net/i40e: fix vlan packets drop

Message ID 1571039632-5524-1-git-send-email-xiao.zhang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers
Series net/i40e: fix vlan packets drop |

Checks

Context Check Description
ci/iol-compilation success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Xiao Zhang Oct. 14, 2019, 7:53 a.m. UTC
  vlan packets with ip length bigger then 1496 will not be received by
i40e due to wrong packets size checking. This patch fixes the issue by
correcting the maximum frame size during checking.

Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Kevin Traynor Oct. 14, 2019, 5:41 p.m. UTC | #1
On 14/10/2019 08:53, Xiao Zhang wrote:
> vlan packets with ip length bigger then 1496 will not be received by
> i40e due to wrong packets size checking. This patch fixes the issue by
> correcting the maximum frame size during checking.
> 
> Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")

To make sure it is backported to the correct stable branches, please tag
the commit that introduced the bug, not the last commit to touch the line.

> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 2ca14da..156d67b 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c

What about vf?

> @@ -12103,7 +12103,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 > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2)
>  		dev_data->dev_conf.rxmode.offloads |=
>  			DEV_RX_OFFLOAD_JUMBO_FRAME;
>  	else
> 

+cc Ian, who looked into MTU for i40e a while back.

MTU code changing makes me nervous. You would need to look through
everywhere there is something related to pkt len to check it is still ok.

E.g. if I got it right (maybe I miss something), this means a 1500 mtu
will set frame_size to 1526, which will turn off jumbo and set
dev_data->dev_conf.rxmode.max_rx_pkt_len = 1526

Then in i40e_rx_queue_config()

rxq->max_pkt_len = RTE_MIN(len, data->dev_conf.rxmode.max_rx_pkt_len);
                   ^^^ lets say max_rx_pkt_len (1526) is the min

if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {

[snip jumbo on branch]

} else {
	if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
		rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
                ^^^ 1526           ^^^ 1518

		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);
		return I40E_ERR_CONFIG;
                ^^^ Error returned ???
	}
}
  
Xiao Zhang Oct. 15, 2019, 1:41 a.m. UTC | #2
Hi Kevin,

> -----Original Message-----
> From: Kevin Traynor [mailto:ktraynor@redhat.com]
> Sent: Tuesday, October 15, 2019 1:42 AM
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> stable@dpdk.org; Stokes, Ian <ian.stokes@intel.com>
> Subject: Re: [dpdk-dev] net/i40e: fix vlan packets drop
> 
> On 14/10/2019 08:53, Xiao Zhang wrote:
> > vlan packets with ip length bigger then 1496 will not be received by
> > i40e due to wrong packets size checking. This patch fixes the issue by
> > correcting the maximum frame size during checking.
> >
> > Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
> 
> To make sure it is backported to the correct stable branches, please tag the
> commit that introduced the bug, not the last commit to touch the line.

Got it, the right fixline should be Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration"), will correct it.

> 
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 2ca14da..156d67b 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> 
> What about vf?

vf also need to be fixed, will add it.

> 
> > @@ -12103,7 +12103,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 > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2)
> >  		dev_data->dev_conf.rxmode.offloads |=
> >  			DEV_RX_OFFLOAD_JUMBO_FRAME;
> >  	else
> >
> 
> +cc Ian, who looked into MTU for i40e a while back.
> 
> MTU code changing makes me nervous. You would need to look through
> everywhere there is something related to pkt len to check it is still ok.
> 
> E.g. if I got it right (maybe I miss something), this means a 1500 mtu will set
> frame_size to 1526, which will turn off jumbo and set dev_data-
> >dev_conf.rxmode.max_rx_pkt_len = 1526
> 
> Then in i40e_rx_queue_config()
> 
> rxq->max_pkt_len = RTE_MIN(len, data->dev_conf.rxmode.max_rx_pkt_len);
>                    ^^^ lets say max_rx_pkt_len (1526) is the min
> 
> if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
> 
> [snip jumbo on branch]
> 
> } else {
> 	if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
> 		rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
>                 ^^^ 1526           ^^^ 1518
> 
> 		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);
> 		return I40E_ERR_CONFIG;
>                 ^^^ Error returned ???
> 	}
> }

Thanks for point out. Will go through the code to check if related pkt length still ok.
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2ca14da..156d67b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12103,7 +12103,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 > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else