net/i40e: fix max frame size checking
PATCH 1/1 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.
--- drivers/net/i40e/i40e_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/i40e/i40e_rxtx.c +1 -2
@@ -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; }
Signature · 1 line
2.11.0
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yanglong Wu
Sent: Thursday, July 26, 2018 7:46 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
Quoted 3 lines
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
Quoted 24 lines
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/i40e/i40e_rxtx.c +1
-3@@ -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
Quoted 21 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, July 26, 2018 5:17 PM
To: Wu, Yanglong <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yanglong Wu
Sent: Thursday, July 26, 2018 7:46 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checking
Quoted 7 lines
Quoted 3 lines
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.
Quoted 29 lines
Might be we need to change that check, but I think we still need to keep it. Konstantin
drivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void *tx_queue,
Quoted 13 lines
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex3be87fe6a..baad433a7100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,struct
rte_mbuf**tx_pkts,Quoted 11 lines
drivers/net/i40e/i40e_rxtx.c +1
-3}/* 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
Quoted 37 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Zhang, Qi Z
Sent: Thursday, July 26, 2018 8:14 PM
To: Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 24 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, July 26, 2018 5:17 PM
To: Wu, Yanglong <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 12 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yanglong Wu
Sent: Thursday, July 26, 2018 7:46 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingNo 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.
Quoted 6 lines
Quoted 3 lines
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.
Quoted 30 lines
Quoted 30 lines
Might be we need to change that check, but I think we still need to keep it. Konstantin
drivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void *tx_queue,
Quoted 13 lines
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex3be87fe6a..baad433a7100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,struct
rte_mbuf**tx_pkts,Quoted 11 lines
drivers/net/i40e/i40e_rxtx.c +1
-3}/* 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
Quoted 53 lines
-----Original Message-----
From: Zhang, Qi Z
Sent: Thursday, July 26, 2018 1:26 PM
To: Zhang, Qi Z <[email protected]>; Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 41 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Zhang, Qi Z
Sent: Thursday, July 26, 2018 8:14 PM
To: Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 20 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, July 26, 2018 5:17 PM
To: Wu, Yanglong <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yanglong Wu
Sent: Thursday, July 26, 2018 7:46 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 7 lines
Quoted 3 lines
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.
Quoted 33 lines
I mean buffer size limit is 16kb according to datasheet.
Quoted 30 lines
Quoted 30 lines
Might be we need to change that check, but I think we still need to keep it. Konstantin
drivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void *tx_queue,
Quoted 13 lines
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex3be87fe6a..baad433a7100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,struct
rte_mbuf**tx_pkts,Quoted 11 lines
drivers/net/i40e/i40e_rxtx.c +1
-3}/* 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
Quoted 65 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, July 26, 2018 8:33 PM
To: Zhang, Qi Z <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 52 lines
-----Original Message-----
From: Zhang, Qi Z
Sent: Thursday, July 26, 2018 1:26 PM
To: Zhang, Qi Z <[email protected]>; Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 40 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Zhang, Qi Z
Sent: Thursday, July 26, 2018 8:14 PM
To: Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 28 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, July 26, 2018 5:17 PM
To: Wu, Yanglong <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yanglong Wu
Sent: Thursday, July 26, 2018 7:46 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 3 lines
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
Quoted 8 lines
remember.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 36 lines
Quoted 6 lines
I mean buffer size limit is 16kb according to datasheet.
Quoted 2 lines
Quoted 2 lines
Might be we need to change that check, but I think we still need to keep
it.
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Konstantin
Quoted 13 lines
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex3be87fe6a..baad433a7100644drivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void · line 1459
Quoted 1 line
drivers/net/i40e/i40e_rxtx.c +0
-0@@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,struct
rte_mbuf**tx_pkts,Quoted 11 lines
drivers/net/i40e/i40e_rxtx.c +1
-2}/* 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
Quoted 80 lines
-----Original Message-----
From: Zhang, Qi Z
Sent: Thursday, July 26, 2018 1:48 PM
To: Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 69 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, July 26, 2018 8:33 PM
To: Zhang, Qi Z <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 52 lines
-----Original Message-----
From: Zhang, Qi Z
Sent: Thursday, July 26, 2018 1:26 PM
To: Zhang, Qi Z <[email protected]>; Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 40 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Zhang, Qi Z
Sent: Thursday, July 26, 2018 8:14 PM
To: Ananyev, Konstantin <[email protected]>; Wu, Yanglong <[email protected]>; [email protected]
Cc: Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 28 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, July 26, 2018 5:17 PM
To: Wu, Yanglong <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yanglong Wu
Sent: Thursday, July 26, 2018 7:46 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Bie, Tiwei <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [dpdk-dev] [PATCH] net/i40e: fix max frame size checkingQuoted 3 lines
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 Iremember.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 6 lines
Quoted 2 lines
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.
Quoted 37 lines
Quoted 37 lines
Quoted 7 lines
I mean buffer size limit is 16kb according to datasheet.
Quoted 2 lines
Quoted 2 lines
Might be we need to change that check, but I think we still need to keep
it.
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Konstantin
Quoted 13 lines
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex3be87fe6a..baad433a7100644drivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void · line 1459
Quoted 1 line
drivers/net/i40e/i40e_rxtx.c +0
-0@@ -1459,8 +1459,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,struct
rte_mbuf**tx_pkts,Quoted 11 lines
drivers/net/i40e/i40e_rxtx.c +1
-2}/* 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
PATCH v2 1/1 net/i40e: fix max frame size checking
In reply to Yanglong WuCheck patcket size according to TSO or no-TSO.
---
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(-)
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -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
drivers/net/i40e/i40e_rxtx.c +5 -4
@@ -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; }
Signature · 1 line
2.11.0
Quoted 58 lines
-----Original Message-----
From: Wu, Yanglong
Sent: Friday, July 27, 2018 5:40 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Ananyev, Konstantin <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [PATCH v2] net/i40e: fix max frame size checkingCheck patcket size according to TSO or no-TSO.
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>---
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(-)drivers/net/i40e/i40e_ethdev.h +1
-0@@ -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 16drivers/net/i40e/i40e_rxtx.c +4
-2@@ -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 */
drivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +1
-3@@ -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; } --
Quoted 1 line
2.11.0
Zhang, Qi Z
AppliedQuoted 72 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Friday, July 27, 2018 4:13 PM
To: Wu, Yanglong <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yao, Lei A <[email protected]>
Subject: RE: [PATCH v2] net/i40e: fix max frame size checkingdrivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void *tx_queue,
Quoted 58 lines
-----Original Message-----
From: Wu, Yanglong
Sent: Friday, July 27, 2018 5:40 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Ananyev, Konstantin <[email protected]>; Yao, Lei A <[email protected]>; Wu, Yanglong <[email protected]>
Subject: [PATCH v2] net/i40e: fix max frame size checkingCheck patcket size according to TSO or no-TSO.
Fixes bfeed0262b0c ("net/i40e: check illegal packets")Signed-off-by Yanglong Wu <[email protected]>---
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(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.hindexcb5e5b5d8..3fffe5a55100644drivers/net/i40e/i40e_ethdev.h +1
-0@@ -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(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex3be87fe6a..1bbc0340b100644drivers/net/i40e/i40e_rxtx.c +4
-2@@ -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 drivers/net/i40e/i40e_rxtx.c +0
-0*/ @@ -1459,8 +1461,7 @@ i40e_prep_pkts(__rte_unused void *tx_queue,struct
rte_mbuf**tx_pkts,Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0}
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +1
-3/* 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; } --
Applied to dpdk-next-net-intel.
Thanks!
Qi
Quoted 2 lines
Quoted 2 lines
2.11.0