[v2,11/22] net/octeontx: fix the jumbo frame flag condition for mtu set

Message ID 20201217092312.27033-12-stevex.yang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series fix rx packets dropped issue |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Steve Yang Dec. 17, 2020, 9:23 a.m. UTC
  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.

Fixes: 3151e6a687a3 ("net/octeontx: support MTU")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 2 +-
 drivers/net/octeontx/octeontx_ethdev.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
  

Comments

Harman Kalra Dec. 21, 2020, 3:04 p.m. UTC | #1
On Thu, Dec 17, 2020 at 09:23:01AM +0000, Steve Yang wrote:
> External Email
> 
> ----------------------------------------------------------------------
> 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.
> 
> Fixes: 3151e6a687a3 ("net/octeontx: support MTU")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>


Acked-by: Harman Kalra <hkalra@marvell.com>

> ---
>  drivers/net/octeontx/octeontx_ethdev.c | 2 +-
>  drivers/net/octeontx/octeontx_ethdev.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
> index 3ee7b043fd..81779885d5 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -552,7 +552,7 @@ octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
>  	if (rc)
>  		return rc;
>  
> -	if (frame_size > RTE_ETHER_MAX_LEN)
> +	if (frame_size > OCCTX_L2_MAX_LEN)
>  		nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
>  	else
>  		nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
> index 7246fb6d1d..780a094ffa 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.h
> +++ b/drivers/net/octeontx/octeontx_ethdev.h
> @@ -44,6 +44,7 @@
>  /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
>  #define OCCTX_L2_OVERHEAD	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
>  				 OCCTX_MAX_VTAG_ACT_SIZE)
> +#define OCCTX_L2_MAX_LEN	(RTE_ETHER_MTU + OCCTX_L2_OVERHEAD)
>  
>  /* Since HW FRS includes NPC VTAG insertion space, user has reduced FRS */
>  #define OCCTX_MAX_FRS	\
> -- 
> 2.17.1
>
  

Patch

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 3ee7b043fd..81779885d5 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -552,7 +552,7 @@  octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	if (rc)
 		return rc;
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > OCCTX_L2_MAX_LEN)
 		nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
 		nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index 7246fb6d1d..780a094ffa 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -44,6 +44,7 @@ 
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
 #define OCCTX_L2_OVERHEAD	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
 				 OCCTX_MAX_VTAG_ACT_SIZE)
+#define OCCTX_L2_MAX_LEN	(RTE_ETHER_MTU + OCCTX_L2_OVERHEAD)
 
 /* Since HW FRS includes NPC VTAG insertion space, user has reduced FRS */
 #define OCCTX_MAX_FRS	\