From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 744001B729 for ; Thu, 10 Jan 2019 19:06:33 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 10:06:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,462,1539673200"; d="scan'208";a="134790813" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.118]) by fmsmga004.fm.intel.com with ESMTP; 10 Jan 2019 10:06:31 -0800 From: Harry van Haaren To: dev@dpdk.org Cc: Harry van Haaren , reshma.pattan@intel.com, cristian.dumitrescu@intel.com, thomas@monjalon.net, olivier.matz@6wind.com Date: Thu, 10 Jan 2019 18:06:58 +0000 Message-Id: <20190110180658.23302-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110165051.4859-1-harry.van.haaren@intel.com> References: <20190110165051.4859-1-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH v2] mbuf: fix compile by removing struct from function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2019 18:06:33 -0000 Although C compilation works with the struct rte_mbuf_sched declared inside the struct rte_mbuf namespace, C++ fails to compile. This fix removes the temporary struct rte_mbuf_sched, instead reading from the mbuf directly for each struct member. As the struct is now not used directly, the C++ compiler doesn't need to know about the struct, resolving the issue. Fixes: 5d3f72100904 ("mbuf: implement generic format for sched field") Signed-off-by: Harry van Haaren --- Cc: reshma.pattan@intel.com Cc: cristian.dumitrescu@intel.com Cc: thomas@monjalon.net Cc: olivier.matz@6wind.com See mailing list for v1 discussion, perhaps this solution is more readable due to leaving sched struct in-line in the mbuf struct. --- lib/librte_mbuf/rte_mbuf.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index bc562dc8a..1b260efd5 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -2344,11 +2344,9 @@ rte_mbuf_sched_get(const struct rte_mbuf *m, uint32_t *queue_id, uint8_t *traffic_class, uint8_t *color) { - struct rte_mbuf_sched sched = m->hash.sched; - - *queue_id = sched.queue_id; - *traffic_class = sched.traffic_class; - *color = sched.color; + *queue_id = m->hash.sched.queue_id; + *traffic_class = m->hash.sched.traffic_class; + *color = m->hash.sched.color; } /** @@ -2395,11 +2393,9 @@ rte_mbuf_sched_set(struct rte_mbuf *m, uint32_t queue_id, uint8_t traffic_class, uint8_t color) { - m->hash.sched = (struct rte_mbuf_sched){ - .queue_id = queue_id, - .traffic_class = traffic_class, - .color = color, - }; + m->hash.sched.queue_id = queue_id; + m->hash.sched.traffic_class = traffic_class; + m->hash.sched.color = color; } #ifdef __cplusplus -- 2.17.1