[1/2] af_xdp: not return a negative value in af_xdp_rx_zc
diff mbox series

Message ID 1600319386-24559-1-git-send-email-lirongqing@baidu.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [1/2] af_xdp: not return a negative value in af_xdp_rx_zc
Related show

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/checkpatch success coding style OK

Commit Message

Li RongQing Sept. 17, 2020, 5:09 a.m. UTC
af_xdp_rx_zc should always return the number of received packets,
and negative value will be as number of received packets, and
confuse the caller

Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
Cc: stable@dpdk.org
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Loftus, Ciara Sept. 17, 2020, 7:33 a.m. UTC | #1
> 
> af_xdp_rx_zc should always return the number of received packets,
> and negative value will be as number of received packets, and
> confuse the caller
> 
> Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
> Cc: stable@dpdk.org
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Hi,

Thank you for the patch. The same fix was submitted and accepted into the next-net tree a few weeks ago:
http://git.dpdk.org/next/dpdk-next-net/commit/?id=e85f60b4e282695ca0e457dc1ad21479b4bd7479
It should hopefully hit the main tree soon.

Ciara

> 
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index 936d4a7d5..7ce4ad04a 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -236,7 +236,7 @@ af_xdp_rx_zc(void *queue, struct rte_mbuf **bufs,
> uint16_t nb_pkts)
>  	if (rte_pktmbuf_alloc_bulk(umem->mb_pool, fq_bufs, nb_pkts)) {
>  		AF_XDP_LOG(DEBUG,
>  			"Failed to get enough buffers for fq.\n");
> -		return -1;
> +		return 0;
>  	}
> 
>  	rcvd = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);
> --
> 2.16.2
Li RongQing Sept. 17, 2020, 8:17 a.m. UTC | #2
> -----Original Message-----
> From: Loftus, Ciara [mailto:ciara.loftus@intel.com]
> Sent: Thursday, September 17, 2020 3:33 PM
> To: Li,Rongqing <lirongqing@baidu.com>
> Cc: dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH 1/2] af_xdp: not return a negative value in
> af_xdp_rx_zc
> 
> >
> > af_xdp_rx_zc should always return the number of received packets, and
> > negative value will be as number of received packets, and confuse the
> > caller
> >
> > Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
> > Cc: stable@dpdk.org
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> >  drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Hi,
> 
> Thank you for the patch. The same fix was submitted and accepted into the
> next-net tree a few weeks ago:
> http://git.dpdk.org/next/dpdk-next-net/commit/?id=e85f60b4e282695ca0e457
> dc1ad21479b4bd7479
> It should hopefully hit the main tree soon.
> 

Thanks ,sorry for noise

-Li

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 936d4a7d5..7ce4ad04a 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -236,7 +236,7 @@  af_xdp_rx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	if (rte_pktmbuf_alloc_bulk(umem->mb_pool, fq_bufs, nb_pkts)) {
 		AF_XDP_LOG(DEBUG,
 			"Failed to get enough buffers for fq.\n");
-		return -1;
+		return 0;
 	}
 
 	rcvd = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);