Skip to content

Commit 6dfb2f2

Browse files
committed
netdev_features: convert NETIF_F_FCOE_MTU to dev->fcoe_mtu
JIRA: https://issues.redhat.com/browse/RHEL-59091 commit 782dbbf Author: Alexander Lobakin <aleksander.lobakin@intel.com> Date: Thu Aug 29 14:33:39 2024 +0200 netdev_features: convert NETIF_F_FCOE_MTU to dev->fcoe_mtu Ability to handle maximum FCoE frames of 2158 bytes can never be changed and thus more of an attribute, not a toggleable feature. Move it from netdev_features_t to "cold" priv flags (bitfield bool) and free yet another feature bit. Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
1 parent a672f9b commit 6dfb2f2

File tree

12 files changed

+20
-24
lines changed

12 files changed

+20
-24
lines changed

Documentation/networking/net_cachelines/net_device.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ unsigned:1 threaded -
167167
unsigned_long:1 see_all_hwtstamp_requests
168168
unsigned_long:1 change_proto_down
169169
unsigned_long:1 netns_local
170+
unsigned_long:1 fcoe_mtu
170171
struct_list_head net_notifier_list
171172
struct_macsec_ops* macsec_ops
172173
struct_udp_tunnel_nic_info* udp_tunnel_nic_info

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/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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
858858

859859
/* enable FCoE and notify stack */
860860
adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
861-
netdev->features |= NETIF_F_FCOE_MTU;
861+
netdev->fcoe_mtu = true;
862862
netdev_features_change(netdev);
863863

864864
/* release existing queues and reallocate them */
@@ -898,7 +898,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
898898

899899
/* disable FCoE and notify stack */
900900
adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
901-
netdev->features &= ~NETIF_F_FCOE_MTU;
901+
netdev->fcoe_mtu = false;
902902

903903
netdev_features_change(netdev);
904904

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
981981
set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state);
982982

983983
#ifdef IXGBE_FCOE
984-
if (adapter->netdev->features & NETIF_F_FCOE_MTU) {
984+
if (adapter->netdev->fcoe_mtu) {
985985
struct ixgbe_ring_feature *f;
986986
f = &adapter->ring_feature[RING_F_FCOE];
987987
if ((rxr_idx >= f->offset) &&

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5052,7 +5052,7 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter)
50525052
netif_set_tso_max_size(adapter->netdev, 32768);
50535053

50545054
#ifdef IXGBE_FCOE
5055-
if (adapter->netdev->features & NETIF_F_FCOE_MTU)
5055+
if (adapter->netdev->fcoe_mtu)
50565056
max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
50575057
#endif
50585058

@@ -5109,8 +5109,7 @@ static int ixgbe_hpbthresh(struct ixgbe_adapter *adapter, int pb)
51095109

51105110
#ifdef IXGBE_FCOE
51115111
/* FCoE traffic class uses FCOE jumbo frames */
5112-
if ((dev->features & NETIF_F_FCOE_MTU) &&
5113-
(tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) &&
5112+
if (dev->fcoe_mtu && tc < IXGBE_FCOE_JUMBO_FRAME_SIZE &&
51145113
(pb == ixgbe_fcoe_get_tc(adapter)))
51155114
tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
51165115
#endif
@@ -5170,8 +5169,7 @@ static int ixgbe_lpbthresh(struct ixgbe_adapter *adapter, int pb)
51705169

51715170
#ifdef IXGBE_FCOE
51725171
/* FCoE traffic class uses FCOE jumbo frames */
5173-
if ((dev->features & NETIF_F_FCOE_MTU) &&
5174-
(tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) &&
5172+
if (dev->fcoe_mtu && tc < IXGBE_FCOE_JUMBO_FRAME_SIZE &&
51755173
(pb == netdev_get_prio_tc_map(dev, adapter->fcoe.up)))
51765174
tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
51775175
#endif
@@ -11034,8 +11032,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1103411032
NETIF_F_FCOE_CRC;
1103511033

1103611034
netdev->vlan_features |= NETIF_F_FSO |
11037-
NETIF_F_FCOE_CRC |
11038-
NETIF_F_FCOE_MTU;
11035+
NETIF_F_FCOE_CRC;
1103911036
}
1104011037
#endif /* IXGBE_FCOE */
1104111038
if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf
496496
s32 err = 0;
497497

498498
#ifdef CONFIG_FCOE
499-
if (dev->features & NETIF_F_FCOE_MTU)
499+
if (dev->fcoe_mtu)
500500
pf_max_frame = max_t(int, pf_max_frame,
501501
IXGBE_FCOE_JUMBO_FRAME_SIZE);
502502

@@ -858,7 +858,7 @@ static void ixgbe_set_vf_rx_tx(struct ixgbe_adapter *adapter, int vf)
858858
int pf_max_frame = dev->mtu + ETH_HLEN;
859859

860860
#if IS_ENABLED(CONFIG_FCOE)
861-
if (dev->features & NETIF_F_FCOE_MTU)
861+
if (dev->fcoe_mtu)
862862
pf_max_frame = max_t(int, pf_max_frame,
863863
IXGBE_FCOE_JUMBO_FRAME_SIZE);
864864
#endif /* CONFIG_FCOE */

drivers/scsi/fcoe/fcoe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
721721
* will return 0, so do this first.
722722
*/
723723
mfs = netdev->mtu;
724-
if (netdev->features & NETIF_F_FCOE_MTU) {
724+
if (netdev->fcoe_mtu) {
725725
mfs = FCOE_MTU;
726726
FCOE_NETDEV_DBG(netdev, "Supports FCOE_MTU of %d bytes\n", mfs);
727727
}
@@ -1872,7 +1872,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
18721872
case NETDEV_CHANGE:
18731873
break;
18741874
case NETDEV_CHANGEMTU:
1875-
if (netdev->features & NETIF_F_FCOE_MTU)
1875+
if (netdev->fcoe_mtu)
18761876
break;
18771877
mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
18781878
sizeof(struct fcoe_crc_eof));

include/linux/netdev_features.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum {
5858

5959
NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
6060
NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */
61-
NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
61+
__UNUSED_NETIF_F_37,
6262
NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
6363
NETIF_F_RXHASH_BIT, /* Receive hashing offload */
6464
NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
@@ -105,7 +105,6 @@ enum {
105105
#define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT)
106106

107107
#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC)
108-
#define NETIF_F_FCOE_MTU __NETIF_F(FCOE_MTU)
109108
#define NETIF_F_FRAGLIST __NETIF_F(FRAGLIST)
110109
#define NETIF_F_FSO __NETIF_F(FSO)
111110
#define NETIF_F_GRO __NETIF_F(GRO)
@@ -210,8 +209,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
210209
#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | \
211210
NETIF_F_TSO_ECN | NETIF_F_TSO_MANGLEID)
212211

213-
#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
214-
NETIF_F_FSO)
212+
#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FSO)
215213

216214
/* List of features with software fallbacks. */
217215
#define NETIF_F_GSO_SOFTWARE (NETIF_F_ALL_TSO | NETIF_F_GSO_SCTP | \

include/linux/netdevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,7 @@ enum netdev_ml_priv_type {
20172017
* HWTSTAMP_SOURCE_NETDEV
20182018
* @change_proto_down: device supports setting carrier via IFLA_PROTO_DOWN
20192019
* @netns_local: interface can't change network namespaces
2020+
* @fcoe_mtu: device supports maximum FCoE MTU, 2158 bytes
20202021
*
20212022
* @net_notifier_list: List of per-net netdev notifier block
20222023
* that follow this device when it is moved
@@ -2418,6 +2419,7 @@ struct net_device {
24182419
unsigned long see_all_hwtstamp_requests:1;
24192420
unsigned long change_proto_down:1;
24202421
unsigned long netns_local:1;
2422+
unsigned long fcoe_mtu:1;
24212423

24222424
struct list_head net_notifier_list;
24232425

0 commit comments

Comments
 (0)