[dpdk-dev] net/i40e: mbuf alloc failed counter not incremented

Message ID 20170327163035.76744-1-allain.legacy@windriver.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Allain Legacy March 27, 2017, 4:30 p.m. UTC
  From: Matt Peters <matt.peters@windriver.com>

When an mbuf alloc fails during the mempool get operation for the
i40e bulk alloc receive function, the rx_mbuf_alloc_failed counter
is not incremented to record the error.

This fix ensures consistency with the other i40e receive procedures and
other net drivers.

Signed-off-by: Matt Peters <matt.peters@windriver.com>
Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
---
 drivers/net/i40e/i40e_rxtx.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Zhang, Helin March 28, 2017, 8:52 a.m. UTC | #1
> -----Original Message-----
> From: Allain Legacy [mailto:allain.legacy@windriver.com]
> Sent: Tuesday, March 28, 2017 12:31 AM
> To: Zhang, Helin; Wu, Jingjing
> Cc: dev@dpdk.org; Peters, Matt (Wind River)
> Subject: [PATCH] net/i40e: mbuf alloc failed counter not incremented
> 
> From: Matt Peters <matt.peters@windriver.com>
> 
> When an mbuf alloc fails during the mempool get operation for the i40e bulk
> alloc receive function, the rx_mbuf_alloc_failed counter is not incremented to
> record the error.
> 
> This fix ensures consistency with the other i40e receive procedures and other
> net drivers.
> 
> Signed-off-by: Matt Peters <matt.peters@windriver.com>
> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
> ---
>  drivers/net/i40e/i40e_rxtx.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index
> ec64a20eb..794d8717e 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -610,6 +610,7 @@ static inline uint16_t  rx_recv_pkts(void *rx_queue,
> struct rte_mbuf **rx_pkts, uint16_t nb_pkts)  {
>  	struct i40e_rx_queue *rxq = (struct i40e_rx_queue *)rx_queue;
> +	struct rte_eth_dev *dev;
>  	uint16_t nb_rx = 0;
> 
>  	if (!nb_pkts)
> @@ -630,6 +631,10 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf
> **rx_pkts, uint16_t nb_pkts)
>  			PMD_RX_LOG(DEBUG, "Rx mbuf alloc failed for "
>  				   "port_id=%u, queue_id=%u",
>  				   rxq->port_id, rxq->queue_id);
> +
> +			dev = &rte_eth_devices[rxq->port_id];
> +			dev->data->rx_mbuf_alloc_failed += rxq-
> >rx_free_thresh;
> +
I think there are more places to have the similar code. Would you help to complete all?
e.g. rte_mbuf_raw_alloc() in i40e_recv_pkts.

Thank you very much for the helps!
/Helin

>  			rxq->rx_nb_avail = 0;
>  			rxq->rx_tail = (uint16_t)(rxq->rx_tail - nb_rx);
>  			for (i = 0, j = rxq->rx_tail; i < nb_rx; i++, j++)
> --
> 2.12.1
  
Allain Legacy March 29, 2017, 10:42 p.m. UTC | #2
> -----Original Message-----
> From: Zhang, Helin [mailto:helin.zhang@intel.com]
> Sent: Tuesday, March 28, 2017 4:52 AM

<...>
> > +
> > +			dev = &rte_eth_devices[rxq->port_id];
> > +			dev->data->rx_mbuf_alloc_failed += rxq-
> > >rx_free_thresh;
> > +
> I think there are more places to have the similar code. Would you help to
> complete all?

Sure, we'll submit a v2 in the near future.
  

Patch

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index ec64a20eb..794d8717e 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -610,6 +610,7 @@  static inline uint16_t
 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct i40e_rx_queue *rxq = (struct i40e_rx_queue *)rx_queue;
+	struct rte_eth_dev *dev;
 	uint16_t nb_rx = 0;
 
 	if (!nb_pkts)
@@ -630,6 +631,10 @@  rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			PMD_RX_LOG(DEBUG, "Rx mbuf alloc failed for "
 				   "port_id=%u, queue_id=%u",
 				   rxq->port_id, rxq->queue_id);
+
+			dev = &rte_eth_devices[rxq->port_id];
+			dev->data->rx_mbuf_alloc_failed += rxq->rx_free_thresh;
+
 			rxq->rx_nb_avail = 0;
 			rxq->rx_tail = (uint16_t)(rxq->rx_tail - nb_rx);
 			for (i = 0, j = rxq->rx_tail; i < nb_rx; i++, j++)