Page MenuHomeFreeBSD

Add tunable net.iflib.tx_update_freq to set transmit descriptor update frequency
Needs ReviewPublic

Authored by nc on May 20 2020, 10:25 PM.
Referenced Files
Unknown Object (File)
Feb 26 2024, 3:34 AM
Unknown Object (File)
Jan 12 2024, 10:39 AM
Unknown Object (File)
Dec 23 2023, 11:44 AM
Unknown Object (File)
Dec 23 2023, 8:26 AM
Unknown Object (File)
Dec 23 2023, 3:47 AM
Unknown Object (File)
Dec 20 2023, 7:39 AM
Unknown Object (File)
Dec 20 2023, 2:41 AM
Unknown Object (File)
Oct 20 2023, 9:50 AM

Details

Reviewers
shurd
Group Reviewers
iflib
Summary

Introduce tunable net.iflib.tx_update_freq to allow an user to set the network transmit descriptor update frequency. Previously, this was hardcoded at 16.

Submitted by: Neel Chauhan <neel AT neelc DOT org>

Test Plan

Compile HEAD and reboot.

Set the tunable net.iflib.tx_update_freq, say net.iflib.tx_update_freq=32 whether by sysctl or /boot/loader.conf.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

nc requested review of this revision.May 20 2020, 10:25 PM

Might there be ways to make this run-time tunable, or is it fundamentally not possible even in principle?

nc retitled this revision from Add readonly tunable net.iflib.tx_update_freq to set transmit descriptor update frequency to Add sysctl net.iflib.tx_update_freq to set transmit descriptor update frequency.
nc edited the summary of this revision. (Show Details)
nc edited the test plan for this revision. (Show Details)

I have a new patch making net.iflib.tx_update_freq a sysctl. I attempted to net.iflib.tx_update_freq=32 from 16 (without rebooting!) and it worked.

Luckily with a brand-new and fast dev box, I could compile and test quickly.

In D24937#560621, @neel_neelc.org wrote:

I have a new patch making net.iflib.tx_update_freq a sysctl. I attempted to net.iflib.tx_update_freq=32 from 16 (without rebooting!) and it worked.

Luckily with a brand-new and fast dev box, I could compile and test quickly.

\o/

Thanks Neel!

afedorov added inline comments.
sys/net/iflib.c
2916

I am worried that if the user sets the value to 1, then this will lead to division by zero and to kernel panic. I think additional checks are needed.

gallatin added inline comments.
sys/net/iflib.c
590

Can you please make this a tunable as well? Eg CTLFLAG_RWTUN

nc retitled this revision from Add sysctl net.iflib.tx_update_freq to set transmit descriptor update frequency to Add tunable net.iflib.tx_update_freq to set transmit descriptor update frequency.
nc edited the summary of this revision. (Show Details)
nc edited the test plan for this revision. (Show Details)

Done.

markj added inline comments.
sys/net/iflib.c
589

Note, ift_update_freq has type uint8_t.

592

The description is wrong. From my reading of the code, which may be incorrect, this tunable really controls the number of outstanding buffers queued for transmit before we make them visible to the hardware. It also controls the rate at which the hardware will generate interrupts in response to completed transmits. The precise relationship is hard to explain.

2916

Well, the division is performed first, so the only value that should cause a panic is 0, but yes, we need a sysctl handler to validate this. The tricky thing is that the set of valid values for ift_update_freq depends on the size of the hardware transmit queues, which of course can vary. So it's not clear to me that a global sysctl really makes sense.