net/i40e: update tx_free_threshold to improve zero copy performance
PATCH 1/1 net/i40e: update tx_free_threshold to improve zero copy performance
From: "Chen, Junjie" <[email protected]>
When vhost backend works in dequeue zero copy mode, nic locks virtio's buffer until there is less or equal than tx_free_threshold buffer remain and then free number of tx burst buffer. This causes packets drop in virtio side and impacts zero copy performance. So we need to increase the tx_free_threshold to let nic free virtio's buffer as soon as possible. Also we keep the upper limit to tx max burst size to ensure least performance impact on non zero copy.
--- drivers/net/i40e/i40e_rxtx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/i40e/i40e_rxtx.c +2 -0
@@ -2039,6 +2039,8 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH); tx_free_thresh = (uint16_t )((tx_conf->tx_free_thresh) ? tx_conf->tx_free_thresh :DEFAULT_TX_FREE_THRESH ); +if (tx_free_thresh < nb_desc -I40E_TX_MAX_BURST ) + tx_free_thresh = nb_desc -I40E_TX_MAX_BURST ;if (tx_rs_thresh >= (nb_desc -2 )) {PMD_INIT_LOG (ERR ,"tx_rs_thresh must be less than the " "number of TX descriptors minus 2. "
Signature · 1 line
2.16.0
Quoted 11 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Junjie Chen
Sent: Thursday, April 12, 2018 6:32 AM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Chen, Junjie J <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceFrom: "Chen, Junjie" <[email protected]>
Quoted 7 lines
When vhost backend works in dequeue zero copy mode, nic locks virtio's buffer until there is less or equal than
tx_free_thresholdbuffer remain and then free number of tx burst buffer. This causes packets drop in virtio side and impacts zero copy performance. So we need to increase thetx_free_thresholdto let nic free virtio's buffer as soon as possible. Also we keep the upper limit to tx max burst size to ensure least performance impact on non zero copy.
Ok but why vhost app can't just use tx_queue_setup() to specify desired value for tx_free_thresh?
Why instead we have to modify PMD to satisfy needs of one app? Konstantin
Quoted 21 lines
Signed-off-by Chen, Junjie <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/i40e/i40e_rxtx.c +2
-1@@ -2039,6 +2039,8 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH); tx_free_thresh = (uint16_t )((tx_conf->tx_free_thresh) ? tx_conf->tx_free_thresh :DEFAULT_TX_FREE_THRESH ); +if (tx_free_thresh < nb_desc -I40E_TX_MAX_BURST ) + tx_free_thresh = nb_desc -I40E_TX_MAX_BURST ;if (tx_rs_thresh >= (nb_desc -2 )) {PMD_INIT_LOG (ERR ,"tx_rs_thresh must be less than the " "number of TX descriptors minus 2. " --2.16.0
Hi Junjie:
Quoted 28 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, April 12, 2018 7:52 PM
To: Chen, Junjie J <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Chen, Junjie J <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceQuoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Junjie Chen
Sent: Thursday, April 12, 2018 6:32 AM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Chen, Junjie J <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceQuoted 7 lines
From: "Chen, Junjie" <[email protected]>
When vhost backend works in dequeue zero copy mode, nic locks virtio's buffer until there is less or equal than
tx_free_thresholdbuffer remain and then free number of tx burst buffer. This causes packets drop in virtio side and impacts zero copy performance. So we need to increase thetx_free_thresholdto let nic free virtio's buffer as soon as
Quoted 8 lines
possible.
Quoted 2 lines
Also we keep the upper limit to tx max burst size to ensure least performance impact on non zero copy.
Ok but why vhost app can't just use
tx_queue_setup()to specify desired value fortx_free_thresh?
Why instead we have to modify PMD to satisfy needs of one app? Konstantin
I think the commit log could include the explanation that this change is proved not impact driver's performance and it reduce total memory be locked by PMD Tx, so basically it benefit application that share the same mem pool overall, vhost dequeue zero copy is one of the example.
Quoted 13 lines
drivers/net/i40e/i40e_rxtx.c i40e_dev_tx_queue_setup(struct rte_eth_dev
Quoted 12 lines
Signed-off-by Chen, Junjie <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex56a854cec..d9569bdc9100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -2039,6 +2039,8 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev*dev,
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, · line 2043
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c +2
-0tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH); tx_free_thresh = (uint16_t )((tx_conf->tx_free_thresh) ? tx_conf->tx_free_thresh :DEFAULT_TX_FREE_THRESH ); +if (tx_free_thresh < nb_desc -I40E_TX_MAX_BURST ) + tx_free_thresh = nb_desc -I40E_TX_MAX_BURST ;
I think we'd better still allow application to set tx_free_thresh, since a small tx_free_thresh may still have benefit to let driver handle the first strike after device restarted So, nb_desc - I40E_TX_MAX_BURST can only be set when tx_conf->tx_rs_thresh = 0
Regards
Qi
Quoted 5 lines
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c +0
-1if (tx_rs_thresh >= (nb_desc -2 )) {PMD_INIT_LOG (ERR ,"tx_rs_thresh must be less than the " "number of TX descriptors minus 2. " --2.16.0
Quoted 65 lines · Qi Z
Hi Junjie:
Quoted 28 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, April 12, 2018 7:52 PM
To: Chen, Junjie J <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Chen, Junjie J <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceQuoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Junjie Chen
Sent: Thursday, April 12, 2018 6:32 AM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Chen, Junjie J <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceQuoted 7 lines
From: "Chen, Junjie" <[email protected]>
When vhost backend works in dequeue zero copy mode, nic locks virtio's buffer until there is less or equal than
tx_free_thresholdbuffer remain and then free number of tx burst buffer. This causes packets drop in virtio side and impacts zero copy performance. So we need to increase thetx_free_thresholdto let nic free virtio's buffer as soon asQuoted 8 lines
possible.
Quoted 2 lines
Also we keep the upper limit to tx max burst size to ensure least performance impact on non zero copy.
Ok but why vhost app can't just use
tx_queue_setup()to specify desired value fortx_free_thresh?
Why instead we have to modify PMD to satisfy needs of one app? KonstantinI think the commit log could include the explanation that this change is proved not impact driver's performance and it reduce total memory be locked by PMD Tx, so basically it benefit application that share the same mem pool overall, vhost dequeue zero copy is one of the example.
Quoted 13 lines
drivers/net/i40e/i40e_rxtx.c i40e_dev_tx_queue_setup(struct rte_eth_dev
Quoted 12 lines
Signed-off-by Chen, Junjie <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex56a854cec..d9569bdc9100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -2039,6 +2039,8 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev*dev,
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, · line 2043
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c +2
-0tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH); tx_free_thresh = (uint16_t )((tx_conf->tx_free_thresh) ? tx_conf->tx_free_thresh :DEFAULT_TX_FREE_THRESH ); +if (tx_free_thresh < nb_desc -I40E_TX_MAX_BURST ) + tx_free_thresh = nb_desc -I40E_TX_MAX_BURST ;I think we'd better still allow application to set
tx_free_thresh, since a smalltx_free_threshmay still have benefit to let driver handle the first strike after device restarted So,nb_desc-I40E_TX_MAX_BURSTcan only be set whentx_conf->tx_rs_thresh= 0
Quoted 3 lines
Regards
Qi
+1 for just changing in this case.
/Bruce
Quoted 74 lines
-----Original Message-----
From: Richardson, Bruce
Sent: Thursday, April 12, 2018 2:12 PM
To: Zhang, Qi Z <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Chen, Junjie J <[email protected]>; Xing, Beilei <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceQuoted 56 lines · Qi Z
Hi Junjie:
Quoted 28 lines
-----Original Message-----
From: Ananyev, Konstantin
Sent: Thursday, April 12, 2018 7:52 PM
To: Chen, Junjie J <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Chen, Junjie J <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceQuoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Junjie Chen
Sent: Thursday, April 12, 2018 6:32 AM
To: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Chen, Junjie J <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] net/i40e: updatetx_free_thresholdto improve zero copy performanceQuoted 7 lines
From: "Chen, Junjie" <[email protected]>
When vhost backend works in dequeue zero copy mode, nic locks virtio's buffer until there is less or equal than
tx_free_thresholdbuffer remain and then free number of tx burst buffer. This causes packets drop in virtio side and impacts zero copy performance. So we need to increase thetx_free_thresholdto let nic free virtio's buffer as soon asQuoted 8 lines
possible.
Quoted 2 lines
Also we keep the upper limit to tx max burst size to ensure least performance impact on non zero copy.
Ok but why vhost app can't just use
tx_queue_setup()to specify desired value fortx_free_thresh?
Why instead we have to modify PMD to satisfy needs of one app? KonstantinI think the commit log could include the explanation that this change is proved not impact driver's performance and it reduce total memory be locked by PMD Tx, so basically it benefit application that share the same mem pool overall, vhost dequeue zero copy is one of the example.
Quoted 13 lines
drivers/net/i40e/i40e_rxtx.c i40e_dev_tx_queue_setup(struct rte_eth_dev
Quoted 12 lines
Signed-off-by Chen, Junjie <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex56a854cec..d9569bdc9100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -2039,6 +2039,8 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev*dev,
Quoted 7 lines
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, · line 2043
Quoted 5 lines
drivers/net/i40e/i40e_rxtx.c +2
-0tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH); tx_free_thresh = (uint16_t )((tx_conf->tx_free_thresh) ? tx_conf->tx_free_thresh :DEFAULT_TX_FREE_THRESH ); +if (tx_free_thresh < nb_desc -I40E_TX_MAX_BURST ) + tx_free_thresh = nb_desc -I40E_TX_MAX_BURST ;I think we'd better still allow application to set
tx_free_thresh, since a smalltx_free_threshmay still have benefit to let driver handle the
Quoted 8 lines
first strike after device restarted
Quoted 5 lines
So,
nb_desc-I40E_TX_MAX_BURSTcan only be set whentx_conf->tx_rs_thresh= 0Regards
Qi+1 for just changing in this case.
Basically you suggest to change DEFAULT_TX_FREE_THRESH.
Are you sure that it wouldn't impact any application on any platform (IA, arm, etc.)?
As I remember we already had similar conversation few years ago.
Again if memory serves me right - one of the contr-arguments about setting that value too high was that PMD might start to check DD bit inside TXD too often - and will collide with HW updating it more often. As I remember it was suggested to use 1/2 or 3/4 of nb_desc as default one.
Though I still don't see what is wrong with setting tx_free_thresh vi queue_setup() for that particular case. In that case we can be sure that no other stuff will be affected.
After all - that's why it is configurable.
Konstantin