net: rename netns_local to netns_immutable
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Fri, 28 Feb 2025 10:20:56 +0000 (11:20 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 4 Mar 2025 11:44:48 +0000 (12:44 +0100)
The name 'netns_local' is confusing. A following commit will export it via
netlink, so let's use a more explicit name.

Reported-by: Eric Dumazet <edumazet@google.com>
Suggested-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
31 files changed:
Documentation/networking/net_cachelines/net_device.rst
Documentation/networking/switchdev.rst
drivers/net/amt.c
drivers/net/bonding/bond_main.c
drivers/net/ethernet/adi/adin1110.c
drivers/net/ethernet/marvell/prestera/prestera_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/rocker/rocker_main.c
drivers/net/ethernet/ti/cpsw_new.c
drivers/net/loopback.c
drivers/net/net_failover.c
drivers/net/team/team_core.c
drivers/net/vrf.c
include/linux/netdevice.h
net/batman-adv/soft-interface.c
net/bridge/br_device.c
net/core/dev.c
net/hsr/hsr_device.c
net/ieee802154/6lowpan/core.c
net/ieee802154/core.c
net/ipv4/ip_tunnel.c
net/ipv4/ipmr.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6mr.c
net/ipv6/sit.c
net/openvswitch/vport-internal_dev.c
net/wireless/core.c
tools/testing/selftests/net/forwarding/README

index 15e31ece675fc4a75fe4a9dc2a2d9d3698c85045..6327e689e8a84c7af9ae5213e9bf9224184c00e9 100644 (file)
@@ -167,7 +167,7 @@ unsigned:1                          wol_enabled
 unsigned:1                          threaded                                                            napi_poll(napi_enable,dev_set_threaded)
 unsigned_long:1                     see_all_hwtstamp_requests
 unsigned_long:1                     change_proto_down
-unsigned_long:1                     netns_local
+unsigned_long:1                     netns_immutable
 unsigned_long:1                     fcoe_mtu
 struct list_head                    net_notifier_list
 struct macsec_ops*                  macsec_ops
index f355f0166f1b4f81be0d8fd9b40b803029e9670c..2966b7122f0509671467e25ae8de54df392a4ebd 100644 (file)
@@ -137,7 +137,7 @@ would be sub-port 0 on port 1 on switch 1.
 Port Features
 ^^^^^^^^^^^^^
 
-dev->netns_local
+dev->netns_immutable
 
 If the switchdev driver (and device) only supports offloading of the default
 network namespace (netns), the driver should set this private flag to prevent
index 53899b70fae1ce056e6f13849c0de476338c48d2..734a0b3242a9bb8975d11b390b323e0e90c87174 100644 (file)
@@ -3099,7 +3099,7 @@ static void amt_link_setup(struct net_device *dev)
        dev->addr_len           = 0;
        dev->priv_flags         |= IFF_NO_QUEUE;
        dev->lltx               = true;
-       dev->netns_local        = true;
+       dev->netns_immutable    = true;
        dev->features           |= NETIF_F_GSO_SOFTWARE;
        dev->hw_features        |= NETIF_F_SG | NETIF_F_HW_CSUM;
        dev->hw_features        |= NETIF_F_FRAGLIST | NETIF_F_RXCSUM;
index 7d98fee5a27f9eba57f864ba9a2d0e8d930b5119..fe7072336e8fdbb9a528fed445a8d3c25a370b9e 100644 (file)
@@ -6025,7 +6025,7 @@ void bond_setup(struct net_device *bond_dev)
        bond_dev->lltx = true;
 
        /* Don't allow bond devices to change network namespaces. */
-       bond_dev->netns_local = true;
+       bond_dev->netns_immutable = true;
 
        /* By default, we declare the bond to be fully
         * VLAN hardware accelerated capable. Special
index 68fad5575fd4f836d4bb985590cd2188306c5be6..30f9d271e59531c08321460a0539c5f1f5e88ac1 100644 (file)
@@ -1599,7 +1599,7 @@ static int adin1110_probe_netdevs(struct adin1110_priv *priv)
                netdev->netdev_ops = &adin1110_netdev_ops;
                netdev->ethtool_ops = &adin1110_ethtool_ops;
                netdev->priv_flags |= IFF_UNICAST_FLT;
-               netdev->netns_local = true;
+               netdev->netns_immutable = true;
 
                port_priv->phydev = get_phy_device(priv->mii_bus, i + 1, false);
                if (IS_ERR(port_priv->phydev)) {
index 8cdecf61253ccad153f859dfe4cc27106c8214ef..71ffb55d1fc4871d06cd08c5424a45d8a1df79cb 100644 (file)
@@ -634,7 +634,7 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
                goto err_dl_port_register;
 
        dev->features |= NETIF_F_HW_TC;
-       dev->netns_local = true;
+       dev->netns_immutable = true;
        dev->netdev_ops = &prestera_netdev_ops;
        dev->ethtool_ops = &prestera_ethtool_ops;
        SET_NETDEV_DEV(dev, sw->dev->dev);
index 7e3aad0151117cb2929f148b4b86968970e03ae7..6eb8642d2e2b1abf15fbccde7880cf5253d2b318 100644 (file)
@@ -4423,9 +4423,9 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
 
        if (mlx5e_is_uplink_rep(priv)) {
                features = mlx5e_fix_uplink_rep_features(netdev, features);
-               netdev->netns_local = true;
+               netdev->netns_immutable = true;
        } else {
-               netdev->netns_local = false;
+               netdev->netns_immutable = false;
        }
 
        mutex_unlock(&priv->state_lock);
index 07f38f472a27965a645a9d336fadbe9625b6c173..2abab241f03bd1526c879bad385e745215545242 100644 (file)
@@ -905,7 +905,7 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev,
 
        netdev->features |= netdev->hw_features;
 
-       netdev->netns_local = true;
+       netdev->netns_immutable = true;
 }
 
 static int mlx5e_init_rep(struct mlx5_core_dev *mdev,
index 1f8362788c7564b26c00db3b255680aeeda4be94..c7e6a325824485e01d34903215782374e8395175 100644 (file)
@@ -1579,7 +1579,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
                            NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
        dev->vlan_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
        dev->lltx = true;
-       dev->netns_local = true;
+       dev->netns_immutable = true;
 
        dev->min_mtu = ETH_MIN_MTU;
        dev->max_mtu = MLXSW_PORT_MAX_MTU - MLXSW_PORT_ETH_FRAME_HDR;
index fe0bf1d3217af2b4d3711adebc3b10b236e001bf..36af94a2e062aac99c59eaf3f385f9e58aab4d0a 100644 (file)
@@ -2576,7 +2576,7 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
        rocker_carrier_init(rocker_port);
 
        dev->features |= NETIF_F_SG;
-       dev->netns_local = true;
+       dev->netns_immutable = true;
 
        /* MTU range: 68 - 9000 */
        dev->min_mtu = ROCKER_PORT_MIN_MTU;
index cec0a90659d9444a8e52689e8baa233c0f7670e8..b01289d4726da213c2a7a18fd2bef72139d948fd 100644 (file)
@@ -1409,7 +1409,7 @@ static int cpsw_create_ports(struct cpsw_common *cpsw)
 
                ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
                                  NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_TC;
-               ndev->netns_local = true;
+               ndev->netns_immutable = true;
 
                ndev->xdp_features = NETDEV_XDP_ACT_BASIC |
                                     NETDEV_XDP_ACT_REDIRECT |
index f1d68153987e1b4d32f25d2ecdd7f88128c19491..201fddcd3b1e86587a2a69408644610d4f74eb70 100644 (file)
@@ -172,7 +172,7 @@ static void gen_lo_setup(struct net_device *dev,
        dev->flags              = IFF_LOOPBACK;
        dev->priv_flags         |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
        dev->lltx               = true;
-       dev->netns_local        = true;
+       dev->netns_immutable    = true;
        netif_keep_dst(dev);
        dev->hw_features        = NETIF_F_GSO_SOFTWARE;
        dev->features           = NETIF_F_SG | NETIF_F_FRAGLIST
index 54c8b9d5b5fcf444d620b99714a6bfd4d3231dcd..5b50d9186f121d7cb85d7f4b70b88000a04905e1 100644 (file)
@@ -734,7 +734,7 @@ struct failover *net_failover_create(struct net_device *standby_dev)
        failover_dev->lltx = true;
 
        /* Don't allow failover devices to change network namespaces. */
-       failover_dev->netns_local = true;
+       failover_dev->netns_immutable = true;
 
        failover_dev->hw_features = FAILOVER_VLAN_FEATURES |
                                    NETIF_F_HW_VLAN_CTAG_TX |
index 78edb8186b6d0fac00aa8b57c4526228e29969c3..fb917560d0a24fb5b909c01345421855f210a5f4 100644 (file)
@@ -2203,7 +2203,7 @@ static void team_setup(struct net_device *dev)
        dev->lltx = true;
 
        /* Don't allow team devices to change network namespaces. */
-       dev->netns_local = true;
+       dev->netns_immutable = true;
 
        dev->features |= NETIF_F_GRO;
 
index 849c3ced2690ece4501bd7e7f0d6044675103a4d..36cf6191335ea3b1309d3506dc5a561982e52cd2 100644 (file)
@@ -1617,7 +1617,7 @@ static void vrf_setup(struct net_device *dev)
        dev->lltx = true;
 
        /* don't allow vrf devices to change network namespaces. */
-       dev->netns_local = true;
+       dev->netns_immutable = true;
 
        /* does not make sense for a VLAN to be added to a vrf device */
        dev->features   |= NETIF_F_VLAN_CHALLENGED;
index 26a0c4e4d963debf28f4f34518d56e4b10f7984b..b8728d67ea91d99cc0fc3836e0d8f02ad4f3674f 100644 (file)
@@ -2021,7 +2021,7 @@ enum netdev_reg_state {
  *                     regardless of source, even if those aren't
  *                     HWTSTAMP_SOURCE_NETDEV
  *     @change_proto_down: device supports setting carrier via IFLA_PROTO_DOWN
- *     @netns_local: interface can't change network namespaces
+ *     @netns_immutable: interface can't change network namespaces
  *     @fcoe_mtu:      device supports maximum FCoE MTU, 2158 bytes
  *
  *     @net_notifier_list:     List of per-net netdev notifier block
@@ -2429,7 +2429,7 @@ struct net_device {
        /* priv_flags_slow, ungrouped to save space */
        unsigned long           see_all_hwtstamp_requests:1;
        unsigned long           change_proto_down:1;
-       unsigned long           netns_local:1;
+       unsigned long           netns_immutable:1;
        unsigned long           fcoe_mtu:1;
 
        struct list_head        net_notifier_list;
index d893c80132616aa03c00dfe8de89b89607cd5228..e190fa954f228ebe54dd1077d4809992bd1b8e98 100644 (file)
@@ -1037,7 +1037,7 @@ static void batadv_softif_init_early(struct net_device *dev)
        dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
        dev->priv_flags |= IFF_NO_QUEUE;
        dev->lltx = true;
-       dev->netns_local = true;
+       dev->netns_immutable = true;
 
        /* can't call min_mtu, because the needed variables
         * have not been initialized yet
index 0ab4613aa07ad61784806e20d18836307bc33feb..9d8c72ed01aba3571527fa59a6c5f9874e467233 100644 (file)
@@ -488,7 +488,7 @@ void br_dev_setup(struct net_device *dev)
        SET_NETDEV_DEVTYPE(dev, &br_type);
        dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
        dev->lltx = true;
-       dev->netns_local = true;
+       dev->netns_immutable = true;
 
        dev->features = COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
                        NETIF_F_HW_VLAN_STAG_TX;
index d6d68a2d2355a2450d6e9f874666bd40ad3b6e75..357ae88064a5fa25489427d9298f7925659742e1 100644 (file)
@@ -12151,7 +12151,7 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net,
 
        /* Don't allow namespace local devices to be moved. */
        err = -EINVAL;
-       if (dev->netns_local)
+       if (dev->netns_immutable)
                goto out;
 
        /* Ensure the device has been registered */
@@ -12533,7 +12533,7 @@ static void __net_exit default_device_exit_net(struct net *net)
                char fb_name[IFNAMSIZ];
 
                /* Ignore unmoveable devices (i.e. loopback) */
-               if (dev->netns_local)
+               if (dev->netns_immutable)
                        continue;
 
                /* Leave virtual devices for the generic cleanup */
index b6fb18469439ae953a86aef4f872f873e0952e50..c6f8614e9ed1fd207d3bddb672ce806e9c7392cb 100644 (file)
@@ -643,7 +643,7 @@ void hsr_dev_setup(struct net_device *dev)
        /* Not sure about this. Taken from bridge code. netdevice.h says
         * it means "Does not change network namespaces".
         */
-       dev->netns_local = true;
+       dev->netns_immutable = true;
 
        dev->needs_free_netdev = true;
 
index ee318d46817d4031bea77abb5b767d64348dfba7..9a9da74b0a4fadbd26860b17bd94fd69aa1ab124 100644 (file)
@@ -116,7 +116,7 @@ static void lowpan_setup(struct net_device *ldev)
        ldev->netdev_ops        = &lowpan_netdev_ops;
        ldev->header_ops        = &lowpan_header_ops;
        ldev->needs_free_netdev = true;
-       ldev->netns_local       = true;
+       ldev->netns_immutable   = true;
 }
 
 static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[],
index 88adb04e407220f3990adf7ea26584716c0ff799..89b671b12600f2dcb5c5aec29e53c562be57dc2e 100644 (file)
@@ -226,11 +226,11 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
        list_for_each_entry(wpan_dev, &rdev->wpan_dev_list, list) {
                if (!wpan_dev->netdev)
                        continue;
-               wpan_dev->netdev->netns_local = false;
+               wpan_dev->netdev->netns_immutable = false;
                err = dev_change_net_namespace(wpan_dev->netdev, net, "wpan%d");
                if (err)
                        break;
-               wpan_dev->netdev->netns_local = true;
+               wpan_dev->netdev->netns_immutable = true;
        }
 
        if (err) {
@@ -242,11 +242,11 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
                                                     list) {
                        if (!wpan_dev->netdev)
                                continue;
-                       wpan_dev->netdev->netns_local = false;
+                       wpan_dev->netdev->netns_immutable = false;
                        err = dev_change_net_namespace(wpan_dev->netdev, net,
                                                       "wpan%d");
                        WARN_ON(err);
-                       wpan_dev->netdev->netns_local = true;
+                       wpan_dev->netdev->netns_immutable = true;
                }
 
                return err;
@@ -291,7 +291,7 @@ static int cfg802154_netdev_notifier_call(struct notifier_block *nb,
        switch (state) {
                /* TODO NETDEV_DEVTYPE */
        case NETDEV_REGISTER:
-               dev->netns_local = true;
+               dev->netns_immutable = true;
                wpan_dev->identifier = ++rdev->wpan_dev_id;
                list_add_rcu(&wpan_dev->list, &rdev->wpan_dev_list);
                rdev->devlist_generation++;
index 011f2a5aab3b9c6862f645da0a665f143a55edfa..4b06dc7e04f2f1f4388c1cf2721e1d0b7f6bf220 100644 (file)
@@ -1162,7 +1162,7 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id,
         * Allowing to move it to another netns is clearly unsafe.
         */
        if (!IS_ERR(itn->fb_tunnel_dev)) {
-               itn->fb_tunnel_dev->netns_local = true;
+               itn->fb_tunnel_dev->netns_immutable = true;
                itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev);
                ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev));
                itn->type = itn->fb_tunnel_dev->type;
index 21ae7594a8525a0df01ce01b801d0075dada0959..b81c8131e23fcfc1420a5caed7db420c6e6443c7 100644 (file)
@@ -563,7 +563,7 @@ static void reg_vif_setup(struct net_device *dev)
        dev->flags              = IFF_NOARP;
        dev->netdev_ops         = &reg_vif_netdev_ops;
        dev->needs_free_netdev  = true;
-       dev->netns_local        = true;
+       dev->netns_immutable    = true;
 }
 
 static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt)
index d31a4ce3b19ffa62d9e9c3381c3308684a28f677..c6ebb6a6d3908e953fcf0eb00bb5370dfd7169f9 100644 (file)
@@ -1620,7 +1620,7 @@ static int __net_init ip6gre_init_net(struct net *net)
        /* FB netdevice is special: we have one, and only one per netns.
         * Allowing to move it to another netns is clearly unsafe.
         */
-       ign->fb_tunnel_dev->netns_local = true;
+       ign->fb_tunnel_dev->netns_immutable = true;
 
        ip6gre_fb_tunnel_init(ign->fb_tunnel_dev);
        ign->fb_tunnel_dev->rtnl_link_ops = &ip6gre_link_ops;
index 89d206731af00684cdc9beeac35f682edb40e467..170a6ac30889a6c9764743665b9f62874e597459 100644 (file)
@@ -2265,7 +2265,7 @@ static int __net_init ip6_tnl_init_net(struct net *net)
        /* FB netdevice is special: we have one, and only one per netns.
         * Allowing to move it to another netns is clearly unsafe.
         */
-       ip6n->fb_tnl_dev->netns_local = true;
+       ip6n->fb_tnl_dev->netns_immutable = true;
 
        err = ip6_fb_tnl_dev_init(ip6n->fb_tnl_dev);
        if (err < 0)
index 535e9f72514c06ad655e46d3200c14298f584d99..e8ade93a0f0ebb14abb0941aae10d56fcb9b8ad9 100644 (file)
@@ -668,7 +668,7 @@ static void reg_vif_setup(struct net_device *dev)
        dev->flags              = IFF_NOARP;
        dev->netdev_ops         = &reg_vif_netdev_ops;
        dev->needs_free_netdev  = true;
-       dev->netns_local        = true;
+       dev->netns_immutable    = true;
 }
 
 static struct net_device *ip6mr_reg_vif(struct net *net, struct mr_table *mrt)
index f7b59bc957d3bb1f7bc6aeb12887bc9b0c9eb9f4..6f04703fe638653367cd76ac6125c911b08e8fef 100644 (file)
@@ -1859,7 +1859,7 @@ static int __net_init sit_init_net(struct net *net)
        /* FB netdevice is special: we have one, and only one per netns.
         * Allowing to move it to another netns is clearly unsafe.
         */
-       sitn->fb_tunnel_dev->netns_local = true;
+       sitn->fb_tunnel_dev->netns_immutable = true;
 
        t = netdev_priv(sitn->fb_tunnel_dev);
        t->net = net;
index 2412d7813d244c66ffd926b8677b26cd85be8fd5..125d310871e93ecfa785349d41ed6006340ea696 100644 (file)
@@ -149,7 +149,7 @@ static struct vport *internal_dev_create(const struct vport_parms *parms)
 
        /* Restrict bridge port to current netns. */
        if (vport->port_no == OVSP_LOCAL)
-               vport->dev->netns_local = true;
+               vport->dev->netns_immutable = true;
 
        rtnl_lock();
        err = register_netdevice(vport->dev);
index 12b780de8779ce656a2ce78ae9d3886ab2924fbd..15bbc9d06c9e98958cd8dc2a45a5fa4424c85b6c 100644 (file)
@@ -162,11 +162,11 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
        list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
                if (!wdev->netdev)
                        continue;
-               wdev->netdev->netns_local = false;
+               wdev->netdev->netns_immutable = false;
                err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
                if (err)
                        break;
-               wdev->netdev->netns_local = true;
+               wdev->netdev->netns_immutable = true;
        }
 
        if (err) {
@@ -178,11 +178,11 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
                                                     list) {
                        if (!wdev->netdev)
                                continue;
-                       wdev->netdev->netns_local = false;
+                       wdev->netdev->netns_immutable = false;
                        err = dev_change_net_namespace(wdev->netdev, net,
                                                        "wlan%d");
                        WARN_ON(err);
-                       wdev->netdev->netns_local = true;
+                       wdev->netdev->netns_immutable = true;
                }
 
                return err;
@@ -1513,7 +1513,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                SET_NETDEV_DEVTYPE(dev, &wiphy_type);
                wdev->netdev = dev;
                /* can only change netns with wiphy */
-               dev->netns_local = true;
+               dev->netns_immutable = true;
 
                cfg80211_init_wdev(wdev);
                break;
index a652429bfd53cd654bdb65f204c4ac5ac28ff4d9..7b41cff993adb0f32a7ab313b2b170980f428375 100644 (file)
@@ -6,7 +6,7 @@ to easily create and test complex environments.
 
 Unfortunately, these namespaces can not be used with actual switching
 ASICs, as their ports can not be migrated to other network namespaces
-(dev->netns_local) and most of them probably do not support the
+(dev->netns_immutable) and most of them probably do not support the
 L1-separation provided by namespaces.
 
 However, a similar kind of flexibility can be achieved by using VRFs and