]> git.droids-corp.org - dpdk.git/commitdiff
net/i40e: fix jumbo frame flag condition
authorSteve Yang <stevex.yang@intel.com>
Mon, 18 Jan 2021 07:04:13 +0000 (07:04 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 19 Jan 2021 02:30:14 +0000 (03:30 +0100)
The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'RTE_ETHER_MTU' and
overhead, that perhaps impacts the cases of the jumbo frame related.

Fixes: c1715402df8f ("i40evf: fix jumbo frame support")
Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: c3ac7c5b0b8a ("net/i40e: convert to new Rx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h
drivers/net/i40e/i40e_ethdev_vf.c
drivers/net/i40e/i40e_fdir.c
drivers/net/i40e/i40e_rxtx.c

index 42987c5dab9375dabc0986f32fcdb65582502e92..946994b80a42e26d08a7c1b5f829f925a5d77446 100644 (file)
@@ -11687,7 +11687,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
                return -EBUSY;
        }
 
-       if (frame_size > RTE_ETHER_MAX_LEN)
+       if (frame_size > I40E_ETH_MAX_LEN)
                dev_data->dev_conf.rxmode.offloads |=
                        DEV_RX_OFFLOAD_JUMBO_FRAME;
        else
index cd484710b03a17dadf60cebb6ae02c1c99abb2a4..1e8f5d3a87933eaee5825b8d9d380addc9979fd2 100644 (file)
@@ -283,6 +283,7 @@ struct rte_flow {
  */
 #define I40E_ETH_OVERHEAD \
        (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2)
+#define I40E_ETH_MAX_LEN (RTE_ETHER_MTU + I40E_ETH_OVERHEAD)
 
 #define I40E_RXTX_BYTES_H_16_BIT(bytes) ((bytes) & ~I40E_48_BIT_MASK)
 #define I40E_RXTX_BYTES_L_48_BIT(bytes) ((bytes) & I40E_48_BIT_MASK)
index 346ec29cbe6552e739c36d2709d3c967a2e532fa..5d7db7fe13ceee918be33a6babc84089f62a3f4a 100644 (file)
@@ -1900,22 +1900,22 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
         * Check if the jumbo frame and maximum packet length are set correctly
         */
        if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-               if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+               if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
                    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
                        PMD_DRV_LOG(ERR, "maximum packet length must be "
                                "larger than %u and smaller than %u, as jumbo "
-                               "frame is enabled", (uint32_t)RTE_ETHER_MAX_LEN,
+                               "frame is enabled", (uint32_t)I40E_ETH_MAX_LEN,
                                        (uint32_t)I40E_FRAME_SIZE_MAX);
                        return I40E_ERR_CONFIG;
                }
        } else {
                if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-                   rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+                   rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
                        PMD_DRV_LOG(ERR, "maximum packet length must be "
                                "larger than %u and smaller than %u, as jumbo "
                                "frame is disabled",
                                (uint32_t)RTE_ETHER_MIN_LEN,
-                               (uint32_t)RTE_ETHER_MAX_LEN);
+                               (uint32_t)I40E_ETH_MAX_LEN);
                        return I40E_ERR_CONFIG;
                }
        }
@@ -2837,7 +2837,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
                return -EBUSY;
        }
 
-       if (frame_size > RTE_ETHER_MAX_LEN)
+       if (frame_size > I40E_ETH_MAX_LEN)
                dev_data->dev_conf.rxmode.offloads |=
                        DEV_RX_OFFLOAD_JUMBO_FRAME;
        else
index 0343e8b09afa071e0cf6846250d3b0814eb5aaf6..f5defcf585191baf593ede63ce6ff72eda33e9ef 100644 (file)
@@ -116,7 +116,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
 #endif
        rx_ctx.dtype = i40e_header_split_none;
        rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
-       rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+       rx_ctx.rxmax = I40E_ETH_MAX_LEN;
        rx_ctx.tphrdesc_ena = 1;
        rx_ctx.tphwdesc_ena = 1;
        rx_ctx.tphdata_ena = 1;
index 3574867685d2abc7b7d646f78b3f3f69ddf99de9..1ae62d433453ea055951e7de4eff24f963928bc5 100644 (file)
@@ -2845,23 +2845,23 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
                RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
                        rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len);
        if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-               if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+               if (rxq->max_pkt_len <= I40E_ETH_MAX_LEN ||
                        rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
                        PMD_DRV_LOG(ERR, "maximum packet length must "
                                    "be larger than %u and smaller than %u,"
                                    "as jumbo frame is enabled",
-                                   (uint32_t)RTE_ETHER_MAX_LEN,
+                                   (uint32_t)I40E_ETH_MAX_LEN,
                                    (uint32_t)I40E_FRAME_SIZE_MAX);
                        return I40E_ERR_CONFIG;
                }
        } else {
                if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-                       rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+                       rxq->max_pkt_len > I40E_ETH_MAX_LEN) {
                        PMD_DRV_LOG(ERR, "maximum packet length must be "
                                    "larger than %u and smaller than %u, "
                                    "as jumbo frame is disabled",
                                    (uint32_t)RTE_ETHER_MIN_LEN,
-                                   (uint32_t)RTE_ETHER_MAX_LEN);
+                                   (uint32_t)I40E_ETH_MAX_LEN);
                        return I40E_ERR_CONFIG;
                }
        }