Re: [lng-odp] [PATCH v2 2/3] CHANGELOG: initial revision

2015-12-02 Thread Nicolas Morey-Chaisemartin


On 12/02/2015 04:58 PM, Mike Holmes wrote:
>
> On 2 December 2015 at 03:46, Nicolas Morey-Chaisemartin  > wrote:
>
> Wouldn't it make sense to also install the CHANGELOG (with the doc for 
> example) ?
>
>
> I dont know if installed apps usually copy the changelog, but I think it 
> would then go into /usr/share/doc/packagename/. [1] if we do that.
>
>
> https://www.debian.org/doc/manuals/maint-guide/dother.en.html
>
I'm not sure either but except if API changes are on top of the documentation, 
it's one of the documents users must review when they update to know what to 
look for and what to fix.
If it is not installed by ODP, they have to go look for the releases notes 
online or in git.

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


Re: [lng-odp] [PATCH v2 2/3] CHANGELOG: initial revision

2015-12-02 Thread Mike Holmes
On 2 December 2015 at 03:46, Nicolas Morey-Chaisemartin 
wrote:

> Wouldn't it make sense to also install the CHANGELOG (with the doc for
> example) ?
>

I dont know if installed apps usually copy the changelog, but I think it
would then go into /usr/share/doc/packagename/. [1] if we do that.


https://www.debian.org/doc/manuals/maint-guide/dother.en.html



>
> On 12/01/2015 08:27 PM, Mike Holmes wrote:
> > With the addition of an RPM package to the existing debian package we
> > need to have a single change log for the ODP API and the linux-generic
> > implementation.
> > The debian and RPM change logs then just list packaging changes.
> >
> > Create an initial copy of the old debian log.
> >
> > Signed-off-by: Mike Holmes 
> > Reviewed-by: Anders Roxell 
> > ---
> >  CHANGELOG   | 520
> 
> >  Makefile.am |   2 +-
> >  2 files changed, 521 insertions(+), 1 deletion(-)
> >  create mode 100644 CHANGELOG
> >
> > diff --git a/CHANGELOG b/CHANGELOG
> > new file mode 100644
> > index 000..cd8c387
> > --- /dev/null
> > +++ b/CHANGELOG
> > @@ -0,0 +1,520 @@
> > +opendataplane (1.4.1.0)
> > +   * Validation
> > +   - pktio: test transmit error recovery
> > +   - schedule: add chaos test
> > +   - check return code from odp_queue_lock_count()
> > +   - scheduler: test ordered queue reorder processing
> > +   - pktio: initialize queue parameters correctly
> > +   - pktio: test for transmit error handling
> > +   - pktio: add support for direct receive
> > +   - pktio: pass interface index rather than name
> > +   - pktio: fix start_stop test
> > +   - test: l2fwd: separate rx and tx drop counters
> > +   - test: l2fwd: increase burst size
> > +   - test: l2fwd: optimize statistics usage
> > +   - test: l2fwd: optimize queue mode
> > +   - test: l2fwd: start pktios after worker thread create
> > +   - test: l2fwd: added option to disable error check
> > +   - example/ipsec: Increase ip_data_len for Tunnel mode
> > +   - example: ipsec: check push_tail return code
> > +   * General:
> > +   - linux-generic: pktio: handle transmit errors correctly
> > +   - pktio socket_mmap: recover from transmit errors but 1890
> > +   - pktio: increase MTU of loop interface
> > +   - ordered queues: fix race condition during order release
> > + and out of order.
> > +   - configure: move HAVE_PCAP AM_CONDITIONAL to configure.ac
> > +   * ODP helper:
> > +   - linux: checkpatch cleaning for helper/linux.c
> > +   - linux: examine the cause for child process termination
> > +   - linux: request SIGTERM if parent process dies
> > +
> > +opendataplane (1.4.0.0)
> > +   * API:
> > +   - ** Classification **
> > +   - odp_cos_set_queue() renamed to odp_cos_queue_set()
> > +   - int odp_cos_set_drop renamed to odp_cos_drop_set()
> > +   - new: odp_queue_t odp_cos_queue(odp_cos_t cos_id)
> > +   - new: odp_drop_e odp_cos_drop(odp_cos_t cos_id)
> > +   - ODP_PMR_CUSTOM_FRAME support in classification
> > +   - odp_pmr_create() arguments passing change to use struct
> > +   - odp_pmr_match_set_create() added id argument
> > +   - ** Config **
> > +   - new: odp_config_...() API introduced instead of ODP_CONFIG_
> defines
> > +   - ** Cpu, Threads and Scheduler **
> > +   - new: uint64_t odp_cpu_cycles(void)
> > +   - new: uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2);
> > +   - new: uint64_t odp_cpu_cycles_max(void);
> > +   - new: uint64_t odp_cpu_cycles_resolution(void);
> > +   - odp_cpumask_def_worker() renamed to
> odp_cpumask_default_worker()
> > +   - odp_cpumask_def_control() renamed to
> odp_cpumask_default_control()
> > +   - odp init extended with num worker and control threads
> > +   - new: int odp_queue_lock_count(odp_queue_t queue);
> > +   - refine api doc for scheduler and schedule orderd locks
> > +   - argument of odp_schedule_order_lock() and
> odp_schedule_order_unlock changed to unsigned
> > +   - new: int odp_thread_count_max(void)
> > +   - ** Packet **
> > +   - new: uint32_t odp_packet_flow_hash(odp_packet_t pkt)
> > +   - new: void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t
> flow_hash)
> > +   - new: int odp_packet_has_flow_hash(odp_packet_t pkt);
> > +   - new: void odp_packet_has_flow_hash_clr(odp_packet_t pkt);
> > +   - ** Pktio **
> > +   - pktio can be configuread as receive or transmit only
> > +   - pktio: refined api doc for start() and stop()
> > +   - new: void odp_pktio_param_init(odp_pktio_param_t *param)
> > +   * ODP docs:
> > +   - implementers-guide: update names of test module libraries
> > +   - implementers-guide: update section on skipping tests
> > +   * Test framework
> > +   - update README files
> > +  

Re: [lng-odp] [PATCH v2 2/3] CHANGELOG: initial revision

2015-12-02 Thread Maxim Uvarov

On 12/02/2015 18:58, Mike Holmes wrote:


On 2 December 2015 at 03:46, Nicolas Morey-Chaisemartin 
> wrote:


Wouldn't it make sense to also install the CHANGELOG (with the doc
for example) ?


I dont know if installed apps usually copy the changelog, but I think 
it would then go into /usr/share/doc/packagename/. [1] if we do that.



https://www.debian.org/doc/manuals/maint-guide/dother.en.html



yes, that is plan. For 1.5 it was only in tar.gz. New patch needed to 
package it to some proper place.


Maxim.



On 12/01/2015 08:27 PM, Mike Holmes wrote:
> With the addition of an RPM package to the existing debian
package we
> need to have a single change log for the ODP API and the
linux-generic
> implementation.
> The debian and RPM change logs then just list packaging changes.
>
> Create an initial copy of the old debian log.
>
> Signed-off-by: Mike Holmes >
> Reviewed-by: Anders Roxell >
> ---
>  CHANGELOG   | 520

>  Makefile.am |   2 +-
>  2 files changed, 521 insertions(+), 1 deletion(-)
>  create mode 100644 CHANGELOG
>
> diff --git a/CHANGELOG b/CHANGELOG
> new file mode 100644
> index 000..cd8c387
> --- /dev/null
> +++ b/CHANGELOG
> @@ -0,0 +1,520 @@
> +opendataplane (1.4.1.0)
> +   * Validation
> +   - pktio: test transmit error recovery
> +   - schedule: add chaos test
> +   - check return code from odp_queue_lock_count()
> +   - scheduler: test ordered queue reorder processing
> +   - pktio: initialize queue parameters correctly
> +   - pktio: test for transmit error handling
> +   - pktio: add support for direct receive
> +   - pktio: pass interface index rather than name
> +   - pktio: fix start_stop test
> +   - test: l2fwd: separate rx and tx drop counters
> +   - test: l2fwd: increase burst size
> +   - test: l2fwd: optimize statistics usage
> +   - test: l2fwd: optimize queue mode
> +   - test: l2fwd: start pktios after worker thread create
> +   - test: l2fwd: added option to disable error check
> +   - example/ipsec: Increase ip_data_len for Tunnel mode
> +   - example: ipsec: check push_tail return code
> +   * General:
> +   - linux-generic: pktio: handle transmit errors correctly
> +   - pktio socket_mmap: recover from transmit errors but 1890
> +   - pktio: increase MTU of loop interface
> +   - ordered queues: fix race condition during order release
> + and out of order.
> +   - configure: move HAVE_PCAP AM_CONDITIONAL to
configure.ac 
> +   * ODP helper:
> +   - linux: checkpatch cleaning for helper/linux.c
> +   - linux: examine the cause for child process termination
> +   - linux: request SIGTERM if parent process dies
> +
> +opendataplane (1.4.0.0)
> +   * API:
> +   - ** Classification **
> +   - odp_cos_set_queue() renamed to odp_cos_queue_set()
> +   - int odp_cos_set_drop renamed to odp_cos_drop_set()
> +   - new: odp_queue_t odp_cos_queue(odp_cos_t cos_id)
> +   - new: odp_drop_e odp_cos_drop(odp_cos_t cos_id)
> +   - ODP_PMR_CUSTOM_FRAME support in classification
> +   - odp_pmr_create() arguments passing change to use struct
> +   - odp_pmr_match_set_create() added id argument
> +   - ** Config **
> +   - new: odp_config_...() API introduced instead of
ODP_CONFIG_ defines
> +   - ** Cpu, Threads and Scheduler **
> +   - new: uint64_t odp_cpu_cycles(void)
> +   - new: uint64_t odp_cpu_cycles_diff(uint64_t c1,
uint64_t c2);
> +   - new: uint64_t odp_cpu_cycles_max(void);
> +   - new: uint64_t odp_cpu_cycles_resolution(void);
> +   - odp_cpumask_def_worker() renamed to
odp_cpumask_default_worker()
> +   - odp_cpumask_def_control() renamed to
odp_cpumask_default_control()
> +   - odp init extended with num worker and control threads
> +   - new: int odp_queue_lock_count(odp_queue_t queue);
> +   - refine api doc for scheduler and schedule orderd locks
> +   - argument of odp_schedule_order_lock() and
odp_schedule_order_unlock changed to unsigned
> +   - new: int odp_thread_count_max(void)
> +   - ** Packet **
> +   - new: uint32_t odp_packet_flow_hash(odp_packet_t pkt)
> +   - new: void odp_packet_flow_hash_set(odp_packet_t pkt,
uint32_t flow_hash)
> +   - new: int odp_packet_has_flow_hash(odp_packet_t pkt);
> +   - new: void 

Re: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new wall time API

2015-12-02 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Ivan Khoronzhuk
> Sent: Tuesday, December 01, 2015 5:08 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new
> wall time API
> 
> The local time API supposes the time source is wall time.
> So correct linux-generic implementation.
> 
> Signed-off-by: Ivan Khoronzhuk 
> ---
>  platform/linux-generic/include/odp_internal.h |  2 +
>  platform/linux-generic/odp_schedule.c |  9 ++--
>  platform/linux-generic/odp_time.c | 61 +++---
> -
>  3 files changed, 48 insertions(+), 24 deletions(-)
> 
> diff --git a/platform/linux-generic/include/odp_internal.h
> b/platform/linux-generic/include/odp_internal.h
> index 74e48a9..50bf6c8 100644
> --- a/platform/linux-generic/include/odp_internal.h
> +++ b/platform/linux-generic/include/odp_internal.h
> @@ -79,6 +79,8 @@ int odp_schedule_term_local(void);
>  int odp_timer_init_global(void);
>  int odp_timer_disarm_all(void);
> 
> +int odp_time_local_init(void);
> +
>  int odp_tm_init_global(void);
> 
>  void _odp_flush_caches(void);
> diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-
> generic/odp_schedule.c
> index 96b3ac5..3017876 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -586,7 +586,7 @@ static int schedule_loop(odp_queue_t *out_queue,
> uint64_t wait,
>odp_event_t out_ev[],
>unsigned int max_num, unsigned int max_deq)
>  {
> - odp_time_t start_time, time, diff, wtime;
> + odp_time_t next, wtime;
>   int first = 1;
>   int ret;
> 
> @@ -604,15 +604,12 @@ static int schedule_loop(odp_queue_t *out_queue,
> uint64_t wait,
> 
>   if (first) {
>   wtime = odp_time_local_from_ns(wait);
> - start_time = odp_time_local();
> + next = odp_time_sum(odp_time_local(), wtime);
>   first = 0;
>   continue;
>   }
> 
> - time = odp_time_local();
> - diff = odp_time_diff(time, start_time);
> -
> - if (odp_time_cmp(wtime, diff) < 0)
> + if (odp_time_cmp(next, odp_time_local()) < 0)
>   break;
>   }
> 
> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
> generic/odp_time.c
> index b725086..1aae88c 100644
> --- a/platform/linux-generic/odp_time.c
> +++ b/platform/linux-generic/odp_time.c
> @@ -11,19 +11,21 @@
>  #include 
>  #include 
> 
> -odp_time_t odp_time_local(void)
> +static __thread struct timespec start_local;

Local time implementation does not have to be thread local. The time source is 
global, so there's no need to keep thread local start time. A global variable 
here would enable using the same implementation to global time.

Performance is also better when there only one copy of the start time (instead 
of N).


> +
> +static inline
> +uint64_t _odp_time_to_ns(odp_time_t val)

Static function and data (not visible outside of this file) does not need _odp 
prefix. It's cleaner to not prefix functions that are not intended to be used 
outside of this file.

>  {
> - int ret;
> - struct timespec time;
> + uint64_t ns;
> 
> - ret = clock_gettime(CLOCK_MONOTONIC_RAW, );
> - if (odp_unlikely(ret != 0))
> - ODP_ABORT("clock_gettime failed\n");
> + ns = val.tv_sec * ODP_TIME_SEC_IN_NS;
> + ns += val.tv_nsec;
> 
> - return time;
> + return ns;
>  }
> 
> -odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
> +static inline
> +odp_time_t _odp_time_diff(odp_time_t t2, odp_time_t t1)

Drop _odp prefix.


>  {
>   struct timespec time;
> 
> @@ -38,24 +40,36 @@ odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
>   return time;
>  }
> 
> -uint64_t odp_time_to_ns(odp_time_t time)
> +odp_time_t odp_time_local(void)
>  {
> - uint64_t ns;
> + int ret;
> + struct timespec time;
> +
> + ret = clock_gettime(CLOCK_MONOTONIC_RAW, );
> + if (odp_unlikely(ret != 0))
> + ODP_ABORT("clock_gettime failed\n");
> 
> - ns = time.tv_sec * ODP_TIME_SEC_IN_NS;
> - ns += time.tv_nsec;
> + return _odp_time_diff(time, start_local);
> +}
> 
> - return ns;
> +odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
> +{
> + return _odp_time_diff(t2, t1);
> +}
> +
> +uint64_t odp_time_to_ns(odp_time_t time)
> +{
> + return _odp_time_to_ns(time);
>  }
> 
>  odp_time_t odp_time_local_from_ns(uint64_t ns)
>  {
> - struct timespec time;
> + struct timespec val;
> 
> - time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
> - time.tv_nsec = ns % ODP_TIME_SEC_IN_NS;
> + val.tv_sec = ns / ODP_TIME_SEC_IN_NS;
> + val.tv_nsec = ns % ODP_TIME_SEC_IN_NS;

Not sure if compiler realizes that it can avoid modulo here and do:


Re: [lng-odp] [PATCH v2 2/3] CHANGELOG: initial revision

2015-12-02 Thread Nicolas Morey-Chaisemartin
Wouldn't it make sense to also install the CHANGELOG (with the doc for example) 
?

On 12/01/2015 08:27 PM, Mike Holmes wrote:
> With the addition of an RPM package to the existing debian package we
> need to have a single change log for the ODP API and the linux-generic
> implementation.
> The debian and RPM change logs then just list packaging changes.
>
> Create an initial copy of the old debian log.
>
> Signed-off-by: Mike Holmes 
> Reviewed-by: Anders Roxell 
> ---
>  CHANGELOG   | 520 
> 
>  Makefile.am |   2 +-
>  2 files changed, 521 insertions(+), 1 deletion(-)
>  create mode 100644 CHANGELOG
>
> diff --git a/CHANGELOG b/CHANGELOG
> new file mode 100644
> index 000..cd8c387
> --- /dev/null
> +++ b/CHANGELOG
> @@ -0,0 +1,520 @@
> +opendataplane (1.4.1.0)
> +   * Validation
> +   - pktio: test transmit error recovery
> +   - schedule: add chaos test
> +   - check return code from odp_queue_lock_count()
> +   - scheduler: test ordered queue reorder processing
> +   - pktio: initialize queue parameters correctly
> +   - pktio: test for transmit error handling
> +   - pktio: add support for direct receive
> +   - pktio: pass interface index rather than name
> +   - pktio: fix start_stop test
> +   - test: l2fwd: separate rx and tx drop counters
> +   - test: l2fwd: increase burst size
> +   - test: l2fwd: optimize statistics usage
> +   - test: l2fwd: optimize queue mode
> +   - test: l2fwd: start pktios after worker thread create
> +   - test: l2fwd: added option to disable error check
> +   - example/ipsec: Increase ip_data_len for Tunnel mode
> +   - example: ipsec: check push_tail return code
> +   * General:
> +   - linux-generic: pktio: handle transmit errors correctly
> +   - pktio socket_mmap: recover from transmit errors but 1890
> +   - pktio: increase MTU of loop interface
> +   - ordered queues: fix race condition during order release
> + and out of order.
> +   - configure: move HAVE_PCAP AM_CONDITIONAL to configure.ac
> +   * ODP helper:
> +   - linux: checkpatch cleaning for helper/linux.c
> +   - linux: examine the cause for child process termination
> +   - linux: request SIGTERM if parent process dies
> +
> +opendataplane (1.4.0.0)
> +   * API:
> +   - ** Classification **
> +   - odp_cos_set_queue() renamed to odp_cos_queue_set()
> +   - int odp_cos_set_drop renamed to odp_cos_drop_set()
> +   - new: odp_queue_t odp_cos_queue(odp_cos_t cos_id)
> +   - new: odp_drop_e odp_cos_drop(odp_cos_t cos_id)
> +   - ODP_PMR_CUSTOM_FRAME support in classification
> +   - odp_pmr_create() arguments passing change to use struct
> +   - odp_pmr_match_set_create() added id argument
> +   - ** Config **
> +   - new: odp_config_...() API introduced instead of ODP_CONFIG_ defines
> +   - ** Cpu, Threads and Scheduler **
> +   - new: uint64_t odp_cpu_cycles(void)
> +   - new: uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2);
> +   - new: uint64_t odp_cpu_cycles_max(void);
> +   - new: uint64_t odp_cpu_cycles_resolution(void);
> +   - odp_cpumask_def_worker() renamed to odp_cpumask_default_worker()
> +   - odp_cpumask_def_control() renamed to odp_cpumask_default_control()
> +   - odp init extended with num worker and control threads
> +   - new: int odp_queue_lock_count(odp_queue_t queue);
> +   - refine api doc for scheduler and schedule orderd locks
> +   - argument of odp_schedule_order_lock() and odp_schedule_order_unlock 
> changed to unsigned
> +   - new: int odp_thread_count_max(void)
> +   - ** Packet **
> +   - new: uint32_t odp_packet_flow_hash(odp_packet_t pkt)
> +   - new: void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t 
> flow_hash)
> +   - new: int odp_packet_has_flow_hash(odp_packet_t pkt);
> +   - new: void odp_packet_has_flow_hash_clr(odp_packet_t pkt);
> +   - ** Pktio **
> +   - pktio can be configuread as receive or transmit only
> +   - pktio: refined api doc for start() and stop()
> +   - new: void odp_pktio_param_init(odp_pktio_param_t *param)
> +   * ODP docs:
> +   - implementers-guide: update names of test module libraries
> +   - implementers-guide: update section on skipping tests
> +   * Test framework
> +   - update README files
> +   - renaming module libs
> +   - add odp_cunit_update() to modify registered tests
> +   - add ability to mark tests inactive
> +   * Validation
> +   - ** Classification **
> +   - Add fix for classification tests
> +   - remove redundant pool lookup function
> +   - remove redundant sequence number check
> +   - use tcp data offset field to calculate data offset
> +   - move destroy_inq() to common file
> +   - add odp_pktio_param_init() 

[lng-odp] [API-NEXT PATCH] linux-generic: tm: use odp_hash_crc32c() api to avoid arch issues

2015-12-02 Thread Bill Fischofer
Change the internal hash_name_and_kind() function to eliminate the use
of architecture-specific hash instructions. This eliminates build issues
surrounding ARM variants. Future optimizations will use the arch directory
consistent with other ODP modules.

Signed-off-by: Bill Fischofer 
---
 platform/linux-generic/odp_name_table.c | 182 +---
 1 file changed, 1 insertion(+), 181 deletions(-)

diff --git a/platform/linux-generic/odp_name_table.c 
b/platform/linux-generic/odp_name_table.c
index 10a760e..610f034 100644
--- a/platform/linux-generic/odp_name_table.c
+++ b/platform/linux-generic/odp_name_table.c
@@ -48,140 +48,6 @@
 
 #define SECONDARY_HASH_HISTO_PRINT  1
 
- /* #define USE_AES */
-
-#if defined __x86_64__ || defined __i386__
-
-#ifdef USE_AES
-
-typedef long long int v2di __attribute__((vector_size(16)));
-
-static const v2di HASH_CONST1 = { 0x123456, 0xFEBCDA383   };
-static const v2di HASH_CONST2 = { 0x493BA3F689, 0x102F5D73A8C };
-
-#define PLATFORM_HASH_STATE v2di
-
-#define PLATFORM_HASH32_INIT(hash_state, name_len)  \
-   ({  \
-   hash_state = HASH_CONST1;   \
-   hash_state[0] ^= name_len;  \
-   })
-
-#define PLATFORM_HASH32(hash_state, name_word) \
-   ({ \
-   v2di data; \
-  \
-   data[0]= name_word;\
-   data[1]= name_word << 1;\
-   hash_state = __builtin_ia32_aesenc128(hash_state, data); \
-   })
-
-#define PLATFORM_HASH32_FINISH(hash_state, kind)\
-   ({  \
-   uint64_t result;\
-   v2di data;  \
-   \
-   data[0]= name_kind; \
-   data[1]= name_kind << 7;\
-   hash_state = __builtin_ia32_aesenc128(hash_state, data); \
-   hash_state = __builtin_ia32_aesenc128(hash_state,   \
- HASH_CONST2); \
-   hash_state = __builtin_ia32_aesenc128(hash_state,   \
- HASH_CONST1); \
-   result = (uint64_t)hash_state[0] ^ hash_state[1];   \
-   result = result ^ result >> 32; \
-   (uint32_t)result;   \
-   })
-
-#else
-
-#define PLATFORM_HASH_STATE uint64_t
-
-#define PLATFORM_HASH32_INIT(hash_state, name_len)\
-   ({\
-   hash_state  = (uint64_t)name_len; \
-   hash_state |= hash_state << 8;\
-   hash_state |= hash_state << 16;   \
-   hash_state |= hash_state << 32;   \
-   })
-
-#define PLATFORM_HASH32(hash_state, name_word)  \
-   ({  \
-   uint64_t temp;  \
-   \
-   temp= ((uint64_t)name_word) * 0xFEFDFCF5;   \
-   hash_state  = hash_state * 0xFF;\
-   hash_state ^= temp ^ (uint64_t)name_word;   \
-   })
-
-#define PLATFORM_HASH32_FINISH(hash_state, kind)\
-   ({  \
-   hash_state ^= (((uint32_t)kind) << 13); \
-   hash_state  = hash_state * 0xFEFDFCF5;  \
-   hash_state  = hash_state ^ hash_state >> 32;\
-   hash_state  = hash_state % 0xFEEDDCCBBAA1;  \
-   hash_state  = hash_state ^ hash_state >> 32;\
-   (uint32_t)hash_state;   \
-   })
-
-#endif
-
-#elif defined(__tile_gx__)
-
-#define PLATFORM_HASH_STATE  uint32_t
-
-#define PLATFORM_HASH32_INIT(hash_state, name_len)  \
-   ({  \
-   hash_state = 0xFEFDFCF5;   \
-   hash_state = __insn_crc_32_32(hash_state, name_len);   \
-   })
-
-#define PLATFORM_HASH32(hash_state, name_word)  \
-   ({ \
-   hash_state = __insn_crc_32_32(hash_state, 

Re: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new wall time API

2015-12-02 Thread Ivan Khoronzhuk



On 02.12.15 10:20, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
Ivan Khoronzhuk
Sent: Tuesday, December 01, 2015 5:08 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new
wall time API

The local time API supposes the time source is wall time.
So correct linux-generic implementation.

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/include/odp_internal.h |  2 +
  platform/linux-generic/odp_schedule.c |  9 ++--
  platform/linux-generic/odp_time.c | 61 +++---
-
  3 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h
b/platform/linux-generic/include/odp_internal.h
index 74e48a9..50bf6c8 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -79,6 +79,8 @@ int odp_schedule_term_local(void);
  int odp_timer_init_global(void);
  int odp_timer_disarm_all(void);

+int odp_time_local_init(void);
+
  int odp_tm_init_global(void);

  void _odp_flush_caches(void);
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-
generic/odp_schedule.c
index 96b3ac5..3017876 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -586,7 +586,7 @@ static int schedule_loop(odp_queue_t *out_queue,
uint64_t wait,
 odp_event_t out_ev[],
 unsigned int max_num, unsigned int max_deq)
  {
-   odp_time_t start_time, time, diff, wtime;
+   odp_time_t next, wtime;
int first = 1;
int ret;

@@ -604,15 +604,12 @@ static int schedule_loop(odp_queue_t *out_queue,
uint64_t wait,

if (first) {
wtime = odp_time_local_from_ns(wait);
-   start_time = odp_time_local();
+   next = odp_time_sum(odp_time_local(), wtime);
first = 0;
continue;
}

-   time = odp_time_local();
-   diff = odp_time_diff(time, start_time);
-
-   if (odp_time_cmp(wtime, diff) < 0)
+   if (odp_time_cmp(next, odp_time_local()) < 0)
break;
}

diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
generic/odp_time.c
index b725086..1aae88c 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,19 +11,21 @@
  #include 
  #include 

-odp_time_t odp_time_local(void)
+static __thread struct timespec start_local;


Local time implementation does not have to be thread local. The time source is 
global, so there's no need to keep thread local start time. A global variable 
here would enable using the same implementation to global time.

Performance is also better when there only one copy of the start time (instead 
of N).


Time is local for each thread.
It's wall time, that means it starts count from beginning a thread is started.
So keep the same approach for all threads not depending on implementation and 
current CPU.
Here source is global, but it has start from 0 for each thread. On other 
implementations it
can have different time sources anyway. With this approach application has 
ability to get time
how much thread is started.





+
+static inline
+uint64_t _odp_time_to_ns(odp_time_t val)


Static function and data (not visible outside of this file) does not need _odp 
prefix. It's cleaner to not prefix functions that are not intended to be used 
outside of this file.


  {
-   int ret;
-   struct timespec time;
+   uint64_t ns;

-   ret = clock_gettime(CLOCK_MONOTONIC_RAW, );
-   if (odp_unlikely(ret != 0))
-   ODP_ABORT("clock_gettime failed\n");
+   ns = val.tv_sec * ODP_TIME_SEC_IN_NS;
+   ns += val.tv_nsec;

-   return time;
+   return ns;
  }

-odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
+static inline
+odp_time_t _odp_time_diff(odp_time_t t2, odp_time_t t1)


Drop _odp prefix.

Ok.





  {
struct timespec time;

@@ -38,24 +40,36 @@ odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
return time;
  }

-uint64_t odp_time_to_ns(odp_time_t time)
+odp_time_t odp_time_local(void)
  {
-   uint64_t ns;
+   int ret;
+   struct timespec time;
+
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, );
+   if (odp_unlikely(ret != 0))
+   ODP_ABORT("clock_gettime failed\n");

-   ns = time.tv_sec * ODP_TIME_SEC_IN_NS;
-   ns += time.tv_nsec;
+   return _odp_time_diff(time, start_local);
+}

-   return ns;
+odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
+{
+   return _odp_time_diff(t2, t1);
+}
+
+uint64_t odp_time_to_ns(odp_time_t time)
+{
+   return _odp_time_to_ns(time);
  }

  odp_time_t 

Re: [lng-odp] [PATCH] example: timer: free resources while termination

2015-12-02 Thread Ivan Khoronzhuk

ping

On 19.11.15 12:54, Ivan Khoronzhuk wrote:

Example should free resources in right order when terminates.
Also it should have correct error path.

Signed-off-by: Ivan Khoronzhuk 
---
  example/timer/odp_timer_test.c | 46 ++
  1 file changed, 38 insertions(+), 8 deletions(-)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 94619e4..2d74e4c 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -331,18 +331,21 @@ int main(int argc, char *argv[])
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
odp_shm_t shm;
test_globals_t  *gbls;
+   int err = 0;

printf("\nODP timer example starts\n");

if (odp_init_global(NULL, NULL)) {
+   err = 1;
printf("ODP global init failed.\n");
-   return -1;
+   goto err;
}

/* Init this thread. */
if (odp_init_local(ODP_THREAD_CONTROL)) {
+   err = 1;
printf("ODP local init failed.\n");
-   return -1;
+   goto err_global;
}

printf("\n");
@@ -360,14 +363,16 @@ int main(int argc, char *argv[])
shm = odp_shm_reserve("shm_test_globals", sizeof(test_globals_t),
  ODP_CACHE_LINE_SIZE, 0);
if (ODP_SHM_INVALID == shm) {
+   err = 1;
EXAMPLE_ERR("Error: shared mem reserve failed.\n");
-   return -1;
+   goto err_local;
}

gbls = odp_shm_addr(shm);
if (NULL == gbls) {
+   err = 1;
EXAMPLE_ERR("Error: shared mem alloc failed.\n");
-   return -1;
+   goto err_shm;
}
memset(gbls, 0, sizeof(test_globals_t));

@@ -404,8 +409,9 @@ int main(int argc, char *argv[])
gbls->pool = odp_pool_create("msg_pool", );

if (gbls->pool == ODP_POOL_INVALID) {
+   err = 1;
EXAMPLE_ERR("Pool create failed.\n");
-   return -1;
+   goto err_shm;
}

tparams.res_ns = gbls->args.resolution_us*ODP_TIME_USEC;
@@ -416,8 +422,9 @@ int main(int argc, char *argv[])
tparams.clk_src = ODP_CLOCK_CPU;
gbls->tp = odp_timer_pool_create("timer_pool", );
if (gbls->tp == ODP_TIMER_POOL_INVALID) {
+   err = 1;
EXAMPLE_ERR("Timer pool create failed.\n");
-   return -1;
+   goto err_msg_pool;
}
odp_timer_pool_start();

@@ -442,8 +449,9 @@ int main(int argc, char *argv[])
queue = odp_queue_create("timer_queue", ODP_QUEUE_TYPE_SCHED, );

if (queue == ODP_QUEUE_INVALID) {
+   err = 1;
EXAMPLE_ERR("Timer queue create failed.\n");
-   return -1;
+   goto err_timer_pool;
}

printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
@@ -481,7 +489,29 @@ int main(int argc, char *argv[])
/* Wait for worker threads to exit */
odph_linux_pthread_join(thread_tbl, num_workers);

-   printf("ODP timer test complete\n\n");
+   /* free resources */
+   if (odp_queue_destroy(queue))
+   err = 1;
+err_timer_pool:
+   odp_timer_pool_destroy(gbls->tp);
+err_msg_pool:
+   if (odp_pool_destroy(gbls->pool))
+   err = 1;
+err_shm:
+   if (odp_shm_free(shm))
+   err = 1;
+err_local:
+   if (odp_term_local())
+   err = 1;
+err_global:
+   if (odp_term_global())
+   err = 1;
+err:
+   if (err) {
+   printf("Err: ODP timer test failed\n\n");
+   return -1;
+   }

+   printf("ODP timer test complete\n\n");
return 0;
  }



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


Re: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new wall time API

2015-12-02 Thread Savolainen, Petri (Nokia - FI/Espoo)
> >>
> >> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
> >> generic/odp_time.c
> >> index b725086..1aae88c 100644
> >> --- a/platform/linux-generic/odp_time.c
> >> +++ b/platform/linux-generic/odp_time.c
> >> @@ -11,19 +11,21 @@
> >>   #include 
> >>   #include 
> >>
> >> -odp_time_t odp_time_local(void)
> >> +static __thread struct timespec start_local;
> >
> > Local time implementation does not have to be thread local. The time
> source is global, so there's no need to keep thread local start time. A
> global variable here would enable using the same implementation to global
> time.
> >
> > Performance is also better when there only one copy of the start time
> (instead of N).
> 
> Time is local for each thread.
> It's wall time, that means it starts count from beginning a thread is
> started.
> So keep the same approach for all threads not depending on implementation
> and current CPU.
> Here source is global, but it has start from 0 for each thread. On other
> implementations it
> can have different time sources anyway. With this approach application has
> ability to get time
> how much thread is started.


"...initialized to zero during ODP startup...", means that it's initialized to 
zero at some point in ODP instance startup (after global_init()). Local time 
does not explicitly measure thread life time. It's specified like this just for 
the reason that global time source can be used directly for local time also.

Thread local copy just adds complexity here, when the time source is not truly 
local.


-Petri


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


Re: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new wall time API

2015-12-02 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
> Sent: Wednesday, December 02, 2015 1:56 PM
> To: Savolainen, Petri (Nokia - FI/Espoo); LNG ODP Mailman List
> Subject: Re: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with
> new wall time API
> 
> 
> 
> On 02.12.15 13:39, Ivan Khoronzhuk wrote:
> >
> >
> > On 02.12.15 13:21, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >
> > diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
> > generic/odp_time.c
> > index b725086..1aae88c 100644
> > --- a/platform/linux-generic/odp_time.c
> > +++ b/platform/linux-generic/odp_time.c
> > @@ -11,19 +11,21 @@
> >#include 
> >#include 
> >
> > -odp_time_t odp_time_local(void)
> > +static __thread struct timespec start_local;
> 
>  Local time implementation does not have to be thread local. The time
> >>> source is global, so there's no need to keep thread local start time.
> A
> >>> global variable here would enable using the same implementation to
> global
> >>> time.
> 
>  Performance is also better when there only one copy of the start time
> >>> (instead of N).
> >>>
> >>> Time is local for each thread.
> >>> It's wall time, that means it starts count from beginning a thread is
> >>> started.
> >>> So keep the same approach for all threads not depending on
> implementation
> >>> and current CPU.
> >>> Here source is global, but it has start from 0 for each thread. On
> other
> >>> implementations it
> >>> can have different time sources anyway. With this approach application
> has
> >>> ability to get time
> >>> how much thread is started.
> >>
> >>
> >> "...initialized to zero during ODP startup...", means that it's
> initialized to zero at some point in ODP instance startup (after
> global_init()).
> > Oh, really?
> >
> > Initialized to zero during ODP startup is only for global time.
> > For local time it's initialized to zero at local init, it is convenient.
> >
> >> Local time does not explicitly measure thread life time.
> > Not. But it is useful feature for thread itself.
> >
> >> It's specified like this just for the reason that global time source
> can be used directly
> > Adding local time startup doesn't prevent global time source usage.
> >
> >> for local time also. Thread local copy just adds complexity here, when
> the time source is not truly local.
> > Any way it requires to extract start time.
> > This var is local for each thread. No sharing.
> 
> IMHO, it should be corrected on "...initialized to zero during
> local_init()". Complexity is ridiculous.


Both local and global timestamp calls can directly return a global HW counter 
value (zeroed at ODP init) when it's defined like this.

If user really needs thread life time, we can add odp_thread_life_time() API 
call for that.


-Petri

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


Re: [lng-odp] [API-NEXT PATCH v2] helper: add cuckoo hash implementation

2015-12-02 Thread HePeng

> 在 2015年12月2日,下午5:30,Maxim Uvarov  写道:
> 
> On 12/02/2015 10:26, HePeng wrote:
>>> 在 2015年11月30日,下午11:04,Maxim Uvarov  写道:
>>> 
>>> On 11/30/2015 11:18, HePeng wrote:
 Hi, Maxim,
 How is everything going, about the ring?
>>> 
>>> Hello Peng,
>>> 
>>> We need to take a look it it's possible to rewrite your hash implementation 
>>> to odp queues api instead of odp ring.
>>> That will allow to use hw queues accelerators for hash.
>>> 
>>> Maxim.
>> Hi Maxim,
>>  
>>  The ring structure in cuckoo hash is just a buffer storing the “key” 
>> address.
>> 
>>  The hash table stores all the keys. In this implementation,  it is the 
>> hash table itself which maintains the memory of all the keys.
>> When add a new key, the hash table will firstly allocate an“index” of the 
>> key using the ring, and when delete a key, the
>> hash table will recycle the “index” of the key into the ring. All in all, 
>> this ring is like a free slots buffer storing all the free indexes.
>> 
>>  In my opinion, (while I did not do this in hardware), the ring is not a 
>> critical data structure in the scenario of hash table matching,
>> because only when table update happens,  the hash table will need to use the 
>> ring. Unless you use the hash table in a write-heavy
>> scenario, and this hardware queue can help you to ease the lock contention 
>> in multi-core.
>> 
>>  So my opinion is that, 1) yes, we can use the queue to replace the 
>> ring, as long as the queue can be large enough to hold
>> all the hash entries. 2) But I do not think it is a critical optimization.
> On the latest Tuesday call we have long discussion about that.  And the final 
> agreement was that cuckoo has is needed but it needs to
> use native odp interface. I.e. use of odp_queue instead of helper odph_ring. 
> The other deal is how that odp_queue is implemented.
> If needed we can extend current implementation of odp_queue or add some 
> parameter to api. I.e. if needed we can put ring code
> inside implementation and make external interface as odp_queue.  In that case 
> platform which can work with queues in hardware
> can accelerate it as other poll queues, other platform will have it in 
> software. You might seen that interface of the ring and
> queue is about the same, i.e. it puts and gets patches to object. So it might 
> be not so hard to rewrite code to current queues api,
> but in that form odp community will be happy to accept that patch. If there 
> will be some performance degradation, than we can work
> on queues implementation and fix it.
> 
> So plan is:
> 1) have this code with queues api;
> 2) remove ring code completely from helper
> 3) move ring code inside linux-generic (I will reuse it for shm pktio ipc);
> 4) test performance of cuckoo hash
> 5) move it to odp hash API when it will be ready (to do that code should not 
> use other helper code, just native odp apis).
Glad to see this. I will begin to shape the code using odp_queue API. 



> 
> Best regards,
> Maxim.

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


Re: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new wall time API

2015-12-02 Thread Ivan Khoronzhuk



On 02.12.15 13:39, Ivan Khoronzhuk wrote:



On 02.12.15 13:21, Savolainen, Petri (Nokia - FI/Espoo) wrote:


diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
generic/odp_time.c
index b725086..1aae88c 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,19 +11,21 @@
   #include 
   #include 

-odp_time_t odp_time_local(void)
+static __thread struct timespec start_local;


Local time implementation does not have to be thread local. The time

source is global, so there's no need to keep thread local start time. A
global variable here would enable using the same implementation to global
time.


Performance is also better when there only one copy of the start time

(instead of N).

Time is local for each thread.
It's wall time, that means it starts count from beginning a thread is
started.
So keep the same approach for all threads not depending on implementation
and current CPU.
Here source is global, but it has start from 0 for each thread. On other
implementations it
can have different time sources anyway. With this approach application has
ability to get time
how much thread is started.



"...initialized to zero during ODP startup...", means that it's initialized to 
zero at some point in ODP instance startup (after global_init()).

Oh, really?

Initialized to zero during ODP startup is only for global time.
For local time it's initialized to zero at local init, it is convenient.


Local time does not explicitly measure thread life time.

Not. But it is useful feature for thread itself.


It's specified like this just for the reason that global time source can be 
used directly

Adding local time startup doesn't prevent global time source usage.


for local time also. Thread local copy just adds complexity here, when the time 
source is not truly local.

Any way it requires to extract start time.
This var is local for each thread. No sharing.


IMHO, it should be corrected on "...initialized to zero during local_init()". 
Complexity is ridiculous.






-Petri






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


[lng-odp] [PATCH] validation: queue: refactor test to avoid coverity issues

2015-12-02 Thread Bill Fischofer
Change CU_ASSERT order to avoid side effect issues identified by Coverity

Signed-off-by: Bill Fischofer 
---
 test/validation/queue/queue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
index 3b522c9..3c1c64a 100644
--- a/test/validation/queue/queue.c
+++ b/test/validation/queue/queue.c
@@ -173,7 +173,8 @@ void queue_test_info(void)
CU_ASSERT(info.param.sched.prio == odp_queue_sched_prio(q_order));
CU_ASSERT(info.param.sched.sync == odp_queue_sched_type(q_order));
CU_ASSERT(info.param.sched.group == odp_queue_sched_group(q_order));
-   CU_ASSERT(ret = odp_queue_lock_count(q_order) >= 0);
+   ret = odp_queue_lock_count(q_order);
+   CU_ASSERT(ret >= 0);
lock_count = (unsigned) ret;
CU_ASSERT(info.param.sched.lock_count == lock_count);
 
-- 
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 v5 7/9] linux-generic: align with new wall time API

2015-12-02 Thread Ivan Khoronzhuk



On 02.12.15 14:07, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Wednesday, December 02, 2015 1:56 PM
To: Savolainen, Petri (Nokia - FI/Espoo); LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with
new wall time API



On 02.12.15 13:39, Ivan Khoronzhuk wrote:



On 02.12.15 13:21, Savolainen, Petri (Nokia - FI/Espoo) wrote:


diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
generic/odp_time.c
index b725086..1aae88c 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,19 +11,21 @@
#include 
#include 

-odp_time_t odp_time_local(void)
+static __thread struct timespec start_local;


Local time implementation does not have to be thread local. The time

source is global, so there's no need to keep thread local start time.

A

global variable here would enable using the same implementation to

global

time.


Performance is also better when there only one copy of the start time

(instead of N).

Time is local for each thread.
It's wall time, that means it starts count from beginning a thread is
started.
So keep the same approach for all threads not depending on

implementation

and current CPU.
Here source is global, but it has start from 0 for each thread. On

other

implementations it
can have different time sources anyway. With this approach application

has

ability to get time
how much thread is started.



"...initialized to zero during ODP startup...", means that it's

initialized to zero at some point in ODP instance startup (after
global_init()).

Oh, really?

Initialized to zero during ODP startup is only for global time.
For local time it's initialized to zero at local init, it is convenient.


Local time does not explicitly measure thread life time.

Not. But it is useful feature for thread itself.


It's specified like this just for the reason that global time source

can be used directly

Adding local time startup doesn't prevent global time source usage.


for local time also. Thread local copy just adds complexity here, when

the time source is not truly local.

Any way it requires to extract start time.
This var is local for each thread. No sharing.


IMHO, it should be corrected on "...initialized to zero during
local_init()". Complexity is ridiculous.



Both local and global timestamp calls can directly return a global HW counter 
value (zeroed at ODP init) when it's defined like this.

If user really needs thread life time, we can add odp_thread_life_time() API 
call for that.



But we can keep it in sync with word "local", any global actions tout local to 
global time.
And no need in additional API calls.



-Petri



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


[lng-odp] [PATCHv2 1/3] validation: pktio: initialize mac addresses for all packets

2015-12-02 Thread Ilya Maximets
For the purpose of testing of real-world interfaces the packet's
content should be valid or kernel will throw them away.

Signed-off-by: Ilya Maximets 
---
 test/validation/pktio/pktio.c | 46 ---
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 146e741..b0deac7 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -86,16 +86,16 @@ static void set_pool_len(odp_pool_param_t *params)
 }
 
 static void pktio_pkt_set_macs(odp_packet_t pkt,
-  pktio_info_t *src, pktio_info_t *dst)
+  odp_pktio_t src, odp_pktio_t dst)
 {
uint32_t len;
odph_ethhdr_t *eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, );
int ret;
 
-   ret = odp_pktio_mac_addr(src->id, >src, sizeof(eth->src));
+   ret = odp_pktio_mac_addr(src, >src, sizeof(eth->src));
CU_ASSERT(ret == ODPH_ETHADDR_LEN);
 
-   ret = odp_pktio_mac_addr(dst->id, >dst, sizeof(eth->dst));
+   ret = odp_pktio_mac_addr(dst, >dst, sizeof(eth->dst));
CU_ASSERT(ret == ODPH_ETHADDR_LEN);
 }
 
@@ -410,12 +410,16 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, 
pktio_info_t *pktio_b,
break;
 
tx_seq[i] = pktio_init_packet(tx_pkt[i]);
-   if (tx_seq[i] == TEST_SEQ_INVALID)
+   if (tx_seq[i] == TEST_SEQ_INVALID) {
+   odp_packet_free(tx_pkt[i]);
break;
+   }
 
-   pktio_pkt_set_macs(tx_pkt[i], pktio_a, pktio_b);
-   if (pktio_fixup_checksums(tx_pkt[i]) != 0)
+   pktio_pkt_set_macs(tx_pkt[i], pktio_a->id, pktio_b->id);
+   if (pktio_fixup_checksums(tx_pkt[i]) != 0) {
+   odp_packet_free(tx_pkt[i]);
break;
+   }
 
tx_ev[i] = odp_packet_to_event(tx_pkt[i]);
}
@@ -724,6 +728,13 @@ static void pktio_test_start_stop(void)
if (pkt == ODP_PACKET_INVALID)
break;
pktio_init_packet(pkt);
+
+   pktio_pkt_set_macs(pkt, pktio[0], pktio[1]);
+   if (pktio_fixup_checksums(pkt) != 0) {
+   odp_packet_free(pkt);
+   break;
+   }
+
tx_ev[alloc] = odp_packet_to_event(pkt);
}
 
@@ -775,6 +786,13 @@ static void pktio_test_start_stop(void)
if (pkt == ODP_PACKET_INVALID)
break;
pktio_init_packet(pkt);
+   if (num_ifaces > 1) {
+   pktio_pkt_set_macs(pkt, pktio[0], pktio[1]);
+   if (pktio_fixup_checksums(pkt) != 0) {
+   odp_packet_free(pkt);
+   break;
+   }
+   }
tx_ev[alloc] = odp_packet_to_event(pkt);
}
 
@@ -896,8 +914,17 @@ static void pktio_test_send_failure(void)
break;
 
pkt_seq[i] = pktio_init_packet(pkt_tbl[i]);
-   if (pkt_seq[i] == TEST_SEQ_INVALID)
+
+   pktio_pkt_set_macs(pkt_tbl[i], pktio_tx, pktio_rx);
+   if (pktio_fixup_checksums(pkt_tbl[i]) != 0) {
+   odp_packet_free(pkt_tbl[i]);
+   break;
+   }
+
+   if (pkt_seq[i] == TEST_SEQ_INVALID) {
+   odp_packet_free(pkt_tbl[i]);
break;
+   }
}
alloc_pkts = i;
 
@@ -941,6 +968,11 @@ static void pktio_test_send_failure(void)
 odp_packet_len(pkt_tbl[i]) -
 PKT_LEN_NORMAL);
pkt_seq[i] = pktio_init_packet(pkt_tbl[i]);
+
+   pktio_pkt_set_macs(pkt_tbl[i], pktio_tx, pktio_rx);
+   ret = pktio_fixup_checksums(pkt_tbl[i]);
+   CU_ASSERT_FATAL(ret == 0);
+
CU_ASSERT_FATAL(pkt_seq[i] != TEST_SEQ_INVALID);
ret = odp_pktio_send(pktio_tx, _tbl[i], TX_BATCH_LEN - i);
CU_ASSERT_FATAL(ret == (TX_BATCH_LEN - i));
-- 
2.1.4

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


[lng-odp] [PATCHv2 0/3] TAP pktio

2015-12-02 Thread Ilya Maximets
Creates a new pktio type that allows for creating and
sending/receiving packets through TAP interface.
Detailed description in commit-message of patch
"[PATCHv2 2/3] linux-generic: pktio: add tap pktio type".

Changelog:

Version 2:
* Validation tests added
* Pktio tests fixed to work with real-world
  interfaces.
* MAC of pktio now is not a kernel interface's MAC
* Interfaces are UP after pktio_open()
* Fixed getting mtu, getting/setting promisc mode
* Misclenious fixes

Ilya Maximets (3):
  validation: pktio: initialize mac addresses for all packets
  linux-generic: pktio: add tap pktio type
  linux-generic: pktio: add test for tap pktio

 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |   3 +
 platform/linux-generic/include/odp_packet_tap.h|  21 ++
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/tap.c | 317 +
 platform/linux-generic/test/Makefile.am|   1 +
 platform/linux-generic/test/pktio/Makefile.am  |   3 +-
 platform/linux-generic/test/pktio/pktio_run_tap| 111 
 test/validation/pktio/pktio.c  |  46 ++-
 9 files changed, 497 insertions(+), 8 deletions(-)
 create mode 100644 platform/linux-generic/include/odp_packet_tap.h
 create mode 100644 platform/linux-generic/pktio/tap.c
 create mode 100755 platform/linux-generic/test/pktio/pktio_run_tap

-- 
2.1.4

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


[lng-odp] [PATCHv2 2/3] linux-generic: pktio: add tap pktio type

2015-12-02 Thread Ilya Maximets
Creates a new pktio type that allows for creating and
sending/receiving packets through TAP interface.
It is intended for use as a simple conventional communication
method between applications that use kernel network stack
(ping, ssh, iperf, etc.) and ODP applications for the purpose
of functional testing and can be used as it is with some
of the existing example applications.

To use this interface the name passed to odp_pktio_open() must
begin with "tap:" and be in the format:

 tap:iface

   iface   the name of TAP device to be created.

TUN/TAP kernel module should be loaded to use this pktio.
There should be no device named 'iface' in the system.
The total length of the 'iface' is limited by IF_NAMESIZE.

Signed-off-by: Ilya Maximets 
---
 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |   3 +
 platform/linux-generic/include/odp_packet_tap.h|  21 ++
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/tap.c | 317 +
 5 files changed, 344 insertions(+)
 create mode 100644 platform/linux-generic/include/odp_packet_tap.h
 create mode 100644 platform/linux-generic/pktio/tap.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 70bd8fe..4639ebc 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -92,6 +92,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_packet_io_queue.h \
  ${srcdir}/include/odp_packet_netmap.h \
  ${srcdir}/include/odp_packet_socket.h \
+ ${srcdir}/include/odp_packet_tap.h \
  ${srcdir}/include/odp_pool_internal.h \
  ${srcdir}/include/odp_queue_internal.h \
  ${srcdir}/include/odp_schedule_internal.h \
@@ -120,6 +121,7 @@ __LIB__libodp_la_SOURCES = \
   pktio/netmap.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
+  pktio/tap.c \
   odp_pool.c \
   odp_queue.c \
   odp_rwlock.c \
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 1a1118c..de29557 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -22,6 +22,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,6 +79,7 @@ struct pktio_entry {
 #ifdef HAVE_PCAP
pkt_pcap_t pkt_pcap;/**< Using pcap for IO */
 #endif
+   pkt_tap_t pkt_tap;  /**< using TAP for IO */
};
enum {
STATE_START = 0,
@@ -157,6 +159,7 @@ extern const pktio_if_ops_t loopback_pktio_ops;
 #ifdef HAVE_PCAP
 extern const pktio_if_ops_t pcap_pktio_ops;
 #endif
+extern const pktio_if_ops_t tap_pktio_ops;
 extern const pktio_if_ops_t * const pktio_if_ops[];
 
 #ifdef __cplusplus
diff --git a/platform/linux-generic/include/odp_packet_tap.h 
b/platform/linux-generic/include/odp_packet_tap.h
new file mode 100644
index 000..7877586
--- /dev/null
+++ b/platform/linux-generic/include/odp_packet_tap.h
@@ -0,0 +1,21 @@
+/* Copyright (c) 2015, Ilya Maximets 
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PACKET_TAP_H_
+#define ODP_PACKET_TAP_H_
+
+#include 
+
+typedef struct {
+   int fd; /**< file descriptor for tap interface*/
+   int skfd;   /**< socket descriptor */
+   uint32_t mtu;   /**< cached mtu */
+   unsigned char if_mac[ETH_ALEN]; /**< MAC address of pktio side (not a
+MAC address of kernel interface)*/
+   odp_pool_t pool;/**< pool to alloc packets from */
+} pkt_tap_t;
+
+#endif
diff --git a/platform/linux-generic/pktio/io_ops.c 
b/platform/linux-generic/pktio/io_ops.c
index 3b344e6..1933abc 100644
--- a/platform/linux-generic/pktio/io_ops.c
+++ b/platform/linux-generic/pktio/io_ops.c
@@ -18,6 +18,7 @@ const pktio_if_ops_t * const pktio_if_ops[]  = {
 #ifdef HAVE_PCAP
_pktio_ops,
 #endif
+   _pktio_ops,
_mmap_pktio_ops,
_mmsg_pktio_ops,
NULL
diff --git a/platform/linux-generic/pktio/tap.c 
b/platform/linux-generic/pktio/tap.c
new file mode 100644
index 000..b11e64f
--- /dev/null
+++ b/platform/linux-generic/pktio/tap.c
@@ -0,0 +1,317 @@
+/* Copyright (c) 2015, Ilya Maximets 
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * TAP pktio type
+ *
+ * This file provides a pktio interface that allows for creating and
+ * send/receive 

[lng-odp] [PATCHv2 3/3] linux-generic: pktio: add test for tap pktio

2015-12-02 Thread Ilya Maximets
Signed-off-by: Ilya Maximets 
---
 platform/linux-generic/test/Makefile.am |   1 +
 platform/linux-generic/test/pktio/Makefile.am   |   3 +-
 platform/linux-generic/test/pktio/pktio_run_tap | 111 
 3 files changed, 114 insertions(+), 1 deletion(-)
 create mode 100755 platform/linux-generic/test/pktio/pktio_run_tap

diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index 1475589..28bd3dc 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -5,6 +5,7 @@ ODP_MODULES = pktio
 
 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/cpumask/cpumask_main$(EXEEXT) \
diff --git a/platform/linux-generic/test/pktio/Makefile.am 
b/platform/linux-generic/test/pktio/Makefile.am
index 4d39372..ea0ad87 100644
--- a/platform/linux-generic/test/pktio/Makefile.am
+++ b/platform/linux-generic/test/pktio/Makefile.am
@@ -1,5 +1,6 @@
 dist_check_SCRIPTS = pktio_env \
-pktio_run
+pktio_run \
+pktio_run_tap
 
 if HAVE_PCAP
 dist_check_SCRIPTS += pktio_run_pcap
diff --git a/platform/linux-generic/test/pktio/pktio_run_tap 
b/platform/linux-generic/test/pktio/pktio_run_tap
new file mode 100755
index 000..4e2526f
--- /dev/null
+++ b/platform/linux-generic/test/pktio/pktio_run_tap
@@ -0,0 +1,111 @@
+#!/bin/sh
+#
+# Copyright (c) 2015, Ilya Maximets 
+# All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# directories where pktio_main binary can be found:
+# -in the validation dir when running make check (intree or out of tree)
+# -in the script directory, when running after 'make install', or
+# -in the validation when running standalone intree.
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/pktio:$PATH
+PATH=$(dirname $0):$PATH
+PATH=$(dirname $0)/../../../../test/validation/pktio:$PATH
+PATH=.:$PATH
+
+pktio_main_path=$(which pktio_main${EXEEXT})
+if [ -x "$pktio_main_path" ] ; then
+   echo "running with $pktio_main_path"
+else
+   echo "cannot find pktio_main${EXEEXT}: please set you PATH for it."
+fi
+
+TAP_BASE_NAME=iotap_vald
+IF0=${TAP_BASE_NAME}0
+IF1=${TAP_BASE_NAME}1
+BR=${TAP_BASE_NAME}_br
+
+export ODP_PKTIO_IF0="tap:$IF0"
+export ODP_PKTIO_IF1="tap:$IF1"
+
+tap_cleanup()
+{
+   ret=$?
+
+   for iface in $IF0 $IF1; do
+   ip link set dev $iface nomaster
+   done
+
+   ip link delete $BR type bridge
+
+   for iface in $IF0 $IF1; do
+   ip tuntap del mode tap $iface
+   done
+
+   trap - EXIT
+   exit $ret
+}
+
+tap_setup()
+{
+   if [ "$(id -u)" != "0" ]; then
+   echo "pktio: need to be root to setup TAP interfaces."
+   return 1
+   fi
+
+   for iface in $IF0 $IF1 $BR; do
+   ip link show $iface 2> /dev/null
+   if [ $? -eq 0 ]; then
+   echo "pktio: interface $iface already exist $?"
+   return 2
+   fi
+   done
+
+   trap tap_cleanup EXIT
+
+   for iface in $IF0 $IF1; do
+   ip tuntap add mode tap $iface
+   if [ $? -ne 0 ]; then
+   echo "pktio: error: unable to create TAP device $iface"
+   return 3
+   fi
+   done
+
+   ip link add name $BR type bridge
+   if [ $? -ne 0 ]; then
+   echo "pktio: error: unable to create bridge $BR"
+   return 3
+   fi
+
+   for iface in $IF0 $IF1; do
+   ip link set dev $iface master $BR
+   if [ $? -ne 0 ]; then
+   echo "pktio: error: unable to add $iface to bridge $BR"
+   return 4
+   fi
+   done
+
+   for iface in $IF0 $IF1 $BR; do
+   ifconfig $iface -arp
+   sysctl -w net.ipv6.conf.${iface}.disable_ipv6=1
+   ip link set dev $iface mtu 9216 up
+   done
+
+   return 0
+}
+
+tap_setup
+ret=$?
+if [ $ret -ne 0 ]; then
+   echo "pktio: tap_setup() FAILED!"
+   exit $ret
+fi
+
+pktio_main${EXEEXT}
+ret=$?
+
+exit $ret
-- 
2.1.4

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


[lng-odp] ODP Roadmap Status Updated

2015-12-02 Thread Marshall Guillory
I updated the ODP website today for the release on the 30th. Roadmaps too
based on JIRA sync.

http://www.opendataplane.org/opendataplane-roadmap/

-- 
Sincerely,

Marshall Guillory

Technical Program Enabler, Agile Coach, Scrum master
Networking (LNG) Segment Group and Automation Teams (LAB, QAS, LAVA & Builds)
Linaro Engineering Group
Content Manager - opendataplane.org

M:  +1.405.609.4491 IRC: marshallg
E: marshall.guill...@linaro.org

Linaro.org │ Open source software for ARM SoCs

[image: Twitter]   [image: Facebook]
  [image: Google Plus]
  [image:
Youtube] 
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] doc: build users and implementers guide in the build tree instead of the source tree

2015-12-02 Thread Nicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin 
---
 doc/implementers-guide/Makefile.am | 4 ++--
 doc/users-guide/Makefile.am| 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/implementers-guide/Makefile.am 
b/doc/implementers-guide/Makefile.am
index d653968..591e9d6 100644
--- a/doc/implementers-guide/Makefile.am
+++ b/doc/implementers-guide/Makefile.am
@@ -1,11 +1,11 @@
-TARGET = $(top_srcdir)/doc/output/implementers-guide.html
+TARGET = $(top_builddir)/doc/output/implementers-guide.html
 
 EXTRA_DIST = implementers-guide.adoc
 
 all-local: $(TARGET)
 
 $(TARGET): implementers-guide.adoc
-   @mkdir -p $(top_srcdir)/doc/output
+   @mkdir -p $(top_builddir)/doc/output
asciidoc -b html5  -a icons -a toc2  -a max-width=55em --out-file=$@ $<
 
 clean-local:
diff --git a/doc/users-guide/Makefile.am b/doc/users-guide/Makefile.am
index 8e60312..700e03f 100644
--- a/doc/users-guide/Makefile.am
+++ b/doc/users-guide/Makefile.am
@@ -1,11 +1,11 @@
-TARGET = $(top_srcdir)/doc/output/users-guide.html
+TARGET = $(top_builddir)/doc/output/users-guide.html
 
 EXTRA_DIST = users-guide.adoc
 
 all-local: $(TARGET)
 
 $(TARGET): users-guide.adoc
-   @mkdir -p $(top_srcdir)/doc/output
+   @mkdir -p $(top_builddir)/doc/output
asciidoc -b html5  -a icons -a toc2  -a max-width=55em --out-file=$@ $<
 
 clean-local:
-- 
2.6.3.372.gcb93895

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