Skip to content

Commit f177edd

Browse files
committed
Merge: CNB96: netdev_features: start cleaning netdev_features_t up
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5362 JIRA: https://issues.redhat.com/browse/RHEL-59091 Explanation from the upstream cover letter by Alexander Lobakin: > 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 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. Even shell scripts won't most likely > break since the removed bits were always read-only, meaning nobody would > try touching them from a script. I proposed a Release Note Text in the Jira to document that "tx-lockless", "netns-local", "fcoe-mtu" will no longer appear in "ethtool -k". Signed-off-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: Eric Chanudet <echanude@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2 parents 395d2a2 + 043963c commit f177edd

File tree

75 files changed

+195
-184
lines changed

Some content is hidden

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

75 files changed

+195
-184
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/bareudp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ static void bareudp_setup(struct net_device *dev)
579579
SET_NETDEV_DEVTYPE(dev, &bareudp_type);
580580
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST;
581581
dev->features |= NETIF_F_RXCSUM;
582-
dev->features |= NETIF_F_LLTX;
583582
dev->features |= NETIF_F_GSO_SOFTWARE;
584583
dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST;
585584
dev->hw_features |= NETIF_F_RXCSUM;
@@ -592,6 +591,7 @@ static void bareudp_setup(struct net_device *dev)
592591
dev->type = ARPHRD_NONE;
593592
netif_keep_dst(dev);
594593
dev->priv_flags |= IFF_NO_QUEUE;
594+
dev->lltx = true;
595595
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
596596
}
597597

drivers/net/bonding/bond_main.c

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

58945894
/* don't acquire bond device's netif_tx_lock when transmitting */
5895-
bond_dev->features |= NETIF_F_LLTX;
5895+
bond_dev->lltx = true;
5896+
5897+
/* Don't allow bond devices to change network namespaces. */
5898+
bond_dev->netns_local = true;
58965899

58975900
/* By default, we declare the bond to be fully
58985901
* VLAN hardware accelerated capable. Special
@@ -5901,9 +5904,6 @@ void bond_setup(struct net_device *bond_dev)
59015904
* capable
59025905
*/
59035906

5904-
/* Don't allow bond devices to change network namespaces. */
5905-
bond_dev->features |= NETIF_F_NETNS_LOCAL;
5906-
59075907
bond_dev->hw_features = BOND_VLAN_FEATURES |
59085908
NETIF_F_HW_VLAN_CTAG_RX |
59095909
NETIF_F_HW_VLAN_CTAG_FILTER |

drivers/net/dummy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ static void dummy_setup(struct net_device *dev)
117117
dev->flags |= IFF_NOARP;
118118
dev->flags &= ~IFF_MULTICAST;
119119
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
120+
dev->lltx = true;
120121
dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST;
121122
dev->features |= NETIF_F_GSO_SOFTWARE;
122-
dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
123+
dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
123124
dev->features |= NETIF_F_GSO_ENCAP_ALL;
124125
dev->hw_features |= dev->features;
125126
dev->hw_enc_features |= dev->features;

drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ int cxgb_fcoe_enable(struct net_device *netdev)
8181

8282
netdev->features |= NETIF_F_FCOE_CRC;
8383
netdev->vlan_features |= NETIF_F_FCOE_CRC;
84-
netdev->features |= NETIF_F_FCOE_MTU;
85-
netdev->vlan_features |= NETIF_F_FCOE_MTU;
84+
netdev->fcoe_mtu = true;
8685

8786
netdev_features_change(netdev);
8887

@@ -112,8 +111,7 @@ int cxgb_fcoe_disable(struct net_device *netdev)
112111

113112
netdev->features &= ~NETIF_F_FCOE_CRC;
114113
netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
115-
netdev->features &= ~NETIF_F_FCOE_MTU;
116-
netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
114+
netdev->fcoe_mtu = false;
117115

118116
netdev_features_change(netdev);
119117

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int dpaa_netdev_init(struct net_device *net_dev,
250250
net_dev->max_mtu = dpaa_get_max_mtu();
251251

252252
net_dev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
253-
NETIF_F_LLTX | NETIF_F_RXHASH);
253+
NETIF_F_RXHASH);
254254

255255
net_dev->hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA;
256256
/* The kernels enables GSO automatically, if we declare NETIF_F_SG.
@@ -260,6 +260,7 @@ static int dpaa_netdev_init(struct net_device *net_dev,
260260
net_dev->features |= NETIF_F_RXCSUM;
261261

262262
net_dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
263+
net_dev->lltx = true;
263264
/* we do not want shared skbs on TX */
264265
net_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
265266

drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
317317
int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
318318

319319
#ifdef IXGBE_FCOE
320-
if (adapter->netdev->features & NETIF_F_FCOE_MTU)
320+
if (adapter->netdev->fcoe_mtu)
321321
max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
322322
#endif
323323

0 commit comments

Comments
 (0)