All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/i40e: fix max frame size checking
@ 2018-07-26  6:46 Yanglong Wu
  2018-07-26  9:16 ` Ananyev, Konstantin
  2018-07-27  4:40 ` [PATCH v2] " Yanglong Wu
  0 siblings, 2 replies; 10+ messages in thread
From: Yanglong Wu @ 2018-07-26  6:46 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, tiwei.bie, lei.a.yao, Yanglong Wu

No need to check max frame size in TX, the checking
should be done in up layer protocal. This checking will
lead to fail for TSO or other application cases.

Fixes: bfeed0262b0c ("net/i40e: check illegal packets")

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
 drivers/net/i40e/i40e_rxtx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 3be87fe6a..baad433a7 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 		}
 
 		/* check the size of packet */
-		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
-		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
+		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
 			rte_errno = -EINVAL;
 			return i;
 		}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] net/i40e: fix max frame size checking
  2018-07-26  6:46 [PATCH] net/i40e: fix max frame size checking Yanglong Wu
@ 2018-07-26  9:16 ` Ananyev, Konstantin
  2018-07-26 12:13   ` Zhang, Qi Z
  2018-07-27  4:40 ` [PATCH v2] " Yanglong Wu
  1 sibling, 1 reply; 10+ messages in thread
From: Ananyev, Konstantin @ 2018-07-26  9:16 UTC (permalink / raw)
  To: Wu, Yanglong, dev; +Cc: Zhang, Qi Z, Bie, Tiwei, Yao, Lei A, Wu, Yanglong



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> Sent: Thursday, July 26, 2018 7:46 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Yanglong
> <yanglong.wu@intel.com>
> Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> 
> No need to check max frame size in TX, the checking
> should be done in up layer protocal. This checking will
> lead to fail for TSO or other application cases.

Not sure why is that?
i40e doesn't support single packet bigger then 9.5KB (or so), as I remember.
For TSO the limit is 256KB - yes, it is bibber, but still there is a limit.
Might be we need to change that check, but I think we still need to keep it.
Konstantin

> 
> Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> 
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
>  drivers/net/i40e/i40e_rxtx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 3be87fe6a..baad433a7 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
>  		}
> 
>  		/* check the size of packet */
> -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
>  			rte_errno = -EINVAL;
>  			return i;
>  		}
> --
> 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net/i40e: fix max frame size checking
  2018-07-26  9:16 ` Ananyev, Konstantin
@ 2018-07-26 12:13   ` Zhang, Qi Z
  2018-07-26 12:25     ` Zhang, Qi Z
  0 siblings, 1 reply; 10+ messages in thread
From: Zhang, Qi Z @ 2018-07-26 12:13 UTC (permalink / raw)
  To: Ananyev, Konstantin, Wu, Yanglong, dev
  Cc: Bie, Tiwei, Yao, Lei A, Wu, Yanglong



> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Thursday, July 26, 2018 5:17 PM
> To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei <tiwei.bie@intel.com>; Yao,
> Lei A <lei.a.yao@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> > Sent: Thursday, July 26, 2018 7:46 AM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Yanglong
> > <yanglong.wu@intel.com>
> > Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> >
> > No need to check max frame size in TX, the checking should be done in
> > up layer protocal. This checking will lead to fail for TSO or other
> > application cases.
> 
> Not sure why is that?
> i40e doesn't support single packet bigger then 9.5KB (or so), as I remember.
> For TSO the limit is 256KB - yes, it is bibber, but still there is a limit.

I think we can't support more than 8 segment for TSO, right? so if the limit is 256KB, seems it is a redundant.

> Might be we need to change that check, but I think we still need to keep it.
> Konstantin

> 
> >
> > Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> >
> > Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> > ---
> >  drivers/net/i40e/i40e_rxtx.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > b/drivers/net/i40e/i40e_rxtx.c index 3be87fe6a..baad433a7 100644
> > --- a/drivers/net/i40e/i40e_rxtx.c
> > +++ b/drivers/net/i40e/i40e_rxtx.c
> > @@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,
> struct rte_mbuf **tx_pkts,
> >  		}
> >
> >  		/* check the size of packet */
> > -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> > -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> >  			rte_errno = -EINVAL;
> >  			return i;
> >  		}
> > --
> > 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net/i40e: fix max frame size checking
  2018-07-26 12:13   ` Zhang, Qi Z
@ 2018-07-26 12:25     ` Zhang, Qi Z
  2018-07-26 12:33       ` Ananyev, Konstantin
  0 siblings, 1 reply; 10+ messages in thread
From: Zhang, Qi Z @ 2018-07-26 12:25 UTC (permalink / raw)
  To: Zhang, Qi Z, Ananyev, Konstantin, Wu, Yanglong, dev
  Cc: Bie, Tiwei, Yao, Lei A, Wu, Yanglong



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang, Qi Z
> Sent: Thursday, July 26, 2018 8:14 PM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Yanglong
> <yanglong.wu@intel.com>; dev@dpdk.org
> Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> Yanglong <yanglong.wu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> 
> 
> 
> > -----Original Message-----
> > From: Ananyev, Konstantin
> > Sent: Thursday, July 26, 2018 5:17 PM
> > To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Yanglong
> > <yanglong.wu@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> >
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> > > Sent: Thursday, July 26, 2018 7:46 AM
> > > To: dev@dpdk.org
> > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > > Yanglong <yanglong.wu@intel.com>
> > > Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> > >
> > > No need to check max frame size in TX, the checking should be done
> > > in up layer protocal. This checking will lead to fail for TSO or
> > > other application cases.
> >
> > Not sure why is that?
> > i40e doesn't support single packet bigger then 9.5KB (or so), as I remember.
> > For TSO the limit is 256KB - yes, it is bibber, but still there is a limit.
> 
> I think we can't support more than 8 segment for TSO, right? so if the limit is
> 256KB, seems it is a redundant.

I mean buffer size limit is 16kb according to datasheet.

> 
> > Might be we need to change that check, but I think we still need to keep it.
> > Konstantin
> 
> >
> > >
> > > Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> > >
> > > Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> > > ---
> > >  drivers/net/i40e/i40e_rxtx.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > > b/drivers/net/i40e/i40e_rxtx.c index 3be87fe6a..baad433a7 100644
> > > --- a/drivers/net/i40e/i40e_rxtx.c
> > > +++ b/drivers/net/i40e/i40e_rxtx.c
> > > @@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,
> > struct rte_mbuf **tx_pkts,
> > >  		}
> > >
> > >  		/* check the size of packet */
> > > -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> > > -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > > +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > >  			rte_errno = -EINVAL;
> > >  			return i;
> > >  		}
> > > --
> > > 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net/i40e: fix max frame size checking
  2018-07-26 12:25     ` Zhang, Qi Z
@ 2018-07-26 12:33       ` Ananyev, Konstantin
  2018-07-26 12:47         ` Zhang, Qi Z
  0 siblings, 1 reply; 10+ messages in thread
From: Ananyev, Konstantin @ 2018-07-26 12:33 UTC (permalink / raw)
  To: Zhang, Qi Z, Wu, Yanglong, dev; +Cc: Bie, Tiwei, Yao, Lei A, Wu, Yanglong



> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, July 26, 2018 1:26 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Yanglong
> <yanglong.wu@intel.com>; dev@dpdk.org
> Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang, Qi Z
> > Sent: Thursday, July 26, 2018 8:14 PM
> > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Yanglong
> > <yanglong.wu@intel.com>; dev@dpdk.org
> > Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > Yanglong <yanglong.wu@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> >
> >
> >
> > > -----Original Message-----
> > > From: Ananyev, Konstantin
> > > Sent: Thursday, July 26, 2018 5:17 PM
> > > To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
> > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Yanglong
> > > <yanglong.wu@intel.com>
> > > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> > > > Sent: Thursday, July 26, 2018 7:46 AM
> > > > To: dev@dpdk.org
> > > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > > > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > > > Yanglong <yanglong.wu@intel.com>
> > > > Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> > > >
> > > > No need to check max frame size in TX, the checking should be done
> > > > in up layer protocal. This checking will lead to fail for TSO or
> > > > other application cases.
> > >
> > > Not sure why is that?
> > > i40e doesn't support single packet bigger then 9.5KB (or so), as I remember.
> > > For TSO the limit is 256KB - yes, it is bibber, but still there is a limit.
> >
> > I think we can't support more than 8 segment for TSO, right? so if the limit is
> > 256KB, seems it is a redundant.

As I remember there is no limit for number of segs for TSO.
For non-TSO - yes, max 8 segments per packet.

> 
> I mean buffer size limit is 16kb according to datasheet.
> 
> >
> > > Might be we need to change that check, but I think we still need to keep it.
> > > Konstantin
> >
> > >
> > > >
> > > > Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> > > >
> > > > Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> > > > ---
> > > >  drivers/net/i40e/i40e_rxtx.c | 3 +--
> > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > > > b/drivers/net/i40e/i40e_rxtx.c index 3be87fe6a..baad433a7 100644
> > > > --- a/drivers/net/i40e/i40e_rxtx.c
> > > > +++ b/drivers/net/i40e/i40e_rxtx.c
> > > > @@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,
> > > struct rte_mbuf **tx_pkts,
> > > >  		}
> > > >
> > > >  		/* check the size of packet */
> > > > -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> > > > -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > > > +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > > >  			rte_errno = -EINVAL;
> > > >  			return i;
> > > >  		}
> > > > --
> > > > 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net/i40e: fix max frame size checking
  2018-07-26 12:33       ` Ananyev, Konstantin
@ 2018-07-26 12:47         ` Zhang, Qi Z
  2018-07-26 12:56           ` Ananyev, Konstantin
  0 siblings, 1 reply; 10+ messages in thread
From: Zhang, Qi Z @ 2018-07-26 12:47 UTC (permalink / raw)
  To: Ananyev, Konstantin, Wu, Yanglong, dev
  Cc: Bie, Tiwei, Yao, Lei A, Wu, Yanglong



> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Thursday, July 26, 2018 8:33 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Yanglong
> <yanglong.wu@intel.com>; dev@dpdk.org
> Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> Yanglong <yanglong.wu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Thursday, July 26, 2018 1:26 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>;
> > dev@dpdk.org
> > Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A
> > <lei.a.yao@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> >
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang, Qi Z
> > > Sent: Thursday, July 26, 2018 8:14 PM
> > > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Yanglong
> > > <yanglong.wu@intel.com>; dev@dpdk.org
> > > Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A
> > > <lei.a.yao@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> > > Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size
> > > checking
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Ananyev, Konstantin
> > > > Sent: Thursday, July 26, 2018 5:17 PM
> > > > To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
> > > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > > > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > > > Yanglong <yanglong.wu@intel.com>
> > > > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size
> > > > checking
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> > > > > Sent: Thursday, July 26, 2018 7:46 AM
> > > > > To: dev@dpdk.org
> > > > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > > > > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > > > > Yanglong <yanglong.wu@intel.com>
> > > > > Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size
> > > > > checking
> > > > >
> > > > > No need to check max frame size in TX, the checking should be
> > > > > done in up layer protocal. This checking will lead to fail for
> > > > > TSO or other application cases.
> > > >
> > > > Not sure why is that?
> > > > i40e doesn't support single packet bigger then 9.5KB (or so), as I
> remember.
> > > > For TSO the limit is 256KB - yes, it is bibber, but still there is a limit.
> > >
> > > I think we can't support more than 8 segment for TSO, right? so if
> > > the limit is 256KB, seems it is a redundant.
> 
> As I remember there is no limit for number of segs for TSO.
> For non-TSO - yes, max 8 segments per packet.

Oh, yes, it's only for non-TSO case, for TSO case, 
So I agree the correct fix is we check the 256KB boundary for TSO case 
And still need to check the 9.5k boundary for non-TSO case.

> 
> >
> > I mean buffer size limit is 16kb according to datasheet.
> >
> > >
> > > > Might be we need to change that check, but I think we still need to keep
> it.
> > > > Konstantin
> > >
> > > >
> > > > >
> > > > > Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> > > > >
> > > > > Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> > > > > ---
> > > > >  drivers/net/i40e/i40e_rxtx.c | 3 +--
> > > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > > > > b/drivers/net/i40e/i40e_rxtx.c index 3be87fe6a..baad433a7 100644
> > > > > --- a/drivers/net/i40e/i40e_rxtx.c
> > > > > +++ b/drivers/net/i40e/i40e_rxtx.c
> > > > > @@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void
> > > > > *tx_queue,
> > > > struct rte_mbuf **tx_pkts,
> > > > >  		}
> > > > >
> > > > >  		/* check the size of packet */
> > > > > -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> > > > > -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > > > > +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > > > >  			rte_errno = -EINVAL;
> > > > >  			return i;
> > > > >  		}
> > > > > --
> > > > > 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] net/i40e: fix max frame size checking
  2018-07-26 12:47         ` Zhang, Qi Z
@ 2018-07-26 12:56           ` Ananyev, Konstantin
  0 siblings, 0 replies; 10+ messages in thread
From: Ananyev, Konstantin @ 2018-07-26 12:56 UTC (permalink / raw)
  To: Zhang, Qi Z, Wu, Yanglong, dev; +Cc: Bie, Tiwei, Yao, Lei A, Wu, Yanglong



> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, July 26, 2018 1:48 PM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
> Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> 
> 
> 
> > -----Original Message-----
> > From: Ananyev, Konstantin
> > Sent: Thursday, July 26, 2018 8:33 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Yanglong
> > <yanglong.wu@intel.com>; dev@dpdk.org
> > Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > Yanglong <yanglong.wu@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> >
> >
> >
> > > -----Original Message-----
> > > From: Zhang, Qi Z
> > > Sent: Thursday, July 26, 2018 1:26 PM
> > > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Ananyev, Konstantin
> > > <konstantin.ananyev@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>;
> > > dev@dpdk.org
> > > Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A
> > > <lei.a.yao@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> > > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang, Qi Z
> > > > Sent: Thursday, July 26, 2018 8:14 PM
> > > > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Yanglong
> > > > <yanglong.wu@intel.com>; dev@dpdk.org
> > > > Cc: Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A
> > > > <lei.a.yao@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> > > > Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size
> > > > checking
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Ananyev, Konstantin
> > > > > Sent: Thursday, July 26, 2018 5:17 PM
> > > > > To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
> > > > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > > > > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > > > > Yanglong <yanglong.wu@intel.com>
> > > > > Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size
> > > > > checking
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yanglong Wu
> > > > > > Sent: Thursday, July 26, 2018 7:46 AM
> > > > > > To: dev@dpdk.org
> > > > > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Bie, Tiwei
> > > > > > <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > > > > > Yanglong <yanglong.wu@intel.com>
> > > > > > Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size
> > > > > > checking
> > > > > >
> > > > > > No need to check max frame size in TX, the checking should be
> > > > > > done in up layer protocal. This checking will lead to fail for
> > > > > > TSO or other application cases.
> > > > >
> > > > > Not sure why is that?
> > > > > i40e doesn't support single packet bigger then 9.5KB (or so), as I
> > remember.
> > > > > For TSO the limit is 256KB - yes, it is bibber, but still there is a limit.
> > > >
> > > > I think we can't support more than 8 segment for TSO, right? so if
> > > > the limit is 256KB, seems it is a redundant.
> >
> > As I remember there is no limit for number of segs for TSO.
> > For non-TSO - yes, max 8 segments per packet.
> 
> Oh, yes, it's only for non-TSO case, for TSO case,
> So I agree the correct fix is we check the 256KB boundary for TSO case
> And still need to check the 9.5k boundary for non-TSO case.

Yep, sounds good.

> 
> >
> > >
> > > I mean buffer size limit is 16kb according to datasheet.
> > >
> > > >
> > > > > Might be we need to change that check, but I think we still need to keep
> > it.
> > > > > Konstantin
> > > >
> > > > >
> > > > > >
> > > > > > Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> > > > > >
> > > > > > Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> > > > > > ---
> > > > > >  drivers/net/i40e/i40e_rxtx.c | 3 +--
> > > > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > > > > > b/drivers/net/i40e/i40e_rxtx.c index 3be87fe6a..baad433a7 100644
> > > > > > --- a/drivers/net/i40e/i40e_rxtx.c
> > > > > > +++ b/drivers/net/i40e/i40e_rxtx.c
> > > > > > @@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void
> > > > > > *tx_queue,
> > > > > struct rte_mbuf **tx_pkts,
> > > > > >  		}
> > > > > >
> > > > > >  		/* check the size of packet */
> > > > > > -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> > > > > > -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > > > > > +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > > > > >  			rte_errno = -EINVAL;
> > > > > >  			return i;
> > > > > >  		}
> > > > > > --
> > > > > > 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] net/i40e: fix max frame size checking
  2018-07-26  6:46 [PATCH] net/i40e: fix max frame size checking Yanglong Wu
  2018-07-26  9:16 ` Ananyev, Konstantin
@ 2018-07-27  4:40 ` Yanglong Wu
  2018-07-27  8:13   ` Ananyev, Konstantin
  1 sibling, 1 reply; 10+ messages in thread
From: Yanglong Wu @ 2018-07-27  4:40 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, konstantin.ananyev, lei.a.yao, Yanglong Wu

Check patcket size according to TSO or no-TSO.

Fixes: bfeed0262b0c ("net/i40e: check illegal packets")

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
v2:
change as comments.
---
 drivers/net/i40e/i40e_ethdev.h | 1 +
 drivers/net/i40e/i40e_rxtx.c   | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index cb5e5b5d8..3fffe5a55 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -28,6 +28,7 @@
 #define I40E_NUM_DESC_ALIGN       32
 #define I40E_BUF_SIZE_MIN         1024
 #define I40E_FRAME_SIZE_MAX       9728
+#define I40E_TSO_FRAME_SIZE_MAX   262144
 #define I40E_QUEUE_BASE_ADDR_UNIT 128
 /* number of VSIs and queue default setting */
 #define I40E_MAX_QP_NUM_PER_VF    16
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 3be87fe6a..1bbc0340b 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1439,13 +1439,15 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 
 		/* Check for m->nb_segs to not exceed the limits. */
 		if (!(ol_flags & PKT_TX_TCP_SEG)) {
-			if (m->nb_segs > I40E_TX_MAX_MTU_SEG) {
+			if (m->nb_segs > I40E_TX_MAX_MTU_SEG ||
+			    m->pkt_len > I40E_FRAME_SIZE_MAX) {
 				rte_errno = -EINVAL;
 				return i;
 			}
 		} else if (m->nb_segs > I40E_TX_MAX_SEG ||
 			   m->tso_segsz < I40E_MIN_TSO_MSS ||
-			   m->tso_segsz > I40E_MAX_TSO_MSS) {
+			   m->tso_segsz > I40E_MAX_TSO_MSS ||
+			   m->pkt_len > I40E_TSO_FRAME_SIZE_MAX) {
 			/* MSS outside the range (256B - 9674B) are considered
 			 * malicious
 			 */
@@ -1459,8 +1461,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 		}
 
 		/* check the size of packet */
-		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
-		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
+		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
 			rte_errno = -EINVAL;
 			return i;
 		}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] net/i40e: fix max frame size checking
  2018-07-27  4:40 ` [PATCH v2] " Yanglong Wu
@ 2018-07-27  8:13   ` Ananyev, Konstantin
  2018-07-30  1:05     ` Zhang, Qi Z
  0 siblings, 1 reply; 10+ messages in thread
From: Ananyev, Konstantin @ 2018-07-27  8:13 UTC (permalink / raw)
  To: Wu, Yanglong, dev; +Cc: Zhang, Qi Z, Yao, Lei A



> -----Original Message-----
> From: Wu, Yanglong
> Sent: Friday, July 27, 2018 5:40 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>; Yao, Lei A <lei.a.yao@intel.com>;
> Wu, Yanglong <yanglong.wu@intel.com>
> Subject: [PATCH v2] net/i40e: fix max frame size checking
> 
> Check patcket size according to TSO or no-TSO.
> 
> Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> 
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
> v2:
> change as comments.
> ---
>  drivers/net/i40e/i40e_ethdev.h | 1 +
>  drivers/net/i40e/i40e_rxtx.c   | 9 +++++----
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
> index cb5e5b5d8..3fffe5a55 100644
> --- a/drivers/net/i40e/i40e_ethdev.h
> +++ b/drivers/net/i40e/i40e_ethdev.h
> @@ -28,6 +28,7 @@
>  #define I40E_NUM_DESC_ALIGN       32
>  #define I40E_BUF_SIZE_MIN         1024
>  #define I40E_FRAME_SIZE_MAX       9728
> +#define I40E_TSO_FRAME_SIZE_MAX   262144
>  #define I40E_QUEUE_BASE_ADDR_UNIT 128
>  /* number of VSIs and queue default setting */
>  #define I40E_MAX_QP_NUM_PER_VF    16
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 3be87fe6a..1bbc0340b 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -1439,13 +1439,15 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
> 
>  		/* Check for m->nb_segs to not exceed the limits. */
>  		if (!(ol_flags & PKT_TX_TCP_SEG)) {
> -			if (m->nb_segs > I40E_TX_MAX_MTU_SEG) {
> +			if (m->nb_segs > I40E_TX_MAX_MTU_SEG ||
> +			    m->pkt_len > I40E_FRAME_SIZE_MAX) {
>  				rte_errno = -EINVAL;
>  				return i;
>  			}
>  		} else if (m->nb_segs > I40E_TX_MAX_SEG ||
>  			   m->tso_segsz < I40E_MIN_TSO_MSS ||
> -			   m->tso_segsz > I40E_MAX_TSO_MSS) {
> +			   m->tso_segsz > I40E_MAX_TSO_MSS ||
> +			   m->pkt_len > I40E_TSO_FRAME_SIZE_MAX) {
>  			/* MSS outside the range (256B - 9674B) are considered
>  			 * malicious
>  			 */
> @@ -1459,8 +1461,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
>  		}
> 
>  		/* check the size of packet */
> -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
>  			rte_errno = -EINVAL;
>  			return i;
>  		}
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] net/i40e: fix max frame size checking
  2018-07-27  8:13   ` Ananyev, Konstantin
@ 2018-07-30  1:05     ` Zhang, Qi Z
  0 siblings, 0 replies; 10+ messages in thread
From: Zhang, Qi Z @ 2018-07-30  1:05 UTC (permalink / raw)
  To: Ananyev, Konstantin, Wu, Yanglong, dev; +Cc: Yao, Lei A



> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Friday, July 27, 2018 4:13 PM
> To: Wu, Yanglong <yanglong.wu@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yao, Lei A <lei.a.yao@intel.com>
> Subject: RE: [PATCH v2] net/i40e: fix max frame size checking
> 
> 
> 
> > -----Original Message-----
> > From: Wu, Yanglong
> > Sent: Friday, July 27, 2018 5:40 AM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu,
> > Yanglong <yanglong.wu@intel.com>
> > Subject: [PATCH v2] net/i40e: fix max frame size checking
> >
> > Check patcket size according to TSO or no-TSO.
> >
> > Fixes: bfeed0262b0c ("net/i40e: check illegal packets")
> >
> > Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> > ---
> > v2:
> > change as comments.
> > ---
> >  drivers/net/i40e/i40e_ethdev.h | 1 +
> >  drivers/net/i40e/i40e_rxtx.c   | 9 +++++----
> >  2 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.h
> > b/drivers/net/i40e/i40e_ethdev.h index cb5e5b5d8..3fffe5a55 100644
> > --- a/drivers/net/i40e/i40e_ethdev.h
> > +++ b/drivers/net/i40e/i40e_ethdev.h
> > @@ -28,6 +28,7 @@
> >  #define I40E_NUM_DESC_ALIGN       32
> >  #define I40E_BUF_SIZE_MIN         1024
> >  #define I40E_FRAME_SIZE_MAX       9728
> > +#define I40E_TSO_FRAME_SIZE_MAX   262144
> >  #define I40E_QUEUE_BASE_ADDR_UNIT 128
> >  /* number of VSIs and queue default setting */
> >  #define I40E_MAX_QP_NUM_PER_VF    16
> > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > b/drivers/net/i40e/i40e_rxtx.c index 3be87fe6a..1bbc0340b 100644
> > --- a/drivers/net/i40e/i40e_rxtx.c
> > +++ b/drivers/net/i40e/i40e_rxtx.c
> > @@ -1439,13 +1439,15 @@ i40e_prep_pkts(__rte_unused void *tx_queue,
> > struct rte_mbuf **tx_pkts,
> >
> >  		/* Check for m->nb_segs to not exceed the limits. */
> >  		if (!(ol_flags & PKT_TX_TCP_SEG)) {
> > -			if (m->nb_segs > I40E_TX_MAX_MTU_SEG) {
> > +			if (m->nb_segs > I40E_TX_MAX_MTU_SEG ||
> > +			    m->pkt_len > I40E_FRAME_SIZE_MAX) {
> >  				rte_errno = -EINVAL;
> >  				return i;
> >  			}
> >  		} else if (m->nb_segs > I40E_TX_MAX_SEG ||
> >  			   m->tso_segsz < I40E_MIN_TSO_MSS ||
> > -			   m->tso_segsz > I40E_MAX_TSO_MSS) {
> > +			   m->tso_segsz > I40E_MAX_TSO_MSS ||
> > +			   m->pkt_len > I40E_TSO_FRAME_SIZE_MAX) {
> >  			/* MSS outside the range (256B - 9674B) are considered
> >  			 * malicious
> >  			 */
> > @@ -1459,8 +1461,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,
> struct rte_mbuf **tx_pkts,
> >  		}
> >
> >  		/* check the size of packet */
> > -		if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> > -		    m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> > +		if (m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> >  			rte_errno = -EINVAL;
> >  			return i;
> >  		}
> > --
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied to dpdk-next-net-intel.

Thanks!
Qi
> 
> > 2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-07-30  1:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26  6:46 [PATCH] net/i40e: fix max frame size checking Yanglong Wu
2018-07-26  9:16 ` Ananyev, Konstantin
2018-07-26 12:13   ` Zhang, Qi Z
2018-07-26 12:25     ` Zhang, Qi Z
2018-07-26 12:33       ` Ananyev, Konstantin
2018-07-26 12:47         ` Zhang, Qi Z
2018-07-26 12:56           ` Ananyev, Konstantin
2018-07-27  4:40 ` [PATCH v2] " Yanglong Wu
2018-07-27  8:13   ` Ananyev, Konstantin
2018-07-30  1:05     ` Zhang, Qi Z

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.