DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mbuf: fix compile by making sched struct visible
@ 2019-01-10 16:50 Harry van Haaren
  2019-01-10 17:34 ` Thomas Monjalon
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Harry van Haaren @ 2019-01-10 16:50 UTC (permalink / raw)
  To: dev; +Cc: Harry van Haaren, reshma.pattan, cristian.dumitrescu, thomas

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.

Regards, -Harry

---
 lib/librte_mbuf/rte_mbuf.h | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index bc562dc8a..a9df0cd00 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -468,6 +468,17 @@ __extension__
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
                                * with a single assignment */
 
+struct rte_mbuf_sched {
+	uint32_t queue_id;   /**< Queue ID. */
+	uint8_t traffic_class;
+	/**< Traffic class ID. Traffic class 0
+	 * is the highest priority traffic class.
+	 */
+	uint8_t color;
+	/**< Color. @see enum rte_color.*/
+	uint16_t reserved;   /**< Reserved. */
+}; /**< Hierarchical scheduler */
+
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -574,16 +585,7 @@ struct rte_mbuf {
 				 * on PKT_RX_FDIR_* flag in ol_flags.
 				 */
 			} fdir;	/**< Filter identifier if FDIR enabled */
-			struct rte_mbuf_sched {
-				uint32_t queue_id;   /**< Queue ID. */
-				uint8_t traffic_class;
-				/**< Traffic class ID. Traffic class 0
-				 * is the highest priority traffic class.
-				 */
-				uint8_t color;
-				/**< Color. @see enum rte_color.*/
-				uint16_t reserved;   /**< Reserved. */
-			} sched; /**< Hierarchical scheduler */
+			struct rte_mbuf_sched sched; /**< Hierarchical scheduler */
 			struct {
 				uint32_t reserved1;
 				uint16_t reserved2;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-01-14 15:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10 16:50 [dpdk-dev] [PATCH] mbuf: fix compile by making sched struct visible Harry van Haaren
2019-01-10 17:34 ` Thomas Monjalon
2019-01-10 17:57   ` Van Haaren, Harry
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

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).