Re: [lng-odp] shmem pool APIs

2017-04-21 Thread Honnappa Nagarahalli
On 21 April 2017 at 09:32, Bill Fischofer  wrote:
>
>
> On Fri, Apr 21, 2017 at 1:27 AM, Bala Manoharan 
> wrote:
>>
>> On 21 April 2017 at 02:05, Honnappa Nagarahalli
>>  wrote:
>> > On 20 April 2017 at 13:54, Bill Fischofer 
>> > wrote:
>> >>
>> >> On Thu, Apr 20, 2017 at 12:26 PM, Honnappa Nagarahalli
>> >>  wrote:
>> >>>
>> >>> Hi,
>> >>>I looked at the shmem pool APIs for allocating smaller chunks of
>> >>> shared memory. Following are the APIs I am looking at:
>> >>>
>> >>> odpdrv_shm_pool_create
>> >>> odpdrv_shm_pool_destroy
>> >>> odpdrv_shm_pool_alloc
>> >>> odpdrv_shm_pool_free
>> >>>
>> >>> Few questions:
>> >>>
>> >>> 1) Why are these APIs prefixed with 'odpdrv', this should be 'odp'.
>> >>> Are these APIs supposed to be used only by drivers?
>> >>
>> >>
>> >> Christophe was using the prefix odpdrv_ for new "Southside" APIs. The
>> >> idea
>> >> is that the standard "Northside" (odp_ prefix) APIs are intended for
>> >> use by
>> >> applications to allow portability across different ODP implementations
>> >> while
>> >> the Southside APIs would provide the same sort of portability for
>> >> drivers.
>> >> These haven't been formalized (yet) so these are still under
>> >> definition. I
>> >> hope we'll be able to review / discuss these during the upcoming
>> >> Sprint.
>> >>
>> >>>
>> >>> 2) odpdrv_shm_pool_alloc - does not take 'alignment' input. The
>> >>> scalable scheduler data structures need cache line alignment.
>> >>
>> >>
>> >> These are prototypes at this point and if that's needed I'm sure it
>> >> could
>> >> easily be added. Since drivers are typically dealing with page-aligned
>> >> ring
>> >> buffers and such they would automatically be cache-aligned, so perhaps
>> >> he
>> >> didn't see the need to call that out explicitly.
>> >>
>> >
>> > I find these APIs useful in allocating smaller chunks of shared memory
>> > (may be some more functionality can be added to these APIs). I will
>> > use them in the scalable scheduler for allocating shared memory for
>> > queues.
>>
>> Since these are driver APIs they might not be available in all
>> implementations.
>> IMO, we need to keep scalable scheduler implementation independent
>> from drv APIs.
>
>
> Agree. Christophe developed his shm extensions with a view that they could
> be used by both north and south APIs. That's the reason why _ishm.c exists.
> Sounds like these should be made _ishm functions so that the scheduler can
> use them as internal APIs.
>

Most of the odpdrv_ APIs are wrappers around _odp_ishm_pool_xxx APIs
(except for 1 API). I am able to use the internal APIs for now. I also
think that these APIs need to be exposed to the application as well.
Application will also have requirements to allocate shared memory.

>>
>>
>> Regards,
>> Bala
>> >
>> >>>
>> >>>
>> >>> Thanks,
>> >>> Honnappa
>> >>
>> >>
>
>


[lng-odp] [PATCHv2] bug: linux-generic: add syntax to allow newer clang to compile odp

2017-04-21 Thread Bill Fischofer
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2942 by adding
casts needed to avoid compilation failures when using clang 4.0.0
included in Ubuntu 17.04, which is stricter than clang 3.8.1 which
is in Ubuntu 16.10.

Signed-off-by: Bill Fischofer 
---
 helper/chksum.c | 6 +++---
 platform/linux-generic/odp_packet_flags.c   | 2 +-
 .../validation/api/classification/odp_classification_common.c   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/helper/chksum.c b/helper/chksum.c
index f740618d..ae70d97e 100644
--- a/helper/chksum.c
+++ b/helper/chksum.c
@@ -128,7 +128,7 @@ static inline int odph_process_l4_hdr(odp_packet_t  
odp_pkt,
 * should come from the udp header, unlike for TCP where is
 * derived. */
l4_len= odp_be_to_cpu_16(udp_hdr_ptr->length);
-   pkt_chksum_ptr= _hdr_ptr->chksum;
+   pkt_chksum_ptr= (uint16_t *)(void *)_hdr_ptr->chksum;
pkt_chksum_offset = l4_offset + offsetof(odph_udphdr_t, chksum);
} else if (odp_packet_has_tcp(odp_pkt)) {
tcp_hdr_ptr  = (odph_tcphdr_t *)l4_ptr;
@@ -139,7 +139,7 @@ static inline int odph_process_l4_hdr(odp_packet_t  
odp_pkt,
   ODPH_TCPHDR_LEN, tcp_hdr_ptr);
}
 
-   pkt_chksum_ptr= _hdr_ptr->cksm;
+   pkt_chksum_ptr= (uint16_t *)(void *)_hdr_ptr->cksm;
pkt_chksum_offset = l4_offset + offsetof(odph_tcphdr_t, cksm);
is_tcp= true;
} else {
@@ -203,7 +203,7 @@ static inline int odph_process_l3_hdr(odp_packet_t odp_pkt,
ipv4_hdr_ptr = _hdr;
}
 
-   addrs_ptr = (uint16_t *)_hdr_ptr->src_addr;
+   addrs_ptr = (uint16_t *)(void *)_hdr_ptr->src_addr;
addrs_len = 2 * ODPH_IPV4ADDR_LEN;
protocol  = ipv4_hdr_ptr->proto;
l3_len= odp_be_to_cpu_16(ipv4_hdr_ptr->tot_len);
diff --git a/platform/linux-generic/odp_packet_flags.c 
b/platform/linux-generic/odp_packet_flags.c
index ea9a2271..c2e8b9cf 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -19,7 +19,7 @@
odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); \
if (pkt_hdr->p.parsed_layers < layer)\
packet_parse_layer(pkt_hdr, layer);  \
-   pkt_hdr->p.x = v & 1;\
+   pkt_hdr->p.x = (v) & 1;  \
} while (0)
 
 int odp_packet_has_error(odp_packet_t pkt)
diff --git 
a/test/common_plat/validation/api/classification/odp_classification_common.c 
b/test/common_plat/validation/api/classification/odp_classification_common.c
index 3b379c14..eca30b87 100644
--- a/test/common_plat/validation/api/classification/odp_classification_common.c
+++ b/test/common_plat/validation/api/classification/odp_classification_common.c
@@ -278,14 +278,14 @@ odp_packet_t create_packet(cls_packet_info_t pkt_info)
ethhdr = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
memcpy(ethhdr->src.addr, _mac, ODPH_ETHADDR_LEN);
memcpy(ethhdr->dst.addr, _mac_be, ODPH_ETHADDR_LEN);
-   vlan_type = (odp_u16be_t *)>type;
+   vlan_type = (odp_u16be_t *)(void *)>type;
vlan_hdr = (odph_vlanhdr_t *)(ethhdr + 1);
 
if (pkt_info.vlan_qinq) {
odp_packet_has_vlan_qinq_set(pkt, 1);
*vlan_type = odp_cpu_to_be_16(ODPH_ETHTYPE_VLAN_OUTER);
vlan_hdr->tci = odp_cpu_to_be_16(0);
-   vlan_type = (uint16_t *)_hdr->type;
+   vlan_type = (uint16_t *)(void *)_hdr->type;
vlan_hdr++;
}
if (pkt_info.vlan) {
-- 
2.11.0



Re: [lng-odp] [API-NEXT PATCH 1/8] api: system: added system info print

2017-04-21 Thread Bill Fischofer
On Fri, Apr 21, 2017 at 11:42 AM, Brian Brooks  wrote:

> On 04/21 16:11:27, Petri Savolainen wrote:
> > This information specifies the system where ODP application
> > is running for debugging purposes.
> >
> > Signed-off-by: Petri Savolainen 
> > ---
> >  include/odp/api/spec/system_info.h | 9 +
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/include/odp/api/spec/system_info.h
> b/include/odp/api/spec/system_info.h
> > index 0bb4f1f1..ca4dcdc7 100644
> > --- a/include/odp/api/spec/system_info.h
> > +++ b/include/odp/api/spec/system_info.h
> > @@ -45,6 +45,15 @@ uint64_t odp_sys_page_size(void);
> >  int odp_sys_cache_line_size(void);
> >
> >  /**
> > + * Print system info
>
> I would advise that APIs return information that can be printed by
> the application or used otherwise. An API like this indicates that
> the implementation itself would be sending something to stdout; that
> can be done by the application.
>

There is ample precedent in ODP for including APIs specifically for
application debugging, e.g., odp_pool_print(), odp_buffer_print(),
odp_packet_print(), so I don't see this as any different. There's a
difference between APIs for debugging vs. logging. A debugging API would
not be used in a production setting whereas a logging API would. For
logging APIs we have the ability for the application to provide an
overriding output function to allow it to consolidate or otherwise handle
the processing of this output.


>
> > + * Print out implementation defined information about the system. This
> > + * information is intended for debugging purposes and may contain e.g.
> > + * information about CPUs, memory and other HW configuration.
> > + */
> > +void odp_sys_info_print(void);
> > +
> > +/**
> >   * @}
> >   */
> >
> > --
> > 2.11.0
> >
>


Re: [lng-odp] [API-NEXT PATCH 8/8] linux-gen: time: use hw time counter when available

2017-04-21 Thread Bill Fischofer
Good stuff. I'll put this on the agenda for Monday's ARCH call to discuss.

On Fri, Apr 21, 2017 at 12:29 PM, Brian Brooks  wrote:

> On 04/21 16:11:34, Petri Savolainen wrote:
> > Use 64 bit HW time counter when available. It is used on
> > x86 when invariant TSC CPU flag indicates that TSC frequency
> > is constant. Otherwise, the system time is used as before. Direct
> > HW time counter usage avoids system call, and related latency
> > and performance issues.
> >
> > Signed-off-by: Petri Savolainen 
> > ---
> >  platform/linux-generic/Makefile.am |   1 +
> >  platform/linux-generic/arch/arm/odp_cpu_arch.c |  11 +
> >  platform/linux-generic/arch/default/odp_cpu_arch.c |  11 +
> >  platform/linux-generic/arch/mips64/odp_cpu_arch.c  |  11 +
> >  platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  11 +
> >  platform/linux-generic/arch/x86/cpu_flags.c|   9 +
> >  platform/linux-generic/arch/x86/odp_cpu_arch.c |  59 
> >  .../include/odp/api/plat/time_types.h  |  23 +-
> >  platform/linux-generic/include/odp_time_internal.h |  24 ++
> >  platform/linux-generic/odp_time.c  | 303
> -
> >  10 files changed, 398 insertions(+), 65 deletions(-)
> >  create mode 100644 platform/linux-generic/include/odp_time_internal.h
> >
> > diff --git a/platform/linux-generic/Makefile.am
> b/platform/linux-generic/Makefile.am
> > index 60b7f849..ed66fecf 100644
> > --- a/platform/linux-generic/Makefile.am
> > +++ b/platform/linux-generic/Makefile.am
> > @@ -171,6 +171,7 @@ noinst_HEADERS = \
> > ${srcdir}/include/odp_schedule_if.h \
> > ${srcdir}/include/odp_sorted_list_internal.h \
> > ${srcdir}/include/odp_shm_internal.h \
> > +   ${srcdir}/include/odp_time_internal.h \
> > ${srcdir}/include/odp_timer_internal.h \
> > ${srcdir}/include/odp_timer_wheel_internal.h \
> > ${srcdir}/include/odp_traffic_mngr_internal.h \
> > diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c
> b/platform/linux-generic/arch/arm/odp_cpu_arch.c
> > index 2ac223e0..3a87f09c 100644
> > --- a/platform/linux-generic/arch/arm/odp_cpu_arch.c
> > +++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c
> > @@ -13,6 +13,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #define GIGA 10
> >
> > @@ -46,3 +47,13 @@ uint64_t odp_cpu_cycles_resolution(void)
> >  {
> >   return 1;
> >  }
> > +
> > +uint64_t cpu_global_time(void)
> > +{
> > + return 0;
> > +}
> > +
> > +uint64_t cpu_global_time_freq(void)
> > +{
> > + return 0;
> > +}
> > diff --git a/platform/linux-generic/arch/default/odp_cpu_arch.c
> b/platform/linux-generic/arch/default/odp_cpu_arch.c
> > index 2ac223e0..3a87f09c 100644
> > --- a/platform/linux-generic/arch/default/odp_cpu_arch.c
> > +++ b/platform/linux-generic/arch/default/odp_cpu_arch.c
> > @@ -13,6 +13,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #define GIGA 10
> >
> > @@ -46,3 +47,13 @@ uint64_t odp_cpu_cycles_resolution(void)
> >  {
> >   return 1;
> >  }
> > +
> > +uint64_t cpu_global_time(void)
> > +{
> > + return 0;
> > +}
> > +
> > +uint64_t cpu_global_time_freq(void)
> > +{
> > + return 0;
> > +}
> > diff --git a/platform/linux-generic/arch/mips64/odp_cpu_arch.c
> b/platform/linux-generic/arch/mips64/odp_cpu_arch.c
> > index 646acf9c..a9a94531 100644
> > --- a/platform/linux-generic/arch/mips64/odp_cpu_arch.c
> > +++ b/platform/linux-generic/arch/mips64/odp_cpu_arch.c
> > @@ -7,6 +7,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  uint64_t odp_cpu_cycles(void)
> >  {
> > @@ -29,3 +30,13 @@ uint64_t odp_cpu_cycles_resolution(void)
> >  {
> >   return 1;
> >  }
> > +
> > +uint64_t cpu_global_time(void)
> > +{
> > + return 0;
> > +}
> > +
> > +uint64_t cpu_global_time_freq(void)
> > +{
> > + return 0;
> > +}
> > diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
> b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
> > index 2ac223e0..3a87f09c 100644
> > --- a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
> > +++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
> > @@ -13,6 +13,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #define GIGA 10
> >
> > @@ -46,3 +47,13 @@ uint64_t odp_cpu_cycles_resolution(void)
> >  {
> >   return 1;
> >  }
> > +
> > +uint64_t cpu_global_time(void)
> > +{
> > + return 0;
> > +}
> > +
> > +uint64_t cpu_global_time_freq(void)
> > +{
> > + return 0;
> > +}
> > diff --git a/platform/linux-generic/arch/x86/cpu_flags.c
> b/platform/linux-generic/arch/x86/cpu_flags.c
> > index 8fb9477a..cde8ad3e 100644
> > --- a/platform/linux-generic/arch/x86/cpu_flags.c
> > +++ b/platform/linux-generic/arch/x86/cpu_flags.c
> > @@ -38,6 +38,7 @@
> >   */
> >
> >  #include 
> > +#include 
> 

Re: [lng-odp] [API-NEXT PATCH 4/8] test: validation: add odp_sys_info_print test

2017-04-21 Thread Brian Brooks
On 04/21 16:11:30, Petri Savolainen wrote:
> Added validation test for the new system info print call.
> 
> Signed-off-by: Petri Savolainen 
> ---
>  test/common_plat/validation/api/system/system.c | 8 
>  test/common_plat/validation/api/system/system.h | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/test/common_plat/validation/api/system/system.c 
> b/test/common_plat/validation/api/system/system.c
> index 57ff34eb..5b7ca01a 100644
> --- a/test/common_plat/validation/api/system/system.c
> +++ b/test/common_plat/validation/api/system/system.c
> @@ -301,6 +301,13 @@ void system_test_odp_cpu_hz_max_id(void)
>   }
>  }
>  
> +void system_test_info_print(void)
> +{
> + printf("\n\nCalling system info print...\n");
> + odp_sys_info_print();
> + printf("...done. ");

Do these printfs provide useful information?

> +}
> +
>  odp_testinfo_t system_suite[] = {
>   ODP_TEST_INFO(system_test_odp_version_numbers),
>   ODP_TEST_INFO(system_test_odp_cpu_count),
> @@ -319,6 +326,7 @@ odp_testinfo_t system_suite[] = {
>   ODP_TEST_INFO(system_test_odp_cpu_cycles_max),
>   ODP_TEST_INFO(system_test_odp_cpu_cycles_resolution),
>   ODP_TEST_INFO(system_test_odp_cpu_cycles_diff),
> + ODP_TEST_INFO(system_test_info_print),
>   ODP_TEST_INFO_NULL,
>  };
>  
> diff --git a/test/common_plat/validation/api/system/system.h 
> b/test/common_plat/validation/api/system/system.h
> index cbb994eb..c33729b9 100644
> --- a/test/common_plat/validation/api/system/system.h
> +++ b/test/common_plat/validation/api/system/system.h
> @@ -30,6 +30,7 @@ void system_test_odp_cpu_cycles_max(void);
>  void system_test_odp_cpu_cycles(void);
>  void system_test_odp_cpu_cycles_diff(void);
>  void system_test_odp_cpu_cycles_resolution(void);
> +void system_test_info_print(void);
>  
>  /* test arrays: */
>  extern odp_testinfo_t system_suite[];
> -- 
> 2.11.0
> 


Re: [lng-odp] [API-NEXT PATCH 1/8] api: system: added system info print

2017-04-21 Thread Brian Brooks
On 04/21 16:11:27, Petri Savolainen wrote:
> This information specifies the system where ODP application
> is running for debugging purposes.
> 
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/spec/system_info.h | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/odp/api/spec/system_info.h 
> b/include/odp/api/spec/system_info.h
> index 0bb4f1f1..ca4dcdc7 100644
> --- a/include/odp/api/spec/system_info.h
> +++ b/include/odp/api/spec/system_info.h
> @@ -45,6 +45,15 @@ uint64_t odp_sys_page_size(void);
>  int odp_sys_cache_line_size(void);
>  
>  /**
> + * Print system info

I would advise that APIs return information that can be printed by
the application or used otherwise. An API like this indicates that
the implementation itself would be sending something to stdout; that
can be done by the application.

> + * Print out implementation defined information about the system. This
> + * information is intended for debugging purposes and may contain e.g.
> + * information about CPUs, memory and other HW configuration.
> + */
> +void odp_sys_info_print(void);
> +
> +/**
>   * @}
>   */
>  
> -- 
> 2.11.0
> 


Re: [lng-odp] shmem pool APIs

2017-04-21 Thread Bill Fischofer
On Fri, Apr 21, 2017 at 1:27 AM, Bala Manoharan 
wrote:

> On 21 April 2017 at 02:05, Honnappa Nagarahalli
>  wrote:
> > On 20 April 2017 at 13:54, Bill Fischofer 
> wrote:
> >>
> >> On Thu, Apr 20, 2017 at 12:26 PM, Honnappa Nagarahalli
> >>  wrote:
> >>>
> >>> Hi,
> >>>I looked at the shmem pool APIs for allocating smaller chunks of
> >>> shared memory. Following are the APIs I am looking at:
> >>>
> >>> odpdrv_shm_pool_create
> >>> odpdrv_shm_pool_destroy
> >>> odpdrv_shm_pool_alloc
> >>> odpdrv_shm_pool_free
> >>>
> >>> Few questions:
> >>>
> >>> 1) Why are these APIs prefixed with 'odpdrv', this should be 'odp'.
> >>> Are these APIs supposed to be used only by drivers?
> >>
> >>
> >> Christophe was using the prefix odpdrv_ for new "Southside" APIs. The
> idea
> >> is that the standard "Northside" (odp_ prefix) APIs are intended for
> use by
> >> applications to allow portability across different ODP implementations
> while
> >> the Southside APIs would provide the same sort of portability for
> drivers.
> >> These haven't been formalized (yet) so these are still under
> definition. I
> >> hope we'll be able to review / discuss these during the upcoming Sprint.
> >>
> >>>
> >>> 2) odpdrv_shm_pool_alloc - does not take 'alignment' input. The
> >>> scalable scheduler data structures need cache line alignment.
> >>
> >>
> >> These are prototypes at this point and if that's needed I'm sure it
> could
> >> easily be added. Since drivers are typically dealing with page-aligned
> ring
> >> buffers and such they would automatically be cache-aligned, so perhaps
> he
> >> didn't see the need to call that out explicitly.
> >>
> >
> > I find these APIs useful in allocating smaller chunks of shared memory
> > (may be some more functionality can be added to these APIs). I will
> > use them in the scalable scheduler for allocating shared memory for
> > queues.
>
> Since these are driver APIs they might not be available in all
> implementations.
> IMO, we need to keep scalable scheduler implementation independent
> from drv APIs.
>

Agree. Christophe developed his shm extensions with a view that they could
be used by both north and south APIs. That's the reason why _ishm.c exists.
Sounds like these should be made _ishm functions so that the scheduler can
use them as internal APIs.


>
> Regards,
> Bala
> >
> >>>
> >>>
> >>> Thanks,
> >>> Honnappa
> >>
> >>
>


[lng-odp] [API-NEXT PATCHv3 6/6] helper: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
additional field documentation to avoid problems with doxygen 1.8.13
and higher.

Signed-off-by: Bill Fischofer 
---
 helper/include/odp/helper/icmp.h | 11 ++
 helper/include/odp/helper/strong_types.h |  3 ++-
 helper/include/odp/helper/table.h|  2 +-
 helper/include/odp/helper/tcp.h  | 35 
 helper/include/odp/helper/threads.h  |  7 +--
 5 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/helper/include/odp/helper/icmp.h b/helper/include/odp/helper/icmp.h
index e25646ad..bef96784 100644
--- a/helper/include/odp/helper/icmp.h
+++ b/helper/include/odp/helper/icmp.h
@@ -32,15 +32,18 @@ typedef struct ODP_PACKED {
uint8_t type;   /**< message type */
uint8_t code;   /**< type sub-code */
odp_u16sum_t chksum;/**< checksum of icmp header */
+   /** Variant mappings of ICMP fields */
union {
+   /** Fields used for ICMP echo msgs */
struct {
-   odp_u16be_t id;
-   odp_u16be_t sequence;
+   odp_u16be_t id;   /**< id */
+   odp_u16be_t sequence; /**< sequence */
} echo; /**< echo datagram */
odp_u32be_t gateway;/**< gateway address */
+   /** Fields used for ICMP frag msgs */
struct {
-   odp_u16be_t __unused;
-   odp_u16be_t mtu;
+   odp_u16be_t __unused; /**< @internal */
+   odp_u16be_t mtu;  /**< mtu */
} frag; /**< path mtu discovery */
} un;   /**< icmp sub header */
 } odph_icmphdr_t;
diff --git a/helper/include/odp/helper/strong_types.h 
b/helper/include/odp/helper/strong_types.h
index 13e35a43..501d0f28 100644
--- a/helper/include/odp/helper/strong_types.h
+++ b/helper/include/odp/helper/strong_types.h
@@ -20,10 +20,11 @@
 
 /** Use strong typing for ODP types */
 #ifdef __cplusplus
+/** @internal C++ helper macro for strong typing  @param type @return */
 #define ODPH_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type
 #else
 #define odph_handle_t struct { uint8_t unused_dummy_var; } *
-/** C/C++ helper macro for strong typing */
+/** @internal C helper macro for strong typing @param type @return */
 #define ODPH_HANDLE_T(type) odph_handle_t type
 #endif
 
diff --git a/helper/include/odp/helper/table.h 
b/helper/include/odp/helper/table.h
index b3440ef5..96c9c5fe 100644
--- a/helper/include/odp/helper/table.h
+++ b/helper/include/odp/helper/table.h
@@ -94,7 +94,7 @@ extern "C" {
 #define ODPH_TABLE_NAME_LEN  32
 
 #include 
-/** ODP table handle */
+/** @internal ODPH table handle @return */
 typedef ODPH_HANDLE_T(odph_table_t);
 
 /**
diff --git a/helper/include/odp/helper/tcp.h b/helper/include/odp/helper/tcp.h
index fd234e58..e91b52e2 100644
--- a/helper/include/odp/helper/tcp.h
+++ b/helper/include/odp/helper/tcp.h
@@ -32,8 +32,9 @@ typedef struct ODP_PACKED {
odp_u16be_t dst_port; /**< Destination port */
odp_u32be_t seq_no;   /**< Sequence number */
odp_u32be_t ack_no;   /**< Acknowledgment number */
+   /** Variant maps for TCP header fields */
union {
-   odp_u16be_t doffset_flags;
+   odp_u16be_t doffset_flags; /**< TCP Flags aggregate */
 #if ODP_BIG_ENDIAN_BITFIELD
struct {
odp_u16be_t rsvd1:8;
@@ -42,14 +43,14 @@ typedef struct ODP_PACKED {
struct {
odp_u16be_t hl:4;/**< Hdr len, in words */
odp_u16be_t rsvd3:4; /**< Reserved */
-   odp_u16be_t cwr:1;
-   odp_u16be_t ece:1;
-   odp_u16be_t urg:1;
-   odp_u16be_t ack:1;
-   odp_u16be_t psh:1;
-   odp_u16be_t rst:1;
-   odp_u16be_t syn:1;
-   odp_u16be_t fin:1;
+   odp_u16be_t cwr:1;   /**< cwr bit */
+   odp_u16be_t ece:1;   /**< ece bit */
+   odp_u16be_t urg:1;   /**< urg bit */
+   odp_u16be_t ack:1;   /**< ack bit */
+   odp_u16be_t psh:1;   /**< psh bit */
+   odp_u16be_t rst:1;   /**< rst bit */
+   odp_u16be_t syn:1;   /**< syn bit */
+   odp_u16be_t fin:1;   /**< fin bit */
};
 #elif ODP_LITTLE_ENDIAN_BITFIELD
struct {
@@ -59,14 +60,14 @@ typedef struct ODP_PACKED {
struct {
odp_u16be_t rsvd3:4; /**< Reserved */
odp_u16be_t hl:4;/**< Hdr len, in words */
-   

[lng-odp] [API-NEXT PATCHv3 5/6] linux-generic: types: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
additional field documentation to avoid problems with doxygen 1.8.13
and higher.

Signed-off-by: Bill Fischofer 
---
 platform/linux-generic/include/odp/api/debug.h   | 8 
 platform/linux-generic/include/odp/api/plat/packet_types.h   | 1 +
 platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp/api/debug.h 
b/platform/linux-generic/include/odp/api/debug.h
index b0f91b1c..bef2fd0e 100644
--- a/platform/linux-generic/include/odp/api/debug.h
+++ b/platform/linux-generic/include/odp/api/debug.h
@@ -25,17 +25,23 @@ extern "C" {
  * versions.
  */
 #define _odp_merge(a, b) a##b
+/** @internal */
 #define _odp_label(a) _odp_merge(_ODP_SASSERT_, a)
+/** @internal */
 #define _ODP_SASSERT _odp_label(__COUNTER__)
+/** @internal */
 #define _ODP_SASSERT_ENUM(e) { _ODP_SASSERT = 1 / !!(e) }
+/** @internal */
 #define _odp_static_assert(e, s) enum _ODP_SASSERT_ENUM(e)
 
 #if defined(__clang__)
 #if defined(__cplusplus)
 #if !__has_feature(cxx_static_assert) && !defined(static_assert)
+/** @internal */
 #definestatic_assert(e, s) _odp_static_assert(e, s)
 #endif
 #elif !__has_feature(c_static_assert) && !defined(_Static_assert)
+/** @internal */
 #define _Static_assert(e, s) _odp_static_assert(e, s)
 #endif
 
@@ -44,9 +50,11 @@ extern "C" {
(__GNUC__ < 6 && defined(__cplusplus))
 #if defined(__cplusplus)
 #if !defined(static_assert)
+/** @intenral */
 #definestatic_assert(e, s) _odp_static_assert(e, s)
 #endif
 #elif !defined(_Static_assert)
+/** @internal */
 #define _Static_assert(e, s) _odp_static_assert(e, s)
 #endif
 #endif
diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h 
b/platform/linux-generic/include/odp/api/plat/packet_types.h
index 7403afc1..a209c759 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_types.h
@@ -105,6 +105,7 @@ typedef union {
/** All input flags */
uint64_t all;
 
+   /** Individual input flags */
struct {
uint64_t dst_queue:1; /**< Dst queue present */
 
diff --git a/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h 
b/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h
index b766afec..f47a13f6 100644
--- a/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h
+++ b/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h
@@ -168,7 +168,7 @@ typedef odp_tm_handle_t odp_tm_wred_t;
  */
 #define ODP_TM_ROOT  ((odp_tm_handle_t)-1)
 
-/** Get printable format of odp_queue_t */
+/** @internal Get printable format of odp_tm_handle_t @param hdl @return */
 static inline uint64_t odp_tm_handle_to_u64(odp_tm_handle_t hdl)
 {
return hdl;
-- 
2.11.0



[lng-odp] [API-NEXT PATCHv3 4/6] api: tm: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
additional field documentation to avoid problems with doxygen 1.8.13
and higher.

Signed-off-by: Bill Fischofer 
---
 include/odp/api/spec/traffic_mngr.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/spec/traffic_mngr.h 
b/include/odp/api/spec/traffic_mngr.h
index 71198bbd..3a748cef 100644
--- a/include/odp/api/spec/traffic_mngr.h
+++ b/include/odp/api/spec/traffic_mngr.h
@@ -471,9 +471,10 @@ typedef enum {
 typedef struct {
odp_tm_egress_kind_t egress_kind; /**< Union discriminator */
 
+   /** Variant parameters for different TM outputs */
union {
-   odp_pktio_t pktio;
-   odp_tm_egress_fcn_t egress_fcn;
+   odp_pktio_t pktio;  /**< Output to PktIO */
+   odp_tm_egress_fcn_t egress_fcn; /**< Output to user func */
};
 } odp_tm_egress_t;
 
-- 
2.11.0



[lng-odp] [API-NEXT PATCHv3 2/6] api: ipsec: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
additional field documentation to avoid problems with doxygen 1.8.13
and higher.

Signed-off-by: Bill Fischofer 
---
 include/odp/api/spec/ipsec.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index a0ceb11a..3521d2f8 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -157,6 +157,7 @@ typedef struct odp_ipsec_inbound_config_t {
/** Flags to control IPSEC payload data checks up to the selected parse
 *  level. */
union {
+   /** Mapping for individual bits */
struct {
/** Check IPv4 header checksum in IPSEC payload.
 *  Default value is 0. */
@@ -195,6 +196,7 @@ typedef struct odp_ipsec_outbound_config_t {
 *  metadata flag to disable checksum insertion per packet bases.
 */
union {
+   /** Mapping for individual bits */
struct {
/** Insert IPv4 header checksum on the payload packet
 *  before IPSEC transformation. Default value is 0. */
@@ -393,6 +395,7 @@ typedef struct odp_ipsec_tunnel_param_t {
/** Tunnel type: IPv4 or IPv6 */
odp_ipsec_tunnel_type_t type;
 
+   /** Variant mappings for tunnel parameters */
union {
/** IPv4 header parameters */
struct {
@@ -850,6 +853,7 @@ typedef struct odp_ipsec_op_opt_t {
 
 /** IPSEC operation status */
 typedef struct odp_ipsec_op_status_t {
+   /** Variant mappings for op status */
union {
/** Error flags */
struct {
@@ -901,6 +905,7 @@ typedef struct odp_ipsec_op_status_t {
uint32_t all_error;
};
 
+   /** Variant mappings for status flags */
union {
/** Status flags */
struct {
-- 
2.11.0



[lng-odp] [API-NEXT PATCHv3 3/6] api: pool: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
additional field documentation to avoid problems with doxygen 1.8.13
and higher.

Signed-off-by: Bill Fischofer 
---
 include/odp/api/spec/pool.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index c0de195a..6fc5b6b4 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -166,7 +166,9 @@ typedef struct odp_pool_param_t {
/** Pool type */
int type;
 
+   /** Variant parameters for different pool types */
union {
+   /** Parameters for buffer pools */
struct {
/** Number of buffers in the pool */
uint32_t num;
@@ -180,6 +182,8 @@ typedef struct odp_pool_param_t {
Default will always be a multiple of 8. */
uint32_t align;
} buf;
+
+   /** Parameters for packet pools */
struct {
/** The number of packets that the pool must provide
that are packet length 'len' bytes or smaller.
@@ -211,6 +215,8 @@ typedef struct odp_pool_param_t {
Specify as 0 if no user area is needed. */
uint32_t uarea_size;
} pkt;
+
+   /** Parameters for timeout pools */
struct {
/** Number of timeouts in the pool */
uint32_t num;
-- 
2.11.0



[lng-odp] [API-NEXT PATCHv3 1/6] api: classification: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
additional field documentation to avoid problems with doxygen 1.8.13
and higher.

Signed-off-by: Bill Fischofer 
---
 include/odp/api/spec/classification.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/odp/api/spec/classification.h 
b/include/odp/api/spec/classification.h
index 0e1addd6..39831b24 100644
--- a/include/odp/api/spec/classification.h
+++ b/include/odp/api/spec/classification.h
@@ -366,7 +366,9 @@ typedef struct odp_pmr_param_t {
/** True if the value is range and false if match */
odp_bool_t range_term;
 
+   /** Variant mappings for types of matches */
union {
+   /** Parameters for single-valued matches */
struct {
/** Value to be matched */
const void  *value;
@@ -374,6 +376,8 @@ typedef struct odp_pmr_param_t {
/** Masked set of bits to be matched */
const void  *mask;
} match;
+
+   /** Parameter for range value matches */
struct {
/** Start and End values are included in the range */
/** start value of range */
-- 
2.11.0



Re: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
On Fri, Apr 21, 2017 at 8:52 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia-bell-labs.com> wrote:

>
>
> From: Bill Fischofer [mailto:bill.fischo...@linaro.org]
> Sent: Friday, April 21, 2017 4:26 PM
> To: Savolainen, Petri (Nokia - FI/Espoo)  labs.com>
> Cc: lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional
> doxygen documentation
>
>
>
> On Fri, Apr 21, 2017 at 8:20 AM, Savolainen, Petri (Nokia - FI/Espoo)
>  wrote:
> These doxygen fixes look OK, but where is patch 5/6. First version had 5
> patches, this should have 6, but has only 5... Did something go wrong.
>
> The first patch was written against master, but then I realized since it
> was making API changes (albeit just doxygen) that it should be against
> api-next. V2 is against api-next and since that includes another API file
> (ipsec.h) that also needed updating v2 is in 6 parts. v2 is the one that
> should be merged and then it can be pulled forward to master.
>
>
>
>
> OK, for some reason I cannot find 5/6 from my client, but it's on the list.
>
> Regardless of that, there's something mixed between 5/6 and 6/6. Both edit
> the same line of helper/ip.h
>
>
> 5/5:
> --- a/helper/include/odp/helper/ip.h
> +++ b/helper/include/odp/helper/ip.h
> @@ -29,7 +29,7 @@ extern "C" {
>  #define ODPH_IPV4 4  /**< IP version 4 */
>  #define ODPH_IPV4HDR_LEN 20  /**< Min length of IP header (no
> options) */
>  #define ODPH_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
> -#define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */
> +cd #define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */
>
>
> 6/6:
> --- a/helper/include/odp/helper/ip.h
> +++ b/helper/include/odp/helper/ip.h
> @@ -29,7 +29,7 @@ extern "C" {
>  #define ODPH_IPV4 4  /**< IP version 4 */
>  #define ODPH_IPV4HDR_LEN 20  /**< Min length of IP header (no
> options) */
>  #define ODPH_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
> -cd #define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */
> +#define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */
>

OK, that was a glitch. I'll correct in a v3 repost. Thanks.


>
> -Petri
>
>


Re: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional doxygen documentation

2017-04-21 Thread Savolainen, Petri (Nokia - FI/Espoo)


From: Bill Fischofer [mailto:bill.fischo...@linaro.org] 
Sent: Friday, April 21, 2017 4:26 PM
To: Savolainen, Petri (Nokia - FI/Espoo) 
Cc: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional doxygen 
documentation



On Fri, Apr 21, 2017 at 8:20 AM, Savolainen, Petri (Nokia - FI/Espoo) 
 wrote:
These doxygen fixes look OK, but where is patch 5/6. First version had 5 
patches, this should have 6, but has only 5... Did something go wrong.

The first patch was written against master, but then I realized since it was 
making API changes (albeit just doxygen) that it should be against api-next. V2 
is against api-next and since that includes another API file (ipsec.h) that 
also needed updating v2 is in 6 parts. v2 is the one that should be merged and 
then it can be pulled forward to master.




OK, for some reason I cannot find 5/6 from my client, but it's on the list.

Regardless of that, there's something mixed between 5/6 and 6/6. Both edit the 
same line of helper/ip.h


5/5:
--- a/helper/include/odp/helper/ip.h
+++ b/helper/include/odp/helper/ip.h
@@ -29,7 +29,7 @@ extern "C" {
 #define ODPH_IPV4 4  /**< IP version 4 */
 #define ODPH_IPV4HDR_LEN 20  /**< Min length of IP header (no options) */
 #define ODPH_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
-#define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */
+cd #define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */


6/6:
--- a/helper/include/odp/helper/ip.h
+++ b/helper/include/odp/helper/ip.h
@@ -29,7 +29,7 @@ extern "C" {
 #define ODPH_IPV4 4  /**< IP version 4 */
 #define ODPH_IPV4HDR_LEN 20  /**< Min length of IP header (no options) */
 #define ODPH_IPV4HDR_IHL_MIN  5  /**< Minimum IHL value*/
-cd #define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */
+#define ODPH_IPV4ADDR_LEN 4  /**< IPv4 address length in bytes */ 

-Petri



Re: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional doxygen documentation

2017-04-21 Thread Bill Fischofer
On Fri, Apr 21, 2017 at 8:20 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia-bell-labs.com> wrote:

> These doxygen fixes look OK, but where is patch 5/6. First version had 5
> patches, this should have 6, but has only 5... Did something go wrong.
>

The first patch was written against master, but then I realized since it
was making API changes (albeit just doxygen) that it should be against
api-next. V2 is against api-next and since that includes another API file
(ipsec.h) that also needed updating v2 is in 6 parts. v2 is the one that
should be merged and then it can be pulled forward to master.


>
> -Petri
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> Bill
> > Fischofer
> > Sent: Thursday, April 20, 2017 1:35 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional doxygen
> > documentation
> >
> > Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
> > additional field documentation to avoid problems with doxygen 1.8.13
> > and higher.
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> >  helper/include/odp/helper/icmp.h | 11 ++
> >  helper/include/odp/helper/ip.h   |  2 +-
> >  helper/include/odp/helper/strong_types.h |  3 ++-
> >  helper/include/odp/helper/table.h|  2 +-
> >  helper/include/odp/helper/tcp.h  | 35
> ---
>
>


Re: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional doxygen documentation

2017-04-21 Thread Savolainen, Petri (Nokia - FI/Espoo)
These doxygen fixes look OK, but where is patch 5/6. First version had 5 
patches, this should have 6, but has only 5... Did something go wrong.

-Petri


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Bill
> Fischofer
> Sent: Thursday, April 20, 2017 1:35 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCHv2 6/6] helper: add additional doxygen
> documentation
> 
> Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2952 by adding
> additional field documentation to avoid problems with doxygen 1.8.13
> and higher.
> 
> Signed-off-by: Bill Fischofer 
> ---
>  helper/include/odp/helper/icmp.h | 11 ++
>  helper/include/odp/helper/ip.h   |  2 +-
>  helper/include/odp/helper/strong_types.h |  3 ++-
>  helper/include/odp/helper/table.h|  2 +-
>  helper/include/odp/helper/tcp.h  | 35 ---



[lng-odp] [API-NEXT PATCH 2/8] linux-gen: cpu_flags: added x86 cpu flag read functions

2017-04-21 Thread Petri Savolainen
When building on x86 CPU flags can be used to determine which
CPU features are supported. CPU flag definitions and the code
to read the flags is from DPDK.

Signed-off-by: Petri Savolainen 
---
 configure.ac|   1 +
 platform/linux-generic/Makefile.am  |   4 +
 platform/linux-generic/arch/x86/cpu_flags.c | 349 
 platform/linux-generic/arch/x86/cpu_flags.h |  20 ++
 4 files changed, 374 insertions(+)
 create mode 100644 platform/linux-generic/arch/x86/cpu_flags.c
 create mode 100644 platform/linux-generic/arch/x86/cpu_flags.h

diff --git a/configure.ac b/configure.ac
index e86e2dca..38129030 100644
--- a/configure.ac
+++ b/configure.ac
@@ -224,6 +224,7 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test "x${DOXYGEN}" = 
"xdoxygen"])
 AM_CONDITIONAL([user_guide], [test "x${user_guides}" = "xyes" ])
 AM_CONDITIONAL([HAVE_MSCGEN], [test "x${MSCGEN}" = "xmscgen"])
 AM_CONDITIONAL([helper_linux], [test x$helper_linux = xyes ])
+AM_CONDITIONAL([ARCH_IS_X86], [test "x${ARCH_DIR}" = "xx86"])
 
 ##
 # Setup doxygen documentation
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 81a19011..60b7f849 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -252,6 +252,10 @@ __LIB__libodp_linux_la_SOURCES = \
   arch/@ARCH_DIR@/odp_cpu_arch.c \
   arch/@ARCH_DIR@/odp_sysinfo_parse.c
 
+if ARCH_IS_X86
+__LIB__libodp_linux_la_SOURCES += arch/@ARCH_DIR@/cpu_flags.c
+endif
+
 if HAVE_PCAP
 __LIB__libodp_linux_la_SOURCES += pktio/pcap.c
 endif
diff --git a/platform/linux-generic/arch/x86/cpu_flags.c 
b/platform/linux-generic/arch/x86/cpu_flags.c
new file mode 100644
index ..8fb9477a
--- /dev/null
+++ b/platform/linux-generic/arch/x86/cpu_flags.c
@@ -0,0 +1,349 @@
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+
+enum rte_cpu_flag_t {
+   /* (EAX 01h) ECX features*/
+   RTE_CPUFLAG_SSE3 = 0,   /**< SSE3 */
+   RTE_CPUFLAG_PCLMULQDQ,  /**< PCLMULQDQ */
+   RTE_CPUFLAG_DTES64, /**< DTES64 */
+   RTE_CPUFLAG_MONITOR,/**< MONITOR */
+   RTE_CPUFLAG_DS_CPL, /**< DS_CPL */
+   RTE_CPUFLAG_VMX,/**< VMX */
+   RTE_CPUFLAG_SMX,/**< SMX */
+   RTE_CPUFLAG_EIST,   /**< EIST */
+   RTE_CPUFLAG_TM2,/**< TM2 */
+   RTE_CPUFLAG_SSSE3,  /**< SSSE3 */
+   RTE_CPUFLAG_CNXT_ID,/**< CNXT_ID */
+   RTE_CPUFLAG_FMA,/**< FMA */
+   RTE_CPUFLAG_CMPXCHG16B, /**< CMPXCHG16B */
+   RTE_CPUFLAG_XTPR,   /**< XTPR */
+   RTE_CPUFLAG_PDCM,   /**< PDCM */
+   RTE_CPUFLAG_PCID,   /**< PCID */
+   RTE_CPUFLAG_DCA,/**< DCA */
+   RTE_CPUFLAG_SSE4_1, /**< SSE4_1 */
+   RTE_CPUFLAG_SSE4_2, /**< 

[lng-odp] [API-NEXT PATCH 8/8] linux-gen: time: use hw time counter when available

2017-04-21 Thread Petri Savolainen
Use 64 bit HW time counter when available. It is used on
x86 when invariant TSC CPU flag indicates that TSC frequency
is constant. Otherwise, the system time is used as before. Direct
HW time counter usage avoids system call, and related latency
and performance issues.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/Makefile.am |   1 +
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  11 +
 platform/linux-generic/arch/default/odp_cpu_arch.c |  11 +
 platform/linux-generic/arch/mips64/odp_cpu_arch.c  |  11 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  11 +
 platform/linux-generic/arch/x86/cpu_flags.c|   9 +
 platform/linux-generic/arch/x86/odp_cpu_arch.c |  59 
 .../include/odp/api/plat/time_types.h  |  23 +-
 platform/linux-generic/include/odp_time_internal.h |  24 ++
 platform/linux-generic/odp_time.c  | 303 -
 10 files changed, 398 insertions(+), 65 deletions(-)
 create mode 100644 platform/linux-generic/include/odp_time_internal.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 60b7f849..ed66fecf 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -171,6 +171,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_schedule_if.h \
  ${srcdir}/include/odp_sorted_list_internal.h \
  ${srcdir}/include/odp_shm_internal.h \
+ ${srcdir}/include/odp_time_internal.h \
  ${srcdir}/include/odp_timer_internal.h \
  ${srcdir}/include/odp_timer_wheel_internal.h \
  ${srcdir}/include/odp_traffic_mngr_internal.h \
diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c 
b/platform/linux-generic/arch/arm/odp_cpu_arch.c
index 2ac223e0..3a87f09c 100644
--- a/platform/linux-generic/arch/arm/odp_cpu_arch.c
+++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define GIGA 10
 
@@ -46,3 +47,13 @@ uint64_t odp_cpu_cycles_resolution(void)
 {
return 1;
 }
+
+uint64_t cpu_global_time(void)
+{
+   return 0;
+}
+
+uint64_t cpu_global_time_freq(void)
+{
+   return 0;
+}
diff --git a/platform/linux-generic/arch/default/odp_cpu_arch.c 
b/platform/linux-generic/arch/default/odp_cpu_arch.c
index 2ac223e0..3a87f09c 100644
--- a/platform/linux-generic/arch/default/odp_cpu_arch.c
+++ b/platform/linux-generic/arch/default/odp_cpu_arch.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define GIGA 10
 
@@ -46,3 +47,13 @@ uint64_t odp_cpu_cycles_resolution(void)
 {
return 1;
 }
+
+uint64_t cpu_global_time(void)
+{
+   return 0;
+}
+
+uint64_t cpu_global_time_freq(void)
+{
+   return 0;
+}
diff --git a/platform/linux-generic/arch/mips64/odp_cpu_arch.c 
b/platform/linux-generic/arch/mips64/odp_cpu_arch.c
index 646acf9c..a9a94531 100644
--- a/platform/linux-generic/arch/mips64/odp_cpu_arch.c
+++ b/platform/linux-generic/arch/mips64/odp_cpu_arch.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 
 uint64_t odp_cpu_cycles(void)
 {
@@ -29,3 +30,13 @@ uint64_t odp_cpu_cycles_resolution(void)
 {
return 1;
 }
+
+uint64_t cpu_global_time(void)
+{
+   return 0;
+}
+
+uint64_t cpu_global_time_freq(void)
+{
+   return 0;
+}
diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c 
b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
index 2ac223e0..3a87f09c 100644
--- a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
+++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define GIGA 10
 
@@ -46,3 +47,13 @@ uint64_t odp_cpu_cycles_resolution(void)
 {
return 1;
 }
+
+uint64_t cpu_global_time(void)
+{
+   return 0;
+}
+
+uint64_t cpu_global_time_freq(void)
+{
+   return 0;
+}
diff --git a/platform/linux-generic/arch/x86/cpu_flags.c 
b/platform/linux-generic/arch/x86/cpu_flags.c
index 8fb9477a..cde8ad3e 100644
--- a/platform/linux-generic/arch/x86/cpu_flags.c
+++ b/platform/linux-generic/arch/x86/cpu_flags.c
@@ -38,6 +38,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
@@ -347,3 +348,11 @@ void cpu_flags_print_all(void)
 
printf("\n\n");
 }
+
+int cpu_has_global_time(void)
+{
+   if (cpu_get_flag_enabled(RTE_CPUFLAG_INVTSC) > 0)
+   return 1;
+
+   return 0;
+}
diff --git a/platform/linux-generic/arch/x86/odp_cpu_arch.c 
b/platform/linux-generic/arch/x86/odp_cpu_arch.c
index c8cf27b6..9ba601a3 100644
--- a/platform/linux-generic/arch/x86/odp_cpu_arch.c
+++ b/platform/linux-generic/arch/x86/odp_cpu_arch.c
@@ -3,7 +3,14 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
+
+#include 
+
 #include 
+#include 
+#include 
+
+#include 
 
 uint64_t odp_cpu_cycles(void)
 {
@@ -31,3 +38,55 @@ uint64_t odp_cpu_cycles_resolution(void)
 {

[lng-odp] [API-NEXT PATCH 7/8] test: validation: add time accuracy test

2017-04-21 Thread Petri Savolainen
Test ODP time keeping accuracy against system time.

Signed-off-by: Petri Savolainen 
---
 test/common_plat/validation/api/time/time.c | 72 +++--
 1 file changed, 57 insertions(+), 15 deletions(-)

diff --git a/test/common_plat/validation/api/time/time.c 
b/test/common_plat/validation/api/time/time.c
index aee7ccef..90e0d301 100644
--- a/test/common_plat/validation/api/time/time.c
+++ b/test/common_plat/validation/api/time/time.c
@@ -7,6 +7,7 @@
 #include 
 #include "odp_cunit_common.h"
 #include "time_test.h"
+#include 
 
 #define BUSY_LOOP_CNT  3000/* used for t > min resolution */
 #define BUSY_LOOP_CNT_LONG 60  /* used for t > 4 sec */
@@ -140,25 +141,25 @@ void time_test_monotony(void)
CU_ASSERT(ns3 > ns2);
 }
 
-static void time_test_cmp(time_cb time, time_from_ns_cb time_from_ns)
+static void time_test_cmp(time_cb time_cur, time_from_ns_cb time_from_ns)
 {
/* volatile to stop optimization of busy loop */
volatile int count = 0;
odp_time_t t1, t2, t3;
 
-   t1 = time();
+   t1 = time_cur();
 
while (count < BUSY_LOOP_CNT) {
count++;
};
 
-   t2 = time();
+   t2 = time_cur();
 
while (count < BUSY_LOOP_CNT * 2) {
count++;
};
 
-   t3 = time();
+   t3 = time_cur();
 
CU_ASSERT(odp_time_cmp(t2, t1) > 0);
CU_ASSERT(odp_time_cmp(t3, t2) > 0);
@@ -191,7 +192,7 @@ void time_test_global_cmp(void)
 }
 
 /* check that a time difference gives a reasonable result */
-static void time_test_diff(time_cb time,
+static void time_test_diff(time_cb time_cur,
   time_from_ns_cb time_from_ns,
   uint64_t res)
 {
@@ -202,13 +203,13 @@ static void time_test_diff(time_cb time,
uint64_t upper_limit, lower_limit;
 
/* test timestamp diff */
-   t1 = time();
+   t1 = time_cur();
 
while (count < BUSY_LOOP_CNT) {
count++;
};
 
-   t2 = time();
+   t2 = time_cur();
CU_ASSERT(odp_time_cmp(t2, t1) > 0);
 
diff = odp_time_diff(t2, t1);
@@ -268,7 +269,7 @@ void time_test_global_diff(void)
 }
 
 /* check that a time sum gives a reasonable result */
-static void time_test_sum(time_cb time,
+static void time_test_sum(time_cb time_cur,
  time_from_ns_cb time_from_ns,
  uint64_t res)
 {
@@ -277,7 +278,7 @@ static void time_test_sum(time_cb time,
uint64_t upper_limit, lower_limit;
 
/* sum timestamp and interval */
-   t1 = time();
+   t1 = time_cur();
ns2 = 103;
t2 = time_from_ns(ns2);
ns1 = odp_time_to_ns(t1);
@@ -319,20 +320,20 @@ void time_test_global_sum(void)
time_test_sum(odp_time_global, odp_time_global_from_ns, global_res);
 }
 
-static void time_test_wait_until(time_cb time, time_from_ns_cb time_from_ns)
+static void time_test_wait_until(time_cb time_cur, time_from_ns_cb 
time_from_ns)
 {
int i;
odp_time_t lower_limit, upper_limit;
odp_time_t start_time, end_time, wait;
odp_time_t second = time_from_ns(ODP_TIME_SEC_IN_NS);
 
-   start_time = time();
+   start_time = time_cur();
wait = start_time;
for (i = 0; i < WAIT_SECONDS; i++) {
wait = odp_time_sum(wait, second);
odp_time_wait_until(wait);
}
-   end_time = time();
+   end_time = time_cur();
 
wait = odp_time_diff(end_time, start_time);
lower_limit = time_from_ns(WAIT_SECONDS * ODP_TIME_SEC_IN_NS -
@@ -398,13 +399,13 @@ void time_test_wait_ns(void)
}
 }
 
-static void time_test_to_u64(time_cb time)
+static void time_test_to_u64(time_cb time_cur)
 {
volatile int count = 0;
uint64_t val1, val2;
odp_time_t t1, t2;
 
-   t1 = time();
+   t1 = time_cur();
 
val1 = odp_time_to_u64(t1);
CU_ASSERT(val1 > 0);
@@ -413,7 +414,7 @@ static void time_test_to_u64(time_cb time)
count++;
};
 
-   t2 = time();
+   t2 = time_cur();
val2 = odp_time_to_u64(t2);
CU_ASSERT(val2 > 0);
 
@@ -433,6 +434,45 @@ void time_test_global_to_u64(void)
time_test_to_u64(odp_time_global);
 }
 
+static void time_test_accuracy(time_cb time_cur, time_from_ns_cb time_from_ns)
+{
+   int i;
+   odp_time_t t1, t2, wait, diff;
+   clock_t c1, c2;
+   double sec_t, sec_c;
+   odp_time_t sec = time_from_ns(ODP_TIME_SEC_IN_NS);
+
+   c1 = clock();
+   t1 = time_cur();
+
+   wait = odp_time_sum(t1, sec);
+   for (i = 0; i < 5; i++) {
+   odp_time_wait_until(wait);
+   wait = odp_time_sum(wait, sec);
+   }
+
+   t2 = time_cur();
+   c2 = clock();
+
+   diff  = odp_time_diff(t2, t1);
+   sec_t = ((double)odp_time_to_ns(diff)) / ODP_TIME_SEC_IN_NS;
+   sec_c = ((double)(c2 

[lng-odp] [API-NEXT PATCH 3/8] linux-gen: system: implement system info print

2017-04-21 Thread Petri Savolainen
Print API, impl name, CPU model/freq, cache line size and
CPU count by default. Print CPU flags in case of x86.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/arch/arm/odp_sysinfo_parse.c  |  4 
 .../linux-generic/arch/default/odp_sysinfo_parse.c   |  4 
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c|  4 
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c   |  4 
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c  |  6 ++
 platform/linux-generic/include/odp_internal.h|  1 +
 platform/linux-generic/odp_system_info.c | 20 
 7 files changed, 43 insertions(+)

diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
index 53e2aaea..8ae2022a 100644
--- a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -25,3 +25,7 @@ uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return 0;
 }
+
+void sys_info_print_arch(void)
+{
+}
diff --git a/platform/linux-generic/arch/default/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/default/odp_sysinfo_parse.c
index 53e2aaea..8ae2022a 100644
--- a/platform/linux-generic/arch/default/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/default/odp_sysinfo_parse.c
@@ -25,3 +25,7 @@ uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return 0;
 }
+
+void sys_info_print_arch(void)
+{
+}
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 407264b7..d6f75f28 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -62,3 +62,7 @@ uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return 0;
 }
+
+void sys_info_print_arch(void)
+{
+}
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 3b88d55b..bd4b9b42 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -61,3 +61,7 @@ uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return 0;
 }
+
+void sys_info_print_arch(void)
+{
+}
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 96127ec6..d77165a4 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -5,6 +5,7 @@
  */
 
 #include 
+#include 
 #include 
 
 int cpuinfo_parser(FILE *file, system_info_t *sysinfo)
@@ -73,3 +74,8 @@ uint64_t odp_cpu_hz_current(int id)
 
return 0;
 }
+
+void sys_info_print_arch(void)
+{
+   cpu_flags_print_all();
+}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index acfc3012..90e2a629 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -133,6 +133,7 @@ int _odp_modules_init_global(void);
 
 int cpuinfo_parser(FILE *file, system_info_t *sysinfo);
 uint64_t odp_cpu_hz_current(int id);
+void sys_info_print_arch(void);
 
 #ifdef __cplusplus
 }
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 18c61dbe..4d6f7f81 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -14,6 +14,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -405,3 +406,22 @@ int odp_cpu_count(void)
 {
return odp_global_data.system_info.cpu_count;
 }
+
+void odp_sys_info_print(void)
+{
+   printf("\n"
+  "ODP system info\n"
+  "---\n"
+  "ODP API version: %s\n"
+  "ODP impl name:   %s\n"
+  "CPU model:   %s\n"
+  "CPU freq (hz):   %" PRIu64 "\n"
+  "Cache line size: %i\n"
+  "CPU count:   %i\n"
+  "\n",
+  odp_version_api_str(), odp_version_impl_name(),
+  odp_cpu_model_str(), odp_cpu_hz_max(),
+  odp_sys_cache_line_size(), odp_cpu_count());
+
+   sys_info_print_arch();
+}
-- 
2.11.0



[lng-odp] [API-NEXT PATCH 0/8] Use HW time counter

2017-04-21 Thread Petri Savolainen
This patch set modifies time implementation to use TSC when running on a x86 
CPU that has invarint TSC CPU flag set. Otherwise, the same Linux system time 
is used as before. TSC is much more efficient both in performance and 
latency/jitter wise than Linux system call. This can be seen also with 
scheduler latency test which time stamps events with this API. All latency 
measurements (min, ave, max) improved significantly.

This is sent through api-next as cpu flags are printed through new system info 
print function for debugging purposes (to verify that invariant TSC flag is 
read correctly).

Patch 2/8 causes two checkpatch errors due to code copied from DPDK. Both 
the macro and the ifdef cannot be changed, so errors should be ignored.


Petri Savolainen (8):
  api: system: added system info print
  linux-gen: cpu_flags: added x86 cpu flag read functions
  linux-gen: system: implement system info print
  test: validation: add odp_sys_info_print test
  test: sched_latency: use sys_info_print
  test: validation: rename time test header file
  test: validation: add time accuracy test
  linux-gen: time: use hw time counter when available

 configure.ac   |   1 +
 include/odp/api/spec/system_info.h |   9 +
 platform/linux-generic/Makefile.am |   5 +
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  11 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c |   4 +
 platform/linux-generic/arch/default/odp_cpu_arch.c |  11 +
 .../linux-generic/arch/default/odp_sysinfo_parse.c |   4 +
 platform/linux-generic/arch/mips64/odp_cpu_arch.c  |  11 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |   4 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  11 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |   4 +
 platform/linux-generic/arch/x86/cpu_flags.c| 358 +
 platform/linux-generic/arch/x86/cpu_flags.h|  20 ++
 platform/linux-generic/arch/x86/odp_cpu_arch.c |  59 
 .../linux-generic/arch/x86/odp_sysinfo_parse.c |   6 +
 .../include/odp/api/plat/time_types.h  |  23 +-
 platform/linux-generic/include/odp_internal.h  |   1 +
 platform/linux-generic/include/odp_time_internal.h |  24 ++
 platform/linux-generic/odp_system_info.c   |  20 ++
 platform/linux-generic/odp_time.c  | 303 +
 test/common_plat/performance/odp_sched_latency.c   |  18 +-
 test/common_plat/validation/api/system/system.c|   8 +
 test/common_plat/validation/api/system/system.h|   1 +
 test/common_plat/validation/api/time/Makefile.am   |   2 +-
 test/common_plat/validation/api/time/time.c|  74 -
 test/common_plat/validation/api/time/time_main.c   |   2 +-
 .../validation/api/time/{time.h => time_test.h}|   0
 27 files changed, 898 insertions(+), 96 deletions(-)
 create mode 100644 platform/linux-generic/arch/x86/cpu_flags.c
 create mode 100644 platform/linux-generic/arch/x86/cpu_flags.h
 create mode 100644 platform/linux-generic/include/odp_time_internal.h
 rename test/common_plat/validation/api/time/{time.h => time_test.h} (100%)

-- 
2.11.0



[lng-odp] [API-NEXT PATCH 4/8] test: validation: add odp_sys_info_print test

2017-04-21 Thread Petri Savolainen
Added validation test for the new system info print call.

Signed-off-by: Petri Savolainen 
---
 test/common_plat/validation/api/system/system.c | 8 
 test/common_plat/validation/api/system/system.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/test/common_plat/validation/api/system/system.c 
b/test/common_plat/validation/api/system/system.c
index 57ff34eb..5b7ca01a 100644
--- a/test/common_plat/validation/api/system/system.c
+++ b/test/common_plat/validation/api/system/system.c
@@ -301,6 +301,13 @@ void system_test_odp_cpu_hz_max_id(void)
}
 }
 
+void system_test_info_print(void)
+{
+   printf("\n\nCalling system info print...\n");
+   odp_sys_info_print();
+   printf("...done. ");
+}
+
 odp_testinfo_t system_suite[] = {
ODP_TEST_INFO(system_test_odp_version_numbers),
ODP_TEST_INFO(system_test_odp_cpu_count),
@@ -319,6 +326,7 @@ odp_testinfo_t system_suite[] = {
ODP_TEST_INFO(system_test_odp_cpu_cycles_max),
ODP_TEST_INFO(system_test_odp_cpu_cycles_resolution),
ODP_TEST_INFO(system_test_odp_cpu_cycles_diff),
+   ODP_TEST_INFO(system_test_info_print),
ODP_TEST_INFO_NULL,
 };
 
diff --git a/test/common_plat/validation/api/system/system.h 
b/test/common_plat/validation/api/system/system.h
index cbb994eb..c33729b9 100644
--- a/test/common_plat/validation/api/system/system.h
+++ b/test/common_plat/validation/api/system/system.h
@@ -30,6 +30,7 @@ void system_test_odp_cpu_cycles_max(void);
 void system_test_odp_cpu_cycles(void);
 void system_test_odp_cpu_cycles_diff(void);
 void system_test_odp_cpu_cycles_resolution(void);
+void system_test_info_print(void);
 
 /* test arrays: */
 extern odp_testinfo_t system_suite[];
-- 
2.11.0



[lng-odp] [API-NEXT PATCH 5/8] test: sched_latency: use sys_info_print

2017-04-21 Thread Petri Savolainen
Use the new system info print function.

Signed-off-by: Petri Savolainen 
---
 test/common_plat/performance/odp_sched_latency.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/test/common_plat/performance/odp_sched_latency.c 
b/test/common_plat/performance/odp_sched_latency.c
index 2b28cd7b..f2aac06f 100644
--- a/test/common_plat/performance/odp_sched_latency.c
+++ b/test/common_plat/performance/odp_sched_latency.c
@@ -634,16 +634,7 @@ int main(int argc, char *argv[])
return -1;
}
 
-   printf("\n");
-   printf("ODP system info\n");
-   printf("---\n");
-   printf("ODP API version:  %s\n",odp_version_api_str());
-   printf("ODP impl name:%s\n",odp_version_impl_name());
-   printf("ODP impl details: %s\n",odp_version_impl_str());
-   printf("CPU model:%s\n",odp_cpu_model_str());
-   printf("CPU freq (hz):%" PRIu64 "\n", odp_cpu_hz_max());
-   printf("Cache line size:  %i\n",odp_sys_cache_line_size());
-   printf("Max CPU count:%i\n",odp_cpu_count());
+   odp_sys_info_print();
 
/* Get default worker cpumask */
if (args.cpu_count)
@@ -654,9 +645,10 @@ int main(int argc, char *argv[])
 
(void)odp_cpumask_to_str(, cpumaskstr, sizeof(cpumaskstr));
 
-   printf("Worker threads:   %i\n", num_workers);
-   printf("First CPU:%i\n", odp_cpumask_first());
-   printf("CPU mask: %s\n\n", cpumaskstr);
+   printf("CPU mask info:\n");
+   printf("  Worker threads: %i\n", num_workers);
+   printf("  First CPU:  %i\n", odp_cpumask_first());
+   printf("  CPU mask:   %s\n", cpumaskstr);
 
thread_tbl = calloc(sizeof(odph_odpthread_t), num_workers);
if (!thread_tbl) {
-- 
2.11.0



[lng-odp] [API-NEXT PATCH 6/8] test: validation: rename time test header file

2017-04-21 Thread Petri Savolainen
Header file name time.h is ambiguos since C has a library header
file with the same name.

Signed-off-by: Petri Savolainen 
---
 test/common_plat/validation/api/time/Makefile.am | 2 +-
 test/common_plat/validation/api/time/time.c  | 2 +-
 test/common_plat/validation/api/time/time_main.c | 2 +-
 test/common_plat/validation/api/time/{time.h => time_test.h} | 0
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename test/common_plat/validation/api/time/{time.h => time_test.h} (100%)

diff --git a/test/common_plat/validation/api/time/Makefile.am 
b/test/common_plat/validation/api/time/Makefile.am
index bf2d0268..999fcf15 100644
--- a/test/common_plat/validation/api/time/Makefile.am
+++ b/test/common_plat/validation/api/time/Makefile.am
@@ -7,4 +7,4 @@ test_PROGRAMS = time_main$(EXEEXT)
 dist_time_main_SOURCES = time_main.c
 time_main_LDADD = libtesttime.la $(LIBCUNIT_COMMON) $(LIBODP)
 
-EXTRA_DIST = time.h
+EXTRA_DIST = time_test.h
diff --git a/test/common_plat/validation/api/time/time.c 
b/test/common_plat/validation/api/time/time.c
index 530d5c07..aee7ccef 100644
--- a/test/common_plat/validation/api/time/time.c
+++ b/test/common_plat/validation/api/time/time.c
@@ -6,7 +6,7 @@
 
 #include 
 #include "odp_cunit_common.h"
-#include "time.h"
+#include "time_test.h"
 
 #define BUSY_LOOP_CNT  3000/* used for t > min resolution */
 #define BUSY_LOOP_CNT_LONG 60  /* used for t > 4 sec */
diff --git a/test/common_plat/validation/api/time/time_main.c 
b/test/common_plat/validation/api/time/time_main.c
index f86d638a..bf1cfe7b 100644
--- a/test/common_plat/validation/api/time/time_main.c
+++ b/test/common_plat/validation/api/time/time_main.c
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include "time.h"
+#include "time_test.h"
 
 int main(int argc, char *argv[])
 {
diff --git a/test/common_plat/validation/api/time/time.h 
b/test/common_plat/validation/api/time/time_test.h
similarity index 100%
rename from test/common_plat/validation/api/time/time.h
rename to test/common_plat/validation/api/time/time_test.h
-- 
2.11.0



[lng-odp] [API-NEXT PATCH 1/8] api: system: added system info print

2017-04-21 Thread Petri Savolainen
This information specifies the system where ODP application
is running for debugging purposes.

Signed-off-by: Petri Savolainen 
---
 include/odp/api/spec/system_info.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/include/odp/api/spec/system_info.h 
b/include/odp/api/spec/system_info.h
index 0bb4f1f1..ca4dcdc7 100644
--- a/include/odp/api/spec/system_info.h
+++ b/include/odp/api/spec/system_info.h
@@ -45,6 +45,15 @@ uint64_t odp_sys_page_size(void);
 int odp_sys_cache_line_size(void);
 
 /**
+ * Print system info
+ *
+ * Print out implementation defined information about the system. This
+ * information is intended for debugging purposes and may contain e.g.
+ * information about CPUs, memory and other HW configuration.
+ */
+void odp_sys_info_print(void);
+
+/**
  * @}
  */
 
-- 
2.11.0



Re: [lng-odp] pcap file discovery

2017-04-21 Thread Maxim Uvarov
On 21 April 2017 at 00:25, Brian Brooks  wrote:

> In test/common_plat/performance/odp_pktio_ordered_run.sh
>
>   PCAP_IN=`find . ${TEST_SRC_DIR} $(dirname $0) -name udp64.pcap -print
> -quit`
>
> It looks like this script is run from workspace root when you do a
> "make check", so "." will find all files named "udp64.pcap".
>
> Depending on whether the files were populated in the file system via
> "git clone" or another means, e.g. "zip ; scp ; unzip", the find
> command could return a different ordering:
>
> on machine 1:
>
>   $ find . -name "udp64.pcap"
>   ./test/common_plat/performance/udp64.pcap
>   ./example/switch/udp64.pcap
>   ./example/l3fwd/udp64.pcap
>   ./example/l2fwd_simple/udp64.pcap
>   ./example/packet/udp64.pcap
>
> on machine 2:
>
>   $ find . -name "udp64.pcap"
>   ./example/l3fwd/udp64.pcap
>   ./example/packet/udp64.pcap
>   ./example/switch/udp64.pcap
>   ./example/l2fwd_simple/udp64.pcap
>   ./test/common_plat/performance/udp64.pcap
>
> A potential fix is:
>
>   PCAP_IN=`find ${TEST_SRC_DIR} -name udp64.pcap -print -quit`
>
> but, it turns out that most of these files are duplicates! They can be
> removed?
>

I think we just need to pull all files to some common place. examples/pcaps
looks like a good place.

Maxim.


Re: [lng-odp] shmem pool APIs

2017-04-21 Thread Bala Manoharan
On 21 April 2017 at 02:05, Honnappa Nagarahalli
 wrote:
> On 20 April 2017 at 13:54, Bill Fischofer  wrote:
>>
>> On Thu, Apr 20, 2017 at 12:26 PM, Honnappa Nagarahalli
>>  wrote:
>>>
>>> Hi,
>>>I looked at the shmem pool APIs for allocating smaller chunks of
>>> shared memory. Following are the APIs I am looking at:
>>>
>>> odpdrv_shm_pool_create
>>> odpdrv_shm_pool_destroy
>>> odpdrv_shm_pool_alloc
>>> odpdrv_shm_pool_free
>>>
>>> Few questions:
>>>
>>> 1) Why are these APIs prefixed with 'odpdrv', this should be 'odp'.
>>> Are these APIs supposed to be used only by drivers?
>>
>>
>> Christophe was using the prefix odpdrv_ for new "Southside" APIs. The idea
>> is that the standard "Northside" (odp_ prefix) APIs are intended for use by
>> applications to allow portability across different ODP implementations while
>> the Southside APIs would provide the same sort of portability for drivers.
>> These haven't been formalized (yet) so these are still under definition. I
>> hope we'll be able to review / discuss these during the upcoming Sprint.
>>
>>>
>>> 2) odpdrv_shm_pool_alloc - does not take 'alignment' input. The
>>> scalable scheduler data structures need cache line alignment.
>>
>>
>> These are prototypes at this point and if that's needed I'm sure it could
>> easily be added. Since drivers are typically dealing with page-aligned ring
>> buffers and such they would automatically be cache-aligned, so perhaps he
>> didn't see the need to call that out explicitly.
>>
>
> I find these APIs useful in allocating smaller chunks of shared memory
> (may be some more functionality can be added to these APIs). I will
> use them in the scalable scheduler for allocating shared memory for
> queues.

Since these are driver APIs they might not be available in all implementations.
IMO, we need to keep scalable scheduler implementation independent
from drv APIs.

Regards,
Bala
>
>>>
>>>
>>> Thanks,
>>> Honnappa
>>
>>