Skip to content

Commit a672f9b

Browse files
committed
netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local
JIRA: https://issues.redhat.com/browse/RHEL-59091 commit 05c1280 Author: Alexander Lobakin <aleksander.lobakin@intel.com> Date: Thu Aug 29 14:33:38 2024 +0200 netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local "Interface can't change network namespaces" is rather an attribute, not a feature, and it can't be changed via Ethtool. Make it a "cold" private flag instead of a netdev_feature and free one more bit. Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Conflicts: drivers/net/amt.c drivers/net/ethernet/adi/adin1110.c Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
1 parent 555cb3d commit a672f9b

File tree

32 files changed

+59
-60
lines changed

32 files changed

+59
-60
lines changed

Documentation/networking/net_cachelines/net_device.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ unsigned:1 wol_enabled
166166
unsigned:1 threaded - - napi_poll(napi_enable,dev_set_threaded)
167167
unsigned_long:1 see_all_hwtstamp_requests
168168
unsigned_long:1 change_proto_down
169+
unsigned_long:1 netns_local
169170
struct_list_head net_notifier_list
170171
struct_macsec_ops* macsec_ops
171172
struct_udp_tunnel_nic_info* udp_tunnel_nic_info

Documentation/networking/netdev-features.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,6 @@ chained skbs (skb->next/prev list).
139139
Features contained in NETIF_F_SOFT_FEATURES are features of networking
140140
stack. Driver should not change behaviour based on them.
141141

142-
* netns-local device
143-
144-
NETIF_F_NETNS_LOCAL is set for devices that are not allowed to move between
145-
network namespaces (e.g. loopback).
146-
147-
Don't use it in drivers.
148-
149142
* VLAN challenged
150143

151144
NETIF_F_VLAN_CHALLENGED should be set for devices which can't cope with VLAN

Documentation/networking/switchdev.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ would be sub-port 0 on port 1 on switch 1.
137137
Port Features
138138
^^^^^^^^^^^^^
139139

140-
NETIF_F_NETNS_LOCAL
140+
dev->netns_local
141141

142142
If the switchdev driver (and device) only supports offloading of the default
143-
network namespace (netns), the driver should set this feature flag to prevent
143+
network namespace (netns), the driver should set this private flag to prevent
144144
the port netdev from being moved out of the default netns. A netns-aware
145145
driver/device would not set this flag and be responsible for partitioning
146146
hardware to preserve netns containment. This means hardware cannot forward

drivers/net/bonding/bond_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5897,16 +5897,16 @@ void bond_setup(struct net_device *bond_dev)
58975897
/* don't acquire bond device's netif_tx_lock when transmitting */
58985898
bond_dev->lltx = true;
58995899

5900+
/* Don't allow bond devices to change network namespaces. */
5901+
bond_dev->netns_local = true;
5902+
59005903
/* By default, we declare the bond to be fully
59015904
* VLAN hardware accelerated capable. Special
59025905
* care is taken in the various xmit functions
59035906
* when there are slaves that are not hw accel
59045907
* capable
59055908
*/
59065909

5907-
/* Don't allow bond devices to change network namespaces. */
5908-
bond_dev->features |= NETIF_F_NETNS_LOCAL;
5909-
59105910
bond_dev->hw_features = BOND_VLAN_FEATURES |
59115911
NETIF_F_HW_VLAN_CTAG_RX |
59125912
NETIF_F_HW_VLAN_CTAG_FILTER |

drivers/net/ethernet/marvell/prestera/prestera_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
315315
if (err)
316316
goto err_dl_port_register;
317317

318-
dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC;
318+
dev->features |= NETIF_F_HW_TC;
319+
dev->netns_local = true;
319320
dev->netdev_ops = &prestera_netdev_ops;
320321
dev->ethtool_ops = &prestera_ethtool_ops;
321322
SET_NETDEV_DEVLINK_PORT(dev, &port->dl_port);

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4222,9 +4222,9 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
42224222

42234223
if (mlx5e_is_uplink_rep(priv)) {
42244224
features = mlx5e_fix_uplink_rep_features(netdev, features);
4225-
features |= NETIF_F_NETNS_LOCAL;
4225+
netdev->netns_local = true;
42264226
} else {
4227-
features &= ~NETIF_F_NETNS_LOCAL;
4227+
netdev->netns_local = false;
42284228
}
42294229

42304230
mutex_unlock(&priv->state_lock);

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev,
866866
netdev->hw_features |= NETIF_F_RXCSUM;
867867

868868
netdev->features |= netdev->hw_features;
869-
netdev->features |= NETIF_F_NETNS_LOCAL;
869+
870+
netdev->netns_local = true;
870871
}
871872

872873
static int mlx5e_init_rep(struct mlx5_core_dev *mdev,

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,10 +1691,11 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
16911691

16921692
netif_carrier_off(dev);
16931693

1694-
dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG |
1695-
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
1694+
dev->features |= NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_FILTER |
1695+
NETIF_F_HW_TC;
16961696
dev->hw_features |= NETIF_F_HW_TC | NETIF_F_LOOPBACK;
16971697
dev->lltx = true;
1698+
dev->netns_local = true;
16981699

16991700
dev->min_mtu = 0;
17001701
dev->max_mtu = ETH_MAX_MTU;

drivers/net/ethernet/rocker/rocker_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,8 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
25752575
netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx);
25762576
rocker_carrier_init(rocker_port);
25772577

2578-
dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG;
2578+
dev->features |= NETIF_F_SG;
2579+
dev->netns_local = true;
25792580

25802581
/* MTU range: 68 - 9000 */
25812582
dev->min_mtu = ROCKER_PORT_MIN_MTU;

drivers/net/ethernet/ti/cpsw_new.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,8 @@ static int cpsw_create_ports(struct cpsw_common *cpsw)
14041404
cpsw->slaves[i].ndev = ndev;
14051405

14061406
ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
1407-
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC;
1407+
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_TC;
1408+
ndev->netns_local = true;
14081409

14091410
ndev->netdev_ops = &cpsw_netdev_ops;
14101411
ndev->ethtool_ops = &cpsw_ethtool_ops;

0 commit comments

Comments
 (0)