[dpdk-dev,1/2] examples/distributor: Fix compile issue

Message ID 1448501706-21718-1-git-send-email-michael.qiu@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Michael Qiu Nov. 26, 2015, 1:35 a.m. UTC
  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 *".

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 examples/distributor/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Thomas Monjalon Nov. 26, 2015, 2:29 p.m. UTC | #1
Hi Michael,
Thank you very much for working on compilation issues.
Please could you try to insert a "Fixes:" line in your logs?
  
Thomas Monjalon Nov. 26, 2015, 9:01 p.m. UTC | #2
2015-11-26 09:35, 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 of _mm_prefetch should be "const char *" and
> need convert "struct rte_mbuf *" to "const void *".
[...]
> -			_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
  

Patch

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 972bddb..a4d8e34 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -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