diff options
author | Paolo Abeni <pabeni@redhat.com> | 2023-02-07 19:44:57 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-02-09 17:45:55 -0800 |
commit | 605cfa1b1090b5d9e227d8a8f7d08fdd04f07724 (patch) | |
tree | 83e0dd63d02fee996caee33f2c76d5142b170e18 /net/core/net-sysfs.c | |
parent | 370ca718fd5e1fd45ccfdf7a9d76d010f561e607 (diff) | |
download | lwn-605cfa1b1090b5d9e227d8a8f7d08fdd04f07724.tar.gz lwn-605cfa1b1090b5d9e227d8a8f7d08fdd04f07724.zip |
net: introduce default_rps_mask netns attribute
If RPS is enabled, this allows configuring a default rps
mask, which is effective since receive queue creation time.
A default RPS mask allows the system admin to ensure proper
isolation, avoiding races at network namespace or device
creation time.
The default RPS mask is initially empty, and can be
modified via a newly added sysctl entry.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 2126970a4bfd..4b361ac6a252 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1083,6 +1083,13 @@ static int rx_queue_add_kobject(struct net_device *dev, int index) goto err; } +#if IS_ENABLED(CONFIG_RPS) && IS_ENABLED(CONFIG_SYSCTL) + if (!cpumask_empty(&rps_default_mask)) { + error = netdev_rx_queue_set_rps_mask(queue, &rps_default_mask); + if (error) + goto err; + } +#endif kobject_uevent(kobj, KOBJ_ADD); return error; |