]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
netdev_features: convert NETIF_F_FCOE_MTU to dev->fcoe_mtu
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Thu, 29 Aug 2024 12:33:39 +0000 (14:33 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 3 Sep 2024 09:36:43 +0000 (11:36 +0200)
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>
12 files changed:
Documentation/networking/net_cachelines/net_device.rst
drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c
drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
drivers/scsi/fcoe/fcoe.c
include/linux/netdev_features.h
include/linux/netdevice.h
net/8021q/vlan_dev.c
net/ethtool/common.c

index e649d8e9556f5626fc8c5bb7d1393501e8836407..56d4bbaf8a2c9202dfc3c3437bacad5b0c0c3aef 100644 (file)
@@ -167,6 +167,7 @@ unsigned:1                          threaded                -
 unsigned_long:1                     see_all_hwtstamp_requests                                       
 unsigned_long:1                     change_proto_down                                               
 unsigned_long:1                     netns_local                                                     
+unsigned_long:1                     fcoe_mtu                                                        
 struct_list_head                    net_notifier_list                                               
 struct_macsec_ops*                  macsec_ops                                                      
 struct_udp_tunnel_nic_info*         udp_tunnel_nic_info                                             
index 33b2c0c455093e9cb8552c8adcfe43a4cb122168..f6f745f5c02218afc0c36f9ac885b4fe33fa3ef3 100644 (file)
@@ -81,8 +81,7 @@ int cxgb_fcoe_enable(struct net_device *netdev)
 
        netdev->features |= NETIF_F_FCOE_CRC;
        netdev->vlan_features |= NETIF_F_FCOE_CRC;
-       netdev->features |= NETIF_F_FCOE_MTU;
-       netdev->vlan_features |= NETIF_F_FCOE_MTU;
+       netdev->fcoe_mtu = true;
 
        netdev_features_change(netdev);
 
@@ -112,8 +111,7 @@ int cxgb_fcoe_disable(struct net_device *netdev)
 
        netdev->features &= ~NETIF_F_FCOE_CRC;
        netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
-       netdev->features &= ~NETIF_F_FCOE_MTU;
-       netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
+       netdev->fcoe_mtu = false;
 
        netdev_features_change(netdev);
 
index e85f7d2e88106eee557be496e40ee0aa17f036bc..f2709b10c2e5ab28a976ddfee89627c8bdae7709 100644 (file)
@@ -317,7 +317,7 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
                int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
 
 #ifdef IXGBE_FCOE
-               if (adapter->netdev->features & NETIF_F_FCOE_MTU)
+               if (adapter->netdev->fcoe_mtu)
                        max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
 #endif
 
index 18d63c8c2ff4df920bdd5b89ed0c607a965d683d..955dced844a9892e1e2cb8b460e4a2a46b05c066 100644 (file)
@@ -858,7 +858,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
 
        /* enable FCoE and notify stack */
        adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
-       netdev->features |= NETIF_F_FCOE_MTU;
+       netdev->fcoe_mtu = true;
        netdev_features_change(netdev);
 
        /* release existing queues and reallocate them */
@@ -898,7 +898,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
 
        /* disable FCoE and notify stack */
        adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
-       netdev->features &= ~NETIF_F_FCOE_MTU;
+       netdev->fcoe_mtu = false;
 
        netdev_features_change(netdev);
 
index 0ee943db3dc92b510c120b546432315ba2c751b1..16fa621ce0ffb5b2615c347477528e2f8423583e 100644 (file)
@@ -981,7 +981,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
                        set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state);
 
 #ifdef IXGBE_FCOE
-               if (adapter->netdev->features & NETIF_F_FCOE_MTU) {
+               if (adapter->netdev->fcoe_mtu) {
                        struct ixgbe_ring_feature *f;
                        f = &adapter->ring_feature[RING_F_FCOE];
                        if ((rxr_idx >= f->offset) &&
index 8057cef61f397e3b8ba7c95b2f6a3241ed2f6203..8b8404d8c9460686f4bed17a1766e2470c6f21eb 100644 (file)
@@ -5079,7 +5079,7 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter)
                netif_set_tso_max_size(adapter->netdev, 32768);
 
 #ifdef IXGBE_FCOE
-       if (adapter->netdev->features & NETIF_F_FCOE_MTU)
+       if (adapter->netdev->fcoe_mtu)
                max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
 #endif
 
@@ -5136,8 +5136,7 @@ static int ixgbe_hpbthresh(struct ixgbe_adapter *adapter, int pb)
 
 #ifdef IXGBE_FCOE
        /* FCoE traffic class uses FCOE jumbo frames */
-       if ((dev->features & NETIF_F_FCOE_MTU) &&
-           (tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) &&
+       if (dev->fcoe_mtu && tc < IXGBE_FCOE_JUMBO_FRAME_SIZE &&
            (pb == ixgbe_fcoe_get_tc(adapter)))
                tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
 #endif
@@ -5197,8 +5196,7 @@ static int ixgbe_lpbthresh(struct ixgbe_adapter *adapter, int pb)
 
 #ifdef IXGBE_FCOE
        /* FCoE traffic class uses FCOE jumbo frames */
-       if ((dev->features & NETIF_F_FCOE_MTU) &&
-           (tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) &&
+       if (dev->fcoe_mtu && tc < IXGBE_FCOE_JUMBO_FRAME_SIZE &&
            (pb == netdev_get_prio_tc_map(dev, adapter->fcoe.up)))
                tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
 #endif
@@ -11096,8 +11094,7 @@ skip_sriov:
                                    NETIF_F_FCOE_CRC;
 
                netdev->vlan_features |= NETIF_F_FSO |
-                                        NETIF_F_FCOE_CRC |
-                                        NETIF_F_FCOE_MTU;
+                                        NETIF_F_FCOE_CRC;
        }
 #endif /* IXGBE_FCOE */
        if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)
index fcfd0a075eee56b23e7e28e71889d980ef3f188a..e71715f5da22874a1edcdb49e8c8ae211086516f 100644 (file)
@@ -495,7 +495,7 @@ static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf
                int err = 0;
 
 #ifdef CONFIG_FCOE
-               if (dev->features & NETIF_F_FCOE_MTU)
+               if (dev->fcoe_mtu)
                        pf_max_frame = max_t(int, pf_max_frame,
                                             IXGBE_FCOE_JUMBO_FRAME_SIZE);
 
@@ -857,7 +857,7 @@ static void ixgbe_set_vf_rx_tx(struct ixgbe_adapter *adapter, int vf)
                int pf_max_frame = dev->mtu + ETH_HLEN;
 
 #if IS_ENABLED(CONFIG_FCOE)
-               if (dev->features & NETIF_F_FCOE_MTU)
+               if (dev->fcoe_mtu)
                        pf_max_frame = max_t(int, pf_max_frame,
                                             IXGBE_FCOE_JUMBO_FRAME_SIZE);
 #endif /* CONFIG_FCOE */
index f1429f270170434d12e1ec8653e1c8242ae97e75..39aec710660cfa77ac7d3c6a56392fb484a35a45 100644 (file)
@@ -722,7 +722,7 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
         * will return 0, so do this first.
         */
        mfs = netdev->mtu;
-       if (netdev->features & NETIF_F_FCOE_MTU) {
+       if (netdev->fcoe_mtu) {
                mfs = FCOE_MTU;
                FCOE_NETDEV_DBG(netdev, "Supports FCOE_MTU of %d bytes\n", mfs);
        }
@@ -1863,7 +1863,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
        case NETDEV_CHANGE:
                break;
        case NETDEV_CHANGEMTU:
-               if (netdev->features & NETIF_F_FCOE_MTU)
+               if (netdev->fcoe_mtu)
                        break;
                mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
                                     sizeof(struct fcoe_crc_eof));
index d5a3836f4793dc835880c2f5ef4615c340b53478..37af2c6e7caf1568571dd3726d0cc64df88f6b40 100644 (file)
@@ -58,7 +58,7 @@ enum {
 
        NETIF_F_FCOE_CRC_BIT,           /* FCoE CRC32 */
        NETIF_F_SCTP_CRC_BIT,           /* SCTP checksum offload */
-       NETIF_F_FCOE_MTU_BIT,           /* Supports max FCoE MTU, 2158 bytes*/
+       __UNUSED_NETIF_F_37,
        NETIF_F_NTUPLE_BIT,             /* N-tuple filters supported */
        NETIF_F_RXHASH_BIT,             /* Receive hashing offload */
        NETIF_F_RXCSUM_BIT,             /* Receive checksumming offload */
@@ -105,7 +105,6 @@ enum {
 #define __NETIF_F(name)                __NETIF_F_BIT(NETIF_F_##name##_BIT)
 
 #define NETIF_F_FCOE_CRC       __NETIF_F(FCOE_CRC)
-#define NETIF_F_FCOE_MTU       __NETIF_F(FCOE_MTU)
 #define NETIF_F_FRAGLIST       __NETIF_F(FRAGLIST)
 #define NETIF_F_FSO            __NETIF_F(FSO)
 #define NETIF_F_GRO            __NETIF_F(GRO)
@@ -210,8 +209,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
 #define NETIF_F_ALL_TSO        (NETIF_F_TSO | NETIF_F_TSO6 | \
                                 NETIF_F_TSO_ECN | NETIF_F_TSO_MANGLEID)
 
-#define NETIF_F_ALL_FCOE       (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
-                                NETIF_F_FSO)
+#define NETIF_F_ALL_FCOE       (NETIF_F_FCOE_CRC | NETIF_F_FSO)
 
 /* List of features with software fallbacks. */
 #define NETIF_F_GSO_SOFTWARE   (NETIF_F_ALL_TSO | NETIF_F_GSO_SCTP |        \
index a698e2402420c8fcdd7775f2503afd05eed4a08c..ca5f0dda733bb162474d3b2806c1225dc75173f9 100644 (file)
@@ -1969,6 +1969,7 @@ enum netdev_reg_state {
  *                     HWTSTAMP_SOURCE_NETDEV
  *     @change_proto_down: device supports setting carrier via IFLA_PROTO_DOWN
  *     @netns_local: interface can't change network namespaces
+ *     @fcoe_mtu:      device supports maximum FCoE MTU, 2158 bytes
  *
  *     @net_notifier_list:     List of per-net netdev notifier block
  *                             that follow this device when it is moved
@@ -2363,6 +2364,7 @@ struct net_device {
        unsigned long           see_all_hwtstamp_requests:1;
        unsigned long           change_proto_down:1;
        unsigned long           netns_local:1;
+       unsigned long           fcoe_mtu:1;
 
        struct list_head        net_notifier_list;
 
index 3ca485537d778afa9a697ba10c3e2988827bc5f9..09b46b057ab297e11cd88805b9ce0be8c7d4b0ea 100644 (file)
@@ -571,6 +571,7 @@ static int vlan_dev_init(struct net_device *dev)
 
        dev->features |= dev->hw_features;
        dev->lltx = true;
+       dev->fcoe_mtu = true;
        netif_inherit_tso_max(dev, real_dev);
        if (dev->features & NETIF_F_VLAN_FEATURES)
                netdev_warn(real_dev, "VLAN features are set incorrectly.  Q-in-Q configurations may not work correctly.\n");
index ca8e64162104e975d48e7ae133fbe4e190e6bde6..00f93c58b319a311978d4a16c1bfeb57f9820904 100644 (file)
@@ -50,7 +50,6 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
 
        [NETIF_F_FCOE_CRC_BIT] =         "tx-checksum-fcoe-crc",
        [NETIF_F_SCTP_CRC_BIT] =        "tx-checksum-sctp",
-       [NETIF_F_FCOE_MTU_BIT] =         "fcoe-mtu",
        [NETIF_F_NTUPLE_BIT] =           "rx-ntuple-filter",
        [NETIF_F_RXHASH_BIT] =           "rx-hashing",
        [NETIF_F_RXCSUM_BIT] =           "rx-checksum",