@@ -1651,6 +1651,8 @@ struct net_device_ops {
* even if those aren't HWTSTAMP_SOURCE_NETDEV.
@ @IFF_LLTX: device supports lockless Tx. Mainly used by logical interfaces,
* such as tunnels.
+ * @IFF_LOGICAL: combines @IFF_NO_QUEUE and @IFF_LLTX, used by logical
+ * interfaces to avoid overhead from locking and Qdisc.
*/
enum netdev_priv_flags {
IFF_802_1Q_VLAN = 1<<0,
@@ -1688,6 +1690,7 @@ enum netdev_priv_flags {
IFF_CHANGE_PROTO_DOWN = BIT_ULL(32),
IFF_SEE_ALL_HWTSTAMP_REQUESTS = BIT_ULL(33),
IFF_LLTX = BIT_ULL(34),
+ IFF_LOGICAL = IFF_NO_QUEUE | IFF_LLTX,
};
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -3097,7 +3097,7 @@ static void amt_link_setup(struct net_device *dev)
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->hard_header_len = 0;
dev->addr_len = 0;
- dev->priv_flags |= IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
dev->features |= NETIF_F_GSO_SOFTWARE;
dev->features |= NETIF_F_NETNS_LOCAL;
dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
@@ -564,7 +564,7 @@ static void bareudp_setup(struct net_device *dev)
dev->max_mtu = IP_MAX_MTU - BAREUDP_BASE_HLEN;
dev->type = ARPHRD_NONE;
netif_keep_dst(dev);
- dev->priv_flags |= IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
}
@@ -5875,9 +5875,7 @@ void bond_setup(struct net_device *bond_dev)
/* Initialize the device options */
bond_dev->flags |= IFF_MASTER;
- bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT | IFF_NO_QUEUE;
- /* don't acquire bond device's netif_tx_lock when transmitting */
- bond_dev->priv_flags |= IFF_LLTX;
+ bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT | IFF_LOGICAL;
bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
#ifdef CONFIG_XFRM_OFFLOAD
@@ -108,7 +108,7 @@ static void dummy_setup(struct net_device *dev)
/* Fill in device structure with ethernet-generic values. */
dev->flags |= IFF_NOARP;
dev->flags &= ~IFF_MULTICAST;
- dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_LOGICAL;
dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST;
dev->features |= NETIF_F_GSO_SOFTWARE;
dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
@@ -384,7 +384,7 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
netdev->features &= ~NETIF_F_HW_VLAN_STAG_RX;
netif_set_tso_max_segs(netdev, NFP_NET_LSO_MAX_SEGS);
- netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL | IFF_LLTX;
+ netdev->priv_flags |= IFF_LOGICAL | IFF_DISABLE_NETPOLL;
if (nfp_app_has_tc(app)) {
netdev->features |= NETIF_F_HW_TC;
@@ -1211,7 +1211,7 @@ static void geneve_setup(struct net_device *dev)
netif_keep_dst(dev);
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_LOGICAL;
eth_hw_addr_random(dev);
}
@@ -956,7 +956,7 @@ static void gtp_link_setup(struct net_device *dev)
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
- dev->priv_flags |= IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
netif_keep_dst(dev);
dev->needed_headroom = LL_MAX_HEADER + max_gtp_header_len;
@@ -174,8 +174,7 @@ static void gen_lo_setup(struct net_device *dev,
dev->addr_len = ETH_ALEN; /* 6 */
dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
dev->flags = IFF_LOOPBACK;
- dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
- dev->priv_flags |= IFF_LLTX;
+ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_LOGICAL;
netif_keep_dst(dev);
dev->hw_features = NETIF_F_GSO_SOFTWARE;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
@@ -726,7 +726,7 @@ struct failover *net_failover_create(struct net_device *standby_dev)
failover_dev->ethtool_ops = &failover_ethtool_ops;
/* Initialize the device options */
- failover_dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE | IFF_LLTX;
+ failover_dev->priv_flags |= IFF_UNICAST_FLT | IFF_LOGICAL;
failover_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE |
IFF_TX_SKB_SHARING);
@@ -241,8 +241,7 @@ static void netkit_setup(struct net_device *dev)
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
dev->priv_flags |= IFF_PHONY_HEADROOM;
- dev->priv_flags |= IFF_NO_QUEUE;
- dev->priv_flags |= IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
dev->ethtool_ops = &netkit_ethtool_ops;
dev->netdev_ops = &netkit_netdev_ops;
@@ -62,7 +62,7 @@ static const struct net_device_ops nlmon_ops = {
static void nlmon_setup(struct net_device *dev)
{
dev->type = ARPHRD_NETLINK;
- dev->priv_flags |= IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
dev->netdev_ops = &nlmon_ops;
dev->ethtool_ops = &nlmon_ethtool_ops;
@@ -2180,7 +2180,7 @@ static void team_setup(struct net_device *dev)
dev->needs_free_netdev = true;
dev->priv_destructor = team_destructor;
dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
- dev->priv_flags |= IFF_NO_QUEUE;
+ dev->priv_flags |= IFF_LOGICAL;
dev->priv_flags |= IFF_TEAM;
/*
@@ -2188,7 +2188,7 @@ static void team_setup(struct net_device *dev)
* bring us to promisc mode in case a unicast addr is added.
* Let this up to underlay drivers.
*/
- dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE | IFF_LLTX;
+ dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
dev->features |= NETIF_F_GRO;
@@ -1693,9 +1693,8 @@ static void veth_setup(struct net_device *dev)
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- dev->priv_flags |= IFF_NO_QUEUE;
+ dev->priv_flags |= IFF_LOGICAL;
dev->priv_flags |= IFF_PHONY_HEADROOM;
- dev->priv_flags |= IFF_LLTX;
dev->netdev_ops = &veth_netdev_ops;
dev->xdp_metadata_ops = &veth_xdp_metadata_ops;
@@ -1670,11 +1670,9 @@ static void vrf_setup(struct net_device *dev)
dev->hw_enc_features = dev->features;
/* default to no qdisc; user can add if desired */
- dev->priv_flags |= IFF_NO_QUEUE;
+ dev->priv_flags |= IFF_LOGICAL;
dev->priv_flags |= IFF_NO_RX_HANDLER;
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- /* don't acquire vrf device's netif_tx_lock when transmitting */
- dev->priv_flags |= IFF_LLTX;
/* VRF devices do not care about MTU, but if the MTU is set
* too low then the ipv4 and ipv6 protocols are disabled
@@ -82,7 +82,7 @@ static const struct ethtool_ops vsockmon_ethtool_ops = {
static void vsockmon_setup(struct net_device *dev)
{
dev->type = ARPHRD_VSOCKMON;
- dev->priv_flags |= IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
dev->netdev_ops = &vsockmon_ops;
dev->ethtool_ops = &vsockmon_ethtool_ops;
@@ -3301,7 +3301,7 @@ static void vxlan_setup(struct net_device *dev)
dev->hw_features |= NETIF_F_RXCSUM;
dev->hw_features |= NETIF_F_GSO_SOFTWARE;
netif_keep_dst(dev);
- dev->priv_flags |= IFF_NO_QUEUE | IFF_CHANGE_PROTO_DOWN | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL | IFF_CHANGE_PROTO_DOWN;
/* MTU range: 68 - 65535 */
dev->min_mtu = ETH_MIN_MTU;
@@ -288,7 +288,7 @@ static void wg_setup(struct net_device *dev)
dev->needed_tailroom = noise_encrypted_len(MESSAGE_PADDING_MULTIPLE);
dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
- dev->priv_flags |= IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
dev->features |= WG_NETDEV_FEATURES;
dev->hw_features |= WG_NETDEV_FEATURES;
dev->hw_enc_features |= WG_NETDEV_FEATURES;
@@ -1021,7 +1021,7 @@ static void batadv_softif_init_early(struct net_device *dev)
dev->needs_free_netdev = true;
dev->priv_destructor = batadv_softif_free;
dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL;
- dev->priv_flags |= IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL;
/* can't call min_mtu, because the needed variables
* have not been initialized yet
@@ -480,7 +480,7 @@ void br_dev_setup(struct net_device *dev)
dev->needs_free_netdev = true;
dev->ethtool_ops = &br_ethtool_ops;
SET_NETDEV_DEVTYPE(dev, &br_type);
- dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE | IFF_LLTX;
+ dev->priv_flags = IFF_EBRIDGE | IFF_LOGICAL;
dev->features = COMMON_FEATURES | NETIF_F_NETNS_LOCAL |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
@@ -1764,7 +1764,7 @@ static const struct kobj_type netdev_queue_ktype = {
static bool netdev_uses_bql(const struct net_device *dev)
{
- if (dev->priv_flags & (IFF_NO_QUEUE | IFF_LLTX))
+ if (dev->priv_flags & IFF_LOGICAL)
return false;
return IS_ENABLED(CONFIG_BQL);
@@ -498,7 +498,7 @@ void hsr_dev_setup(struct net_device *dev)
dev->header_ops = &hsr_header_ops;
dev->netdev_ops = &hsr_device_ops;
SET_NETDEV_DEVTYPE(dev, &hsr_type);
- dev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL | IFF_LLTX;
+ dev->priv_flags |= IFF_LOGICAL | IFF_DISABLE_NETPOLL;
dev->needs_free_netdev = true;
@@ -102,7 +102,7 @@ static void do_setup(struct net_device *netdev)
netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH |
- IFF_NO_QUEUE | IFF_LLTX;
+ IFF_LOGICAL;
netdev->needs_free_netdev = true;
netdev->priv_destructor = NULL;
netdev->ethtool_ops = &internal_dev_ethtool_ops;
These two are often used together when creating logical interfaces w/o locking and Qdisc overhead. Introduce a shorthand to avoid repeating the same pattern. Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> --- include/linux/netdevice.h | 3 +++ drivers/net/amt.c | 2 +- drivers/net/bareudp.c | 2 +- drivers/net/bonding/bond_main.c | 4 +--- drivers/net/dummy.c | 2 +- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 2 +- drivers/net/geneve.c | 2 +- drivers/net/gtp.c | 2 +- drivers/net/loopback.c | 3 +-- drivers/net/net_failover.c | 2 +- drivers/net/netkit.c | 3 +-- drivers/net/nlmon.c | 2 +- drivers/net/team/team_core.c | 4 ++-- drivers/net/veth.c | 3 +-- drivers/net/vrf.c | 4 +--- drivers/net/vsockmon.c | 2 +- drivers/net/vxlan/vxlan_core.c | 2 +- drivers/net/wireguard/device.c | 2 +- net/batman-adv/soft-interface.c | 2 +- net/bridge/br_device.c | 2 +- net/core/net-sysfs.c | 2 +- net/hsr/hsr_device.c | 2 +- net/openvswitch/vport-internal_dev.c | 2 +- 23 files changed, 26 insertions(+), 30 deletions(-)