Re: [lng-odp] [PATCH] doc: doxygen: use .svg logo

2016-01-27 Thread Bill Fischofer
Applying this generates the following warnings:

Applying: doc: doxygen: use .svg logo
/home/bill/linaro/mikedoc/.git/rebase-apply/patch:168: indent with spaces.
 rdf:about="">
/home/bill/linaro/mikedoc/.git/rebase-apply/patch:169: indent with spaces.
image/svg+xml
/home/bill/linaro/mikedoc/.git/rebase-apply/patch:170: indent with spaces.
http://purl.org/dc/dcmitype/StillImage; />
/home/bill/linaro/mikedoc/.git/rebase-apply/patch:172: indent with spaces.
OpenDataPlane-branding_ODP Logo
warning: squelched 4 whitespace errors
warning: 9 lines add whitespace errors.

Not sure if these are legit or if this is another example of an overzealous
checkpatch trying to apply C rules to non-C files. Can checkpatch behave
differently based on file type?

Other than that, looks good.

On Tue, Jan 26, 2016 at 12:25 PM, Mike Holmes 
wrote:

> Signed-off-by: Mike Holmes 
>

Reviewed-and-tested-by: Bill Fischofer 


> ---

 doc/application-api-guide/doxygen.cfg |   2 +-
>  doc/images/ODP-Logo-HQ.png| Bin 5736 -> 0 bytes
>  doc/images/ODP-Logo-HQ.svg| 209
> ++
>  3 files changed, 210 insertions(+), 1 deletion(-)
>  delete mode 100644 doc/images/ODP-Logo-HQ.png
>  create mode 100644 doc/images/ODP-Logo-HQ.svg
>
> diff --git a/doc/application-api-guide/doxygen.cfg
> b/doc/application-api-guide/doxygen.cfg
> index 75006e2..7951e9e 100644
> --- a/doc/application-api-guide/doxygen.cfg
> +++ b/doc/application-api-guide/doxygen.cfg
> @@ -1,6 +1,6 @@
>  PROJECT_NAME = "API Reference Manual for $(WITH_PLATFORM)"
>  PROJECT_NUMBER = $(VERSION)
> -PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
> +PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.svg
>  QUIET = YES
>  OUTPUT_DIRECTORY = $(DOCDIR)
>  FULL_PATH_NAMES = NO
> diff --git a/doc/images/ODP-Logo-HQ.png b/doc/images/ODP-Logo-HQ.png
> deleted file mode 100644
> index
> 721bf40b185f75ee6899b161a35b2e6fdf0c5ab4..
> GIT binary patch
> literal 0
> HcmV?d1
>
> literal 5736
> zcmV-u7MJOXP) zddwdkt*~h=<% zl?^8G^0sej-_{~YkXEhK`YI%WY;Ehu+PAjWid7^_#S3EV{fbhh3P>(o zA2Zopb~g}6;@ftApAVPaIrE&~IrE$6Jm<`FW+9C<(nuqXe-DWMtnBKmubyTY#!Y+n
> z>^W)U#*NX;%*^%gzyJP!_9url(f}~~tD;aSbVo24{EpTd(=@Sd8^bV888c?gyd67s
> z3==}={^F8G8nQns357z-gTdf;Y}-aDh1Q zG8hbAYuk2r#j>|;+qP@!)Tvp0%_ogCppS)LR8&+Q3 z=JX|}G}3@R6n;@r(JITbuIVcJre=fLXCGwWUWwx*oR(EzUtd3E%9Npf#Vd_8ppS$f
> z3WdU!WfgT5{lP;f7tGjBQSlnKzXCgVf}JS-%)NW}?wB-b(uls`mPQ)T2f`19LiYrN
> z!THHVe_{TI6khfStEw+%@ZcddycuQJPKb30|Ai14hYlUuHh%p0QN7JCjWnQ_g
> zeiaM`uSzERZ{%-h+z-7FO1;2iWy`N7{<=GqU_$4T>Q3ee{lTq$B*qzj%lO;
> zz4!pj7yY-AhBxPY$R%@EQS##e@um7#E5LCg`XSo{RB*lvcMl) zCcgLHdmr`|*EG`T72&5Ay}^a~JK~;x<153+%24s+t}AGbN|rBv60I8 zAP_il>(;Fw^akHF(m3W>Lmt-c+JLe?}d1E?dpY>cRxk14yaK$WUB&^K>+$*!M;&
> z`wl^CG@%;Hw(Y;?<>h_ySox-r1{|aC=g*|l6v}cc5vzC4^v%L$cC4OCx|{y
> zKtM*&<+>%)i8`Y>u&7b__CyzfC|6p#~}PrD0F{DM#kkSJ^kF(
> ztXfknT0?WILCkKiS_&4XQ7zQ*air;K)ZQV3s!h{o!
> zmUkLyz){BdMMXuwwJht>RHDE1@`qVjUC1*p4QD`R=a}Ah1j`rK@=)z*JicKR*;$=$
> zii6DtKmXyg49(fjq%UN0pa}*fX7Q*%AaKgoty|wd8vaz~hY`#}N{hDCI03kN2SQv$
> zac$(N?DiI_3(mu(2Ize23k2u`Aa123^1uDgt1^Esh@S$TgHeG%>s@HR%eCt^P+3q2
> z{2a6mVi%>6Gy0wDVbJ63%up!wfMr>Q38HT{`1;wN=vS@0IH~AkwqW_ z*0WjrY;IiqLcqW*#dm)4C6@hQBU_^u$#Yg)gyK@$gVcYhb zD`zgiGUn6jfCfzI-Ep=Hh8T--{{#%^X}|O;w9Y1Ij=}cxI!u3bbX>2KO!-@WaqcV3
> ze|+;1+gvey6e4gB5Jd<{N#uea^Aa)#OO8#-ONt4&`WZkV+<{nuu{bU$J+R01^aFYn
> z>J$|f{XQ5BCKdhHzEa0!^E^-g^ot`>c=`xJ3N9! z9RBN;FVL`i0$ZMICU-a-Je0^?DfRks#~pV{k6P^NbBOr@((V>)=UkL3As|6%2%1^k
> zT`-|XHhUXdXk5Vcha*Rq;p#H9K8UM5o>6B(k8B##bg#V{@;V4Q!H#9UnM@zPr3
> zxVPh|JL8-J22|%?iIy?19018DcONs3*yD#np$9F?`erK8&%NSdR#hkW^if-|VsQi^
> zG}kZ5XXv0kl>by9#9$ULU5k{nSpCFU1`hD@7leSEY=?!neV*GEN;W^Ug-^}MV%rWF
> zl-;R%>ALP~ z)%pL879$X%f#TX_3AU^9uS3W@w9p7G(7G8^4JA+P@QxRJ3R4b2X+d%A(^Sp;4(PE6
> z_D~$TB`IGiV8PlY095ABL&|}ECv_f`s`HD{Vj@yB;Y5E%hV= zxu6ByTQGrEF`5On8{;-AXMPW%bAg?dM1D$D!51;5MCt>~uYE0{CyQ@10jrf*^?2
> z;F5zDAEoU7s{A=1rXp}~)$bU<9$L(aNG(_pc?y7 zuM%y}{1NEEAYE`JLNq45J{@pG!ViT)4+Vq43zLd|dc7z5l@}-V^f5=U{3c)YHy02H
> zXr$B(8wO>!2^?n#OKx3Dz%1Yowc{AnMf~5t{d3&9Q1I51?{dnF0ldErayk#5!nW;K
> zeDS|>1kKSM{^yN&%cc+SRKjT66eI7$lv8MNpt9fq0b>xZ_Q+M{S5UgHU3^sqby
> z_;D?~s)SL-iu? zOTe6j(%y~YTIEDJK!zNIuXGyLG+xQ2Lash9+tt@E9l9_1VMpeNN5n?c=gs6HI
> z_)J$aDS9{chN9|%KVzA*{m=+7Zsd^KNl=dT!=^TyPh$cx>9I3RkF#k&8CL{0}_
> z)vS|o^_v*NJ5>nK(!V|hODK(`OmjbMs8du_^xI^jZ)!I9+Vnc+
> zv<}m7xpv7+Oao+xjaFmEz|B7s+_-QE7hM)%_(9D3IT%$Is9PR8T|c&6M19(
> zAtq0Py$2F`+P3|2uP=3KqC{2Og0+p%4Tn1X zRRfOpJggKq`4*$Z6hswhgl{j3qri{?$N6cGIaU^2LC~B;RC#s9)ONH!h!lf}I-qq+
> 

Re: [lng-odp] [PATCH] doc: doxygen: generate .svg not .png tree graphs

2016-01-27 Thread Bill Fischofer
On Tue, Jan 26, 2016 at 12:26 PM, Mike Holmes 
wrote:

> Signed-off-by: Mike Holmes 
>

Reviewed-and-tested-by: Bill Fischofer 


> ---
>  doc/application-api-guide/doxygen.cfg | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/doc/application-api-guide/doxygen.cfg
> b/doc/application-api-guide/doxygen.cfg
> index 909f0ce..75006e2 100644
> --- a/doc/application-api-guide/doxygen.cfg
> +++ b/doc/application-api-guide/doxygen.cfg
> @@ -46,3 +46,4 @@ PREDEFINED = __GNUC__ \
>  ODP_PACKED \
>  "ODP_HANDLE_T(type)=odp_handle_t type"
>  INTERNAL_DOCS = YES
> +DOT_IMAGE_FORMAT = svg
> --
> 2.5.0
>
> ___
> 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 1/3] linux-generic: remove direct include of stdint.h by atomic.h

2016-01-27 Thread Bill Fischofer
For this series:

Reviewed-and-tested-by: Bill Fischofer 

On Wed, Jan 27, 2016 at 2:53 PM, Mike Holmes  wrote:

> atomic.h should include odp/std_types.h in line with the precedent
> set by the other headers.
>
> Signed-off-by: Mike Holmes 
> ---
>  platform/linux-generic/include/odp/atomic.h| 1 -
>  platform/linux-generic/include/odp/barrier.h   | 1 +
>  platform/linux-generic/include/odp/plat/atomic_types.h | 1 +
>  platform/linux-generic/include/odp/std_types.h | 1 +
>  4 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/odp/atomic.h
> b/platform/linux-generic/include/odp/atomic.h
> index deb4039..10cf361 100644
> --- a/platform/linux-generic/include/odp/atomic.h
> +++ b/platform/linux-generic/include/odp/atomic.h
> @@ -17,7 +17,6 @@
>  extern "C" {
>  #endif
>
> -#include 
>  #include 
>  #include 
>
> diff --git a/platform/linux-generic/include/odp/barrier.h
> b/platform/linux-generic/include/odp/barrier.h
> index 42df859..3447429 100644
> --- a/platform/linux-generic/include/odp/barrier.h
> +++ b/platform/linux-generic/include/odp/barrier.h
> @@ -17,6 +17,7 @@
>  extern "C" {
>  #endif
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/platform/linux-generic/include/odp/plat/atomic_types.h
> b/platform/linux-generic/include/odp/plat/atomic_types.h
> index 0f6c353..0fe15ed 100644
> --- a/platform/linux-generic/include/odp/plat/atomic_types.h
> +++ b/platform/linux-generic/include/odp/plat/atomic_types.h
> @@ -18,6 +18,7 @@
>  extern "C" {
>  #endif
>
> +#include 
>  #include 
>
>  /**
> diff --git a/platform/linux-generic/include/odp/std_types.h
> b/platform/linux-generic/include/odp/std_types.h
> index 1bd22ff..f509243 100644
> --- a/platform/linux-generic/include/odp/std_types.h
> +++ b/platform/linux-generic/include/odp/std_types.h
> @@ -17,6 +17,7 @@
>  extern "C" {
>  #endif
>
> +#include 
>  #include 
>  #include 
>  #include 
> --
> 2.5.0
>
> ___
> 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] linux-generic: packet_io: fix array indexing in pktin_deq_multi()

2016-01-27 Thread Bill Fischofer
On Wed, Jan 27, 2016 at 11:44 AM, Zoltan Kiss 
wrote:

> 'j' is incremented twice, therefore every second element of hdr_tbl is
> garbage. Introduced in f3c1e77f "linux-generic: pktio: optimize
> pktin_deq_multi".
>
> Signed-off-by: Zoltan Kiss 
>

Reviewed-by: Bill Fischofer 


> ---
> diff --git a/platform/linux-generic/odp_packet_io.c
> b/platform/linux-generic/odp_packet_io.c
> index cda1900..540cdb8 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -640,7 +640,7 @@ int pktin_deq_multi(queue_entry_t *qentry,
> odp_buffer_hdr_t *buf_hdr[], int num)
> /* Queue the rest for later */
> for (j = 0; i < pkts; i++, j++) {
> buf= _odp_packet_to_buffer(pkt_tbl[i]);
> -   hdr_tbl[j++] = odp_buf_to_hdr(buf);
> +   hdr_tbl[j] = odp_buf_to_hdr(buf);
> }
>
> if (j)
> ___
> 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 v3 1/2] linux-generic: test: move validation tests to their own directory

2016-01-27 Thread Bill Fischofer
This applies and builds OK, however when I try to run these tests I see
this:

bill@Ubuntu15:~/linaro/mikedoc/platform/linux-generic/test/validation/pktio$
ls
Makefile Makefile.in  pktio_run   pktio_run_tap
Makefile.am  pktio_envpktio_run_pcap
bill@Ubuntu15:~/linaro/mikedoc/platform/linux-generic/test/validation/pktio$
./pktio_run_pcap
cannot find pktio_main: please set you PATH for it.
./pktio_run_pcap: 30: ./pktio_run_pcap: pktio_main: not found

So it looks like the make didn't build them.  I ran with ./configure
--enable-cunit-support --enable-user-guides

Did I miss something?

On Wed, Jan 27, 2016 at 12:37 PM, Mike Holmes 
wrote:

> Simplify adding platform performance tests by mirroring the test directory
> structure and moving the validation tests to their own directory.
>
> Signed-off-by: Mike Holmes 
> ---
>  platform/linux-generic/m4/configure.m4 |   3 +-
>  platform/linux-generic/test/Makefile.am|  51 +
>  platform/linux-generic/test/pktio/.gitignore   |   2 -
>  platform/linux-generic/test/pktio/Makefile.am  |   9 --
>  platform/linux-generic/test/pktio/pktio_env| 120
> -
>  platform/linux-generic/test/pktio/pktio_run| 110
> ---
>  platform/linux-generic/test/pktio/pktio_run_pcap   |  33 --
>  platform/linux-generic/test/pktio/pktio_run_tap| 115
> 
>  platform/linux-generic/test/validation/Makefile.am |  44 
>  .../linux-generic/test/validation/pktio/.gitignore |   2 +
>  .../test/validation/pktio/Makefile.am  |   9 ++
>  .../linux-generic/test/validation/pktio/pktio_env  | 120
> +
>  .../linux-generic/test/validation/pktio/pktio_run  | 110
> +++
>  .../test/validation/pktio/pktio_run_pcap   |  33 ++
>  .../test/validation/pktio/pktio_run_tap| 115
> 
>  test/performance/odp_l2fwd_run |   6 +-
>  16 files changed, 442 insertions(+), 440 deletions(-)
>  delete mode 100644 platform/linux-generic/test/pktio/.gitignore
>  delete mode 100644 platform/linux-generic/test/pktio/Makefile.am
>  delete mode 100644 platform/linux-generic/test/pktio/pktio_env
>  delete mode 100755 platform/linux-generic/test/pktio/pktio_run
>  delete mode 100755 platform/linux-generic/test/pktio/pktio_run_pcap
>  delete mode 100755 platform/linux-generic/test/pktio/pktio_run_tap
>  create mode 100644 platform/linux-generic/test/validation/Makefile.am
>  create mode 100644 platform/linux-generic/test/validation/pktio/.gitignore
>  create mode 100644
> platform/linux-generic/test/validation/pktio/Makefile.am
>  create mode 100644 platform/linux-generic/test/validation/pktio/pktio_env
>  create mode 100755 platform/linux-generic/test/validation/pktio/pktio_run
>  create mode 100755
> platform/linux-generic/test/validation/pktio/pktio_run_pcap
>  create mode 100755
> platform/linux-generic/test/validation/pktio/pktio_run_tap
>
> diff --git a/platform/linux-generic/m4/configure.m4
> b/platform/linux-generic/m4/configure.m4
> index df6dc64..97c15fa 100644
> --- a/platform/linux-generic/m4/configure.m4
> +++ b/platform/linux-generic/m4/configure.m4
> @@ -23,4 +23,5 @@ m4_include([platform/linux-generic/m4/odp_pcap.m4])
>
>  AC_CONFIG_FILES([platform/linux-generic/Makefile
>  platform/linux-generic/test/Makefile
> -platform/linux-generic/test/pktio/Makefile])
> +platform/linux-generic/test/validation/Makefile
> +platform/linux-generic/test/validation/pktio/Makefile])
> diff --git a/platform/linux-generic/test/Makefile.am
> b/platform/linux-generic/test/Makefile.am
> index e629872..3cf638d 100644
> --- a/platform/linux-generic/test/Makefile.am
> +++ b/platform/linux-generic/test/Makefile.am
> @@ -1,56 +1,13 @@
> -include $(top_srcdir)/test/Makefile.inc
> -TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
> -
> -ODP_MODULES = pktio
> +SUBDIRS =
>
>  if test_vald
> -TESTS = pktio/pktio_run \
> -   pktio/pktio_run_tap \
> -   ${top_builddir}/test/validation/buffer/buffer_main$(EXEEXT) \
> -
>  ${top_builddir}/test/validation/classification/classification_main$(EXEEXT)
> \
> -   ${top_builddir}/test/validation/config/config_main$(EXEEXT) \
> -   ${top_builddir}/test/validation/cpumask/cpumask_main$(EXEEXT) \
> -   ${top_builddir}/test/validation/crypto/crypto_main$(EXEEXT) \
> -   ${top_builddir}/test/validation/errno/errno_main$(EXEEXT) \
> -   ${top_builddir}/test/validation/hash/hash_main$(EXEEXT) \
> -   ${top_builddir}/test/validation/init/init_main_ok$(EXEEXT) \
> -   ${top_builddir}/test/validation/init/init_main_abort$(EXEEXT) \
> -   ${top_builddir}/test/validation/init/init_main_log$(EXEEXT) \
> -   ${top_builddir}/test/validation/packet/packet_main$(EXEEXT) \
> -   

Re: [lng-odp] [API-NEXT RFC PATCH 0/3] new try for a adding a driver interface

2016-01-27 Thread Christophe Milard
In other words, what I don't like with your proposal, Mike, is that the
term "application" gets two meanings:
in "app", it means the program attached to the north interface.
in "api", (the "a" is for application),it means anything attached to ODP
(either north or south interface)

I dont think having different meanings for the same word is a good start
point. We have that today with "ODP" (somtimes meaning the ODP library,
sometimes meaning its north interface) and this is confusing

Christophe.

On 27 January 2016 at 08:30, Christophe Milard  wrote:

>
>
> On 26 January 2016 at 22:45, Mike Holmes  wrote:
>
>> Inline comment on include structure
>>
>> On 26 January 2016 at 13:04, Christophe Milard <
>> christophe.mil...@linaro.org> wrote:
>>
>>> This patch series implements a new structure in the ODP repo so that new
>>> interfaces can be more easily added to ODP
>>>
>>> Saddly changing the current structure seems needed as just adding to it
>>> results in a quite fuzzy file organisation:
>>>
>>> Today:
>>> include/odp/api is the reference for the ODP API interface.
>>
>> Platform/linux-generic/include/odp is the platform implementation of the
>>> ODP
>>> API interface.  The ODP API interface is simply called ODP there.
>>> Having the same name (ODP) for the whole ODP and one of its API result
>>> in a
>>> quite messy organisation.
>>> Moreover, with the current structure, a new interface cannot be named
>>> the same
>>> on the platform side as on the reference side because the directory name
>>> is
>>> what is used to distinguish the files at include time (hence the 2 names
>>> today):
>>> A new interface (e.g. defined in include/odp/drv) cannot be called
>>> Platform/linux-generic/include/odp/drv on the platform side as the
>>> statement
>>> include  would be ambiguous.
>>> And this make the driver interface appear as a sub interface of the API,
>>> which does not reflect any reality.
>>> I have tried a few variant of this, none of which gave me enough
>>> satisfaction.
>>>
>>> These patches:
>>> Aims to having a way to get following structures
>>> (for two interfaces: api and drv):
>>>
>>>
>>
>> In the repo:
>>> ./
>>> ├── include/
>>> │   └── odp/
>>> │   ├── api/  <-- this was old bad thinking, there is more than
>>> one api now,  so this is the application or app directory
>>> │   │   └── ref/  <- this is the odp/app/api, it is not a reference
>>> it is the api for apps
>>> │   ├── api.h
>>> │   ├── drv/
>>> │   │   └── ref/ <- this is the odp/drv/api, it is not a reference
>>> it is the api for drivers
>>> │   └── drv.h
>>>
>>
>> I don't mind changing api to app if that is more popular.
>
> But, regarding the ref->api change: API stands for Application Programming
> Interface. Isn't it confusing to have an Application Programming Interface
> for drivers and an Application Programming Interface for applications?
> I am not sure why you don't see these files as a reference as this is what
> the implementations should comply to, and I don't mind changing the name
> either, but I don't like API: are drivers applications?
> shouldn't be called DPI then, as this actually is the Driver programming
> interface. not the application
> But of course, we want one single common name: the reference files (or
> whatever we want to call them) should be called:
> include/odp/api/something and include/odp/drv/something. That "something"
> should be the same thing. A name telling that these files comes from the
> Interface reference/public/ definition.
> The path already says what interface we talk about (api/drv)
>
> if "ref", which make more sense for me is not popular, I think "pub" (for
> public) is a better alternative than api. Even if the references files have
> been called api up to now.
>
> Christophe.
>
>
>>
>>> └── platform/
>>> └── linux-generic/
>>> └── include/
>>> └── odp/
>>> ├── api/
>>> │   └── plat/
>>> ├── com/
>>> │   └── plat/
>>> └── drv/
>>> └── plat/
>>>
>>> Once installed:
>>> ./
>>> └── include/
>>> └── odp/
>>> ├── api/
>>> │   ├── plat/
>>> │   └── ref/
>>> ├── api.h
>>> ├── com/
>>> │   └── plat/
>>> ├── drv/
>>> │   ├── plat/
>>> │   └── ref/
>>> └── drv.h
>>>
>>> These patches do not create the drv interface: they just move around
>>> the existing structure (the ODP API includes files) according to the
>>> above
>>> trees. Patch 3 updates the docs with a view of the new structure
>>> (without the
>>> drv interface). New patches will be sent to create the new interface and
>>> update the documentation accordinally if this new structure gets
>>> approved.
>>>
>>> With this new structure, each interface can get its own directory.
>>>
>>> The com/ directory is meant to contain things which can be 

Re: [lng-odp] [API-NEXT PATCH] api: prefixing some standard types.

2016-01-27 Thread Christophe Milard
maxim: do you want a v2 or are you fixing this in the merge?

On 27 January 2016 at 16:14, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> For the git log readability better subject would be:
>
> "api: endian: rename endian types with odp_ prefix"
>
>
> Maybe Maxim can edit that during merge.
>
>
>
> Reviewed-by: Petri Savolainen 
>
>
>
> > -Original Message-
> > From: EXT Christophe Milard [mailto:christophe.mil...@linaro.org]
> > Sent: Wednesday, January 27, 2016 5:00 PM
> > To: anders.rox...@linaro.org; mike.hol...@linaro.org;
> > bill.fischo...@linaro.org; petri.savolai...@linaro.org
> > Cc: lng-odp@lists.linaro.org; Christophe Milard
> > Subject: [API-NEXT PATCH] api: prefixing some standard types.
> >
> > The following types: uint16le_t, uint16be_t, uint32le_t, uint32be_t,
> > uint64le_t, uint64be_t, uint16sum_t, uint32sum_t defined in the api and
> > in platform/linux-generic/include/odp/plat/byteorder_types.h were not
> > odp_* prefixed and could create name clash with an applications.
> > This patch prefixes those with odp_*, suppressing "int" for shortness.
> > e.g. uint16le_t becomes odp_u16le_t
> > Also modifies files using these types, of course.
> >
> > Signed-off-by: Christophe Milard 
> > ---
> >  example/classifier/odp_classifier.c|  2 +-
> >  example/ipsec/odp_ipsec_cache.h|  2 +-
> >  example/ipsec/odp_ipsec_stream.c   |  2 +-
> >  example/packet/odp_pktio.c |  2 +-
> >  helper/include/odp/helper/chksum.h |  4 +-
> >  helper/include/odp/helper/eth.h|  6 +-
> >  helper/include/odp/helper/icmp.h   | 12 ++--
> >  helper/include/odp/helper/ip.h | 22 
> >  helper/include/odp/helper/ipsec.h  | 10 ++--
> >  helper/include/odp/helper/tcp.h| 64
> +++--
> > -
> >  helper/include/odp/helper/udp.h|  8 +--
> >  include/odp/api/byteorder.h| 40 +++---
> >  platform/linux-generic/include/odp/byteorder.h | 48 
> >  .../include/odp/plat/byteorder_types.h | 16 +++---
> >  test/performance/odp_pktio_perf.c  |  2 +-
> >  .../classification/odp_classification_common.c |  6 +-
> >  test/validation/pktio/pktio.c  |  6 +-
> >  17 files changed, 126 insertions(+), 126 deletions(-)
> >
> > diff --git a/example/classifier/odp_classifier.c
> > b/example/classifier/odp_classifier.c
> > index 5a8cd37..9e5bec9 100644
> > --- a/example/classifier/odp_classifier.c
> > +++ b/example/classifier/odp_classifier.c
> > @@ -667,7 +667,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[],
> > unsigned len)
> >   odph_ethhdr_t *eth;
> >   odph_ethaddr_t tmp_addr;
> >   odph_ipv4hdr_t *ip;
> > - uint32be_t ip_tmp_addr; /* tmp ip addr */
> > + odp_u32be_t ip_tmp_addr; /* tmp ip addr */
> >   unsigned i;
> >
> >   for (i = 0; i < len; ++i) {
> > diff --git a/example/ipsec/odp_ipsec_cache.h
> > b/example/ipsec/odp_ipsec_cache.h
> > index 91d9d7e..56be9d8 100644
> > --- a/example/ipsec/odp_ipsec_cache.h
> > +++ b/example/ipsec/odp_ipsec_cache.h
> > @@ -57,7 +57,7 @@ typedef struct ipsec_cache_entry_s {
> >   uint32_t  esp_seq; /**< ESP TX sequence number
> */
> >   uint32_t  ah_seq;  /**< AH TX sequence number
> */
> >   uint8_t   iv[MAX_IV_LEN];  /**< ESP IV storage */
> > - uint16be_ttun_hdr_id;  /**< Tunnel header IP ID */
> > + odp_u16be_ttun_hdr_id; /**< Tunnel header IP ID */
> >   } state;
> >  } ipsec_cache_entry_t;
> >
> > diff --git a/example/ipsec/odp_ipsec_stream.c
> > b/example/ipsec/odp_ipsec_stream.c
> > index 9c2722e..ff2ca33 100644
> > --- a/example/ipsec/odp_ipsec_stream.c
> > +++ b/example/ipsec/odp_ipsec_stream.c
> > @@ -36,7 +36,7 @@
> >   * Stream packet header
> >   */
> >  typedef struct ODP_PACKED stream_pkt_hdr_s {
> > - uint64be_t magic;/**< Stream magic value for verification */
> > + odp_u64be_t magic;   /**< Stream magic value for verification */
> >   uint8_tdata[0];  /**< Incrementing data stream */
> >  } stream_pkt_hdr_t;
> >
> > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> > index 75e92ac..13f044f 100644
> > --- a/example/packet/odp_pktio.c
> > +++ b/example/packet/odp_pktio.c
> > @@ -502,7 +502,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[],
> > unsigned len)
> >   odph_ethhdr_t *eth;
> >   odph_ethaddr_t tmp_addr;
> >   odph_ipv4hdr_t *ip;
> > - uint32be_t ip_tmp_addr; /* tmp ip addr */
> > + odp_u32be_t ip_tmp_addr; /* tmp ip addr */
> >   unsigned i;
> >
> >   for (i = 0; i < len; ++i) {
> > diff --git a/helper/include/odp/helper/chksum.h
> > 

Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast flags

2016-01-27 Thread Ola Liljedahl
On 27 January 2016 at 09:59, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
>
>
>
> *From:* EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Tuesday, January 26, 2016 8:17 PM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast
> flags
>
>
>
> Before sending my reviewed-by I started working on implementing these
> (along with the tests).  The flags themselves are straightforward, however
> the parse definitions are somewhat complicated and we may want to simplify
> things a bit to capture what applications are really looking for.
>
>
>
> First, we only define a single bit for each of these and it's not clear
> whether this applies to the source or destination address of the packet.
> For the sets, I'm assuming we'd want these to refer to the destination
> addresses since it makes little sense for an application to modify a source
> address since the packet has already been received, however on receipt do
> applications want to know whether the packet originated from a broadcast or
> multicast address?  What are the use cases we're looking to support, since
> that will say whether we need one or two bits for these designators.
>
>
>
> All these bits are for destination address. It would be a protocol error
> (L2/L3 error flag set) in all these cases if source address would be bcast
> or mcast.
>
>
>
>
>
> Ethernet multicast is indicated by bit 7 of the MAC address being 1.  By
> convention, most use MAC addr FF:FF:FF:FF:FF:FF to indicate broadcast even
> though Ethernet really doesn't distinguish between these two.
>
>
>
> Eth_bcast is the broadcast address - in practice all ones. I’d expect that
> at least some IEEE Ethernet standard would define that as the bcast address.
>
>
>
>
>
> So do we really need both eth_bcast and eth_mcast?
>
>
>
> Yes. Multicast Ethernet addresses are many and handled differently (e.g.
> in IP stack) than the (single) bcast address (all ones).
>
>
>
> For IP things are a bit more complicated.
>
>
>
> Parser needs to find only those addresses that are fixed by the protocol
> address format. Dynamically configured addresses (like subnet bcast) would
> need a  proper IP stack,  ODP is just a (dummy) parser – not a stack.
>
Agree. In my experience (e.g. in the IP stacks I have written), IP
multicast and broadcast is detected by the IP layer when looking up the
destination IP address in the FIB. What to do with a packet depends on the
matching route (what action it specifies, e.g. drop, forward, terminate).
Thus I am not even sure I would need support in the parser to detected IP
multicast and broadcast addresses. But perhaps other designs find these
parser outputs useful.


>
>
> For IPv4, multicast is basically a Class D IP address (addresses in the
> range 224.x.x.x through 239.x.x.x (leading hex nibble D). Broadcast
> addresses, however, are a function of the subnet being used and that's not
> unambiguous in the absence of a separately specified subnet mask.  For
> example, for network 192.168.1.0/8 the broadcast address is
> 192.168.1.255, however for network 192.168.1.0/4 the broadcast address is
> 192.168.1.15 whereas this is a unicast address in the /8 network.  What
> exactly do we expect the ip_bcast bit to mean with respect to the (unknown)
> subnet mask?
>
>
>
> IPv4 multicast addresses are defined by the leading address bits of 1110
> (ip_mcast == 1). Broadcast is 255.255.255.255 (ip_bcast == 1).
>
>
>
> For IPv6 we have a similar issue in that IPv6 doesn't recognize broadcast
> addresses, but instead uses multicast addresses, which have prefix ff00::/8
>  with address ff02::1 being the "all nodes" multicast address, which is
> sort of like broadcast.  Exactly how do we wish to define ip_bcast and
> ip_mcast for IPv6?
>
>
>
> IPv4 multicast addresses are defined by the leading address bits of
>  (ip_mcast == 1). There’s no bcast address (ip_bcast == 0 always).
>
>
>
>
>
> -Petri
>
>
>
>
>
> On Fri, Jan 22, 2016 at 3:12 AM, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolai...@nokia.com> wrote:
>
>
>
>
>
> *From:* EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Friday, January 22, 2016 1:03 AM
>
>
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast
> flags
>
>
>
>
>
>
>
> On Thu, Jan 21, 2016 at 9:30 AM, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolai...@nokia.com> wrote:
>
>
>
>
>
> *From:* EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Thursday, January 21, 2016 4:43 PM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast
> flags
>
>
>
>
>
>
>
> On Thu, Jan 21, 2016 at 3:39 AM, Petri Savolainen <
> petri.savolai...@nokia.com> wrote:
>
> Added packet flags for Ethernet and IP broad- and 

[lng-odp] [API-NEXT PATCH 08/11] linux-generic: dpdk: add odp_pktio_input_queues_config()

2016-01-27 Thread Matias Elo
Implement odp_pktio_input_queues_config() function and add
helper rss_conf_to_hash_proto() for converting
odp_pktin_hash_proto_t to struct rte_eth_rss_conf.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/include/odp_packet_dpdk.h |  1 +
 platform/linux-generic/pktio/dpdk.c  | 60 +---
 2 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_dpdk.h 
b/platform/linux-generic/include/odp_packet_dpdk.h
index 659f08d..de2b420 100644
--- a/platform/linux-generic/include/odp_packet_dpdk.h
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -39,6 +39,7 @@ typedef struct {
/** DPDK packet pool name (pktpool_) */
char pool_name[IF_NAMESIZE + 8];
uint8_t port_id;  /**< DPDK port identifier */
+   odp_pktin_hash_proto_t hash;  /**< Packet input hash protocol */
odp_bool_t lockless_rx;   /**< no locking for rx */
odp_bool_t lockless_tx;   /**< no locking for tx */
odp_ticketlock_t rx_lock[PKTIO_MAX_QUEUES];  /**< RX queue locks */
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 91fa810..96a51d5 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -151,10 +151,39 @@ static int dpdk_netdev_is_valid(const char *s)
return 1;
 }
 
+static void rss_conf_to_hash_proto(struct rte_eth_rss_conf *rss_conf,
+  const odp_pktin_hash_proto_t *hash_proto)
+{
+   memset(rss_conf, 0, sizeof(struct rte_eth_rss_conf));
+
+   if (hash_proto->proto.ipv4_udp)
+   rss_conf->rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
+   if (hash_proto->proto.ipv4_tcp)
+   rss_conf->rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
+   if (hash_proto->proto.ipv4)
+   rss_conf->rss_hf |= ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 |
+   ETH_RSS_NONFRAG_IPV4_OTHER;
+   if (hash_proto->proto.ipv6_udp)
+   rss_conf->rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP |
+   ETH_RSS_IPV6_UDP_EX;
+   if (hash_proto->proto.ipv6_tcp)
+   rss_conf->rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP |
+   ETH_RSS_IPV6_TCP_EX;
+   if (hash_proto->proto.ipv6)
+   rss_conf->rss_hf |= ETH_RSS_IPV6 | ETH_RSS_FRAG_IPV6 |
+   ETH_RSS_NONFRAG_IPV6_OTHER |
+   ETH_RSS_IPV6_EX;
+   rss_conf->rss_key = NULL;
+}
+
 static int dpdk_setup_port(pktio_entry_t *pktio_entry)
 {
-   pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
int ret;
+   pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
+   struct rte_eth_rss_conf rss_conf;
+
+   rss_conf_to_hash_proto(_conf, _dpdk->hash);
+
struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_RSS,
@@ -167,10 +196,7 @@ static int dpdk_setup_port(pktio_entry_t *pktio_entry)
.hw_strip_crc   = 0,
},
.rx_adv_conf = {
-   .rss_conf = {
-   .rss_key = NULL,
-   .rss_hf = ETH_RSS_IP,
-   },
+   .rss_conf = rss_conf,
},
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
@@ -304,6 +330,28 @@ int odp_dpdk_pktio_init_local(void)
return 0;
 }
 
+static int dpdk_input_queues_config(pktio_entry_t *pktio_entry,
+   const odp_pktio_input_queue_param_t *p)
+{
+   odp_pktio_input_mode_t mode = pktio_entry->s.param.in_mode;
+   odp_bool_t single_user;
+
+   /**
+* Scheduler synchronizes input queue polls. Only single thread
+* at a time polls a queue */
+   if (mode == ODP_PKTIN_MODE_SCHED)
+   single_user = 1;
+   else
+   single_user = p->single_user;
+
+   if (p->hash_enable && p->num_queues > 1)
+   pktio_entry->s.pkt_dpdk.hash = p->hash_proto;
+
+   pktio_entry->s.pkt_dpdk.lockless_rx = single_user;
+
+   return 0;
+}
+
 static int dpdk_open(odp_pktio_t id ODP_UNUSED,
 pktio_entry_t *pktio_entry,
 const char *netdev,
@@ -700,7 +748,7 @@ const pktio_if_ops_t dpdk_pktio_ops = {
.promisc_mode_get = dpdk_promisc_mode_get,
.mac_get = dpdk_mac_addr_get,
.capability = dpdk_capability,
-   .input_queues_config = NULL,
+   .input_queues_config = dpdk_input_queues_config,
.output_queues_config = NULL,
.in_queues = dpdk_in_queues,
.pktin_queues = dpdk_pktin_queues,
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org

[lng-odp] [API-NEXT PATCH 02/11] linux-generic: pktio: initial DPDK pktio implementation

2016-01-27 Thread Matias Elo
Initial implementation of the DPDK pktio type.
Initialization code copied from the odp-dpdk branch.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/include/odp_internal.h|   5 +
 platform/linux-generic/include/odp_packet_dpdk.h |  23 +
 platform/linux-generic/odp_init.c|  12 +
 platform/linux-generic/pktio/dpdk.c  | 534 ++-
 4 files changed, 550 insertions(+), 24 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index cdbed7d..c01cbef 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -107,6 +107,11 @@ int odp_tm_init_global(void);
 
 void _odp_flush_caches(void);
 
+#ifdef ODP_DPDK
+int odp_dpdk_pktio_init_global(void);
+int odp_dpdk_pktio_init_local(void);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/include/odp_packet_dpdk.h 
b/platform/linux-generic/include/odp_packet_dpdk.h
index 71fdbdc..5676f4c 100644
--- a/platform/linux-generic/include/odp_packet_dpdk.h
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -10,11 +10,34 @@
 #include 
 #include 
 
+#include 
+
+#ifdef ODP_DPDK
+#include 
+#include 
+
+#define DPDK_MEMORY_MB 512
+#define DPDK_NB_MBUF 8192
+#define DPDK_MBUF_BUF_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
+#define DPDK_MEMPOOL_CACHE_SIZE 32
+#define DPDK_NM_RX_DESC  128
+#define DPDK_NM_TX_DESC  512
+
+_ODP_STATIC_ASSERT(DPDK_NB_MBUF % DPDK_MEMPOOL_CACHE_SIZE == 0 &&
+  DPDK_MEMPOOL_CACHE_SIZE <= RTE_MEMPOOL_CACHE_MAX_SIZE &&
+  DPDK_MEMPOOL_CACHE_SIZE <= DPDK_MBUF_BUF_SIZE / 1.5
+  , "DPDK mempool cache size failure");
+#endif
 
 /** Packet IO using DPDK interface */
 typedef struct {
odp_pool_t pool;  /**< pool to alloc packets from */
+   struct rte_mempool *pkt_pool; /**< DPDK packet pool */
odp_pktio_capability_t  capa; /**< interface capabilities */
+   uint32_t data_room;   /**< maximum packet length */
+   /** DPDK packet pool name (pktpool_) */
+   char pool_name[IF_NAMESIZE + 8];
+   uint8_t port_id;  /**< DPDK port identifier */
 } pkt_dpdk_t;
 
 #endif
diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index 6ad3320..584e659 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -37,6 +37,12 @@ int odp_init_global(const odp_init_t *params,
}
stage = SYSINFO_INIT;
 
+#ifdef ODP_DPDK
+   if (odp_dpdk_pktio_init_global() < 0) {
+   ODP_ERR("ODP dpdk pktio init failed.\n");
+   return -1;
+   }
+#endif
if (odp_shm_init_global()) {
ODP_ERR("ODP shm init failed.\n");
goto init_failed;
@@ -215,6 +221,12 @@ int odp_init_local(odp_thread_type_t thr_type)
}
stage = THREAD_INIT;
 
+#ifdef ODP_DPDK
+   if (odp_dpdk_pktio_init_local()) {
+   ODP_ERR("ODP dpdk pktio local init failed.\n");
+   return -1;
+   }
+#endif
if (odp_pktio_init_local()) {
ODP_ERR("ODP packet io local init failed.\n");
goto init_fail;
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 31fe9ae..be622dd 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -8,64 +8,550 @@
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
+#include 
+#include 
+
+/* Has dpdk_pktio_init() been called */
+static odp_bool_t dpdk_initialized;
+
+#define PMD_EXT(drv) \
+extern void devinitfn_##drv(void)
+
+PMD_EXT(cryptodev_aesni_mb_pmd_drv);
+PMD_EXT(pmd_qat_drv);
+PMD_EXT(pmd_af_packet_drv);
+PMD_EXT(rte_bnx2x_driver);
+PMD_EXT(rte_bnx2xvf_driver);
+PMD_EXT(bond_drv);
+PMD_EXT(rte_cxgbe_driver);
+PMD_EXT(em_pmd_drv);
+PMD_EXT(pmd_igb_drv);
+PMD_EXT(pmd_igbvf_drv);
+PMD_EXT(rte_enic_driver);
+PMD_EXT(rte_fm10k_driver);
+PMD_EXT(rte_i40e_driver);
+PMD_EXT(rte_i40evf_driver);
+PMD_EXT(rte_ixgbe_driver);
+PMD_EXT(rte_ixgbevf_driver);
+PMD_EXT(rte_mlx4_driver);
+PMD_EXT(rte_mlx5_driver);
+PMD_EXT(pmd_mpipe_xgbe_drv);
+PMD_EXT(pmd_mpipe_gbe_drv);
+PMD_EXT(rte_nfp_net_driver);
+PMD_EXT(pmd_null_drv);
+PMD_EXT(pmd_pcap_drv);
+PMD_EXT(pmd_ring_drv);
+PMD_EXT(pmd_szedata2_drv);
+PMD_EXT(rte_virtio_driver);
+PMD_EXT(rte_vmxnet3_driver);
+PMD_EXT(pmd_xenvirt_drv);
+
+/*
+ * This function is not called from anywhere, it's only purpose is to make sure
+ * that if ODP and DPDK are statically linked to an application, the GCC
+ * constuctors of the PMDs are linked as well. Otherwise the linker would omit
+ * them. It's not an issue with dynamic linking. */
+void refer_constructors(void);
+void refer_constructors(void)
+{
+#ifdef 

[lng-odp] [API-NEXT PATCH 11/11] linux-generic: dpdk: close resources in odp_pktio_close()

2016-01-27 Thread Matias Elo
Free/close open resources in odp_pktio_close().

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/include/odp_packet_dpdk.h |  1 +
 platform/linux-generic/pktio/dpdk.c  | 19 ++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp_packet_dpdk.h 
b/platform/linux-generic/include/odp_packet_dpdk.h
index ca7ea83..1efef29 100644
--- a/platform/linux-generic/include/odp_packet_dpdk.h
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -53,6 +53,7 @@ typedef struct {
uint32_t data_room;   /**< maximum packet length */
/** DPDK packet pool name (pktpool_) */
char pool_name[IF_NAMESIZE + 8];
+   odp_bool_t started;   /**< DPDK device has been started */
uint8_t port_id;  /**< DPDK port identifier */
unsigned min_rx_burst;/**< minimum RX burst size */
odp_pktin_hash_proto_t hash;  /**< Packet input hash protocol */
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 2e32a2f..dfd48fc 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -214,8 +214,23 @@ static int dpdk_setup_port(pktio_entry_t *pktio_entry)
return 0;
 }
 
-static int dpdk_close(pktio_entry_t *pktio_entry ODP_UNUSED)
+static int dpdk_close(pktio_entry_t *pktio_entry)
 {
+   pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
+   unsigned idx;
+   unsigned i, j;
+
+   /* Free cache packets */
+   for (i = 0; i < PKTIO_MAX_QUEUES; i++) {
+   idx = pkt_dpdk->rx_cache[i].s.idx;
+
+   for (j = 0; j < pkt_dpdk->rx_cache[i].s.count; j++)
+   rte_pktmbuf_free(pkt_dpdk->rx_cache[i].s.pkt[idx++]);
+   }
+
+   if (pkt_dpdk->started)
+   rte_eth_dev_close(pkt_dpdk->port_id);
+
return 0;
 }
 
@@ -494,6 +509,8 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
ret, port_id);
return -1;
}
+   pkt_dpdk->started = 1;
+
return 0;
 }
 
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 09/11] linux-generic: dpdk: add odp_pktio_output_queues_config()

2016-01-27 Thread Matias Elo
Implement odp_pktio_output_queues_config() function.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/pktio/dpdk.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 96a51d5..c184ade 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -352,6 +352,16 @@ static int dpdk_input_queues_config(pktio_entry_t 
*pktio_entry,
return 0;
 }
 
+static int dpdk_output_queues_config(pktio_entry_t *pktio_entry,
+const odp_pktio_output_queue_param_t *p)
+{
+   pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
+
+   pkt_dpdk->lockless_tx = p->single_user;
+
+   return 0;
+}
+
 static int dpdk_open(odp_pktio_t id ODP_UNUSED,
 pktio_entry_t *pktio_entry,
 const char *netdev,
@@ -749,7 +759,7 @@ const pktio_if_ops_t dpdk_pktio_ops = {
.mac_get = dpdk_mac_addr_get,
.capability = dpdk_capability,
.input_queues_config = dpdk_input_queues_config,
-   .output_queues_config = NULL,
+   .output_queues_config = dpdk_output_queues_config,
.in_queues = dpdk_in_queues,
.pktin_queues = dpdk_pktin_queues,
.pktout_queues = dpdk_pktout_queues
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 10/11] linux-generic: dpdk: handle ixgbe_pmd minimum burst size

2016-01-27 Thread Matias Elo
ixgbe_pmd has a minimum supported RX burst size of 4. If
less than 4 packets are requested with
odp_pktio_recv_queue(),  rte_eth_rx_burst() is called with
nb_pkts=4 and the possibly received extra packets are cached
for the next dpdk_recv_queue() call to use.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/include/odp_packet_dpdk.h | 18 +
 platform/linux-generic/pktio/dpdk.c  | 47 ++--
 2 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_dpdk.h 
b/platform/linux-generic/include/odp_packet_dpdk.h
index de2b420..ca7ea83 100644
--- a/platform/linux-generic/include/odp_packet_dpdk.h
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -30,6 +30,21 @@ _ODP_STATIC_ASSERT(DPDK_NB_MBUF % DPDK_MEMPOOL_CACHE_SIZE == 
0 &&
   , "DPDK mempool cache size failure");
 #endif
 
+#define DPDK_IXGBE_MIN_RX_BURST 4
+
+/** Cache for storing packets */
+struct pkt_cache_t {
+   /** array for storing extra RX packets */
+   struct rte_mbuf *pkt[DPDK_IXGBE_MIN_RX_BURST];
+   unsigned idx; /**< head of cache */
+   unsigned count;   /**< packets in cache */
+};
+
+typedef union {
+   struct pkt_cache_t s;
+   uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(struct pkt_cache_t))];
+} pkt_cache_t ODP_ALIGNED_CACHE;
+
 /** Packet IO using DPDK interface */
 typedef struct {
odp_pool_t pool;  /**< pool to alloc packets from */
@@ -39,11 +54,14 @@ typedef struct {
/** DPDK packet pool name (pktpool_) */
char pool_name[IF_NAMESIZE + 8];
uint8_t port_id;  /**< DPDK port identifier */
+   unsigned min_rx_burst;/**< minimum RX burst size */
odp_pktin_hash_proto_t hash;  /**< Packet input hash protocol */
odp_bool_t lockless_rx;   /**< no locking for rx */
odp_bool_t lockless_tx;   /**< no locking for tx */
odp_ticketlock_t rx_lock[PKTIO_MAX_QUEUES];  /**< RX queue locks */
odp_ticketlock_t tx_lock[PKTIO_MAX_QUEUES];  /**< TX queue locks */
+   /** cache for storing extra RX packets */
+   pkt_cache_t rx_cache[PKTIO_MAX_QUEUES];
 } pkt_dpdk_t;
 
 #endif
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index c184ade..2e32a2f 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -416,6 +416,11 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
pkt_dpdk->capa.max_input_queues = dev_info.max_rx_queues;
pkt_dpdk->capa.max_output_queues = dev_info.max_tx_queues;
 
+   if (!strcmp(dev_info.driver_name, "rte_ixgbe_pmd"))
+   pkt_dpdk->min_rx_burst = DPDK_IXGBE_MIN_RX_BURST;
+   else
+   pkt_dpdk->min_rx_burst = 0;
+
/* Look for previously opened packet pool */
pkt_pool = rte_mempool_lookup(pkt_dpdk->pool_name);
if (pkt_pool == NULL)
@@ -582,15 +587,51 @@ static int dpdk_recv_queue(pktio_entry_t *pktio_entry,
   int num)
 {
pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
+   pkt_cache_t *rx_cache = _dpdk->rx_cache[index];
uint16_t nb_rx;
-
struct rte_mbuf *rx_mbufs[num];
+   int i;
+   unsigned cache_idx;
 
if (!pkt_dpdk->lockless_rx)
odp_ticketlock_lock(_dpdk->rx_lock[index]);
+   /**
+* ixgbe_pmd has a minimum supported RX burst size ('min_rx_burst'). If
+* 'num' < 'min_rx_burst', 'min_rx_burst' is used as rte_eth_rx_burst()
+* argument and the possibly received extra packets are cached for the
+* next dpdk_recv_queue() call to use.
+*
+* Either use cached packets or receive new ones. Not both during the
+* same call. */
+   if (rx_cache->s.count > 0) {
+   for (i = 0; i < num && rx_cache->s.count; i++) {
+   rx_mbufs[i] = rx_cache->s.pkt[rx_cache->s.idx];
+   rx_cache->s.idx++;
+   rx_cache->s.count--;
+   }
+   nb_rx = i;
+   } else if ((unsigned)num < pkt_dpdk->min_rx_burst) {
+   struct rte_mbuf *new_mbufs[pkt_dpdk->min_rx_burst];
 
-   nb_rx = rte_eth_rx_burst(pktio_entry->s.pkt_dpdk.port_id, index,
-rx_mbufs, num);
+   nb_rx = rte_eth_rx_burst(pktio_entry->s.pkt_dpdk.port_id, index,
+new_mbufs, pkt_dpdk->min_rx_burst);
+
+   rx_cache->s.idx = 0;
+   for (i = 0; i < nb_rx; i++) {
+   if (i < num) {
+   rx_mbufs[i] = new_mbufs[i];
+   } else {
+   cache_idx = rx_cache->s.count;
+   rx_cache->s.pkt[cache_idx] = 

[lng-odp] [API-NEXT PATCH 01/11] linux-generic: pktio: add DPDK pktio build support

2016-01-27 Thread Matias Elo
Add initial support for building ODP with DPDK pktio.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 DEPENDENCIES   | 54 
 platform/linux-generic/Makefile.am |  2 +
 platform/linux-generic/include/odp_packet_dpdk.h   | 20 +
 .../linux-generic/include/odp_packet_io_internal.h |  3 +
 platform/linux-generic/m4/configure.m4 |  1 +
 platform/linux-generic/m4/odp_dpdk.m4  | 43 ++
 platform/linux-generic/pktio/dpdk.c| 96 ++
 platform/linux-generic/pktio/io_ops.c  |  3 +
 8 files changed, 222 insertions(+)
 create mode 100644 platform/linux-generic/include/odp_packet_dpdk.h
 create mode 100644 platform/linux-generic/m4/odp_dpdk.m4
 create mode 100644 platform/linux-generic/pktio/dpdk.c

diff --git a/DEPENDENCIES b/DEPENDENCIES
index c2711d5..fe7df40 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -154,6 +154,60 @@ Prerequisites for building the OpenDataPlane (ODP) API
netmap kernel module is loaded. If socket I/O is desired instead, it can be
activated by setting the environment variable ODP_PKTIO_DISABLE_NETMAP.
 
+3.4 DPDK (optional)
+
+   Use DPDK for ODP packet I/O.
+
+3.4.1 Building DPDK
+
+   DPDK packet I/O has been tested to work with DPDK v2.2.0.
+
+   # Checkout DPDK code
+   $ git clone http://dpdk.org/git/dpdk
+   $ cd dpdk
+   $ git checkout v2.2.0
+
+   # Make and edit DPDK configuration
+   $ make config T=x86_64-native-linuxapp-gcc O=x86_64-native-linuxapp-gcc
+   $ cd x86_64-native-linuxapp-gcc
+   $ sed -ri 's,(CONFIG_RTE_BUILD_COMBINE_LIBS=).*,\1y,' .config
+   # To use I/O without DPDK supported NIC's enable pcap pmd:
+   $ sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
+   $ cd ..
+
+   # Build DPDK
+   $ make install T=x86_64-native-linuxapp-gcc EXTRA_CFLAGS="-fPIC"
+
+3.4.2 Setup system
+
+   # Load DPDK modules
+   $ sudo /sbin/modprobe uio
+   $ cd 
+   $ sudo insmod x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
+
+   Reserve and mount hugepages and bind supported interfaces to DPDK modules
+   following the DPDK documentation. ODP DPDK packet I/O has been tested with
+   512 x 2MB hugepages. All this can be done with the DPDK setup script
+   (/tools/setup.sh).
+
+3.4.3 Building ODP
+
+   $ cd 
+   $ ./bootstrap
+   $ ./configure --with-dpdk-path=/x86_64-native-linuxapp-gcc
+   $ make
+
+3.4.4 Running ODP with DPDK I/O
+
+   ODP applications will try use DPDK for packet I/O by default. If some other
+   I/O type is desired instead, DPDK I/O can be disabled by setting the
+   environment variable ODP_PKTIO_DISABLE_DPDK.
+
+   DPDK interfaces are accessed using indices. For example, two first DPDK
+   interfaces can be used with the odp_l2fwd example as follows:
+   $ cd 
+   $ sudo ./test/performance/odp_l2fwd -i 0,1 -c 2 -m 0
+
 4.0 Packages needed to build API tests
 
Cunit test framework version 2.1-3 is required
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index fde2553..e307e81 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -103,6 +103,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_packet_io_internal.h \
  ${srcdir}/include/odp_packet_io_queue.h \
  ${srcdir}/include/odp_packet_netmap.h \
+ ${srcdir}/include/odp_packet_dpdk.h \
  ${srcdir}/include/odp_packet_socket.h \
  ${srcdir}/include/odp_packet_tap.h \
  ${srcdir}/include/odp_pkt_queue_internal.h \
@@ -139,6 +140,7 @@ __LIB__libodp_la_SOURCES = \
   pktio/pktio_common.c \
   pktio/loop.c \
   pktio/netmap.c \
+  pktio/dpdk.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
   pktio/sysfs.c \
diff --git a/platform/linux-generic/include/odp_packet_dpdk.h 
b/platform/linux-generic/include/odp_packet_dpdk.h
new file mode 100644
index 000..71fdbdc
--- /dev/null
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -0,0 +1,20 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PACKET_DPDK_H
+#define ODP_PACKET_DPDK_H
+
+#include 
+#include 
+
+
+/** Packet IO using DPDK interface */
+typedef struct {
+   odp_pool_t pool;  /**< pool to alloc packets from */
+   odp_pktio_capability_t  capa; /**< interface capabilities */
+} pkt_dpdk_t;
+
+#endif
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index a734877..e732b85 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ 

[lng-odp] [API-NEXT PATCH 00/11] DPDK pktio implementation

2016-01-27 Thread Matias Elo
Implements new DPDK pktio type, which operates in the same manner as the
existing ODP interface types. DPDK mbuf packets are copied during receive/send
to maintain compatibility with the linux-generic pktio.

The current unoptimized DPDK pktio implementation achieves forwarding rates
(odp_l2fwd), which are comparable to netmap pktio and scale better with larger
thread counts. Some initial benchmark results below
(odp_l2fwd  4 x 10 Gbps - 64B, Intel Xeon E5-2697v3).

Threads
1   2   4   6   8   10  12
DPDK6.7 12  25.337.247.647.346.8MPPS
Netmap  6.1 12.625.832.438.938.638.4


From 8 threads and onwards the throughput is limited by the NICs (Intel 82599).

Build and usage information can be found from DEPENDENCIES. The DPDK
initialization code is copied from the odp-dpdk branch.

Matias Elo (11):
  linux-generic: pktio: add DPDK pktio build support
  linux-generic: pktio: initial DPDK pktio implementation
  linux-generic: dpdk: add get/set functions for mtu, promisc mode, and
capability
  linux-generic: dpdk: add rx/tx locking
  linux-generic: dpdk: add odp_pktio_link_status()
  linux-generic: dpdk: add dpdk_setup_port()
  linux-generic: dpdk: add functions for fetching packet input/output
queues
  linux-generic: dpdk: add odp_pktio_input_queues_config()
  linux-generic: dpdk: add odp_pktio_output_queues_config()
  linux-generic: dpdk: handle ixgbe_pmd minimum burst size
  linux-generic: dpdk: close resources in odp_pktio_close()

 DEPENDENCIES   |  54 ++
 platform/linux-generic/Makefile.am |   2 +
 platform/linux-generic/include/odp_internal.h  |   5 +
 platform/linux-generic/include/odp_packet_dpdk.h   |  68 ++
 .../linux-generic/include/odp_packet_io_internal.h |   3 +
 platform/linux-generic/m4/configure.m4 |   1 +
 platform/linux-generic/m4/odp_dpdk.m4  |  43 ++
 platform/linux-generic/odp_init.c  |  12 +
 platform/linux-generic/pktio/dpdk.c| 826 +
 platform/linux-generic/pktio/io_ops.c  |   3 +
 10 files changed, 1017 insertions(+)
 create mode 100644 platform/linux-generic/include/odp_packet_dpdk.h
 create mode 100644 platform/linux-generic/m4/odp_dpdk.m4
 create mode 100644 platform/linux-generic/pktio/dpdk.c

-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 05/11] linux-generic: dpdk: add odp_pktio_link_status()

2016-01-27 Thread Matias Elo
Implement odp_pktio_link_status() for dpdk pktio.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/pktio/dpdk.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 7a82b07..819bd5f 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -609,6 +609,17 @@ static int dpdk_capability(pktio_entry_t *pktio_entry,
return 0;
 }
 
+static int dpdk_link_status(pktio_entry_t *pktio_entry)
+{
+   struct rte_eth_link link;
+
+   memset(, 0, sizeof(struct rte_eth_link));
+
+   rte_eth_link_get_nowait(pktio_entry->s.pkt_dpdk.port_id, );
+
+   return link.link_status;
+}
+
 const pktio_if_ops_t dpdk_pktio_ops = {
.name = "dpdk",
.init = NULL,
@@ -621,7 +632,7 @@ const pktio_if_ops_t dpdk_pktio_ops = {
.send = dpdk_send,
.recv_queue = dpdk_recv_queue,
.send_queue = dpdk_send_queue,
-   .link_status = NULL,
+   .link_status = dpdk_link_status,
.mtu_get = dpdk_mtu_get,
.promisc_mode_set = dpdk_promisc_mode_set,
.promisc_mode_get = dpdk_promisc_mode_get,
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 06/11] linux-generic: dpdk: add dpdk_setup_port()

2016-01-27 Thread Matias Elo
Add helper function dpdk_setup_port() for configuring
DPDK ports.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/pktio/dpdk.c | 62 -
 1 file changed, 41 insertions(+), 21 deletions(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 819bd5f..7b67de1 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -151,6 +151,43 @@ static int dpdk_netdev_is_valid(const char *s)
return 1;
 }
 
+static int dpdk_setup_port(pktio_entry_t *pktio_entry)
+{
+   pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
+   int ret;
+   struct rte_eth_conf port_conf = {
+   .rxmode = {
+   .mq_mode = ETH_MQ_RX_RSS,
+   .max_rx_pkt_len = pkt_dpdk->data_room,
+   .split_hdr_size = 0,
+   .header_split   = 0,
+   .hw_ip_checksum = 0,
+   .hw_vlan_filter = 0,
+   .jumbo_frame= 1,
+   .hw_strip_crc   = 0,
+   },
+   .rx_adv_conf = {
+   .rss_conf = {
+   .rss_key = NULL,
+   .rss_hf = ETH_RSS_IP,
+   },
+   },
+   .txmode = {
+   .mq_mode = ETH_MQ_TX_NONE,
+   },
+   };
+
+   ret = rte_eth_dev_configure(pkt_dpdk->port_id,
+   pktio_entry->s.num_in_queue,
+   pktio_entry->s.num_out_queue, _conf);
+   if (ret < 0) {
+   ODP_ERR("Failed to setup device: err=%d, port=%" PRIu8 "\n",
+   ret, pkt_dpdk->port_id);
+   return -1;
+   }
+   return 0;
+}
+
 static int dpdk_close(pktio_entry_t *pktio_entry ODP_UNUSED)
 {
return 0;
@@ -354,32 +391,15 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
int ret;
unsigned i;
 
-   struct rte_eth_conf port_conf = {
-   .rxmode = {
-   .max_rx_pkt_len = pkt_dpdk->data_room,
-   .split_hdr_size = 0,
-   .header_split   = 0, /**< Header Split disabled */
-   .hw_ip_checksum = 0, /**< IP checksum offload disabled 
*/
-   .hw_vlan_filter = 0, /**< VLAN filtering disabled */
-   .jumbo_frame= 1, /**< Jumbo Frame Support enabled */
-   .hw_strip_crc   = 0, /**< CRC stripped by hardware */
-   },
-   .txmode = {
-   .mq_mode = ETH_MQ_TX_NONE,
-   },
-   };
-
/* DPDK doesn't support nb_rx_q/nb_tx_q being 0 */
if (!pktio_entry->s.num_in_queue)
pktio_entry->s.num_in_queue = 1;
if (!pktio_entry->s.num_out_queue)
pktio_entry->s.num_out_queue = 1;
-   ret = rte_eth_dev_configure(pkt_dpdk->port_id,
-   pktio_entry->s.num_in_queue,
-   pktio_entry->s.num_out_queue, _conf);
-   if (ret < 0) {
-   ODP_ERR("Cannot configure device: err=%d, port=%" PRIu8 "\n",
-   ret, pkt_dpdk->port_id);
+
+   /* init port */
+   if (dpdk_setup_port(pktio_entry)) {
+   ODP_ERR("Failed to configure device\n");
return -1;
}
/* Init TX queues */
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 04/11] linux-generic: dpdk: add rx/tx locking

2016-01-27 Thread Matias Elo
Add locking support to dpdk_recv_queue() and
dpdk_send_queue().

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/include/odp_packet_dpdk.h |  5 +
 platform/linux-generic/pktio/dpdk.c  | 19 +++
 2 files changed, 24 insertions(+)

diff --git a/platform/linux-generic/include/odp_packet_dpdk.h 
b/platform/linux-generic/include/odp_packet_dpdk.h
index 5676f4c..659f08d 100644
--- a/platform/linux-generic/include/odp_packet_dpdk.h
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -38,6 +39,10 @@ typedef struct {
/** DPDK packet pool name (pktpool_) */
char pool_name[IF_NAMESIZE + 8];
uint8_t port_id;  /**< DPDK port identifier */
+   odp_bool_t lockless_rx;   /**< no locking for rx */
+   odp_bool_t lockless_tx;   /**< no locking for tx */
+   odp_ticketlock_t rx_lock[PKTIO_MAX_QUEUES];  /**< RX queue locks */
+   odp_ticketlock_t tx_lock[PKTIO_MAX_QUEUES];  /**< TX queue locks */
 } pkt_dpdk_t;
 
 #endif
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index aad4066..7a82b07 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -277,6 +277,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
struct rte_mempool *pkt_pool;
odp_pool_info_t pool_info;
uint16_t data_room;
+   int i;
 
if (getenv("ODP_PKTIO_DISABLE_DPDK"))
return -1;
@@ -338,6 +339,11 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
RTE_PKTMBUF_HEADROOM;
pkt_dpdk->data_room = RTE_MIN(pool_info.params.pkt.len, data_room);
 
+   for (i = 0; i < PKTIO_MAX_QUEUES; i++) {
+   odp_ticketlock_init(_dpdk->rx_lock[i]);
+   odp_ticketlock_init(_dpdk->tx_lock[i]);
+   }
+
return 0;
 }
 
@@ -497,16 +503,23 @@ static int dpdk_recv_queue(pktio_entry_t *pktio_entry,
   odp_packet_t pkt_table[],
   int num)
 {
+   pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
uint16_t nb_rx;
 
struct rte_mbuf *rx_mbufs[num];
 
+   if (!pkt_dpdk->lockless_rx)
+   odp_ticketlock_lock(_dpdk->rx_lock[index]);
+
nb_rx = rte_eth_rx_burst(pktio_entry->s.pkt_dpdk.port_id, index,
 rx_mbufs, num);
 
if (nb_rx > 0)
nb_rx = mbuf_to_pkt(pktio_entry, pkt_table, rx_mbufs, nb_rx);
 
+   if (!pktio_entry->s.pkt_dpdk.lockless_rx)
+   odp_ticketlock_unlock(_dpdk->rx_lock[index]);
+
return nb_rx;
 }
 
@@ -528,6 +541,9 @@ static int dpdk_send_queue(pktio_entry_t *pktio_entry,
int i;
int mbufs;
 
+   if (!pktio_entry->s.pkt_dpdk.lockless_tx)
+   odp_ticketlock_lock(_dpdk->tx_lock[index]);
+
mbufs = pkt_to_mbuf(pktio_entry, tx_mbufs, pkt_table, num);
 
tx_pkts = rte_eth_tx_burst(pkt_dpdk->port_id, index,
@@ -540,6 +556,9 @@ static int dpdk_send_queue(pktio_entry_t *pktio_entry,
 
odp_packet_free_multi(pkt_table, tx_pkts);
 
+   if (!pktio_entry->s.pkt_dpdk.lockless_tx)
+   odp_ticketlock_unlock(_dpdk->tx_lock[index]);
+
if (odp_unlikely(tx_pkts == 0 && __odp_errno != 0))
return -1;
 
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 07/11] linux-generic: dpdk: add functions for fetching packet input/output queues

2016-01-27 Thread Matias Elo
Implement odp_pktio_in_queues(), odp_pktio_pktin_queues(),
and odp_pktio_pktout_queues() functions.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/pktio/dpdk.c | 48 ++---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 7b67de1..91fa810 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -640,6 +640,48 @@ static int dpdk_link_status(pktio_entry_t *pktio_entry)
return link.link_status;
 }
 
+static int dpdk_in_queues(pktio_entry_t *pktio_entry, odp_queue_t queues[],
+ int num)
+{
+   int i;
+   int num_queues = pktio_entry->s.num_in_queue;
+
+   if (queues && num > 0) {
+   for (i = 0; i < num && i < num_queues; i++)
+   queues[i] = pktio_entry->s.in_queue[i].queue;
+   }
+
+   return num_queues;
+}
+
+static int dpdk_pktin_queues(pktio_entry_t *pktio_entry,
+odp_pktin_queue_t queues[], int num)
+{
+   int i;
+   int num_queues = pktio_entry->s.num_in_queue;
+
+   if (queues && num > 0) {
+   for (i = 0; i < num && i < num_queues; i++)
+   queues[i] = pktio_entry->s.in_queue[i].pktin;
+   }
+
+   return num_queues;
+}
+
+static int dpdk_pktout_queues(pktio_entry_t *pktio_entry,
+ odp_pktout_queue_t queues[], int num)
+{
+   int i;
+   int num_queues = pktio_entry->s.num_out_queue;
+
+   if (queues && num > 0) {
+   for (i = 0; i < num && i < num_queues; i++)
+   queues[i] = pktio_entry->s.out_queue[i].pktout;
+   }
+
+   return num_queues;
+}
+
 const pktio_if_ops_t dpdk_pktio_ops = {
.name = "dpdk",
.init = NULL,
@@ -660,9 +702,9 @@ const pktio_if_ops_t dpdk_pktio_ops = {
.capability = dpdk_capability,
.input_queues_config = NULL,
.output_queues_config = NULL,
-   .in_queues = NULL,
-   .pktin_queues = NULL,
-   .pktout_queues = NULL
+   .in_queues = dpdk_in_queues,
+   .pktin_queues = dpdk_pktin_queues,
+   .pktout_queues = dpdk_pktout_queues
 };
 
 #endif /* ODP_DPDK */
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 03/11] linux-generic: dpdk: add get/set functions for mtu, promisc mode, and capability

2016-01-27 Thread Matias Elo
Add dpdk_mtu_get(), dpdk_promisc_mode_set(),
dpdk_promisc_mode_get(), and dpdk_capability() functions.

Reviewed-by: Petri Savolainen 
Signed-off-by: Matias Elo 
---
 platform/linux-generic/pktio/dpdk.c | 44 +
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index be622dd..aad4066 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -273,6 +273,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
 odp_pool_t pool)
 {
pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
+   struct rte_eth_dev_info dev_info;
struct rte_mempool *pkt_pool;
odp_pool_info_t pool_info;
uint16_t data_room;
@@ -314,6 +315,11 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
return -1;
}
 
+   memset(_info, 0, sizeof(struct rte_eth_dev_info));
+   rte_eth_dev_info_get(pkt_dpdk->port_id, _info);
+   pkt_dpdk->capa.max_input_queues = dev_info.max_rx_queues;
+   pkt_dpdk->capa.max_output_queues = dev_info.max_tx_queues;
+
/* Look for previously opened packet pool */
pkt_pool = rte_mempool_lookup(pkt_dpdk->pool_name);
if (pkt_pool == NULL)
@@ -554,6 +560,36 @@ static int dpdk_mac_addr_get(pktio_entry_t *pktio_entry, 
void *mac_addr)
return ETH_ALEN;
 }
 
+static int dpdk_mtu_get(pktio_entry_t *pktio_entry)
+{
+   uint16_t mtu;
+
+   if (rte_eth_dev_get_mtu(pktio_entry->s.pkt_dpdk.port_id, ) != 0)
+   return -1;
+   return mtu;
+}
+
+static int dpdk_promisc_mode_set(pktio_entry_t *pktio_entry, odp_bool_t enable)
+{
+   if (enable)
+   rte_eth_promiscuous_enable(pktio_entry->s.pkt_dpdk.port_id);
+   else
+   rte_eth_promiscuous_disable(pktio_entry->s.pkt_dpdk.port_id);
+   return 0;
+}
+
+static int dpdk_promisc_mode_get(pktio_entry_t *pktio_entry)
+{
+   return rte_eth_promiscuous_get(pktio_entry->s.pkt_dpdk.port_id);
+}
+
+static int dpdk_capability(pktio_entry_t *pktio_entry,
+  odp_pktio_capability_t *capa)
+{
+   *capa = pktio_entry->s.pkt_dpdk.capa;
+   return 0;
+}
+
 const pktio_if_ops_t dpdk_pktio_ops = {
.name = "dpdk",
.init = NULL,
@@ -567,11 +603,11 @@ const pktio_if_ops_t dpdk_pktio_ops = {
.recv_queue = dpdk_recv_queue,
.send_queue = dpdk_send_queue,
.link_status = NULL,
-   .mtu_get = NULL,
-   .promisc_mode_set = NULL,
-   .promisc_mode_get = NULL,
+   .mtu_get = dpdk_mtu_get,
+   .promisc_mode_set = dpdk_promisc_mode_set,
+   .promisc_mode_get = dpdk_promisc_mode_get,
.mac_get = dpdk_mac_addr_get,
-   .capability = NULL,
+   .capability = dpdk_capability,
.input_queues_config = NULL,
.output_queues_config = NULL,
.in_queues = NULL,
-- 
1.9.1

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCH 2/2 v2] validation: timer: handle early exhaustion of pool

2016-01-27 Thread Zoltan Kiss
As per-thread caches might retain some elements, no particular thread
should assume that a certain amount of elements are available at any
time.
Also, to make the high watermark test reliable we should avoid releasing
timers.

Signed-off-by: Zoltan Kiss 
---

v2:
- keep high watermark test by bookkeeping the exact amounts of allocation. It
  needs a change in order of allocation to make sure no timer is released,
  otherwise the watermark becomes unpredictable
- use Ola's subject recommendation

 test/validation/timer/timer.c | 38 +++---
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index 5d89700..8f00788 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -37,6 +37,10 @@ static odp_timer_pool_t tp;
 /** @private Count of timeouts delivered too late */
 static odp_atomic_u32_t ndelivtoolate;
 
+/** @private Sum of all allocated timers from all threads. Thread-local
+ * caches may make this number lower than the capacity of the pool  */
+static odp_atomic_u32_t timers_allocated;
+
 /** @private min() function */
 static int min(int a, int b)
 {
@@ -274,7 +278,7 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t 
prev_tick)
 static void *worker_entrypoint(void *arg TEST_UNUSED)
 {
int thr = odp_thread_id();
-   uint32_t i;
+   uint32_t i, allocated;
unsigned seed = thr;
int rc;
 
@@ -290,21 +294,30 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
 
/* Prepare all timers */
for (i = 0; i < NTIMERS; i++) {
-   tt[i].tim = odp_timer_alloc(tp, queue, [i]);
-   if (tt[i].tim == ODP_TIMER_INVALID)
-   CU_FAIL_FATAL("Failed to allocate timer");
tt[i].ev = odp_timeout_to_event(odp_timeout_alloc(tbp));
-   if (tt[i].ev == ODP_EVENT_INVALID)
-   CU_FAIL_FATAL("Failed to allocate timeout");
+   if (tt[i].ev == ODP_EVENT_INVALID) {
+   LOG_DBG("Failed to allocate timeout (%d/%d)\n",
+   i, NTIMERS);
+   break;
+   }
+   tt[i].tim = odp_timer_alloc(tp, queue, [i]);
+   if (tt[i].tim == ODP_TIMER_INVALID) {
+   LOG_DBG("Failed to allocate timer (%d/%d)\n",
+   i, NTIMERS);
+   odp_timeout_free(tt[i].ev);
+   break;
+   }
tt[i].ev2 = tt[i].ev;
tt[i].tick = TICK_INVALID;
}
+   allocated = i;
+   odp_atomic_fetch_add_u32(_allocated, allocated);
 
odp_barrier_wait(_barrier);
 
/* Initial set all timers with a random expiration time */
uint32_t nset = 0;
-   for (i = 0; i < NTIMERS; i++) {
+   for (i = 0; i < allocated; i++) {
uint64_t tck = odp_timer_current_tick(tp) + 1 +
   odp_timer_ns_to_tick(tp,
(rand_r() % RANGE_MS)
@@ -336,7 +349,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
nrcv++;
}
prev_tick = odp_timer_current_tick(tp);
-   i = rand_r() % NTIMERS;
+   i = rand_r() % allocated;
if (tt[i].ev == ODP_EVENT_INVALID &&
(rand_r() % 2 == 0)) {
/* Timer active, cancel it */
@@ -384,7 +397,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
 
/* Cancel and free all timers */
uint32_t nstale = 0;
-   for (i = 0; i < NTIMERS; i++) {
+   for (i = 0; i < allocated; i++) {
(void)odp_timer_cancel(tt[i].tim, [i].ev);
tt[i].tick = TICK_INVALID;
if (tt[i].ev == ODP_EVENT_INVALID)
@@ -428,7 +441,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
 
rc = odp_queue_destroy(queue);
CU_ASSERT(rc == 0);
-   for (i = 0; i < NTIMERS; i++) {
+   for (i = 0; i < allocated; i++) {
if (tt[i].ev != ODP_EVENT_INVALID)
odp_event_free(tt[i].ev);
}
@@ -504,6 +517,9 @@ void timer_test_odp_timer_all(void)
/* Initialize the shared timeout counter */
odp_atomic_init_u32(, 0);
 
+   /* Initialize the number of finally allocated elements */
+   odp_atomic_init_u32(_allocated, 0);
+
/* Create and start worker threads */
pthrd_arg thrdarg;
thrdarg.testcase = 0;
@@ -520,7 +536,7 @@ void timer_test_odp_timer_all(void)
CU_FAIL("odp_timer_pool_info");
CU_ASSERT(tpinfo.param.num_timers == (unsigned)num_workers * NTIMERS);
CU_ASSERT(tpinfo.cur_timers == 0);
-   CU_ASSERT(tpinfo.hwm_timers == (unsigned)num_workers * NTIMERS);
+   CU_ASSERT(tpinfo.hwm_timers == 

Re: [lng-odp] [API-NEXT PATCH 2/2] validation: timer: don't utilize pool enirely

2016-01-27 Thread Zoltan Kiss



On 26/01/16 16:17, Ola Liljedahl wrote:



On 26 January 2016 at 14:32, Zoltan Kiss > wrote:

Hi Ola,

Would you mind taking a look at this?

Zoli

On 22/01/16 18:24, Zoltan Kiss wrote:

As per-thread caches might retain some elements, no particular
thread
should assume that a certain amount of elements are available at any
time.
Also, we can't reliable check the high watermark anymore.

Signed-off-by: Zoltan Kiss >
---
   test/validation/timer/timer.c | 27 +--
   1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/test/validation/timer/timer.c
b/test/validation/timer/timer.c
index 5d89700..e9f2a90 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -274,7 +274,7 @@ static void handle_tmo(odp_event_t ev, bool
stale, uint64_t prev_tick)
   static void *worker_entrypoint(void *arg TEST_UNUSED)
   {
 int thr = odp_thread_id();
-   uint32_t i;
+   uint32_t i, allocated;
 unsigned seed = thr;
 int rc;

@@ -291,20 +291,28 @@ static void *worker_entrypoint(void *arg
TEST_UNUSED)
 /* Prepare all timers */
 for (i = 0; i < NTIMERS; i++) {
 tt[i].tim = odp_timer_alloc(tp, queue, [i]);
-   if (tt[i].tim == ODP_TIMER_INVALID)
-   CU_FAIL_FATAL("Failed to allocate timer");
+   if (tt[i].tim == ODP_TIMER_INVALID) {
+   LOG_DBG("Failed to allocate timer
(%d/%d)\n",
+   i, NTIMERS);
+   break;
+   }
 tt[i].ev =
odp_timeout_to_event(odp_timeout_alloc(tbp));
-   if (tt[i].ev == ODP_EVENT_INVALID)
-   CU_FAIL_FATAL("Failed to allocate timeout");
+   if (tt[i].ev == ODP_EVENT_INVALID) {
+   LOG_DBG("Failed to allocate timeout
(%d/%d)\n",
+   i, NTIMERS);
+   odp_timer_free(tt[i].tim);
+   break;
+   }
 tt[i].ev2 = tt[i].ev;
 tt[i].tick = TICK_INVALID;
 }
+   allocated = i;

 odp_barrier_wait(_barrier);

 /* Initial set all timers with a random expiration time */
 uint32_t nset = 0;
-   for (i = 0; i < NTIMERS; i++) {
+   for (i = 0; i < allocated; i++) {
 uint64_t tck = odp_timer_current_tick(tp) + 1 +
odp_timer_ns_to_tick(tp,

(rand_r() % RANGE_MS)
@@ -336,7 +344,7 @@ static void *worker_entrypoint(void *arg
TEST_UNUSED)
 nrcv++;
 }
 prev_tick = odp_timer_current_tick(tp);
-   i = rand_r() % NTIMERS;
+   i = rand_r() % allocated;
 if (tt[i].ev == ODP_EVENT_INVALID &&
 (rand_r() % 2 == 0)) {
 /* Timer active, cancel it */
@@ -384,7 +392,7 @@ static void *worker_entrypoint(void *arg
TEST_UNUSED)

 /* Cancel and free all timers */
 uint32_t nstale = 0;
-   for (i = 0; i < NTIMERS; i++) {
+   for (i = 0; i < allocated; i++) {
 (void)odp_timer_cancel(tt[i].tim, [i].ev);
 tt[i].tick = TICK_INVALID;
 if (tt[i].ev == ODP_EVENT_INVALID)
@@ -428,7 +436,7 @@ static void *worker_entrypoint(void *arg
TEST_UNUSED)

 rc = odp_queue_destroy(queue);
 CU_ASSERT(rc == 0);
-   for (i = 0; i < NTIMERS; i++) {
+   for (i = 0; i < allocated; i++) {
 if (tt[i].ev != ODP_EVENT_INVALID)
 odp_event_free(tt[i].ev);
 }
@@ -520,7 +528,6 @@ void timer_test_odp_timer_all(void)
 CU_FAIL("odp_timer_pool_info");
 CU_ASSERT(tpinfo.param.num_timers ==
(unsigned)num_workers * NTIMERS);
 CU_ASSERT(tpinfo.cur_timers == 0);
-   CU_ASSERT(tpinfo.hwm_timers == (unsigned)num_workers *
NTIMERS);

It is a bit sad that this check is removed. Now there will be now test
that 'hwm_timers' (high watermark) is correct.
Couldn't you accumulate all the allocated 

[lng-odp] [PATCH] linux-generic: packet_io: fix array indexing in pktin_deq_multi()

2016-01-27 Thread Zoltan Kiss
'j' is incremented twice, therefore every second element of hdr_tbl is
garbage. Introduced in f3c1e77f "linux-generic: pktio: optimize
pktin_deq_multi".

Signed-off-by: Zoltan Kiss 
---
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index cda1900..540cdb8 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -640,7 +640,7 @@ int pktin_deq_multi(queue_entry_t *qentry, odp_buffer_hdr_t 
*buf_hdr[], int num)
/* Queue the rest for later */
for (j = 0; i < pkts; i++, j++) {
buf= _odp_packet_to_buffer(pkt_tbl[i]);
-   hdr_tbl[j++] = odp_buf_to_hdr(buf);
+   hdr_tbl[j] = odp_buf_to_hdr(buf);
}
 
if (j)
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v3 1/2] linux-generic: test: move validation tests to their own directory

2016-01-27 Thread Mike Holmes
Simplify adding platform performance tests by mirroring the test directory
structure and moving the validation tests to their own directory.

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/m4/configure.m4 |   3 +-
 platform/linux-generic/test/Makefile.am|  51 +
 platform/linux-generic/test/pktio/.gitignore   |   2 -
 platform/linux-generic/test/pktio/Makefile.am  |   9 --
 platform/linux-generic/test/pktio/pktio_env| 120 -
 platform/linux-generic/test/pktio/pktio_run| 110 ---
 platform/linux-generic/test/pktio/pktio_run_pcap   |  33 --
 platform/linux-generic/test/pktio/pktio_run_tap| 115 
 platform/linux-generic/test/validation/Makefile.am |  44 
 .../linux-generic/test/validation/pktio/.gitignore |   2 +
 .../test/validation/pktio/Makefile.am  |   9 ++
 .../linux-generic/test/validation/pktio/pktio_env  | 120 +
 .../linux-generic/test/validation/pktio/pktio_run  | 110 +++
 .../test/validation/pktio/pktio_run_pcap   |  33 ++
 .../test/validation/pktio/pktio_run_tap| 115 
 test/performance/odp_l2fwd_run |   6 +-
 16 files changed, 442 insertions(+), 440 deletions(-)
 delete mode 100644 platform/linux-generic/test/pktio/.gitignore
 delete mode 100644 platform/linux-generic/test/pktio/Makefile.am
 delete mode 100644 platform/linux-generic/test/pktio/pktio_env
 delete mode 100755 platform/linux-generic/test/pktio/pktio_run
 delete mode 100755 platform/linux-generic/test/pktio/pktio_run_pcap
 delete mode 100755 platform/linux-generic/test/pktio/pktio_run_tap
 create mode 100644 platform/linux-generic/test/validation/Makefile.am
 create mode 100644 platform/linux-generic/test/validation/pktio/.gitignore
 create mode 100644 platform/linux-generic/test/validation/pktio/Makefile.am
 create mode 100644 platform/linux-generic/test/validation/pktio/pktio_env
 create mode 100755 platform/linux-generic/test/validation/pktio/pktio_run
 create mode 100755 platform/linux-generic/test/validation/pktio/pktio_run_pcap
 create mode 100755 platform/linux-generic/test/validation/pktio/pktio_run_tap

diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index df6dc64..97c15fa 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -23,4 +23,5 @@ m4_include([platform/linux-generic/m4/odp_pcap.m4])
 
 AC_CONFIG_FILES([platform/linux-generic/Makefile
 platform/linux-generic/test/Makefile
-platform/linux-generic/test/pktio/Makefile])
+platform/linux-generic/test/validation/Makefile
+platform/linux-generic/test/validation/pktio/Makefile])
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index e629872..3cf638d 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -1,56 +1,13 @@
-include $(top_srcdir)/test/Makefile.inc
-TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
-
-ODP_MODULES = pktio
+SUBDIRS =
 
 if test_vald
-TESTS = pktio/pktio_run \
-   pktio/pktio_run_tap \
-   ${top_builddir}/test/validation/buffer/buffer_main$(EXEEXT) \
-   
${top_builddir}/test/validation/classification/classification_main$(EXEEXT) \
-   ${top_builddir}/test/validation/config/config_main$(EXEEXT) \
-   ${top_builddir}/test/validation/cpumask/cpumask_main$(EXEEXT) \
-   ${top_builddir}/test/validation/crypto/crypto_main$(EXEEXT) \
-   ${top_builddir}/test/validation/errno/errno_main$(EXEEXT) \
-   ${top_builddir}/test/validation/hash/hash_main$(EXEEXT) \
-   ${top_builddir}/test/validation/init/init_main_ok$(EXEEXT) \
-   ${top_builddir}/test/validation/init/init_main_abort$(EXEEXT) \
-   ${top_builddir}/test/validation/init/init_main_log$(EXEEXT) \
-   ${top_builddir}/test/validation/packet/packet_main$(EXEEXT) \
-   ${top_builddir}/test/validation/pool/pool_main$(EXEEXT) \
-   ${top_builddir}/test/validation/queue/queue_main$(EXEEXT) \
-   ${top_builddir}/test/validation/random/random_main$(EXEEXT) \
-   ${top_builddir}/test/validation/scheduler/scheduler_main$(EXEEXT) \
-   ${top_builddir}/test/validation/std_clib/std_clib_main$(EXEEXT) \
-   
${top_builddir}/test/validation/synchronizers/synchronizers_main$(EXEEXT) \
-   ${top_builddir}/test/validation/thread/thread_main$(EXEEXT) \
-   ${top_builddir}/test/validation/time/time_main$(EXEEXT) \
-   ${top_builddir}/test/validation/timer/timer_main$(EXEEXT) \
-   ${top_builddir}/test/validation/shmem/shmem_main$(EXEEXT) \
-   ${top_builddir}/test/validation/system/system_main$(EXEEXT)
-
-SUBDIRS = $(ODP_MODULES)
-
-if HAVE_PCAP
-TESTS += pktio/pktio_run_pcap
+SUBDIRS += validation
 endif
-endif

[lng-odp] [PATCH v3 2/2] linux-generic: test: add performance test framework

2016-01-27 Thread Mike Holmes
Add infrastructure for platform dependent performance testing.
Added scheduler performance test using process mode.

Signed-off-by: Mike Holmes 
---
v3:
   Fixes running by hand (Bill)
   Cleanups for installcheck etc (Stuart)

 platform/linux-generic/m4/configure.m4 |  1 +
 platform/linux-generic/test/Makefile.am|  4 
 platform/linux-generic/test/performance/.gitignore |  1 +
 .../linux-generic/test/performance/Makefile.am | 22 +
 .../test/performance/odp_scheduling_proc_run   | 28 ++
 test/performance/Makefile.am   |  2 +-
 6 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 platform/linux-generic/test/performance/.gitignore
 create mode 100644 platform/linux-generic/test/performance/Makefile.am
 create mode 100755 
platform/linux-generic/test/performance/odp_scheduling_proc_run

diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index 97c15fa..82b7c5e 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -23,5 +23,6 @@ m4_include([platform/linux-generic/m4/odp_pcap.m4])
 
 AC_CONFIG_FILES([platform/linux-generic/Makefile
 platform/linux-generic/test/Makefile
+platform/linux-generic/test/performance/Makefile
 platform/linux-generic/test/validation/Makefile
 platform/linux-generic/test/validation/pktio/Makefile])
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index 3cf638d..7fe79c9 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -4,6 +4,10 @@ if test_vald
 SUBDIRS += validation
 endif
 
+if test_perf
+SUBDIRS += performance
+endif
+
 if test_installdir
 installcheck-local:
$(DESTDIR)/$(testdir)/run-test
diff --git a/platform/linux-generic/test/performance/.gitignore 
b/platform/linux-generic/test/performance/.gitignore
new file mode 100644
index 000..93778a9
--- /dev/null
+++ b/platform/linux-generic/test/performance/.gitignore
@@ -0,0 +1 @@
+tests-performance.env
diff --git a/platform/linux-generic/test/performance/Makefile.am 
b/platform/linux-generic/test/performance/Makefile.am
new file mode 100644
index 000..7b0c096
--- /dev/null
+++ b/platform/linux-generic/test/performance/Makefile.am
@@ -0,0 +1,22 @@
+include $(top_srcdir)/test/Makefile.inc
+TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/performance
+
+if test_perf
+TESTS = odp_scheduling_proc_run
+endif
+
+TEST_ENV = tests-performance.env
+
+dist_check_SCRIPTS = odp_scheduling_proc_run $(TEST_ENV) $(LOG_COMPILER)
+
+test_SCRIPTS = $(dist_check_SCRIPTS)
+
+.PHONY: performance-test-env
+performance-test-env:
+
+clean-local: tests-performance.env
+
+tests-performance.env:
+   echo "TESTS=\"$(TESTS)\""> $@
+   echo "$(TESTS_ENVIRONMENT)" >> $@
+   echo "$(LOG_COMPILER)"  >> $@
diff --git a/platform/linux-generic/test/performance/odp_scheduling_proc_run 
b/platform/linux-generic/test/performance/odp_scheduling_proc_run
new file mode 100755
index 000..31d43be
--- /dev/null
+++ b/platform/linux-generic/test/performance/odp_scheduling_proc_run
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (c) 2015, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Script that passes command line arguments to odp_scheduling test when
+# launched by 'make check'
+TEST_DIR="${TEST_DIR:-$(dirname $0)}"
+
+PATH=${TEST_DIR}:$PATH
+PATH=$(dirname $0)/../../../../test/performance:$PATH
+
+ret=0
+
+run()
+{
+   echo odp_scheduling_proc_run starts with $1 worker threads
+   echo ===
+
+   odp_scheduling${EXEEXT} -c $1 --proc || ret=1
+}
+
+run 1
+run 8
+
+exit $ret
diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
index 721615b..719be2b 100644
--- a/test/performance/Makefile.am
+++ b/test/performance/Makefile.am
@@ -14,7 +14,7 @@ if test_perf
 TESTS = $(EXECUTABLES) $(TESTSCRIPTS)
 endif
 
-bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
+test_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
 
 odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
 odp_atomic_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv2 2/6] linux-generic: packet: implement broadcast and multicast metadata flags

2016-01-27 Thread Bill Fischofer
Signed-off-by: Bill Fischofer 
---
 .../linux-generic/include/odp_packet_internal.h|  4 +++
 platform/linux-generic/odp_packet_flags.c  | 40 ++
 2 files changed, 44 insertions(+)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 1340f8a..55cc0a8 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -46,6 +46,8 @@ typedef union {
uint32_t l4:1;/**< known L4 protocol present */
 
uint32_t eth:1;   /**< Ethernet */
+   uint32_t eth_bcast:1; /**< Ethernet broadcast */
+   uint32_t eth_mcast:1; /**< Ethernet multicast */
uint32_t jumbo:1; /**< Jumbo frame */
uint32_t vlan:1;  /**< VLAN hdr found */
uint32_t vlan_qinq:1; /**< Stacked VLAN found, QinQ */
@@ -55,6 +57,8 @@ typedef union {
 
uint32_t ipv4:1;  /**< IPv4 */
uint32_t ipv6:1;  /**< IPv6 */
+   uint32_t ip_bcast:1;  /**< IP broadcast */
+   uint32_t ip_mcast:1;  /**< IP multicast */
uint32_t ipfrag:1;/**< IP fragment */
uint32_t ipopt:1; /**< IP optional headers */
uint32_t ipsec:1; /**< IPSec decryption may be needed */
diff --git a/platform/linux-generic/odp_packet_flags.c 
b/platform/linux-generic/odp_packet_flags.c
index ae9a9ed..1a0a11c 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -85,6 +85,16 @@ int odp_packet_has_eth(odp_packet_t pkt)
return pkt_hdr->input_flags.eth;
 }
 
+int odp_packet_has_eth_bcast(odp_packet_t pkt)
+{
+   retflag(pkt, input_flags.eth_bcast);
+}
+
+int odp_packet_has_eth_mcast(odp_packet_t pkt)
+{
+   retflag(pkt, input_flags.eth_mcast);
+}
+
 int odp_packet_has_jumbo(odp_packet_t pkt)
 {
odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
@@ -117,6 +127,16 @@ int odp_packet_has_ipv6(odp_packet_t pkt)
retflag(pkt, input_flags.ipv6);
 }
 
+int odp_packet_has_ip_bcast(odp_packet_t pkt)
+{
+   retflag(pkt, input_flags.ip_bcast);
+}
+
+int odp_packet_has_ip_mcast(odp_packet_t pkt)
+{
+   retflag(pkt, input_flags.ip_mcast);
+}
+
 int odp_packet_has_ipfrag(odp_packet_t pkt)
 {
retflag(pkt, input_flags.ipfrag);
@@ -226,6 +246,16 @@ void odp_packet_has_eth_set(odp_packet_t pkt, int val)
setflag(pkt, input_flags.eth, val);
 }
 
+void odp_packet_has_eth_bcast_set(odp_packet_t pkt, int val)
+{
+   setflag(pkt, input_flags.eth_bcast, val);
+}
+
+void odp_packet_has_eth_mcast_set(odp_packet_t pkt, int val)
+{
+   setflag(pkt, input_flags.eth_mcast, val);
+}
+
 void odp_packet_has_jumbo_set(odp_packet_t pkt, int val)
 {
setflag(pkt, input_flags.jumbo, val);
@@ -256,6 +286,16 @@ void odp_packet_has_ipv6_set(odp_packet_t pkt, int val)
setflag(pkt, input_flags.ipv6, val);
 }
 
+void odp_packet_has_ip_bcast_set(odp_packet_t pkt, int val)
+{
+   setflag(pkt, input_flags.ip_bcast, val);
+}
+
+void odp_packet_has_ip_mcast_set(odp_packet_t pkt, int val)
+{
+   setflag(pkt, input_flags.ip_mcast, val);
+}
+
 void odp_packet_has_ipfrag_set(odp_packet_t pkt, int val)
 {
setflag(pkt, input_flags.ipfrag, val);
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv2 3/6] linux-generic: packet: implement parser extensions for broadcast and multicast

2016-01-27 Thread Bill Fischofer
Signed-off-by: Bill Fischofer 
---
 platform/linux-generic/odp_packet.c | 37 -
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index db85b5e..9395132 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -784,6 +784,7 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr,
uint8_t ver = ODPH_IPV4HDR_VER(ipv4->ver_ihl);
uint8_t ihl = ODPH_IPV4HDR_IHL(ipv4->ver_ihl);
uint16_t frag_offset;
+   uint32_t dstaddr = odp_be_to_cpu_32(ipv4->dst_addr);
 
pkt_hdr->l3_len = odp_be_to_cpu_16(ipv4->tot_len);
 
@@ -809,6 +810,10 @@ static inline uint8_t parse_ipv4(odp_packet_hdr_t *pkt_hdr,
if (odp_unlikely(ODPH_IPV4HDR_IS_FRAGMENT(frag_offset)))
pkt_hdr->input_flags.ipfrag = 1;
 
+   /* Handle IPv4 broadcast / multicast */
+   pkt_hdr->input_flags.ip_bcast = (dstaddr == 0x);
+   pkt_hdr->input_flags.ip_mcast = (dstaddr >> 28) == 0xd;
+
return ipv4->proto;
 }
 
@@ -820,6 +825,7 @@ static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr,
 {
const odph_ipv6hdr_t *ipv6 = (const odph_ipv6hdr_t *)*parseptr;
const odph_ipv6hdr_ext_t *ipv6ext;
+   uint32_t dstaddr0 = odp_be_to_cpu_32(ipv6->dst_addr[0]);
 
pkt_hdr->l3_len = odp_be_to_cpu_16(ipv6->payload_len);
 
@@ -830,11 +836,14 @@ static inline uint8_t parse_ipv6(odp_packet_hdr_t 
*pkt_hdr,
return 0;
}
 
+   /* IPv6 broadcast / multicast flags */
+   pkt_hdr->input_flags.ip_mcast = (dstaddr0 & 0xff00) == 0xff00;
+   pkt_hdr->input_flags.ip_bcast = 0;
+
/* Skip past IPv6 header */
*offset   += sizeof(odph_ipv6hdr_t);
*parseptr += sizeof(odph_ipv6hdr_t);
 
-
/* Skip past any IPv6 extension headers */
if (ipv6->next_hdr == ODPH_IPPROTO_HOPOPTS ||
ipv6->next_hdr == ODPH_IPPROTO_ROUTE) {
@@ -850,7 +859,8 @@ static inline uint8_t parse_ipv6(odp_packet_hdr_t *pkt_hdr,
  ipv6ext->next_hdr == ODPH_IPPROTO_ROUTE) &&
*offset < pkt_hdr->frame_len);
 
-   if (*offset >= pkt_hdr->l3_offset + 
odp_be_to_cpu_16(ipv6->payload_len)) {
+   if (*offset >= pkt_hdr->l3_offset +
+   odp_be_to_cpu_16(ipv6->payload_len)) {
pkt_hdr->error_flags.ip_err = 1;
return 0;
}
@@ -938,23 +948,24 @@ int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const 
uint8_t *ptr)
uint32_t offset, seglen;
uint8_t ip_proto = 0;
const uint8_t *parseptr;
+   uint16_t macaddr0;
 
offset = sizeof(odph_ethhdr_t);
if (packet_parse_l2_not_done(pkt_hdr))
packet_parse_l2(pkt_hdr);
 
-   if (ptr == NULL) {
-   eth = (odph_ethhdr_t *)packet_map(pkt_hdr, 0, );
-   parseptr = (const uint8_t *)>type;
-   ethtype = odp_be_to_cpu_16(*((const uint16_t *)
-  (const void *)parseptr));
-   } else {
-   eth = (const odph_ethhdr_t *)ptr;
-   parseptr = (const uint8_t *)>type;
-   ethtype = odp_be_to_cpu_16(*((const uint16_t *)
-  (const void *)parseptr));
-   }
+   eth = ptr ? (const odph_ethhdr_t *)ptr :
+   (odph_ethhdr_t *)packet_map(pkt_hdr, 0, );
+
+   /* Handle Ethernet broadcast/multicast addresses */
+   macaddr0 = odp_be_to_cpu_16(*((const uint16_t *)(const void *)eth));
+   pkt_hdr->input_flags.eth_mcast = (macaddr0 & 0x0100) == 0x0100;
+   pkt_hdr->input_flags.eth_bcast = (macaddr0 == 0x);
 
+   /* Get Ethertype */
+   parseptr = (const uint8_t *)>type;
+   ethtype = odp_be_to_cpu_16(*((const uint16_t *)
+(const void *)parseptr));
 
/* Parse the VLAN header(s), if present */
if (ethtype == ODPH_ETHTYPE_VLAN_OUTER) {
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv2 1/6] api: packet: add bcast/mcast parse documentation

2016-01-27 Thread Bill Fischofer
Signed-off-by: Bill Fischofer 
---
 include/odp/api/packet_flags.h | 16 
 1 file changed, 16 insertions(+)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index 65fd3ce..a9fd07a 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -109,6 +109,9 @@ int odp_packet_has_eth(odp_packet_t pkt);
 /**
  * Check for Ethernet broadcast address
  *
+ * ODP recognizes the destination MAC address as broadcast if it begins
+ * FF:FF:
+ *
  * @param pkt Packet handle
  * @retval non-zero if Ethernet destination address is the broadcast address
  * @retval 0 if Ethernet destination address is not the broadcast address
@@ -118,6 +121,8 @@ int odp_packet_has_eth_bcast(odp_packet_t pkt);
 /**
  * Check for Ethernet multicast address
  *
+ * ODP recognizes the destination MAC address as multicast if bit 7 is 1.
+ *
  * @param pkt Packet handle
  * @retval non-zero if Ethernet destination address is a multicast address
  * @retval 0 if Ethernet destination address is not a multicast address
@@ -181,6 +186,11 @@ int odp_packet_has_ipv6(odp_packet_t pkt);
 /**
  * Check for IP broadcast address
  *
+ * For IPv4, ODP recognizes the destination IP address 255.255.255.255 as
+ * a broadcast address. All other addresses are considered non-broadcast.
+ *
+ * For IPv6, no destination addresses are recognized as broadcast addresses.
+ *
  * @param pkt Packet handle
  * @retval non-zero if IP destination address is a broadcast address
  * @retval 0 if IP destination address is not a broadcast address
@@ -190,6 +200,12 @@ int odp_packet_has_ip_bcast(odp_packet_t pkt);
 /**
  * Check for IP multicast address
  *
+ * For IPv4 ODP recognizes destination IP addresses in the range 224.0.0.0
+ * through 239.255.255.255 as multicast addresses.
+ *
+ * For IPv6 ODP recognizes destination IP addresses with prefixes FF00::
+ * through :: as multicast addresses.
+ *
  * @param pkt Packet handle
  * @retval non-zero if IP destination address is a multicast address
  * @retval 0 if IP destination address is not a multicast address
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv2 0/6] Packet Multicast Implementation and Documentation

2016-01-27 Thread Bill Fischofer
Changes for v2:
- Add parse criteria to API documentation for bcast/mcast flags
- Implement revised parse criteria

This patch series adds the implementation, CUnit validation tests, and
documentation for the addition of the broadcast and multicast packet metadata
APIs.

This series must be applied following patch
http://patches.opendataplane.org/patch/4653/

Bill Fischofer (6):
  api: packet: add bcast/mcast parse documentation
  linux-generic: packet: implement broadcast and multicast metadata
flags
  linux-generic: packet: implement parser extensions for broadcast and
multicast
  validataion: packet: add tests for broadcast and multicast flags
  documentation: userguide: add images for packet processing
  documentation: userguide: add packet processing description

 doc/images/packet.svg  |   4 +
 doc/images/segment.svg |   4 +
 doc/users-guide/users-guide.adoc   | 121 +
 include/odp/api/packet_flags.h |  16 +++
 .../linux-generic/include/odp_packet_internal.h|   4 +
 platform/linux-generic/odp_packet.c|  37 ---
 platform/linux-generic/odp_packet_flags.c  |  40 +++
 test/validation/packet/packet.c|   9 +-
 8 files changed, 221 insertions(+), 14 deletions(-)
 create mode 100644 doc/images/packet.svg
 create mode 100644 doc/images/segment.svg

-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv2 6/6] documentation: userguide: add packet processing description

2016-01-27 Thread Bill Fischofer
Signed-off-by: Bill Fischofer 
---
 doc/users-guide/users-guide.adoc | 121 +++
 1 file changed, 121 insertions(+)

diff --git a/doc/users-guide/users-guide.adoc b/doc/users-guide/users-guide.adoc
index b3c08a1..513f383 100644
--- a/doc/users-guide/users-guide.adoc
+++ b/doc/users-guide/users-guide.adoc
@@ -768,6 +768,127 @@ NOTE: Both ordered and parallel queues improve throughput 
over atomic queues
 due to parallel event processing, but require that the application take
 steps to ensure context data synchronization if needed.
 
+== Packet Processing
+ODP applications are designed to process packets, which are the basic unit of
+data of interest in the data plane. To assist in processing packets, ODP
+provides a set of APIs that enable applications to examine and manipulate
+packet data and metadata. Packets are referenced by an abstract *odp_packet_t*
+handle defined by each implementation.
+
+Packet objects are normally created at ingress when they arrive at a source
+*odp_pktio_t* and are received by an application either directly or (more
+typically) foa a scheduled receive queue. They MAY be implicitly freed when
+they are transmitted to an output *odp_pktio_t* via an associated transmit
+queue, or freed directly via the +odp_packet_free()+ API.
+
+Occasionally an application may originate a packet itself, either _de novo_ or
+by deriving it from an existing packet, and APIs are provided to assist in
+these cases as well. Application-created packets can be recycled back through
+a _loopback interface_ to reparse and reclassify them, or the application can
+do its own parsing as desired.
+
+Various attributes associated with a packet, such as parse results, are
+stored as metadata and APIs are provided to permit applications to examing
+and/or modify this information.
+
+=== Packet Structure and Concepts
+A _packet_ consists of a sequence of octets conforming to an architectued
+format, such as Ethernet, that can be received and transmitted via the ODP
+*pktio* abstraction. Packets of a _length_, which is the number of bytes in
+the packet. Packet data in ODP is referenced via _offsets_ since these reflect
+the logical contents and structure of a packet independent of how particular
+ODP implementations store that data.
+
+These concetps are shown in the following diagram:
+
+.ODP Packet Structure
+image::../images/packet.svg[align="center"]
+
+Packet data consists of zero or more _headers_ followed by 0 or more bytes of
+_payload_, followed by zero or more _trailers_.  Shown here are various APIs
+that permit applications to examine and navigate various parts of a packet and
+to manipulate its structure.
+
+To support packet manipulation, predefined _headroom_ and _tailroom_
+areas are logically associated with a packet. Packets can be adjusted by
+_pulling_ and _pushing_ these areas. Typical packet processing might consist
+of stripping headers from a packet via +odp_pull_head()+ calls as part of
+receive procesing and then replacing them with new headers via 
+odp_push_head()+
+calls as the packet is being prepared for transmit.
+
+=== Packet Segments and Addressing
+ODP platforms use various methods and techniques to store and process packets
+efficiently. These vary considerably from platform to platofrm, so to ensure
+portability across them ODP adopts certain conventions for referencing
+packets.
+
+ODP APIs use a handle of type *odp_packet_t* to refer to packet objects.
+Associated with packets are various bits of system metadata that describe the
+packet. By referring to the metadata, ODP applications accelerate packet
+processin gby minimizing the need to examine packet data. This is because the
+metadata is pupolated by parsing and classification functions that are coupled
+to ingress processing that occur prior to a packet being presented to the
+application via the ODP scheduler.
+
+When an ODP application needs to examine the contents of a packet, it requests
+addressability to it via an API call that makes the packet (or a contiguously
+addressable _segment_ of it) available for coherent access by the application.
+To ensure portability, ODP applications assume that the underlying
+implementation stores packets in _segments_ of implementation-defined
+and managed size. These represent the contiguously addressable portaions of a
+packet that the application may refer to via normal memory accesses. ODP
+provides APIs that allow applications to operate on packet segments in an
+efficient and portable manner as needed. By combining these with the metadata
+provided by packets, ODP applications can operate in a fully
+platform-independent manner while still achieving optimal performance across
+the range of platforms that support DOP.
+
+The use of segments for packet addressing and their relationship to metadata
+is shown in this diagram:
+
+.ODP Packet Segmentation
+image::../images/segment.svg[align="center"]
+
+The packet 

[lng-odp] [API-NEXT PATCHv2 4/6] validataion: packet: add tests for broadcast and multicast flags

2016-01-27 Thread Bill Fischofer
Signed-off-by: Bill Fischofer 
---
 test/validation/packet/packet.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
index 2467dec..c5e2356 100644
--- a/test/validation/packet/packet.c
+++ b/test/validation/packet/packet.c
@@ -609,12 +609,16 @@ void packet_test_in_flags(void)
TEST_INFLAG(pkt, l3);
TEST_INFLAG(pkt, l4);
TEST_INFLAG(pkt, eth);
+   TEST_INFLAG(pkt, eth_bcast);
+   TEST_INFLAG(pkt, eth_mcast);
TEST_INFLAG(pkt, jumbo);
TEST_INFLAG(pkt, vlan);
TEST_INFLAG(pkt, vlan_qinq);
TEST_INFLAG(pkt, arp);
TEST_INFLAG(pkt, ipv4);
TEST_INFLAG(pkt, ipv6);
+   TEST_INFLAG(pkt, ip_bcast);
+   TEST_INFLAG(pkt, ip_mcast);
TEST_INFLAG(pkt, ipfrag);
TEST_INFLAG(pkt, ipopt);
TEST_INFLAG(pkt, ipsec);
@@ -724,13 +728,16 @@ static void _packet_compare_inflags(odp_packet_t pkt1, 
odp_packet_t pkt2)
COMPARE_INFLAG(pkt1, pkt2, l3);
COMPARE_INFLAG(pkt1, pkt2, l4);
COMPARE_INFLAG(pkt1, pkt2, eth);
+   COMPARE_INFLAG(pkt1, pkt2, eth_bcast);
+   COMPARE_INFLAG(pkt1, pkt2, eth_mcast);
COMPARE_INFLAG(pkt1, pkt2, jumbo);
-   COMPARE_INFLAG(pkt1, pkt2, eth);
COMPARE_INFLAG(pkt1, pkt2, vlan);
COMPARE_INFLAG(pkt1, pkt2, vlan_qinq);
COMPARE_INFLAG(pkt1, pkt2, arp);
COMPARE_INFLAG(pkt1, pkt2, ipv4);
COMPARE_INFLAG(pkt1, pkt2, ipv6);
+   COMPARE_INFLAG(pkt1, pkt2, ip_bcast);
+   COMPARE_INFLAG(pkt1, pkt2, ip_mcast);
COMPARE_INFLAG(pkt1, pkt2, ipfrag);
COMPARE_INFLAG(pkt1, pkt2, ipopt);
COMPARE_INFLAG(pkt1, pkt2, ipsec);
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 3/3] linux-generic: remove direct include of endian.h from byteorder.h

2016-01-27 Thread Mike Holmes
byteorder.h should include odp/std_types.h in line with the precedent
set by the other headers.

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/include/odp/byteorder.h | 2 --
 platform/linux-generic/include/odp/std_types.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/include/odp/byteorder.h 
b/platform/linux-generic/include/odp/byteorder.h
index 173b047..7fc7dc5 100644
--- a/platform/linux-generic/include/odp/byteorder.h
+++ b/platform/linux-generic/include/odp/byteorder.h
@@ -17,8 +17,6 @@
 extern "C" {
 #endif
 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/platform/linux-generic/include/odp/std_types.h 
b/platform/linux-generic/include/odp/std_types.h
index cb30bfc..56b5a4e 100644
--- a/platform/linux-generic/include/odp/std_types.h
+++ b/platform/linux-generic/include/odp/std_types.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 1/3] linux-generic: remove direct include of stdint.h by atomic.h

2016-01-27 Thread Mike Holmes
atomic.h should include odp/std_types.h in line with the precedent
set by the other headers.

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/include/odp/atomic.h| 1 -
 platform/linux-generic/include/odp/barrier.h   | 1 +
 platform/linux-generic/include/odp/plat/atomic_types.h | 1 +
 platform/linux-generic/include/odp/std_types.h | 1 +
 4 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp/atomic.h 
b/platform/linux-generic/include/odp/atomic.h
index deb4039..10cf361 100644
--- a/platform/linux-generic/include/odp/atomic.h
+++ b/platform/linux-generic/include/odp/atomic.h
@@ -17,7 +17,6 @@
 extern "C" {
 #endif
 
-#include 
 #include 
 #include 
 
diff --git a/platform/linux-generic/include/odp/barrier.h 
b/platform/linux-generic/include/odp/barrier.h
index 42df859..3447429 100644
--- a/platform/linux-generic/include/odp/barrier.h
+++ b/platform/linux-generic/include/odp/barrier.h
@@ -17,6 +17,7 @@
 extern "C" {
 #endif
 
+#include 
 #include 
 #include 
 #include 
diff --git a/platform/linux-generic/include/odp/plat/atomic_types.h 
b/platform/linux-generic/include/odp/plat/atomic_types.h
index 0f6c353..0fe15ed 100644
--- a/platform/linux-generic/include/odp/plat/atomic_types.h
+++ b/platform/linux-generic/include/odp/plat/atomic_types.h
@@ -18,6 +18,7 @@
 extern "C" {
 #endif
 
+#include 
 #include 
 
 /**
diff --git a/platform/linux-generic/include/odp/std_types.h 
b/platform/linux-generic/include/odp/std_types.h
index 1bd22ff..f509243 100644
--- a/platform/linux-generic/include/odp/std_types.h
+++ b/platform/linux-generic/include/odp/std_types.h
@@ -17,6 +17,7 @@
 extern "C" {
 #endif
 
+#include 
 #include 
 #include 
 #include 
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 2/3] linux-generic: remove direct include of stdlib.h by timer.h

2016-01-27 Thread Mike Holmes
timer.h should include odp/std_types.h in line with the precedent
set by the other headers.

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/include/odp/std_types.h | 1 +
 platform/linux-generic/include/odp/timer.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp/std_types.h 
b/platform/linux-generic/include/odp/std_types.h
index f509243..cb30bfc 100644
--- a/platform/linux-generic/include/odp/std_types.h
+++ b/platform/linux-generic/include/odp/std_types.h
@@ -17,6 +17,7 @@
 extern "C" {
 #endif
 
+#include 
 #include 
 #include 
 #include 
diff --git a/platform/linux-generic/include/odp/timer.h 
b/platform/linux-generic/include/odp/timer.h
index af9b140..3e9cd4e 100644
--- a/platform/linux-generic/include/odp/timer.h
+++ b/platform/linux-generic/include/odp/timer.h
@@ -17,7 +17,6 @@
 extern "C" {
 #endif
 
-#include 
 #include 
 #include 
 #include 
-- 
2.5.0

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv2] validation: timer: fix delay after loop

2016-01-27 Thread Maxim Uvarov

Merged,
Maxim.

On 01/26/2016 19:06, Ivan Khoronzhuk wrote:



On 26.01.16 17:46, Maxim Uvarov wrote:

Signed-off-by: Maxim Uvarov 


Reviewed-by: Ivan Khoronzhuk 


---
  test/validation/timer/timer.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/validation/timer/timer.c 
b/test/validation/timer/timer.c

index 5d89700..0bd67fb 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -405,12 +405,14 @@ static void *worker_entrypoint(void *arg 
TEST_UNUSED)

  thr, nstale);

  /* Delay some more to ensure timeouts for expired timers can be
- * received */
+ * received. Can not use busy loop here to make background timer
+ * thread finish their work. */
  struct timespec ts;
  ts.tv_sec = 0;
-ts.tv_nsec = 100; /* 1ms */
+ts.tv_nsec = (3 * RANGE_MS / 10 + 50) * ODP_TIME_MSEC_IN_NS;
  if (nanosleep(, NULL) < 0)
  CU_FAIL_FATAL("nanosleep failed");
+
  while (nstale != 0) {
  odp_event_t ev = odp_queue_deq(queue);
  if (ev != ODP_EVENT_INVALID) {





___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 04/12] linux-generic: sysinfo: move x86 system info codes to its plarform file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

This patch moves the x86 system info codes into the newly added x86
specific platform file.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/Makefile.am |  6 +-
 .../linux-generic/arch/x86/odp_sysinfo_parse.c | 72 ++
 platform/linux-generic/include/odp_internal.h  |  4 ++
 platform/linux-generic/odp_system_info.c   | 68 +---
 4 files changed, 81 insertions(+), 69 deletions(-)
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index c1e8ccb..ae32268 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -161,12 +161,14 @@ __LIB__libodp_la_SOURCES = \
   odp_traffic_mngr.c \
   odp_version.c \
   odp_weak.c \
-  arch/@ARCH@/odp_cpu_arch.c
+  arch/@ARCH@/odp_cpu_arch.c \
+  arch/@ARCH@/odp_sysinfo_parse.c
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
-arch/x86/odp_cpu_arch.c
+arch/x86/odp_cpu_arch.c \
+arch/x86/odp_sysinfo_parse.c
 
 if HAVE_PCAP
 __LIB__libodp_la_SOURCES += pktio/pcap.c
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
new file mode 100644
index 000..e2931cb
--- /dev/null
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -0,0 +1,72 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double ghz = 0.0;
+   uint64_t hz;
+   int id = 0;
+
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
+   pos = strstr(str, "model name");
+   if (pos) {
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+
+   pos = strchr(sysinfo->model_str[id], '@');
+   *(pos - 1) = '\0';
+   if (sscanf(pos, "@ %lfGHz", ) == 1) {
+   hz = (uint64_t)(ghz * 10.0);
+   sysinfo->cpu_hz[id] = hz;
+   }
+   id++;
+   }
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id)
+{
+   char str[1024];
+   FILE *file;
+   int cpu;
+   char *pos;
+   double mhz = 0.0;
+
+   file = fopen("/proc/cpuinfo", "rt");
+
+   /* find the correct processor instance */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "processor");
+   if (pos) {
+   if (sscanf(pos, "processor : %d", ) == 1)
+   if (cpu == id)
+   break;
+   }
+   }
+
+   /* extract the cpu current speed */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "cpu MHz");
+   if (pos) {
+   if (sscanf(pos, "cpu MHz : %lf", ) == 1)
+   break;
+   }
+   }
+
+   fclose(file);
+   if (mhz)
+   return (uint64_t)(mhz * 100.0);
+
+   return -1;
+}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 39e6f78..b527438 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -20,6 +20,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 extern __thread int __odp_errno;
 
@@ -108,6 +109,9 @@ int odp_tm_init_global(void);
 
 void _odp_flush_caches(void);
 
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo);
+uint64_t odp_cpu_hz_current(int id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index fd6b866..fd25067 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -109,71 +109,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __x86_64__ || defined __i386__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double ghz = 0.0;
-   int id = 0;
-
-   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
-   pos = strstr(str, "model name");
-   if (pos) {
-

[lng-odp] [PATCH v8 API-NEXT 06/12] linux-generic: sysinfo: move ARM system info codes to default arch file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

This patch moves the ARM system info codes into the general arch file,
ARM sysinfo isn't implemented now and there is no need to create specific
arch file for it, but this can serve as the default implementaton instead.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/Makefile.am|  1 +
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 19 +++
 platform/linux-generic/odp_system_info.c  | 15 +--
 3 files changed, 21 insertions(+), 14 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index d476ae9..f4bc58e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -166,6 +166,7 @@ __LIB__libodp_la_SOURCES = \
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
+arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
new file mode 100644
index 000..881dd2d
--- /dev/null
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -0,0 +1,19 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+  odp_system_info_t *sysinfo ODP_UNUSED)
+{
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 1959434..7d68c2e 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -109,20 +109,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __arm__ || defined __aarch64__
-
-static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
- odp_system_info_t *sysinfo ODP_UNUSED)
-{
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
-#elif defined __powerpc__
+#if defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 03/12] linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

This function will be moved to their own platform specific files too,
it is better to be named with a odp_ prefix.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/odp_system_info.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 113ae63..fd6b866 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -137,7 +137,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id)
+static uint64_t odp_cpu_hz_current(int id)
 {
char str[1024];
FILE *file;
@@ -181,7 +181,7 @@ static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -228,7 +228,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -274,7 +274,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -403,12 +403,12 @@ uint64_t odp_cpu_hz(void)
 {
int id = sched_getcpu();
 
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_id(int id)
 {
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_max(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv5 2/2] doc: update CONTRIBUTING and DEPENDENCIES files for images

2016-01-27 Thread Maxim Uvarov

Merged,
Maxim.

On 01/15/2016 03:06, Bill Fischofer wrote:

Signed-off-by: Bill Fischofer 
---
  CONTRIBUTING |  5 ++---
  DEPENDENCIES | 11 ++-
  2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/CONTRIBUTING b/CONTRIBUTING
index 4ad964e..f6e3fc6 100644
--- a/CONTRIBUTING
+++ b/CONTRIBUTING
@@ -126,9 +126,8 @@ Code without a proper signoff cannot be merged into the 
mainline.
  
  - Images are decorated with :-
  .Optional Title
-image::../images/.png[align="center"]
-- The images are stored in the doc/images directory as svg files and rendered 
as
-  png and eps during the build process.
+image::../images/.svg[align="center"]
+- The images are stored in the doc/images directory as svg files.
  - Body text shall wrap at the 80 char point.
  - No warnings may be generated by the asciidoc tool.
  
diff --git a/DEPENDENCIES b/DEPENDENCIES

index fec65d2..bddadf3 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -189,12 +189,9 @@ Prerequisites for building the OpenDataPlane (ODP) API
  
  5.0 Documentation Images & Doxygen
  
-  Images are stored as svg files and the png or eps versions generated when the docs are built

-  Image magics convert application is used
-  # Debian/Ubuntu
-  # apt-get install imagemagick
+  Images are stored as svg files. No conversions for these are needed.
  
-  Message squence diagrams are stored as msc files and the png or eps versions generated when the docs are built

+  Message squence diagrams are stored as msc files and the svg versions 
generated when the docs are built
mscgen is used
#Debian/Ubuntu
# apt-get install mscgen
@@ -208,10 +205,6 @@ The tested version of doxygen is 1.8.8
 # Debian/Ubuntu
 $ apt-get install doxygen graphviz
  
-5.1.2 PDF

-   # Debian/Ubuntu
-   $ apt-get install texlive-latex-recommended texlive-latex-extra 
texlive-fonts-recommended
-
  5.2 User guides
  
  5.2.1 HTML


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] doc: make docs build conditionally

2016-01-27 Thread Maxim Uvarov

Merged,
Maxim.

On 01/26/2016 22:38, Anders Roxell wrote:

On 20 January 2016 at 19:52, Mike Holmes  wrote:

Currently docs will build the images regardless of the setting for
enable-user-docs at configure time.
The image generation should be dependent on actually building docs so
that systems without the image tools installed will not generate
warnings.

Signed-off-by: Mike Holmes 

Reviewed-by: Anders Roxell 


---
  doc/Makefile.am | 8 ++--
  1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 41d804b..2a38106 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,10 +1,6 @@
-SUBDIRS = images
-
-if HAVE_DOXYGEN
+if user_guide
  clean-local:
 rm -rf output
-endif

-if user_guide
-SUBDIRS += implementers-guide users-guide process-guide
+SUBDIRS = images implementers-guide users-guide process-guide
  endif
--
2.5.0

___
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


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

v7->v8 changes:
 - use file name odp_cpu_arch.c in this patch set instead of odp_cpu_cycles.c
since the top api-next tree did this change 

v6->v7 changes:
 - update symlink in patch 7

v5->v6 changes:
 - eliminate checkpatch.pl warnings

v4->v5 changes:
 - rebase to latest api-next branch

v3->v4 changes:
 - update patch 9 of platform naming
 - add new patch 12 to rename cpu_hz to cpu_hz_max

v2->v3 changes:
use "api: cpu:" tag in patch 8/11 title instead of "linux-generic: sysinfo"

v1->v2 changes:
 - don't create arch/arm/ since there isn't implementation now, use arch/linux
as default choice
 - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent this
arch cannot be compiled
 - add some clean-ups patches 8~11, these patches are against the previous ones
so send them together for better review and merge.

v1 notes:
This patch set separates the CPU info codes into their own platform sepcific
files.
It is common sence that the top general layer call an uniform interface to
initialize some plarform specific data structures, and this uniform interface
is implemented in their own platform specific files.
This patch set makes it.

Hongbo Zhang (12):
  linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
  linux-generic: sysinfo: use uniform call odp_sysinfo_parser
  linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
  linux-generic: sysinfo: move x86 system info codes to its plarform
file
  linux-generic: sysinfo: move MIPS system info codes to its plarform
file
  linux-generic: sysinfo: move ARM system info codes to default arch
file
  linux-generic: sysinfo: move PowerPC system info codes to its plarform
file
  api: cpu: make frequency API return 0 on failure
  linux-generic: sysinfo: set values for cpu_arch_str
  linux-generic: sysinfo: apply per-CPU implementation to MIPS
  linux-generic: sysinfo: apply per-CPU implementation to PowerPC
  linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

 configure.ac   |   1 +
 include/odp/api/cpu.h  |   4 +
 platform/linux-generic/Makefile.am |  10 +-
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h |   1 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
 .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
 platform/linux-generic/include/odp_internal.h  |   7 +-
 platform/linux-generic/odp_system_info.c   | 220 +
 11 files changed, 246 insertions(+), 217 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
 create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 01/12] linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

This is a pre-step for separating platform specific codes into their own
arch files.
Value of cpu_arch_str will be set later in separate arch parser code.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/include/odp_internal.h | 1 +
 platform/linux-generic/odp_system_info.c  | 5 -
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index cdbed7d..39e6f78 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -31,6 +31,7 @@ typedef struct {
uint64_t page_size;
int  cache_line_size;
int  cpu_count;
+   char cpu_arch_str[128];
char model_str[MAX_CPU_NUMBER][128];
 } odp_system_info_t;
 
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index de28fab..2e3726e 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -27,7 +27,6 @@
 
 
 typedef struct {
-   const char *cpu_arch_str;
int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
 
 } odp_compiler_info_t;
@@ -292,19 +291,15 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 static odp_compiler_info_t compiler_info = {
#if defined __x86_64__ || defined __i386__
-   .cpu_arch_str = "x86",
.cpuinfo_parser = cpuinfo_x86
 
#elif defined __arm__ || defined __aarch64__
-   .cpu_arch_str = "arm",
.cpuinfo_parser = cpuinfo_arm
 
#elif defined __OCTEON__
-   .cpu_arch_str = "octeon",
.cpuinfo_parser = cpuinfo_octeon
 
#elif defined __powerpc__
-   .cpu_arch_str = "powerpc",
.cpuinfo_parser = cpuinfo_powerpc
 
#else
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 02/12] linux-generic: sysinfo: use uniform call odp_sysinfo_parser

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

It is common way that the general top layer calls a uniform interface to
initialize data structrure for different plarform, this patch introduces
odp_sysinfo_parser() instead of using different interfaces for each
platform, and also removes using structure odp_compiler_info_t since both
members inside it become useless now.
This is still another pre-step for separating platform specific codes into
their own arch files.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/odp_system_info.c | 36 ++--
 1 file changed, 6 insertions(+), 30 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 2e3726e..113ae63 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -25,12 +25,6 @@
 #include 
 
 
-
-typedef struct {
-   int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
-
-} odp_compiler_info_t;
-
 #define CACHE_LNSZ_FILE \
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
 
@@ -117,7 +111,7 @@ static int huge_page_size(void)
  */
 #if defined __x86_64__ || defined __i386__
 
-static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -181,8 +175,8 @@ static uint64_t arch_cpu_hz_current(int id)
 
 #elif defined __arm__ || defined __aarch64__
 
-static int cpuinfo_arm(FILE *file ODP_UNUSED,
-odp_system_info_t *sysinfo ODP_UNUSED)
+static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+ odp_system_info_t *sysinfo ODP_UNUSED)
 {
return 0;
 }
@@ -194,7 +188,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 #elif defined __OCTEON__
 
-static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -240,7 +234,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 }
 
 #elif defined __powerpc__
-static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -289,24 +283,6 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
#error GCC target not found
 #endif
 
-static odp_compiler_info_t compiler_info = {
-   #if defined __x86_64__ || defined __i386__
-   .cpuinfo_parser = cpuinfo_x86
-
-   #elif defined __arm__ || defined __aarch64__
-   .cpuinfo_parser = cpuinfo_arm
-
-   #elif defined __OCTEON__
-   .cpuinfo_parser = cpuinfo_octeon
-
-   #elif defined __powerpc__
-   .cpuinfo_parser = cpuinfo_powerpc
-
-   #else
-   #error GCC target not found
-   #endif
-};
-
 
 #if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \
 defined __powerpc__
@@ -398,7 +374,7 @@ int odp_system_info_init(void)
return -1;
}
 
-   compiler_info.cpuinfo_parser(file, _global_data.system_info);
+   odp_cpuinfo_parser(file, _global_data.system_info);
 
fclose(file);
 
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 12/12] linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

The legacy variable cpu_hz holds the max frequency for odp_cpu_hz_max(),
so rename it to cpu_hz_max for better meaning.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/include/odp_internal.h   | 2 +-
 platform/linux-generic/odp_system_info.c| 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 64d65d2..53074f7 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -26,7 +26,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
/* bogomips seems to be 2x freq */
hz = (uint64_t)(mhz * 100.0 / 2.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 62c3ae3..99457ce 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -25,7 +25,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (pos)
if (sscanf(pos, "clock : %lf", ) == 1) {
hz = (uint64_t)(mhz * 100.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index d2b3c80..816629d 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -27,7 +27,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
*(pos - 1) = '\0';
if (sscanf(pos, "@ %lfGHz", ) == 1) {
hz = (uint64_t)(ghz * 10.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
}
id++;
}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index b527438..aac2ba9 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -27,7 +27,7 @@ extern __thread int __odp_errno;
 #define MAX_CPU_NUMBER 128
 
 typedef struct {
-   uint64_t cpu_hz[MAX_CPU_NUMBER];
+   uint64_t cpu_hz_max[MAX_CPU_NUMBER];
uint64_t huge_page_size;
uint64_t page_size;
int  cache_line_size;
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 727053a..42aef8a 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -169,7 +169,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
ODP_DBG("Warning: use dummy values for freq and model string\n");
ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
for (i = 0; i < MAX_CPU_NUMBER; i++) {
-   sysinfo->cpu_hz[i] = 14;
+   sysinfo->cpu_hz_max[i] = 14;
strcpy(sysinfo->model_str[i], "UNKNOWN");
}
 
@@ -240,7 +240,7 @@ uint64_t odp_cpu_hz_max(void)
 uint64_t odp_cpu_hz_max_id(int id)
 {
if (id >= 0 && id < MAX_CPU_NUMBER)
-   return odp_global_data.system_info.cpu_hz[id];
+   return odp_global_data.system_info.cpu_hz_max[id];
else
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 09/12] linux-generic: sysinfo: set values for cpu_arch_str

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

The values of cpu_arch_str were deleted due to codes reorganization, this
patch adds values to them again.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 1 +
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 1 +
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index b6e0e2c..dcecbb9 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
int model = 0;
int count = 2;
 
+   strcpy(sysinfo->cpu_arch_str, "mips64");
while (fgets(str, sizeof(str), file) != NULL && count > 0) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 83d88ca..1ed95ad 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
int model = 0;
int count = 2;
 
+   strcpy(sysinfo->cpu_arch_str, "powerpc");
while (fgets(str, sizeof(str), file) != NULL && count > 0) {
if (!mhz) {
pos = strstr(str, "clock");
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 831a53a..d2b3c80 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
uint64_t hz;
int id = 0;
 
+   strcpy(sysinfo->cpu_arch_str, "x86");
while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
pos = strstr(str, "model name");
if (pos) {
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 07/12] linux-generic: sysinfo: move PowerPC system info codes to its plarform file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

This patch moves the PowerPC system info codes into the newly added PowerPC
specific platform file.
This patch also creates syslink to arch/linux/odp_cpu_cycles.c for PowerPC.

Signed-off-by: Hongbo Zhang 
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 +
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h |  1 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 52 +
 platform/linux-generic/odp_system_info.c   | 53 --
 6 files changed, 57 insertions(+), 53 deletions(-)
 create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index fbe7c08..14a025e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@ AX_VALGRIND_CHECK
 AS_CASE([$host],
   [x86*], [ARCH=x86],
   [mips64*], [ARCH=mips64],
+  [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
 )
 AC_SUBST([ARCH])
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index f4bc58e..fded462 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -169,6 +169,8 @@ EXTRA_DIST = \
 arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
+arch/powerpc/odp_cpu_arch.c \
+arch/powerpc/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
new file mode 12
index 000..0617d7f
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
@@ -0,0 +1 @@
+../../linux/odp/cpu_arch.h
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c 
b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
new file mode 12
index 000..c5fe400
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
@@ -0,0 +1 @@
+../linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
new file mode 100644
index 000..fe13f40
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -0,0 +1,52 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "clock");
+
+   if (pos)
+   if (sscanf(pos, "clock : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 7d68c2e..210dd1d 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -105,59 +105,6 @@ static int huge_page_size(void)
 }
 
 
-
-/*
- * HW specific /proc/cpuinfo file parsing
- */
-#if defined __powerpc__
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "clock");
-
-   if (pos) {
-   sscanf(pos, "clock : %lf", );
-   count--;
-   }
-   }
-
-   

[lng-odp] [PATCH v8 API-NEXT 10/12] linux-generic: sysinfo: apply per-CPU implementation to MIPS

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
MIPS platform.

Signed-off-by: Hongbo Zhang 
---
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 28 +++---
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index dcecbb9..64d65d2 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -12,17 +12,23 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "mips64");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
 
if (pos)
-   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
+   /* bogomips seems to be 2x freq */
+   hz = (uint64_t)(mhz * 100.0 / 2.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,18 +38,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
-   }
 
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
+   }
 
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 11/12] linux-generic: sysinfo: apply per-CPU implementation to PowerPC

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
PowerPC platform.

Signed-off-by: Hongbo Zhang 
---
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 24 +++---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 1ed95ad..62c3ae3 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -12,17 +12,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "powerpc");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "clock");
 
if (pos)
-   if (sscanf(pos, "clock : %lf", ) == 1)
+   if (sscanf(pos, "clock : %lf", ) == 1) {
+   hz = (uint64_t)(mhz * 100.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,16 +37,21 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
 
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
}
 
return 0;
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv8 0/5] pktio statistics counters

2016-01-27 Thread Maxim Uvarov

Merged,
Maxim.

On 01/26/2016 19:17, Stuart Haslam wrote:

On Tue, Jan 26, 2016 at 07:00:37PM +0300, Maxim Uvarov wrote:

v8: - fix validation test to support unsupported counters :)
v7: - fix stats struction init if stats not supported in stats() call.
v6: - reorganize stats code to support different sockets and not fail on 
missing ethtool
   strings.
v5: - update to the latest api-next. Fix logic to not fail if ethtool or sysfs 
not supported.
v4: - fix Stuarts and Mikes comments.
v3: - fix netmap (ethtool = 1);
v2: -  try to use ethtool for statistics counters if not fall back to sysfs.
( virtual veth devices do not support sysfs, netmap does not support 
sysfs.)
  - fix Stuarts comments for validation test suite.



Maxim Uvarov (5):
   linux-generic: sockets: implement pktio statistics
   linux-generic: netmap: implement pktio statistics
   linux-generic: pktio loop: implement statistics counters
   linux-generic: pcap: implement pktio statistics counters
   validation: implement pktio statistics counters

  platform/linux-generic/Makefile.am |   2 +
  .../linux-generic/include/odp_packet_io_internal.h |  15 ++
  platform/linux-generic/include/odp_packet_socket.h |   5 +
  platform/linux-generic/odp_packet_io.c |  53 +++
  platform/linux-generic/pktio/ethtool.c | 164 
  platform/linux-generic/pktio/loop.c|  42 -
  platform/linux-generic/pktio/netmap.c  |  44 ++
  platform/linux-generic/pktio/pcap.c|  28 +++-
  platform/linux-generic/pktio/pktio_common.c|  72 +
  platform/linux-generic/pktio/socket.c  |  51 +++
  platform/linux-generic/pktio/socket_mmap.c |  49 ++
  platform/linux-generic/pktio/sysfs.c   |  76 +
  test/validation/pktio/pktio.c  | 170 +
  test/validation/pktio/pktio.h  |   2 +
  14 files changed, 769 insertions(+), 4 deletions(-)
  create mode 100644 platform/linux-generic/pktio/ethtool.c
  create mode 100644 platform/linux-generic/pktio/sysfs.c


For the series

Reviewed-and-tested-by: Stuart Haslam 



___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 08/12] api: cpu: make frequency API return 0 on failure

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

All the CPU frequency API return value type is uint64_t, this patch makes
them return 0 on failure instead of -1.

Signed-off-by: Hongbo Zhang 
---
 include/odp/api/cpu.h   | 4 
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c   | 2 +-
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/odp_system_info.c| 2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 4cbaf58..eaee24b 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -71,6 +71,7 @@ const char *odp_cpu_model_str_id(int id);
  * Returns current frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz(void);
 
@@ -82,6 +83,7 @@ uint64_t odp_cpu_hz(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_id(int id);
 
@@ -91,6 +93,7 @@ uint64_t odp_cpu_hz_id(int id);
  * Returns maximum frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max(void);
 
@@ -102,6 +105,7 @@ uint64_t odp_cpu_hz_max(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max_id(int id);
 
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 881dd2d..8ff6f48 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -15,5 +15,5 @@ int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 264ab28..b6e0e2c 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -49,5 +49,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index fe13f40..83d88ca 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -48,5 +48,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index e2931cb..831a53a 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -68,5 +68,5 @@ uint64_t odp_cpu_hz_current(int id)
if (mhz)
return (uint64_t)(mhz * 100.0);
 
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 210dd1d..727053a 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -242,7 +242,7 @@ uint64_t odp_cpu_hz_max_id(int id)
if (id >= 0 && id < MAX_CPU_NUMBER)
return odp_global_data.system_info.cpu_hz[id];
else
-   return -1;
+   return 0;
 }
 
 uint64_t odp_sys_huge_page_size(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 05/12] linux-generic: sysinfo: move MIPS system info codes to its plarform file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang 

This patch moves the MIPS system info codes into the newly added MIPS
specific platform file.

Signed-off-by: Hongbo Zhang 
---
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 53 ++
 platform/linux-generic/odp_system_info.c   | 47 ---
 3 files changed, 54 insertions(+), 47 deletions(-)
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index ae32268..d476ae9 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,6 +167,7 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
+arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
new file mode 100644
index 000..264ab28
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -0,0 +1,53 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "BogoMIPS");
+
+   if (pos)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu model");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+   }
+
+   /* bogomips seems to be 2x freq */
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index fd25067..1959434 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -122,53 +122,6 @@ static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
return -1;
 }
 
-#elif defined __OCTEON__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "BogoMIPS");
-
-   if (pos) {
-   sscanf(pos, "BogoMIPS : %lf", );
-   count--;
-   }
-   }
-
-   if (!model) {
-   pos = strstr(str, "cpu model");
-
-   if (pos) {
-   int len;
-   pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
-   model = 1;
-   count--;
-   }
-   }
-   }
-
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
-
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
 #elif defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast flags

2016-01-27 Thread Savolainen, Petri (Nokia - FI/Espoo)


From: EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
Sent: Tuesday, January 26, 2016 8:17 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast flags

Before sending my reviewed-by I started working on implementing these (along 
with the tests).  The flags themselves are straightforward, however the parse 
definitions are somewhat complicated and we may want to simplify things a bit 
to capture what applications are really looking for.

First, we only define a single bit for each of these and it's not clear whether 
this applies to the source or destination address of the packet.  For the sets, 
I'm assuming we'd want these to refer to the destination addresses since it 
makes little sense for an application to modify a source address since the 
packet has already been received, however on receipt do applications want to 
know whether the packet originated from a broadcast or multicast address?  What 
are the use cases we're looking to support, since that will say whether we need 
one or two bits for these designators.

All these bits are for destination address. It would be a protocol error (L2/L3 
error flag set) in all these cases if source address would be bcast or mcast.


Ethernet multicast is indicated by bit 7 of the MAC address being 1.  By 
convention, most use MAC addr FF:FF:FF:FF:FF:FF to indicate broadcast even 
though Ethernet really doesn't distinguish between these two.

Eth_bcast is the broadcast address - in practice all ones. I’d expect that at 
least some IEEE Ethernet standard would define that as the bcast address.


So do we really need both eth_bcast and eth_mcast?

Yes. Multicast Ethernet addresses are many and handled differently (e.g. in IP 
stack) than the (single) bcast address (all ones).

For IP things are a bit more complicated.

Parser needs to find only those addresses that are fixed by the protocol 
address format. Dynamically configured addresses (like subnet bcast) would need 
a  proper IP stack,  ODP is just a (dummy) parser – not a stack.

For IPv4, multicast is basically a Class D IP address (addresses in the range 
224.x.x.x through 239.x.x.x (leading hex nibble D). Broadcast addresses, 
however, are a function of the subnet being used and that's not unambiguous in 
the absence of a separately specified subnet mask.  For example, for network 
192.168.1.0/8 the broadcast address is 192.168.1.255, 
however for network 192.168.1.0/4 the broadcast address 
is 192.168.1.15 whereas this is a unicast address in the /8 network.  What 
exactly do we expect the ip_bcast bit to mean with respect to the (unknown) 
subnet mask?

IPv4 multicast addresses are defined by the leading address bits of 1110 
(ip_mcast == 1). Broadcast is 255.255.255.255 (ip_bcast == 1).

For IPv6 we have a similar issue in that IPv6 doesn't recognize broadcast 
addresses, but instead uses multicast addresses, which have prefix ff00::/8  
with address ff02::1 being the "all nodes" multicast address, which is sort of 
like broadcast.  Exactly how do we wish to define ip_bcast and ip_mcast for 
IPv6?

IPv4 multicast addresses are defined by the leading address bits of  
(ip_mcast == 1). There’s no bcast address (ip_bcast == 0 always).


-Petri


On Fri, Jan 22, 2016 at 3:12 AM, Savolainen, Petri (Nokia - FI/Espoo) 
> wrote:


From: EXT Bill Fischofer 
[mailto:bill.fischo...@linaro.org]
Sent: Friday, January 22, 2016 1:03 AM

To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast flags



On Thu, Jan 21, 2016 at 9:30 AM, Savolainen, Petri (Nokia - FI/Espoo) 
> wrote:


From: EXT Bill Fischofer 
[mailto:bill.fischo...@linaro.org]
Sent: Thursday, January 21, 2016 4:43 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast flags



On Thu, Jan 21, 2016 at 3:39 AM, Petri Savolainen 
> wrote:
Added packet flags for Ethernet and IP broad- and multicast.
For application, it's more effective to check a flag than all
destionation address bits.

Signed-off-by: Petri Savolainen 
>
---
 include/odp/api/packet_flags.h | 70 +-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index 8de0c82..65fd3ce 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -102,11 +102,29 @@ int odp_packet_has_l4(odp_packet_t pkt);
  *
  * @param pkt Packet handle
  * @retval non-zero 

[lng-odp] [API-NEXT PATCH] api: prefixing some standard types.

2016-01-27 Thread Christophe Milard
The following types: uint16le_t, uint16be_t, uint32le_t, uint32be_t,
uint64le_t, uint64be_t, uint16sum_t, uint32sum_t defined in the api and
in platform/linux-generic/include/odp/plat/byteorder_types.h were not
odp_* prefixed and could create name clash with an applications.
This patch prefixes those with odp_*, suppressing "int" for shortness.
e.g. uint16le_t becomes odp_u16le_t
Also modifies files using these types, of course.

Signed-off-by: Christophe Milard 
---
 example/classifier/odp_classifier.c|  2 +-
 example/ipsec/odp_ipsec_cache.h|  2 +-
 example/ipsec/odp_ipsec_stream.c   |  2 +-
 example/packet/odp_pktio.c |  2 +-
 helper/include/odp/helper/chksum.h |  4 +-
 helper/include/odp/helper/eth.h|  6 +-
 helper/include/odp/helper/icmp.h   | 12 ++--
 helper/include/odp/helper/ip.h | 22 
 helper/include/odp/helper/ipsec.h  | 10 ++--
 helper/include/odp/helper/tcp.h| 64 +++---
 helper/include/odp/helper/udp.h|  8 +--
 include/odp/api/byteorder.h| 40 +++---
 platform/linux-generic/include/odp/byteorder.h | 48 
 .../include/odp/plat/byteorder_types.h | 16 +++---
 test/performance/odp_pktio_perf.c  |  2 +-
 .../classification/odp_classification_common.c |  6 +-
 test/validation/pktio/pktio.c  |  6 +-
 17 files changed, 126 insertions(+), 126 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 5a8cd37..9e5bec9 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -667,7 +667,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned 
len)
odph_ethhdr_t *eth;
odph_ethaddr_t tmp_addr;
odph_ipv4hdr_t *ip;
-   uint32be_t ip_tmp_addr; /* tmp ip addr */
+   odp_u32be_t ip_tmp_addr; /* tmp ip addr */
unsigned i;
 
for (i = 0; i < len; ++i) {
diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h
index 91d9d7e..56be9d8 100644
--- a/example/ipsec/odp_ipsec_cache.h
+++ b/example/ipsec/odp_ipsec_cache.h
@@ -57,7 +57,7 @@ typedef struct ipsec_cache_entry_s {
uint32_t  esp_seq; /**< ESP TX sequence number */
uint32_t  ah_seq;  /**< AH TX sequence number */
uint8_t   iv[MAX_IV_LEN];  /**< ESP IV storage */
-   uint16be_ttun_hdr_id;  /**< Tunnel header IP ID */
+   odp_u16be_ttun_hdr_id; /**< Tunnel header IP ID */
} state;
 } ipsec_cache_entry_t;
 
diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c
index 9c2722e..ff2ca33 100644
--- a/example/ipsec/odp_ipsec_stream.c
+++ b/example/ipsec/odp_ipsec_stream.c
@@ -36,7 +36,7 @@
  * Stream packet header
  */
 typedef struct ODP_PACKED stream_pkt_hdr_s {
-   uint64be_t magic;/**< Stream magic value for verification */
+   odp_u64be_t magic;   /**< Stream magic value for verification */
uint8_tdata[0];  /**< Incrementing data stream */
 } stream_pkt_hdr_t;
 
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 75e92ac..13f044f 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -502,7 +502,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned 
len)
odph_ethhdr_t *eth;
odph_ethaddr_t tmp_addr;
odph_ipv4hdr_t *ip;
-   uint32be_t ip_tmp_addr; /* tmp ip addr */
+   odp_u32be_t ip_tmp_addr; /* tmp ip addr */
unsigned i;
 
for (i = 0; i < len; ++i) {
diff --git a/helper/include/odp/helper/chksum.h 
b/helper/include/odp/helper/chksum.h
index edb1c98..215917c 100644
--- a/helper/include/odp/helper/chksum.h
+++ b/helper/include/odp/helper/chksum.h
@@ -27,7 +27,7 @@ extern "C" {
  *
  * @return checksum value in host cpu order
  */
-static inline uint16sum_t odp_chksum(void *buffer, int len)
+static inline odp_u16sum_t odp_chksum(void *buffer, int len)
 {
uint16_t *buf = buffer;
uint32_t sum = 0;
@@ -43,7 +43,7 @@ static inline uint16sum_t odp_chksum(void *buffer, int len)
sum += (sum >> 16);
result = ~sum;
 
-   return  (__odp_force uint16sum_t) result;
+   return  (__odp_force odp_u16sum_t) result;
 }
 
 #ifdef __cplusplus
diff --git a/helper/include/odp/helper/eth.h b/helper/include/odp/helper/eth.h
index f1c164d..7c9c728 100644
--- a/helper/include/odp/helper/eth.h
+++ b/helper/include/odp/helper/eth.h
@@ -51,7 +51,7 @@ _ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == 
ODPH_ETHADDR_LEN, "ODPH_ETHADDR_T__
 typedef struct ODP_PACKED {
odph_ethaddr_t dst; /**< Destination address */
odph_ethaddr_t src; /**< Source address */
-   

Re: [lng-odp] [API-NEXT PATCHv1 1/4] api: classification: add pmr create api

2016-01-27 Thread Bala Manoharan
Ping. Any feedback on the API definition and comments most welcome.

Regards,
Bala


On 26 January 2016 at 06:37, Bill Fischofer  wrote:
> The question of contexts for stateful classification was discussed last
> July.  We can discuss this further during tomorrow's public call to see if
> we want to pursue this for Monarch or if it should be considered a
> post-Monarch item.
>
> On Fri, Jan 22, 2016 at 9:47 AM, Ivan Khoronzhuk
>  wrote:
>>
>> + list
>>
>> On 22.01.16 17:46, Ivan Khoronzhuk wrote:
>>>
>>> It discussed several times when started to look at it and Bill proposed
>>> to add some cls environment.
>>> Finally, it's sent. After this change PMR is created while connection to
>>> CoSes,
>>> and it's eliminates ability to connect the same PMR to several CoSes
>>> (which may arise questions...),
>>> and maps PMR handle directly to physical rule. It greatly simplifies life
>>> for implementors.
>>>
>>>
>>>
>>> On 22.01.16 13:54, Balasubramanian Manoharan wrote:

 Packet match rule creation is modified to include source and destination
 class of service. Removes the ability to add any class of service
 directly
 with pktio. If a PMR needs to be applied at the pktio level the same
 should be applied to default class of service.

 Packet match rule destroy function is updated to removes the link
 between
 the source and destination class of service.

 Signed-off-by: Balasubramanian Manoharan 
 ---
   include/odp/api/classification.h | 74
 +---
   1 file changed, 24 insertions(+), 50 deletions(-)

 diff --git a/include/odp/api/classification.h
 b/include/odp/api/classification.h
 index f46912e..59bd01d 100644
 --- a/include/odp/api/classification.h
 +++ b/include/odp/api/classification.h
 @@ -50,7 +50,7 @@ extern "C" {
   /**
* @def ODP_PMR_INVAL
* Invalid odp_pmr_t value.
 - * This value is returned from odp_pmr_create()
 + * This value is returned from odp_cls_pmr_create()
* function on failure.
*/

 @@ -286,50 +286,33 @@ typedef struct odp_pmr_match_t {
   } odp_pmr_match_t;

   /**
 - * Create a packet match rule with mask and value
 + * Create a packet match rule between source and destination class of
 service.
 + * This packet matching rule is applied on all packets arriving at the
 source
 + * class of service and packets satisfying this PMR are sent to the
 destination
 + * class of service.
*
* @param[in]match   packet matching rule definition
 + * @param[in]src_cossource CoS handle
 + * @param[in]dst_cosdestination CoS handle
*
* @returnHandle of the matching rule
* @retvalODP_PMR_INVAL on failure
*/
 -odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match);
 -
 +odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *match, odp_cos_t
 src_cos,
 + odp_cos_t dst_cos);
   /**
 - * Invalidate a packet match rule and vacate its resources
 + * Function to destroy a packet match rule
 + * Destroying a PMR removes the link between the source and destination
 + * class of service and this PMR will no longer be applied for packets
 arriving
 + * at the source class of service. All the resource associated with the
 PMR
 + * be release but the class of service will remain intact.
*
* @param[in]pmr_idIdentifier of the PMR to be destroyed
*
* @retval0 on success
* @retval<0 on failure
*/
 -int odp_pmr_destroy(odp_pmr_t pmr_id);
 -
 -/**
 - * Apply a PMR to a pktio to assign a CoS.
 - *
 - * @param[in]pmr_idPMR to be activated
 - * @param[in]src_pktiopktio to which this PMR is to be applied
 - * @param[in]dst_cosCoS to be assigned by this PMR
 - *
 - * @retval0 on success
 - * @retval<0 on failure
 - */
 -int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
 -  odp_pktio_t src_pktio, odp_cos_t dst_cos);
 -
 -/**
 - * Cascade a PMR to refine packets from one CoS to another.
 - *
 - * @param[in]pmr_idPMR to be activated
 - * @param[in]src_cosCoS to be filtered
 - * @param[in]dst_cosCoS to be assigned to packets filtered
 - *from src_cos that match pmr_id.
 - *
 - * @retval0 on success
 - * @retval<0 on failure
 - */
 -int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t
 dst_cos);
 +int odp_cls_pmr_destroy(odp_pmr_t pmr_id);

   /**
* Inquire about matching terms supported by the classifier
 @@ -357,19 +340,24 @@ unsigned 

Re: [lng-odp] [API-NEXT PATCH v3 00/13] atomi api completion

2016-01-27 Thread Maxim Uvarov

Merged,

please check.

Maxim.

On 01/26/2016 15:41, Savolainen, Petri (Nokia - FI/Espoo) wrote:


Thanks. Maxim could you first try to merge and resolve conflicts. 
Those should be quite simple to resolve: additional atomic validation 
tests into validation/atomic/atomic.c instead of old 
validation/synchronizers/synchronizers.c.


-Petri

*From:*EXT Ola Liljedahl [mailto:ola.liljed...@linaro.org]
*Sent:* Tuesday, January 26, 2016 2:16 PM
*To:* Savolainen, Petri (Nokia - FI/Espoo)
*Cc:* LNG ODP Mailman List
*Subject:* Re: [lng-odp] [API-NEXT PATCH v3 00/13] atomi api completion

On 20 January 2016 at 10:19, Petri Savolainen 
> wrote:


Completed additions to atomic API. Added exchange operation in
relaxed memory
model. Added CAS operations in rel and acq_rel memory order. Added
64 bit
versions of all non-relaxed operations defined so far. Added all
missing
validation tests. Replaced internal atomics usage in lock, etc code
(all except spinlock and timer) with API calls.

This set of atomic calls seem to be sufficient to current
linux-generic use
cases. Timer and spinlock use atomic flag and 128 bit types, but
does not
require additional operation types (e.g. load_acq, store_rel, cas,
cas_rel, etc
are supported by the API).

Additional operations can be added later if needed. Only commonly
needed
combinations of non-relaxed operations will be supported (added
based on use
case as any other ODP API). This set should already enable major
part of
lock-free algorithms.

They enable a lot of *lock-less* implementations but not all lock-less 
designs are properly "lock-free". Lock-free implies that no thread can 
block other other threads from doing progress. E.g. the DPDK ring 
buffer we copied is lock-less (based on CAS) but not lock-free, a 
thread which has entered the critical section (between CAS and the 
subsequent releasing store) must exit it before other threads can exit 
the critical section. The lock-less design enables some parallelism in 
operating on the data structure.



v3:
  * Corrected race condition in xchg validation test

v2:
  * rebased on latest api-next

Failed to actually build and run validation tests since some patches 
require some manual effort to merge. We agreed Petri & Maxim would do 
that.


Whole patch set

Reviewed-by: Ola Liljedahl >



Petri Savolainen (13):
  api: atomic: rename release ordering
  api: atomic: added 32bit cas_rel and cas_acq_rel
  linux-generic: atomic: 32bit cas_rel and cas_acq_rel
  api: atomic: add non-relaxed 64bit operations
  linux-generic: atomic: non-relaxed 64bit operations
  api: atomic: added relaxed exchange operation
  linux-generic: atomic: implemented exchange
  validation: atomic: added max and min tests
  validation: atomic: added cas test
  validation: atomic: added xchg test
  validation: atomic: added non-relaxed test
  linux-generic: locks: replace internal atomics
  linux-generic: barrier: use API memory barrier

 include/odp/api/atomic.h  | 220 +++--
 platform/linux-generic/include/odp/atomic.h | 142 -
 .../linux-generic/include/odp_atomic_internal.h |   6 -
 platform/linux-generic/include/odp_pool_internal.h |   1 -
 platform/linux-generic/odp_barrier.c  |   8 +-
 platform/linux-generic/odp_pool.c |   1 -
 platform/linux-generic/odp_rwlock.c |  23 +-
 platform/linux-generic/odp_ticketlock.c |  21 +-
 test/validation/synchronizers/synchronizers.c | 347
-
 test/validation/synchronizers/synchronizers.h |   4 +
 10 files changed, 689 insertions(+), 84 deletions(-)

--
2.6.3

___
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] [API-NEXT PATCH] api: packet: added multicast flags

2016-01-27 Thread Bill Fischofer
Thanks for the clarification.  With that, for the API patch:

Reviewed-by: Bill Fischofer 

I'll send a v2 of my implementation patch to reflect these implementation
changes and will update the documentation accordingly.

On Wed, Jan 27, 2016 at 2:59 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
>
>
>
> *From:* EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Tuesday, January 26, 2016 8:17 PM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast
> flags
>
>
>
> Before sending my reviewed-by I started working on implementing these
> (along with the tests).  The flags themselves are straightforward, however
> the parse definitions are somewhat complicated and we may want to simplify
> things a bit to capture what applications are really looking for.
>
>
>
> First, we only define a single bit for each of these and it's not clear
> whether this applies to the source or destination address of the packet.
> For the sets, I'm assuming we'd want these to refer to the destination
> addresses since it makes little sense for an application to modify a source
> address since the packet has already been received, however on receipt do
> applications want to know whether the packet originated from a broadcast or
> multicast address?  What are the use cases we're looking to support, since
> that will say whether we need one or two bits for these designators.
>
>
>
> All these bits are for destination address. It would be a protocol error
> (L2/L3 error flag set) in all these cases if source address would be bcast
> or mcast.
>
>
>
>
>
> Ethernet multicast is indicated by bit 7 of the MAC address being 1.  By
> convention, most use MAC addr FF:FF:FF:FF:FF:FF to indicate broadcast even
> though Ethernet really doesn't distinguish between these two.
>
>
>
> Eth_bcast is the broadcast address - in practice all ones. I’d expect that
> at least some IEEE Ethernet standard would define that as the bcast address.
>
>
>
>
>
> So do we really need both eth_bcast and eth_mcast?
>
>
>
> Yes. Multicast Ethernet addresses are many and handled differently (e.g.
> in IP stack) than the (single) bcast address (all ones).
>
>
>
> For IP things are a bit more complicated.
>
>
>
> Parser needs to find only those addresses that are fixed by the protocol
> address format. Dynamically configured addresses (like subnet bcast) would
> need a  proper IP stack,  ODP is just a (dummy) parser – not a stack.
>
>
>
> For IPv4, multicast is basically a Class D IP address (addresses in the
> range 224.x.x.x through 239.x.x.x (leading hex nibble D). Broadcast
> addresses, however, are a function of the subnet being used and that's not
> unambiguous in the absence of a separately specified subnet mask.  For
> example, for network 192.168.1.0/8 the broadcast address is
> 192.168.1.255, however for network 192.168.1.0/4 the broadcast address is
> 192.168.1.15 whereas this is a unicast address in the /8 network.  What
> exactly do we expect the ip_bcast bit to mean with respect to the (unknown)
> subnet mask?
>
>
>
> IPv4 multicast addresses are defined by the leading address bits of 1110
> (ip_mcast == 1). Broadcast is 255.255.255.255 (ip_bcast == 1).
>
>
>
> For IPv6 we have a similar issue in that IPv6 doesn't recognize broadcast
> addresses, but instead uses multicast addresses, which have prefix ff00::/8
>  with address ff02::1 being the "all nodes" multicast address, which is
> sort of like broadcast.  Exactly how do we wish to define ip_bcast and
> ip_mcast for IPv6?
>
>
>
> IPv4 multicast addresses are defined by the leading address bits of
>  (ip_mcast == 1). There’s no bcast address (ip_bcast == 0 always).
>
>
>
>
>
> -Petri
>
>
>
>
>
> On Fri, Jan 22, 2016 at 3:12 AM, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolai...@nokia.com> wrote:
>
>
>
>
>
> *From:* EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Friday, January 22, 2016 1:03 AM
>
>
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast
> flags
>
>
>
>
>
>
>
> On Thu, Jan 21, 2016 at 9:30 AM, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolai...@nokia.com> wrote:
>
>
>
>
>
> *From:* EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Thursday, January 21, 2016 4:43 PM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] api: packet: added multicast
> flags
>
>
>
>
>
>
>
> On Thu, Jan 21, 2016 at 3:39 AM, Petri Savolainen <
> petri.savolai...@nokia.com> wrote:
>
> Added packet flags for Ethernet and IP broad- and multicast.
> For application, it's more effective to check a flag than all
> destionation address bits.
>
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/packet_flags.h | 70
> 

Re: [lng-odp] [API-NEXT PATCH] api: prefixing some standard types.

2016-01-27 Thread Savolainen, Petri (Nokia - FI/Espoo)
For the git log readability better subject would be:

"api: endian: rename endian types with odp_ prefix"


Maybe Maxim can edit that during merge.



Reviewed-by: Petri Savolainen 



> -Original Message-
> From: EXT Christophe Milard [mailto:christophe.mil...@linaro.org]
> Sent: Wednesday, January 27, 2016 5:00 PM
> To: anders.rox...@linaro.org; mike.hol...@linaro.org;
> bill.fischo...@linaro.org; petri.savolai...@linaro.org
> Cc: lng-odp@lists.linaro.org; Christophe Milard
> Subject: [API-NEXT PATCH] api: prefixing some standard types.
> 
> The following types: uint16le_t, uint16be_t, uint32le_t, uint32be_t,
> uint64le_t, uint64be_t, uint16sum_t, uint32sum_t defined in the api and
> in platform/linux-generic/include/odp/plat/byteorder_types.h were not
> odp_* prefixed and could create name clash with an applications.
> This patch prefixes those with odp_*, suppressing "int" for shortness.
> e.g. uint16le_t becomes odp_u16le_t
> Also modifies files using these types, of course.
> 
> Signed-off-by: Christophe Milard 
> ---
>  example/classifier/odp_classifier.c|  2 +-
>  example/ipsec/odp_ipsec_cache.h|  2 +-
>  example/ipsec/odp_ipsec_stream.c   |  2 +-
>  example/packet/odp_pktio.c |  2 +-
>  helper/include/odp/helper/chksum.h |  4 +-
>  helper/include/odp/helper/eth.h|  6 +-
>  helper/include/odp/helper/icmp.h   | 12 ++--
>  helper/include/odp/helper/ip.h | 22 
>  helper/include/odp/helper/ipsec.h  | 10 ++--
>  helper/include/odp/helper/tcp.h| 64 +++--
> -
>  helper/include/odp/helper/udp.h|  8 +--
>  include/odp/api/byteorder.h| 40 +++---
>  platform/linux-generic/include/odp/byteorder.h | 48 
>  .../include/odp/plat/byteorder_types.h | 16 +++---
>  test/performance/odp_pktio_perf.c  |  2 +-
>  .../classification/odp_classification_common.c |  6 +-
>  test/validation/pktio/pktio.c  |  6 +-
>  17 files changed, 126 insertions(+), 126 deletions(-)
> 
> diff --git a/example/classifier/odp_classifier.c
> b/example/classifier/odp_classifier.c
> index 5a8cd37..9e5bec9 100644
> --- a/example/classifier/odp_classifier.c
> +++ b/example/classifier/odp_classifier.c
> @@ -667,7 +667,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[],
> unsigned len)
>   odph_ethhdr_t *eth;
>   odph_ethaddr_t tmp_addr;
>   odph_ipv4hdr_t *ip;
> - uint32be_t ip_tmp_addr; /* tmp ip addr */
> + odp_u32be_t ip_tmp_addr; /* tmp ip addr */
>   unsigned i;
> 
>   for (i = 0; i < len; ++i) {
> diff --git a/example/ipsec/odp_ipsec_cache.h
> b/example/ipsec/odp_ipsec_cache.h
> index 91d9d7e..56be9d8 100644
> --- a/example/ipsec/odp_ipsec_cache.h
> +++ b/example/ipsec/odp_ipsec_cache.h
> @@ -57,7 +57,7 @@ typedef struct ipsec_cache_entry_s {
>   uint32_t  esp_seq; /**< ESP TX sequence number */
>   uint32_t  ah_seq;  /**< AH TX sequence number */
>   uint8_t   iv[MAX_IV_LEN];  /**< ESP IV storage */
> - uint16be_ttun_hdr_id;  /**< Tunnel header IP ID */
> + odp_u16be_ttun_hdr_id; /**< Tunnel header IP ID */
>   } state;
>  } ipsec_cache_entry_t;
> 
> diff --git a/example/ipsec/odp_ipsec_stream.c
> b/example/ipsec/odp_ipsec_stream.c
> index 9c2722e..ff2ca33 100644
> --- a/example/ipsec/odp_ipsec_stream.c
> +++ b/example/ipsec/odp_ipsec_stream.c
> @@ -36,7 +36,7 @@
>   * Stream packet header
>   */
>  typedef struct ODP_PACKED stream_pkt_hdr_s {
> - uint64be_t magic;/**< Stream magic value for verification */
> + odp_u64be_t magic;   /**< Stream magic value for verification */
>   uint8_tdata[0];  /**< Incrementing data stream */
>  } stream_pkt_hdr_t;
> 
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index 75e92ac..13f044f 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -502,7 +502,7 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[],
> unsigned len)
>   odph_ethhdr_t *eth;
>   odph_ethaddr_t tmp_addr;
>   odph_ipv4hdr_t *ip;
> - uint32be_t ip_tmp_addr; /* tmp ip addr */
> + odp_u32be_t ip_tmp_addr; /* tmp ip addr */
>   unsigned i;
> 
>   for (i = 0; i < len; ++i) {
> diff --git a/helper/include/odp/helper/chksum.h
> b/helper/include/odp/helper/chksum.h
> index edb1c98..215917c 100644
> --- a/helper/include/odp/helper/chksum.h
> +++ b/helper/include/odp/helper/chksum.h
> @@ -27,7 +27,7 @@ extern "C" {
>   *
>   * @return checksum value in host cpu order
>   */
> -static inline uint16sum_t odp_chksum(void *buffer, int len)
> +static inline odp_u16sum_t odp_chksum(void *buffer, int len)
>  {
>