mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-03 08:14:12 +00:00
xdp: double protect netdev->xdp_flags with netdev->lock
Protect xdp_features with netdev->lock. This way pure readers no longer have to take rtnl_lock to access the field. This includes calling NETDEV_XDP_FEAT_CHANGE under the lock. Looks like that's fine for bonding, the only "real" listener, it's the same as ethtool feature change. In terms of normal drivers - only GVE need special consideration (other drivers don't use instance lock or don't support XDP). It calls xdp_set_features_flag() helper from gve_init_priv() which in turn is called from gve_reset_recovery() (locked), or prior to netdev registration. So switch to _locked. Reviewed-by: Joe Damato <jdamato@fastly.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Acked-by: Harshitha Ramamurthy <hramamurthy@google.com> Acked-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://patch.msgid.link/20250408195956.412733-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -20,6 +20,7 @@ int netdev_debug_event(struct notifier_block *nb, unsigned long event,
|
||||
switch (cmd) {
|
||||
case NETDEV_REGISTER:
|
||||
case NETDEV_UP:
|
||||
case NETDEV_XDP_FEAT_CHANGE:
|
||||
netdev_ops_assert_locked(dev);
|
||||
fallthrough;
|
||||
case NETDEV_DOWN:
|
||||
@@ -58,7 +59,6 @@ int netdev_debug_event(struct notifier_block *nb, unsigned long event,
|
||||
case NETDEV_OFFLOAD_XSTATS_DISABLE:
|
||||
case NETDEV_OFFLOAD_XSTATS_REPORT_USED:
|
||||
case NETDEV_OFFLOAD_XSTATS_REPORT_DELTA:
|
||||
case NETDEV_XDP_FEAT_CHANGE:
|
||||
ASSERT_RTNL();
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user