Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
There’s no dependency to netmap unless the user requests to use it with “--with-netmap-path” configure option. So, the switch is there (in this patch). -Petri From: EXT Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Thursday, October 08, 2015 9:01 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: EXT Ola Liljedahl; Elo, Matias (Nokia - FI/Espoo); LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support Are there any complications when packaging for deb / RPM, conceivably you want this to depend on netmap, but in many cases you dont want that. Should there be a configure switch to optionally create the packages with a dependency ? On 7 October 2015 at 13:47, Savolainen, Petri (Nokia - FI/Espoo) <petri.savolai...@nokia.com<mailto:petri.savolai...@nokia.com>> wrote: The odp-netmap was in practice this level of modification to linux-generic – just use netmap for packet io instead of sockets. If user has netmap installed, linux-generic utilizes it instead of sockets and we can get up to 5 Mpps per core (roughly 10x improvement to sockets). Linux-generic is more suitable for demos, testing, validation, etc with that kind of packet rate than with poor sockets. There are some small things to tune, optimize and simplify (e.g. usage of locks) in linux-generic which may give some more performance. -Petri From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org<mailto:lng-odp-boun...@lists.linaro.org>] On Behalf Of EXT Ola Liljedahl Sent: Wednesday, October 07, 2015 3:30 PM To: Elo, Matias (Nokia - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support ODP linux-generic is still a (s)low-performing reference implementation, even with better performing pktio. Do we want to change that and optimize linux-generic (and likely make it less suitable for its original purpose, how important is that) Or should we performance optimize ODP-netmap instead? -- Ola On 29 September 2015 at 08:28, Matias Elo <matias@nokia.com<mailto:matias@nokia.com>> wrote: Added new netmap pktio interface type which operates in the same manner as the existing socket io interfaces. The code is based on the odp-netmap branch. Using netmap io requires netmap headers and loaded netmap kernel module. Netmap can be installed from https://github.com/luigirizzo/netmap. ODP netmap support is enabled using --with-netmap-path= configuration option. If netmap kernel module is loaded when starting ODP application netmap io will be used by default. If the module is not found standard socket io is used. Netmap io can be disabled with ODP_PKTIO_DISABLE_NETMAP environment variable. Signed-off-by: Matias Elo <matias@nokia.com<mailto:matias@nokia.com>> --- configure.ac<http://configure.ac> | 44 +++ example/generator/odp_generator.c | 3 +- example/ipsec/odp_ipsec.c | 3 +- example/packet/odp_pktio.c | 3 +- platform/linux-generic/Makefile.am | 2 + .../linux-generic/include/odp_packet_io_internal.h | 3 + platform/linux-generic/include/odp_packet_netmap.h | 24 ++ platform/linux-generic/pktio/io_ops.c | 1 + platform/linux-generic/pktio/netmap.c | 331 + platform/linux-generic/pktio/socket.c | 4 + test/performance/odp_l2fwd.c | 3 +- 11 files changed, 417 insertions(+), 4 deletions(-) create mode 100644 platform/linux-generic/include/odp_packet_netmap.h create mode 100644 platform/linux-generic/pktio/netmap.c diff --git a/configure.ac<http://configure.ac> b/configure.ac<http://configure.ac> index 15dc6cf..67e2133 100644 --- a/configure.ac<http://configure.ac> +++ b/configure.ac<http://configure.ac> @@ -167,6 +167,30 @@ AC_ARG_ENABLE([test-cpp], AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ]) ## +# Enable netmap support +## +netmap_support=no +ODP_NETMAP=0 +AC_ARG_ENABLE([netmap_support], +[ --enable-netmap-support include netmap IO support], +[if test x$enableval = xyes; then +netmap_support=yes +ODP_NETMAP=1 +fi]) + +## +# Set optional netmap path +## +AC_ARG_WITH([netmap-path], +AC_HELP_STRING([--with-netmap-path=DIR path to netmap root directory], + [(or in the default path if not specified).]), +[NETMAP_PATH=$withval +AM_CPPFLAGS="$AM_CPPFLAGS -I$NETMAP_PATH/sys" +netmap_su
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
Hi Mike. I have read through this patch: I haven't dared marking it as reviewed as I am not sure about some part of it, especialy related to the build environment. The pktio part is very close to what I did when merging and looked fine to me. Also the debate regarding whether this should be merged (or not) in linux generic was still going on on the last ARCH call: I am not sure it is best (because I don't really see where the line should be drawn between the "reference goal" of the linux generic implementation and how much it should be optimised for performence. But I'll support this change now, as I want to make some progress! I think the next step is to see how this behave in CI: I expect it to run as fine as the normal linux-generic, but I will dig into it if lcov still fails. We already have a bug report for that. On 9 October 2015 at 08:25, Savolainen, Petri (Nokia - FI/Espoo) < petri.savolai...@nokia.com> wrote: > There’s no dependency to netmap unless the user requests to use it with > “--with-netmap-path” configure option. So, the switch is there (in this > patch). > > > > -Petri > > > > > > *From:* EXT Mike Holmes [mailto:mike.hol...@linaro.org] > *Sent:* Thursday, October 08, 2015 9:01 PM > *To:* Savolainen, Petri (Nokia - FI/Espoo) > *Cc:* EXT Ola Liljedahl; Elo, Matias (Nokia - FI/Espoo); LNG ODP Mailman > List > > *Subject:* Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap > pktio support > > > > Are there any complications when packaging for deb / RPM, conceivably you > want this to depend on netmap, but in many cases you dont want that. > > > > Should there be a configure switch to optionally create the packages with > a dependency ? > > > > On 7 October 2015 at 13:47, Savolainen, Petri (Nokia - FI/Espoo) < > petri.savolai...@nokia.com> wrote: > > The odp-netmap was in practice this level of modification to linux-generic > – just use netmap for packet io instead of sockets. If user has netmap > installed, linux-generic utilizes it instead of sockets and we can get up > to 5 Mpps per core (roughly 10x improvement to sockets). Linux-generic is > more suitable for demos, testing, validation, etc with that kind of packet > rate than with poor sockets. There are some small things to tune, optimize > and simplify (e.g. usage of locks) in linux-generic which may give some > more performance. > > > > -Petri > > > > > > *From:* lng-odp [mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of *EXT > Ola Liljedahl > *Sent:* Wednesday, October 07, 2015 3:30 PM > *To:* Elo, Matias (Nokia - FI/Espoo) > *Cc:* LNG ODP Mailman List > *Subject:* Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap > pktio support > > > > ODP linux-generic is still a (s)low-performing reference implementation, > even with better performing pktio. Do we want to change that and optimize > linux-generic (and likely make it less suitable for its original purpose, > how important is that) Or should we performance optimize ODP-netmap instead? > > > > -- Ola > > > > > > On 29 September 2015 at 08:28, Matias Elo <matias@nokia.com> wrote: > > Added new netmap pktio interface type which operates in the > same manner as the existing socket io interfaces. The code > is based on the odp-netmap branch. > > Using netmap io requires netmap headers and loaded netmap > kernel module. Netmap can be installed from > https://github.com/luigirizzo/netmap. ODP netmap support is > enabled using --with-netmap-path= configuration > option. > > If netmap kernel module is loaded when starting ODP > application netmap io will be used by default. If the module > is not found standard socket io is used. Netmap io can be > disabled with ODP_PKTIO_DISABLE_NETMAP environment variable. > > Signed-off-by: Matias Elo <matias@nokia.com> > --- > configure.ac | 44 +++ > example/generator/odp_generator.c | 3 +- > example/ipsec/odp_ipsec.c | 3 +- > example/packet/odp_pktio.c | 3 +- > platform/linux-generic/Makefile.am | 2 + > .../linux-generic/include/odp_packet_io_internal.h | 3 + > platform/linux-generic/include/odp_packet_netmap.h | 24 ++ > platform/linux-generic/pktio/io_ops.c | 1 + > platform/linux-generic/pktio/netmap.c | 331 > + > platform/linux-generic/pktio/socket.c | 4 + > test/performance/odp_l2fwd.c | 3 +- > 11 files changed, 417 insertions(+), 4 deletions(-) > create mode 100644 platform/linux-generic/include/odp_packet_netmap.h > create mo
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
This is same level of optimization than using mmap type sockets instead of basic sockets. It’s an alternative way to get packets into linux-generic. The optimization talk should start after this point (after packet receive from the network): how much we optimize SW classifier, how much SW queues, how much SW scheduler, … As said in the call, I don’t expect that linux-generic SW implementation is optimized to the last bit, just make sure that there’s no obvious performance (or code readability) bugs. For example, set / copy data only once (now we double init some packet header fields), use locks wisely (now we double lock sometimes), do conversions only ones (now we convert the same offset to the same pointer in every step it’s used), … The line should at: “follow good (multi-thread) programming practices”. Maybe linux-generic performance (with netmap) is around 30-50% of odp-dpdk performance (instead of 1% with sockets), which is already usable for early application development/testing (and it always has the latest API version supported). -Petri From: EXT Christophe Milard [mailto:christophe.mil...@linaro.org] Sent: Friday, October 09, 2015 9:58 AM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: EXT Mike Holmes; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support Hi Mike. I have read through this patch: I haven't dared marking it as reviewed as I am not sure about some part of it, especialy related to the build environment. The pktio part is very close to what I did when merging and looked fine to me. Also the debate regarding whether this should be merged (or not) in linux generic was still going on on the last ARCH call: I am not sure it is best (because I don't really see where the line should be drawn between the "reference goal" of the linux generic implementation and how much it should be optimised for performence. But I'll support this change now, as I want to make some progress! I think the next step is to see how this behave in CI: I expect it to run as fine as the normal linux-generic, but I will dig into it if lcov still fails. We already have a bug report for that. On 9 October 2015 at 08:25, Savolainen, Petri (Nokia - FI/Espoo) <petri.savolai...@nokia.com<mailto:petri.savolai...@nokia.com>> wrote: There’s no dependency to netmap unless the user requests to use it with “--with-netmap-path” configure option. So, the switch is there (in this patch). -Petri From: EXT Mike Holmes [mailto:mike.hol...@linaro.org<mailto:mike.hol...@linaro.org>] Sent: Thursday, October 08, 2015 9:01 PM To: Savolainen, Petri (Nokia - FI/Espoo) Cc: EXT Ola Liljedahl; Elo, Matias (Nokia - FI/Espoo); LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support Are there any complications when packaging for deb / RPM, conceivably you want this to depend on netmap, but in many cases you dont want that. Should there be a configure switch to optionally create the packages with a dependency ? On 7 October 2015 at 13:47, Savolainen, Petri (Nokia - FI/Espoo) <petri.savolai...@nokia.com<mailto:petri.savolai...@nokia.com>> wrote: The odp-netmap was in practice this level of modification to linux-generic – just use netmap for packet io instead of sockets. If user has netmap installed, linux-generic utilizes it instead of sockets and we can get up to 5 Mpps per core (roughly 10x improvement to sockets). Linux-generic is more suitable for demos, testing, validation, etc with that kind of packet rate than with poor sockets. There are some small things to tune, optimize and simplify (e.g. usage of locks) in linux-generic which may give some more performance. -Petri From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org<mailto:lng-odp-boun...@lists.linaro.org>] On Behalf Of EXT Ola Liljedahl Sent: Wednesday, October 07, 2015 3:30 PM To: Elo, Matias (Nokia - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support ODP linux-generic is still a (s)low-performing reference implementation, even with better performing pktio. Do we want to change that and optimize linux-generic (and likely make it less suitable for its original purpose, how important is that) Or should we performance optimize ODP-netmap instead? -- Ola On 29 September 2015 at 08:28, Matias Elo <matias@nokia.com<mailto:matias@nokia.com>> wrote: Added new netmap pktio interface type which operates in the same manner as the existing socket io interfaces. The code is based on the odp-netmap branch. Using netmap io requires netmap headers and loaded netmap kernel module. Netmap can be installed from https://github.com/luigirizzo/netmap. ODP netmap support is enabled using --with-netmap-path= configuration option. If netmap kernel module is loaded when starting ODP application netmap io will be used
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
Are there any complications when packaging for deb / RPM, conceivably you want this to depend on netmap, but in many cases you dont want that. Should there be a configure switch to optionally create the packages with a dependency ? On 7 October 2015 at 13:47, Savolainen, Petri (Nokia - FI/Espoo) < petri.savolai...@nokia.com> wrote: > The odp-netmap was in practice this level of modification to linux-generic > – just use netmap for packet io instead of sockets. If user has netmap > installed, linux-generic utilizes it instead of sockets and we can get up > to 5 Mpps per core (roughly 10x improvement to sockets). Linux-generic is > more suitable for demos, testing, validation, etc with that kind of packet > rate than with poor sockets. There are some small things to tune, optimize > and simplify (e.g. usage of locks) in linux-generic which may give some > more performance. > > > > -Petri > > > > > > *From:* lng-odp [mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of *EXT > Ola Liljedahl > *Sent:* Wednesday, October 07, 2015 3:30 PM > *To:* Elo, Matias (Nokia - FI/Espoo) > *Cc:* LNG ODP Mailman List > *Subject:* Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap > pktio support > > > > ODP linux-generic is still a (s)low-performing reference implementation, > even with better performing pktio. Do we want to change that and optimize > linux-generic (and likely make it less suitable for its original purpose, > how important is that) Or should we performance optimize ODP-netmap instead? > > > > -- Ola > > > > > > On 29 September 2015 at 08:28, Matias Elo <matias@nokia.com> wrote: > > Added new netmap pktio interface type which operates in the > same manner as the existing socket io interfaces. The code > is based on the odp-netmap branch. > > Using netmap io requires netmap headers and loaded netmap > kernel module. Netmap can be installed from > https://github.com/luigirizzo/netmap. ODP netmap support is > enabled using --with-netmap-path= configuration > option. > > If netmap kernel module is loaded when starting ODP > application netmap io will be used by default. If the module > is not found standard socket io is used. Netmap io can be > disabled with ODP_PKTIO_DISABLE_NETMAP environment variable. > > Signed-off-by: Matias Elo <matias@nokia.com> > --- > configure.ac | 44 +++ > example/generator/odp_generator.c | 3 +- > example/ipsec/odp_ipsec.c | 3 +- > example/packet/odp_pktio.c | 3 +- > platform/linux-generic/Makefile.am | 2 + > .../linux-generic/include/odp_packet_io_internal.h | 3 + > platform/linux-generic/include/odp_packet_netmap.h | 24 ++ > platform/linux-generic/pktio/io_ops.c | 1 + > platform/linux-generic/pktio/netmap.c | 331 > + > platform/linux-generic/pktio/socket.c | 4 + > test/performance/odp_l2fwd.c | 3 +- > 11 files changed, 417 insertions(+), 4 deletions(-) > create mode 100644 platform/linux-generic/include/odp_packet_netmap.h > create mode 100644 platform/linux-generic/pktio/netmap.c > > diff --git a/configure.ac b/configure.ac > index 15dc6cf..67e2133 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -167,6 +167,30 @@ AC_ARG_ENABLE([test-cpp], > AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ]) > > ## > +# Enable netmap support > +## > +netmap_support=no > +ODP_NETMAP=0 > +AC_ARG_ENABLE([netmap_support], > +[ --enable-netmap-support include netmap IO support], > +[if test x$enableval = xyes; then > +netmap_support=yes > +ODP_NETMAP=1 > +fi]) > + > +## > +# Set optional netmap path > +## > +AC_ARG_WITH([netmap-path], > +AC_HELP_STRING([--with-netmap-path=DIR path to netmap root directory], > + [(or in the default path if not specified).]), > +[NETMAP_PATH=$withval > +AM_CPPFLAGS="$AM_CPPFLAGS -I$NETMAP_PATH/sys" > +netmap_support=yes > +ODP_NETMAP=1],[]) > +ODP_CFLAGS="$ODP_CFLAGS -DODP_NETMAP=$ODP_NETMAP" > + > +## > # Set optional CUnit path > ## > AC_ARG_WITH([cu
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
The odp-netmap was in practice this level of modification to linux-generic – just use netmap for packet io instead of sockets. If user has netmap installed, linux-generic utilizes it instead of sockets and we can get up to 5 Mpps per core (roughly 10x improvement to sockets). Linux-generic is more suitable for demos, testing, validation, etc with that kind of packet rate than with poor sockets. There are some small things to tune, optimize and simplify (e.g. usage of locks) in linux-generic which may give some more performance. -Petri From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT Ola Liljedahl Sent: Wednesday, October 07, 2015 3:30 PM To: Elo, Matias (Nokia - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support ODP linux-generic is still a (s)low-performing reference implementation, even with better performing pktio. Do we want to change that and optimize linux-generic (and likely make it less suitable for its original purpose, how important is that) Or should we performance optimize ODP-netmap instead? -- Ola On 29 September 2015 at 08:28, Matias Elo <matias@nokia.com<mailto:matias@nokia.com>> wrote: Added new netmap pktio interface type which operates in the same manner as the existing socket io interfaces. The code is based on the odp-netmap branch. Using netmap io requires netmap headers and loaded netmap kernel module. Netmap can be installed from https://github.com/luigirizzo/netmap. ODP netmap support is enabled using --with-netmap-path= configuration option. If netmap kernel module is loaded when starting ODP application netmap io will be used by default. If the module is not found standard socket io is used. Netmap io can be disabled with ODP_PKTIO_DISABLE_NETMAP environment variable. Signed-off-by: Matias Elo <matias@nokia.com<mailto:matias@nokia.com>> --- configure.ac<http://configure.ac> | 44 +++ example/generator/odp_generator.c | 3 +- example/ipsec/odp_ipsec.c | 3 +- example/packet/odp_pktio.c | 3 +- platform/linux-generic/Makefile.am | 2 + .../linux-generic/include/odp_packet_io_internal.h | 3 + platform/linux-generic/include/odp_packet_netmap.h | 24 ++ platform/linux-generic/pktio/io_ops.c | 1 + platform/linux-generic/pktio/netmap.c | 331 + platform/linux-generic/pktio/socket.c | 4 + test/performance/odp_l2fwd.c | 3 +- 11 files changed, 417 insertions(+), 4 deletions(-) create mode 100644 platform/linux-generic/include/odp_packet_netmap.h create mode 100644 platform/linux-generic/pktio/netmap.c diff --git a/configure.ac<http://configure.ac> b/configure.ac<http://configure.ac> index 15dc6cf..67e2133 100644 --- a/configure.ac<http://configure.ac> +++ b/configure.ac<http://configure.ac> @@ -167,6 +167,30 @@ AC_ARG_ENABLE([test-cpp], AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ]) ## +# Enable netmap support +## +netmap_support=no +ODP_NETMAP=0 +AC_ARG_ENABLE([netmap_support], +[ --enable-netmap-support include netmap IO support], +[if test x$enableval = xyes; then +netmap_support=yes +ODP_NETMAP=1 +fi]) + +## +# Set optional netmap path +## +AC_ARG_WITH([netmap-path], +AC_HELP_STRING([--with-netmap-path=DIR path to netmap root directory], + [(or in the default path if not specified).]), +[NETMAP_PATH=$withval +AM_CPPFLAGS="$AM_CPPFLAGS -I$NETMAP_PATH/sys" +netmap_support=yes +ODP_NETMAP=1],[]) +ODP_CFLAGS="$ODP_CFLAGS -DODP_NETMAP=$ODP_NETMAP" + +## # Set optional CUnit path ## AC_ARG_WITH([cunit-path], @@ -257,6 +281,19 @@ fi AM_CONDITIONAL([cunit_support], [test x$cunit_support = xyes ]) ## +# Check for netmap availability +## +if test x$netmap_support = xyes +then +AC_CHECK_HEADERS([net/netmap_user.h], [], +[AC_MSG_FAILURE(["can't find netmap header"])]) +else +netmap_support=no +fi + +AM_CONDITIONAL([netmap_support], [test x$netmap_support = xyes ]) + +## # Restore old saved variables ##
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
ODP linux-generic is still a (s)low-performing reference implementation, even with better performing pktio. Do we want to change that and optimize linux-generic (and likely make it less suitable for its original purpose, how important is that) Or should we performance optimize ODP-netmap instead? -- Ola On 29 September 2015 at 08:28, Matias Elowrote: > Added new netmap pktio interface type which operates in the > same manner as the existing socket io interfaces. The code > is based on the odp-netmap branch. > > Using netmap io requires netmap headers and loaded netmap > kernel module. Netmap can be installed from > https://github.com/luigirizzo/netmap. ODP netmap support is > enabled using --with-netmap-path= configuration > option. > > If netmap kernel module is loaded when starting ODP > application netmap io will be used by default. If the module > is not found standard socket io is used. Netmap io can be > disabled with ODP_PKTIO_DISABLE_NETMAP environment variable. > > Signed-off-by: Matias Elo > --- > configure.ac | 44 +++ > example/generator/odp_generator.c | 3 +- > example/ipsec/odp_ipsec.c | 3 +- > example/packet/odp_pktio.c | 3 +- > platform/linux-generic/Makefile.am | 2 + > .../linux-generic/include/odp_packet_io_internal.h | 3 + > platform/linux-generic/include/odp_packet_netmap.h | 24 ++ > platform/linux-generic/pktio/io_ops.c | 1 + > platform/linux-generic/pktio/netmap.c | 331 > + > platform/linux-generic/pktio/socket.c | 4 + > test/performance/odp_l2fwd.c | 3 +- > 11 files changed, 417 insertions(+), 4 deletions(-) > create mode 100644 platform/linux-generic/include/odp_packet_netmap.h > create mode 100644 platform/linux-generic/pktio/netmap.c > > diff --git a/configure.ac b/configure.ac > index 15dc6cf..67e2133 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -167,6 +167,30 @@ AC_ARG_ENABLE([test-cpp], > AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ]) > > ## > +# Enable netmap support > +## > +netmap_support=no > +ODP_NETMAP=0 > +AC_ARG_ENABLE([netmap_support], > +[ --enable-netmap-support include netmap IO support], > +[if test x$enableval = xyes; then > +netmap_support=yes > +ODP_NETMAP=1 > +fi]) > + > +## > +# Set optional netmap path > +## > +AC_ARG_WITH([netmap-path], > +AC_HELP_STRING([--with-netmap-path=DIR path to netmap root directory], > + [(or in the default path if not specified).]), > +[NETMAP_PATH=$withval > +AM_CPPFLAGS="$AM_CPPFLAGS -I$NETMAP_PATH/sys" > +netmap_support=yes > +ODP_NETMAP=1],[]) > +ODP_CFLAGS="$ODP_CFLAGS -DODP_NETMAP=$ODP_NETMAP" > + > +## > # Set optional CUnit path > ## > AC_ARG_WITH([cunit-path], > @@ -257,6 +281,19 @@ fi > AM_CONDITIONAL([cunit_support], [test x$cunit_support = xyes ]) > > ## > +# Check for netmap availability > +## > +if test x$netmap_support = xyes > +then > +AC_CHECK_HEADERS([net/netmap_user.h], [], > +[AC_MSG_FAILURE(["can't find netmap header"])]) > +else > +netmap_support=no > +fi > + > +AM_CONDITIONAL([netmap_support], [test x$netmap_support = xyes ]) > + > +## > # Restore old saved variables > ## > LDFLAGS=$OLD_LDFLAGS > @@ -271,6 +308,12 @@ ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs > -Wcast-qual -Wformat-nonli > ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings" > ODP_CFLAGS="$ODP_CFLAGS -std=c99" > > +# Disable cast errors until the problem in netmap_user.h is fixed upstream > +if test x$netmap_support = xyes > +then > +ODP_CFLAGS="$ODP_CFLAGS -Wno-cast-qual" > +fi > + > ## > # Default include setup > ## > @@ -354,6 +397,7 @@ AC_MSG_RESULT([ > am_ldflags: ${AM_LDFLAGS} > libs: ${LIBS} > cunit: ${cunit_support} > + netmap: ${netmap_support} > test_vald:
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
On 09/29/15 09:57, Nicolas Morey-Chaisemartin wrote: --- a/platform/linux-generic/include/odp_packet_io_internal.h >+++ b/platform/linux-generic/include/odp_packet_io_internal.h >@@ -20,6 +20,7 @@ extern "C" { > > #include > #include >+#include > #include > #include > #include >@@ -49,6 +50,7 @@ struct pktio_entry { >pkt_sock_t pkt_sock;/**< using socket API for IO */ >pkt_sock_mmap_t pkt_sock_mmap; /**< using socket mmap > * API for IO */ >+ pkt_netmap_t pkt_nm;/**< using netmap API for IO */ >}; >enum { >STATE_START = 0, it looks like all pkt_ should be under union{}. Maxim. ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
They are already inside an union. Patch just doesn't include those lines. -Matias > -Original Message- > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT Maxim > Uvarov > Sent: Tuesday, September 29, 2015 12:56 PM > To: lng-odp@lists.linaro.org > Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio > support > > On 09/29/15 09:57, Nicolas Morey-Chaisemartin wrote: > > --- a/platform/linux-generic/include/odp_packet_io_internal.h > > >+++ b/platform/linux-generic/include/odp_packet_io_internal.h > > >@@ -20,6 +20,7 @@ extern "C" { > > > > > > #include > > > #include > > >+#include > > > #include > > > #include > > > #include > > >@@ -49,6 +50,7 @@ struct pktio_entry { > > > pkt_sock_t pkt_sock;/**< using socket API for IO */ > > > pkt_sock_mmap_t pkt_sock_mmap; /**< using socket mmap > > >* API for IO */ > > >+ pkt_netmap_t pkt_nm;/**< using netmap API > for IO */ > > > }; > > > enum { > > > STATE_START = 0, > > it looks like all pkt_ should be under union{}. > > Maxim. > ___ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
On 09/29/15 09:57, Nicolas Morey-Chaisemartin wrote: --- a/platform/linux-generic/pktio/socket.c >+++ b/platform/linux-generic/pktio/socket.c >@@ -91,6 +91,7 @@ int sendmmsg(int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags) > /** > * ODP_PACKET_SOCKET_MMSG: > * ODP_PACKET_SOCKET_MMAP: >+ * ODP_PACKET_NETMAP: > */ > int mac_addr_get_fd(int fd, const char *name, unsigned char mac_dst[]) > { >@@ -115,6 +116,7 @@ int mac_addr_get_fd(int fd, const char *name, unsigned char mac_dst[]) > /* > * ODP_PACKET_SOCKET_MMSG: > * ODP_PACKET_SOCKET_MMAP: >+ * ODP_PACKET_NETMAP: > */ > int mtu_get_fd(int fd, const char *name) > { >@@ -133,6 +135,7 @@ int mtu_get_fd(int fd, const char *name) > /* > * ODP_PACKET_SOCKET_MMSG: > * ODP_PACKET_SOCKET_MMAP: >+ * ODP_PACKET_NETMAP: > */ > int promisc_mode_set_fd(int fd, const char *name, int enable) > { >@@ -162,6 +165,7 @@ int promisc_mode_set_fd(int fd, const char *name, int enable) > /* > * ODP_PACKET_SOCKET_MMSG: > * ODP_PACKET_SOCKET_MMAP: >+ * ODP_PACKET_NETMAP: Does somebody need that comments above? I would like to remove them and add some description on top of that file. Maxim. ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
On 09/29/15 09:57, Nicolas Morey-Chaisemartin wrote: +#else /* ODP_NETMAP == 0 */ >+ >+/* >+ * Dummy function to enable ODP build without netmap support >+ */ >+static int netmap_open(odp_pktio_t id ODP_UNUSED, >+ pktio_entry_t *pktio_entry ODP_UNUSED, >+ const char *devname ODP_UNUSED, >+ odp_pool_t pool ODP_UNUSED) >+{ >+ return -1; >+} >+ >+const pktio_if_ops_t netmap_pktio_ops = { >+ .open = netmap_open, >+}; >+ That block also not needed. You should set ifdef in previous patch: const pktio_if_ops_t * const pktio_if_ops[] = { _pktio_ops, #ifdef ODP_NETMAP + _pktio_ops, #endif _mmap_pktio_ops, _mmsg_pktio_ops, ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
I think now we need to use prefixes name for pktio and avoid exports. The same as Stuart did for pcap. For netmap it will be something like: netmap:eth0 Maxim. On 09/29/15 09:57, Nicolas Morey-Chaisemartin wrote: On 09/29/2015 08:28 AM, Matias Elo wrote: Added new netmap pktio interface type which operates in the same manner as the existing socket io interfaces. The code is based on the odp-netmap branch. Using netmap io requires netmap headers and loaded netmap kernel module. Netmap can be installed from https://github.com/luigirizzo/netmap. ODP netmap support is enabled using --with-netmap-path= configuration option. If netmap kernel module is loaded when starting ODP application netmap io will be used by default. If the module is not found standard socket io is used. Netmap io can be disabled with ODP_PKTIO_DISABLE_NETMAP environment variable. Signed-off-by: Matias Elo--- configure.ac | 44 +++ example/generator/odp_generator.c | 3 +- example/ipsec/odp_ipsec.c | 3 +- example/packet/odp_pktio.c | 3 +- platform/linux-generic/Makefile.am | 2 + .../linux-generic/include/odp_packet_io_internal.h | 3 + platform/linux-generic/include/odp_packet_netmap.h | 24 ++ platform/linux-generic/pktio/io_ops.c | 1 + platform/linux-generic/pktio/netmap.c | 331 + platform/linux-generic/pktio/socket.c | 4 + test/performance/odp_l2fwd.c | 3 +- 11 files changed, 417 insertions(+), 4 deletions(-) create mode 100644 platform/linux-generic/include/odp_packet_netmap.h create mode 100644 platform/linux-generic/pktio/netmap.c diff --git a/configure.ac b/configure.ac index 15dc6cf..67e2133 100644 --- a/configure.ac +++ b/configure.ac @@ -167,6 +167,30 @@ AC_ARG_ENABLE([test-cpp], AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ]) ## +# Enable netmap support +## +netmap_support=no +ODP_NETMAP=0 +AC_ARG_ENABLE([netmap_support], +[ --enable-netmap-support include netmap IO support], +[if test x$enableval = xyes; then +netmap_support=yes +ODP_NETMAP=1 +fi]) + +## +# Set optional netmap path +## +AC_ARG_WITH([netmap-path], +AC_HELP_STRING([--with-netmap-path=DIR path to netmap root directory], + [(or in the default path if not specified).]), +[NETMAP_PATH=$withval +AM_CPPFLAGS="$AM_CPPFLAGS -I$NETMAP_PATH/sys" +netmap_support=yes +ODP_NETMAP=1],[]) +ODP_CFLAGS="$ODP_CFLAGS -DODP_NETMAP=$ODP_NETMAP" + +## # Set optional CUnit path ## AC_ARG_WITH([cunit-path], @@ -257,6 +281,19 @@ fi AM_CONDITIONAL([cunit_support], [test x$cunit_support = xyes ]) ## +# Check for netmap availability +## +if test x$netmap_support = xyes +then +AC_CHECK_HEADERS([net/netmap_user.h], [], +[AC_MSG_FAILURE(["can't find netmap header"])]) +else +netmap_support=no +fi + +AM_CONDITIONAL([netmap_support], [test x$netmap_support = xyes ]) + +## # Restore old saved variables ## LDFLAGS=$OLD_LDFLAGS @@ -271,6 +308,12 @@ ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonli ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings" ODP_CFLAGS="$ODP_CFLAGS -std=c99" +# Disable cast errors until the problem in netmap_user.h is fixed upstream +if test x$netmap_support = xyes +then +ODP_CFLAGS="$ODP_CFLAGS -Wno-cast-qual" +fi + ## # Default include setup ## @@ -354,6 +397,7 @@ AC_MSG_RESULT([ am_ldflags: ${AM_LDFLAGS} libs: ${LIBS} cunit: ${cunit_support} + netmap: ${netmap_support} test_vald: ${test_vald} test_perf: ${test_perf} test_cpp: ${test_cpp} As this is very linux-generic oriented, all the configure stuff should probably go in a .m4 in platform/linux-generic/m4 and included by platform/linux-generic/m4/configure.m4 diff --git
Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio support
Will be fixed in V2, thanks. -Matias > -Original Message- > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT Maxim > Uvarov > Sent: Tuesday, September 29, 2015 1:02 PM > To: lng-odp@lists.linaro.org > Subject: Re: [lng-odp] [PATCH 2/3] linux-generic: pktio: add netmap pktio > support > > On 09/29/15 09:57, Nicolas Morey-Chaisemartin wrote: > > +#else /* ODP_NETMAP == 0 */ > > >+ > > >+/* > > >+ * Dummy function to enable ODP build without netmap support > > >+ */ > > >+static int netmap_open(odp_pktio_t id ODP_UNUSED, > > >+ pktio_entry_t *pktio_entry ODP_UNUSED, > > >+ const char *devname ODP_UNUSED, > > >+ odp_pool_t pool ODP_UNUSED) > > >+{ > > >+ return -1; > > >+} > > >+ > > >+const pktio_if_ops_t netmap_pktio_ops = { > > >+ .open = netmap_open, > > >+}; > > >+ > That block also not needed. You should set ifdef in previous patch: > > const pktio_if_ops_t * const pktio_if_ops[] = { > _pktio_ops, > #ifdef ODP_NETMAP > + _pktio_ops, > #endif > _mmap_pktio_ops, > _mmsg_pktio_ops, > > > ___ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp