Bug 254884 - [if_smsc] Add ability to disable "turbo_mode" (RX frames batching) similar to linux driver
Summary: [if_smsc] Add ability to disable "turbo_mode" (RX frames batching) similar to...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Only Me
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-08 12:15 UTC by Oleg Sidorkin
Modified: 2021-05-10 14:33 UTC (History)
2 users (show)

See Also:


Attachments
Patch to add ability to disable "turbo mode" in if_smsc (1.54 KB, patch)
2021-04-08 12:15 UTC, Oleg Sidorkin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Sidorkin 2021-04-08 12:15:04 UTC
Created attachment 223924 [details]
Patch to add ability to disable "turbo mode" in if_smsc

"turbo  mode" makes chip to wait a while before transferring the frame in case there are some other frames. This increases both throughput and rtt.

Linux driver has module param to disable batching if necessary.

Attached patch adds similar flag to freebsd driver.
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2021-04-08 12:20:15 UTC
Patch looks good. Do you have someone to commit it?

--HPS
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2021-04-08 12:21:24 UTC
Can you also post the numbers you see using iperf?

--HPS
Comment 3 Oleg Sidorkin 2021-04-08 13:17:59 UTC
(In reply to Hans Petter Selasky from comment #1)

No :)

(In reply to Hans Petter Selasky from comment #2)

Iperf3:
Turbo off:
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.01   sec  1.80 MBytes  14.9 Mbits/sec   22   60.8 KBytes
[  5]   1.01-2.00   sec  4.27 MBytes  36.3 Mbits/sec   50   21.3 KBytes
[  5]   2.00-3.00   sec  4.31 MBytes  36.2 Mbits/sec   43   19.8 KBytes
[  5]   3.00-4.00   sec  2.36 MBytes  19.8 Mbits/sec   37   60.8 KBytes
[  5]   4.00-5.00   sec  1.44 MBytes  12.1 Mbits/sec   40   2.84 KBytes
[  5]   5.00-6.01   sec  1.91 MBytes  15.9 Mbits/sec   42   48.1 KBytes
[  5]   6.01-7.00   sec  3.08 MBytes  26.0 Mbits/sec   48   14.1 KBytes
[  5]   7.00-8.01   sec  3.59 MBytes  29.9 Mbits/sec   43   60.8 KBytes
[  5]   8.01-9.00   sec  2.62 MBytes  22.1 Mbits/sec   45   18.4 KBytes
[  5]   9.00-10.00  sec  1.89 MBytes  15.9 Mbits/sec   43   1.41 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  27.3 MBytes  22.9 Mbits/sec  413             sender
[  5]   0.00-10.00  sec  27.2 MBytes  22.8 Mbits/sec                  receiver


Turbo on:
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  7.27 MBytes  61.0 Mbits/sec   34   31.2 KBytes
[  5]   1.00-2.00   sec  7.54 MBytes  63.2 Mbits/sec   33   36.9 KBytes
[  5]   2.00-3.00   sec  7.53 MBytes  63.2 Mbits/sec   36   21.2 KBytes
[  5]   3.00-4.00   sec  7.57 MBytes  63.5 Mbits/sec   33   26.9 KBytes
[  5]   4.00-5.00   sec  7.49 MBytes  62.9 Mbits/sec   34   35.5 KBytes
[  5]   5.00-6.00   sec  7.48 MBytes  62.8 Mbits/sec   33   36.9 KBytes
[  5]   6.00-7.00   sec  7.46 MBytes  62.6 Mbits/sec   36   5.66 KBytes
[  5]   7.00-8.00   sec  7.56 MBytes  63.4 Mbits/sec   35   25.5 KBytes
[  5]   8.00-9.00   sec  7.53 MBytes  63.1 Mbits/sec   34   32.6 KBytes
[  5]   9.00-10.00  sec  7.44 MBytes  62.4 Mbits/sec   35   36.9 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  74.9 MBytes  62.8 Mbits/sec  343             sender
[  5]   0.00-10.01  sec  74.8 MBytes  62.7 Mbits/sec                  receiver

Ping:
Turbo off:
21 packets transmitted, 21 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.344/0.432/0.558/0.057 ms

Turbo on:
21 packets transmitted, 21 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.425/0.581/0.676/0.085 ms
Comment 4 Bertrand Petit 2021-04-08 13:38:25 UTC
This contribution is very welcome, I foresee a positive impact on ntp servers: it will improve jitter. Will it be applied to stable branches?
Comment 5 Hans Petter Selasky freebsd_committer freebsd_triage 2021-04-08 13:48:19 UTC
Yes, it can be MFC'ed from what I see.

I'll have a look at it tomorrow if nobody else grabs it :-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-04-11 18:28:12 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a3426f453f970edda38367bea5ebf7385c3819d

commit 5a3426f453f970edda38367bea5ebf7385c3819d
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-04-11 18:24:41 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-04-11 18:25:58 +0000

    if_smsc: Add the ability to disable "turbo_mode", also called RX frame batching,
    similarly to the Linux driver, by a tunable read only sysctl.

    Submitted by:   Oleg Sidorkin <osidorkin@gmail.com>
    PR:             254884
    MFC after:      1 week
    Sponsored by:   Mellanox Technologies // NVIDIA Networking

 sys/dev/usb/net/if_smsc.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-05-10 14:33:08 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9312bcb2e9f6c13b99b52bb3d4e2a31c95c3076a

commit 9312bcb2e9f6c13b99b52bb3d4e2a31c95c3076a
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-04-11 18:24:41 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-05-10 14:11:19 +0000

    if_smsc: Add the ability to disable "turbo_mode", also called RX frame batching,
    similarly to the Linux driver, by a tunable read only sysctl.

    Submitted by:   Oleg Sidorkin <osidorkin@gmail.com>
    PR:             254884
    Sponsored by:   Mellanox Technologies // NVIDIA Networking

    (cherry picked from commit 5a3426f453f970edda38367bea5ebf7385c3819d)

 sys/dev/usb/net/if_smsc.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)