DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] net/af_xdp: fix zero copy Tx queue drain
@ 2021-08-25 10:05 Baruch Siach
  2021-08-25 10:48 ` Loftus, Ciara
  0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2021-08-25 10:05 UTC (permalink / raw)
  To: Ciara Loftus, Qi Zhang; +Cc: dev, Baruch Siach, stable

Call xsk_ring_prod__submit() before kick_tx() so that the kernel
consumer sees the updated state of Tx ring. Otherwise, Tx packets are
stuck in the ring until the next call to af_xdp_tx_zc().

Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
Cc: stable@dpdk.org

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
--
v2:

  Don't call xsk_ring_prod__submit() when kick_tx() is only used to
  drain the completion queue (Ciara Loftus)
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 74ffa4511284..9bea0a895a3e 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -527,7 +527,6 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 
 			if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) {
 				rte_pktmbuf_free(local_mbuf);
-				kick_tx(txq, cq);
 				goto out;
 			}
 
@@ -551,10 +550,9 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		tx_bytes += mbuf->pkt_len;
 	}
 
-	kick_tx(txq, cq);
-
 out:
 	xsk_ring_prod__submit(&txq->tx, count);
+	kick_tx(txq, cq);
 
 	txq->stats.tx_pkts += count;
 	txq->stats.tx_bytes += tx_bytes;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/af_xdp: fix zero copy Tx queue drain
  2021-08-25 10:05 [dpdk-dev] [PATCH v2] net/af_xdp: fix zero copy Tx queue drain Baruch Siach
@ 2021-08-25 10:48 ` Loftus, Ciara
  2021-09-07 15:56   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Loftus, Ciara @ 2021-08-25 10:48 UTC (permalink / raw)
  To: Baruch Siach, Zhang, Qi Z; +Cc: dev, stable

> 
> Call xsk_ring_prod__submit() before kick_tx() so that the kernel
> consumer sees the updated state of Tx ring. Otherwise, Tx packets are
> stuck in the ring until the next call to af_xdp_tx_zc().
> 
> Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Thanks for respinning. I tested it out and it looks good to me.

Acked-by: Ciara Loftus <ciara.loftus@intel.com>

> --
> v2:
> 
>   Don't call xsk_ring_prod__submit() when kick_tx() is only used to
>   drain the completion queue (Ciara Loftus)
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index 74ffa4511284..9bea0a895a3e 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -527,7 +527,6 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs,
> uint16_t nb_pkts)
> 
>  			if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) {
>  				rte_pktmbuf_free(local_mbuf);
> -				kick_tx(txq, cq);
>  				goto out;
>  			}
> 
> @@ -551,10 +550,9 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs,
> uint16_t nb_pkts)
>  		tx_bytes += mbuf->pkt_len;
>  	}
> 
> -	kick_tx(txq, cq);
> -
>  out:
>  	xsk_ring_prod__submit(&txq->tx, count);
> +	kick_tx(txq, cq);
> 
>  	txq->stats.tx_pkts += count;
>  	txq->stats.tx_bytes += tx_bytes;
> --
> 2.32.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/af_xdp: fix zero copy Tx queue drain
  2021-08-25 10:48 ` Loftus, Ciara
@ 2021-09-07 15:56   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2021-09-07 15:56 UTC (permalink / raw)
  To: Loftus, Ciara, Baruch Siach, Zhang, Qi Z; +Cc: dev, stable

On 8/25/2021 11:48 AM, Loftus, Ciara wrote:
>>
>> Call xsk_ring_prod__submit() before kick_tx() so that the kernel
>> consumer sees the updated state of Tx ring. Otherwise, Tx packets are
>> stuck in the ring until the next call to af_xdp_tx_zc().
>>
>> Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> 
> Thanks for respinning. I tested it out and it looks good to me.
> 
> Acked-by: Ciara Loftus <ciara.loftus@intel.com>
> 

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-07 15:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 10:05 [dpdk-dev] [PATCH v2] net/af_xdp: fix zero copy Tx queue drain Baruch Siach
2021-08-25 10:48 ` Loftus, Ciara
2021-09-07 15:56   ` Ferruh Yigit

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).