mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
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>
This commit is contained in:
committed by
Paolo Abeni
parent
00d066a4d4
commit
05c1280a2b
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) | \
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user