]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Thu, 29 Aug 2024 12:33:38 +0000 (14:33 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 3 Sep 2024 09:36:43 +0000 (11:36 +0200)
"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>
34 files changed:
Documentation/networking/net_cachelines/net_device.rst
Documentation/networking/netdev-features.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/netdev_features.h
include/linux/netdevice.h
net/batman-adv/soft-interface.c
net/bridge/br_device.c
net/core/dev.c
net/ethtool/common.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 e5531927707453d776bbb8468a11943285d9f395..e649d8e9556f5626fc8c5bb7d1393501e8836407 100644 (file)
@@ -166,6 +166,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                                                     
 struct_list_head                    net_notifier_list                                               
 struct_macsec_ops*                  macsec_ops                                                      
 struct_udp_tunnel_nic_info*         udp_tunnel_nic_info                                             
index f29d982ebf5d3bc40f4de94530167c1fd251af80..5014f7cc1398baf195f06a14026609b38ee359c2 100644 (file)
@@ -139,13 +139,6 @@ chained skbs (skb->next/prev list).
 Features contained in NETIF_F_SOFT_FEATURES are features of networking
 stack. Driver should not change behaviour based on them.
 
- * netns-local device
-
-NETIF_F_NETNS_LOCAL is set for devices that are not allowed to move between
-network namespaces (e.g. loopback).
-
-Don't use it in drivers.
-
  * VLAN challenged
 
 NETIF_F_VLAN_CHALLENGED should be set for devices which can't cope with VLAN
index 758f1dae3fce2071b130db775d9d73aeca4af214..f355f0166f1b4f81be0d8fd9b40b803029e9670c 100644 (file)
@@ -137,10 +137,10 @@ would be sub-port 0 on port 1 on switch 1.
 Port Features
 ^^^^^^^^^^^^^
 
-NETIF_F_NETNS_LOCAL
+dev->netns_local
 
 If the switchdev driver (and device) only supports offloading of the default
-network namespace (netns), the driver should set this feature flag to prevent
+network namespace (netns), the driver should set this private flag to prevent
 the port netdev from being moved out of the default netns.  A netns-aware
 driver/device would not set this flag and be responsible for partitioning
 hardware to preserve netns containment.  This means hardware cannot forward
index 921bbfd72a3868c604777331eb1bd9cc06d02d1f..0433a0f36d1b4e3a98b1b5d6b1b631665b2de6fb 100644 (file)
@@ -3099,8 +3099,8 @@ 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->features           |= NETIF_F_GSO_SOFTWARE;
-       dev->features           |= NETIF_F_NETNS_LOCAL;
        dev->hw_features        |= NETIF_F_SG | NETIF_F_HW_CSUM;
        dev->hw_features        |= NETIF_F_FRAGLIST | NETIF_F_RXCSUM;
        dev->hw_features        |= NETIF_F_GSO_SOFTWARE;
index 8ae887cdc231b1f6676068e1bbecdd715fb524a0..f13d413ad26c4ea6996ea1d4b10b47756e688160 100644 (file)
@@ -5930,6 +5930,9 @@ void bond_setup(struct net_device *bond_dev)
        /* don't acquire bond device's netif_tx_lock when transmitting */
        bond_dev->lltx = true;
 
+       /* Don't allow bond devices to change network namespaces. */
+       bond_dev->netns_local = true;
+
        /* By default, we declare the bond to be fully
         * VLAN hardware accelerated capable. Special
         * care is taken in the various xmit functions
@@ -5937,9 +5940,6 @@ void bond_setup(struct net_device *bond_dev)
         * capable
         */
 
-       /* Don't allow bond devices to change network namespaces. */
-       bond_dev->features |= NETIF_F_NETNS_LOCAL;
-
        bond_dev->hw_features = BOND_VLAN_FEATURES |
                                NETIF_F_HW_VLAN_CTAG_RX |
                                NETIF_F_HW_VLAN_CTAG_FILTER |
index 0713f1e2c7f38b5194e186ee6c5bdb21bf0a66b4..3431a7e62b0d2b3341be59a5e687b5ee9ff3354c 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->features |= NETIF_F_NETNS_LOCAL;
+               netdev->netns_local = true;
 
                port_priv->phydev = get_phy_device(priv->mii_bus, i + 1, false);
                if (IS_ERR(port_priv->phydev)) {
index 63ae01954dfc5e049615b7322322699cb166ff0f..22ca6ee9665eb41cd4ea3acbe9122b063908afbb 100644 (file)
@@ -633,7 +633,8 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
        if (err)
                goto err_dl_port_register;
 
-       dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC;
+       dev->features |= NETIF_F_HW_TC;
+       dev->netns_local = true;
        dev->netdev_ops = &prestera_netdev_ops;
        dev->ethtool_ops = &prestera_ethtool_ops;
        SET_NETDEV_DEV(dev, sw->dev->dev);
index 16b67c457b605739ede6dd9b7423ca48d05cfc1e..47e7a80d221be8a6497e606e535f65fcb11fec7b 100644 (file)
@@ -4414,9 +4414,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);
-               features |= NETIF_F_NETNS_LOCAL;
+               netdev->netns_local = true;
        } else {
-               features &= ~NETIF_F_NETNS_LOCAL;
+               netdev->netns_local = false;
        }
 
        mutex_unlock(&priv->state_lock);
index b885042eef14229d9537bc5db71e539e65eb9c2b..92094bf60d5986a4e6139c123f2a1f26fcb6b93f 100644 (file)
@@ -898,7 +898,8 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev,
        netdev->hw_features    |= NETIF_F_RXCSUM;
 
        netdev->features |= netdev->hw_features;
-       netdev->features |= NETIF_F_NETNS_LOCAL;
+
+       netdev->netns_local = true;
 }
 
 static int mlx5e_init_rep(struct mlx5_core_dev *mdev,
index 44d6e125bd6f003b7b1a2aa5645c38412b8608fd..b9ffd7236aff8168ef719e30f87ddbeeb68689c1 100644 (file)
@@ -1676,10 +1676,11 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
 
        netif_carrier_off(dev);
 
-       dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG |
-                        NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
+       dev->features |= NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_FILTER |
+                        NETIF_F_HW_TC;
        dev->hw_features |= NETIF_F_HW_TC | NETIF_F_LOOPBACK;
        dev->lltx = true;
+       dev->netns_local = true;
 
        dev->min_mtu = ETH_MIN_MTU;
        dev->max_mtu = MLXSW_PORT_MAX_MTU - MLXSW_PORT_ETH_FRAME_HDR;
index e097ce3e69ea3b40b4a529b42c97a7915968f77e..84fa911c78db55d9dd2fd1f93a56440fcc373bec 100644 (file)
@@ -2575,7 +2575,8 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
        netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx);
        rocker_carrier_init(rocker_port);
 
-       dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG;
+       dev->features |= NETIF_F_SG;
+       dev->netns_local = true;
 
        /* MTU range: 68 - 9000 */
        dev->min_mtu = ROCKER_PORT_MIN_MTU;
index 2baa198ebfa090e533dee7d5f72c7ebff8894b7e..557cc71b9dd22ce517001283ba0d538006cb4009 100644 (file)
@@ -1407,7 +1407,8 @@ static int cpsw_create_ports(struct cpsw_common *cpsw)
                cpsw->slaves[i].ndev = ndev;
 
                ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
-                                 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC;
+                                 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_TC;
+               ndev->netns_local = true;
 
                ndev->xdp_features = NETDEV_XDP_ACT_BASIC |
                                     NETDEV_XDP_ACT_REDIRECT |
index bf857782be0ff3ee8eb9ea43bc2163970458bbb7..1993b90b1a5f90ef150466665d97f5bee273092b 100644 (file)
@@ -172,6 +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;
        netif_keep_dst(dev);
        dev->hw_features        = NETIF_F_GSO_SOFTWARE;
        dev->features           = NETIF_F_SG | NETIF_F_FRAGLIST
@@ -180,7 +181,6 @@ static void gen_lo_setup(struct net_device *dev,
                | NETIF_F_RXCSUM
                | NETIF_F_SCTP_CRC
                | NETIF_F_HIGHDMA
-               | NETIF_F_NETNS_LOCAL
                | NETIF_F_VLAN_CHALLENGED
                | NETIF_F_LOOPBACK;
        dev->ethtool_ops        = eth_ops;
index 06728385a35fb258af61e853da5fcdf4ea5ca1a1..54c8b9d5b5fcf444d620b99714a6bfd4d3231dcd 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->features |= NETIF_F_NETNS_LOCAL;
+       failover_dev->netns_local = true;
 
        failover_dev->hw_features = FAILOVER_VLAN_FEATURES |
                                    NETIF_F_HW_VLAN_CTAG_TX |
index 1d1bad3cedc2d762d1f0e50f184e2f4e29b0dd9a..18191d5a8bd4d37000fcbae27ab6bb26802762a3 100644 (file)
@@ -2191,10 +2191,10 @@ static void team_setup(struct net_device *dev)
        dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
        dev->lltx = true;
 
-       dev->features |= NETIF_F_GRO;
-
        /* Don't allow team devices to change network namespaces. */
-       dev->features |= NETIF_F_NETNS_LOCAL;
+       dev->netns_local = true;
+
+       dev->features |= NETIF_F_GRO;
 
        dev->hw_features = TEAM_VLAN_FEATURES |
                           NETIF_F_HW_VLAN_CTAG_RX |
index b1d4ef538995eff249d5cf60be699c281b7e96a8..4d8ccaf9a2b4d3f9bf677c00608ee5c6f18d78de 100644 (file)
@@ -1638,7 +1638,7 @@ static void vrf_setup(struct net_device *dev)
        dev->lltx = true;
 
        /* don't allow vrf devices to change network namespaces. */
-       dev->features |= NETIF_F_NETNS_LOCAL;
+       dev->netns_local = true;
 
        /* does not make sense for a VLAN to be added to a vrf device */
        dev->features   |= NETIF_F_VLAN_CHALLENGED;
index a2e20b5175841b65d15d59e3d2bb43c3d7dbc9ed..d5a3836f4793dc835880c2f5ef4615c340b53478 100644 (file)
@@ -25,7 +25,7 @@ enum {
        NETIF_F_VLAN_CHALLENGED_BIT,    /* Device cannot handle VLAN packets */
        NETIF_F_GSO_BIT,                /* Enable software GSO. */
        __UNUSED_NETIF_F_12,
-       NETIF_F_NETNS_LOCAL_BIT,        /* Does not change network namespaces */
+       __UNUSED_NETIF_F_13,
        NETIF_F_GRO_BIT,                /* Generic receive offload */
        NETIF_F_LRO_BIT,                /* large receive offload */
 
@@ -121,7 +121,6 @@ enum {
 #define NETIF_F_IPV6_CSUM      __NETIF_F(IPV6_CSUM)
 #define NETIF_F_LOOPBACK       __NETIF_F(LOOPBACK)
 #define NETIF_F_LRO            __NETIF_F(LRO)
-#define NETIF_F_NETNS_LOCAL    __NETIF_F(NETNS_LOCAL)
 #define NETIF_F_NOCACHE_COPY   __NETIF_F(NOCACHE_COPY)
 #define NETIF_F_NTUPLE         __NETIF_F(NTUPLE)
 #define NETIF_F_RXCSUM         __NETIF_F(RXCSUM)
@@ -190,8 +189,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
-#define NETIF_F_NEVER_CHANGE   (NETIF_F_VLAN_CHALLENGED | \
-                                NETIF_F_NETNS_LOCAL)
+#define NETIF_F_NEVER_CHANGE   NETIF_F_VLAN_CHALLENGED
 
 /* remember that ((t)1 << t_BITS) is undefined in C99 */
 #define NETIF_F_ETHTOOL_BITS   ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \
index e22ca5e0749029435e06d1f63f06267053e735c0..a698e2402420c8fcdd7775f2503afd05eed4a08c 100644 (file)
@@ -1968,6 +1968,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
  *
  *     @net_notifier_list:     List of per-net netdev notifier block
  *                             that follow this device when it is moved
@@ -2361,6 +2362,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;
 
        struct list_head        net_notifier_list;
 
index e791a73ef901b1ce63f194ba8c1811d2af957f42..2758aba47a2f25961725dbac45f0133f9251f858 100644 (file)
@@ -1020,9 +1020,10 @@ static void batadv_softif_init_early(struct net_device *dev)
        dev->netdev_ops = &batadv_netdev_ops;
        dev->needs_free_netdev = true;
        dev->priv_destructor = batadv_softif_free;
-       dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL;
+       dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
        dev->priv_flags |= IFF_NO_QUEUE;
        dev->lltx = true;
+       dev->netns_local = true;
 
        /* can't call min_mtu, because the needed variables
         * have not been initialized yet
index a6d25113dfb18517456d68d60ef3b9ac1e9824d0..26b79feb385d2daea3bf9c63772a566cdd621476 100644 (file)
@@ -488,9 +488,10 @@ 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->features = COMMON_FEATURES | NETIF_F_NETNS_LOCAL |
-                       NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
+       dev->features = COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
+                       NETIF_F_HW_VLAN_STAG_TX;
        dev->hw_features = COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |
                           NETIF_F_HW_VLAN_STAG_TX;
        dev->vlan_features = COMMON_FEATURES;
index 56aed88ceadfe3150fb05be5695d4cdbdc34c153..98bb5f890b887bf497d1510b81859937cc9c44d9 100644 (file)
@@ -11487,7 +11487,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->features & NETIF_F_NETNS_LOCAL)
+       if (dev->netns_local)
                goto out;
 
        /* Ensure the device has been registered */
@@ -11869,7 +11869,7 @@ static void __net_exit default_device_exit_net(struct net *net)
                char fb_name[IFNAMSIZ];
 
                /* Ignore unmoveable devices (i.e. loopback) */
-               if (dev->features & NETIF_F_NETNS_LOCAL)
+               if (dev->netns_local)
                        continue;
 
                /* Leave virtual devices for the generic cleanup */
index 447fc80e1b0069289caeafe66973af7e66c25625..ca8e64162104e975d48e7ae133fbe4e190e6bde6 100644 (file)
@@ -25,7 +25,6 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
        [NETIF_F_HW_VLAN_STAG_FILTER_BIT] = "rx-vlan-stag-filter",
        [NETIF_F_VLAN_CHALLENGED_BIT] =  "vlan-challenged",
        [NETIF_F_GSO_BIT] =              "tx-generic-segmentation",
-       [NETIF_F_NETNS_LOCAL_BIT] =      "netns-local",
        [NETIF_F_GRO_BIT] =              "rx-gro",
        [NETIF_F_GRO_HW_BIT] =           "rx-gro-hw",
        [NETIF_F_LRO_BIT] =              "rx-lro",
index d4c7830766621be747e72dd08fe6ba042ba1d4c5..a06e790042e2e0832fb1ecda65fbd8f9d5dbc3df 100644 (file)
@@ -556,6 +556,10 @@ void hsr_dev_setup(struct net_device *dev)
        dev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL;
        /* Prevent recursive tx locking */
        dev->lltx = true;
+       /* Not sure about this. Taken from bridge code. netdevice.h says
+        * it means "Does not change network namespaces".
+        */
+       dev->netns_local = true;
 
        dev->needs_free_netdev = true;
 
@@ -569,10 +573,6 @@ void hsr_dev_setup(struct net_device *dev)
         * hsr_header_create() etc.
         */
        dev->features |= NETIF_F_VLAN_CHALLENGED;
-       /* Not sure about this. Taken from bridge code. netdev_features.h says
-        * it means "Does not change network namespaces".
-        */
-       dev->features |= NETIF_F_NETNS_LOCAL;
 }
 
 /* Return true if dev is a HSR master; return false otherwise.
index 77b4e92027c5dfdadefc3019ca82ee8967a9006e..175efd860f7b4adaa49dfbb42bf05a55784e8e9b 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->features          |= NETIF_F_NETNS_LOCAL;
+       ldev->netns_local       = true;
 }
 
 static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[],
index 60e8fff1347ee8c02863e63ccec0a8e79e33015a..88adb04e407220f3990adf7ea26584716c0ff799 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->features &= ~NETIF_F_NETNS_LOCAL;
+               wpan_dev->netdev->netns_local = false;
                err = dev_change_net_namespace(wpan_dev->netdev, net, "wpan%d");
                if (err)
                        break;
-               wpan_dev->netdev->features |= NETIF_F_NETNS_LOCAL;
+               wpan_dev->netdev->netns_local = 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->features &= ~NETIF_F_NETNS_LOCAL;
+                       wpan_dev->netdev->netns_local = false;
                        err = dev_change_net_namespace(wpan_dev->netdev, net,
                                                       "wpan%d");
                        WARN_ON(err);
-                       wpan_dev->netdev->features |= NETIF_F_NETNS_LOCAL;
+                       wpan_dev->netdev->netns_local = 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->features |= NETIF_F_NETNS_LOCAL;
+               dev->netns_local = true;
                wpan_dev->identifier = ++rdev->wpan_dev_id;
                list_add_rcu(&wpan_dev->list, &rdev->wpan_dev_list);
                rdev->devlist_generation++;
index 0cd2f3de100c380cb75ddace0c7c9b0a808ac7b8..18964394d6bd0cdb70f6ba4e340702933431089d 100644 (file)
@@ -1161,7 +1161,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->features |= NETIF_F_NETNS_LOCAL;
+               itn->fb_tunnel_dev->netns_local = 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 b0eda745e3bc4f0adf823b5da966ebad6ee09b6b..f1a43199551b96144feb4e14acbf14bd2cd7edf2 100644 (file)
@@ -537,7 +537,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->features           |= NETIF_F_NETNS_LOCAL;
+       dev->netns_local        = true;
 }
 
 static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt)
index 08beab638bda6af92b5e71a08fe107d12e9100d8..235808cfec705032b545d6f396f8e58f4693e8d8 100644 (file)
@@ -1621,8 +1621,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->features |= NETIF_F_NETNS_LOCAL;
-
+       ign->fb_tunnel_dev->netns_local = true;
 
        ip6gre_fb_tunnel_init(ign->fb_tunnel_dev);
        ign->fb_tunnel_dev->rtnl_link_ops = &ip6gre_link_ops;
index cbef0fcece7157699a4ded50b235876c7c64b3af..ec51ab5063e8746c48abae718a079d4de529d8d5 100644 (file)
@@ -2258,7 +2258,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->features |= NETIF_F_NETNS_LOCAL;
+       ip6n->fb_tnl_dev->netns_local = true;
 
        err = ip6_fb_tnl_dev_init(ip6n->fb_tnl_dev);
        if (err < 0)
index e3ee93c562c3adbf104b9028aa0cfc466692af4c..2ce4ae0d8dc3b443986d7a7b4177a057f5affaec 100644 (file)
@@ -640,7 +640,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->features           |= NETIF_F_NETNS_LOCAL;
+       dev->netns_local        = true;
 }
 
 static struct net_device *ip6mr_reg_vif(struct net *net, struct mr_table *mrt)
index 58306522fb1e7c180363b7d1cec67b929d9dccf7..16b90a24c9baf8c0d0115b9fb23f2ad39e3e2262 100644 (file)
@@ -1856,7 +1856,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->features |= NETIF_F_NETNS_LOCAL;
+       sitn->fb_tunnel_dev->netns_local = true;
 
        err = register_netdev(sitn->fb_tunnel_dev);
        if (err)
index 3a369a31c5cc93b9d7eeb5f33a86c50a47866014..5858d65ea1a9b37e53ec032242a1eb684f6f2b8d 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->features |= NETIF_F_NETNS_LOCAL;
+               vport->dev->netns_local = true;
 
        rtnl_lock();
        err = register_netdevice(vport->dev);
index 4d5d351bd0b51e6d74230d946740af9da18e6633..661adfc776444408f300dfa5fde6361567cf9c11 100644 (file)
@@ -165,11 +165,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->features &= ~NETIF_F_NETNS_LOCAL;
+               wdev->netdev->netns_local = false;
                err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
                if (err)
                        break;
-               wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+               wdev->netdev->netns_local = true;
        }
 
        if (err) {
@@ -181,11 +181,11 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
                                                     list) {
                        if (!wdev->netdev)
                                continue;
-                       wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+                       wdev->netdev->netns_local = false;
                        err = dev_change_net_namespace(wdev->netdev, net,
                                                        "wlan%d");
                        WARN_ON(err);
-                       wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
+                       wdev->netdev->netns_local = true;
                }
 
                return err;
@@ -1473,7 +1473,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->features |= NETIF_F_NETNS_LOCAL;
+               dev->netns_local = true;
 
                cfg80211_init_wdev(wdev);
                break;
index 7fdb6a9ca543f1ea646823053e88cf1afde087b3..a652429bfd53cd654bdb65f204c4ac5ac28ff4d9 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
-(NETIF_F_NETNS_LOCAL) and most of them probably do not support the
+(dev->netns_local) 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