DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bnx2x: fix undeclared PAGE_SIZE build error
@ 2015-07-28  8:48 Zhigang Lu
  2015-07-28  9:17 ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Zhigang Lu @ 2015-07-28  8:48 UTC (permalink / raw)
  To: dev

This patch fixes a build error caused by undeclared PAGE_SIZE when
compiling for non-X86 arches. On some arches, PAGE_SIZE is not fixed
so that header files do not define it.  A better way to get it is
via sysconf(3) or getpagesize(2).

Fixes: 540a211084a7 ("bnx2x: driver core")

== Build drivers/net/bnx2x
  CC bnx2x.o
/u/zlu.bjg/git/dpdk.org/drivers/net/bnx2x/bnx2x.c: In function ‘bnx2x_set_fp_rx_buf_size’:
/u/zlu.bjg/git/dpdk.org/drivers/net/bnx2x/bnx2x.c:2331: error: ‘PAGE_SIZE’ undeclared (first use in this function)
/u/zlu.bjg/git/dpdk.org/drivers/net/bnx2x/bnx2x.c:2331: error: (Each undeclared identifier is reported only once
/u/zlu.bjg/git/dpdk.org/drivers/net/bnx2x/bnx2x.c:2331: error: for each function it appears in.)
/u/zlu.bjg/git/dpdk.org/drivers/net/bnx2x/bnx2x.c: In function ‘ecore_gunzip’:
/u/zlu.bjg/git/dpdk.org/drivers/net/bnx2x/bnx2x.c:11579: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Zhigang Lu <zlu@ezchip.com>
---
 drivers/net/bnx2x/bnx2x.h        | 2 ++
 drivers/net/bnx2x/bnx2x_ethdev.h | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index b1e36e5..84b4a29 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -144,6 +144,8 @@ struct bnx2x_device_type {
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
 	((uint64_t)((mb)->buf_physaddr + (mb)->data_off))
 
+#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
+
 #define BNX2X_PAGE_SHIFT       12
 #define BNX2X_PAGE_SIZE        (1 << BNX2X_PAGE_SHIFT)
 #define BNX2X_PAGE_MASK        (~(BNX2X_PAGE_SIZE - 1))
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h
index 569bfdf..4f96ef7 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.h
+++ b/drivers/net/bnx2x/bnx2x_ethdev.h
@@ -9,7 +9,6 @@
 
 #include <sys/queue.h>
 #include <sys/param.h>
-#include <sys/user.h>
 #include <sys/stat.h>
 
 #include <stdio.h>
-- 
2.1.2

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

* Re: [dpdk-dev] [PATCH] bnx2x: fix undeclared PAGE_SIZE build error
  2015-07-28  8:48 [dpdk-dev] [PATCH] bnx2x: fix undeclared PAGE_SIZE build error Zhigang Lu
@ 2015-07-28  9:17 ` Thomas Monjalon
  2015-07-29  1:10   ` Tony Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2015-07-28  9:17 UTC (permalink / raw)
  To: Zhigang Lu; +Cc: dev

2015-07-28 16:48, Zhigang Lu:
> This patch fixes a build error caused by undeclared PAGE_SIZE when
> compiling for non-X86 arches. On some arches, PAGE_SIZE is not fixed
> so that header files do not define it.  A better way to get it is
> via sysconf(3) or getpagesize(2).
> 
> Fixes: 540a211084a7 ("bnx2x: driver core")

Thanks for fixing it.

> +#define PAGE_SIZE (sysconf(_SC_PAGESIZE))

To avoid conflict with system headers, it would be better to prefix
the constant.
Ideally, we should add RTE_PAGESIZE in EAL and cleanup every usage
of sysconf(_SC_PAGESIZE) and getpagesize.

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

* Re: [dpdk-dev] [PATCH] bnx2x: fix undeclared PAGE_SIZE build error
  2015-07-28  9:17 ` Thomas Monjalon
@ 2015-07-29  1:10   ` Tony Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lu @ 2015-07-29  1:10 UTC (permalink / raw)
  To: 'Thomas Monjalon'; +Cc: dev

>-----Original Message-----
>From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
>Sent: Tuesday, July 28, 2015 5:18 PM
>To: Zhigang Lu
>Cc: dev@dpdk.org
>Subject: Re: [dpdk-dev] [PATCH] bnx2x: fix undeclared PAGE_SIZE build error
>
>2015-07-28 16:48, Zhigang Lu:
>> This patch fixes a build error caused by undeclared PAGE_SIZE when
>> compiling for non-X86 arches. On some arches, PAGE_SIZE is not fixed
>> so that header files do not define it.  A better way to get it is via
>> sysconf(3) or getpagesize(2).
>>
>> Fixes: 540a211084a7 ("bnx2x: driver core")
>
>Thanks for fixing it.
>
>> +#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
>
>To avoid conflict with system headers, it would be better to prefix the
constant.
>Ideally, we should add RTE_PAGESIZE in EAL and cleanup every usage of
>sysconf(_SC_PAGESIZE) and getpagesize.

Agree, good idea.

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

end of thread, other threads:[~2015-07-29  1:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28  8:48 [dpdk-dev] [PATCH] bnx2x: fix undeclared PAGE_SIZE build error Zhigang Lu
2015-07-28  9:17 ` Thomas Monjalon
2015-07-29  1:10   ` Tony Lu

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