DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: Yerden Zhumabekov <e_zhumabekov@sts.kz>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] rte_port_ring and SP/MP, SC/MC flags
Date: Wed, 1 Feb 2017 23:00:12 +0000	[thread overview]
Message-ID: <3EB4FA525960D640B5BDFFD6A3D8912652746DF3@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <428d5e1d-8a34-bae1-0a4c-238269435903@sts.kz>

Hi Yerden,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yerden
> Zhumabekov
> Sent: Monday, January 30, 2017 5:43 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] rte_port_ring and SP/MP, SC/MC flags
> 
> Hello,
> 
> I'd like to use rte_port_ring abstract in my application and I'm a
> little confused about how it treats underlying ring flags.
> 
> According to DPDK API reference, when creating a ring (via
> rte_ring_create()/rte_ring_init()), RING_F_SP_ENQ/RING_F_SC_DEQ may
> be
> specified. These flags affect the choice of MP/SP, MC/SC operation when
> using 'default' ring enq/deq API, i.e.
> rte_ring_enqueue()/rte_ring_dequeue(),
> rte_ring_enqueue_bulk()/rte_ring_dequeue_bulk(),
> rte_ring_enqueue_burst()/rte_ring_dequeue_burst().
> 
> These API then choose which version of enq/deq to use considering the
> flags. If you use designated API straightforward, those API (*_mp_*,
> *_sc_* etc.) don't care about these flags and perform required
> operations right away.
> 
> When I use rte_port_ring abstraction, '.f_create()' functions check for
> flags which were used when creating an underlying ring (see
> lib/librte_port/rte_port_ring.c:75). But then different call tables use
> designated ring API which makes checking flags pointless.
> 

Yes, we can detect the SP/MP and SC/MC characteristic of each rte_ring by looking inside the structure, at least at this point. As a side note, personally I see this as an implementation detail that might change, and I don't want to rely on it too much (yes, we do rely on it for validation purpose at port_ring creation time, as you state).

> I find it confusing to be forced to choose between SP/MP, SC/MC twice,
> when creating ring at first and creating abstraction afterwards. And I
> see no point in checking for ring flags when creating abstraction
> because it really does not affect the operation of this abstraction
> anyway. Is this behaviour anyhow justified?
> 

Yes, we could have decided to have a unified implementation of rte_port_ring reader/writer that handles the SC/MC or SP/MP aspect transparently, but we decided against it because we want to write branchless code. The unified implementation would have to test the internal S/M flag on every call of the port_ring RX/TX function, which would have a performance impact, especially when a mix of S and M port rings are used within the same app.

> 
> --
> 
> Yerden Zhumabekov

Regards,
Cristian


      reply	other threads:[~2017-02-01 23:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30  5:42 Yerden Zhumabekov
2017-02-01 23:00 ` Dumitrescu, Cristian [this message]

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=3EB4FA525960D640B5BDFFD6A3D8912652746DF3@IRSMSX108.ger.corp.intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=e_zhumabekov@sts.kz \
    /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).