net/af_xdp: use single-prod-and-cons ring
diff mbox series

Message ID 20200108133708.51909-1-xiao.w.wang@intel.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • net/af_xdp: use single-prod-and-cons ring
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot warning Travis build: failed
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Wang, Xiao W Jan. 8, 2020, 1:37 p.m. UTC
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(-)

Comments

Ciara Loftus Jan. 13, 2020, 10:05 a.m. UTC | #1
> 
> 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
Ye Xiaolong Jan. 14, 2020, 1:37 a.m. UTC | #2
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>
Ferruh Yigit Jan. 14, 2020, 9:38 a.m. UTC | #3
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.

Patch
diff mbox series

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;