Skip to contentSkip to conversation

examples/distributor: Fix compile issue

PATCH Superseded Michael Qiu 4 participants 12 messages Nov 26, 2015 – Nov 27, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 examples/distributor: Fix compile issue

examples/distributor/main.c(338): error #167:
argument of type "struct rte_mbuf *"
is incompatible with parameter of type "const char *"
_mm_prefetch(bufs[0], 0);

The first param of _mm_prefetch should be "const char *" and need convert "struct rte_mbuf *" to "const void *".

---
 examples/distributor/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/distributor/main.c +4 -4
index 972bddb..a4d8e34 100644
@@ -335,13 +335,13 @@ lcore_tx(struct rte_ring *in_r)
 
 			/* for traffic we receive, queue it up for transmit */
 			uint16_t i;
-			_mm_prefetch(bufs[0], 0);
-			_mm_prefetch(bufs[1], 0);
-			_mm_prefetch(bufs[2], 0);
+			_mm_prefetch((const void *)bufs[0], 0);
+			_mm_prefetch((const void *)bufs[1], 0);
+			_mm_prefetch((const void *)bufs[2], 0);
 			for (i = 0; i < nb_rx; i++) {
 				struct output_buffer *outbuf;
 				uint8_t outp;
-				_mm_prefetch(bufs[i + 3], 0);
+				_mm_prefetch((const void *)bufs[i + 3], 0);
 				/*
 				 * workers should update in_port to hold the
 				 * output port value
Signature · 1 line
1.9.3
#1 lore raw

PATCH 2/2 Fix compile issue in i686 platform

In i686 platform, long is 32bit, so XXX_CYCLECOUNTER_MASK need define as 'ULL'

---
 drivers/net/e1000/igb_ethdev.c   | 2 +-
 drivers/net/i40e/i40e_ethdev.c   | 2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/e1000/igb_ethdev.c +1 -1
index 31452ae..518b6c9 100644
@@ -78,7 +78,7 @@
 #define IGB_8_BIT_MASK   UINT8_MAX
 
 /* Additional timesync values. */
-#define E1000_CYCLECOUNTER_MASK      0xffffffffffffffff
+#define E1000_CYCLECOUNTER_MASK      0xffffffffffffffffULL
 #define E1000_ETQF_FILTER_1588       3
 #define IGB_82576_TSYNC_SHIFT        16
 #define E1000_INCPERIOD_82576        (1 << E1000_TIMINCA_16NS_SHIFT)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 13ab81a..5cd6e88 100644
@@ -131,7 +131,7 @@
 #define I40E_PTP_1GB_INCVAL      0x2000000000ULL
 #define I40E_PRTTSYN_TSYNENA     0x80000000
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
-#define I40E_CYCLECOUNTER_MASK   0xffffffffffffffff
+#define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
 #define I40E_MAX_PERCENT            100
 #define I40E_DEFAULT_DCB_APP_NUM    1
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index 49f2410..808ac69 100644
@@ -136,7 +136,7 @@
 #define IXGBE_INCVAL_SHIFT_82599 7
 #define IXGBE_INCPER_SHIFT_82599 24
 
-#define IXGBE_CYCLECOUNTER_MASK   0xffffffffffffffff
+#define IXGBE_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
 static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
Signature · 1 line
1.9.3
#2 lore raw

Re: [PATCH 2/2] Fix compile issue in i686 platform

2015-11-26 09:35, Michael Qiu:

Quoted 4 lines

In i686 platform, long is 32bit, so XXX_CYCLECOUNTER_MASK need define as 'ULL'

This patch is correct but the description is not exact:
I have no issue with my i686 compiler.
For future reference, please could you be more precise
about the reproduction environment? Is it related to a specific compiler?

We also need to add these lines:

Fixes 9c857bf6be87 ("igb: support ieee1588 functions for device time")
Fixes 1c4445e1f28e ("ixgbe: support ieee1588 functions for device time")
Fixes f3a4e40eca0c ("i40e: support ieee1588 functions for device time")
#3 lore raw

Re: [PATCH 2/2] Fix compile issue in i686 platform

Quoted 9 lines · Thomas Monjalon

2015-11-26 09:35, Michael Qiu:

Quoted 4 lines

In i686 platform, long is 32bit, so XXX_CYCLECOUNTER_MASK need define as 'ULL'

This patch is correct but the description is not exact:
I have no issue with my i686 compiler.
For future reference, please could you be more precise
about the reproduction environment? Is it related to a specific compiler?

OK, I will be for careful about the compile and os next time.

Quoted 4 lines

We also need to add these lines:

Fixes 9c857bf6be87 ("igb: support ieee1588 functions for device time")
Fixes 1c4445e1f28e ("ixgbe: support ieee1588 functions for device time")
Fixes f3a4e40eca0c ("i40e: support ieee1588 functions for device time")

So I will repost the patch set.

Thanks,
Michael

#5 lore raw
In reply to Michael Qiu

2015-11-26 09:35, Michael Qiu:

Quoted 7 lines

examples/distributor/main.c(338): error #167:
argument of type "struct rte_mbuf *"
is incompatible with parameter of type "const char *"
_mm_prefetch(bufs[0], 0);

The first param of _mm_prefetch should be "const char *" and need convert "struct rte_mbuf *" to "const void *".

[...]

examples/distributor/main.c lcore_tx(struct rte_ring *in_r) · line 340

Quoted 6 lines
examples/distributor/main.c +3 -3
-			_mm_prefetch(bufs[0], 0);
-			_mm_prefetch(bufs[1], 0);
-			_mm_prefetch(bufs[2], 0);
+			_mm_prefetch((const void *)bufs[0], 0);
+			_mm_prefetch((const void *)bufs[1], 0);
+			_mm_prefetch((const void *)bufs[2], 0);

With clang:
error: cast from 'const void *' to 'void *' drops const qualifier

#6 lore raw
In reply to Michael Qiu

Acked and verified.

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Thursday, November 26, 2015 9:35 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/2] examples/distributor: Fix compile issue

examples/distributor/main.c(338): error #167:
argument of type "struct rte_mbuf *"
is incompatible with parameter of type "const char *"
_mm_prefetch(bufs[0], 0);

The first param of _mm_prefetch should be "const char *" and need convert "struct rte_mbuf *" to "const void *".

---
 examples/distributor/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/distributor/main.c +4 -4
@@ -335,13 +335,13 @@ lcore_tx(struct rte_ring *in_r)
 
 			/* for traffic we receive, queue it up for transmit */
 			uint16_t i;
-			_mm_prefetch(bufs[0], 0);
-			_mm_prefetch(bufs[1], 0);
-			_mm_prefetch(bufs[2], 0);
+			_mm_prefetch((const void *)bufs[0], 0);
+			_mm_prefetch((const void *)bufs[1], 0);
+			_mm_prefetch((const void *)bufs[2], 0);
 			for (i = 0; i < nb_rx; i++) {
 				struct output_buffer *outbuf;
 				uint8_t outp;
-				_mm_prefetch(bufs[i + 3], 0);
+				_mm_prefetch((const void *)bufs[i + 3], 0);
 				/*
 				 * workers should update in_port to hold the
 				 * output port value

--
1.9.3

#7 lore raw

PATCH v2 1/2 examples/distributor: Fix compile issue

In reply to Michael Qiu

examples/distributor/main.c(338): error #167:
argument of type "struct rte_mbuf *"
is incompatible with parameter of type "const char *"
_mm_prefetch(bufs[0], 0);

The first param pass to _mm_prefetch is wrong,
need convert "struct rte_mbuf *" to "void *".

Fixes 07db4a975094 ("examples/distributor: new sample app")

---
v2 --> v1:
convert "const void *" to "void *" to avoid CLANG issue. add "Fixes" line in commit log

 examples/distributor/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
examples/distributor/main.c +4 -4
index 972bddb..a4d8e34 100644
@@ -335,13 +335,13 @@ lcore_tx(struct rte_ring *in_r)
 
 			/* for traffic we receive, queue it up for transmit */
 			uint16_t i;
-			_mm_prefetch(bufs[0], 0);
-			_mm_prefetch(bufs[1], 0);
-			_mm_prefetch(bufs[2], 0);
+			_mm_prefetch((void *)bufs[0], 0);
+			_mm_prefetch((void *)bufs[1], 0);
+			_mm_prefetch((void *)bufs[2], 0);
 			for (i = 0; i < nb_rx; i++) {
 				struct output_buffer *outbuf;
 				uint8_t outp;
-				_mm_prefetch(bufs[i + 3], 0);
+				_mm_prefetch((void *)bufs[i + 3], 0);
 				/*
 				 * workers should update in_port to hold the
 				 * output port value
Signature · 1 line
1.9.3
#8 lore raw

PATCH v2 2/2 Fix compile issue in i686 platform

In i686 platform, long is 32bit, so XXX_CYCLECOUNTER_MASK need define as 'ULL'

Fixes 9c857bf6be87 ("igb: support ieee1588 functions for device time")
Fixes 1c4445e1f28e ("ixgbe: support ieee1588 functions for device time")
Fixes f3a4e40eca0c ("i40e: support ieee1588 functions for device time")

---
v2 --> v1:
add "Fixes" line in commit log

 drivers/net/e1000/igb_ethdev.c   | 2 +-
 drivers/net/i40e/i40e_ethdev.c   | 2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/e1000/igb_ethdev.c +1 -1
index 31452ae..518b6c9 100644
@@ -78,7 +78,7 @@
 #define IGB_8_BIT_MASK   UINT8_MAX
 
 /* Additional timesync values. */
-#define E1000_CYCLECOUNTER_MASK      0xffffffffffffffff
+#define E1000_CYCLECOUNTER_MASK      0xffffffffffffffffULL
 #define E1000_ETQF_FILTER_1588       3
 #define IGB_82576_TSYNC_SHIFT        16
 #define E1000_INCPERIOD_82576        (1 << E1000_TIMINCA_16NS_SHIFT)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 13ab81a..5cd6e88 100644
@@ -131,7 +131,7 @@
 #define I40E_PTP_1GB_INCVAL      0x2000000000ULL
 #define I40E_PRTTSYN_TSYNENA     0x80000000
 #define I40E_PRTTSYN_TSYNTYPE    0x0e000000
-#define I40E_CYCLECOUNTER_MASK   0xffffffffffffffff
+#define I40E_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
 #define I40E_MAX_PERCENT            100
 #define I40E_DEFAULT_DCB_APP_NUM    1
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index 49f2410..808ac69 100644
@@ -136,7 +136,7 @@
 #define IXGBE_INCVAL_SHIFT_82599 7
 #define IXGBE_INCPER_SHIFT_82599 24
 
-#define IXGBE_CYCLECOUNTER_MASK   0xffffffffffffffff
+#define IXGBE_CYCLECOUNTER_MASK   0xffffffffffffffffULL
 
 static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
Signature · 1 line
1.9.3
#9 lore raw

Re: [PATCH 2/2 v2] Fix compile issue in i686 platform

2015-11-27 11:36, Michael Qiu:

Quoted 2 lines

In i686 platform, long is 32bit, so XXX_CYCLECOUNTER_MASK need define as 'ULL'

Michael, it is the same comment as the first patch.
How your compiler is different of mine which compiles fine without this patch? I'm using GCC 5.2.0.

Acked-by on v2 1/2
#10 lore raw
In reply to Michael Qiu
Quoted 14 lines

-----Original Message-----
From: Qiu, Michael
Sent: Friday, November 27, 2015 3:36 AM
To: [email protected]
Cc: De Lara Guarch, Pablo; [email protected]; Qiu, Michael
Subject: [PATCH 1/2 v2] examples/distributor: Fix compile issue

examples/distributor/main.c(338): error #167:
argument of type "struct rte_mbuf *"
is incompatible with parameter of type "const char *"
_mm_prefetch(bufs[0], 0);

Quoted 6 lines

The first param pass to _mm_prefetch is wrong,
need convert "struct rte_mbuf *" to "void *".

Fixes 07db4a975094 ("examples/distributor: new sample app")
#11 lore raw
Quoted 5 lines
Quoted 5 lines

examples/distributor/main.c(338): error #167:
argument of type "struct rte_mbuf *"
is incompatible with parameter of type "const char *"
_mm_prefetch(bufs[0], 0);

Quoted 8 lines
Quoted 6 lines

The first param pass to _mm_prefetch is wrong,
need convert "struct rte_mbuf *" to "void *".

Fixes 07db4a975094 ("examples/distributor: new sample app")

As described by Pablo, it is seen with ICC 2015.

Series applied, thanks