net/i40e: add Tx preparation for vector data path
PATCH 1/1 net/i40e: add Tx preparation for vector data path
Fill up dev->tx_pkt_prepare to i40e_pkt_prepare when on vector and simple data path selection, as the sanity check is needed ideally.
--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx.c +1 -1
@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;
Signature · 1 line
2.17.1
Quoted 9 lines
-----Original Message-----
From: Rong, Leyi <[email protected]>
Sent: Wednesday, March 31, 2021 4:54 PM
To: Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [PATCH] net/i40e: add Tx preparation for vector data path
Quoted 4 lines
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 14 lines · Leyi Rong
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/i40e/i40e_rxtx.c +0
-0
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;
I find this a bit surprising to set this op at two different locations. Why not simply leave the value set in i40e_ethdev.c?
Signature · 1 line
David Marchand
Quoted 13 lines · Leyi Rong
Quoted 9 lines
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 13 lines
drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;I find this a bit surprising to set this op at two different locations. Why not simply leave the value set in
i40e_ethdev.c?
Actually I wonder should we set dev->tx_pkt_prepare to point to i40e_prep_pkts() for simple TX path?
As I remember, simple TX path doesn't support neither multi-segment packets, neither TX offloads.
While i40e_prep_pkts() assumes that selected tx_burst() supports all that. If you don't want to keep dev->tx_pkt_prepare==NULL for simple TX path, why not create a new one: i40e_simple_prep_pkts() or so?
Konstantin
Quoted 14 lines · Leyi Rong
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/i40e/i40e_rxtx.c +0
-0
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;
It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepare used always.
Quoted 31 lines
-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Thursday, April 8, 2021 12:40 AM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/i40e: add Tx preparation for vector data pathQuoted 20 lines · Leyi Rong
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex61cb204be2..b3d7765e3b100644drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." );
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0dev->tx_pkt_burst = i40e_xmit_pkts;It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepare used always.
Hi Ferruh,
Yes, it make sense.
Hi Konstantin,
Would that be something wrong if the prepare function goes for simple Tx function although it does not support the offload feature yet?
Quoted 41 lines
Quoted 32 lines
-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Thursday, April 8, 2021 12:40 AM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/i40e: add Tx preparation for vector data pathQuoted 20 lines · Leyi Rong
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex61cb204be2..b3d7765e3b100644drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." );Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0dev->tx_pkt_burst = i40e_xmit_pkts;It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepare used always.
Quoted 5 lines
Hi Ferruh,
Yes, it make sense.
Hi Konstantin,
Hi Leyi,
Quoted 3 lines
Would that be something wrong if the prepare function goes for simple Tx function although it does not support the offload feature yet?
Current situation:
For simple TX path we set dev->tx_pkt_prepare = NULL.
That makes rte_eth_tx_prepare() a stub that does nothing and always returns: "All packets are good". That is unsafe off-course, and if upper layer will pass a packet that is not supported, then it can lead to various bad things: bad cksum, corrupted packets, TX hang, etc. But at least it keeps simple TX path fast.
With that patch:
For simple TX path we set dev->tx_pkt_prepare = i40e_prep_pkts.
Now on TX path we invoke extra function that does a lot of checks, but it still unsafe:
as i40e_prep_pkts() assumes that full-featured TX function is in place (multi-segs are allowed, etc.). So our simple TX path became slower, but still is unsafe.
I think that if we want to introduce tx_prepare() for simple TX path,
then the proper way - create a new function for it (i40e_simple_prep_pkts() or so).
It will be aware that simple TX path is in place and more restrictions should be met:
check that nb_segs==1 and no TX offloads (except FAST_FREE?) are enabled,
plus usual checks for min and max pkt_len.
Konstantin
Quoted 87 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Thursday, April 8, 2021 6:33 PM
To: Rong, Leyi <[email protected]>; Yigit, Ferruh <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/i40e: add Tx preparation for vector data pathQuoted 31 lines
Quoted 31 lines
-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Thursday, April 8, 2021 12:40 AM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/i40e: add Tx preparation for vector data pathQuoted 20 lines · Leyi Rong
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex61cb204be2..b3d7765e3b100644drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." );Quoted 8 lines
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0dev->tx_pkt_burst = i40e_xmit_pkts;It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepareused always.
Quoted 6 lines
Hi Ferruh,
Yes, it make sense.
Hi Konstantin,
Hi Leyi,
Quoted 2 lines
Would that be something wrong if the prepare function goes for simple Tx
function although it does not support the offload feature yet?
Quoted 1 line
Current situation:
For simple TX path we setdev->tx_pkt_prepare= NULL.
That makesrte_eth_tx_prepare()a stub that does nothing and always returns:
"All packets are good".
That is unsafe off-course, and if upper layer will pass a packet that is not supported, then it can lead to various bad things: bad cksum, corrupted packets, TX hang, etc.
But at least it keeps simple TX path fast.
With that patch:
For simple TX path we setdev->tx_pkt_prepare=i40e_prep_pkts.
Now on TX path we invoke extra function that does a lot of checks, but it still unsafe:
asi40e_prep_pkts()assumes that full-featured TX function is in place (multi-segs are allowed, etc.).
So our simple TX path became slower, but still is unsafe.
I think that if we want to introducetx_prepare()for simple TX path, then the proper way - create a new function for it (i40e_simple_prep_pkts()or so). It will be aware that simple TX path is in place and more restrictions should be met:
check that nb_segs==1 and no TX offloads (exceptFAST_FREE?) are enabled, plus usual checks for min and maxpkt_len.
Quoted 2 lines
Konstantin
Hi Konstantin,
Thanks for the explanation, I know the current full-featured prepare function will cost more CPU cycle, but not sure how to say is still unsafe?
Why I set the simple Tx prepare function to the current i40e_prep_pkts() is we may support more offload features like current full-featured Tx for vector path(which is included in simple Tx currently), if so, the current tx prepare function can be re-used.
Quoted 67 lines
Quoted 67 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex61cb204be2..b3d7765e3b100644drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." );Quoted 8 lines
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0dev->tx_pkt_burst = i40e_xmit_pkts;It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepareused always.
Quoted 6 lines
Hi Ferruh,
Yes, it make sense.
Hi Konstantin,
Hi Leyi,
Quoted 2 lines
Would that be something wrong if the prepare function goes for simple Tx
function although it does not support the offload feature yet?
Quoted 1 line
Current situation:
For simple TX path we setdev->tx_pkt_prepare= NULL.
That makesrte_eth_tx_prepare()a stub that does nothing and always returns:
"All packets are good".
That is unsafe off-course, and if upper layer will pass a packet that is not supported, then it can lead to various bad things: bad cksum, corrupted packets, TX hang, etc.
But at least it keeps simple TX path fast.
With that patch:
For simple TX path we setdev->tx_pkt_prepare=i40e_prep_pkts.
Now on TX path we invoke extra function that does a lot of checks, but it still unsafe:
asi40e_prep_pkts()assumes that full-featured TX function is in place (multi-segs are allowed, etc.).
So our simple TX path became slower, but still is unsafe.
I think that if we want to introducetx_prepare()for simple TX path, then the proper way - create a new function for it (i40e_simple_prep_pkts()or so). It will be aware that simple TX path is in place and more restrictions should be met:
check that nb_segs==1 and no TX offloads (exceptFAST_FREE?) are enabled, plus usual checks for min and maxpkt_len.
Quoted 2 lines
Quoted 2 lines
Konstantin
Hi Leyi,
Quoted 4 lines
Hi Konstantin,
Thanks for the explanation, I know the current full-featured prepare function will cost more CPU cycle, but not sure how to say is still unsafe?
Let say user will do:
mb = create_and_fill_multi_seg_pkt(...);
n = rte_eth_tx_prepare(p, q, &mb, 1);
if (n == 1)
n = rte_eth_tx_burst(p, q, &mb, 1);
else
rte_pktmbuf_free(mb);
if dev->tx_pkt_prepare == i40e_prep_pkts and dev->tx_pkt_burs == i40e_xmit_pkts_simple, then this code will TX the packet, even though it shouldn't in theory.
Quoted 2 lines
Why I set the simple Tx prepare function to the current
i40e_prep_pkts()is we may support more offload features like current full-featured Tx for vector path(which is included in simple Tx currently), if so, the current tx prepare function can be re-used.
AFAIK, for i40e current simple (and vector) TX path doesn't support all offloads that are supported by full-featured path To be more specific: mulit-seg packets, TCP_CKSUM, TCP_SEG, etc.
Am I missing something obvious here?
Konstantin
Quoted 106 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Friday, April 9, 2021 6:40 PM
To: Rong, Leyi <[email protected]>; Yigit, Ferruh <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/i40e: add Tx preparation for vector data pathQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev
Quoted 6 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex61cb204be2..b3d7765e3b100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev*dev)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev · line 3412
Quoted 1 line
drivers/net/i40e/i40e_rxtx.c +0
-0PMD_INIT_LOG(DEBUG, "Simple tx finally beused.");
Quoted 26 lines
Quoted 26 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/net/i40e/i40e_rxtx.c +1
-1dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;Quoted 8 lines
Quoted 8 lines
Quoted 1 line
It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepareused always.
Quoted 6 lines
Hi Ferruh,
Yes, it make sense.
Hi Konstantin,
Hi Leyi,
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Would that be something wrong if the prepare function goes for simple Tx
function although it does not support the offload feature yet?
Quoted 1 line
Current situation:
For simple TX path we setdev->tx_pkt_prepare= NULL. That makesrte_eth_tx_prepare()a stub that does nothing and alwaysreturns:
Quoted 7 lines
Quoted 7 lines
"All packets are good".
That is unsafe off-course, and if upper layer will pass a packet that is not supported, then it can lead to various bad things: bad cksum, corrupted packets, TX hang, etc.
But at least it keeps simple TX path fast.
With that patch:
For simple TX path we setdev->tx_pkt_prepare=i40e_prep_pkts.Quoted 8 lines
Quoted 8 lines
Now on TX path we invoke extra function that does a lot of checks, but it still
unsafe:
asi40e_prep_pkts()assumes that full-featured TX function is in place (multi-segs are allowed, etc.).
So our simple TX path became slower, but still is unsafe. I think that if we want to introducetx_prepare()for simple TX path, then the proper way - create a new function for it(
i40e_simple_prep_pkts()or so).Quoted 8 lines
Quoted 8 lines
It will be aware that simple TX path is in place and more restrictions should be
met:
check that nb_segs==1 and no TX offloads (exceptFAST_FREE?) are enabled, plus usual checks for min and maxpkt_len.Konstantin
Hi Leyi,
Quoted 4 lines
Hi Konstantin,
Thanks for the explanation, I know the current full-featured prepare function will cost more CPU cycle, but not sure how to say is still unsafe?
Let say user will do:
mb =
create_and_fill_multi_seg_pkt(...);
n =rte_eth_tx_prepare(p, q, &mb, 1);
if (n == 1)
n =rte_eth_tx_burst(p, q, &mb, 1);
else
rte_pktmbuf_free(mb);
Quoted 4 lines
if
dev->tx_pkt_prepare==i40e_prep_pktsanddev->tx_pkt_burs==i40e_xmit_pkts_simple, then this code will TX the packet, even though it shouldn't in theory.
Hi Konstantin,
Yes, it make sense for the current situation.
Quoted 11 lines
Quoted 2 lines
Why I set the simple Tx prepare function to the current
i40e_prep_pkts()is we may support more offload features like current full-featured Tx for vector path(which is included in simple Tx currently), if so, the current tx prepare function can be re-used.
AFAIK, for i40e current simple (and vector) TX path doesn't support all offloads that are supported by full-featured path To be more specific: mulit-seg packets,
TCP_CKSUM,TCP_SEG, etc.
Am I missing something obvious here?Konstantin
We're intending to support more offload features into vector path gradually, ice/iavf PMD will support Tx checksum offload in AVX512 path in the 2105 release, also will try to support more in the future if possible.
Quoted 96 lines
Quoted 96 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev
Quoted 6 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex61cb204be2..b3d7765e3b100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev*dev)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev · line 3412
Quoted 1 line
drivers/net/i40e/i40e_rxtx.c +0
-0PMD_INIT_LOG(DEBUG, "Simple tx finally beused.");
Quoted 26 lines
Quoted 26 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/net/i40e/i40e_rxtx.c +1
-1dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;Quoted 8 lines
Quoted 8 lines
Quoted 1 line
It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepareused always.
Quoted 6 lines
Hi Ferruh,
Yes, it make sense.
Hi Konstantin,
Hi Leyi,
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Would that be something wrong if the prepare function goes for simple Tx
function although it does not support the offload feature yet?
Quoted 1 line
Current situation:
For simple TX path we setdev->tx_pkt_prepare= NULL. That makesrte_eth_tx_prepare()a stub that does nothing and alwaysreturns:
Quoted 7 lines
Quoted 7 lines
"All packets are good".
That is unsafe off-course, and if upper layer will pass a packet that is not supported, then it can lead to various bad things: bad cksum, corrupted packets, TX hang, etc.
But at least it keeps simple TX path fast.
With that patch:
For simple TX path we setdev->tx_pkt_prepare=i40e_prep_pkts.Quoted 8 lines
Quoted 8 lines
Now on TX path we invoke extra function that does a lot of checks, but it still
unsafe:
asi40e_prep_pkts()assumes that full-featured TX function is in place (multi-segs are allowed, etc.).
So our simple TX path became slower, but still is unsafe. I think that if we want to introducetx_prepare()for simple TX path, then the proper way - create a new function for it(
i40e_simple_prep_pkts()or so).Quoted 8 lines
Quoted 8 lines
It will be aware that simple TX path is in place and more restrictions should be
met:
check that nb_segs==1 and no TX offloads (exceptFAST_FREE?) are enabled, plus usual checks for min and maxpkt_len.Konstantin
Hi Leyi,
Quoted 4 lines
Hi Konstantin,
Thanks for the explanation, I know the current full-featured prepare function will cost more CPU cycle, but not sure how to say is still unsafe?
Let say user will do:
mb =
create_and_fill_multi_seg_pkt(...);
n =rte_eth_tx_prepare(p, q, &mb, 1);
if (n == 1)
n =rte_eth_tx_burst(p, q, &mb, 1);
else
rte_pktmbuf_free(mb);
Quoted 8 lines
Quoted 4 lines
if
dev->tx_pkt_prepare==i40e_prep_pktsanddev->tx_pkt_burs==i40e_xmit_pkts_simple, then this code will TX the packet, even though it shouldn't in theory.Hi Konstantin,
Yes, it make sense for the current situation.
Hmm, could you elaborate a bit: what exactly makes sense?
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Why I set the simple Tx prepare function to the current
i40e_prep_pkts()is we may support more offload features like current full-featured Tx for vector path(which is included in simple Tx currently), if so, the current tx prepare function can be re-used.
AFAIK, for i40e current simple (and vector) TX path doesn't support all offloads that are supported by full-featured path To be more specific: mulit-seg packets,
TCP_CKSUM,TCP_SEG, etc.
Am I missing something obvious here?
Quoted 4 lines
Quoted 1 line
Konstantin
We're intending to support more offload features into vector path gradually, ice/iavf PMD will support Tx checksum offload in AVX512 path in the 2105 release, also will try to support more in the future if possible.
Well, when i40e vector TX will support these offloads, then it will make sense to use the same prepare function for it.
But right now, I think it is not the case.
So I still think create a separate one is the best approach for now.
Quoted 22 lines · Ferruh Yigit
Quoted 20 lines · Leyi Rong
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." );
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0dev->tx_pkt_burst = i40e_xmit_pkts;It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepare used always.
As I said earlier, what is the point of setting it in ethdev.c too? It would be more consistent to have this in a single location.
drivers/net/i40e/i40e_ethdev.c: dev->tx_pkt_burst = i40e_xmit_pkts; drivers/net/i40e/i40e_ethdev.c: dev->tx_pkt_prepare = i40e_prep_pkts;drivers/net/i40e/i40e_ethdev_vf.c: eth_dev->tx_pkt_burst = &i40e_xmit_pkts;drivers/net/i40e/i40e_rxtx.c: if (dev->tx_pkt_burst ==i40e_xmit_pkts_vec_avx512) {drivers/net/i40e/i40e_rxtx.c: if (dev->tx_pkt_burst ==i40e_xmit_pkts_vec_avx2 ||drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_burst ==i40e_xmit_pkts_vec) {drivers/net/i40e/i40e_rxtx.c:dev->tx_pkt_burst = i40e_xmit_pkts_vec_avx512; drivers/net/i40e/i40e_rxtx.c:dev->tx_pkt_burst = use_avx2 ?drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_burst =i40e_xmit_pkts_simple;
drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_prepare = NULL; drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_burst = i40e_xmit_pkts; drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_prepare = i40e_prep_pkts; drivers/net/i40e/i40e_rxtx.c: eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
drivers/net/i40e/i40e_vf_representor.c: ethdev->tx_pkt_burst = i40e_vf_representor_tx_burst;
Signature · 1 line
David Marchand
Quoted 65 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, April 8, 2021 4:40 PM
To: Yigit, Ferruh <[email protected]>
Cc: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>; Xing, Beilei <[email protected]>; dev <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: add Tx preparation for vector data pathQuoted 22 lines · Ferruh Yigit
Quoted 20 lines · Leyi Rong
Fill up
dev->tx_pkt_preparetoi40e_pkt_preparewhen on vector and simple data path selection, as the sanity check is needed ideally.Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex61cb204be2..b3d7765e3b100644drivers/net/i40e/i40e_rxtx.c +1
-1@@ -3412,7 +3412,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." );Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c i40e_set_tx_function(struct rte_eth_dev *dev) · line 3418
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0dev->tx_pkt_burst = i40e_xmit_pkts;It seems prepare function is doing some sanity checks before handing packets to the HW.
So with this change all Tx paths calls the same Tx prepare function, if so why not set the function pointer outside of the if block, instead of setting it in both legs of the if/else? This clarifies that Tx prepareused always.
As I said earlier, what is the point of setting it in
ethdev.ctoo? It would be more consistent to have this in a single location.
drivers/net/i40e/i40e_ethdev.c:dev->tx_pkt_burst=i40e_xmit_pkts;drivers/net/i40e/i40e_ethdev.c:dev->tx_pkt_prepare=i40e_prep_pkts;drivers/net/i40e/i40e_ethdev_vf.c:eth_dev->tx_pkt_burst=&i40e_xmit_pkts;drivers/net/i40e/i40e_rxtx.c: if (dev->tx_pkt_burst==i40e_xmit_pkts_vec_avx512) {drivers/net/i40e/i40e_rxtx.c: if (dev->tx_pkt_burst==i40e_xmit_pkts_vec_avx2||drivers/net/i40e/i40e_rxtx.c:dev->tx_pkt_burst==i40e_xmit_pkts_vec) {drivers/net/i40e/i40e_rxtx.c:dev->tx_pkt_burst=i40e_xmit_pkts_vec_avx512;drivers/net/i40e/i40e_rxtx.c:dev->tx_pkt_burst=use_avx2?drivers/net/i40e/i40e_rxtx.c:dev->tx_pkt_burst=i40e_xmit_pkts_simple;drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_prepare = NULL; drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_burst = i40e_xmit_pkts; drivers/net/i40e/i40e_rxtx.c: dev->tx_pkt_prepare = i40e_prep_pkts; drivers/net/i40e/i40e_rxtx.c: eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
Quoted 6 lines
drivers/net/i40e/i40e_vf_representor.c:ethdev->tx_pkt_burst=i40e_vf_representor_tx_burst;--
David Marchand
Hi David,
Yes, if agreed to set the same prepare function for all Tx path, can leave the setting in one place.
PATCH v2 1/1 net/i40e: add Tx preparation for simple Tx data path
In reply to Leyi RongIntroduce i40e_simple_prep_pkts() as the preparation function for simple Tx data path, as it's for sanity check for simple Tx.
--- drivers/net/i40e/i40e_rxtx.c | 42 +++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx.c +41 -1
@@ -1479,6 +1479,46 @@ i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,return nb_tx; } +/********************************************************************* +* +* TX simple prep functions +* +**********************************************************************/ +uint16_t +i40e_simple_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) +{ +int i; +uint64_t ol_flags; +struct rte_mbuf *m; +struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue; + +for (i =0 ; i < nb_pkts; i++) { + m = tx_pkts[i]; + ol_flags = m->ol_flags; + +if (!(txq->offloads == + (txq->offloads &DEV_TX_OFFLOAD_MBUF_FAST_FREE ) && + m->nb_segs ==1 )) { + rte_errno =EINVAL ; +return i; + } + +if (ol_flags &I40E_TX_OFFLOAD_NOTSUP_MASK ) { + rte_errno =ENOTSUP ; +return i; + } + +/* check the size of packet */ +if (m->pkt_len <I40E_TX_MIN_PKT_LEN || + m->pkt_len >I40E_FRAME_SIZE_MAX ) { + rte_errno =EINVAL ; +return i; + } + } +return i; +} +/********************************************************************* * * TX prep functions
@@ -3412,7 +3452,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_simple_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;
drivers/net/i40e/i40e_rxtx.h +2 -0
@@ -208,6 +208,8 @@ uint16_t i40e_recv_scattered_pkts(void *rx_queue,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t i40e_simple_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);uint16_t i40e_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int i40e_tx_queue_init (struct i40e_tx_queue *txq);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2] net/i40e: add Tx preparation for simple Tx data path
Quoted 10 lines
-----Original Message-----
From: Rong, Leyi <[email protected]>
Sent: Monday, April 19, 2021 4:36 PM
To: Zhang, Qi Z <[email protected]>; Ananyev, Konstantin <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [PATCH v2] net/i40e: add Tx preparation for simple Tx data path
Quoted 5 lines
Introduce
i40e_simple_prep_pkts()as the preparation function for simple Tx data path, as it's for sanity check for simple Tx.Suggested-by Konstantin Ananyev <[email protected]>Signed-off-by Leyi Rong <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi
Re: [dpdk-dev] [PATCH v2] net/i40e: add Tx preparation for simple Tx data path
In reply to Leyi RongHi Leyi,
Quoted 29 lines
Introduce
i40e_simple_prep_pkts()as the preparation function for simple Tx data path, as it's for sanity check for simple Tx.Suggested-by Konstantin Ananyev <[email protected]>Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 42 +++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-)drivers/net/i40e/i40e_rxtx.c +11
-0@@ -1479,6 +1479,46 @@ i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,return nb_tx; } +/********************************************************************* +* +* TX simple prep functions +* +**********************************************************************/ +uint16_t +i40e_simple_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) +{ +int i; +uint64_t ol_flags;
drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 1502
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +10
-0+struct rte_mbuf *m; +struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue; + +for (i =0 ; i < nb_pkts; i++) { + m = tx_pkts[i]; + ol_flags = m->ol_flags; + +if (!(txq->offloads == + (txq->offloads &DEV_TX_OFFLOAD_MBUF_FAST_FREE ) && + m->nb_segs ==1 )) {
I think we don't need to check txq->offloads here, they should be already checked at setup phase. I suppose:
if (m->nb_segs != 1) {...}
should be enough here.
drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 1507
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c +5
-0+ rte_errno =EINVAL ; +return i; + } + +if (ol_flags &I40E_TX_OFFLOAD_NOTSUP_MASK ) {
It would return OK for the packet with any supported by any i40e TX offload (full-featured path). Probably we need here instead:
if (ol_flags & PKT_TX_OFFLOAD_MASK) {...}
Quoted 41 lines
drivers/net/i40e/i40e_rxtx.c +15
-1+ rte_errno =ENOTSUP ; +return i; + } + +/* check the size of packet */ +if (m->pkt_len <I40E_TX_MIN_PKT_LEN || + m->pkt_len >I40E_FRAME_SIZE_MAX ) { + rte_errno =EINVAL ; +return i; + } + } +return i; +} +/********************************************************************* * * TX prep functions @@ -3412,7 +3452,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_simple_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;drivers/net/i40e/i40e_rxtx.h +2
-1@@ -208,6 +208,8 @@ uint16_t i40e_recv_scattered_pkts(void *rx_queue,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t i40e_simple_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);uint16_t i40e_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int i40e_tx_queue_init (struct i40e_tx_queue *txq); --2.17.1
Re: [dpdk-dev] [PATCH v2] net/i40e: add Tx preparation for simple Tx data path
Quoted 78 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Monday, April 19, 2021 6:59 PM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH v2] net/i40e: add Tx preparation for simple Tx data pathHi Leyi,
drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct
Quoted 16 lines
Introduce
i40e_simple_prep_pkts()as the preparation function for simple Tx data path, as it's for sanity check for simple Tx.Suggested-by Konstantin Ananyev <[email protected]>Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 42 +++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex3c7686c3f4..282eb5924b100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -1479,6 +1479,46 @@ i40e_xmit_pkts_vec(void *tx_queue, struct
rte_mbuf**tx_pkts,drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
Quoted 4 lines
drivers/net/i40e/i40e_rxtx.c +0
-0return nb_tx; }+/***************************************************************
*****drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
Quoted 6 lines
drivers/net/i40e/i40e_rxtx.c +5
-0+* +* +* TX simple prep functions +* ++****************************************************************
*****drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct · line 1491
Quoted 3 lines
drivers/net/i40e/i40e_rxtx.c +3
-0+*/ +uint16_t +i40e_simple_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf**tx_pkts,
drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
Quoted 13 lines
drivers/net/i40e/i40e_rxtx.c +13
-0+ uint16_t nb_pkts) +{ +int i; +uint64_t ol_flags; +struct rte_mbuf *m; +struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue; + +for (i =0 ; i < nb_pkts; i++) { + m = tx_pkts[i]; + ol_flags = m->ol_flags; + + if (!(txq->offloads == + (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)&&
drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 1502
Quoted 1 line
drivers/net/i40e/i40e_rxtx.c +1
-0+ m->nb_segs == 1)) {I think we don't need to check
txq->offloadshere, they should be already checked at setup phase.
I suppose:
if (m->nb_segs!= 1) {...}
should be enough here.drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 1507
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c +5
-0+ rte_errno =EINVAL ; +return i; + } + +if (ol_flags &I40E_TX_OFFLOAD_NOTSUP_MASK ) {It would return OK for the packet with any supported by any i40e TX offload (full-featured path).
Probably we need here instead:
if (ol_flags&PKT_TX_OFFLOAD_MASK) {...}
Quoted 3 lines
drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, · line 1510
Quoted 3 lines
drivers/net/i40e/i40e_rxtx.c +3
-0+ rte_errno =ENOTSUP ; +return i; + }
Hi Konstantin,
Got your points, will be fixed in v3, thanks!
PATCH v3 1/1 net/i40e: add Tx preparation for simple Tx data path
In reply to Leyi RongIntroduce i40e_simple_prep_pkts() as the preparation function for simple Tx data path, as it's for sanity check for simple Tx.
--- drivers/net/i40e/i40e_rxtx.c | 39 +++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 2 files changed, 40 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx.c +38 -1
@@ -1479,6 +1479,43 @@ i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,return nb_tx; } +/********************************************************************* +* +* TX simple prep functions +* +**********************************************************************/ +uint16_t +i40e_simple_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) +{ +int i; +uint64_t ol_flags; +struct rte_mbuf *m; + +for (i =0 ; i < nb_pkts; i++) { + m = tx_pkts[i]; + ol_flags = m->ol_flags; + +if (m->nb_segs !=1 ) { + rte_errno =EINVAL ; +return i; + } + +if (ol_flags &PKT_TX_OFFLOAD_MASK ) { + rte_errno =ENOTSUP ; +return i; + } + +/* check the size of packet */ +if (m->pkt_len <I40E_TX_MIN_PKT_LEN || + m->pkt_len >I40E_FRAME_SIZE_MAX ) { + rte_errno =EINVAL ; +return i; + } + } +return i; +} +/********************************************************************* * * TX prep functions
@@ -3412,7 +3449,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_simple_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;
drivers/net/i40e/i40e_rxtx.h +2 -0
@@ -208,6 +208,8 @@ uint16_t i40e_recv_scattered_pkts(void *rx_queue,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t i40e_simple_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);uint16_t i40e_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int i40e_tx_queue_init (struct i40e_tx_queue *txq);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3] net/i40e: add Tx preparation for simple Tx data path
Quoted 73 lines
Introduce
i40e_simple_prep_pkts()as the preparation function for simple Tx data path, as it's for sanity check for simple Tx.Suggested-by Konstantin Ananyev <[email protected]>Signed-off-by Leyi Rong <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 39 +++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 2 files changed, 40 insertions(+), 1 deletion(-)drivers/net/i40e/i40e_rxtx.c +38
-1@@ -1479,6 +1479,43 @@ i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,return nb_tx; } +/********************************************************************* +* +* TX simple prep functions +* +**********************************************************************/ +uint16_t +i40e_simple_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t nb_pkts) +{ +int i; +uint64_t ol_flags; +struct rte_mbuf *m; + +for (i =0 ; i < nb_pkts; i++) { + m = tx_pkts[i]; + ol_flags = m->ol_flags; + +if (m->nb_segs !=1 ) { + rte_errno =EINVAL ; +return i; + } + +if (ol_flags &PKT_TX_OFFLOAD_MASK ) { + rte_errno =ENOTSUP ; +return i; + } + +/* check the size of packet */ +if (m->pkt_len <I40E_TX_MIN_PKT_LEN || + m->pkt_len >I40E_FRAME_SIZE_MAX ) { + rte_errno =EINVAL ; +return i; + } + } +return i; +} +/********************************************************************* * * TX prep functions @@ -3412,7 +3449,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)PMD_INIT_LOG (DEBUG ,"Simple tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare =NULL ; + dev->tx_pkt_prepare = i40e_simple_prep_pkts; }else {PMD_INIT_LOG (DEBUG ,"Xmit tx finally be used." ); dev->tx_pkt_burst = i40e_xmit_pkts;drivers/net/i40e/i40e_rxtx.h +0
-0
drivers/net/i40e/i40e_rxtx.h uint16_t i40e_recv_scattered_pkts(void *rx_queue,
Quoted 9 lines
drivers/net/i40e/i40e_rxtx.h +2
-1@@ -208,6 +208,8 @@ uint16_t i40e_recv_scattered_pkts(void *rx_queue,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t i40e_simple_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);uint16_t i40e_prep_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);int i40e_tx_queue_init (struct i40e_tx_queue *txq); --
Quoted 1 line
2.17.1
Zhang, Qi Z
AppliedRe: [dpdk-dev] [PATCH v3] net/i40e: add Tx preparation for simple Tx data path
Quoted 15 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Tuesday, April 20, 2021 4:03 PM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH v3] net/i40e: add Tx preparation for simple Tx data pathQuoted 5 lines
Introduce
i40e_simple_prep_pkts()as the preparation function for simple Tx data path, as it's for sanity check for simple Tx.Suggested-by Konstantin Ananyev <[email protected]>Signed-off-by Leyi Rong <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi