Skip to contentSkip to conversation

net/i40e: reduce redundant store operation

PATCH Superseded Feifei Wang 2 participants 3 messages Dec 21, 2021 – Jan 27, 2022 Network drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net/i40e: reduce redundant store operation

For free buffer operation in i40e vector path, it is unnecessary to store 'NULL' into txep.mbuf. This is because when putting mbuf into Tx queue, tx_tail is the sentinel. And when doing tx_free, tx_next_dd is the sentinel. In all processes, mbuf==NULL is not a condition in check. Thus reset of mbuf is unnecessary and can be omitted.

---

v2: remove the change for scalar path due to scalar path needs to check whether the mbuf is 'NULL' to release and clean up (Haiyue)

 drivers/net/i40e/i40e_rxtx_vec_common.h | 1 -
 1 file changed, 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_common.h +0 -1
index f9a7f46550..26deb59fc4 100644
@@ -103,7 +103,6 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
 	if (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) {
 		for (i = 0; i < n; i++) {
 			free[i] = txep[i].mbuf;
-			txep[i].mbuf = NULL;
 		}
 		rte_mempool_put_bulk(free[0]->pool, (void **)free, n);
 		goto done;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 33 lines

-----Original Message-----
From: Feifei Wang <[email protected]>
Sent: Tuesday, December 21, 2021 4:11 PM
To: Xing, Beilei <[email protected]>
Cc: [email protected]; Wang, Haiyue <[email protected]>; [email protected]; Feifei Wang <[email protected]>; Ruifeng Wang <[email protected]>
Subject: [PATCH v2] net/i40e: reduce redundant store operation

For free buffer operation in i40e vector path, it is unnecessary to store 'NULL' into txep.mbuf. This is because when putting mbuf into Tx queue, tx_tail is the sentinel. And when doing tx_free, tx_next_dd is the sentinel. In all processes, mbuf==NULL is not a condition in check.
Thus reset of mbuf is unnecessary and can be omitted.

---

v2: remove the change for scalar path due to scalar path needs to check whether the mbuf is 'NULL' to release and clean up (Haiyue)

 drivers/net/i40e/i40e_rxtx_vec_common.h | 1 -
 1 file changed, 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_common.h +0 -0
index f9a7f46550..26deb59fc4 100644

drivers/net/i40e/i40e_rxtx_vec_common.h i40e_tx_free_bufs(struct i40e_tx_queue *txq) · line 106

Quoted 4 lines
drivers/net/i40e/i40e_rxtx_vec_common.h +0 -1
@@ -103,7 +103,6 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
 	if (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) {
 		for (i = 0; i < n; i++) {
 			free[i] = txep[i].mbuf;
-			txep[i].mbuf = NULL;

I will suggest to still add some comment here just for explaining, this may help to avoid unnecessary suspect when someone reading or debug on these code 😊

Quoted 5 lines
drivers/net/i40e/i40e_rxtx_vec_common.h +0 -1
 		}
 		rte_mempool_put_bulk(free[0]->pool, (void **)free, n);
 		goto done;
--

2.25.1

#2 lore raw
Quoted 39 lines

-----邮件原件-----
发件人: Zhang, Qi Z <[email protected]>
发送时间: Wednesday, January 26, 2022 10:28 PM
收件人: Feifei Wang <[email protected]>; Xing, Beilei <[email protected]>
抄送: [email protected]; Wang, Haiyue <[email protected]>; nd <[email protected]>; Ruifeng Wang <[email protected]> 主题: RE: [PATCH v2] net/i40e: reduce redundant store operation

Quoted 10 lines

-----Original Message-----
From: Feifei Wang <[email protected]>
Sent: Tuesday, December 21, 2021 4:11 PM
To: Xing, Beilei <[email protected]>
Cc: [email protected]; Wang, Haiyue <[email protected]>; [email protected]; Feifei Wang <[email protected]>; Ruifeng Wang <[email protected]>
Subject: [PATCH v2] net/i40e: reduce redundant store operation

For free buffer operation in i40e vector path, it is unnecessary to store

'NULL'

Quoted 15 lines

into txep.mbuf. This is because when putting mbuf into Tx queue, tx_tail is the sentinel. And when doing tx_free, tx_next_dd is the sentinel. In all processes, mbuf==NULL is not a condition in check. Thus reset of mbuf is unnecessary and can be omitted.

---

v2: remove the change for scalar path due to scalar path needs to check whether the mbuf is 'NULL' to release and clean up (Haiyue)

 drivers/net/i40e/i40e_rxtx_vec_common.h | 1 -
 1 file changed, 1 deletion(-)
Quoted 15 lines

drivers/net/i40e/i40e_rxtx_vec_common.h i40e_tx_free_bufs(struct i40e_tx_queue *txq) · line 106

Quoted 10 lines
drivers/net/i40e/i40e_rxtx_vec_common.h +0 -1
index f9a7f46550..26deb59fc4 100644
@@ -103,7 +103,6 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
 	if (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) {
 		for (i = 0; i < n; i++) {
 			free[i] = txep[i].mbuf;
-			txep[i].mbuf = NULL;

I will suggest to still add some comment here just for explaining, this may help to avoid unnecessary suspect when someone reading or debug on these code 😊

Thanks for your comments. Agree with this, and I will add the comment to explain why this store operation is unnecessary here.

Quoted 6 lines
Quoted 6 lines
drivers/net/i40e/i40e_rxtx_vec_common.h +0 -1
 		}
 		rte_mempool_put_bulk(free[0]->pool, (void **)free, n);
 		goto done;
--

2.25.1