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

Message ID 20201217092312.27033-11-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: 70d6b7f550f4 ("net/ipn3ke: add representor")

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

Comments

Xu, Rosen Dec. 19, 2020, 12:54 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Steve Yang <stevex.yang@intel.com>
> Sent: Thursday, December 17, 2020 17:23
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; asomalap@amd.com;
> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
> sachin.saxena@oss.nxp.com; Guo, Jia <jia.guo@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; g.singh@nxp.com; xuanziyang2@huawei.com;
> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com;
> xavier.huwei@huawei.com; humin29@huawei.com;
> yisen.zhuang@huawei.com; oulijun@huawei.com; Wu, Jingjing
> <jingjing.wu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi
> Z <qi.z.zhang@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> sthotton@marvell.com; srinivasan@marvell.com;
> heinrich.kuhn@netronome.com; hkalra@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; kirankumark@marvell.com;
> rmody@marvell.com; shshaikh@marvell.com;
> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com;
> thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
> ivan.boule@6wind.com; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; samuel.gauthier@6wind.com;
> david.marchand@6wind.com; shahafs@mellanox.com;
> stephen@networkplumber.org; maxime.coquelin@redhat.com;
> olivier.matz@6wind.com; lihuisong@huawei.com; shreyansh.jain@nxp.com;
> wei.dai@intel.com; fengchunsong@huawei.com; chenhao164@huawei.com;
> tangchengchang@hisilicon.com; Zhang, Helin <helin.zhang@intel.com>;
> yanglong.wu@intel.com; xiaolong.ye@intel.com; Xu, Ting
> <ting.xu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>; Wei, Dan
> <dan.wei@intel.com>; Pei, Andy <andy.pei@intel.com>;
> vattunuru@marvell.com; skori@marvell.com; sony.chacko@qlogic.com;
> Richardson, Bruce <bruce.richardson@intel.com>; ivan.malov@oktetlabs.ru;
> rad@semihalf.com; slawomir.rosek@semihalf.com;
> kamil.rytarowski@caviumnetworks.com; Zhao1, Wei <wei.zhao1@intel.com>;
> Jiang, JunyuX <junyux.jiang@intel.com>; kumaras@chelsio.com;
> girish.nandibasappa@amd.com; rolf.neugebauer@netronome.com;
> alejandro.lucero@netronome.com; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v2 10/22] net/ipn3ke: fix the jumbo frame flag condition for
> mtu set
> 
> 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: 70d6b7f550f4 ("net/ipn3ke: add representor")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>  drivers/net/ipn3ke/ipn3ke_ethdev.h      | 1 +
>  drivers/net/ipn3ke/ipn3ke_representor.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h
> b/drivers/net/ipn3ke/ipn3ke_ethdev.h
> index 9b0cf309c8..a6815a9cca 100644
> --- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
> +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
> @@ -640,6 +640,7 @@ ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
>   */
>  #define IPN3KE_ETH_OVERHEAD \
>  	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
> IPN3KE_VLAN_TAG_SIZE * 2)
> +#define IPN3KE_ETH_MAX_LEN (RTE_ETHER_MTU +
> IPN3KE_ETH_OVERHEAD)
> 
>  #define IPN3KE_MAC_FRAME_SIZE_MAX    9728
>  #define IPN3KE_MAC_RX_FRAME_MAXLENGTH    0x00AE
> diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c
> b/drivers/net/ipn3ke/ipn3ke_representor.c
> index 8a53602576..9e15cce34f 100644
> --- a/drivers/net/ipn3ke/ipn3ke_representor.c
> +++ b/drivers/net/ipn3ke/ipn3ke_representor.c
> @@ -2801,7 +2801,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev,
> uint16_t mtu)
>  		return -EBUSY;
>  	}
> 
> -	if (frame_size > RTE_ETHER_MAX_LEN)
> +	if (frame_size > IPN3KE_ETH_MAX_LEN)
>  		dev_data->dev_conf.rxmode.offloads |=
>  			(uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME);
>  	else
> --
> 2.17.1

Reviewed-by: Rosen Xu <rosen.xu@intel.com>
  

Patch

diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index 9b0cf309c8..a6815a9cca 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -640,6 +640,7 @@  ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev,
  */
 #define IPN3KE_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IPN3KE_VLAN_TAG_SIZE * 2)
+#define IPN3KE_ETH_MAX_LEN (RTE_ETHER_MTU + IPN3KE_ETH_OVERHEAD)
 
 #define IPN3KE_MAC_FRAME_SIZE_MAX    9728
 #define IPN3KE_MAC_RX_FRAME_MAXLENGTH    0x00AE
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 8a53602576..9e15cce34f 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2801,7 +2801,7 @@  ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > IPN3KE_ETH_MAX_LEN)
 		dev_data->dev_conf.rxmode.offloads |=
 			(uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME);
 	else