[dpdk-dev,v4,09/17] enic: fix re-define freebsd compile complain

Message ID 1422842559-13617-10-git-send-email-cunming.liang@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Cunming Liang Feb. 2, 2015, 2:02 a.m. UTC
  Some macro already been defined by freebsd 'sys/param.h'.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
---
 lib/librte_pmd_enic/enic.h        | 1 +
 lib/librte_pmd_enic/enic_compat.h | 1 +
 2 files changed, 2 insertions(+)
  

Comments

Olivier Matz Feb. 8, 2015, 8 p.m. UTC | #1
Hi,

On 02/02/2015 03:02 AM, Cunming Liang wrote:
> Some macro already been defined by freebsd 'sys/param.h'.
> 
> Signed-off-by: Cunming Liang <cunming.liang@intel.com>
> ---
>  lib/librte_pmd_enic/enic.h        | 1 +
>  lib/librte_pmd_enic/enic_compat.h | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h
> index c43417c..189c3b9 100644
> --- a/lib/librte_pmd_enic/enic.h
> +++ b/lib/librte_pmd_enic/enic.h
> @@ -66,6 +66,7 @@
>  #define ENIC_CALC_IP_CKSUM      1
>  #define ENIC_CALC_TCP_UDP_CKSUM 2
>  #define ENIC_MAX_MTU            9000
> +#undef PAGE_SIZE
>  #define PAGE_SIZE               4096
>  #define PAGE_ROUND_UP(x) \
>  	((((unsigned long)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1)))
> diff --git a/lib/librte_pmd_enic/enic_compat.h b/lib/librte_pmd_enic/enic_compat.h
> index b1af838..b84c766 100644
> --- a/lib/librte_pmd_enic/enic_compat.h
> +++ b/lib/librte_pmd_enic/enic_compat.h
> @@ -67,6 +67,7 @@
>  #define pr_warn(y, args...) dev_warning(0, y, ##args)
>  #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
>  
> +#undef ALIGN
>  #define ALIGN(x, a)              __ALIGN_MASK(x, (typeof(x))(a)-1)
>  #define __ALIGN_MASK(x, mask)    (((x)+(mask))&~(mask))
>  #define udelay usleep
> 

Is the issue caused by a change you've made previously in the patch
series?

Wouldn't it be better to rename the macros in enic instead of doing
#undef?

Regards,
Olivier
  
Cunming Liang Feb. 9, 2015, 1:50 p.m. UTC | #2
> -----Original Message-----
> From: Olivier MATZ [mailto:olivier.matz@6wind.com]
> Sent: Monday, February 09, 2015 4:01 AM
> To: Liang, Cunming; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 09/17] enic: fix re-define freebsd compile
> complain
> 
> Hi,
> 
> On 02/02/2015 03:02 AM, Cunming Liang wrote:
> > Some macro already been defined by freebsd 'sys/param.h'.
> >
> > Signed-off-by: Cunming Liang <cunming.liang@intel.com>
> > ---
> >  lib/librte_pmd_enic/enic.h        | 1 +
> >  lib/librte_pmd_enic/enic_compat.h | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h
> > index c43417c..189c3b9 100644
> > --- a/lib/librte_pmd_enic/enic.h
> > +++ b/lib/librte_pmd_enic/enic.h
> > @@ -66,6 +66,7 @@
> >  #define ENIC_CALC_IP_CKSUM      1
> >  #define ENIC_CALC_TCP_UDP_CKSUM 2
> >  #define ENIC_MAX_MTU            9000
> > +#undef PAGE_SIZE
> >  #define PAGE_SIZE               4096
> >  #define PAGE_ROUND_UP(x) \
> >  	((((unsigned long)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1)))
> > diff --git a/lib/librte_pmd_enic/enic_compat.h
> b/lib/librte_pmd_enic/enic_compat.h
> > index b1af838..b84c766 100644
> > --- a/lib/librte_pmd_enic/enic_compat.h
> > +++ b/lib/librte_pmd_enic/enic_compat.h
> > @@ -67,6 +67,7 @@
> >  #define pr_warn(y, args...) dev_warning(0, y, ##args)
> >  #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
> >
> > +#undef ALIGN
> >  #define ALIGN(x, a)              __ALIGN_MASK(x, (typeof(x))(a)-1)
> >  #define __ALIGN_MASK(x, mask)    (((x)+(mask))&~(mask))
> >  #define udelay usleep
> >
> 
> Is the issue caused by a change you've made previously in the patch
> series?
[LCM] Yes, caused by [01/17] which include <pthread_np.h> in freebsdapp.
> 
> Wouldn't it be better to rename the macros in enic instead of doing
> #undef?
[LCM] Agree, will do it.
> 
> Regards,
> Olivier
  

Patch

diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h
index c43417c..189c3b9 100644
--- a/lib/librte_pmd_enic/enic.h
+++ b/lib/librte_pmd_enic/enic.h
@@ -66,6 +66,7 @@ 
 #define ENIC_CALC_IP_CKSUM      1
 #define ENIC_CALC_TCP_UDP_CKSUM 2
 #define ENIC_MAX_MTU            9000
+#undef PAGE_SIZE
 #define PAGE_SIZE               4096
 #define PAGE_ROUND_UP(x) \
 	((((unsigned long)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1)))
diff --git a/lib/librte_pmd_enic/enic_compat.h b/lib/librte_pmd_enic/enic_compat.h
index b1af838..b84c766 100644
--- a/lib/librte_pmd_enic/enic_compat.h
+++ b/lib/librte_pmd_enic/enic_compat.h
@@ -67,6 +67,7 @@ 
 #define pr_warn(y, args...) dev_warning(0, y, ##args)
 #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
 
+#undef ALIGN
 #define ALIGN(x, a)              __ALIGN_MASK(x, (typeof(x))(a)-1)
 #define __ALIGN_MASK(x, mask)    (((x)+(mask))&~(mask))
 #define udelay usleep