From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com
 [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id E14861B738
 for <dev@dpdk.org>; Thu, 10 Jan 2019 23:05:21 +0100 (CET)
Received: by mail-pl1-f194.google.com with SMTP id gn14so5772258plb.10
 for <dev@dpdk.org>; Thu, 10 Jan 2019 14:05:21 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=9Ae3/gTP4Ndy5z8cSkgUdLrsOAQj6X6qftEWvSERkbw=;
 b=T3SBFRbAAb1+hIi7c307BlI8w/+tooHo9RY6zGiH5z3JeqqMtBjQQX4Z/wBMkd7b1C
 LBhUg4Tk6fnPAbhL9obVc8uWHp3Zn3lv4DeC8TfGL6JdsEuNV+GOJdPys4B541nK5GVd
 Z8buSD3G9kDzDsGtn+43gCF/bx+Hetk99JGbcSvr9tIktkveZmlHvmxP+oTWI1Qg2z2G
 55RWgxe2/RvRyCQ1PBc6A6DGaySCJ9Aqh89mffxSnOAXq27CIVn5XMaHkC0kLlcBAghT
 ADJQVzYQQtvA87a7P567ERVI+o3m4YZ8iR72KLvhtz26ARfZiffZrvS0SmReaNFLcyt4
 TgLQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=9Ae3/gTP4Ndy5z8cSkgUdLrsOAQj6X6qftEWvSERkbw=;
 b=kvGw26jA8Sf1zZRdCH5jcgLDQ7tFc7HBiCfpIGEEPrfi83dU1m6dR9cRjGN/yv2OVS
 lTaP/Fd/6aw+cg5aYWlCmuOT8lkiK1fUASVOwWWhWrnrHCD3+vm1enaG6roQMLTWgcle
 bbjR8SsAIpjAtMORcemzriOYHfLdR46o1n1GQ02ppJ5OZH34hHULu9n7JRpSXEkrC7v/
 U4oJZQE4O60wZ6K9jWYLCGc2MZlv4jE+XQ2i6FpHElbhCAR6bSCjQA92dXBNLBbQpiQG
 487TSCzdwubHD8KnC1S5r7SiJkPiULlGQ6tgm6CWJoPvlwNRp/Gi5L/o0WS8Y26f0mzs
 cGlA==
X-Gm-Message-State: AJcUukfw2sfB9LUC5Houabz+90Nh5qPmK2qNOUFd/NPOcH4tkjjOyTBy
 gPfG9+xGwYyE4XGawxKpR5LrNA==
X-Google-Smtp-Source: ALg8bN5z7Ya5rvwcElJk578JCuvU9jtoE119S4RLYCiZqoySCAwBrAYJDbtar0fc8tFPjyQh6vvwnQ==
X-Received: by 2002:a17:902:a40f:: with SMTP id
 p15mr12339516plq.286.1547157920977; 
 Thu, 10 Jan 2019 14:05:20 -0800 (PST)
Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id b2sm138610603pfm.3.2019.01.10.14.05.20
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 10 Jan 2019 14:05:20 -0800 (PST)
Date: Thu, 10 Jan 2019 14:05:11 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Harry van Haaren <harry.van.haaren@intel.com>
Cc: dev@dpdk.org, reshma.pattan@intel.com, cristian.dumitrescu@intel.com,
 thomas@monjalon.net
Message-ID: <20190110140511.51728db0@hermes.lan>
In-Reply-To: <20190110165051.4859-1-harry.van.haaren@intel.com>
References: <20190110165051.4859-1-harry.van.haaren@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH] mbuf: fix compile by making sched struct
 visible
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Jan 2019 22:05:22 -0000

On Thu, 10 Jan 2019 16:50:51 +0000
Harry van Haaren <harry.van.haaren@intel.com> wrote:

> 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>
> 
I believe this was done so that the compiler doesn't generate
bad code.

If you reference the mbuf to get the fields then each operation becomes
a load shift and mask operation to get to the bitfield.  But if they
are local then this is all done on a single register value.

Check the generated code.

One solution would be to move this into a private header file
where C++ won't find it.