[dpdk-dev,8/9] net/qede: use newer packet mbuf allocate API

Message ID 1498729889-21524-9-git-send-email-rasesh.mody@cavium.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Mody, Rasesh June 29, 2017, 9:51 a.m. UTC
  Use rte_pktmbuf_alloc() API instead of rte_mbuf_raw_alloc().

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/qede_rxtx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit June 29, 2017, 12:55 p.m. UTC | #1
On 6/29/2017 10:51 AM, Rasesh Mody wrote:
> Use rte_pktmbuf_alloc() API instead of rte_mbuf_raw_alloc().
> 
> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
> ---
>  drivers/net/qede/qede_rxtx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
> index 8063233..6b047a3 100644
> --- a/drivers/net/qede/qede_rxtx.c
> +++ b/drivers/net/qede/qede_rxtx.c
> @@ -16,7 +16,7 @@ static inline int qede_alloc_rx_buffer(struct qede_rx_queue *rxq)
>  	dma_addr_t mapping;
>  	uint16_t idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq);
>  
> -	new_mb = rte_mbuf_raw_alloc(rxq->mb_pool);
> +	new_mb = rte_pktmbuf_alloc(rxq->mb_pool);

rte_pktmbuf_alloc() is more expensive call, because of
rte_pktmbuf_reset() it has.

Are you sure you want to switch, what is the motivation?

>  	if (unlikely(!new_mb)) {
>  		PMD_RX_LOG(ERR, rxq,
>  			   "Failed to allocate rx buffer "
>
  
Mody, Rasesh July 1, 2017, 7:34 p.m. UTC | #2
Hi Ferruh,

> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]

> Sent: Thursday, June 29, 2017 5:55 AM

> 

> On 6/29/2017 10:51 AM, Rasesh Mody wrote:

> > Use rte_pktmbuf_alloc() API instead of rte_mbuf_raw_alloc().

> >

> > Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>

> > ---

> >  drivers/net/qede/qede_rxtx.c |    2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> >

> > diff --git a/drivers/net/qede/qede_rxtx.c

> > b/drivers/net/qede/qede_rxtx.c index 8063233..6b047a3 100644

> > --- a/drivers/net/qede/qede_rxtx.c

> > +++ b/drivers/net/qede/qede_rxtx.c

> > @@ -16,7 +16,7 @@ static inline int qede_alloc_rx_buffer(struct

> qede_rx_queue *rxq)

> >  	dma_addr_t mapping;

> >  	uint16_t idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq);

> >

> > -	new_mb = rte_mbuf_raw_alloc(rxq->mb_pool);

> > +	new_mb = rte_pktmbuf_alloc(rxq->mb_pool);

> 

> rte_pktmbuf_alloc() is more expensive call, because of

> rte_pktmbuf_reset() it has.

> 

> Are you sure you want to switch, what is the motivation?


Yes, the intent was to initialize a new mbuf. But thinking over it again, we think it's better to skip this patch as we are updating most of the mbuf flags in receive routine anyway (except next and tx_offload fields). We've sent v2 series without this patch.

Thanks!
-Rasesh

> 

> >  	if (unlikely(!new_mb)) {

> >  		PMD_RX_LOG(ERR, rxq,

> >  			   "Failed to allocate rx buffer "

> >
  

Patch

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 8063233..6b047a3 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -16,7 +16,7 @@  static inline int qede_alloc_rx_buffer(struct qede_rx_queue *rxq)
 	dma_addr_t mapping;
 	uint16_t idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq);
 
-	new_mb = rte_mbuf_raw_alloc(rxq->mb_pool);
+	new_mb = rte_pktmbuf_alloc(rxq->mb_pool);
 	if (unlikely(!new_mb)) {
 		PMD_RX_LOG(ERR, rxq,
 			   "Failed to allocate rx buffer "