Skip to content

zperf time handling fixes #30237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2020
Merged

zperf time handling fixes #30237

merged 2 commits into from
Dec 1, 2020

Conversation

jukkar
Copy link
Member

@jukkar jukkar commented Nov 25, 2020

Converted the code to use usec accuracy time functions that the kernel provides currently.
Also noticed IP address setting issue when testing the changes.

Copy link
Collaborator

@pabigot pabigot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments related to upcoming restrictions of use of internal API, and signed/unsigned nit-picks. I wish absolute times in ticks were represented as unsigned, but they're not.

Currently the code uses hw cycles and tries to convert them
to usec. I noticed some failures with this, for example the test
duration was sometimes missed meaning that instead of testing 5
seconds, we bailed out after 2 sec etc. After the kernel k_timeout_t
changes, which added APIs to support usec accuracy, we can use usec
and ticks here. This simplifies the code a bit.

Signed-off-by: Jukka Rissanen <[email protected]>
If user has enabled DHCPv4, then allow to use its address instead
of giving error if static address cannot be set. Similar fix for
IPv6, so allow user to manually set an IPv6 address.

Because DHCPv4 has already set the IPv4 address to the network
interface, then zperf might not be able to add the pre-configured
address to it. So instead of returning immediately, try to use the
IP address that is already in the network interface. This way we
avoid this error print.

  uart:~$ zperf udp download 5001

  Setting IP address 2001:db8::1
  Setting destination IP address 2001:db8::2
  Cannot set IPv4 address 192.0.2.1
  Unable to set IP
  Setting destination IP address 192.0.2.2

  Cannot set IPv4 address 192.0.2.1
  Unable to set IPv4
  Binding to 192.0.2.1
  Cannot bind IPv4 UDP port 5001 (-2)

In this example, the network interface already had a proper and working
IPv4 address 192.168.0.2 in it.

Signed-off-by: Jukka Rissanen <[email protected]>
@jukkar
Copy link
Member Author

jukkar commented Dec 1, 2020

Updated according to comments.

@jukkar
Copy link
Member Author

jukkar commented Dec 1, 2020

I wish absolute times in ticks were represented as unsigned, but they're not.

I agree, the fact that some of the ticks/time/timeout functions use signed and some unsigned is quite confusing.

@jukkar jukkar merged commit 9028ecb into zephyrproject-rtos:master Dec 1, 2020
@jukkar jukkar deleted the zperf branch December 1, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants