DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] net/af_xdp: use single-prod-and-cons ring
@ 2020-01-08 13:37 Xiao Wang
  2020-01-13 10:05 ` Loftus, Ciara
  2020-01-14  1:37 ` Ye Xiaolong
  0 siblings, 2 replies; 4+ messages in thread
From: Xiao Wang @ 2020-01-08 13:37 UTC (permalink / raw)
  To: xiaolong.ye, qi.z.zhang; +Cc: dev, Xiao Wang

The ring is used only by af_xdp pmd itself, so no need to support
multi-producer and multi-consumer mode. This patch changes the ring
to single-producer and single-consumer mode, which could yield better
performance for addr enqueue and dequeue.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index d903e6c28..683e2a559 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -809,7 +809,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
 	umem->buf_ring = rte_ring_create(ring_name,
 					 ETH_AF_XDP_NUM_BUFFERS,
 					 rte_socket_id(),
-					 0x0);
+					 RING_F_SP_ENQ | RING_F_SC_DEQ);
 	if (umem->buf_ring == NULL) {
 		AF_XDP_LOG(ERR, "Failed to create rte_ring\n");
 		goto err;
-- 
2.15.1


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

* Re: [dpdk-dev] [PATCH] net/af_xdp: use single-prod-and-cons ring
  2020-01-08 13:37 [dpdk-dev] [PATCH] net/af_xdp: use single-prod-and-cons ring Xiao Wang
@ 2020-01-13 10:05 ` Loftus, Ciara
  2020-01-14  1:37 ` Ye Xiaolong
  1 sibling, 0 replies; 4+ messages in thread
From: Loftus, Ciara @ 2020-01-13 10:05 UTC (permalink / raw)
  To: Wang, Xiao W, Ye, Xiaolong, Zhang, Qi Z; +Cc: dev, Wang, Xiao W

> 
> The ring is used only by af_xdp pmd itself, so no need to support
> multi-producer and multi-consumer mode. This patch changes the ring
> to single-producer and single-consumer mode, which could yield better
> performance for addr enqueue and dequeue.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>

LGTM.

I ran some rough numbers and measured a +~6.8% improvement for single-core single-pmd testpmd loopback (IRQs pinned to app core) and +~15.9% for two core (IRQs and app pinned to separate cores).

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

Thanks,
Ciara

> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index d903e6c28..683e2a559 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -809,7 +809,7 @@ xsk_umem_info *xdp_umem_configure(struct
> pmd_internals *internals,
>  	umem->buf_ring = rte_ring_create(ring_name,
>  					 ETH_AF_XDP_NUM_BUFFERS,
>  					 rte_socket_id(),
> -					 0x0);
> +					 RING_F_SP_ENQ |
> RING_F_SC_DEQ);
>  	if (umem->buf_ring == NULL) {
>  		AF_XDP_LOG(ERR, "Failed to create rte_ring\n");
>  		goto err;
> --
> 2.15.1


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

* Re: [dpdk-dev] [PATCH] net/af_xdp: use single-prod-and-cons ring
  2020-01-08 13:37 [dpdk-dev] [PATCH] net/af_xdp: use single-prod-and-cons ring Xiao Wang
  2020-01-13 10:05 ` Loftus, Ciara
@ 2020-01-14  1:37 ` Ye Xiaolong
  2020-01-14  9:38   ` Ferruh Yigit
  1 sibling, 1 reply; 4+ messages in thread
From: Ye Xiaolong @ 2020-01-14  1:37 UTC (permalink / raw)
  To: Xiao Wang; +Cc: qi.z.zhang, dev

On 01/08, Xiao Wang wrote:
>The ring is used only by af_xdp pmd itself, so no need to support
>multi-producer and multi-consumer mode. This patch changes the ring
>to single-producer and single-consumer mode, which could yield better
>performance for addr enqueue and dequeue.
>
>Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
>---
> drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>index d903e6c28..683e2a559 100644
>--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>@@ -809,7 +809,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
> 	umem->buf_ring = rte_ring_create(ring_name,
> 					 ETH_AF_XDP_NUM_BUFFERS,
> 					 rte_socket_id(),
>-					 0x0);
>+					 RING_F_SP_ENQ | RING_F_SC_DEQ);
> 	if (umem->buf_ring == NULL) {
> 		AF_XDP_LOG(ERR, "Failed to create rte_ring\n");
> 		goto err;
>-- 
>2.15.1
>

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: use single-prod-and-cons ring
  2020-01-14  1:37 ` Ye Xiaolong
@ 2020-01-14  9:38   ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2020-01-14  9:38 UTC (permalink / raw)
  To: Ye Xiaolong, Xiao Wang; +Cc: qi.z.zhang, dev

On 1/14/2020 1:37 AM, Ye Xiaolong wrote:
> On 01/08, Xiao Wang wrote:
>> The ring is used only by af_xdp pmd itself, so no need to support
>> multi-producer and multi-consumer mode. This patch changes the ring
>> to single-producer and single-consumer mode, which could yield better
>> performance for addr enqueue and dequeue.
>>
>> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
>> ---
>> drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> index d903e6c28..683e2a559 100644
>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> @@ -809,7 +809,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
>> 	umem->buf_ring = rte_ring_create(ring_name,
>> 					 ETH_AF_XDP_NUM_BUFFERS,
>> 					 rte_socket_id(),
>> -					 0x0);
>> +					 RING_F_SP_ENQ | RING_F_SC_DEQ);
>> 	if (umem->buf_ring == NULL) {
>> 		AF_XDP_LOG(ERR, "Failed to create rte_ring\n");
>> 		goto err;
>> -- 
>> 2.15.1
>>
> 
> Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
> 

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

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 13:37 [dpdk-dev] [PATCH] net/af_xdp: use single-prod-and-cons ring Xiao Wang
2020-01-13 10:05 ` Loftus, Ciara
2020-01-14  1:37 ` Ye Xiaolong
2020-01-14  9:38   ` Ferruh Yigit

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git