Skip to content

Commit c55f34a

Browse files
author
Paolo Abeni
committed
Merge branch 'netdev_features-start-cleaning-netdev_features_t-up'
Alexander Lobakin says: ==================== netdev_features: start cleaning netdev_features_t up NETDEV_FEATURE_COUNT is currently 64, which means we can't add any new features as netdev_features_t is u64. As per several discussions, instead of converting netdev_features_t to a bitmap, which would mean A LOT of changes, we can try cleaning up netdev feature bits. There's a bunch of bits which don't really mean features, rather device attributes/properties that can't be changed via Ethtool in any of the drivers. Such attributes can be moved to netdev private flags without losing any functionality. Start converting some read-only netdev features to private flags from the ones that are most obvious, like lockless Tx, inability to change network namespace etc. I was able to reduce NETDEV_FEATURE_COUNT from 64 to 60, which mean 4 free slots for new features. There are obviously more read-only features to convert, such as highDMA, "challenged VLAN", HSR (4 bits) - this will be done in subsequent series. Please note that currently netdev features are not uAPI/ABI by any means. Ethtool passes their names and bits to the userspace separately and there are no hardcoded names/bits in the userspace, so that new Ethtool could work on older kernels and vice versa. This, however, isn't true for Ethtools < 3.4. I haven't changed the bit positions of the already existing features and instead replaced the freed bits with stubs. But it's anyway theoretically possible that Ethtools older than 2011 will break. I hope no currently supported distros supply such an ancient version. Shell scripts also most likely won't break since the removed bits were always read-only, meaning nobody would try touching them from a script. ==================== Link: https://patch.msgid.link/20240829123340.789395-1-aleksander.lobakin@intel.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2 parents 075e3d3 + a61fec1 commit c55f34a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+208
-194
lines changed

Documentation/networking/net_cachelines/net_device.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ net_device struct fast path usage breakdown
77

88
Type Name fastpath_tx_access fastpath_rx_access Comments
99
..struct ..net_device
10+
unsigned_long:32 priv_flags read_mostly - __dev_queue_xmit(tx)
11+
unsigned_long:1 lltx read_mostly - HARD_TX_LOCK,HARD_TX_TRYLOCK,HARD_TX_UNLOCK(tx)
1012
char name[16] - -
1113
struct_netdev_name_node* name_node
1214
struct_dev_ifalias* ifalias
@@ -23,7 +25,6 @@ struct_list_head ptype_specific
2325
struct adj_list
2426
unsigned_int flags read_mostly read_mostly __dev_queue_xmit,__dev_xmit_skb,ip6_output,__ip6_finish_output(tx);ip6_rcv_core(rx)
2527
xdp_features_t xdp_features
26-
unsigned_long_long priv_flags read_mostly - __dev_queue_xmit(tx)
2728
struct_net_device_ops* netdev_ops read_mostly - netdev_core_pick_tx,netdev_start_xmit(tx)
2829
struct_xdp_metadata_ops* xdp_metadata_ops
2930
int ifindex - read_mostly ip6_rcv_core
@@ -163,6 +164,10 @@ struct_lock_class_key* qdisc_tx_busylock
163164
bool proto_down
164165
unsigned:1 wol_enabled
165166
unsigned:1 threaded - - napi_poll(napi_enable,dev_set_threaded)
167+
unsigned_long:1 see_all_hwtstamp_requests
168+
unsigned_long:1 change_proto_down
169+
unsigned_long:1 netns_local
170+
unsigned_long:1 fcoe_mtu
166171
struct_list_head net_notifier_list
167172
struct_macsec_ops* macsec_ops
168173
struct_udp_tunnel_nic_info* udp_tunnel_nic_info

Documentation/networking/netdev-features.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +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-
* LLTX driver (deprecated for hardware drivers)
143-
144-
NETIF_F_LLTX is meant to be used by drivers that don't need locking at all,
145-
e.g. software tunnels.
146-
147-
This is also used in a few legacy drivers that implement their
148-
own locking, don't use it for new (hardware) drivers.
149-
150-
* netns-local device
151-
152-
NETIF_F_NETNS_LOCAL is set for devices that are not allowed to move between
153-
network namespaces (e.g. loopback).
154-
155-
Don't use it in drivers.
156-
157142
* VLAN challenged
158143

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

Documentation/networking/netdevices.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,11 @@ ndo_get_stats:
258258
ndo_start_xmit:
259259
Synchronization: __netif_tx_lock spinlock.
260260

261-
When the driver sets NETIF_F_LLTX in dev->features this will be
261+
When the driver sets dev->lltx this will be
262262
called without holding netif_tx_lock. In this case the driver
263263
has to lock by itself when needed.
264264
The locking there should also properly protect against
265-
set_rx_mode. WARNING: use of NETIF_F_LLTX is deprecated.
265+
set_rx_mode. WARNING: use of dev->lltx is deprecated.
266266
Don't use it for new drivers.
267267

268268
Context: Process with BHs disabled or BH (timer),

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/amt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3098,9 +3098,9 @@ static void amt_link_setup(struct net_device *dev)
30983098
dev->hard_header_len = 0;
30993099
dev->addr_len = 0;
31003100
dev->priv_flags |= IFF_NO_QUEUE;
3101-
dev->features |= NETIF_F_LLTX;
3101+
dev->lltx = true;
3102+
dev->netns_local = true;
31023103
dev->features |= NETIF_F_GSO_SOFTWARE;
3103-
dev->features |= NETIF_F_NETNS_LOCAL;
31043104
dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
31053105
dev->hw_features |= NETIF_F_FRAGLIST | NETIF_F_RXCSUM;
31063106
dev->hw_features |= NETIF_F_GSO_SOFTWARE;

drivers/net/bareudp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ static void bareudp_setup(struct net_device *dev)
553553
SET_NETDEV_DEVTYPE(dev, &bareudp_type);
554554
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST;
555555
dev->features |= NETIF_F_RXCSUM;
556-
dev->features |= NETIF_F_LLTX;
557556
dev->features |= NETIF_F_GSO_SOFTWARE;
558557
dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST;
559558
dev->hw_features |= NETIF_F_RXCSUM;
@@ -566,6 +565,7 @@ static void bareudp_setup(struct net_device *dev)
566565
dev->type = ARPHRD_NONE;
567566
netif_keep_dst(dev);
568567
dev->priv_flags |= IFF_NO_QUEUE;
568+
dev->lltx = true;
569569
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
570570
dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
571571
}

drivers/net/bonding/bond_main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5928,7 +5928,10 @@ void bond_setup(struct net_device *bond_dev)
59285928
#endif /* CONFIG_XFRM_OFFLOAD */
59295929

59305930
/* don't acquire bond device's netif_tx_lock when transmitting */
5931-
bond_dev->features |= NETIF_F_LLTX;
5931+
bond_dev->lltx = true;
5932+
5933+
/* Don't allow bond devices to change network namespaces. */
5934+
bond_dev->netns_local = true;
59325935

59335936
/* By default, we declare the bond to be fully
59345937
* VLAN hardware accelerated capable. Special
@@ -5937,9 +5940,6 @@ void bond_setup(struct net_device *bond_dev)
59375940
* capable
59385941
*/
59395942

5940-
/* Don't allow bond devices to change network namespaces. */
5941-
bond_dev->features |= NETIF_F_NETNS_LOCAL;
5942-
59435943
bond_dev->hw_features = BOND_VLAN_FEATURES |
59445944
NETIF_F_HW_VLAN_CTAG_RX |
59455945
NETIF_F_HW_VLAN_CTAG_FILTER |

drivers/net/dummy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ static void dummy_setup(struct net_device *dev)
109109
dev->flags |= IFF_NOARP;
110110
dev->flags &= ~IFF_MULTICAST;
111111
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
112+
dev->lltx = true;
112113
dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST;
113114
dev->features |= NETIF_F_GSO_SOFTWARE;
114-
dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
115+
dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
115116
dev->features |= NETIF_F_GSO_ENCAP_ALL;
116117
dev->hw_features |= dev->features;
117118
dev->hw_enc_features |= dev->features;

drivers/net/ethernet/adi/adin1110.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ static int adin1110_probe_netdevs(struct adin1110_priv *priv)
15991599
netdev->netdev_ops = &adin1110_netdev_ops;
16001600
netdev->ethtool_ops = &adin1110_ethtool_ops;
16011601
netdev->priv_flags |= IFF_UNICAST_FLT;
1602-
netdev->features |= NETIF_F_NETNS_LOCAL;
1602+
netdev->netns_local = true;
16031603

16041604
port_priv->phydev = get_phy_device(priv->mii_bus, i + 1, false);
16051605
if (IS_ERR(port_priv->phydev)) {

drivers/net/ethernet/chelsio/cxgb/cxgb2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
10341034
netdev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM |
10351035
NETIF_F_RXCSUM;
10361036
netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM |
1037-
NETIF_F_RXCSUM | NETIF_F_LLTX | NETIF_F_HIGHDMA;
1037+
NETIF_F_RXCSUM | NETIF_F_HIGHDMA;
1038+
netdev->lltx = true;
10381039

10391040
if (vlan_tso_capable(adapter)) {
10401041
netdev->features |=

0 commit comments

Comments
 (0)