DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Pattan, Reshma" <reshma.pattan@intel.com>,
	 "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>,
	"olivier.matz@6wind.com" <olivier.matz@6wind.com>
Subject: Re: [dpdk-dev] [PATCH] mbuf: fix compile by making sched struct visible
Date: Thu, 10 Jan 2019 17:57:27 +0000	[thread overview]
Message-ID: <E923DB57A917B54B9182A2E928D00FA6757BDE02@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <1558979.Xtpf54c0cE@xps>

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, January 10, 2019 5:35 PM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>; Dumitrescu,
> Cristian <cristian.dumitrescu@intel.com>; olivier.matz@6wind.com
> Subject: Re: [PATCH] mbuf: fix compile by making sched struct visible
> 
> 10/01/2019 17:50, Harry van Haaren:
> > Although C compilation works with the struct rte_mbuf_sched
> > declared inside the struct rte_mbuf namespace, C++ fails to
> > compile. This fix moves the rte_mbuf_sched struct up to the
> > global namespace, instead of declaring it inside the struct
> > mbuf namespace.
> >
> > The struct rte_mbuf_sched is being used on the stack in
> > rte_mbuf_sched_get() and as a cast in _set(). For this
> > reason, it must be exposed as an available type.
> >
> > Fixes: 5d3f72100904 ("mbuf: implement generic format for sched field")
> >
> > Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> >
> > ---
> >
> > Cc: reshma.pattan@intel.com
> > Cc: cristian.dumitrescu@intel.com
> > Cc: thomas@monjalon.net
> >
> > Hey folks,
> >
> > Currently the mbuf header will fail to compile with a C++ compiler,
> > this patch is one possible solution. I'm not particularly happy with
> > this as a fix as it reduces mbuf struct readability, however it does
> > resolve the issue.
> 
> What are the other possible solutions?


I guess we could avoid using the struct in inline functions, by reading
or writing from the mbuf struct directly (without pulling out a temporary
rte_mbuf_sched field):

get()
*queue_id = m->hash.sched.queue_id;
...

set()
m->hash.sched.queue_id = queue_id;
...


I believe this was discussed when the patch was being reviewed;
http://patches.dpdk.org/patch/49126/

I have a mild preference to keep all mbuf structs visible inside the unions,
it makes it easier to understand the layout of mbuf, hence I prefer the
above pseudo code suggestion over the v1 patch sent before.

If others have a strong opinion for another solution, I'm ok with it.

  reply	other threads:[~2019-01-10 17:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 16:50 Harry van Haaren
2019-01-10 17:34 ` Thomas Monjalon
2019-01-10 17:57   ` Van Haaren, Harry [this message]
2019-01-10 18:06 ` [dpdk-dev] [PATCH v2] mbuf: fix compile by removing struct from function Harry van Haaren
2019-01-10 18:40   ` Dumitrescu, Cristian
2019-01-11  3:01     ` Gavin Hu (Arm Technology China)
2019-01-11  6:03       ` Stephen Hemminger
2019-01-11  8:44     ` Olivier Matz
2019-01-11 11:20       ` Van Haaren, Harry
2019-01-11 11:32   ` [dpdk-dev] [PATCH v3] mbuf: fix compile by making sched struct visible Harry van Haaren
2019-01-11 14:33     ` Dumitrescu, Cristian
2019-01-14 14:58       ` Olivier Matz
2019-01-14 15:28         ` Thomas Monjalon
2019-01-10 22:05 ` [dpdk-dev] [PATCH] " Stephen Hemminger

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=E923DB57A917B54B9182A2E928D00FA6757BDE02@IRSMSX102.ger.corp.intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=reshma.pattan@intel.com \
    --cc=thomas@monjalon.net \
    /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).