[dpdk-dev] net/tap: fix build issue with ARM32
diff mbox

Message ID 20180131051408.3652-1-jerin.jacob@caviumnetworks.com
State Rejected, archived
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jerin Jacob Jan. 31, 2018, 5:14 a.m. UTC
arm32 Linux does not support eBPF interface.
Since tap PMD driver has a dependency on eBPF(the symbol __NR_bpf),
disabling it armv7 config.

compilation error log:
In file included from /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:15:0:
/tmp/dpdk/drivers/net/tap/tap_bpf.h:103:4: error: #error __NR_bpf not
defined
 #  error __NR_bpf not defined
    ^
/tmp/dpdk/drivers/net/tap/tap_bpf_api.c: In function ‘sys_bpf’:
/tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: error: ‘__NR_bpf’
undeclared (first use in this function)
  return syscall(__NR_bpf, cmd, attr, size);
                 ^
/tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: note: each undeclared
identifier is reported only once for each function it appears in
/tmp/dpdk/drivers/net/tap/tap_bpf_api.c:93:1: error: control reaches
end of non-void function [-Werror=return-type]
 }
 ^
cc1: all warnings being treated as errors

Fixes: b02d85e1 ("net/tap: add eBPF API")

Cc: Pascal Mazon <pascal.mazon@6wind.com>
Cc: Jan Viktorin <viktorin@rehivetech.com>
Cc: Jianbo Liu <jianbo.liu@arm.com>

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 config/defconfig_arm-armv7a-linuxapp-gcc | 1 +
 1 file changed, 1 insertion(+)

Comments

Ophir Munk Jan. 31, 2018, 9:59 a.m. UTC | #1
Hi,
Please see comments inline

> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob

> Sent: Wednesday, January 31, 2018 7:14 AM

> To: dev@dpdk.org

> Cc: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob

> <jerin.jacob@caviumnetworks.com>; Pascal Mazon

> <pascal.mazon@6wind.com>; Jan Viktorin <viktorin@rehivetech.com>;

> Jianbo Liu <jianbo.liu@arm.com>

> Subject: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32

> 

> arm32 Linux does not support eBPF interface.

> Since tap PMD driver has a dependency on eBPF(the symbol __NR_bpf),

> disabling it armv7 config.

> 

> compilation error log:

> In file included from /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:15:0:

> /tmp/dpdk/drivers/net/tap/tap_bpf.h:103:4: error: #error __NR_bpf not

> defined  #  error __NR_bpf not defined

>     ^


arm architecture is missing is file drivers/tap/tap_bpf.h
I suggest adding it, for example

# elif defined(__arm__)
#  define __NR_bpf 386

It should work for you. Can you please try it?
If it doesn't work for you, please have a look in this link:
 https://sourceforge.net/p/predef/wiki/Architectures/
where you can see more arm architecture definitions.
You should find the one suitable for you.

> /tmp/dpdk/drivers/net/tap/tap_bpf_api.c: In function ‘sys_bpf’:

> /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: error: ‘__NR_bpf’

> undeclared (first use in this function)

>   return syscall(__NR_bpf, cmd, attr, size);

>                  ^

> /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: note: each undeclared

> identifier is reported only once for each function it appears in

> /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:93:1: error: control reaches end of

> non-void function [-Werror=return-type]  }  ^

> cc1: all warnings being treated as errors

> 

> Fixes: b02d85e1 ("net/tap: add eBPF API")

> 

> Cc: Pascal Mazon <pascal.mazon@6wind.com>

> Cc: Jan Viktorin <viktorin@rehivetech.com>

> Cc: Jianbo Liu <jianbo.liu@arm.com>

> 

> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> ---

>  config/defconfig_arm-armv7a-linuxapp-gcc | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/config/defconfig_arm-armv7a-linuxapp-gcc

> b/config/defconfig_arm-armv7a-linuxapp-gcc

> index a20b7a85f..4a55bb397 100644

> --- a/config/defconfig_arm-armv7a-linuxapp-gcc

> +++ b/config/defconfig_arm-armv7a-linuxapp-gcc

> @@ -80,3 +80,4 @@ CONFIG_RTE_LIBRTE_BNX2X_PMD=n

> CONFIG_RTE_LIBRTE_QEDE_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n

> CONFIG_RTE_LIBRTE_AVP_PMD=n

> +CONFIG_RTE_LIBRTE_PMD_TAP=n

> --


I suggest fixing the compilation issue by adding the missing architecture system call number
(as suggested above) instead of disabling TAP compilation by default

> 2.16.1
Jerin Jacob Jan. 31, 2018, 10:23 a.m. UTC | #2
-----Original Message-----
> Date: Wed, 31 Jan 2018 09:59:45 +0000
> From: Ophir Munk <ophirmu@mellanox.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, "dev@dpdk.org"
>  <dev@dpdk.org>
> CC: Thomas Monjalon <thomas@monjalon.net>, Pascal Mazon
>  <pascal.mazon@6wind.com>, Jan Viktorin <viktorin@rehivetech.com>, Jianbo
>  Liu <jianbo.liu@arm.com>
> Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with ARM32
> 
> Hi,
> Please see comments inline
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> > Sent: Wednesday, January 31, 2018 7:14 AM
> > To: dev@dpdk.org
> > Cc: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob
> > <jerin.jacob@caviumnetworks.com>; Pascal Mazon
> > <pascal.mazon@6wind.com>; Jan Viktorin <viktorin@rehivetech.com>;
> > Jianbo Liu <jianbo.liu@arm.com>
> > Subject: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32
> > 
> > arm32 Linux does not support eBPF interface.
> > Since tap PMD driver has a dependency on eBPF(the symbol __NR_bpf),
> > disabling it armv7 config.
> > 
> > compilation error log:
> > In file included from /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:15:0:
> > /tmp/dpdk/drivers/net/tap/tap_bpf.h:103:4: error: #error __NR_bpf not
> > defined  #  error __NR_bpf not defined
> >     ^
> 
> arm architecture is missing is file drivers/tap/tap_bpf.h
> I suggest adding it, for example
> 
> # elif defined(__arm__)
> #  define __NR_bpf 386

By looking at Linux source code
http://elixir.free-electrons.com/linux/v4.15/source/tools/build/feature/test-bpf.c#L6
I am not sure, Is eBPF support available for arm32 support?

> 
> It should work for you. Can you please try it?

I don't have access to an arm32 board. I was facing cross compilation
build issue with arm32.

> If it doesn't work for you, please have a look in this link:
>  https://sourceforge.net/p/predef/wiki/Architectures/
> where you can see more arm architecture definitions.
> You should find the one suitable for you.

I guess, it is not just matter of enabling the build for arm32. It should work
at runtime too, If some can confirm following addition in the drivers/net/tap/tap_bpf.h
works then we can add it.

# elif defined(__arm__)
#  define __NR_bpf 386

> 
> > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c: In function ‘sys_bpf’:
> > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: error: ‘__NR_bpf’
> > undeclared (first use in this function)
> >   return syscall(__NR_bpf, cmd, attr, size);
> >                  ^
> > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: note: each undeclared
> > identifier is reported only once for each function it appears in
> > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:93:1: error: control reaches end of
> > non-void function [-Werror=return-type]  }  ^
> > cc1: all warnings being treated as errors
> > 
> > Fixes: b02d85e1 ("net/tap: add eBPF API")
> > 
> > Cc: Pascal Mazon <pascal.mazon@6wind.com>
> > Cc: Jan Viktorin <viktorin@rehivetech.com>
> > Cc: Jianbo Liu <jianbo.liu@arm.com>
> > 
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > ---
> >  config/defconfig_arm-armv7a-linuxapp-gcc | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/config/defconfig_arm-armv7a-linuxapp-gcc
> > b/config/defconfig_arm-armv7a-linuxapp-gcc
> > index a20b7a85f..4a55bb397 100644
> > --- a/config/defconfig_arm-armv7a-linuxapp-gcc
> > +++ b/config/defconfig_arm-armv7a-linuxapp-gcc
> > @@ -80,3 +80,4 @@ CONFIG_RTE_LIBRTE_BNX2X_PMD=n
> > CONFIG_RTE_LIBRTE_QEDE_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
> > CONFIG_RTE_LIBRTE_AVP_PMD=n
> > +CONFIG_RTE_LIBRTE_PMD_TAP=n
> > --
> 
> I suggest fixing the compilation issue by adding the missing architecture system call number
> (as suggested above) instead of disabling TAP compilation by default
> 
> > 2.16.1
>
Ophir Munk Jan. 31, 2018, 10:38 a.m. UTC | #3
Hi,
Please see inline

> -----Original Message-----

> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]

> Sent: Wednesday, January 31, 2018 12:24 PM

> To: Ophir Munk <ophirmu@mellanox.com>

> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Pascal

> Mazon <pascal.mazon@6wind.com>; Jan Viktorin

> <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>

> Subject: Re: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32

> 

> -----Original Message-----

> > Date: Wed, 31 Jan 2018 09:59:45 +0000

> > From: Ophir Munk <ophirmu@mellanox.com>

> > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, "dev@dpdk.org"

> >  <dev@dpdk.org>

> > CC: Thomas Monjalon <thomas@monjalon.net>, Pascal Mazon

> > <pascal.mazon@6wind.com>, Jan Viktorin <viktorin@rehivetech.com>,

> > Jianbo  Liu <jianbo.liu@arm.com>

> > Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with ARM32

> >

> > Hi,

> > Please see comments inline

> >

> > > -----Original Message-----

> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob

> > > Sent: Wednesday, January 31, 2018 7:14 AM

> > > To: dev@dpdk.org

> > > Cc: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob

> > > <jerin.jacob@caviumnetworks.com>; Pascal Mazon

> > > <pascal.mazon@6wind.com>; Jan Viktorin <viktorin@rehivetech.com>;

> > > Jianbo Liu <jianbo.liu@arm.com>

> > > Subject: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32

> > >

> > > arm32 Linux does not support eBPF interface.

> > > Since tap PMD driver has a dependency on eBPF(the symbol __NR_bpf),

> > > disabling it armv7 config.

> > >

> > > compilation error log:

> > > In file included from /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:15:0:

> > > /tmp/dpdk/drivers/net/tap/tap_bpf.h:103:4: error: #error __NR_bpf

> > > not defined  #  error __NR_bpf not defined

> > >     ^

> >

> > arm architecture is missing is file drivers/tap/tap_bpf.h I suggest

> > adding it, for example

> >

> > # elif defined(__arm__)

> > #  define __NR_bpf 386

> 

> By looking at Linux source code

> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Felixi

> r.free-

> electrons.com%2Flinux%2Fv4.15%2Fsource%2Ftools%2Fbuild%2Ffeature%2

> Ftest-

> bpf.c%23L6&data=02%7C01%7Cophirmu%40mellanox.com%7C19f50ad7f27

> 34d00173808d56894c997%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%

> 7C0%7C636529910613736017&sdata=ynsxHG9fvao4LyfWLo4GVJjlKNmcF0q

> 0BkFocJyarAE%3D&reserved=0

> I am not sure, Is eBPF support available for arm32 support?


TAP eBPF has a graceful approach: it must successfully compile on all Linux
distributions. If a specific kernel cannot support eBPF it will gracefully
refuse the eBPF netlink message sent to it. 
Thus, there is no harm even if there is no eBPF support available for arm32.

You should enable TAP compilation for cases where you only need TAP without eBPF.

> 

> >

> > It should work for you. Can you please try it?

> 

> I don't have access to an arm32 board. I was facing cross compilation build

> issue with arm32.

> 

> > If it doesn't work for you, please have a look in this link:

> >

> >

> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou

> >

> rceforge.net%2Fp%2Fpredef%2Fwiki%2FArchitectures%2F&data=02%7C01%

> 7Coph

> >

> irmu%40mellanox.com%7C19f50ad7f2734d00173808d56894c997%7Ca6529

> 71c7d2e4

> >

> d9ba6a4d149256f461b%7C0%7C0%7C636529910613736017&sdata=g5fEkG

> Gwm%2BJgR

> > KyDrxJgbFII0%2B1%2BxtbT%2FE4Qy1HACEg%3D&reserved=0

> > where you can see more arm architecture definitions.

> > You should find the one suitable for you.

> 

> I guess, it is not just matter of enabling the build for arm32. It should work at

> runtime too, If some can confirm following addition in the

> drivers/net/tap/tap_bpf.h works then we can add it.

> 


As mentioned above it must not work at runtime too.

> # elif defined(__arm__)

> #  define __NR_bpf 386

> 

> >

> > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c: In function ‘sys_bpf’:

> > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: error: ‘__NR_bpf’

> > > undeclared (first use in this function)

> > >   return syscall(__NR_bpf, cmd, attr, size);

> > >                  ^

> > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: note: each undeclared

> > > identifier is reported only once for each function it appears in

> > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:93:1: error: control reaches

> > > end of non-void function [-Werror=return-type]  }  ^

> > > cc1: all warnings being treated as errors

> > >

> > > Fixes: b02d85e1 ("net/tap: add eBPF API")

> > >

> > > Cc: Pascal Mazon <pascal.mazon@6wind.com>

> > > Cc: Jan Viktorin <viktorin@rehivetech.com>

> > > Cc: Jianbo Liu <jianbo.liu@arm.com>

> > >

> > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> > > ---

> > >  config/defconfig_arm-armv7a-linuxapp-gcc | 1 +

> > >  1 file changed, 1 insertion(+)

> > >

> > > diff --git a/config/defconfig_arm-armv7a-linuxapp-gcc

> > > b/config/defconfig_arm-armv7a-linuxapp-gcc

> > > index a20b7a85f..4a55bb397 100644

> > > --- a/config/defconfig_arm-armv7a-linuxapp-gcc

> > > +++ b/config/defconfig_arm-armv7a-linuxapp-gcc

> > > @@ -80,3 +80,4 @@ CONFIG_RTE_LIBRTE_BNX2X_PMD=n

> > > CONFIG_RTE_LIBRTE_QEDE_PMD=n

> CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n

> > > CONFIG_RTE_LIBRTE_AVP_PMD=n

> > > +CONFIG_RTE_LIBRTE_PMD_TAP=n

> > > --

> >

> > I suggest fixing the compilation issue by adding the missing

> > architecture system call number (as suggested above) instead of

> > disabling TAP compilation by default

> >

> > > 2.16.1

> >
Thomas Monjalon Jan. 31, 2018, 11:19 a.m. UTC | #4
31/01/2018 11:38, Ophir Munk:
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > > arm architecture is missing is file drivers/tap/tap_bpf.h I suggest
> > > adding it, for example
> > >
> > > # elif defined(__arm__)
> > > #  define __NR_bpf 386
[...]
> > I am not sure, Is eBPF support available for arm32 support?
> 
> TAP eBPF has a graceful approach: it must successfully compile on all Linux
> distributions. If a specific kernel cannot support eBPF it will gracefully
> refuse the eBPF netlink message sent to it. 
> Thus, there is no harm even if there is no eBPF support available for arm32.
> 
> You should enable TAP compilation for cases where you only need TAP without eBPF.

Ophir, please send a patch.
Jerin Jacob Jan. 31, 2018, 11:30 a.m. UTC | #5
-----Original Message-----
> Date: Wed, 31 Jan 2018 10:38:32 +0000
> From: Ophir Munk <ophirmu@mellanox.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: "dev@dpdk.org" <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>,
>  Pascal Mazon <pascal.mazon@6wind.com>, Jan Viktorin
>  <viktorin@rehivetech.com>, Jianbo Liu <jianbo.liu@arm.com>
> Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with ARM32
> 
> Hi,
> Please see inline
> 
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > Sent: Wednesday, January 31, 2018 12:24 PM
> > To: Ophir Munk <ophirmu@mellanox.com>
> > Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Pascal
> > Mazon <pascal.mazon@6wind.com>; Jan Viktorin
> > <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>
> > Subject: Re: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32
> > 
> > -----Original Message-----
> > > Date: Wed, 31 Jan 2018 09:59:45 +0000
> > > From: Ophir Munk <ophirmu@mellanox.com>
> > > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, "dev@dpdk.org"
> > >  <dev@dpdk.org>
> > > CC: Thomas Monjalon <thomas@monjalon.net>, Pascal Mazon
> > > <pascal.mazon@6wind.com>, Jan Viktorin <viktorin@rehivetech.com>,
> > > Jianbo  Liu <jianbo.liu@arm.com>
> > > Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with ARM32
> > >
> > > Hi,
> > > Please see comments inline
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> > > > Sent: Wednesday, January 31, 2018 7:14 AM
> > > > To: dev@dpdk.org
> > > > Cc: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob
> > > > <jerin.jacob@caviumnetworks.com>; Pascal Mazon
> > > > <pascal.mazon@6wind.com>; Jan Viktorin <viktorin@rehivetech.com>;
> > > > Jianbo Liu <jianbo.liu@arm.com>
> > > > Subject: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32
> > > >
> > > > arm32 Linux does not support eBPF interface.
> > > > Since tap PMD driver has a dependency on eBPF(the symbol __NR_bpf),
> > > > disabling it armv7 config.
> > > >
> > > > compilation error log:
> > > > In file included from /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:15:0:
> > > > /tmp/dpdk/drivers/net/tap/tap_bpf.h:103:4: error: #error __NR_bpf
> > > > not defined  #  error __NR_bpf not defined
> > > >     ^
> > >
> > > arm architecture is missing is file drivers/tap/tap_bpf.h I suggest
> > > adding it, for example
> > >
> > > # elif defined(__arm__)
> > > #  define __NR_bpf 386
> > 
> > By looking at Linux source code
> > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Felixi
> > r.free-
> > electrons.com%2Flinux%2Fv4.15%2Fsource%2Ftools%2Fbuild%2Ffeature%2
> > Ftest-
> > bpf.c%23L6&data=02%7C01%7Cophirmu%40mellanox.com%7C19f50ad7f27
> > 34d00173808d56894c997%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%
> > 7C0%7C636529910613736017&sdata=ynsxHG9fvao4LyfWLo4GVJjlKNmcF0q
> > 0BkFocJyarAE%3D&reserved=0
> > I am not sure, Is eBPF support available for arm32 support?
> 
> TAP eBPF has a graceful approach: it must successfully compile on all Linux
> distributions. If a specific kernel cannot support eBPF it will gracefully
> refuse the eBPF netlink message sent to it. 
> Thus, there is no harm even if there is no eBPF support available for arm32.

OK. But, To enable grace full refuse, we should not any random system call number like #define __NR_bpf 386.
It should at least unused for arm32.

> 
> You should enable TAP compilation for cases where you only need TAP without eBPF.

Yes. It would have been better if new eBPF depended features would have
under conditional compilation flag so it it can be turned off selectively.

> 
> > 
> > >
> > > It should work for you. Can you please try it?
> > 
> > I don't have access to an arm32 board. I was facing cross compilation build
> > issue with arm32.
> > 
> > > If it doesn't work for you, please have a look in this link:
> > >
> > >
> > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou
> > >
> > rceforge.net%2Fp%2Fpredef%2Fwiki%2FArchitectures%2F&data=02%7C01%
> > 7Coph
> > >
> > irmu%40mellanox.com%7C19f50ad7f2734d00173808d56894c997%7Ca6529
> > 71c7d2e4
> > >
> > d9ba6a4d149256f461b%7C0%7C0%7C636529910613736017&sdata=g5fEkG
> > Gwm%2BJgR
> > > KyDrxJgbFII0%2B1%2BxtbT%2FE4Qy1HACEg%3D&reserved=0
> > > where you can see more arm architecture definitions.
> > > You should find the one suitable for you.
> > 
> > I guess, it is not just matter of enabling the build for arm32. It should work at
> > runtime too, If some can confirm following addition in the
> > drivers/net/tap/tap_bpf.h works then we can add it.
> > 
> 
> As mentioned above it must not work at runtime too.
> 
> > # elif defined(__arm__)
> > #  define __NR_bpf 386
> > 
> > >
> > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c: In function ‘sys_bpf’:
> > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: error: ‘__NR_bpf’
> > > > undeclared (first use in this function)
> > > >   return syscall(__NR_bpf, cmd, attr, size);
> > > >                  ^
> > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: note: each undeclared
> > > > identifier is reported only once for each function it appears in
> > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:93:1: error: control reaches
> > > > end of non-void function [-Werror=return-type]  }  ^
> > > > cc1: all warnings being treated as errors
> > > >
> > > > Fixes: b02d85e1 ("net/tap: add eBPF API")
> > > >
> > > > Cc: Pascal Mazon <pascal.mazon@6wind.com>
> > > > Cc: Jan Viktorin <viktorin@rehivetech.com>
> > > > Cc: Jianbo Liu <jianbo.liu@arm.com>
> > > >
> > > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > > > ---
> > > >  config/defconfig_arm-armv7a-linuxapp-gcc | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/config/defconfig_arm-armv7a-linuxapp-gcc
> > > > b/config/defconfig_arm-armv7a-linuxapp-gcc
> > > > index a20b7a85f..4a55bb397 100644
> > > > --- a/config/defconfig_arm-armv7a-linuxapp-gcc
> > > > +++ b/config/defconfig_arm-armv7a-linuxapp-gcc
> > > > @@ -80,3 +80,4 @@ CONFIG_RTE_LIBRTE_BNX2X_PMD=n
> > > > CONFIG_RTE_LIBRTE_QEDE_PMD=n
> > CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
> > > > CONFIG_RTE_LIBRTE_AVP_PMD=n
> > > > +CONFIG_RTE_LIBRTE_PMD_TAP=n
> > > > --
> > >
> > > I suggest fixing the compilation issue by adding the missing
> > > architecture system call number (as suggested above) instead of
> > > disabling TAP compilation by default
> > >
> > > > 2.16.1
> > >
Ophir Munk Jan. 31, 2018, 11:57 a.m. UTC | #6
> -----Original Message-----

> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]

> Sent: Wednesday, January 31, 2018 1:31 PM

> To: Ophir Munk <ophirmu@mellanox.com>

> Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Pascal

> Mazon <pascal.mazon@6wind.com>; Jan Viktorin

> <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>

> Subject: Re: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32

> 

> -----Original Message-----

> > Date: Wed, 31 Jan 2018 10:38:32 +0000

> > From: Ophir Munk <ophirmu@mellanox.com>

> > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> > CC: "dev@dpdk.org" <dev@dpdk.org>, Thomas Monjalon

> > <thomas@monjalon.net>,  Pascal Mazon <pascal.mazon@6wind.com>,

> Jan

> > Viktorin  <viktorin@rehivetech.com>, Jianbo Liu <jianbo.liu@arm.com>

> > Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with ARM32

> >

> > Hi,

> > Please see inline

> >

> > > -----Original Message-----

> > > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]

> > > Sent: Wednesday, January 31, 2018 12:24 PM

> > > To: Ophir Munk <ophirmu@mellanox.com>

> > > Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Pascal

> > > Mazon <pascal.mazon@6wind.com>; Jan Viktorin

> > > <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>

> > > Subject: Re: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32

> > >

> > > -----Original Message-----

> > > > Date: Wed, 31 Jan 2018 09:59:45 +0000

> > > > From: Ophir Munk <ophirmu@mellanox.com>

> > > > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, "dev@dpdk.org"

> > > >  <dev@dpdk.org>

> > > > CC: Thomas Monjalon <thomas@monjalon.net>, Pascal Mazon

> > > > <pascal.mazon@6wind.com>, Jan Viktorin <viktorin@rehivetech.com>,

> > > > Jianbo  Liu <jianbo.liu@arm.com>

> > > > Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with

> > > > ARM32

> > > >

> > > > Hi,

> > > > Please see comments inline

> > > >

> > > > > -----Original Message-----

> > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob

> > > > > Sent: Wednesday, January 31, 2018 7:14 AM

> > > > > To: dev@dpdk.org

> > > > > Cc: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob

> > > > > <jerin.jacob@caviumnetworks.com>; Pascal Mazon

> > > > > <pascal.mazon@6wind.com>; Jan Viktorin

> > > > > <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>

> > > > > Subject: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32

> > > > >

> > > > > arm32 Linux does not support eBPF interface.

> > > > > Since tap PMD driver has a dependency on eBPF(the symbol

> > > > > __NR_bpf), disabling it armv7 config.

> > > > >

> > > > > compilation error log:

> > > > > In file included from /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:15:0:

> > > > > /tmp/dpdk/drivers/net/tap/tap_bpf.h:103:4: error: #error

> > > > > __NR_bpf not defined  #  error __NR_bpf not defined

> > > > >     ^

> > > >

> > > > arm architecture is missing is file drivers/tap/tap_bpf.h I

> > > > suggest adding it, for example

> > > >

> > > > # elif defined(__arm__)

> > > > #  define __NR_bpf 386

> > >

> > > By looking at Linux source code

> > >

> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fel

> > > ixi

> > > r.free-

> > >

> electrons.com%2Flinux%2Fv4.15%2Fsource%2Ftools%2Fbuild%2Ffeature%2

> > > Ftest-

> > >

> bpf.c%23L6&data=02%7C01%7Cophirmu%40mellanox.com%7C19f50ad7f27

> > >

> 34d00173808d56894c997%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%

> > >

> 7C0%7C636529910613736017&sdata=ynsxHG9fvao4LyfWLo4GVJjlKNmcF0q

> > > 0BkFocJyarAE%3D&reserved=0

> > > I am not sure, Is eBPF support available for arm32 support?

> >

> > TAP eBPF has a graceful approach: it must successfully compile on all

> > Linux distributions. If a specific kernel cannot support eBPF it will

> > gracefully refuse the eBPF netlink message sent to it.

> > Thus, there is no harm even if there is no eBPF support available for arm32.

> 

> OK. But, To enable grace full refuse, we should not any random system call

> number like #define __NR_bpf 386.

> It should at least unused for arm32.

> 


For arm - system call 386 seems to be used only for eBPF
http://elixir.free-electrons.com/linux/v4.15/source/arch/arm64/include/asm/unistd32.h#L796


> >

> > You should enable TAP compilation for cases where you only need TAP

> without eBPF.

> 

> Yes. It would have been better if new eBPF depended features would have

> under conditional compilation flag so it it can be turned off selectively.

> 


I am in favor of keeping configuration as simple as possible if possible.
I will issue a PR which includes arm BPF definition

> >

> > >

> > > >

> > > > It should work for you. Can you please try it?

> > >

> > > I don't have access to an arm32 board. I was facing cross

> > > compilation build issue with arm32.

> > >

> > > > If it doesn't work for you, please have a look in this link:

> > > >

> > > >

> > >

> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fs

> > > ou

> > > >

> > >

> rceforge.net%2Fp%2Fpredef%2Fwiki%2FArchitectures%2F&data=02%7C01%

> > > 7Coph

> > > >

> > >

> irmu%40mellanox.com%7C19f50ad7f2734d00173808d56894c997%7Ca6529

> > > 71c7d2e4

> > > >

> > >

> d9ba6a4d149256f461b%7C0%7C0%7C636529910613736017&sdata=g5fEkG

> > > Gwm%2BJgR

> > > > KyDrxJgbFII0%2B1%2BxtbT%2FE4Qy1HACEg%3D&reserved=0

> > > > where you can see more arm architecture definitions.

> > > > You should find the one suitable for you.

> > >

> > > I guess, it is not just matter of enabling the build for arm32. It

> > > should work at runtime too, If some can confirm following addition

> > > in the drivers/net/tap/tap_bpf.h works then we can add it.

> > >

> >

> > As mentioned above it must not work at runtime too.

> >

> > > # elif defined(__arm__)

> > > #  define __NR_bpf 386

> > >

> > > >

> > > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c: In function ‘sys_bpf’:

> > > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: error: ‘__NR_bpf’

> > > > > undeclared (first use in this function)

> > > > >   return syscall(__NR_bpf, cmd, attr, size);

> > > > >                  ^

> > > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:92:17: note: each

> > > > > undeclared identifier is reported only once for each function it

> > > > > appears in

> > > > > /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:93:1: error: control

> > > > > reaches end of non-void function [-Werror=return-type]  }  ^

> > > > > cc1: all warnings being treated as errors

> > > > >

> > > > > Fixes: b02d85e1 ("net/tap: add eBPF API")

> > > > >

> > > > > Cc: Pascal Mazon <pascal.mazon@6wind.com>

> > > > > Cc: Jan Viktorin <viktorin@rehivetech.com>

> > > > > Cc: Jianbo Liu <jianbo.liu@arm.com>

> > > > >

> > > > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> > > > > ---

> > > > >  config/defconfig_arm-armv7a-linuxapp-gcc | 1 +

> > > > >  1 file changed, 1 insertion(+)

> > > > >

> > > > > diff --git a/config/defconfig_arm-armv7a-linuxapp-gcc

> > > > > b/config/defconfig_arm-armv7a-linuxapp-gcc

> > > > > index a20b7a85f..4a55bb397 100644

> > > > > --- a/config/defconfig_arm-armv7a-linuxapp-gcc

> > > > > +++ b/config/defconfig_arm-armv7a-linuxapp-gcc

> > > > > @@ -80,3 +80,4 @@ CONFIG_RTE_LIBRTE_BNX2X_PMD=n

> > > > > CONFIG_RTE_LIBRTE_QEDE_PMD=n

> > > CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n

> > > > > CONFIG_RTE_LIBRTE_AVP_PMD=n

> > > > > +CONFIG_RTE_LIBRTE_PMD_TAP=n

> > > > > --

> > > >

> > > > I suggest fixing the compilation issue by adding the missing

> > > > architecture system call number (as suggested above) instead of

> > > > disabling TAP compilation by default

> > > >

> > > > > 2.16.1

> > > >
Jerin Jacob Jan. 31, 2018, 12:40 p.m. UTC | #7
-----Original Message-----
> Date: Wed, 31 Jan 2018 11:57:10 +0000
> From: Ophir Munk <ophirmu@mellanox.com>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> CC: "dev@dpdk.org" <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>,
>  Pascal Mazon <pascal.mazon@6wind.com>, Jan Viktorin
>  <viktorin@rehivetech.com>, Jianbo Liu <jianbo.liu@arm.com>
> Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with ARM32
> 
> 
> 
> > -----Original Message-----
> > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > Sent: Wednesday, January 31, 2018 1:31 PM
> > To: Ophir Munk <ophirmu@mellanox.com>
> > Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Pascal
> > Mazon <pascal.mazon@6wind.com>; Jan Viktorin
> > <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>
> > Subject: Re: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32
> > 
> > -----Original Message-----
> > > Date: Wed, 31 Jan 2018 10:38:32 +0000
> > > From: Ophir Munk <ophirmu@mellanox.com>
> > > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > > CC: "dev@dpdk.org" <dev@dpdk.org>, Thomas Monjalon
> > > <thomas@monjalon.net>,  Pascal Mazon <pascal.mazon@6wind.com>,
> > Jan
> > > Viktorin  <viktorin@rehivetech.com>, Jianbo Liu <jianbo.liu@arm.com>
> > > Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with ARM32
> > >
> > > Hi,
> > > Please see inline
> > >
> > > > -----Original Message-----
> > > > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > > > Sent: Wednesday, January 31, 2018 12:24 PM
> > > > To: Ophir Munk <ophirmu@mellanox.com>
> > > > Cc: dev@dpdk.org; Thomas Monjalon <thomas@monjalon.net>; Pascal
> > > > Mazon <pascal.mazon@6wind.com>; Jan Viktorin
> > > > <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>
> > > > Subject: Re: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32
> > > >
> > > > -----Original Message-----
> > > > > Date: Wed, 31 Jan 2018 09:59:45 +0000
> > > > > From: Ophir Munk <ophirmu@mellanox.com>
> > > > > To: Jerin Jacob <jerin.jacob@caviumnetworks.com>, "dev@dpdk.org"
> > > > >  <dev@dpdk.org>
> > > > > CC: Thomas Monjalon <thomas@monjalon.net>, Pascal Mazon
> > > > > <pascal.mazon@6wind.com>, Jan Viktorin <viktorin@rehivetech.com>,
> > > > > Jianbo  Liu <jianbo.liu@arm.com>
> > > > > Subject: RE: [dpdk-dev]  [PATCH] net/tap: fix build issue with
> > > > > ARM32
> > > > >
> > > > > Hi,
> > > > > Please see comments inline
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> > > > > > Sent: Wednesday, January 31, 2018 7:14 AM
> > > > > > To: dev@dpdk.org
> > > > > > Cc: Thomas Monjalon <thomas@monjalon.net>; Jerin Jacob
> > > > > > <jerin.jacob@caviumnetworks.com>; Pascal Mazon
> > > > > > <pascal.mazon@6wind.com>; Jan Viktorin
> > > > > > <viktorin@rehivetech.com>; Jianbo Liu <jianbo.liu@arm.com>
> > > > > > Subject: [dpdk-dev] [PATCH] net/tap: fix build issue with ARM32
> > > > > >
> > > > > > arm32 Linux does not support eBPF interface.
> > > > > > Since tap PMD driver has a dependency on eBPF(the symbol
> > > > > > __NR_bpf), disabling it armv7 config.
> > > > > >
> > > > > > compilation error log:
> > > > > > In file included from /tmp/dpdk/drivers/net/tap/tap_bpf_api.c:15:0:
> > > > > > /tmp/dpdk/drivers/net/tap/tap_bpf.h:103:4: error: #error
> > > > > > __NR_bpf not defined  #  error __NR_bpf not defined
> > > > > >     ^
> > > > >
> > > > > arm architecture is missing is file drivers/tap/tap_bpf.h I
> > > > > suggest adding it, for example
> > > > >
> > > > > # elif defined(__arm__)
> > > > > #  define __NR_bpf 386
> > > >
> > > > By looking at Linux source code
> > > >
> > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fel
> > > > ixi
> > > > r.free-
> > > >
> > electrons.com%2Flinux%2Fv4.15%2Fsource%2Ftools%2Fbuild%2Ffeature%2
> > > > Ftest-
> > > >
> > bpf.c%23L6&data=02%7C01%7Cophirmu%40mellanox.com%7C19f50ad7f27
> > > >
> > 34d00173808d56894c997%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%
> > > >
> > 7C0%7C636529910613736017&sdata=ynsxHG9fvao4LyfWLo4GVJjlKNmcF0q
> > > > 0BkFocJyarAE%3D&reserved=0
> > > > I am not sure, Is eBPF support available for arm32 support?
> > >
> > > TAP eBPF has a graceful approach: it must successfully compile on all
> > > Linux distributions. If a specific kernel cannot support eBPF it will
> > > gracefully refuse the eBPF netlink message sent to it.
> > > Thus, there is no harm even if there is no eBPF support available for arm32.
> > 
> > OK. But, To enable grace full refuse, we should not any random system call
> > number like #define __NR_bpf 386.
> > It should at least unused for arm32.
> > 
> 
> For arm - system call 386 seems to be used only for eBPF
> http://elixir.free-electrons.com/linux/v4.15/source/arch/arm64/include/asm/unistd32.h#L796
> 
> 
> > >
> > > You should enable TAP compilation for cases where you only need TAP
> > without eBPF.
> > 
> > Yes. It would have been better if new eBPF depended features would have
> > under conditional compilation flag so it it can be turned off selectively.
> > 
> 
> I am in favor of keeping configuration as simple as possible if possible.
> I will issue a PR which includes arm BPF definition

OK.

Looks like systemd is using the similar method.
https://github.com/systemd/systemd/blob/master/src/basic/missing_syscall.h#L334

Patch
diff mbox

diff --git a/config/defconfig_arm-armv7a-linuxapp-gcc b/config/defconfig_arm-armv7a-linuxapp-gcc
index a20b7a85f..4a55bb397 100644
--- a/config/defconfig_arm-armv7a-linuxapp-gcc
+++ b/config/defconfig_arm-armv7a-linuxapp-gcc
@@ -80,3 +80,4 @@  CONFIG_RTE_LIBRTE_BNX2X_PMD=n
 CONFIG_RTE_LIBRTE_QEDE_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_TAP=n