Skip to contentSkip to conversation

Fixes for exported headers

PATCH Superseded Adrien Mazarguil 15 participants 66 messages Apr 24, 2017 – Apr 30, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Fixes for exported headers

This series addresses the remaining issues seen by check-includes.sh in exported headers. Most of them may cause compilation errors in user applications:

- Dependencies on missing includes.
- Non-standard C/C++ constructs usage without associated safeties.
- Missing C++ awareness blocks.

It also addresses the incomplete implementation of E-Tag and NVGRE flow API pattern items.

Adrien Mazarguil (13):
crypto/scheduler: fix missing includes
eventdev: fix errors with strict compilation flags
latency: fix missing includes in exported header
net: fix missing include in exported header
vhost: fix errors with strict compilation flags
mbuf: fix missing includes in exported header net/avp: fix errors in exported headers
bitrate: fix errors in exported header
efd: fix missing include in exported header
metrics: fix errors in exported header
ethdev: fix C++ errors in flow API
ethdev: fix C++ errors in flow API (MPLS, GRE)
ethdev: fix incomplete items in flow API

 app/test-pmd/cmdline_flow.c                     | 46 ++++++++++++++++++
 devtools/check-includes.sh                      |  4 +-
 doc/guides/prog_guide/rte_flow.rst              | 19 ++++++++
 .../crypto/scheduler/rte_cryptodev_scheduler.h  |  1 +
 .../rte_cryptodev_scheduler_operations.h        |  1 +
 drivers/net/avp/rte_avp_common.h                | 16 +++++-
 drivers/net/avp/rte_avp_fifo.h                  | 12 +++++
 lib/librte_bitratestats/rte_bitrate.h           | 10 ++++
 lib/librte_efd/rte_efd.h                        |  2 +
 lib/librte_ether/rte_flow.h                     | 51 ++++++++++++++++++++
 lib/librte_eventdev/rte_eventdev.h              |  3 +-
 lib/librte_eventdev/rte_eventdev_pmd.h          | 16 +++---
 lib/librte_latencystats/rte_latencystats.h      |  2 +
 lib/librte_mbuf/rte_mbuf_ptype.h                |  3 ++
 lib/librte_metrics/rte_metrics.h                | 10 ++++
 lib/librte_net/rte_net_crc.h                    |  2 +
 lib/librte_vhost/rte_vhost.h                    | 16 ++++--
 17 files changed, 200 insertions(+), 14 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/13 crypto/scheduler: fix missing includes

This commit addresses the following compilation errors:

In file included from build/include/rte_cryptodev_scheduler.h:37:0,

                  from /tmp/check-includes.sh.5355.c:1:
 build/include/rte_cryptodev_scheduler_operations.h:43:30: error: unknown
    type name 'uint8_t' struct rte_cryptodev *dev, uint8_t slave_id);

[...]

Fixes 097ab0bac017 ("crypto/scheduler: add API")
---
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h            | 1 +
 drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h | 1 +
 2 files changed, 2 insertions(+)
drivers/crypto/scheduler/rte_cryptodev_scheduler.h +1 -0
index 7a34d0a..2ba6e47 100644
@@ -46,6 +46,7 @@
  * operation: round robin, packet-size based, and fail-over.
  */
 
+#include <stdint.h>
 #include "rte_cryptodev_scheduler_operations.h"
 
 #ifdef __cplusplus
drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h +1 -0
index 42fe9e6..719165c 100644
@@ -34,6 +34,7 @@
 #ifndef _RTE_CRYPTO_SCHEDULER_OPERATIONS_H
 #define _RTE_CRYPTO_SCHEDULER_OPERATIONS_H
 
+#include <rte_cryptodev.h>
 
 #ifdef __cplusplus
 extern "C" {
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/13 eventdev: fix errors with strict compilation flags

In reply to Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from build/include/rte_eventdev_pmd.h:55:0,

                  from /tmp/check-includes.sh.25816.c:1:

build/include/rte_eventdev.h:908:8: error: struct has no named members
[-Werror=pedantic]
[...]
In file included from /tmp/check-includes.sh.25816.c:1:0:
build/include/rte_eventdev_pmd.h:65:35: error: ISO C does not permit named
variadic macros [-Werror=variadic-macros]
[...]

Fixes 71f238432865 ("eventdev: introduce event driven programming model")
Fixes 4f0804bbdfb9 ("eventdev: implement the northbound APIs")
---
 lib/librte_eventdev/rte_eventdev.h     |  3 +--
 lib/librte_eventdev/rte_eventdev_pmd.h | 16 +++++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)
lib/librte_eventdev/rte_eventdev.h +1 -2
index b8ed6ef..20e7293 100644
@@ -905,9 +905,9 @@ rte_event_dev_close(uint8_t dev_id);
  * The generic *rte_event* structure to hold the event attributes
  * for dequeue and enqueue operation
  */
+RTE_STD_C11
 struct rte_event {
 	/** WORD0 */
-	RTE_STD_C11
 	union {
 		uint64_t event;
 		/** Event attributes for dequeue or enqueue operation */
@@ -967,7 +967,6 @@ struct rte_event {
 		};
 	};
 	/** WORD1 */
-	RTE_STD_C11
 	union {
 		uint64_t u64;
 		/**< Opaque 64-bit value */
lib/librte_eventdev/rte_eventdev_pmd.h +9 -7
index a73dc91..988018f 100644
@@ -62,16 +62,18 @@ extern "C" {
 #endif
 
 /* Logging Macros */
-#define RTE_EDEV_LOG_ERR(fmt, args...) \
-	RTE_LOG(ERR, EVENTDEV, "%s() line %u: " fmt "\n",  \
-			__func__, __LINE__, ## args)
+#define RTE_EDEV_LOG_ERR(...) \
+	RTE_LOG(ERR, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-#define RTE_EDEV_LOG_DEBUG(fmt, args...) \
-	RTE_LOG(DEBUG, EVENTDEV, "%s() line %u: " fmt "\n",  \
-			__func__, __LINE__, ## args)
+#define RTE_EDEV_LOG_DEBUG(...) \
+	RTE_LOG(DEBUG, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 #else
-#define RTE_EDEV_LOG_DEBUG(fmt, args...) (void)0
+#define RTE_EDEV_LOG_DEBUG(...) (void)0
 #endif
 
 /* Macros to check for valid device */
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/13 latency: fix missing includes in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from build/include/rte_latencystats.h:43:0,

                  from /tmp/check-includes.sh.6580.c:1:

build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t' [...]
In file included from /tmp/check-includes.sh.6580.c:1:0:
build/include/rte_latencystats.h:66:19: error: expected declaration
specifiers or '...' before '*' token
[...]

Fixes 5cd3cac9ed22 ("latency: added new library for latency stats")
---
 lib/librte_latencystats/rte_latencystats.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_latencystats/rte_latencystats.h +2 -0
index 6efeaf4..d85cf3a 100644
@@ -40,7 +40,9 @@
  * library to provide application and flow based latency stats.
  */
 
+#include <stdint.h>
 #include <rte_metrics.h>
+#include <rte_mbuf.h>
 
 #ifdef __cplusplus
 extern "C" {
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/13 net: fix missing include in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.18889.c:1:0:
build/include/rte_net_crc.h:86:1: error: unknown type name 'uint32_t' [...]

Fixes 986ff526fb84 ("net: add CRC computation API")
---
 lib/librte_net/rte_net_crc.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_net/rte_net_crc.h +2 -0
index 76fd129..d22286c 100644
@@ -34,6 +34,8 @@
 #ifndef _RTE_NET_CRC_H_
 #define _RTE_NET_CRC_H_
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
#5 lore raw

PATCH 5/13 vhost: fix errors with strict compilation flags

In reply to Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from /tmp/check-includes.sh.20132.c:1:0:
build/include/rte_vhost.h:73:30: error: ISO C forbids zero-size array
'regions' [-Werror=pedantic]
[...]

Also:

- Add C++ awareness to rte_vhost.h for consistency with rte_eth_vhost.h.
- Move Linux includes into C++ block to prevent linking issues with exported symbols.
- Update check-includes.sh following the removal of rte_virtio_net.h.

Finally, update check-includes.sh to ignore rte_vhost.h and rte_eth_vhost.h from now on since the Linux headers they depend on are not clean enough:

In file included from /usr/include/linux/vhost.h:17:0,

                  from build/include/rte_vhost.h:43,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:
 /usr/include/linux/virtio_ring.h: In function 'vring_init':
 /usr/include/linux/virtio_ring.h:146:16: error: pointer of type 'void *'
    used in arithmetic [-Werror=pointer-arith]
 [...]
 In file included from build/include/rte_vhost.h:43:0,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:

/usr/include/linux/vhost.h: At top level:
/usr/include/linux/vhost.h:73:3: error: ISO C99 doesn't support unnamed
structs/unions [-Werror=pedantic]
[...]

Fixes eb32247457fe ("vhost: export guest memory regions")
Fixes a798beb47c8e ("vhost: rename header file")
Cc Yuanhan Liu <[email protected]>
Cc Maxime Coquelin <[email protected]>
---
 devtools/check-includes.sh   |  4 +++-
 lib/librte_vhost/rte_vhost.h | 16 +++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)
devtools/check-includes.sh +3 -1
index d65adc6..c4ec73f 100755
@@ -109,10 +109,12 @@ include_dir=${1:-build/include}
 	'rte_byteorder_64.h' \
 	'generic/*' \
 	'exec-env/*' \
+	'rte_vhost.h' \
+	'rte_eth_vhost.h' \
 }
 : ${IGNORE_CXX= \
+	'rte_vhost.h' \
 	'rte_eth_vhost.h' \
-	'rte_virtio_net.h' \
 }
 
 temp_cc=/tmp/${0##*/}.$$.c
lib/librte_vhost/rte_vhost.h +13 -3
index 7a586e4..605e47c 100644
@@ -40,13 +40,19 @@
  */
 
 #include <stdint.h>
-#include <linux/vhost.h>
-#include <linux/virtio_ring.h>
 #include <sys/eventfd.h>
 
 #include <rte_memory.h>
 #include <rte_mempool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These are not C++-aware. */
+#include <linux/vhost.h>
+#include <linux/virtio_ring.h>
+
 #define RTE_VHOST_USER_CLIENT		(1ULL << 0)
 #define RTE_VHOST_USER_NO_RECONNECT	(1ULL << 1)
 #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY	(1ULL << 2)
@@ -70,7 +76,7 @@ struct rte_vhost_mem_region {
  */
 struct rte_vhost_memory {
 	uint32_t nregions;
-	struct rte_vhost_mem_region regions[0];
+	struct rte_vhost_mem_region regions[];
 };
 
 struct rte_vhost_vring {
@@ -426,4 +432,8 @@ int rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem);
 int rte_vhost_get_vhost_vring(int vid, uint16_t vring_idx,
 			      struct rte_vhost_vring *vring);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_VHOST_H_ */
Signature · 1 line
2.1.4
Acked-by on v1 5/13
#6 lore raw

Re: [PATCH 05/13] vhost: fix errors with strict compilation flags

Quoted 34 lines · Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from /tmp/check-includes.sh.20132.c:1:0:
build/include/rte_vhost.h:73:30: error: ISO C forbids zero-size array
'regions' [-Werror=pedantic]
[...]

Also:

- Add C++ awareness to rte_vhost.h for consistency with rte_eth_vhost.h.
- Move Linux includes into C++ block to prevent linking issues with exported symbols.
- Update check-includes.sh following the removal of rte_virtio_net.h.

Finally, update check-includes.sh to ignore rte_vhost.h and rte_eth_vhost.h from now on since the Linux headers they depend on are not clean enough:

In file included from /usr/include/linux/vhost.h:17:0,

                  from build/include/rte_vhost.h:43,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:
 /usr/include/linux/virtio_ring.h: In function 'vring_init':
 /usr/include/linux/virtio_ring.h:146:16: error: pointer of type 'void *'
    used in arithmetic [-Werror=pointer-arith]
 [...]
 In file included from build/include/rte_vhost.h:43:0,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:

/usr/include/linux/vhost.h: At top level:
/usr/include/linux/vhost.h:73:3: error: ISO C99 doesn't support unnamed
structs/unions [-Werror=pedantic]
[...]

Quoted 6 lines
Fixes eb32247457fe ("vhost: export guest memory regions")
Fixes a798beb47c8e ("vhost: rename header file")
Cc Yuanhan Liu <[email protected]>
Cc Maxime Coquelin <[email protected]>
	--yliu
Acked-by on v1 5/13
#7 lore raw

Re: [PATCH 05/13] vhost: fix errors with strict compilation flags

In reply to Adrien Mazarguil
Quoted 37 lines · Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from /tmp/check-includes.sh.20132.c:1:0:
build/include/rte_vhost.h:73:30: error: ISO C forbids zero-size array
'regions' [-Werror=pedantic]
[...]

Also:

- Add C++ awareness to rte_vhost.h for consistency with rte_eth_vhost.h.
- Move Linux includes into C++ block to prevent linking issues with exported symbols.
- Update check-includes.sh following the removal of rte_virtio_net.h.

Finally, update check-includes.sh to ignore rte_vhost.h and rte_eth_vhost.h from now on since the Linux headers they depend on are not clean enough:

In file included from /usr/include/linux/vhost.h:17:0,

                   from build/include/rte_vhost.h:43,
                   from build/include/rte_eth_vhost.h:44,
                   from /tmp/check-includes.sh.20132.c:1:
  /usr/include/linux/virtio_ring.h: In function 'vring_init':
  /usr/include/linux/virtio_ring.h:146:16: error: pointer of type 'void *'
     used in arithmetic [-Werror=pointer-arith]
  [...]
  In file included from build/include/rte_vhost.h:43:0,
                   from build/include/rte_eth_vhost.h:44,
                   from /tmp/check-includes.sh.20132.c:1:

/usr/include/linux/vhost.h: At top level:
/usr/include/linux/vhost.h:73:3: error: ISO C99 doesn't support unnamed
structs/unions [-Werror=pedantic]
[...]

Fixes eb32247457fe ("vhost: export guest memory regions")
Fixes a798beb47c8e ("vhost: rename header file")
Quoted 7 lines
Cc Yuanhan Liu <[email protected]>
Cc Maxime Coquelin <[email protected]>
---
  devtools/check-includes.sh   |  4 +++-
  lib/librte_vhost/rte_vhost.h | 16 +++++++++++++---
  2 files changed, 16 insertions(+), 4 deletions(-)

Thanks,
Maxime

#8 lore raw

PATCH 6/13 mbuf: fix missing includes in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.681.c:1:0:
build/include/rte_mbuf_ptype.h:587:35: error: unknown type name 'uint32_t' [...]
build/include/rte_mbuf_ptype.h:662:51: error: unknown type name 'size_t' [...]

Fixes 288541c8ff9e ("mbuf: add functions to dump packet type")
---
 lib/librte_mbuf/rte_mbuf_ptype.h | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_mbuf/rte_mbuf_ptype.h +3 -0
index ff6de9d..a3269c4 100644
@@ -91,6 +91,9 @@
  * RTE_PTYPE_INNER_L4_UDP.
  */
 
+#include <stddef.h>
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
#9 lore raw

PATCH 7/13 net/avp: fix errors in exported headers

In reply to Adrien Mazarguil

This commit addresses several errors related to missing includes such as:

In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_fifo.h:77:22: error: 'struct rte_avp_fifo' declared
inside parameter list [-Werror]
[...]
build/include/rte_avp_fifo.h: In function 'avp_fifo_init':
build/include/rte_avp_fifo.h:81:3: error: implicit declaration of function
'rte_panic' [-Werror=implicit-function-declaration]
[...]
build/include/rte_avp_fifo.h:83:6: error: dereferencing pointer to
incomplete type
[...]
build/include/rte_avp_fifo.h:109:2: error: implicit declaration of
function 'rte_wmb' [-Werror=implicit-function-declaration]
[...]
In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_common.h:104:2: error: unknown type name 'uint64_t' [...]
build/include/rte_avp_common.h:386:15: error: 'ETHER_ADDR_LEN' undeclared
here (not in a function)
[...]

It addresses errors with strict compilation flags:

In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_common.h:122:3: error: ISO C99 doesn't support
unnamed structs/unions [-Werror=pedantic]
[...]
build/include/rte_avp_common.h:136:17: error: ISO C forbids zero-size
array 'buffer' [-Werror=pedantic]
[...]

And also adds C++ awareness to both header files.

Fixes 8e680655e205 ("net/avp: add public header files")
---
 drivers/net/avp/rte_avp_common.h | 16 +++++++++++++++-
 drivers/net/avp/rte_avp_fifo.h   | 12 ++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/net/avp/rte_avp_common.h +15 -1
index 31d763e..6cdaca9 100644
@@ -57,9 +57,18 @@
 #ifndef _RTE_AVP_COMMON_H_
 #define _RTE_AVP_COMMON_H_
 
+#include <stdint.h>
 #ifdef __KERNEL__
 #include <linux/if.h>
 #endif
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_ether.h>
+#include <rte_atomic.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * AVP name is part of network device name.
@@ -115,6 +124,7 @@ struct rte_avp_device_config {
  */
 struct rte_avp_request {
 	uint32_t req_id; /**< Request id */
+	RTE_STD_C11
 	union {
 		uint32_t new_mtu; /**< New MTU */
 		uint8_t if_up;	/**< 1: interface up, 0: interface down */
@@ -133,7 +143,7 @@ struct rte_avp_fifo {
 	volatile unsigned int read; /**< Next position to be read */
 	unsigned int len; /**< Circular buffer length */
 	unsigned int elem_size; /**< Pointer size - for 32/64 bit OS */
-	void *volatile buffer[0]; /**< The buffer contains mbuf pointers */
+	void *volatile buffer[]; /**< The buffer contains mbuf pointers */
 };
 
 
@@ -413,4 +423,8 @@ struct rte_avp_device_info {
 #define RTE_AVP_IOCTL_RELEASE _IOWR(0, 3, struct rte_avp_device_info)
 #define RTE_AVP_IOCTL_QUERY   _IOWR(0, 4, struct rte_avp_device_config)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_COMMON_H_ */
drivers/net/avp/rte_avp_fifo.h +12 -0
index 8262e4f..a0a37eb 100644
@@ -57,6 +57,12 @@
 #ifndef _RTE_AVP_FIFO_H_
 #define _RTE_AVP_FIFO_H_
 
+#include <rte_avp_common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __KERNEL__
 /* Write memory barrier for kernel compiles */
 #define AVP_WMB() smp_wmb()
@@ -70,6 +76,8 @@
 #endif
 
 #ifndef __KERNEL__
+#include <rte_debug.h>
+
 /**
  * Initializes the avp fifo structure
  */
@@ -154,4 +162,8 @@ avp_fifo_free_count(struct rte_avp_fifo *fifo)
 	return (fifo->read - fifo->write - 1) & (fifo->len - 1);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_FIFO_H_ */
Signature · 1 line
2.1.4
#10 lore raw

Re: [PATCH 07/13] net/avp: fix errors in exported headers

Quoted 3 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Monday, April 24, 2017 11:53 AM

<...>

Quoted 7 lines
drivers/net/avp/rte_avp_common.h +0 -0
index 31d763e..6cdaca9 100644
@@ -57,9 +57,18 @@
 #ifndef _RTE_AVP_COMMON_H_

drivers/net/avp/rte_avp_common.h line 67

Quoted 10 lines
drivers/net/avp/rte_avp_common.h +5 -0
 #define _RTE_AVP_COMMON_H_
 
+#include <stdint.h>
 #ifdef __KERNEL__
 #include <linux/if.h>
 #endif
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_ether.h>
+#include <rte_atomic.h>

These 4 are going to need to be in an #else of the #ifdef __KERNEL__ otherwise our local kernel module build will fail.

#11 lore raw

PATCH 8/13 bitrate: fix errors in exported header

In reply to Adrien Mazarguil

This commit addresses the following error:

In file included from /tmp/check-includes.sh.28023.c:1:0:
build/include/rte_bitrate.h:82:2: error: unknown type name 'uint8_t' [...]

It also adds C++ awareness to rte_bitrate.h.

Fixes 2ad7ba9a6567 ("bitrate: add bitrate statistics library")
---
 lib/librte_bitratestats/rte_bitrate.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/librte_bitratestats/rte_bitrate.h +10 -0
index b9f11bd..15fc270 100644
@@ -34,6 +34,12 @@
 #ifndef _RTE_BITRATE_H_
 #define _RTE_BITRATE_H_
 
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  *  Bitrate statistics data structure.
  *  This data structure is intentionally opaque.
@@ -81,4 +87,8 @@ int rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data);
 int rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
 	uint8_t port_id);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_BITRATE_H_ */
Signature · 1 line
2.1.4
#12 lore raw

PATCH 9/13 efd: fix missing include in exported header

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from /tmp/check-includes.sh.8373.c:1:0:
build/include/rte_efd.h:133:9: error: unknown type name 'uint8_t' [...]

Fixes 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Cc Byron Marohn <[email protected]>
Cc Pablo de Lara Guarch <[email protected]>
---
 lib/librte_efd/rte_efd.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_efd/rte_efd.h +2 -0
index 6d31e18..1596863 100644
@@ -40,6 +40,8 @@
  * RTE EFD Table
  */
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
#13 lore raw

PATCH 10/13 metrics: fix errors in exported header

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from /tmp/check-includes.sh.21060.c:1:0:
build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t' [...]

It also adds C++ awareness to rte_metrics.h.

Fixes 349950ddb9c5 ("metrics: add information metrics library")
---
 lib/librte_metrics/rte_metrics.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/librte_metrics/rte_metrics.h +10 -0
index fd0154f..0fa3104 100644
@@ -52,6 +52,12 @@
 #ifndef _RTE_METRICS_H_
 #define _RTE_METRICS_H_
 
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Maximum length of metric name (including null-terminator) */
 #define RTE_METRICS_MAX_NAME_LEN 64
 
@@ -237,4 +243,8 @@ int rte_metrics_update_values(
 	const uint64_t *values,
 	uint32_t count);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
Signature · 1 line
2.1.4
#14 lore raw

PATCH 11/13 ethdev: fix C++ errors in flow API

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:
 build/include/rte_flow.h:428:2: error: expected primary-expression before
    '.' token

[...]
build/include/rte_flow.h:469:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 6de5c0f1302c ("ethdev: define default item masks in flow API")
---
 lib/librte_ether/rte_flow.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
lib/librte_ether/rte_flow.h +26 -0
index 7749491..bc7bc45 100644
@@ -314,9 +314,11 @@ struct rte_flow_item_any {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
+#ifndef __cplusplus
 static const struct rte_flow_item_any rte_flow_item_any_mask = {
 	.num = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VF
@@ -341,9 +343,11 @@ struct rte_flow_item_vf {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
 	.id = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_PORT
@@ -370,9 +374,11 @@ struct rte_flow_item_port {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT. */
+#ifndef __cplusplus
 static const struct rte_flow_item_port rte_flow_item_port_mask = {
 	.index = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_RAW
@@ -403,6 +409,7 @@ struct rte_flow_item_raw {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
+#ifndef __cplusplus
 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
 	.relative = 1,
 	.search = 1,
@@ -411,6 +418,7 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
 	.limit = 0xffff,
 	.length = 0xffff,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_ETH
@@ -424,11 +432,13 @@ struct rte_flow_item_eth {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
+#ifndef __cplusplus
 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
 	.dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.type = 0x0000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VLAN
@@ -444,10 +454,12 @@ struct rte_flow_item_vlan {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
 	.tpid = 0x0000,
 	.tci = 0xffff,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV4
@@ -461,12 +473,14 @@ struct rte_flow_item_ipv4 {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
 	.hdr = {
 		.src_addr = 0xffffffff,
 		.dst_addr = 0xffffffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV6.
@@ -480,6 +494,7 @@ struct rte_flow_item_ipv6 {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
 	.hdr = {
 		.src_addr =
@@ -490,6 +505,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
 			"\xff\xff\xff\xff\xff\xff\xff\xff",
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_ICMP.
@@ -501,12 +517,14 @@ struct rte_flow_item_icmp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
 	.hdr = {
 		.icmp_type = 0xff,
 		.icmp_code = 0xff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_UDP.
@@ -518,12 +536,14 @@ struct rte_flow_item_udp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_TCP.
@@ -535,12 +555,14 @@ struct rte_flow_item_tcp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_SCTP.
@@ -552,12 +574,14 @@ struct rte_flow_item_sctp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VXLAN.
@@ -572,9 +596,11 @@ struct rte_flow_item_vxlan {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
 	.vni = "\xff\xff\xff",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_E_TAG.
Signature · 1 line
2.1.4
#15 lore raw

PATCH 12/13 ethdev: fix C++ errors in flow API (MPLS, GRE)

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:

build/include/rte_flow.h:631:1: error: C99 designator 'label_tc_s' outside
aggregate initializer
[...]
build/include/rte_flow.h:631:1: error: initializer-string for array of
chars is too long [-fpermissive]
[...]
build/include/rte_flow.h:650:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 7cd048321d1d ("ethdev: add MPLS and GRE flow API items")
---
 lib/librte_ether/rte_flow.h | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_ether/rte_flow.h +4 -0
index bc7bc45..abd4c6a 100644
@@ -652,9 +652,11 @@ struct rte_flow_item_mpls {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
+#ifndef __cplusplus
 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
 	.label_tc_s = "\xff\xff\xf0",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_GRE.
@@ -671,9 +673,11 @@ struct rte_flow_item_gre {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
+#ifndef __cplusplus
 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
 	.protocol = 0xffff,
 };
+#endif
 
 /**
  * Matching pattern item definition.
Signature · 1 line
2.1.4
Acked-by on v1 12/13
#16 lore raw

Re: [PATCH 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE)

Quoted 72 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Monday, April 24, 2017 11:53 PM
To: [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: [PATCH 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE)

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:

build/include/rte_flow.h:631:1: error: C99 designator 'label_tc_s' outside
aggregate initializer
[...]
build/include/rte_flow.h:631:1: error: initializer-string for array of
chars is too long [-fpermissive]
[...]
build/include/rte_flow.h:650:1: sorry, unimplemented: non-trivial
designated initializers not supported [...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 7cd048321d1d ("ethdev: add MPLS and GRE flow API items")
---
 lib/librte_ether/rte_flow.h | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_ether/rte_flow.h index renamed from lib/librte_ether/rte_flow.h +0 -0

bc7bc45..abd4c6a 100644

lib/librte_ether/rte_flow.h +4 -1
@@ -652,9 +652,11 @@ struct rte_flow_item_mpls {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
+#ifndef __cplusplus
 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
 	.label_tc_s = "\xff\xff\xf0",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_GRE.
@@ -671,9 +673,11 @@ struct rte_flow_item_gre {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
+#ifndef __cplusplus
 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
 	.protocol = 0xffff,
 };
+#endif
 
 /**
  * Matching pattern item definition.
--
Quoted 1 line

2.1.4

Thanks.

#17 lore raw

PATCH 13/13 ethdev: fix incomplete items in flow API

In reply to Adrien Mazarguil

E-Tag and NVGRE pattern items have been added hastily without updating documentation nor testpmd.

This commit also adds default masks for these items based on the ixgbe implementation.

Fixes 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
---
 app/test-pmd/cmdline_flow.c        | 46 +++++++++++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst | 19 ++++++++++++++
 lib/librte_ether/rte_flow.h        | 21 +++++++++++++++
 3 files changed, 86 insertions(+)
app/test-pmd/cmdline_flow.c +46 -0
index 4e99f0f..5514ee4 100644
@@ -159,6 +159,10 @@ enum index {
 	ITEM_SCTP_CKSUM,
 	ITEM_VXLAN,
 	ITEM_VXLAN_VNI,
+	ITEM_E_TAG,
+	ITEM_E_TAG_ECID_B,
+	ITEM_NVGRE,
+	ITEM_NVGRE_TNI,
 	ITEM_MPLS,
 	ITEM_MPLS_LABEL,
 	ITEM_GRE,
@@ -436,6 +440,8 @@ static const enum index next_item[] = {
 	ITEM_TCP,
 	ITEM_SCTP,
 	ITEM_VXLAN,
+	ITEM_E_TAG,
+	ITEM_NVGRE,
 	ITEM_MPLS,
 	ITEM_GRE,
 	ZERO,
@@ -544,6 +550,18 @@ static const enum index item_vxlan[] = {
 	ZERO,
 };
 
+static const enum index item_e_tag[] = {
+	ITEM_E_TAG_ECID_B,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_nvgre[] = {
+	ITEM_NVGRE_TNI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_mpls[] = {
 	ITEM_MPLS_LABEL,
 	ITEM_NEXT,
@@ -1297,6 +1315,34 @@ static const struct token token_list[] = {
 		.next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)),
 	},
+	[ITEM_E_TAG] = {
+		.name = "e_tag",
+		.help = "match E-Tag header",
+		.priv = PRIV_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
+		.next = NEXT(item_e_tag),
+		.call = parse_vc,
+	},
+	[ITEM_E_TAG_ECID_B] = {
+		.name = "ecid_b",
+		.help = "E-CID base",
+		.next = NEXT(item_e_tag, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_e_tag,
+						  rsvd_grp_ecid_b,
+						  "\x3f\xff")),
+	},
+	[ITEM_NVGRE] = {
+		.name = "nvgre",
+		.help = "match NVGRE header",
+		.priv = PRIV_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
+		.next = NEXT(item_nvgre),
+		.call = parse_vc,
+	},
+	[ITEM_NVGRE_TNI] = {
+		.name = "tni",
+		.help = "Virtual subnet ID",
+		.next = NEXT(item_nvgre, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_nvgre, tni)),
+	},
 	[ITEM_MPLS] = {
 		.name = "mpls",
 		.help = "match MPLS header",
doc/guides/prog_guide/rte_flow.rst +19 -0
index 9bca9ec..5dfd8a2 100644
@@ -863,6 +863,25 @@ Matches a VXLAN header (RFC 7348).
 - ``rsvd1``: reserved, normally 0x00.
 - Default ``mask`` matches VNI only.
 
+Item: ``E_TAG``
+^^^^^^^^^^^^^^^
+
+Matches an IEEE 802.1BR E-Tag header.
+
+- ``tpid``: tag protocol identifier (0x893F)
+- ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b),
+  E-DEI (1b), ingress E-CID base (12b).
+- ``rsvd_grp_ecid_b``: reserved (2b), GRP (2b), E-CID base (12b).
+- ``in_ecid_e``: ingress E-CID ext.
+- ``ecid_e``: E-CID ext.
+
+Item: ``NVGRE``
+^^^^^^^^^^^^^^^
+
+Matches a NVGRE header (RFC 7637).
+
+- ``c_k_s_rsvd0_ver``
+
 Item: ``MPLS``
 ^^^^^^^^^^^^^^
 
lib/librte_ether/rte_flow.h +21 -0
index abd4c6a..c47edbc 100644
@@ -49,6 +49,7 @@
 #include <rte_sctp.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_byteorder.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -620,6 +621,19 @@ struct rte_flow_item_e_tag {
 	uint8_t ecid_e; /**< E-CID ext. */
 };
 
+/** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
+#ifndef __cplusplus
+static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	.rsvd_grp_ecid_b = 0x3fff,
+#elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	.rsvd_grp_ecid_b = 0xff3f,
+#else
+#error Unsupported endianness.
+#endif
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_NVGRE.
  *
@@ -638,6 +652,13 @@ struct rte_flow_item_nvgre {
 	uint8_t flow_id; /**< Flow ID. */
 };
 
+/** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
+	.tni = "\xff\xff\xff",
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_MPLS.
  *
Signature · 1 line
2.1.4
#18 lore raw

v2 cover Fixes for exported headers

In reply to Adrien Mazarguil

This series addresses the remaining issues seen by check-includes.sh in exported headers. Most of them may cause compilation errors in user applications:

- Dependencies on missing includes.
- Non-standard C/C++ constructs usage without associated safeties.
- Missing C++ awareness blocks.

It also addresses the incomplete implementation of E-Tag and NVGRE flow API pattern items.

Changes in v2:

- Fixed (still) incomplete E-tag and NVGRE flow API documentation.
- Renamed E-Tag item parameter "ecid_b" to "grp_ecid_b" in testpmd, to reflect that both fields are set at once.
- Fixed remaining compilation issue with RTE_LIBRTE_EVENTDEV_DEBUG.
- Fixed avp include to avoid kernel module compilation issue pointed out by Allain.

Adrien Mazarguil (13):
crypto/scheduler: fix missing includes
eventdev: fix errors with strict compilation flags
latency: fix missing includes in exported header
net: fix missing include in exported header
vhost: fix errors with strict compilation flags
mbuf: fix missing includes in exported header net/avp: fix errors in exported headers
bitrate: fix errors in exported header
efd: fix missing include in exported header
metrics: fix errors in exported header
ethdev: fix C++ errors in flow API
ethdev: fix C++ errors in flow API (MPLS, GRE)
ethdev: fix incomplete items in flow API

 app/test-pmd/cmdline_flow.c                     | 46 ++++++++++++++++++
 devtools/check-includes.sh                      |  4 +-
 doc/guides/prog_guide/rte_flow.rst              | 26 ++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst     |  8 +++
 .../crypto/scheduler/rte_cryptodev_scheduler.h  |  1 +
 .../rte_cryptodev_scheduler_operations.h        |  1 +
 drivers/net/avp/rte_avp_common.h                | 17 ++++++-
 drivers/net/avp/rte_avp_fifo.h                  | 12 +++++
 lib/librte_bitratestats/rte_bitrate.h           | 10 ++++
 lib/librte_efd/rte_efd.h                        |  2 +
 lib/librte_ether/rte_flow.h                     | 51 ++++++++++++++++++++
 lib/librte_eventdev/rte_eventdev.h              |  3 +-
 lib/librte_eventdev/rte_eventdev_pmd.h          | 24 ++++-----
 lib/librte_latencystats/rte_latencystats.h      |  2 +
 lib/librte_mbuf/rte_mbuf_ptype.h                |  3 ++
 lib/librte_metrics/rte_metrics.h                | 10 ++++
 lib/librte_net/rte_net_crc.h                    |  2 +
 lib/librte_vhost/rte_vhost.h                    | 16 ++++--
 18 files changed, 217 insertions(+), 21 deletions(-)
Signature · 1 line
2.1.4
#19 lore raw

PATCH v2 1/13 crypto/scheduler: fix missing includes

This commit addresses the following compilation errors:

In file included from build/include/rte_cryptodev_scheduler.h:37:0,

                  from /tmp/check-includes.sh.5355.c:1:
 build/include/rte_cryptodev_scheduler_operations.h:43:30: error: unknown
    type name 'uint8_t' struct rte_cryptodev *dev, uint8_t slave_id);

[...]

Fixes 097ab0bac017 ("crypto/scheduler: add API")
---
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h            | 1 +
 drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h | 1 +
 2 files changed, 2 insertions(+)
drivers/crypto/scheduler/rte_cryptodev_scheduler.h +1 -0
index 7a34d0a..2ba6e47 100644
@@ -46,6 +46,7 @@
  * operation: round robin, packet-size based, and fail-over.
  */
 
+#include <stdint.h>
 #include "rte_cryptodev_scheduler_operations.h"
 
 #ifdef __cplusplus
drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h +1 -0
index 42fe9e6..719165c 100644
@@ -34,6 +34,7 @@
 #ifndef _RTE_CRYPTO_SCHEDULER_OPERATIONS_H
 #define _RTE_CRYPTO_SCHEDULER_OPERATIONS_H
 
+#include <rte_cryptodev.h>
 
 #ifdef __cplusplus
 extern "C" {
Signature · 1 line
2.1.4
Acked-by on v2 1/13
#20 lore raw

Re: [PATCH v2 01/13] crypto/scheduler: fix missing includes

Quoted 9 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Tuesday, April 25, 2017 9:30 AM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>
Subject: [PATCH v2 01/13] crypto/scheduler: fix missing includes

Quoted 8 lines

This commit addresses the following compilation errors:

In file included from build/include/rte_cryptodev_scheduler.h:37:0,

                  from /tmp/check-includes.sh.5355.c:1:

build/include/rte_cryptodev_scheduler_operations.h:43:30: error: unknown
type name 'uint8_t' struct rte_cryptodev *dev, uint8_t slave_id); [...]

Fixes 097ab0bac017 ("crypto/scheduler: add API")

Thanks for the patch, Adrien.

#21 lore raw

PATCH v2 2/13 eventdev: fix errors with strict compilation flags

In reply to Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from build/include/rte_eventdev_pmd.h:55:0,

                  from /tmp/check-includes.sh.25816.c:1:

build/include/rte_eventdev.h:908:8: error: struct has no named members
[-Werror=pedantic]
[...]
In file included from /tmp/check-includes.sh.25816.c:1:0:
build/include/rte_eventdev_pmd.h:65:35: error: ISO C does not permit named
variadic macros [-Werror=variadic-macros]
[...]

Also enabling RTE_LIBRTE_EVENTDEV_DEBUG causes redefinitions:

In file included from /tmp/check-includes.sh.18921.c:27:0:

    build/include/rte_eventdev_pmd.h:58:0: error: "RTE_PMD_DEBUG_TRACE"
    redefined [-Werror]

[...]

Rely on the rte_ethdev.h version instead.

Fixes 71f238432865 ("eventdev: introduce event driven programming model")
Fixes 4f0804bbdfb9 ("eventdev: implement the northbound APIs")
---
 lib/librte_eventdev/rte_eventdev.h     |  3 +--
 lib/librte_eventdev/rte_eventdev_pmd.h | 24 ++++++++++--------------
 2 files changed, 11 insertions(+), 16 deletions(-)
lib/librte_eventdev/rte_eventdev.h +1 -2
index b8ed6ef..20e7293 100644
@@ -905,9 +905,9 @@ rte_event_dev_close(uint8_t dev_id);
  * The generic *rte_event* structure to hold the event attributes
  * for dequeue and enqueue operation
  */
+RTE_STD_C11
 struct rte_event {
 	/** WORD0 */
-	RTE_STD_C11
 	union {
 		uint64_t event;
 		/** Event attributes for dequeue or enqueue operation */
@@ -967,7 +967,6 @@ struct rte_event {
 		};
 	};
 	/** WORD1 */
-	RTE_STD_C11
 	union {
 		uint64_t u64;
 		/**< Opaque 64-bit value */
lib/librte_eventdev/rte_eventdev_pmd.h +10 -14
index a73dc91..a090fa4 100644
@@ -51,27 +51,23 @@ extern "C" {
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_common.h>
+#include <rte_ethdev.h>
 
 #include "rte_eventdev.h"
 
-#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
 /* Logging Macros */
-#define RTE_EDEV_LOG_ERR(fmt, args...) \
-	RTE_LOG(ERR, EVENTDEV, "%s() line %u: " fmt "\n",  \
-			__func__, __LINE__, ## args)
+#define RTE_EDEV_LOG_ERR(...) \
+	RTE_LOG(ERR, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-#define RTE_EDEV_LOG_DEBUG(fmt, args...) \
-	RTE_LOG(DEBUG, EVENTDEV, "%s() line %u: " fmt "\n",  \
-			__func__, __LINE__, ## args)
+#define RTE_EDEV_LOG_DEBUG(...) \
+	RTE_LOG(DEBUG, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 #else
-#define RTE_EDEV_LOG_DEBUG(fmt, args...) (void)0
+#define RTE_EDEV_LOG_DEBUG(...) (void)0
 #endif
 
 /* Macros to check for valid device */
Signature · 1 line
2.1.4
#22 lore raw

Re: [PATCH v2 02/13] eventdev: fix errors with strict compilation flags

Hi Adrien,

Quoted 30 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Adrien Mazarguil
Sent: Tuesday, April 25, 2017 9:30 AM
To: [email protected]
Cc: Jerin Jacob
Subject: [dpdk-dev] [PATCH v2 02/13] eventdev: fix errors with strict compilation flags

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from build/include/rte_eventdev_pmd.h:55:0,

                  from /tmp/check-includes.sh.25816.c:1:

build/include/rte_eventdev.h:908:8: error: struct has no named members
[-Werror=pedantic]
[...]
In file included from /tmp/check-includes.sh.25816.c:1:0:
build/include/rte_eventdev_pmd.h:65:35: error: ISO C does not permit
named
variadic macros [-Werror=variadic-macros]
[...]

Also enabling RTE_LIBRTE_EVENTDEV_DEBUG causes redefinitions:

In file included from /tmp/check-includes.sh.18921.c:27:0:

    build/include/rte_eventdev_pmd.h:58:0: error:

"RTE_PMD_DEBUG_TRACE"
redefined [-Werror]
[...]

Quoted 8 lines

Rely on the rte_ethdev.h version instead.

Fixes 71f238432865 ("eventdev: introduce event driven programming

model")

Fixes 4f0804bbdfb9 ("eventdev: implement the northbound APIs")

I am seeing the following error due to this patch:
In file included from /root/tmp/dpdk-17.05-rc2/lib/librte_eventdev/rte_eventdev.c:62:0:
/root/tmp/dpdk-17.05-rc2/lib/librte_eventdev/rte_eventdev_pmd.h:54:24: fatal error: rte_ethdev.h: No such file or directory
#include <rte_ethdev.h>

It only happens when I compile with "-j", so it looks like dependencies have to be fixed?

Thanks,
Pablo

#23 lore raw

Re: [PATCH v2 02/13] eventdev: fix errors with strict compilation flags

Quoted 41 lines · Pablo

Hi Adrien,

Quoted 30 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Adrien Mazarguil
Sent: Tuesday, April 25, 2017 9:30 AM
To: [email protected]
Cc: Jerin Jacob
Subject: [dpdk-dev] [PATCH v2 02/13] eventdev: fix errors with strict compilation flags

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from build/include/rte_eventdev_pmd.h:55:0,

                  from /tmp/check-includes.sh.25816.c:1:

build/include/rte_eventdev.h:908:8: error: struct has no named members
[-Werror=pedantic]
[...]
In file included from /tmp/check-includes.sh.25816.c:1:0:
build/include/rte_eventdev_pmd.h:65:35: error: ISO C does not permit
named
variadic macros [-Werror=variadic-macros]
[...]

Also enabling RTE_LIBRTE_EVENTDEV_DEBUG causes redefinitions:

In file included from /tmp/check-includes.sh.18921.c:27:0:

    build/include/rte_eventdev_pmd.h:58:0: error:

"RTE_PMD_DEBUG_TRACE"
redefined [-Werror]
[...]

Quoted 8 lines

Rely on the rte_ethdev.h version instead.

Fixes 71f238432865 ("eventdev: introduce event driven programming

model")

Fixes 4f0804bbdfb9 ("eventdev: implement the northbound APIs")
Quoted 6 lines

I am seeing the following error due to this patch:
In file included from /root/tmp/dpdk-17.05-rc2/lib/librte_eventdev/rte_eventdev.c:62:0:
/root/tmp/dpdk-17.05-rc2/lib/librte_eventdev/rte_eventdev_pmd.h:54:24: fatal error: rte_ethdev.h: No such file or directory
#include <rte_ethdev.h>

It only happens when I compile with "-j", so it looks like dependencies have to be fixed?

You're right, actually rte_eventdev_pmd.h is not even supposed to have a dependency on rte_ethdev.h. The problem comes from RTE_FUNC_PTR_OR_ERR_RET() defined in rte_dev.h, itself relying on the RTE_PMD_DEBUG_TRACE() macro without any kind of dependency.

This makes no sense, RTE_PMD_DEBUG_TRACE() should be defined along with rte_pmd_debug_trace() in rte_dev.h. I'll move this fix to a separate commit to remove all duplicate definitions.

Signature · 2 lines
Adrien Mazarguil
6WIND
#24 lore raw

PATCH v2 3/13 latency: fix missing includes in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from build/include/rte_latencystats.h:43:0,

                  from /tmp/check-includes.sh.6580.c:1:

build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t' [...]
In file included from /tmp/check-includes.sh.6580.c:1:0:
build/include/rte_latencystats.h:66:19: error: expected declaration
specifiers or '...' before '*' token
[...]

Fixes 5cd3cac9ed22 ("latency: added new library for latency stats")
---
 lib/librte_latencystats/rte_latencystats.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_latencystats/rte_latencystats.h +2 -0
index 6efeaf4..d85cf3a 100644
@@ -40,7 +40,9 @@
  * library to provide application and flow based latency stats.
  */
 
+#include <stdint.h>
 #include <rte_metrics.h>
+#include <rte_mbuf.h>
 
 #ifdef __cplusplus
 extern "C" {
Signature · 1 line
2.1.4
#25 lore raw

PATCH v2 4/13 net: fix missing include in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.18889.c:1:0:
build/include/rte_net_crc.h:86:1: error: unknown type name 'uint32_t' [...]

Fixes 986ff526fb84 ("net: add CRC computation API")
---
 lib/librte_net/rte_net_crc.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_net/rte_net_crc.h +2 -0
index 76fd129..d22286c 100644
@@ -34,6 +34,8 @@
 #ifndef _RTE_NET_CRC_H_
 #define _RTE_NET_CRC_H_
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
Acked-by on v2 4/13
#26 lore raw

Re: [PATCH v2 04/13] net: fix missing include in exported header

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Tuesday, April 25, 2017 9:30 AM
To: [email protected]
Cc: Singh, Jasvinder <[email protected]>
Subject: [PATCH v2 04/13] net: fix missing include in exported header

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.18889.c:1:0:
build/include/rte_net_crc.h:86:1: error: unknown type name 'uint32_t' [...]

Fixes 986ff526fb84 ("net: add CRC computation API")

Thanks.

#27 lore raw

PATCH v2 5/13 vhost: fix errors with strict compilation flags

In reply to Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from /tmp/check-includes.sh.20132.c:1:0:
build/include/rte_vhost.h:73:30: error: ISO C forbids zero-size array
'regions' [-Werror=pedantic]
[...]

Also:

- Add C++ awareness to rte_vhost.h for consistency with rte_eth_vhost.h.
- Move Linux includes into C++ block to prevent linking issues with exported symbols.
- Update check-includes.sh following the removal of rte_virtio_net.h.

Finally, update check-includes.sh to ignore rte_vhost.h and rte_eth_vhost.h from now on since the Linux headers they depend on are not clean enough:

In file included from /usr/include/linux/vhost.h:17:0,

                  from build/include/rte_vhost.h:43,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:
 /usr/include/linux/virtio_ring.h: In function 'vring_init':
 /usr/include/linux/virtio_ring.h:146:16: error: pointer of type 'void *'
    used in arithmetic [-Werror=pointer-arith]
 [...]
 In file included from build/include/rte_vhost.h:43:0,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:

/usr/include/linux/vhost.h: At top level:
/usr/include/linux/vhost.h:73:3: error: ISO C99 doesn't support unnamed
structs/unions [-Werror=pedantic]
[...]

Fixes eb32247457fe ("vhost: export guest memory regions")
Fixes a798beb47c8e ("vhost: rename header file")
---
 devtools/check-includes.sh   |  4 +++-
 lib/librte_vhost/rte_vhost.h | 16 +++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)
devtools/check-includes.sh +3 -1
index d65adc6..c4ec73f 100755
@@ -109,10 +109,12 @@ include_dir=${1:-build/include}
 	'rte_byteorder_64.h' \
 	'generic/*' \
 	'exec-env/*' \
+	'rte_vhost.h' \
+	'rte_eth_vhost.h' \
 }
 : ${IGNORE_CXX= \
+	'rte_vhost.h' \
 	'rte_eth_vhost.h' \
-	'rte_virtio_net.h' \
 }
 
 temp_cc=/tmp/${0##*/}.$$.c
lib/librte_vhost/rte_vhost.h +13 -3
index 7a586e4..605e47c 100644
@@ -40,13 +40,19 @@
  */
 
 #include <stdint.h>
-#include <linux/vhost.h>
-#include <linux/virtio_ring.h>
 #include <sys/eventfd.h>
 
 #include <rte_memory.h>
 #include <rte_mempool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These are not C++-aware. */
+#include <linux/vhost.h>
+#include <linux/virtio_ring.h>
+
 #define RTE_VHOST_USER_CLIENT		(1ULL << 0)
 #define RTE_VHOST_USER_NO_RECONNECT	(1ULL << 1)
 #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY	(1ULL << 2)
@@ -70,7 +76,7 @@ struct rte_vhost_mem_region {
  */
 struct rte_vhost_memory {
 	uint32_t nregions;
-	struct rte_vhost_mem_region regions[0];
+	struct rte_vhost_mem_region regions[];
 };
 
 struct rte_vhost_vring {
@@ -426,4 +432,8 @@ int rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem);
 int rte_vhost_get_vhost_vring(int vid, uint16_t vring_idx,
 			      struct rte_vhost_vring *vring);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_VHOST_H_ */
Signature · 1 line
2.1.4
#28 lore raw

PATCH v2 6/13 mbuf: fix missing includes in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.681.c:1:0:
build/include/rte_mbuf_ptype.h:587:35: error: unknown type name 'uint32_t' [...]
build/include/rte_mbuf_ptype.h:662:51: error: unknown type name 'size_t' [...]

Fixes 288541c8ff9e ("mbuf: add functions to dump packet type")
---
 lib/librte_mbuf/rte_mbuf_ptype.h | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_mbuf/rte_mbuf_ptype.h +3 -0
index ff6de9d..a3269c4 100644
@@ -91,6 +91,9 @@
  * RTE_PTYPE_INNER_L4_UDP.
  */
 
+#include <stddef.h>
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
Acked-by on v2 6/13
#29 lore raw

Re: [PATCH v2 06/13] mbuf: fix missing includes in exported header

Quoted 8 lines · Adrien Mazarguil

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.681.c:1:0:
build/include/rte_mbuf_ptype.h:587:35: error: unknown type name 'uint32_t' [...]
build/include/rte_mbuf_ptype.h:662:51: error: unknown type name 'size_t' [...]

Quoted 5 lines
Fixes 288541c8ff9e ("mbuf: add functions to dump packet type")
#30 lore raw

PATCH v2 7/13 net/avp: fix errors in exported headers

In reply to Adrien Mazarguil

This commit addresses several errors related to missing includes such as:

In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_fifo.h:77:22: error: 'struct rte_avp_fifo' declared
inside parameter list [-Werror]
[...]
build/include/rte_avp_fifo.h: In function 'avp_fifo_init':
build/include/rte_avp_fifo.h:81:3: error: implicit declaration of function
'rte_panic' [-Werror=implicit-function-declaration]
[...]
build/include/rte_avp_fifo.h:83:6: error: dereferencing pointer to
incomplete type
[...]
build/include/rte_avp_fifo.h:109:2: error: implicit declaration of
function 'rte_wmb' [-Werror=implicit-function-declaration]
[...]
In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_common.h:104:2: error: unknown type name 'uint64_t' [...]
build/include/rte_avp_common.h:386:15: error: 'ETHER_ADDR_LEN' undeclared
here (not in a function)
[...]

It addresses errors with strict compilation flags:

In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_common.h:122:3: error: ISO C99 doesn't support
unnamed structs/unions [-Werror=pedantic]
[...]
build/include/rte_avp_common.h:136:17: error: ISO C forbids zero-size
array 'buffer' [-Werror=pedantic]
[...]

And also adds C++ awareness to both header files.

Fixes 8e680655e205 ("net/avp: add public header files")
---
 drivers/net/avp/rte_avp_common.h | 17 ++++++++++++++++-
 drivers/net/avp/rte_avp_fifo.h   | 12 ++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/net/avp/rte_avp_common.h +16 -1
index 31d763e..05093ad 100644
@@ -57,8 +57,18 @@
 #ifndef _RTE_AVP_COMMON_H_
 #define _RTE_AVP_COMMON_H_
 
+#include <stdint.h>
 #ifdef __KERNEL__
 #include <linux/if.h>
+#else
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_ether.h>
+#include <rte_atomic.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
 #endif
 
 /**
@@ -115,6 +125,7 @@ struct rte_avp_device_config {
  */
 struct rte_avp_request {
 	uint32_t req_id; /**< Request id */
+	RTE_STD_C11
 	union {
 		uint32_t new_mtu; /**< New MTU */
 		uint8_t if_up;	/**< 1: interface up, 0: interface down */
@@ -133,7 +144,7 @@ struct rte_avp_fifo {
 	volatile unsigned int read; /**< Next position to be read */
 	unsigned int len; /**< Circular buffer length */
 	unsigned int elem_size; /**< Pointer size - for 32/64 bit OS */
-	void *volatile buffer[0]; /**< The buffer contains mbuf pointers */
+	void *volatile buffer[]; /**< The buffer contains mbuf pointers */
 };
 
 
@@ -413,4 +424,8 @@ struct rte_avp_device_info {
 #define RTE_AVP_IOCTL_RELEASE _IOWR(0, 3, struct rte_avp_device_info)
 #define RTE_AVP_IOCTL_QUERY   _IOWR(0, 4, struct rte_avp_device_config)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_COMMON_H_ */
drivers/net/avp/rte_avp_fifo.h +12 -0
index 8262e4f..a0a37eb 100644
@@ -57,6 +57,12 @@
 #ifndef _RTE_AVP_FIFO_H_
 #define _RTE_AVP_FIFO_H_
 
+#include <rte_avp_common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __KERNEL__
 /* Write memory barrier for kernel compiles */
 #define AVP_WMB() smp_wmb()
@@ -70,6 +76,8 @@
 #endif
 
 #ifndef __KERNEL__
+#include <rte_debug.h>
+
 /**
  * Initializes the avp fifo structure
  */
@@ -154,4 +162,8 @@ avp_fifo_free_count(struct rte_avp_fifo *fifo)
 	return (fifo->read - fifo->write - 1) & (fifo->len - 1);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_FIFO_H_ */
Signature · 1 line
2.1.4
#31 lore raw

Re: [PATCH v2 07/13] net/avp: fix errors in exported headers

Quoted 3 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Tuesday, April 25, 2017 4:30 AM

<...>

drivers/net/avp/rte_avp_common.h line 68

Quoted 10 lines
drivers/net/avp/rte_avp_common.h +7 -0
+#include <stdint.h>
 #ifdef __KERNEL__
 #include <linux/if.h>
+#else
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_ether.h>
+#include <rte_atomic.h>
+#endif

I compiled this in our environment and found a couple of additional issues. I apologize... I should have done that on the first pass. It should actually look like this to handle both userspace and kernel compiles:

	#ifdef __KERNEL__
	#include <linux/if.h>
	#define RTE_STD_C11
	#else
	#include <stdint.h>
	#include <rte_common.h>
	#include <rte_memory.h>
	#include <rte_ether.h>
	#include <rte_atomic.h>
	#endif

1) stdint.h needs to be moved in to the #else, and
2) RTE_STD_C11 needs to be included in the #ifdef __KERNEL__.

<..>

drivers/net/avp/rte_avp_fifo.h line 60

Quoted 9 lines
drivers/net/avp/rte_avp_fifo.h +1 -0
index 8262e4f..a0a37eb 100644
@@ -57,6 +57,12 @@
 #ifndef _RTE_AVP_FIFO_H_
 #define _RTE_AVP_FIFO_H_
 
+#include <rte_avp_common.h>

Would you mind changing the brackets (<>) to quotes ("") since this is a local include file?

	#include "rte_avp_common.h"
#32 lore raw

Re: [PATCH v2 07/13] net/avp: fix errors in exported headers

Quoted 28 lines · Allain
Quoted 3 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Tuesday, April 25, 2017 4:30 AM

<...>

drivers/net/avp/rte_avp_common.h line 68

Quoted 10 lines
drivers/net/avp/rte_avp_common.h +7 -0
+#include <stdint.h>
 #ifdef __KERNEL__
 #include <linux/if.h>
+#else
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_ether.h>
+#include <rte_atomic.h>
+#endif

I compiled this in our environment and found a couple of additional issues. I apologize... I should have done that on the first pass. It should actually look like this to handle both userspace and kernel compiles:

	#ifdef __KERNEL__
	#include <linux/if.h>
	#define RTE_STD_C11
	#else
	#include <stdint.h>
	#include <rte_common.h>
	#include <rte_memory.h>
	#include <rte_ether.h>
	#include <rte_atomic.h>
	#endif
Quoted 1 line

1) stdint.h needs to be moved in to the #else, and

OK, will update.

Quoted 1 line

2) RTE_STD_C11 needs to be included in the #ifdef __KERNEL__.

Missed that one, however I suggest either:

#ifndef __KERNEL__ around RTE_STD_C11

or using __extension__ directly. Which do you prefer?

By the way, is the kernel module that depends on rte_avp_common.h available somewhere to validate compilation against it?

Quoted 9 lines

<..>

Quoted 8 lines
drivers/net/avp/rte_avp_fifo.h +0 -0
index 8262e4f..a0a37eb 100644
@@ -57,6 +57,12 @@
 #ifndef _RTE_AVP_FIFO_H_
 #define _RTE_AVP_FIFO_H_
 
Quoted 5 lines

drivers/net/avp/rte_avp_fifo.h line 60

Quoted 1 line
drivers/net/avp/rte_avp_fifo.h +1 -0
+#include <rte_avp_common.h>

Would you mind changing the brackets (<>) to quotes ("") since this is a local include file?

	#include "rte_avp_common.h"

I will update it.

Signature · 2 lines
Adrien Mazarguil
6WIND
#33 lore raw

Re: [PATCH v2 07/13] net/avp: fix errors in exported headers

Quoted 3 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Tuesday, April 25, 2017 8:50 AM

<...>

Quoted 7 lines
Quoted 1 line

2) RTE_STD_C11 needs to be included in the #ifdef __KERNEL__.

Missed that one, however I suggest either:

#ifndef __KERNEL__ around RTE_STD_C11

or using __extension__ directly. Which do you prefer?

I would prefer if it was done as it is done in rte_kni_common.h to provide consistency with other similar files. Like this:

	#ifdef __KERNEL__
	#include <linux/if.h>
	#define RTE_STD_C11
	#else
	#include <rte_common.h>
	#endif

...but if you disagree then I prefer the #ifndef __KERNEL__ option.

Quoted 3 lines

By the way, is the kernel module that depends on rte_avp_common.h available somewhere to validate compilation against it?

There is an older version of the module available on github, but it has not been updated since the AVP driver has been included in the DPDK. Since the AVP directory and files were significantly changed in order to meet the requirements of the DPDK it won't be much use to you. Until we can update it please make sure both Matt Peters and I are CC'd on the patch requests and we'll confirm compilation as quickly as possible.

Quoted 6 lines
Quoted 1 line

Would you mind changing the brackets (<>) to quotes ("") since this is a

local include file?

Quoted 2 lines
	#include "rte_avp_common.h"

I will update it.

Thank you.

#34 lore raw

Re: [PATCH v2 07/13] net/avp: fix errors in exported headers

Quoted 14 lines · Allain
Quoted 3 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Tuesday, April 25, 2017 8:50 AM

<...>

Quoted 7 lines
Quoted 1 line

2) RTE_STD_C11 needs to be included in the #ifdef __KERNEL__.

Missed that one, however I suggest either:

#ifndef __KERNEL__ around RTE_STD_C11

or using __extension__ directly. Which do you prefer?

I would prefer if it was done as it is done in rte_kni_common.h to provide consistency with other similar files. Like this:

Quoted 8 lines
	#ifdef __KERNEL__
	#include <linux/if.h>
	#define RTE_STD_C11
	#else
	#include <rte_common.h>
	#endif

...but if you disagree then I prefer the #ifndef __KERNEL__ option.

You're right in fact, I did not remember that was the method used for KNI. Let's keep your suggestion.

Quoted 8 lines
Quoted 3 lines

By the way, is the kernel module that depends on rte_avp_common.h available somewhere to validate compilation against it?

There is an older version of the module available on github, but it has not been updated since the AVP driver has been included in the DPDK. Since the AVP directory and files were significantly changed in order to meet the requirements of the DPDK it won't be much use to you. Until we can update it please make sure both Matt Peters and I are CC'd on the patch requests and we'll confirm compilation as quickly as possible.

Quoted 1 line
Quoted 1 line

Would you mind changing the brackets (<>) to quotes ("") since this is a

Quoted 8 lines
Quoted 5 lines

local include file?

Quoted 2 lines
	#include "rte_avp_common.h"

I will update it.

Thank you.

Can I add your acked-by line directly assuming all the above is done as described?

Signature · 2 lines
Adrien Mazarguil
6WIND
#35 lore raw

Re: [PATCH v2 07/13] net/avp: fix errors in exported headers

Quoted 3 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Tuesday, April 25, 2017 10:49 AM

<...>

Quoted 4 lines
Quoted 1 line

Thank you.

Can I add your acked-by line directly assuming all the above is done as described?

Yes.

#36 lore raw

PATCH v2 8/13 bitrate: fix errors in exported header

In reply to Adrien Mazarguil

This commit addresses the following error:

In file included from /tmp/check-includes.sh.28023.c:1:0:
build/include/rte_bitrate.h:82:2: error: unknown type name 'uint8_t' [...]

It also adds C++ awareness to rte_bitrate.h.

Fixes 2ad7ba9a6567 ("bitrate: add bitrate statistics library")
---
 lib/librte_bitratestats/rte_bitrate.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/librte_bitratestats/rte_bitrate.h +10 -0
index b9f11bd..15fc270 100644
@@ -34,6 +34,12 @@
 #ifndef _RTE_BITRATE_H_
 #define _RTE_BITRATE_H_
 
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  *  Bitrate statistics data structure.
  *  This data structure is intentionally opaque.
@@ -81,4 +87,8 @@ int rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data);
 int rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
 	uint8_t port_id);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_BITRATE_H_ */
Signature · 1 line
2.1.4
#37 lore raw

PATCH v2 9/13 efd: fix missing include in exported header

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from /tmp/check-includes.sh.8373.c:1:0:
build/include/rte_efd.h:133:9: error: unknown type name 'uint8_t' [...]

Fixes 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Cc Byron Marohn <[email protected]>
Cc Pablo de Lara Guarch <[email protected]>
---
 lib/librte_efd/rte_efd.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_efd/rte_efd.h +2 -0
index 6d31e18..1596863 100644
@@ -40,6 +40,8 @@
  * RTE EFD Table
  */
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
#38 lore raw

PATCH v2 10/13 metrics: fix errors in exported header

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from /tmp/check-includes.sh.21060.c:1:0:
build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t' [...]

It also adds C++ awareness to rte_metrics.h.

Fixes 349950ddb9c5 ("metrics: add information metrics library")
---
 lib/librte_metrics/rte_metrics.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/librte_metrics/rte_metrics.h +10 -0
index fd0154f..0fa3104 100644
@@ -52,6 +52,12 @@
 #ifndef _RTE_METRICS_H_
 #define _RTE_METRICS_H_
 
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Maximum length of metric name (including null-terminator) */
 #define RTE_METRICS_MAX_NAME_LEN 64
 
@@ -237,4 +243,8 @@ int rte_metrics_update_values(
 	const uint64_t *values,
 	uint32_t count);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
Signature · 1 line
2.1.4
#39 lore raw

PATCH v2 11/13 ethdev: fix C++ errors in flow API

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:
 build/include/rte_flow.h:428:2: error: expected primary-expression before
    '.' token

[...]
build/include/rte_flow.h:469:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 6de5c0f1302c ("ethdev: define default item masks in flow API")
---
 lib/librte_ether/rte_flow.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
lib/librte_ether/rte_flow.h +26 -0
index 7749491..bc7bc45 100644
@@ -314,9 +314,11 @@ struct rte_flow_item_any {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
+#ifndef __cplusplus
 static const struct rte_flow_item_any rte_flow_item_any_mask = {
 	.num = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VF
@@ -341,9 +343,11 @@ struct rte_flow_item_vf {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
 	.id = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_PORT
@@ -370,9 +374,11 @@ struct rte_flow_item_port {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT. */
+#ifndef __cplusplus
 static const struct rte_flow_item_port rte_flow_item_port_mask = {
 	.index = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_RAW
@@ -403,6 +409,7 @@ struct rte_flow_item_raw {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
+#ifndef __cplusplus
 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
 	.relative = 1,
 	.search = 1,
@@ -411,6 +418,7 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
 	.limit = 0xffff,
 	.length = 0xffff,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_ETH
@@ -424,11 +432,13 @@ struct rte_flow_item_eth {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
+#ifndef __cplusplus
 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
 	.dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.type = 0x0000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VLAN
@@ -444,10 +454,12 @@ struct rte_flow_item_vlan {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
 	.tpid = 0x0000,
 	.tci = 0xffff,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV4
@@ -461,12 +473,14 @@ struct rte_flow_item_ipv4 {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
 	.hdr = {
 		.src_addr = 0xffffffff,
 		.dst_addr = 0xffffffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV6.
@@ -480,6 +494,7 @@ struct rte_flow_item_ipv6 {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
 	.hdr = {
 		.src_addr =
@@ -490,6 +505,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
 			"\xff\xff\xff\xff\xff\xff\xff\xff",
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_ICMP.
@@ -501,12 +517,14 @@ struct rte_flow_item_icmp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
 	.hdr = {
 		.icmp_type = 0xff,
 		.icmp_code = 0xff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_UDP.
@@ -518,12 +536,14 @@ struct rte_flow_item_udp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_TCP.
@@ -535,12 +555,14 @@ struct rte_flow_item_tcp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_SCTP.
@@ -552,12 +574,14 @@ struct rte_flow_item_sctp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VXLAN.
@@ -572,9 +596,11 @@ struct rte_flow_item_vxlan {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
 	.vni = "\xff\xff\xff",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_E_TAG.
Signature · 1 line
2.1.4
Acked-by on v2 11/13
#40 lore raw

Re: [dpdk-stable] [PATCH v2 11/13] ethdev: fix C++ errors in flow API

Tuesday, April 25, 2017 11:30 AM, Adrien Mazarguil:

Quoted 24 lines

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:
 build/include/rte_flow.h:428:2: error: expected primary-expression before
    '.' token

[...]
build/include/rte_flow.h:469:1: sorry, unimplemented: non-trivial
designated initializers not supported [...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

Quoted 7 lines

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 6de5c0f1302c ("ethdev: define default item masks in flow API")
Quoted 181 lines
---
 lib/librte_ether/rte_flow.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
lib/librte_ether/rte_flow.h index renamed from lib/librte_ether/rte_flow.h +0 -0

7749491..bc7bc45 100644

lib/librte_ether/rte_flow.h +8 -0
@@ -314,9 +314,11 @@ struct rte_flow_item_any {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
+#ifndef __cplusplus
 static const struct rte_flow_item_any rte_flow_item_any_mask = {
 	.num = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VF
@@ -341,9 +343,11 @@ struct rte_flow_item_vf {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
 	.id = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_PORT
@@ -370,9 +374,11 @@ struct rte_flow_item_port {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT. */
+#ifndef __cplusplus
 static const struct rte_flow_item_port rte_flow_item_port_mask = {
 	.index = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_RAW
@@ -403,6 +409,7 @@ struct rte_flow_item_raw {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
+#ifndef __cplusplus
 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
 	.relative = 1,
 	.search = 1,
@@ -411,6 +418,7 @@ static const struct rte_flow_item_raw
 rte_flow_item_raw_mask = {
 	.limit = 0xffff,
 	.length = 0xffff,
 };
+#endif
 
 /**

* RTE_FLOW_ITEM_TYPE_ETH

lib/librte_ether/rte_flow.h +8 -0
@@ -424,11 +432,13 @@ struct rte_flow_item_eth {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
+#ifndef __cplusplus
 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
 	.dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.type = 0x0000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VLAN
@@ -444,10 +454,12 @@ struct rte_flow_item_vlan {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
 	.tpid = 0x0000,
 	.tci = 0xffff,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV4
@@ -461,12 +473,14 @@ struct rte_flow_item_ipv4 {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
 	.hdr = {
 		.src_addr = 0xffffffff,
 		.dst_addr = 0xffffffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV6.
@@ -480,6 +494,7 @@ struct rte_flow_item_ipv6 {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
 	.hdr = {
 		.src_addr =
@@ -490,6 +505,7 @@ static const struct rte_flow_item_ipv6
 rte_flow_item_ipv6_mask = {
 			"\xff\xff\xff\xff\xff\xff\xff\xff",
 	},
 };
+#endif
 
 /**

* RTE_FLOW_ITEM_TYPE_ICMP.

lib/librte_ether/rte_flow.h +10 -1
@@ -501,12 +517,14 @@ struct rte_flow_item_icmp {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
 	.hdr = {
 		.icmp_type = 0xff,
 		.icmp_code = 0xff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_UDP.
@@ -518,12 +536,14 @@ struct rte_flow_item_udp {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_TCP.
@@ -535,12 +555,14 @@ struct rte_flow_item_tcp {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_SCTP.
@@ -552,12 +574,14 @@ struct rte_flow_item_sctp {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VXLAN.
@@ -572,9 +596,11 @@ struct rte_flow_item_vxlan {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
 	.vni = "\xff\xff\xff",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_E_TAG.
--

2.1.4

#41 lore raw

PATCH v2 12/13 ethdev: fix C++ errors in flow API (MPLS, GRE)

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:

build/include/rte_flow.h:631:1: error: C99 designator 'label_tc_s' outside
aggregate initializer
[...]
build/include/rte_flow.h:631:1: error: initializer-string for array of
chars is too long [-fpermissive]
[...]
build/include/rte_flow.h:650:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 7cd048321d1d ("ethdev: add MPLS and GRE flow API items")
---
 lib/librte_ether/rte_flow.h | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_ether/rte_flow.h +4 -0
index bc7bc45..abd4c6a 100644
@@ -652,9 +652,11 @@ struct rte_flow_item_mpls {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
+#ifndef __cplusplus
 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
 	.label_tc_s = "\xff\xff\xf0",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_GRE.
@@ -671,9 +673,11 @@ struct rte_flow_item_gre {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
+#ifndef __cplusplus
 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
 	.protocol = 0xffff,
 };
+#endif
 
 /**
  * Matching pattern item definition.
Signature · 1 line
2.1.4
Acked-by on v2 12/13
#42 lore raw

Re: [PATCH v2 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE)

Tuesday, April 25, 2017 11:30 AM, Adrien Mazarguil:

Quoted 27 lines

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:

build/include/rte_flow.h:631:1: error: C99 designator 'label_tc_s' outside
aggregate initializer
[...]
build/include/rte_flow.h:631:1: error: initializer-string for array of
chars is too long [-fpermissive]
[...]
build/include/rte_flow.h:650:1: sorry, unimplemented: non-trivial
designated initializers not supported [...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

Quoted 7 lines

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 7cd048321d1d ("ethdev: add MPLS and GRE flow API items")
Quoted 32 lines
---
 lib/librte_ether/rte_flow.h | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_ether/rte_flow.h index renamed from lib/librte_ether/rte_flow.h +0 -0

bc7bc45..abd4c6a 100644

lib/librte_ether/rte_flow.h +4 -1
@@ -652,9 +652,11 @@ struct rte_flow_item_mpls {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
+#ifndef __cplusplus
 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
 	.label_tc_s = "\xff\xff\xf0",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_GRE.
@@ -671,9 +673,11 @@ struct rte_flow_item_gre {  };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
+#ifndef __cplusplus
 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
 	.protocol = 0xffff,
 };
+#endif
 
 /**
  * Matching pattern item definition.
--

2.1.4

#43 lore raw

PATCH v2 13/13 ethdev: fix incomplete items in flow API

In reply to Adrien Mazarguil

E-Tag and NVGRE pattern items have been added hastily without updating documentation nor testpmd.

This commit also adds default masks for these items based on the ixgbe implementation.

Fixes 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
---
 app/test-pmd/cmdline_flow.c                 | 46 ++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst          | 26 ++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  8 +++++
 lib/librte_ether/rte_flow.h                 | 21 +++++++++++
 4 files changed, 101 insertions(+)
app/test-pmd/cmdline_flow.c +46 -0
index 4e99f0f..0a40005 100644
@@ -159,6 +159,10 @@ enum index {
 	ITEM_SCTP_CKSUM,
 	ITEM_VXLAN,
 	ITEM_VXLAN_VNI,
+	ITEM_E_TAG,
+	ITEM_E_TAG_GRP_ECID_B,
+	ITEM_NVGRE,
+	ITEM_NVGRE_TNI,
 	ITEM_MPLS,
 	ITEM_MPLS_LABEL,
 	ITEM_GRE,
@@ -436,6 +440,8 @@ static const enum index next_item[] = {
 	ITEM_TCP,
 	ITEM_SCTP,
 	ITEM_VXLAN,
+	ITEM_E_TAG,
+	ITEM_NVGRE,
 	ITEM_MPLS,
 	ITEM_GRE,
 	ZERO,
@@ -544,6 +550,18 @@ static const enum index item_vxlan[] = {
 	ZERO,
 };
 
+static const enum index item_e_tag[] = {
+	ITEM_E_TAG_GRP_ECID_B,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_nvgre[] = {
+	ITEM_NVGRE_TNI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_mpls[] = {
 	ITEM_MPLS_LABEL,
 	ITEM_NEXT,
@@ -1297,6 +1315,34 @@ static const struct token token_list[] = {
 		.next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)),
 	},
+	[ITEM_E_TAG] = {
+		.name = "e_tag",
+		.help = "match E-Tag header",
+		.priv = PRIV_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
+		.next = NEXT(item_e_tag),
+		.call = parse_vc,
+	},
+	[ITEM_E_TAG_GRP_ECID_B] = {
+		.name = "grp_ecid_b",
+		.help = "GRP and E-CID base",
+		.next = NEXT(item_e_tag, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_e_tag,
+						  rsvd_grp_ecid_b,
+						  "\x3f\xff")),
+	},
+	[ITEM_NVGRE] = {
+		.name = "nvgre",
+		.help = "match NVGRE header",
+		.priv = PRIV_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
+		.next = NEXT(item_nvgre),
+		.call = parse_vc,
+	},
+	[ITEM_NVGRE_TNI] = {
+		.name = "tni",
+		.help = "virtual subnet ID",
+		.next = NEXT(item_nvgre, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_nvgre, tni)),
+	},
 	[ITEM_MPLS] = {
 		.name = "mpls",
 		.help = "match MPLS header",
doc/guides/prog_guide/rte_flow.rst +26 -0
index 9bca9ec..b587ba9 100644
@@ -863,6 +863,32 @@ Matches a VXLAN header (RFC 7348).
 - ``rsvd1``: reserved, normally 0x00.
 - Default ``mask`` matches VNI only.
 
+Item: ``E_TAG``
+^^^^^^^^^^^^^^^
+
+Matches an IEEE 802.1BR E-Tag header.
+
+- ``tpid``: tag protocol identifier (0x893F)
+- ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b),
+  E-DEI (1b), ingress E-CID base (12b).
+- ``rsvd_grp_ecid_b``: reserved (2b), GRP (2b), E-CID base (12b).
+- ``in_ecid_e``: ingress E-CID ext.
+- ``ecid_e``: E-CID ext.
+- Default ``mask`` simultaneously matches GRP and E-CID base.
+
+Item: ``NVGRE``
+^^^^^^^^^^^^^^^
+
+Matches a NVGRE header (RFC 7637).
+
+- ``c_k_s_rsvd0_ver``: checksum (1b), undefined (1b), key bit (1b),
+  sequence number (1b), reserved 0 (9b), version (3b). This field must have
+  value 0x2000 according to RFC 7637.
+- ``protocol``: protocol type (0x6558).
+- ``tni``: virtual subnet ID.
+- ``flow_id``: flow ID.
+- Default ``mask`` matches TNI only.
+
 Item: ``MPLS``
 ^^^^^^^^^^^^^^
 
doc/guides/testpmd_app_ug/testpmd_funcs.rst +8 -0
index ddd1d92..1aea101 100644
@@ -2537,6 +2537,14 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``vni {unsigned}``: VXLAN identifier.
 
+- ``e_tag``: match IEEE 802.1BR E-Tag header.
+
+  - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
+
+- ``nvgre``: match NVGRE header.
+
+  - ``tni {unsigned}``: virtual subnet ID.
+
 - ``mpls``: match MPLS header.
 
   - ``label {unsigned}``: MPLS label.
lib/librte_ether/rte_flow.h +21 -0
index abd4c6a..c47edbc 100644
@@ -49,6 +49,7 @@
 #include <rte_sctp.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_byteorder.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -620,6 +621,19 @@ struct rte_flow_item_e_tag {
 	uint8_t ecid_e; /**< E-CID ext. */
 };
 
+/** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
+#ifndef __cplusplus
+static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	.rsvd_grp_ecid_b = 0x3fff,
+#elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	.rsvd_grp_ecid_b = 0xff3f,
+#else
+#error Unsupported endianness.
+#endif
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_NVGRE.
  *
@@ -638,6 +652,13 @@ struct rte_flow_item_nvgre {
 	uint8_t flow_id; /**< Flow ID. */
 };
 
+/** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
+	.tni = "\xff\xff\xff",
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_MPLS.
  *
Signature · 1 line
2.1.4
#44 lore raw
In reply to Adrien Mazarguil
Quoted 8 lines · Adrien Mazarguil

This series addresses the remaining issues seen by check-includes.sh in exported headers. Most of them may cause compilation errors in user applications:

- Dependencies on missing includes.
- Non-standard C/C++ constructs usage without associated safeties.
- Missing C++ awareness blocks.

Quoted 6 lines

It also addresses the incomplete implementation of E-Tag and NVGRE flow API pattern items.

Changes in v2:

- Fixed (still) incomplete E-tag and NVGRE flow API documentation.

Hi Adrien,

Thanks for fixing this.

Quoted 5 lines

- Renamed E-Tag item parameter "ecid_b" to "grp_ecid_b" in testpmd, to reflect that both fields are set at once.
- Fixed remaining compilation issue with RTE_LIBRTE_EVENTDEV_DEBUG.
- Fixed avp include to avoid kernel module compilation issue pointed out by Allain.

#45 lore raw

v3 cover Fixes for exported headers

In reply to Adrien Mazarguil

This series addresses the remaining issues seen by check-includes.sh in exported headers. Most of them may cause compilation errors in user applications:

- Dependencies on missing includes.
- Non-standard C/C++ constructs usage without associated safeties.
- Missing C++ awareness blocks.

It also addresses the incomplete implementation of E-Tag and NVGRE flow API pattern items.

Changes in v2:

- Fixed (still) incomplete E-tag and NVGRE flow API documentation.
- Renamed E-Tag item parameter "ecid_b" to "grp_ecid_b" in testpmd, to reflect that both fields are set at once.
- Fixed remaining compilation issue with RTE_LIBRTE_EVENTDEV_DEBUG.
- Fixed avp include to avoid kernel module compilation issue pointed out by Allain.

Changes in v3:

- Reverted regression introduced in v2 related to RTE_PMD_DEBUG_TRACE() and RTE_LIBRTE_EVENTDEV_DEBUG.
- Addressed original issue with RTE_PMD_DEBUG_TRACE() in a new separate commit.
- Fixed remaining regression on the kernel side of avp.

Adrien Mazarguil (14):
crypto/scheduler: fix missing includes
eventdev: fix errors with strict compilation flags
latency: fix missing includes in exported header
net: fix missing include in exported header
vhost: fix errors with strict compilation flags
mbuf: fix missing includes in exported header net/avp: fix errors in exported headers
bitrate: fix errors in exported header
efd: fix missing include in exported header
metrics: fix errors in exported header
ethdev: fix C++ errors in flow API
ethdev: fix C++ errors in flow API (MPLS, GRE)
ethdev: fix incomplete items in flow API
eal: fix debug macro redefinition

 app/test-pmd/cmdline_flow.c                     | 46 ++++++++++++++++++
 devtools/check-includes.sh                      |  4 +-
 doc/guides/prog_guide/rte_flow.rst              | 26 ++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst     |  8 +++
 .../crypto/scheduler/rte_cryptodev_scheduler.h  |  1 +
 .../rte_cryptodev_scheduler_operations.h        |  1 +
 drivers/net/avp/rte_avp_common.h                | 18 ++++++-
 drivers/net/avp/rte_avp_fifo.h                  | 12 +++++
 lib/librte_bitratestats/rte_bitrate.h           | 10 ++++
 lib/librte_cryptodev/rte_cryptodev_pmd.h        |  8 ---
 lib/librte_eal/common/include/rte_dev.h         | 14 ++++++
 lib/librte_efd/rte_efd.h                        |  2 +
 lib/librte_ether/rte_ethdev.h                   |  9 ----
 lib/librte_ether/rte_flow.h                     | 51 ++++++++++++++++++++
 lib/librte_eventdev/rte_eventdev.h              |  3 +-
 lib/librte_eventdev/rte_eventdev_pmd.h          | 23 ++++-----
 lib/librte_latencystats/rte_latencystats.h      |  2 +
 lib/librte_mbuf/rte_mbuf_ptype.h                |  3 ++
 lib/librte_metrics/rte_metrics.h                | 10 ++++
 lib/librte_net/rte_net_crc.h                    |  2 +
 lib/librte_vhost/rte_vhost.h                    | 16 ++++--
 21 files changed, 231 insertions(+), 38 deletions(-)
Signature · 1 line
2.1.4
#46 lore raw

PATCH v3 1/14 crypto/scheduler: fix missing includes

This commit addresses the following compilation errors:

In file included from build/include/rte_cryptodev_scheduler.h:37:0,

                  from /tmp/check-includes.sh.5355.c:1:
 build/include/rte_cryptodev_scheduler_operations.h:43:30: error: unknown
    type name 'uint8_t' struct rte_cryptodev *dev, uint8_t slave_id);

[...]

Fixes 097ab0bac017 ("crypto/scheduler: add API")
---
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h            | 1 +
 drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h | 1 +
 2 files changed, 2 insertions(+)
drivers/crypto/scheduler/rte_cryptodev_scheduler.h +1 -0
index 7a34d0a..2ba6e47 100644
@@ -46,6 +46,7 @@
  * operation: round robin, packet-size based, and fail-over.
  */
 
+#include <stdint.h>
 #include "rte_cryptodev_scheduler_operations.h"
 
 #ifdef __cplusplus
drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h +1 -0
index 42fe9e6..719165c 100644
@@ -34,6 +34,7 @@
 #ifndef _RTE_CRYPTO_SCHEDULER_OPERATIONS_H
 #define _RTE_CRYPTO_SCHEDULER_OPERATIONS_H
 
+#include <rte_cryptodev.h>
 
 #ifdef __cplusplus
 extern "C" {
Signature · 1 line
2.1.4
#47 lore raw

PATCH v3 2/14 eventdev: fix errors with strict compilation flags

In reply to Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from build/include/rte_eventdev_pmd.h:55:0,

                  from /tmp/check-includes.sh.25816.c:1:

build/include/rte_eventdev.h:908:8: error: struct has no named members
[-Werror=pedantic]
[...]
In file included from /tmp/check-includes.sh.25816.c:1:0:
build/include/rte_eventdev_pmd.h:65:35: error: ISO C does not permit named
variadic macros [-Werror=variadic-macros]
[...]

Fixes 71f238432865 ("eventdev: introduce event driven programming model")
Fixes 4f0804bbdfb9 ("eventdev: implement the northbound APIs")
Cc Jerin Jacob <[email protected]>
Cc "De Lara Guarch, Pablo" <[email protected]>
---
 lib/librte_eventdev/rte_eventdev.h     |  3 +--
 lib/librte_eventdev/rte_eventdev_pmd.h | 16 +++++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)
lib/librte_eventdev/rte_eventdev.h +1 -2
index b8ed6ef..20e7293 100644
@@ -905,9 +905,9 @@ rte_event_dev_close(uint8_t dev_id);
  * The generic *rte_event* structure to hold the event attributes
  * for dequeue and enqueue operation
  */
+RTE_STD_C11
 struct rte_event {
 	/** WORD0 */
-	RTE_STD_C11
 	union {
 		uint64_t event;
 		/** Event attributes for dequeue or enqueue operation */
@@ -967,7 +967,6 @@ struct rte_event {
 		};
 	};
 	/** WORD1 */
-	RTE_STD_C11
 	union {
 		uint64_t u64;
 		/**< Opaque 64-bit value */
lib/librte_eventdev/rte_eventdev_pmd.h +9 -7
index a73dc91..988018f 100644
@@ -62,16 +62,18 @@ extern "C" {
 #endif
 
 /* Logging Macros */
-#define RTE_EDEV_LOG_ERR(fmt, args...) \
-	RTE_LOG(ERR, EVENTDEV, "%s() line %u: " fmt "\n",  \
-			__func__, __LINE__, ## args)
+#define RTE_EDEV_LOG_ERR(...) \
+	RTE_LOG(ERR, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-#define RTE_EDEV_LOG_DEBUG(fmt, args...) \
-	RTE_LOG(DEBUG, EVENTDEV, "%s() line %u: " fmt "\n",  \
-			__func__, __LINE__, ## args)
+#define RTE_EDEV_LOG_DEBUG(...) \
+	RTE_LOG(DEBUG, EVENTDEV, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
 #else
-#define RTE_EDEV_LOG_DEBUG(fmt, args...) (void)0
+#define RTE_EDEV_LOG_DEBUG(...) (void)0
 #endif
 
 /* Macros to check for valid device */
Signature · 1 line
2.1.4
Acked-by on v3 2/14
#48 lore raw

Re: [PATCH v3 02/14] eventdev: fix errors with strict compilation flags

-----Original Message-----

Quoted 21 lines

Date: Wed, 26 Apr 2017 14:07:10 +0200
From: Adrien Mazarguil <[email protected]>
To: [email protected]
Cc: Jerin Jacob <[email protected]>, "De Lara Guarch, Pablo"
<[email protected]>
Subject: [PATCH v3 02/14] eventdev: fix errors with strict compilation flags
X-Mailer: git-send-email 2.1.4

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from build/include/rte_eventdev_pmd.h:55:0,

                  from /tmp/check-includes.sh.25816.c:1:

build/include/rte_eventdev.h:908:8: error: struct has no named members
[-Werror=pedantic]
[...]
In file included from /tmp/check-includes.sh.25816.c:1:0:
build/include/rte_eventdev_pmd.h:65:35: error: ISO C does not permit named
variadic macros [-Werror=variadic-macros]
[...]

Quoted 6 lines
Fixes 71f238432865 ("eventdev: introduce event driven programming model")
Fixes 4f0804bbdfb9 ("eventdev: implement the northbound APIs")
Cc Jerin Jacob <[email protected]>
Cc "De Lara Guarch, Pablo" <[email protected]>
#49 lore raw

PATCH v3 3/14 latency: fix missing includes in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from build/include/rte_latencystats.h:43:0,

                  from /tmp/check-includes.sh.6580.c:1:

build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t' [...]
In file included from /tmp/check-includes.sh.6580.c:1:0:
build/include/rte_latencystats.h:66:19: error: expected declaration
specifiers or '...' before '*' token
[...]

Fixes 5cd3cac9ed22 ("latency: added new library for latency stats")
---
 lib/librte_latencystats/rte_latencystats.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_latencystats/rte_latencystats.h +2 -0
index 6efeaf4..d85cf3a 100644
@@ -40,7 +40,9 @@
  * library to provide application and flow based latency stats.
  */
 
+#include <stdint.h>
 #include <rte_metrics.h>
+#include <rte_mbuf.h>
 
 #ifdef __cplusplus
 extern "C" {
Signature · 1 line
2.1.4
#50 lore raw

PATCH v3 4/14 net: fix missing include in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.18889.c:1:0:
build/include/rte_net_crc.h:86:1: error: unknown type name 'uint32_t' [...]

Fixes 986ff526fb84 ("net: add CRC computation API")
---
 lib/librte_net/rte_net_crc.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_net/rte_net_crc.h +2 -0
index 76fd129..d22286c 100644
@@ -34,6 +34,8 @@
 #ifndef _RTE_NET_CRC_H_
 #define _RTE_NET_CRC_H_
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
#51 lore raw

PATCH v3 5/14 vhost: fix errors with strict compilation flags

In reply to Adrien Mazarguil

Exported headers must allow compilation with the strictest flags. This commit addresses the following errors:

In file included from /tmp/check-includes.sh.20132.c:1:0:
build/include/rte_vhost.h:73:30: error: ISO C forbids zero-size array
'regions' [-Werror=pedantic]
[...]

Also:

- Add C++ awareness to rte_vhost.h for consistency with rte_eth_vhost.h.
- Move Linux includes into C++ block to prevent linking issues with exported symbols.
- Update check-includes.sh following the removal of rte_virtio_net.h.

Finally, update check-includes.sh to ignore rte_vhost.h and rte_eth_vhost.h from now on since the Linux headers they depend on are not clean enough:

In file included from /usr/include/linux/vhost.h:17:0,

                  from build/include/rte_vhost.h:43,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:
 /usr/include/linux/virtio_ring.h: In function 'vring_init':
 /usr/include/linux/virtio_ring.h:146:16: error: pointer of type 'void *'
    used in arithmetic [-Werror=pointer-arith]
 [...]
 In file included from build/include/rte_vhost.h:43:0,
                  from build/include/rte_eth_vhost.h:44,
                  from /tmp/check-includes.sh.20132.c:1:

/usr/include/linux/vhost.h: At top level:
/usr/include/linux/vhost.h:73:3: error: ISO C99 doesn't support unnamed
structs/unions [-Werror=pedantic]
[...]

Fixes eb32247457fe ("vhost: export guest memory regions")
Fixes a798beb47c8e ("vhost: rename header file")
---
 devtools/check-includes.sh   |  4 +++-
 lib/librte_vhost/rte_vhost.h | 16 +++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)
devtools/check-includes.sh +3 -1
index d65adc6..c4ec73f 100755
@@ -109,10 +109,12 @@ include_dir=${1:-build/include}
 	'rte_byteorder_64.h' \
 	'generic/*' \
 	'exec-env/*' \
+	'rte_vhost.h' \
+	'rte_eth_vhost.h' \
 }
 : ${IGNORE_CXX= \
+	'rte_vhost.h' \
 	'rte_eth_vhost.h' \
-	'rte_virtio_net.h' \
 }
 
 temp_cc=/tmp/${0##*/}.$$.c
lib/librte_vhost/rte_vhost.h +13 -3
index 7a586e4..605e47c 100644
@@ -40,13 +40,19 @@
  */
 
 #include <stdint.h>
-#include <linux/vhost.h>
-#include <linux/virtio_ring.h>
 #include <sys/eventfd.h>
 
 #include <rte_memory.h>
 #include <rte_mempool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These are not C++-aware. */
+#include <linux/vhost.h>
+#include <linux/virtio_ring.h>
+
 #define RTE_VHOST_USER_CLIENT		(1ULL << 0)
 #define RTE_VHOST_USER_NO_RECONNECT	(1ULL << 1)
 #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY	(1ULL << 2)
@@ -70,7 +76,7 @@ struct rte_vhost_mem_region {
  */
 struct rte_vhost_memory {
 	uint32_t nregions;
-	struct rte_vhost_mem_region regions[0];
+	struct rte_vhost_mem_region regions[];
 };
 
 struct rte_vhost_vring {
@@ -426,4 +432,8 @@ int rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem);
 int rte_vhost_get_vhost_vring(int vid, uint16_t vring_idx,
 			      struct rte_vhost_vring *vring);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_VHOST_H_ */
Signature · 1 line
2.1.4
#52 lore raw

PATCH v3 6/14 mbuf: fix missing includes in exported header

In reply to Adrien Mazarguil

This commit addresses the following errors:

In file included from /tmp/check-includes.sh.681.c:1:0:
build/include/rte_mbuf_ptype.h:587:35: error: unknown type name 'uint32_t' [...]
build/include/rte_mbuf_ptype.h:662:51: error: unknown type name 'size_t' [...]

Fixes 288541c8ff9e ("mbuf: add functions to dump packet type")
---
 lib/librte_mbuf/rte_mbuf_ptype.h | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_mbuf/rte_mbuf_ptype.h +3 -0
index ff6de9d..a3269c4 100644
@@ -91,6 +91,9 @@
  * RTE_PTYPE_INNER_L4_UDP.
  */
 
+#include <stddef.h>
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
#53 lore raw

PATCH v3 7/14 net/avp: fix errors in exported headers

In reply to Adrien Mazarguil

This commit addresses several errors related to missing includes such as:

In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_fifo.h:77:22: error: 'struct rte_avp_fifo' declared
inside parameter list [-Werror]
[...]
build/include/rte_avp_fifo.h: In function 'avp_fifo_init':
build/include/rte_avp_fifo.h:81:3: error: implicit declaration of function
'rte_panic' [-Werror=implicit-function-declaration]
[...]
build/include/rte_avp_fifo.h:83:6: error: dereferencing pointer to
incomplete type
[...]
build/include/rte_avp_fifo.h:109:2: error: implicit declaration of
function 'rte_wmb' [-Werror=implicit-function-declaration]
[...]
In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_common.h:104:2: error: unknown type name 'uint64_t' [...]
build/include/rte_avp_common.h:386:15: error: 'ETHER_ADDR_LEN' undeclared
here (not in a function)
[...]

It addresses errors with strict compilation flags:

In file included from /tmp/check-includes.sh.15315.c:1:0:
build/include/rte_avp_common.h:122:3: error: ISO C99 doesn't support
unnamed structs/unions [-Werror=pedantic]
[...]
build/include/rte_avp_common.h:136:17: error: ISO C forbids zero-size
array 'buffer' [-Werror=pedantic]
[...]

And also adds C++ awareness to both header files.

Fixes 8e680655e205 ("net/avp: add public header files")
---
 drivers/net/avp/rte_avp_common.h | 18 +++++++++++++++++-
 drivers/net/avp/rte_avp_fifo.h   | 12 ++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)
drivers/net/avp/rte_avp_common.h +17 -1
index 31d763e..488d721 100644
@@ -59,6 +59,17 @@
 
 #ifdef __KERNEL__
 #include <linux/if.h>
+#define RTE_STD_C11
+#else
+#include <stdint.h>
+#include <rte_common.h>
+#include <rte_memory.h>
+#include <rte_ether.h>
+#include <rte_atomic.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
 #endif
 
 /**
@@ -115,6 +126,7 @@ struct rte_avp_device_config {
  */
 struct rte_avp_request {
 	uint32_t req_id; /**< Request id */
+	RTE_STD_C11
 	union {
 		uint32_t new_mtu; /**< New MTU */
 		uint8_t if_up;	/**< 1: interface up, 0: interface down */
@@ -133,7 +145,7 @@ struct rte_avp_fifo {
 	volatile unsigned int read; /**< Next position to be read */
 	unsigned int len; /**< Circular buffer length */
 	unsigned int elem_size; /**< Pointer size - for 32/64 bit OS */
-	void *volatile buffer[0]; /**< The buffer contains mbuf pointers */
+	void *volatile buffer[]; /**< The buffer contains mbuf pointers */
 };
 
 
@@ -413,4 +425,8 @@ struct rte_avp_device_info {
 #define RTE_AVP_IOCTL_RELEASE _IOWR(0, 3, struct rte_avp_device_info)
 #define RTE_AVP_IOCTL_QUERY   _IOWR(0, 4, struct rte_avp_device_config)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_COMMON_H_ */
drivers/net/avp/rte_avp_fifo.h +12 -0
index 8262e4f..803eb80 100644
@@ -57,6 +57,12 @@
 #ifndef _RTE_AVP_FIFO_H_
 #define _RTE_AVP_FIFO_H_
 
+#include "rte_avp_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __KERNEL__
 /* Write memory barrier for kernel compiles */
 #define AVP_WMB() smp_wmb()
@@ -70,6 +76,8 @@
 #endif
 
 #ifndef __KERNEL__
+#include <rte_debug.h>
+
 /**
  * Initializes the avp fifo structure
  */
@@ -154,4 +162,8 @@ avp_fifo_free_count(struct rte_avp_fifo *fifo)
 	return (fifo->read - fifo->write - 1) & (fifo->len - 1);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_AVP_FIFO_H_ */
Signature · 1 line
2.1.4
#54 lore raw

PATCH v3 8/14 bitrate: fix errors in exported header

In reply to Adrien Mazarguil

This commit addresses the following error:

In file included from /tmp/check-includes.sh.28023.c:1:0:
build/include/rte_bitrate.h:82:2: error: unknown type name 'uint8_t' [...]

It also adds C++ awareness to rte_bitrate.h.

Fixes 2ad7ba9a6567 ("bitrate: add bitrate statistics library")
---
 lib/librte_bitratestats/rte_bitrate.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/librte_bitratestats/rte_bitrate.h +10 -0
index b9f11bd..15fc270 100644
@@ -34,6 +34,12 @@
 #ifndef _RTE_BITRATE_H_
 #define _RTE_BITRATE_H_
 
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  *  Bitrate statistics data structure.
  *  This data structure is intentionally opaque.
@@ -81,4 +87,8 @@ int rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data);
 int rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
 	uint8_t port_id);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_BITRATE_H_ */
Signature · 1 line
2.1.4
#56 lore raw

PATCH v3 9/14 efd: fix missing include in exported header

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from /tmp/check-includes.sh.8373.c:1:0:
build/include/rte_efd.h:133:9: error: unknown type name 'uint8_t' [...]

Fixes 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Cc Byron Marohn <[email protected]>
Cc Pablo de Lara Guarch <[email protected]>
---
 lib/librte_efd/rte_efd.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_efd/rte_efd.h +2 -0
index 6d31e18..1596863 100644
@@ -40,6 +40,8 @@
  * RTE EFD Table
  */
 
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.1.4
Acked-by on v3 9/14
#57 lore raw

Re: [PATCH v3 09/14] efd: fix missing include in exported header

Quoted 15 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Wednesday, April 26, 2017 1:07 PM
To: [email protected]
Cc: [email protected]; Marohn, Byron; De Lara Guarch, Pablo
Subject: [PATCH v3 09/14] efd: fix missing include in exported header

This commit addresses the following compilation errors:

In file included from /tmp/check-includes.sh.8373.c:1:0:
build/include/rte_efd.h:133:9: error: unknown type name 'uint8_t' [...]

Quoted 6 lines
Fixes 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Cc Byron Marohn <[email protected]>
Cc Pablo de Lara Guarch <[email protected]>
#58 lore raw

PATCH v3 10/14 metrics: fix errors in exported header

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from /tmp/check-includes.sh.21060.c:1:0:
build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t' [...]

It also adds C++ awareness to rte_metrics.h.

Fixes 349950ddb9c5 ("metrics: add information metrics library")
---
 lib/librte_metrics/rte_metrics.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/librte_metrics/rte_metrics.h +10 -0
index fd0154f..0fa3104 100644
@@ -52,6 +52,12 @@
 #ifndef _RTE_METRICS_H_
 #define _RTE_METRICS_H_
 
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Maximum length of metric name (including null-terminator) */
 #define RTE_METRICS_MAX_NAME_LEN 64
 
@@ -237,4 +243,8 @@ int rte_metrics_update_values(
 	const uint64_t *values,
 	uint32_t count);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
Signature · 1 line
2.1.4
#60 lore raw

PATCH v3 11/14 ethdev: fix C++ errors in flow API

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:
 build/include/rte_flow.h:428:2: error: expected primary-expression before
    '.' token

[...]
build/include/rte_flow.h:469:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 6de5c0f1302c ("ethdev: define default item masks in flow API")
---
 lib/librte_ether/rte_flow.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
lib/librte_ether/rte_flow.h +26 -0
index 7749491..bc7bc45 100644
@@ -314,9 +314,11 @@ struct rte_flow_item_any {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
+#ifndef __cplusplus
 static const struct rte_flow_item_any rte_flow_item_any_mask = {
 	.num = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VF
@@ -341,9 +343,11 @@ struct rte_flow_item_vf {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
 	.id = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_PORT
@@ -370,9 +374,11 @@ struct rte_flow_item_port {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_PORT. */
+#ifndef __cplusplus
 static const struct rte_flow_item_port rte_flow_item_port_mask = {
 	.index = 0x00000000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_RAW
@@ -403,6 +409,7 @@ struct rte_flow_item_raw {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
+#ifndef __cplusplus
 static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
 	.relative = 1,
 	.search = 1,
@@ -411,6 +418,7 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
 	.limit = 0xffff,
 	.length = 0xffff,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_ETH
@@ -424,11 +432,13 @@ struct rte_flow_item_eth {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
+#ifndef __cplusplus
 static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
 	.dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.src.addr_bytes = "\xff\xff\xff\xff\xff\xff",
 	.type = 0x0000,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VLAN
@@ -444,10 +454,12 @@ struct rte_flow_item_vlan {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
 	.tpid = 0x0000,
 	.tci = 0xffff,
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV4
@@ -461,12 +473,14 @@ struct rte_flow_item_ipv4 {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
 	.hdr = {
 		.src_addr = 0xffffffff,
 		.dst_addr = 0xffffffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_IPV6.
@@ -480,6 +494,7 @@ struct rte_flow_item_ipv6 {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
+#ifndef __cplusplus
 static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
 	.hdr = {
 		.src_addr =
@@ -490,6 +505,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
 			"\xff\xff\xff\xff\xff\xff\xff\xff",
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_ICMP.
@@ -501,12 +517,14 @@ struct rte_flow_item_icmp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
 	.hdr = {
 		.icmp_type = 0xff,
 		.icmp_code = 0xff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_UDP.
@@ -518,12 +536,14 @@ struct rte_flow_item_udp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_TCP.
@@ -535,12 +555,14 @@ struct rte_flow_item_tcp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_SCTP.
@@ -552,12 +574,14 @@ struct rte_flow_item_sctp {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
+#ifndef __cplusplus
 static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
 	.hdr = {
 		.src_port = 0xffff,
 		.dst_port = 0xffff,
 	},
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_VXLAN.
@@ -572,9 +596,11 @@ struct rte_flow_item_vxlan {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
+#ifndef __cplusplus
 static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
 	.vni = "\xff\xff\xff",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_E_TAG.
Signature · 1 line
2.1.4
#61 lore raw

PATCH v3 12/14 ethdev: fix C++ errors in flow API (MPLS, GRE)

In reply to Adrien Mazarguil

This commit addresses the following compilation errors:

In file included from build/include/rte_flow_driver.h:50:0,

                  from /tmp/check-includes.sh.1397.cc:1:

build/include/rte_flow.h:631:1: error: C99 designator 'label_tc_s' outside
aggregate initializer
[...]
build/include/rte_flow.h:631:1: error: initializer-string for array of
chars is too long [-fpermissive]
[...]
build/include/rte_flow.h:650:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]

C++ does not support the C99-style designated initializers used in this file for the default item masks. While the resulting symbols are primarily useful to PMDs (written in C), they are exposed as part of the public API for documentation purposes and to assist application writers.

Considering that:

- using pre-C99 initialization style for compatibility with C++ would render them difficult to understand (all struct members must be initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time

This commit hides these symbols from C++ applications. Specific C++ initializers will be added later if necessary.

Fixes 7cd048321d1d ("ethdev: add MPLS and GRE flow API items")
---
 lib/librte_ether/rte_flow.h | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_ether/rte_flow.h +4 -0
index bc7bc45..abd4c6a 100644
@@ -652,9 +652,11 @@ struct rte_flow_item_mpls {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
+#ifndef __cplusplus
 static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
 	.label_tc_s = "\xff\xff\xf0",
 };
+#endif
 
 /**
  * RTE_FLOW_ITEM_TYPE_GRE.
@@ -671,9 +673,11 @@ struct rte_flow_item_gre {
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
+#ifndef __cplusplus
 static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
 	.protocol = 0xffff,
 };
+#endif
 
 /**
  * Matching pattern item definition.
Signature · 1 line
2.1.4
#62 lore raw

PATCH v3 13/14 ethdev: fix incomplete items in flow API

In reply to Adrien Mazarguil

E-Tag and NVGRE pattern items have been added hastily without updating documentation nor testpmd.

This commit also adds default masks for these items based on the ixgbe implementation.

Fixes 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
---
 app/test-pmd/cmdline_flow.c                 | 46 ++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst          | 26 ++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  8 +++++
 lib/librte_ether/rte_flow.h                 | 21 +++++++++++
 4 files changed, 101 insertions(+)
app/test-pmd/cmdline_flow.c +46 -0
index 4e99f0f..0a40005 100644
@@ -159,6 +159,10 @@ enum index {
 	ITEM_SCTP_CKSUM,
 	ITEM_VXLAN,
 	ITEM_VXLAN_VNI,
+	ITEM_E_TAG,
+	ITEM_E_TAG_GRP_ECID_B,
+	ITEM_NVGRE,
+	ITEM_NVGRE_TNI,
 	ITEM_MPLS,
 	ITEM_MPLS_LABEL,
 	ITEM_GRE,
@@ -436,6 +440,8 @@ static const enum index next_item[] = {
 	ITEM_TCP,
 	ITEM_SCTP,
 	ITEM_VXLAN,
+	ITEM_E_TAG,
+	ITEM_NVGRE,
 	ITEM_MPLS,
 	ITEM_GRE,
 	ZERO,
@@ -544,6 +550,18 @@ static const enum index item_vxlan[] = {
 	ZERO,
 };
 
+static const enum index item_e_tag[] = {
+	ITEM_E_TAG_GRP_ECID_B,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_nvgre[] = {
+	ITEM_NVGRE_TNI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_mpls[] = {
 	ITEM_MPLS_LABEL,
 	ITEM_NEXT,
@@ -1297,6 +1315,34 @@ static const struct token token_list[] = {
 		.next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)),
 	},
+	[ITEM_E_TAG] = {
+		.name = "e_tag",
+		.help = "match E-Tag header",
+		.priv = PRIV_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
+		.next = NEXT(item_e_tag),
+		.call = parse_vc,
+	},
+	[ITEM_E_TAG_GRP_ECID_B] = {
+		.name = "grp_ecid_b",
+		.help = "GRP and E-CID base",
+		.next = NEXT(item_e_tag, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_e_tag,
+						  rsvd_grp_ecid_b,
+						  "\x3f\xff")),
+	},
+	[ITEM_NVGRE] = {
+		.name = "nvgre",
+		.help = "match NVGRE header",
+		.priv = PRIV_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
+		.next = NEXT(item_nvgre),
+		.call = parse_vc,
+	},
+	[ITEM_NVGRE_TNI] = {
+		.name = "tni",
+		.help = "virtual subnet ID",
+		.next = NEXT(item_nvgre, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_nvgre, tni)),
+	},
 	[ITEM_MPLS] = {
 		.name = "mpls",
 		.help = "match MPLS header",
doc/guides/prog_guide/rte_flow.rst +26 -0
index 9bca9ec..b587ba9 100644
@@ -863,6 +863,32 @@ Matches a VXLAN header (RFC 7348).
 - ``rsvd1``: reserved, normally 0x00.
 - Default ``mask`` matches VNI only.
 
+Item: ``E_TAG``
+^^^^^^^^^^^^^^^
+
+Matches an IEEE 802.1BR E-Tag header.
+
+- ``tpid``: tag protocol identifier (0x893F)
+- ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b),
+  E-DEI (1b), ingress E-CID base (12b).
+- ``rsvd_grp_ecid_b``: reserved (2b), GRP (2b), E-CID base (12b).
+- ``in_ecid_e``: ingress E-CID ext.
+- ``ecid_e``: E-CID ext.
+- Default ``mask`` simultaneously matches GRP and E-CID base.
+
+Item: ``NVGRE``
+^^^^^^^^^^^^^^^
+
+Matches a NVGRE header (RFC 7637).
+
+- ``c_k_s_rsvd0_ver``: checksum (1b), undefined (1b), key bit (1b),
+  sequence number (1b), reserved 0 (9b), version (3b). This field must have
+  value 0x2000 according to RFC 7637.
+- ``protocol``: protocol type (0x6558).
+- ``tni``: virtual subnet ID.
+- ``flow_id``: flow ID.
+- Default ``mask`` matches TNI only.
+
 Item: ``MPLS``
 ^^^^^^^^^^^^^^
 
doc/guides/testpmd_app_ug/testpmd_funcs.rst +8 -0
index ddd1d92..1aea101 100644
@@ -2537,6 +2537,14 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``vni {unsigned}``: VXLAN identifier.
 
+- ``e_tag``: match IEEE 802.1BR E-Tag header.
+
+  - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
+
+- ``nvgre``: match NVGRE header.
+
+  - ``tni {unsigned}``: virtual subnet ID.
+
 - ``mpls``: match MPLS header.
 
   - ``label {unsigned}``: MPLS label.
lib/librte_ether/rte_flow.h +21 -0
index abd4c6a..c47edbc 100644
@@ -49,6 +49,7 @@
 #include <rte_sctp.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_byteorder.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -620,6 +621,19 @@ struct rte_flow_item_e_tag {
 	uint8_t ecid_e; /**< E-CID ext. */
 };
 
+/** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
+#ifndef __cplusplus
+static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	.rsvd_grp_ecid_b = 0x3fff,
+#elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	.rsvd_grp_ecid_b = 0xff3f,
+#else
+#error Unsupported endianness.
+#endif
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_NVGRE.
  *
@@ -638,6 +652,13 @@ struct rte_flow_item_nvgre {
 	uint8_t flow_id; /**< Flow ID. */
 };
 
+/** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
+	.tni = "\xff\xff\xff",
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_MPLS.
  *
Signature · 1 line
2.1.4
Acked-by on v3 13/14
#63 lore raw

Re: [PATCH v3 13/14] ethdev: fix incomplete items in flow API

Hi,

Quoted 13 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Wednesday, April 26, 2017 8:07 PM
To: [email protected]
Cc: [email protected]; Zhao1, Wei; Lu, Wenzhuo
Subject: [PATCH v3 13/14] ethdev: fix incomplete items in flow API

E-Tag and NVGRE pattern items have been added hastily without updating documentation nor testpmd.

This commit also adds default masks for these items based on the ixgbe implementation.

Quoted 6 lines
Fixes 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")

Thanks for this patch :)

#64 lore raw

PATCH v3 14/14 eal: fix debug macro redefinition

In reply to Adrien Mazarguil

The RTE_FUNC_*_RET() and RTE_PROC_*_RET() macro definitions in rte_dev.h require RTE_PMD_DEBUG_TRACE(). This macro is defined as needed by users of rte_dev.h since its value depends on their own debug settings.

It may be defined multiple times as a result when including files from various components simultaneously. Worse, these redefinitions may be inconsistent. This causes the following compilation errors:

In file included from /tmp/check-includes.sh.13890.c:27:0:

    build/include/rte_eventdev_pmd.h:58:0: error: "RTE_PMD_DEBUG_TRACE"
    redefined [-Werror]

[...]
In file included from build/include/rte_ethdev_pci.h:39:0,
from /tmp/check-includes.sh.13890.c:13:
build/include/rte_ethdev.h:1042:0: note: this is the location of the previous definition
[...]
In file included from /tmp/check-includes.sh.13890.c:83:0:
build/include/rte_cryptodev_pmd.h:65:0: error: "RTE_PMD_DEBUG_TRACE" redefined [-Werror]
[...]
In file included from /tmp/check-includes.sh.13890.c:27:0:
build/include/rte_eventdev_pmd.h:58:0: note: this is the location of the previous definition
[...]

This commit moves the RTE_PMD_DEBUG_TRACE() definition to rte_dev.h where it is enabled consistently depending on global configuration settings and removes redundant definitions.

Also when disabled, RTE_PMD_DEBUG_TRACE() is now defined as (void)0 to avoid empty statements warnings if used outside { } blocks.

Fixes b974e4a40cb5 ("ethdev: make error checking macros public")
Cc Thomas Monjalon <[email protected]>
Cc Declan Doherty <[email protected]>
Cc Jerin Jacob <[email protected]>
---
 lib/librte_cryptodev/rte_cryptodev_pmd.h |  8 --------
 lib/librte_eal/common/include/rte_dev.h  | 14 ++++++++++++++
 lib/librte_ether/rte_ethdev.h            |  9 ---------
 lib/librte_eventdev/rte_eventdev_pmd.h   |  7 -------
 4 files changed, 14 insertions(+), 24 deletions(-)
lib/librte_cryptodev/rte_cryptodev_pmd.h +0 -8
index 356b9dc..17ef37c 100644
@@ -57,14 +57,6 @@ extern "C" {
 #include "rte_crypto.h"
 #include "rte_cryptodev.h"
 
-
-#ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
 struct rte_cryptodev_session {
 	RTE_STD_C11
 	struct {
lib/librte_eal/common/include/rte_dev.h +14 -0
index 67c2b0c..d18e6b8 100644
@@ -49,6 +49,7 @@ extern "C" {
 #include <stdio.h>
 #include <sys/queue.h>
 
+#include <rte_config.h>
 #include <rte_log.h>
 
 __attribute__((format(printf, 2, 0)))
@@ -70,6 +71,19 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
 	rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
 }
 
+/*
+ * Enable RTE_PMD_DEBUG_TRACE() when at least one component relying on the
+ * RTE_*_RET() macros defined below is compiled in debug mode.
+ */
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || \
+	defined(RTE_LIBRTE_CRYPTODEV_DEBUG) || \
+	defined(RTE_LIBRTE_EVENTDEV_DEBUG)
+#define RTE_PMD_DEBUG_TRACE(...) \
+	rte_pmd_debug_trace(__func__, __VA_ARGS__)
+#else
+#define RTE_PMD_DEBUG_TRACE(...) (void)0
+#endif
+
 /* Macros for checking for restricting functions to primary instance only */
 #define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
lib/librte_ether/rte_ethdev.h +0 -9
index e0f7ee5..5f1d663 100644
@@ -1034,15 +1034,6 @@ struct rte_eth_dev_callback;
 /** @internal Structure to keep track of registered callbacks */
 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
 
-
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
-
 /* Macros to check for valid port */
 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
 	if (!rte_eth_dev_is_valid_port(port_id)) { \
lib/librte_eventdev/rte_eventdev_pmd.h +0 -7
index 988018f..4005b3c 100644
@@ -54,13 +54,6 @@ extern "C" {
 
 #include "rte_eventdev.h"
 
-#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
 /* Logging Macros */
 #define RTE_EDEV_LOG_ERR(...) \
 	RTE_LOG(ERR, EVENTDEV, \
Signature · 1 line
2.1.4
#65 lore raw
In reply to Adrien Mazarguil

26/04/2017 14:07, Adrien Mazarguil:

Quoted 10 lines

This series addresses the remaining issues seen by check-includes.sh in exported headers. Most of them may cause compilation errors in user applications:

- Dependencies on missing includes.
- Non-standard C/C++ constructs usage without associated safeties.
- Missing C++ awareness blocks.

It also addresses the incomplete implementation of E-Tag and NVGRE flow API pattern items.

Applied, thanks