[dpdk-dev] testpmd: fix build on FreeBSD

Message ID 1458524684-13539-1-git-send-email-yong.liu@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Marvin Liu March 21, 2016, 1:44 a.m. UTC
  Build log:
/root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
's6_addr32' in 'struct in6_addr'
	rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);

This is caused by macro "s6_addr32" not defined on FreeBSD.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
  

Comments

Daniel Mrzyglod March 21, 2016, 8:59 a.m. UTC | #1
>From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Marvin Liu
>Sent: Monday, March 21, 2016 2:45 AM
>To: dev@dpdk.org
>Cc: Liu, Yong <yong.liu@intel.com>
>Subject: [dpdk-dev] [PATCH] testpmd: fix build on FreeBSD
>
>Build log:
>/root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
>'s6_addr32' in 'struct in6_addr'
>	rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
>
>This is caused by macro "s6_addr32" not defined on FreeBSD.
>
>Signed-off-by: Marvin Liu <yong.liu@intel.com>

Acked-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
  
Sergio Gonzalez Monroy March 21, 2016, 9:13 a.m. UTC | #2
On 21/03/2016 01:44, Marvin Liu wrote:
> Build log:
> /root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
> 's6_addr32' in 'struct in6_addr'
> 	rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
>
> This is caused by macro "s6_addr32" not defined on FreeBSD.
>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 9d52b8c..51ad23b 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -6684,7 +6684,11 @@ cmd_tunnel_filter_parsed(void *parsed_result,
>   		int i;
>   		for (i = 0; i < 4; i++) {
>   			tunnel_filter_conf.ip_addr.ipv6_addr[i] =
> +#ifdef RTE_EXEC_ENV_BSDAPP
> +			rte_be_to_cpu_32(res->ip_value.addr.ipv6.__u6_addr.__u6_addr32[i]);
> +#else
>   			rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
> +#endif

Why not always use .__u6_addr.__u6_addr32[i] and avoid ifdef?

Sergio

>   		}
>   		tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
>   	}
  
De Lara Guarch, Pablo March 21, 2016, 9:40 a.m. UTC | #3
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
> Monroy
> Sent: Monday, March 21, 2016 9:13 AM
> To: Liu, Yong; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] testpmd: fix build on FreeBSD
> 
> On 21/03/2016 01:44, Marvin Liu wrote:
> > Build log:
> > /root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
> > 's6_addr32' in 'struct in6_addr'
> > 	rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
> >
> > This is caused by macro "s6_addr32" not defined on FreeBSD.
> >
> > Signed-off-by: Marvin Liu <yong.liu@intel.com>
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> > index 9d52b8c..51ad23b 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -6684,7 +6684,11 @@ cmd_tunnel_filter_parsed(void *parsed_result,
> >   		int i;
> >   		for (i = 0; i < 4; i++) {
> >   			tunnel_filter_conf.ip_addr.ipv6_addr[i] =
> > +#ifdef RTE_EXEC_ENV_BSDAPP
> > +			rte_be_to_cpu_32(res-
> >ip_value.addr.ipv6.__u6_addr.__u6_addr32[i]);
> > +#else
> >   			rte_be_to_cpu_32(res-
> >ip_value.addr.ipv6.s6_addr32[i]);
> > +#endif
> 
> Why not always use .__u6_addr.__u6_addr32[i] and avoid ifdef?
> 
> Sergio
> 
> >   		}
> >   		tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
> >   	}

Also, can you include the missing "Fixes" line?

Thanks,
Pablo
  
Bruce Richardson March 21, 2016, 2:57 p.m. UTC | #4
On Mon, Mar 21, 2016 at 09:40:07AM +0000, De Lara Guarch, Pablo wrote:
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
> > Monroy
> > Sent: Monday, March 21, 2016 9:13 AM
> > To: Liu, Yong; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] testpmd: fix build on FreeBSD
> > 
> > On 21/03/2016 01:44, Marvin Liu wrote:
> > > Build log:
> > > /root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
> > > 's6_addr32' in 'struct in6_addr'
> > > 	rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
> > >
> > > This is caused by macro "s6_addr32" not defined on FreeBSD.
> > >
> > > Signed-off-by: Marvin Liu <yong.liu@intel.com>
> > >
> > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> > > index 9d52b8c..51ad23b 100644
> > > --- a/app/test-pmd/cmdline.c
> > > +++ b/app/test-pmd/cmdline.c
> > > @@ -6684,7 +6684,11 @@ cmd_tunnel_filter_parsed(void *parsed_result,
> > >   		int i;
> > >   		for (i = 0; i < 4; i++) {
> > >   			tunnel_filter_conf.ip_addr.ipv6_addr[i] =
> > > +#ifdef RTE_EXEC_ENV_BSDAPP
> > > +			rte_be_to_cpu_32(res-
> > >ip_value.addr.ipv6.__u6_addr.__u6_addr32[i]);
> > > +#else
> > >   			rte_be_to_cpu_32(res-
> > >ip_value.addr.ipv6.s6_addr32[i]);
> > > +#endif
> > 
> > Why not always use .__u6_addr.__u6_addr32[i] and avoid ifdef?
> > 
> > Sergio
> > 
> > >   		}
> > >   		tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
> > >   	}
> 
> Also, can you include the missing "Fixes" line?
> 
A slightly higher level question:
Why are we doing 32-bit endian conversions, when IPv6 addresses are normally
specified in 16-bit (4-hex digit) blocks?

/Bruce
  
Marvin Liu March 22, 2016, 3:30 a.m. UTC | #5
Hi Pablo & Sergio,

> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Monday, March 21, 2016 5:40 PM
> To: Gonzalez Monroy, Sergio; Liu, Yong; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] testpmd: fix build on FreeBSD
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
> > Monroy
> > Sent: Monday, March 21, 2016 9:13 AM
> > To: Liu, Yong; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] testpmd: fix build on FreeBSD
> >
> > On 21/03/2016 01:44, Marvin Liu wrote:
> > > Build log:
> > > /root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
> > > 's6_addr32' in 'struct in6_addr'
> > > 	rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
> > >
> > > This is caused by macro "s6_addr32" not defined on FreeBSD.
> > >
> > > Signed-off-by: Marvin Liu <yong.liu@intel.com>
> > >
> > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> > > index 9d52b8c..51ad23b 100644
> > > --- a/app/test-pmd/cmdline.c
> > > +++ b/app/test-pmd/cmdline.c
> > > @@ -6684,7 +6684,11 @@ cmd_tunnel_filter_parsed(void *parsed_result,
> > >   		int i;
> > >   		for (i = 0; i < 4; i++) {
> > >   			tunnel_filter_conf.ip_addr.ipv6_addr[i] =
> > > +#ifdef RTE_EXEC_ENV_BSDAPP
> > > +			rte_be_to_cpu_32(res-
> > >ip_value.addr.ipv6.__u6_addr.__u6_addr32[i]);
> > > +#else
> > >   			rte_be_to_cpu_32(res-
> > >ip_value.addr.ipv6.s6_addr32[i]);
> > > +#endif
> >
> > Why not always use .__u6_addr.__u6_addr32[i] and avoid ifdef?
> >
Because of structures between BSD an Linux have different names. 
On linux, it will be "__in6_u. __u6_addr32". 

> > Sergio
> >
> > >   		}
> > >   		tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
> > >   	}
> 
> Also, can you include the missing "Fixes" line?
> 
Sure, I will add it and send out v2.

> Thanks,
> Pablo

Best regards,
Marvin
  
Sergio Gonzalez Monroy March 22, 2016, 9:44 a.m. UTC | #6
On 22/03/2016 03:30, Liu, Yong wrote:
> Hi Pablo & Sergio,
>
>> -----Original Message-----
>> From: De Lara Guarch, Pablo
>> Sent: Monday, March 21, 2016 5:40 PM
>> To: Gonzalez Monroy, Sergio; Liu, Yong; dev@dpdk.org
>> Subject: RE: [dpdk-dev] [PATCH] testpmd: fix build on FreeBSD
>>
>>
>>
>>> -----Original Message-----
>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
>>> Monroy
>>> Sent: Monday, March 21, 2016 9:13 AM
>>> To: Liu, Yong; dev@dpdk.org
>>> Subject: Re: [dpdk-dev] [PATCH] testpmd: fix build on FreeBSD
>>>
>>> On 21/03/2016 01:44, Marvin Liu wrote:
>>>> Build log:
>>>> /root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
>>>> 's6_addr32' in 'struct in6_addr'
>>>> 	rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
>>>>
>>>> This is caused by macro "s6_addr32" not defined on FreeBSD.
>>>>
>>>> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>>>>
>>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
>>>> index 9d52b8c..51ad23b 100644
>>>> --- a/app/test-pmd/cmdline.c
>>>> +++ b/app/test-pmd/cmdline.c
>>>> @@ -6684,7 +6684,11 @@ cmd_tunnel_filter_parsed(void *parsed_result,
>>>>    		int i;
>>>>    		for (i = 0; i < 4; i++) {
>>>>    			tunnel_filter_conf.ip_addr.ipv6_addr[i] =
>>>> +#ifdef RTE_EXEC_ENV_BSDAPP
>>>> +			rte_be_to_cpu_32(res-
>>>> ip_value.addr.ipv6.__u6_addr.__u6_addr32[i]);
>>>> +#else
>>>>    			rte_be_to_cpu_32(res-
>>>> ip_value.addr.ipv6.s6_addr32[i]);
>>>> +#endif
>>> Why not always use .__u6_addr.__u6_addr32[i] and avoid ifdef?
>>>
> Because of structures between BSD an Linux have different names.
> On linux, it will be "__in6_u. __u6_addr32".

Duh!

Sorry about that. I should drink coffee before replying emails.

Sergio

>>> Sergio
>>>
>>>>    		}
>>>>    		tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
>>>>    	}
>> Also, can you include the missing "Fixes" line?
>>
> Sure, I will add it and send out v2.
>
>> Thanks,
>> Pablo
> Best regards,
> Marvin
>
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9d52b8c..51ad23b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6684,7 +6684,11 @@  cmd_tunnel_filter_parsed(void *parsed_result,
 		int i;
 		for (i = 0; i < 4; i++) {
 			tunnel_filter_conf.ip_addr.ipv6_addr[i] =
+#ifdef RTE_EXEC_ENV_BSDAPP
+			rte_be_to_cpu_32(res->ip_value.addr.ipv6.__u6_addr.__u6_addr32[i]);
+#else
 			rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
+#endif
 		}
 		tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
 	}