* [PATCH 1/3] net/i40e: reduce redundant store operation
2021-12-20 5:50 [PATCH 0/3] reduce redundant store operation for Tx free Feifei Wang
@ 2021-12-20 5:50 ` Feifei Wang
2021-12-20 5:50 ` [PATCH 2/3] net/ice: " Feifei Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Feifei Wang @ 2021-12-20 5:50 UTC (permalink / raw)
To: Beilei Xing; +Cc: dev, nd, Feifei Wang, Ruifeng Wang
For free buffer operation in i40e driver, 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.
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
drivers/net/i40e/i40e_rxtx.c | 3 ---
drivers/net/i40e/i40e_rxtx_vec_common.h | 1 -
2 files changed, 4 deletions(-)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index e4cb33dc3c..4de2be53e6 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1344,7 +1344,6 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
for (j = 0; j != k; j += RTE_I40E_TX_MAX_FREE_BUF_SZ) {
for (i = 0; i < RTE_I40E_TX_MAX_FREE_BUF_SZ; ++i, ++txep) {
free[i] = txep->mbuf;
- txep->mbuf = NULL;
}
rte_mempool_put_bulk(free[0]->pool, (void **)free,
RTE_I40E_TX_MAX_FREE_BUF_SZ);
@@ -1354,14 +1353,12 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
if (m) {
for (i = 0; i < m; ++i, ++txep) {
free[i] = txep->mbuf;
- txep->mbuf = NULL;
}
rte_mempool_put_bulk(free[0]->pool, (void **)free, m);
}
} else {
for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
rte_pktmbuf_free_seg(txep->mbuf);
- txep->mbuf = NULL;
}
}
diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h
index f9a7f46550..26deb59fc4 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_common.h
+++ b/drivers/net/i40e/i40e_rxtx_vec_common.h
@@ -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;
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] net/ice: reduce redundant store operation
2021-12-20 5:50 [PATCH 0/3] reduce redundant store operation for Tx free Feifei Wang
2021-12-20 5:50 ` [PATCH 1/3] net/i40e: reduce redundant store operation Feifei Wang
@ 2021-12-20 5:50 ` Feifei Wang
2021-12-20 5:50 ` [PATCH 3/3] net/ixgbe: " Feifei Wang
2022-01-27 7:40 ` [PATCH v3] net/i40e: reduce redundant reset operation Feifei Wang
3 siblings, 0 replies; 8+ messages in thread
From: Feifei Wang @ 2021-12-20 5:50 UTC (permalink / raw)
To: Qiming Yang, Qi Zhang; +Cc: dev, nd, Feifei Wang, Ruifeng Wang
For free buffer in ice driver, 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.
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
drivers/net/ice/ice_rxtx.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index f6d8564ab8..e043335bad 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2893,12 +2893,10 @@ ice_tx_free_bufs(struct ice_tx_queue *txq)
if (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) {
for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
rte_mempool_put(txep->mbuf->pool, txep->mbuf);
- txep->mbuf = NULL;
}
} else {
for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
rte_pktmbuf_free_seg(txep->mbuf);
- txep->mbuf = NULL;
}
}
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] net/ixgbe: reduce redundant store operation
2021-12-20 5:50 [PATCH 0/3] reduce redundant store operation for Tx free Feifei Wang
2021-12-20 5:50 ` [PATCH 1/3] net/i40e: reduce redundant store operation Feifei Wang
2021-12-20 5:50 ` [PATCH 2/3] net/ice: " Feifei Wang
@ 2021-12-20 5:50 ` Feifei Wang
2021-12-20 7:24 ` Wang, Haiyue
2022-01-27 7:40 ` [PATCH v3] net/i40e: reduce redundant reset operation Feifei Wang
3 siblings, 1 reply; 8+ messages in thread
From: Feifei Wang @ 2021-12-20 5:50 UTC (permalink / raw)
To: Haiyue Wang; +Cc: dev, nd, Feifei Wang, Ruifeng Wang
For free buffer in ixgbe driver, 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.
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
drivers/net/ixgbe/ixgbe_rxtx.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index d7c80d4242..9f3f2e9b50 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -120,7 +120,6 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)
for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
/* free buffers one at a time */
m = rte_pktmbuf_prefree_seg(txep->mbuf);
- txep->mbuf = NULL;
if (unlikely(m == NULL))
continue;
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 3/3] net/ixgbe: reduce redundant store operation
2021-12-20 5:50 ` [PATCH 3/3] net/ixgbe: " Feifei Wang
@ 2021-12-20 7:24 ` Wang, Haiyue
2021-12-21 6:55 ` 回复: " Feifei Wang
0 siblings, 1 reply; 8+ messages in thread
From: Wang, Haiyue @ 2021-12-20 7:24 UTC (permalink / raw)
To: Feifei Wang; +Cc: dev, nd, Ruifeng Wang
> -----Original Message-----
> From: Feifei Wang <feifei.wang2@arm.com>
> Sent: Monday, December 20, 2021 13:51
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>; Ruifeng Wang <ruifeng.wang@arm.com>
> Subject: [PATCH 3/3] net/ixgbe: reduce redundant store operation
>
> For free buffer in ixgbe driver, 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.
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
> drivers/net/ixgbe/ixgbe_rxtx.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index d7c80d4242..9f3f2e9b50 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -120,7 +120,6 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)
> for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
> /* free buffers one at a time */
> m = rte_pktmbuf_prefree_seg(txep->mbuf);
> - txep->mbuf = NULL;
Not sure, but at least found:
static void __rte_cold
ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq)
{
unsigned i;
if (txq->sw_ring != NULL) {
for (i = 0; i < txq->nb_tx_desc; i++) {
if (txq->sw_ring[i].mbuf != NULL) { <---------------------------- ?
rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf);
txq->sw_ring[i].mbuf = NULL;
}
}
}
}
>
> if (unlikely(m == NULL))
> continue;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* 回复: [PATCH 3/3] net/ixgbe: reduce redundant store operation
2021-12-20 7:24 ` Wang, Haiyue
@ 2021-12-21 6:55 ` Feifei Wang
0 siblings, 0 replies; 8+ messages in thread
From: Feifei Wang @ 2021-12-21 6:55 UTC (permalink / raw)
To: Wang, Haiyue; +Cc: dev, nd, Ruifeng Wang, nd
> -----邮件原件-----
> 发件人: Wang, Haiyue <haiyue.wang@intel.com>
> 发送时间: Monday, December 20, 2021 3:25 PM
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>
> 抄送: dev@dpdk.org; nd <nd@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>
> 主题: RE: [PATCH 3/3] net/ixgbe: reduce redundant store operation
>
> > -----Original Message-----
> > From: Feifei Wang <feifei.wang2@arm.com>
> > Sent: Monday, December 20, 2021 13:51
> > To: Wang, Haiyue <haiyue.wang@intel.com>
> > Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>;
> > Ruifeng Wang <ruifeng.wang@arm.com>
> > Subject: [PATCH 3/3] net/ixgbe: reduce redundant store operation
> >
> > For free buffer in ixgbe driver, 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.
> >
> > Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> > drivers/net/ixgbe/ixgbe_rxtx.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c
> > b/drivers/net/ixgbe/ixgbe_rxtx.c index d7c80d4242..9f3f2e9b50 100644
> > --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> > @@ -120,7 +120,6 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)
> > for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
> > /* free buffers one at a time */
> > m = rte_pktmbuf_prefree_seg(txep->mbuf);
> > - txep->mbuf = NULL;
>
> Not sure, but at least found:
>
> static void __rte_cold
> ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) {
> unsigned i;
>
> if (txq->sw_ring != NULL) {
> for (i = 0; i < txq->nb_tx_desc; i++) {
> if (txq->sw_ring[i].mbuf != NULL) { <--------------------
> -------- ?
> rte_pktmbuf_free_seg(txq-
> >sw_ring[i].mbuf);
> txq->sw_ring[i].mbuf = NULL;
> }
> }
> }
> }
>
Thanks for your remind. I check the function"xx_tx_queue_release_mbufs" and "xx_tx_done_cleanup_full" which
have the check for 'sw_ring->buf == NULL'. I find the scheme of free buffers in scalar path and vector path are different:
For scalar, it should support jumbo frame, so it cannot use 'tx_next_dd' to find free buffer index
For vector, free a packet means free a buffer, just use tx_next_dd can find the start index of free buffer.
At last, store operation of NULL for freed buffer is necessary for scalar path. And I will just keep the vector path path.
> >
> > if (unlikely(m == NULL))
> > continue;
> > --
> > 2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] net/i40e: reduce redundant reset operation
2021-12-20 5:50 [PATCH 0/3] reduce redundant store operation for Tx free Feifei Wang
` (2 preceding siblings ...)
2021-12-20 5:50 ` [PATCH 3/3] net/ixgbe: " Feifei Wang
@ 2022-01-27 7:40 ` Feifei Wang
2022-01-28 6:54 ` Zhang, Qi Z
3 siblings, 1 reply; 8+ messages in thread
From: Feifei Wang @ 2022-01-27 7:40 UTC (permalink / raw)
To: Beilei Xing; +Cc: dev, nd, Feifei Wang, Ruifeng Wang
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.
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
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)
v3: add comments to remind reset mbuf is unnecessary here (Qi Zhang)
drivers/net/i40e/i40e_rxtx_vec_common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h
index f9a7f46550..959832ed6a 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_common.h
+++ b/drivers/net/i40e/i40e_rxtx_vec_common.h
@@ -103,7 +103,7 @@ 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;
+ /* no need to reset txep[i].mbuf in vector path */
}
rte_mempool_put_bulk(free[0]->pool, (void **)free, n);
goto done;
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v3] net/i40e: reduce redundant reset operation
2022-01-27 7:40 ` [PATCH v3] net/i40e: reduce redundant reset operation Feifei Wang
@ 2022-01-28 6:54 ` Zhang, Qi Z
0 siblings, 0 replies; 8+ messages in thread
From: Zhang, Qi Z @ 2022-01-28 6:54 UTC (permalink / raw)
To: Feifei Wang, Xing, Beilei; +Cc: dev, nd, Ruifeng Wang
> -----Original Message-----
> From: Feifei Wang <feifei.wang2@arm.com>
> Sent: Thursday, January 27, 2022 3:40 PM
> To: Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; nd@arm.com; Feifei Wang <feifei.wang2@arm.com>;
> Ruifeng Wang <ruifeng.wang@arm.com>
> Subject: [PATCH v3] net/i40e: reduce redundant reset 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.
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 8+ messages in thread