]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i40e: increase max descriptors for XL710
authorJustin Bronder <jsbronder@cold-front.org>
Mon, 29 Sep 2025 14:45:58 +0000 (10:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Oct 2025 11:35:47 +0000 (13:35 +0200)
[ Upstream commit aa6908ca3bd1e713fd6cd8d7193a008f060bf7d9 ]

In Tables 8-12 and 8-22 in the X710/XXV710/XL710 datasheet, the QLEN
description states that the maximum size of the descriptor queue is 8k
minus 32, or 8160.

Signed-off-by: Justin Bronder <jsbronder@cold-front.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20231113231047.548659-2-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 55d225670def ("i40e: add validation for ring_len param")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_ethtool.c

index add9a3107d9a0ca2d28a8aad5d92bf4a139cb9c2..512354442891ff04f53f799378d6b530c5f3ed96 100644 (file)
@@ -50,6 +50,7 @@
 #define I40E_MAX_VEB                   16
 
 #define I40E_MAX_NUM_DESCRIPTORS       4096
+#define I40E_MAX_NUM_DESCRIPTORS_XL710 8160
 #define I40E_MAX_CSR_SPACE             (4 * 1024 * 1024 - 64 * 1024)
 #define I40E_DEFAULT_NUM_DESCRIPTORS   512
 #define I40E_REQ_DESCRIPTOR_MULTIPLE   32
index 7f8fc9b3b105f2cd2c2ff094144bfdca4b761453..588b72aba4f6baaa36c47bc580d3b26d146afc86 100644 (file)
@@ -1916,6 +1916,18 @@ static void i40e_get_drvinfo(struct net_device *netdev,
                drvinfo->n_priv_flags += I40E_GL_PRIV_FLAGS_STR_LEN;
 }
 
+static u32 i40e_get_max_num_descriptors(struct i40e_pf *pf)
+{
+       struct i40e_hw *hw = &pf->hw;
+
+       switch (hw->mac.type) {
+       case I40E_MAC_XL710:
+               return I40E_MAX_NUM_DESCRIPTORS_XL710;
+       default:
+               return I40E_MAX_NUM_DESCRIPTORS;
+       }
+}
+
 static void i40e_get_ringparam(struct net_device *netdev,
                               struct ethtool_ringparam *ring)
 {
@@ -1923,8 +1935,8 @@ static void i40e_get_ringparam(struct net_device *netdev,
        struct i40e_pf *pf = np->vsi->back;
        struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
 
-       ring->rx_max_pending = I40E_MAX_NUM_DESCRIPTORS;
-       ring->tx_max_pending = I40E_MAX_NUM_DESCRIPTORS;
+       ring->rx_max_pending = i40e_get_max_num_descriptors(pf);
+       ring->tx_max_pending = i40e_get_max_num_descriptors(pf);
        ring->rx_mini_max_pending = 0;
        ring->rx_jumbo_max_pending = 0;
        ring->rx_pending = vsi->rx_rings[0]->count;
@@ -1947,12 +1959,12 @@ static bool i40e_active_tx_ring_index(struct i40e_vsi *vsi, u16 index)
 static int i40e_set_ringparam(struct net_device *netdev,
                              struct ethtool_ringparam *ring)
 {
+       u32 new_rx_count, new_tx_count, max_num_descriptors;
        struct i40e_ring *tx_rings = NULL, *rx_rings = NULL;
        struct i40e_netdev_priv *np = netdev_priv(netdev);
        struct i40e_hw *hw = &np->vsi->back->hw;
        struct i40e_vsi *vsi = np->vsi;
        struct i40e_pf *pf = vsi->back;
-       u32 new_rx_count, new_tx_count;
        u16 tx_alloc_queue_pairs;
        int timeout = 50;
        int i, err = 0;
@@ -1960,14 +1972,15 @@ static int i40e_set_ringparam(struct net_device *netdev,
        if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
                return -EINVAL;
 
-       if (ring->tx_pending > I40E_MAX_NUM_DESCRIPTORS ||
+       max_num_descriptors = i40e_get_max_num_descriptors(pf);
+       if (ring->tx_pending > max_num_descriptors ||
            ring->tx_pending < I40E_MIN_NUM_DESCRIPTORS ||
-           ring->rx_pending > I40E_MAX_NUM_DESCRIPTORS ||
+           ring->rx_pending > max_num_descriptors ||
            ring->rx_pending < I40E_MIN_NUM_DESCRIPTORS) {
                netdev_info(netdev,
                            "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n",
                            ring->tx_pending, ring->rx_pending,
-                           I40E_MIN_NUM_DESCRIPTORS, I40E_MAX_NUM_DESCRIPTORS);
+                           I40E_MIN_NUM_DESCRIPTORS, max_num_descriptors);
                return -EINVAL;
        }