Re: [PATCH net-next v3 2/5] net: add sysfs attribute to control napi threaded mode
From: Wei Wang <hidden>
Date: 2020-11-18 21:20:51
On Wed, Nov 18, 2020 at 12:36 PM Randy Dunlap [off-list ref] wrote:
On 11/18/20 11:10 AM, Wei Wang wrote:quoted
From: Paolo Abeni <pabeni@redhat.com> this patch adds a new sysfs attribute to the network device class. Said attribute is a bitmask that allows controlling the threaded mode for all the napi instances of the given network device. The threaded mode can be switched only if related network device is down. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Hannes Frederic Sowa <redacted> Signed-off-by: Wei Wang <redacted> Reviewed-by: Eric Dumazet <edumazet@google.com>Hi, Could someone describe the bitmask (is it a bit per instance of the network device?). And how to use the sysfs interface, please?
It is 1 bit per napi. Depending on the driver implementation, 1 napi could correspond to 1 tx queue, or 1 rx queue, or 1 pair of tx/rx queues. To set bits in the bit mask, you could do: echo 0-14 > /sys/class/net/<dev>/threaded to set consecutive bits. or: echo 0,2,4,6,8 > /sys/class/net/<dev>/threaded to set individual bits. To clear the bit mask, you could do: echo > /sys/class/net/<dev>/threaded
quoted
--- net/core/net-sysfs.c | 103 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+)diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 94fff0700bdd..df8dd25e5e4b 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.cthanks. -- ~Randy