* [PATCH] iavf: do tx done cleanup starting from tx_tail
@ 2022-07-07 0:14 Aleksandr Miloshenko
2022-08-30 1:13 ` [PATCH v2] net/iavf: do Tx done cleanup starting from Tx tail Aleksandr Miloshenko
0 siblings, 1 reply; 3+ messages in thread
From: Aleksandr Miloshenko @ 2022-07-07 0:14 UTC (permalink / raw)
To: jingjing.wu, beilei.xing; +Cc: dev, b.oconnor, s.lewites, Aleksandr Miloshenko
iavf_xmit_pkts() sets tx_tail to the next of last transmitted tx descriptor.
So the cleanup of tx done descriptors must be started from tx_tail, not from the next of tx_tail.
Otherwise rte_eth_tx_done_cleanup() doesn't free the first tx done mbuf when tx queue is full.
Signed-off-by: Aleksandr Miloshenko <a.miloshenko@f5.com>
---
drivers/net/iavf/iavf_rxtx.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 109ba756f8..7cd5db6e49 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -3184,14 +3184,14 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
uint32_t free_cnt)
{
struct iavf_tx_entry *swr_ring = txq->sw_ring;
- uint16_t i, tx_last, tx_id;
+ uint16_t tx_last, tx_id;
uint16_t nb_tx_free_last;
uint16_t nb_tx_to_clean;
- uint32_t pkt_cnt;
+ uint32_t pkt_cnt = 0;
- /* Start free mbuf from the next of tx_tail */
- tx_last = txq->tx_tail;
- tx_id = swr_ring[tx_last].next_id;
+ /* Start free mbuf from tx_tail */
+ tx_id = txq->tx_tail;
+ tx_last = tx_id;
if (txq->nb_free == 0 && iavf_xmit_cleanup(txq))
return 0;
@@ -3204,10 +3204,8 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
/* Loop through swr_ring to count the amount of
* freeable mubfs and packets.
*/
- for (pkt_cnt = 0; pkt_cnt < free_cnt; ) {
- for (i = 0; i < nb_tx_to_clean &&
- pkt_cnt < free_cnt &&
- tx_id != tx_last; i++) {
+ while (pkt_cnt < free_cnt) {
+ do {
if (swr_ring[tx_id].mbuf != NULL) {
rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
swr_ring[tx_id].mbuf = NULL;
@@ -3220,7 +3218,7 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
}
tx_id = swr_ring[tx_id].next_id;
- }
+ } while (--nb_tx_to_clean && pkt_cnt < free_cnt && tx_id != tx_last);
if (txq->rs_thresh > txq->nb_tx_desc -
txq->nb_free || tx_id == tx_last)
--
2.37.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] net/iavf: do Tx done cleanup starting from Tx tail
2022-07-07 0:14 [PATCH] iavf: do tx done cleanup starting from tx_tail Aleksandr Miloshenko
@ 2022-08-30 1:13 ` Aleksandr Miloshenko
2022-08-30 1:45 ` Zhang, Qi Z
0 siblings, 1 reply; 3+ messages in thread
From: Aleksandr Miloshenko @ 2022-08-30 1:13 UTC (permalink / raw)
To: qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, Aleksandr Miloshenko, stable
iavf_xmit_pkts() sets tx_tail to the next of last transmitted
Tx descriptor. So the cleanup of Tx done descriptors must be started
from tx_tail, not from the next of tx_tail.
Otherwise rte_eth_tx_done_cleanup() doesn't free the first Tx done mbuf
when tx queue is full.
Fixes: 86e44244f95c ("net/iavf: cleanup Tx buffers")
Cc: stable@dpdk.org
Signed-off-by: Aleksandr Miloshenko <a.miloshenko@f5.com>
---
v2:
* Fixed the commit style.
drivers/net/iavf/iavf_rxtx.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 109ba756f8..7cd5db6e49 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -3184,14 +3184,14 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
uint32_t free_cnt)
{
struct iavf_tx_entry *swr_ring = txq->sw_ring;
- uint16_t i, tx_last, tx_id;
+ uint16_t tx_last, tx_id;
uint16_t nb_tx_free_last;
uint16_t nb_tx_to_clean;
- uint32_t pkt_cnt;
+ uint32_t pkt_cnt = 0;
- /* Start free mbuf from the next of tx_tail */
- tx_last = txq->tx_tail;
- tx_id = swr_ring[tx_last].next_id;
+ /* Start free mbuf from tx_tail */
+ tx_id = txq->tx_tail;
+ tx_last = tx_id;
if (txq->nb_free == 0 && iavf_xmit_cleanup(txq))
return 0;
@@ -3204,10 +3204,8 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
/* Loop through swr_ring to count the amount of
* freeable mubfs and packets.
*/
- for (pkt_cnt = 0; pkt_cnt < free_cnt; ) {
- for (i = 0; i < nb_tx_to_clean &&
- pkt_cnt < free_cnt &&
- tx_id != tx_last; i++) {
+ while (pkt_cnt < free_cnt) {
+ do {
if (swr_ring[tx_id].mbuf != NULL) {
rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
swr_ring[tx_id].mbuf = NULL;
@@ -3220,7 +3218,7 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
}
tx_id = swr_ring[tx_id].next_id;
- }
+ } while (--nb_tx_to_clean && pkt_cnt < free_cnt && tx_id != tx_last);
if (txq->rs_thresh > txq->nb_tx_desc -
txq->nb_free || tx_id == tx_last)
--
2.37.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH v2] net/iavf: do Tx done cleanup starting from Tx tail
2022-08-30 1:13 ` [PATCH v2] net/iavf: do Tx done cleanup starting from Tx tail Aleksandr Miloshenko
@ 2022-08-30 1:45 ` Zhang, Qi Z
0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2022-08-30 1:45 UTC (permalink / raw)
To: Aleksandr Miloshenko, Wu, Jingjing, Xing, Beilei; +Cc: dev, stable
> -----Original Message-----
> From: Aleksandr Miloshenko <a.miloshenko@f5.com>
> Sent: Tuesday, August 30, 2022 9:14 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Aleksandr Miloshenko <a.miloshenko@f5.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/iavf: do Tx done cleanup starting from Tx tail
>
> iavf_xmit_pkts() sets tx_tail to the next of last transmitted Tx descriptor. So the
> cleanup of Tx done descriptors must be started from tx_tail, not from the next
> of tx_tail.
> Otherwise rte_eth_tx_done_cleanup() doesn't free the first Tx done mbuf when
> tx queue is full.
>
> Fixes: 86e44244f95c ("net/iavf: cleanup Tx buffers")
> Cc: stable@dpdk.org
>
> Signed-off-by: Aleksandr Miloshenko <a.miloshenko@f5.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-30 1:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 0:14 [PATCH] iavf: do tx done cleanup starting from tx_tail Aleksandr Miloshenko
2022-08-30 1:13 ` [PATCH v2] net/iavf: do Tx done cleanup starting from Tx tail Aleksandr Miloshenko
2022-08-30 1:45 ` Zhang, Qi Z
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).