patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] examples/bpf: fix compilation issue
@ 2019-07-30 10:19 Konstantin Ananyev
  2019-07-31  3:16 ` [dpdk-stable] [dpdk-dev] " Varghese, Vipin
  0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Ananyev @ 2019-07-30 10:19 UTC (permalink / raw)
  To: dev; +Cc: Konstantin Ananyev, stable

Example BPF programs t1.c, t2.c, t3.c in folder examples/bpf are
failing to compile with latest dpdk.org master.
The reason is changes in some core DPDK header files, that causes
now inclusion of x86 specific headers.
To overcome the issue, minimize inclusion of DPDK header files
into BPF source code.

Bugzilla ID: 321

Fixes: 9dfc06c26a8b ("test/bpf: add samples")
Cc: stable@dpdk.org

Reported-by: Michel Machado <michel@digirati.com.br>
Suggested-by: Michel Machado <michel@digirati.com.br>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 examples/bpf/mbuf.h | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/examples/bpf/mbuf.h b/examples/bpf/mbuf.h
index b623d8694..e41c3d26e 100644
--- a/examples/bpf/mbuf.h
+++ b/examples/bpf/mbuf.h
@@ -13,7 +13,6 @@
 
 #include <stdint.h>
 #include <rte_common.h>
-#include <rte_memory.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -364,6 +363,23 @@ typedef struct {
 	volatile int16_t cnt; /**< An internal counter value. */
 } rte_atomic16_t;
 
+#define RTE_CACHE_LINE_MIN_SIZE 64      /**< Minimum Cache line size. */
+
+/**
+ * Force minimum cache line alignment.
+ */
+#define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
+
+/**
+ * IO virtual address type.
+ * When the physical addressing mode (IOVA as PA) is in use,
+ * the translation from an IO virtual address (IOVA) to a physical address
+ * is a direct mapping, i.e. the same value.
+ * Otherwise, in virtual mode (IOVA as VA), an IOMMU may do the translation.
+ */
+typedef uint64_t rte_iova_t;
+#define RTE_BAD_IOVA ((rte_iova_t)-1)
+
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -377,7 +393,11 @@ struct rte_mbuf {
 	 * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
 	 * working on vector drivers easier.
 	 */
-	phys_addr_t buf_physaddr __rte_aligned(sizeof(phys_addr_t));
+	RTE_STD_C11
+	union {
+		rte_iova_t buf_iova;
+		rte_iova_t buf_physaddr; /**< deprecated */
+	} __rte_aligned(sizeof(rte_iova_t));
 
 	/* next 8 bytes are initialised on RX descriptor rearm */
 	MARKER64 rearm_data;
-- 
2.17.1


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/bpf: fix compilation issue
  2019-07-30 10:19 [dpdk-stable] [PATCH] examples/bpf: fix compilation issue Konstantin Ananyev
@ 2019-07-31  3:16 ` Varghese, Vipin
  2019-07-31  7:04   ` Ananyev, Konstantin
  0 siblings, 1 reply; 5+ messages in thread
From: Varghese, Vipin @ 2019-07-31  3:16 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev; +Cc: Ananyev, Konstantin, stable

snipped

> Example BPF programs t1.c, t2.c, t3.c in folder examples/bpf are failing to
> compile with latest dpdk.org master.

As a note, the file t3.c is one which fails to get compiled.

> The reason is changes in some core DPDK header files, that causes now inclusion
> of x86 specific headers.

snipped


> 
>  #include <stdint.h>
>  #include <rte_common.h>
> -#include <rte_memory.h>
> 
>  #ifdef __cplusplus
>  extern "C" {
> @@ -364,6 +363,23 @@ typedef struct {
>  	volatile int16_t cnt; /**< An internal counter value. */  } rte_atomic16_t;
> 
> +#define RTE_CACHE_LINE_MIN_SIZE 64      /**< Minimum Cache line size. */

The definition for RTE_CACHE_LINE_MIN_SIZE is present in ` rte_config.h`. Using the same did not cause compilation issues. Is there specific reason not to use the same?

Snipped

The code is tested and verified with clang6.0 and clang8.0 on Ubuntu 18.04.2 LTS.

Tested-by: Vipin Varghese <vipin.varghese@intel.com>


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/bpf: fix compilation issue
  2019-07-31  3:16 ` [dpdk-stable] [dpdk-dev] " Varghese, Vipin
@ 2019-07-31  7:04   ` Ananyev, Konstantin
  2019-07-31  8:20     ` Varghese, Vipin
  0 siblings, 1 reply; 5+ messages in thread
From: Ananyev, Konstantin @ 2019-07-31  7:04 UTC (permalink / raw)
  To: Varghese, Vipin, dev; +Cc: stable


> 
> > Example BPF programs t1.c, t2.c, t3.c in folder examples/bpf are failing to
> > compile with latest dpdk.org master.
> 
> As a note, the file t3.c is one which fails to get compiled.

t2.c also uses rte_mbuf, so same story  for both. 

> 
> > The reason is changes in some core DPDK header files, that causes now inclusion
> > of x86 specific headers.
> 
> snipped
> 
> 
> >
> >  #include <stdint.h>
> >  #include <rte_common.h>
> > -#include <rte_memory.h>
> >
> >  #ifdef __cplusplus
> >  extern "C" {
> > @@ -364,6 +363,23 @@ typedef struct {
> >  	volatile int16_t cnt; /**< An internal counter value. */  } rte_atomic16_t;
> >
> > +#define RTE_CACHE_LINE_MIN_SIZE 64      /**< Minimum Cache line size. */
> 
> The definition for RTE_CACHE_LINE_MIN_SIZE is present in ` rte_config.h`.

I believe it is not:
$ find lib config -type f | xargs grep CACHE_LINE_MIN_SIZE
lib/librte_eal/linux/eal/include/rte_kni_common.h:#define RTE_CACHE_LINE_MIN_SIZE 64
lib/librte_eal/linux/eal/include/rte_kni_common.h:      char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
lib/librte_eal/common/include/rte_memory.h:#define RTE_CACHE_LINE_MIN_SIZE 64  /**< Minimum Cache line size. */
lib/librte_eal/common/include/rte_memory.h:#define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)

Konstantin

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/bpf: fix compilation issue
  2019-07-31  7:04   ` Ananyev, Konstantin
@ 2019-07-31  8:20     ` Varghese, Vipin
  2019-07-31  8:22       ` Ananyev, Konstantin
  0 siblings, 1 reply; 5+ messages in thread
From: Varghese, Vipin @ 2019-07-31  8:20 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev; +Cc: stable

Snipped

> > > Example BPF programs t1.c, t2.c, t3.c in folder examples/bpf are
> > > failing to compile with latest dpdk.org master.
> >
> > As a note, the file t3.c is one which fails to get compiled.
> 
> t2.c also uses rte_mbuf, so same story  for both.

Thank you. So, the rewrite will be ' Example BPF programs t2.c, and t3.c in folder examples/bpf are failing to compile with latest dpdk.org master.'

> 
> >
> > > The reason is changes in some core DPDK header files, that causes
> > > now inclusion of x86 specific headers.
> >
> > snipped
> >
> >
> > >
> > >  #include <stdint.h>
> > >  #include <rte_common.h>
> > > -#include <rte_memory.h>
> > >
> > >  #ifdef __cplusplus
> > >  extern "C" {
> > > @@ -364,6 +363,23 @@ typedef struct {
> > >  	volatile int16_t cnt; /**< An internal counter value. */  }
> > > rte_atomic16_t;
> > >
> > > +#define RTE_CACHE_LINE_MIN_SIZE 64      /**< Minimum Cache line size.
> */
> >
> > The definition for RTE_CACHE_LINE_MIN_SIZE is present in ` rte_config.h`.
> 
> I believe it is not:
> $ find lib config -type f | xargs grep CACHE_LINE_MIN_SIZE
> lib/librte_eal/linux/eal/include/rte_kni_common.h:#define
> RTE_CACHE_LINE_MIN_SIZE 64
> lib/librte_eal/linux/eal/include/rte_kni_common.h:      char pad3[8]
> __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
> lib/librte_eal/common/include/rte_memory.h:#define
> RTE_CACHE_LINE_MIN_SIZE 64  /**< Minimum Cache line size. */
> lib/librte_eal/common/include/rte_memory.h:#define
> __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
> 
> Konstantin

Thanks. So, is not the best approach to place RTE_CACHE_LINE_MIN_SIZE in rte_config.h to prevent multiple definition (rte_kni_common.h, rte_memory.h and examples/bpf/mbuf.h)?

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/bpf: fix compilation issue
  2019-07-31  8:20     ` Varghese, Vipin
@ 2019-07-31  8:22       ` Ananyev, Konstantin
  0 siblings, 0 replies; 5+ messages in thread
From: Ananyev, Konstantin @ 2019-07-31  8:22 UTC (permalink / raw)
  To: Varghese, Vipin, dev; +Cc: stable



> -----Original Message-----
> From: Varghese, Vipin
> Sent: Wednesday, July 31, 2019 9:20 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] examples/bpf: fix compilation issue
> 
> Snipped
> 
> > > > Example BPF programs t1.c, t2.c, t3.c in folder examples/bpf are
> > > > failing to compile with latest dpdk.org master.
> > >
> > > As a note, the file t3.c is one which fails to get compiled.
> >
> > t2.c also uses rte_mbuf, so same story  for both.
> 
> Thank you. So, the rewrite will be ' Example BPF programs t2.c, and t3.c in folder examples/bpf are failing to compile with latest dpdk.org
> master.'
> 
> >
> > >
> > > > The reason is changes in some core DPDK header files, that causes
> > > > now inclusion of x86 specific headers.
> > >
> > > snipped
> > >
> > >
> > > >
> > > >  #include <stdint.h>
> > > >  #include <rte_common.h>
> > > > -#include <rte_memory.h>
> > > >
> > > >  #ifdef __cplusplus
> > > >  extern "C" {
> > > > @@ -364,6 +363,23 @@ typedef struct {
> > > >  	volatile int16_t cnt; /**< An internal counter value. */  }
> > > > rte_atomic16_t;
> > > >
> > > > +#define RTE_CACHE_LINE_MIN_SIZE 64      /**< Minimum Cache line size.
> > */
> > >
> > > The definition for RTE_CACHE_LINE_MIN_SIZE is present in ` rte_config.h`.
> >
> > I believe it is not:
> > $ find lib config -type f | xargs grep CACHE_LINE_MIN_SIZE
> > lib/librte_eal/linux/eal/include/rte_kni_common.h:#define
> > RTE_CACHE_LINE_MIN_SIZE 64
> > lib/librte_eal/linux/eal/include/rte_kni_common.h:      char pad3[8]
> > __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
> > lib/librte_eal/common/include/rte_memory.h:#define
> > RTE_CACHE_LINE_MIN_SIZE 64  /**< Minimum Cache line size. */
> > lib/librte_eal/common/include/rte_memory.h:#define
> > __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
> >
> > Konstantin
> 
> Thanks. So, is not the best approach to place RTE_CACHE_LINE_MIN_SIZE in rte_config.h to prevent multiple definition
> (rte_kni_common.h, rte_memory.h and examples/bpf/mbuf.h)?

Probably, but I don't want to touch rte_common.h in RC4.
Konstantin



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

end of thread, other threads:[~2019-07-31  8:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 10:19 [dpdk-stable] [PATCH] examples/bpf: fix compilation issue Konstantin Ananyev
2019-07-31  3:16 ` [dpdk-stable] [dpdk-dev] " Varghese, Vipin
2019-07-31  7:04   ` Ananyev, Konstantin
2019-07-31  8:20     ` Varghese, Vipin
2019-07-31  8:22       ` Ananyev, Konstantin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).