[dpdk-dev] [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition

Guo, Jia jia.guo at intel.com
Fri Dec 18 03:44:02 CET 2020


Acked-by: Jeff Guo <jia.guo at intel.com>

> -----Original Message-----
> From: Steve Yang <stevex.yang at intel.com>
> Sent: Thursday, December 17, 2020 5:23 PM
> To: dev at dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu at intel.com>; Xing, Beilei
> <beilei.xing at intel.com>; Iremonger, Bernard
> <bernard.iremonger at intel.com>; asomalap at amd.com;
> rahul.lakkireddy at chelsio.com; hemant.agrawal at nxp.com;
> sachin.saxena at oss.nxp.com; Guo, Jia <jia.guo at intel.com>; Wang, Haiyue
> <haiyue.wang at intel.com>; g.singh at nxp.com; xuanziyang2 at huawei.com;
> cloud.wangxiaoyun at huawei.com; zhouguoyang at huawei.com;
> xavier.huwei at huawei.com; humin29 at huawei.com;
> yisen.zhuang at huawei.com; oulijun at huawei.com; Wu, Jingjing
> <jingjing.wu at intel.com>; Yang, Qiming <qiming.yang at intel.com>; Zhang, Qi
> Z <qi.z.zhang at intel.com>; Xu, Rosen <rosen.xu at intel.com>;
> sthotton at marvell.com; srinivasan at marvell.com;
> heinrich.kuhn at netronome.com; hkalra at marvell.com; jerinj at marvell.com;
> ndabilpuram at marvell.com; kirankumark at marvell.com;
> rmody at marvell.com; shshaikh at marvell.com;
> andrew.rybchenko at oktetlabs.ru; mczekaj at marvell.com;
> thomas at monjalon.net; Yigit, Ferruh <ferruh.yigit at intel.com>;
> ivan.boule at 6wind.com; Ananyev, Konstantin
> <konstantin.ananyev at intel.com>; samuel.gauthier at 6wind.com;
> david.marchand at 6wind.com; shahafs at mellanox.com;
> stephen at networkplumber.org; maxime.coquelin at redhat.com;
> olivier.matz at 6wind.com; lihuisong at huawei.com; shreyansh.jain at nxp.com;
> wei.dai at intel.com; fengchunsong at huawei.com; chenhao164 at huawei.com;
> tangchengchang at hisilicon.com; Zhang, Helin <helin.zhang at intel.com>;
> yanglong.wu at intel.com; xiaolong.ye at intel.com; Xu, Ting
> <ting.xu at intel.com>; Li, Xiaoyun <xiaoyun.li at intel.com>; Wei, Dan
> <dan.wei at intel.com>; Pei, Andy <andy.pei at intel.com>;
> vattunuru at marvell.com; skori at marvell.com; sony.chacko at qlogic.com;
> Richardson, Bruce <bruce.richardson at intel.com>; ivan.malov at oktetlabs.ru;
> rad at semihalf.com; slawomir.rosek at semihalf.com;
> kamil.rytarowski at caviumnetworks.com; Zhao1, Wei <wei.zhao1 at intel.com>;
> Jiang, JunyuX <junyux.jiang at intel.com>; kumaras at chelsio.com;
> girish.nandibasappa at amd.com; rolf.neugebauer at netronome.com;
> alejandro.lucero at netronome.com; Yang, SteveX <stevex.yang at intel.com>
> Subject: [PATCH v2 07/22] net/i40e: fix the jumbo frame flag condition
> 
> 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: 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")
> 
> Signed-off-by: Steve Yang <stevex.yang at intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c    |  2 +-
>  drivers/net/i40e/i40e_ethdev.h    |  1 +
>  drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
>  drivers/net/i40e/i40e_fdir.c      |  2 +-
>  drivers/net/i40e/i40e_rxtx.c      |  8 ++++----
>  5 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 2cb18ecc03..d4fcc6c853 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -11770,7 +11770,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
> diff --git a/drivers/net/i40e/i40e_ethdev.h
> b/drivers/net/i40e/i40e_ethdev.h index 696c5aaf7e..1f31a532a1 100644
> --- a/drivers/net/i40e/i40e_ethdev.h
> +++ b/drivers/net/i40e/i40e_ethdev.h
> @@ -281,6 +281,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)
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index c26b036b85..85c65c09ee 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1889,22 +1889,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;
>  		}
>  	}
> @@ -2825,7 +2825,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
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index
> 50c0eee9f2..449b67b2a9 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -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;
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index
> 5df9a9df56..b8859bbff2 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -2797,23 +2797,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;
>  		}
>  	}
> --
> 2.17.1



More information about the dev mailing list