[dpdk-dev,v2] net/ixgbe: fix compilation when offload flags disabled

Message ID 1467360147-19571-1-git-send-email-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Olivier Matz July 1, 2016, 8:02 a.m. UTC
  The ixgbe driver does not compile if CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n
because the macro has not the proper number of parameters. To reproduce
the issue:

  make config T=x86_64-native-linuxapp-gcc
  sed -i 's,CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=y,CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n,' build/.config
  make -j4
  [...]
   ixgbe_rxtx_vec_sse.c: In function ‘_recv_raw_pkts_vec’:
   ixgbe_rxtx_vec_sse.c:345:53: error: macro "desc_to_olflags_v" passed 3 arguments, but takes just 2
      desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
                                                        ^
   ixgbe_rxtx_vec_sse.c:345:3: error: ‘desc_to_olflags_v’ undeclared (first use in this function)
      desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
      ^
   ixgbe_rxtx_vec_sse.c:345:3: note: each undeclared identifier is reported only once for each function it appears in
   ixgbe_rxtx_vec_sse.c:231:10: error: variable ‘vlan_flags’ set but not used [-Werror=unused-but-set-variable]
     uint8_t vlan_flags;
             ^
   cc1: all warnings being treated as errors

This patch fixes the number of arguments in th macro, and ensure that
vlan_flags is marked as used to avoid the third error.

Fixes: b37b528d957c ("mbuf: add new Rx flags for stripped VLAN")
Reported-by: Amin Tootoonchian <amint@icsi.berkeley.edu>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin July 1, 2016, 9:02 a.m. UTC | #1
> The ixgbe driver does not compile if CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n

> because the macro has not the proper number of parameters. To reproduce

> the issue:

> 

>   make config T=x86_64-native-linuxapp-gcc

>   sed -i 's,CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=y,CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n,' build/.config

>   make -j4

>   [...]

>    ixgbe_rxtx_vec_sse.c: In function ‘_recv_raw_pkts_vec’:

>    ixgbe_rxtx_vec_sse.c:345:53: error: macro "desc_to_olflags_v" passed 3 arguments, but takes just 2

>       desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);

>                                                         ^

>    ixgbe_rxtx_vec_sse.c:345:3: error: ‘desc_to_olflags_v’ undeclared (first use in this function)

>       desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);

>       ^

>    ixgbe_rxtx_vec_sse.c:345:3: note: each undeclared identifier is reported only once for each function it appears in

>    ixgbe_rxtx_vec_sse.c:231:10: error: variable ‘vlan_flags’ set but not used [-Werror=unused-but-set-variable]

>      uint8_t vlan_flags;

>              ^

>    cc1: all warnings being treated as errors

> 

> This patch fixes the number of arguments in th macro, and ensure that

> vlan_flags is marked as used to avoid the third error.

> 

> Fixes: b37b528d957c ("mbuf: add new Rx flags for stripped VLAN")

> Reported-by: Amin Tootoonchian <amint@icsi.berkeley.edu>

> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

> ---

>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c

> index 4f95deb..1c4fd7c 100644

> --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c

> +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c

> @@ -197,7 +197,9 @@ desc_to_olflags_v(__m128i descs[4], uint8_t vlan_flags,

>  	rx_pkts[3]->ol_flags = vol.e[3];

>  }

>  #else

> -#define desc_to_olflags_v(desc, rx_pkts) do {} while (0)

> +#define desc_to_olflags_v(desc, vlan_flags, rx_pkts) do { \

> +		RTE_SET_USED(vlan_flags); \

> +	} while (0)

>  #endif

> 

>  /*

> --


Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>


> 2.8.1
  
Bruce Richardson July 5, 2016, 9:11 a.m. UTC | #2
On Fri, Jul 01, 2016 at 10:02:46AM +0100, Ananyev, Konstantin wrote:
> 
> > The ixgbe driver does not compile if CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n
> > because the macro has not the proper number of parameters. To reproduce
> > the issue:
> > 
> >   make config T=x86_64-native-linuxapp-gcc
> >   sed -i 's,CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=y,CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n,' build/.config
> >   make -j4
> >   [...]
> >    ixgbe_rxtx_vec_sse.c: In function ‘_recv_raw_pkts_vec’:
> >    ixgbe_rxtx_vec_sse.c:345:53: error: macro "desc_to_olflags_v" passed 3 arguments, but takes just 2
> >       desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
> >                                                         ^
> >    ixgbe_rxtx_vec_sse.c:345:3: error: ‘desc_to_olflags_v’ undeclared (first use in this function)
> >       desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
> >       ^
> >    ixgbe_rxtx_vec_sse.c:345:3: note: each undeclared identifier is reported only once for each function it appears in
> >    ixgbe_rxtx_vec_sse.c:231:10: error: variable ‘vlan_flags’ set but not used [-Werror=unused-but-set-variable]
> >      uint8_t vlan_flags;
> >              ^
> >    cc1: all warnings being treated as errors
> > 
> > This patch fixes the number of arguments in th macro, and ensure that
> > vlan_flags is marked as used to avoid the third error.
> > 
> > Fixes: b37b528d957c ("mbuf: add new Rx flags for stripped VLAN")
> > Reported-by: Amin Tootoonchian <amint@icsi.berkeley.edu>
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> > index 4f95deb..1c4fd7c 100644
> > --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> > +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
> > @@ -197,7 +197,9 @@ desc_to_olflags_v(__m128i descs[4], uint8_t vlan_flags,
> >  	rx_pkts[3]->ol_flags = vol.e[3];
> >  }
> >  #else
> > -#define desc_to_olflags_v(desc, rx_pkts) do {} while (0)
> > +#define desc_to_olflags_v(desc, vlan_flags, rx_pkts) do { \
> > +		RTE_SET_USED(vlan_flags); \
> > +	} while (0)
> >  #endif
> > 
> >  /*
> > --
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
Applied to dpdk-next-net/rel_16_07

/Bruce
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index 4f95deb..1c4fd7c 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -197,7 +197,9 @@  desc_to_olflags_v(__m128i descs[4], uint8_t vlan_flags,
 	rx_pkts[3]->ol_flags = vol.e[3];
 }
 #else
-#define desc_to_olflags_v(desc, rx_pkts) do {} while (0)
+#define desc_to_olflags_v(desc, vlan_flags, rx_pkts) do { \
+		RTE_SET_USED(vlan_flags); \
+	} while (0)
 #endif
 
 /*