DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Yigit, Ferruh" <ferruh.yigit@intel.com>,
	"Koujalagi, MalleshX" <malleshx.koujalagi@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "mtetsuyah@gmail.com" <mtetsuyah@gmail.com>
Subject: Re: [dpdk-dev] [PATCH] net/null: Support bulk alloc and free.
Date: Mon, 5 Mar 2018 15:36:08 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB97725890F203AA@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <803da3d7-7443-01e8-a14c-1e899c3a5a17@intel.com>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Monday, March 5, 2018 3:25 PM
> To: Koujalagi, MalleshX <malleshx.koujalagi@intel.com>; dev@dpdk.org
> Cc: mtetsuyah@gmail.com
> Subject: Re: [dpdk-dev] [PATCH] net/null: Support bulk alloc and free.
> 
> On 2/3/2018 3:11 AM, Mallesh Koujalagi wrote:
> > After bulk allocation and freeing of multiple mbufs increase more than ~2%
> > throughput on single core.
> >
> > Signed-off-by: Mallesh Koujalagi <malleshx.koujalagi@intel.com>
> > ---
> >  drivers/net/null/rte_eth_null.c | 16 +++++++---------
> >  1 file changed, 7 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> > index 9385ffd..247ede0 100644
> > --- a/drivers/net/null/rte_eth_null.c
> > +++ b/drivers/net/null/rte_eth_null.c
> > @@ -130,10 +130,11 @@ eth_null_copy_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> >  		return 0;
> >
> >  	packet_size = h->internals->packet_size;
> > +
> > +	if (rte_pktmbuf_alloc_bulk(h->mb_pool, bufs, nb_bufs) != 0)
> > +		return 0;
> > +
> >  	for (i = 0; i < nb_bufs; i++) {
> > -		bufs[i] = rte_pktmbuf_alloc(h->mb_pool);
> > -		if (!bufs[i])
> > -			break;
> >  		rte_memcpy(rte_pktmbuf_mtod(bufs[i], void *), h->dummy_packet,
> >  					packet_size);
> >  		bufs[i]->data_len = (uint16_t)packet_size;
> > @@ -149,18 +150,15 @@ eth_null_copy_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> >  static uint16_t
> >  eth_null_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> >  {
> > -	int i;
> >  	struct null_queue *h = q;
> >
> >  	if ((q == NULL) || (bufs == NULL))
> >  		return 0;
> >
> > -	for (i = 0; i < nb_bufs; i++)
> > -		rte_pktmbuf_free(bufs[i]);
> > +	rte_mempool_put_bulk(bufs[0]->pool, (void **)bufs, nb_bufs);
> 
> Is it guarantied that all mbufs will be from same mempool?

I don't think it does, plus
rte_pktmbuf_free(mb) != rte_mempool_put_bulk(mb->pool, &mb, 1);
Konstantin

> 
> > +	rte_atomic64_add(&h->tx_pkts, nb_bufs);
> >
> > -	rte_atomic64_add(&(h->tx_pkts), i);
> > -
> > -	return i;
> > +	return nb_bufs;
> >  }
> >
> >  static uint16_t
> >


  reply	other threads:[~2018-03-05 15:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03  3:11 Mallesh Koujalagi
2018-03-05 15:24 ` Ferruh Yigit
2018-03-05 15:36   ` Ananyev, Konstantin [this message]
2018-03-07 10:57     ` Ferruh Yigit
2018-03-08 21:29       ` Koujalagi, MalleshX
2018-03-08 23:40 ` [dpdk-dev] [PATCH v2] net/null: support bulk allocation Mallesh Koujalagi
2018-03-09 11:09   ` Ferruh Yigit
2018-03-16 14:08     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2601191342CEEE43887BDE71AB97725890F203AA@irsmsx105.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=malleshx.koujalagi@intel.com \
    --cc=mtetsuyah@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).