Re: [lng-odp] [PATCH 1/2] linux-gen: ipc: use hdr to handle conversion function

2017-02-27 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Maxim
> Uvarov
> Sent: Monday, February 27, 2017 6:10 PM
> To: lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [PATCH 1/2] linux-gen: ipc: use hdr to handle
> conversion function
> 
> On 02/27/17 19:02, Bill Fischofer wrote:
> > On Mon, Feb 27, 2017 at 9:57 AM, Petri Savolainen <
> > petri.savolai...@linaro.org> wrote:
> >
> >> Use conversion function instead of casting.
> >>
> >> Signed-off-by: Petri Savolainen 
> >> ---
> >>  platform/linux-generic/include/odp_packet_internal.h | 6 ++
> >>  platform/linux-generic/odp_packet.c  | 5 -
> >>  platform/linux-generic/pktio/ipc.c   | 2 +-
> >>  3 files changed, 7 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/platform/linux-generic/include/odp_packet_internal.h
> >> b/platform/linux-generic/include/odp_packet_internal.h
> >> index 4f844d1..7a394dd 100644
> >> --- a/platform/linux-generic/include/odp_packet_internal.h
> >> +++ b/platform/linux-generic/include/odp_packet_internal.h
> >> @@ -163,6 +163,12 @@ static inline odp_packet_hdr_t
> >> *odp_packet_hdr(odp_packet_t pkt)
> >> return (odp_packet_hdr_t *)(uintptr_t)pkt;
> >>  }
> >>
> >> +/* Only one using this outside of packet.c is ipc.c */
> >>
> >
> > I'd delete this comment but otherwise this series looks good. Who else
> is
> > using this function is potentially anyone who includes packet_internal.h
> > and that will change over time.
> >
> 
> +1 to remove.
> 
> Maxim.

It's there to remind that maybe IPC should not have this dependency either. All 
other pktios manage to do their job without this conversion. So, I'm not 
expecting anyone adding this call outside of packet.c, but instead ipc.c to 
remove the call after which we can move the function back into packet.c.

-Petri


Re: [lng-odp] [PATCH 1/2] linux-gen: packet: remove unnecessary packet reparsing

2017-02-27 Thread Elo, Matias (Nokia - FI/Espoo)
Ping.

> On 15 Feb 2017, at 18:01, Matias Elo  wrote:
> 
> Previously the highest already parsed layer was unnecessarily reparsed on
> the following packet_parse_common() calls.
> 
> Signed-off-by: Matias Elo 
> ---
> platform/linux-generic/odp_packet.c | 22 +++---
> 1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/platform/linux-generic/odp_packet.c 
> b/platform/linux-generic/odp_packet.c
> index 024f694..a6cf4cd 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -2022,12 +2022,15 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
>   case LAYER_NONE:
>   /* Fall through */
> 
> - case LAYER_L2:
> + case LAYER_L1:
>   {
>   const _odp_ethhdr_t *eth;
>   uint16_t macaddr0, macaddr2, macaddr4;
>   const _odp_vlanhdr_t *vlan;
> 
> + if (layer <= LAYER_L1)
> + return prs->error_flags.all != 0;
> +
>   offset = sizeof(_odp_ethhdr_t);
>   if (packet_parse_l2_not_done(prs))
>   packet_parse_l2(prs, frame_len);
> @@ -2091,13 +2094,14 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
> 
>   prs->l3_offset = offset;
>   prs->parsed_layers = LAYER_L2;
> - if (layer == LAYER_L2)
> - return prs->error_flags.all != 0;
>   }
>   /* Fall through */
> 
> - case LAYER_L3:
> + case LAYER_L2:
>   {
> + if (layer <= LAYER_L2)
> + return prs->error_flags.all != 0;
> +
>   offset = prs->l3_offset;
>   parseptr = (const uint8_t *)(ptr + offset);
>   /* Set l3_offset+flag only for known ethtypes */
> @@ -2131,13 +2135,14 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
>   /* Set l4_offset+flag only for known ip_proto */
>   prs->l4_offset = offset;
>   prs->parsed_layers = LAYER_L3;
> - if (layer == LAYER_L3)
> - return prs->error_flags.all != 0;
>   }
>   /* Fall through */
> 
> - case LAYER_L4:
> + case LAYER_L3:
>   {
> + if (layer <= LAYER_L3)
> + return prs->error_flags.all != 0;
> +
>   offset = prs->l4_offset;
>   parseptr = (const uint8_t *)(ptr + offset);
>   prs->input_flags.l4 = 1;
> @@ -2186,6 +2191,9 @@ int packet_parse_common(packet_parser_t *prs, const 
> uint8_t *ptr,
>   break;
>   }
> 
> + case LAYER_L4:
> + break;
> +
>   case LAYER_ALL:
>   break;
> 
> -- 
> 2.7.4
> 



[lng-odp] [PATCH 2/2 v3] example: introducing multi-threaded traffic management case

2017-02-27 Thread forrest.shi
From: Xuelin Shi 

introduce a new example of traffic management with following features:
  - multiple TM threads: one TM thread for each pktio
  - for small system less than 4 cores, only one TM thread created.
  - receiving packets from multiple pktios other than generating packets
  - identifying TM user by ip with individual class of service
  - print the user service while starting the program
  - print the packets counts every 10 seconds for each user

Signed-off-by: Xuelin Shi 
---
v3:
  fix copyright string, add test and termination path (Maxim)
v2:
  rebased to latest code
 
 example/Makefile.am|   3 +-
 example/m4/configure.m4|   1 +
 example/traffic_mgmt_multi/.gitignore  |   3 +
 example/traffic_mgmt_multi/Makefile.am |  18 +
 example/traffic_mgmt_multi/odp_traffic_mgmt.c  | 877 +
 example/traffic_mgmt_multi/odp_traffic_mgmt.h  |  55 ++
 example/traffic_mgmt_multi/odp_traffic_pktio.c | 824 +++
 .../traffic_mgmt_multi/traffic_mgmt_multi_run.sh   |  29 +
 example/traffic_mgmt_multi/udp64.pcap  | Bin 0 -> 7624 bytes
 platform/linux-generic/odp_traffic_mngr.c  |   2 +-
 10 files changed, 1810 insertions(+), 2 deletions(-)
 create mode 100644 example/traffic_mgmt_multi/.gitignore
 create mode 100644 example/traffic_mgmt_multi/Makefile.am
 create mode 100644 example/traffic_mgmt_multi/odp_traffic_mgmt.c
 create mode 100644 example/traffic_mgmt_multi/odp_traffic_mgmt.h
 create mode 100644 example/traffic_mgmt_multi/odp_traffic_pktio.c
 create mode 100755 example/traffic_mgmt_multi/traffic_mgmt_multi_run.sh
 create mode 100644 example/traffic_mgmt_multi/udp64.pcap

diff --git a/example/Makefile.am b/example/Makefile.am
index dfc07b6..9e21989 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -8,4 +8,5 @@ SUBDIRS = classifier \
  switch \
  time \
  timer \
- traffic_mgmt
+ traffic_mgmt \
+ traffic_mgmt_multi
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index 620db04..3bf48bd 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -21,4 +21,5 @@ AC_CONFIG_FILES([example/classifier/Makefile
 example/time/Makefile
 example/timer/Makefile
 example/traffic_mgmt/Makefile
+example/traffic_mgmt_multi/Makefile
 example/Makefile])
diff --git a/example/traffic_mgmt_multi/.gitignore 
b/example/traffic_mgmt_multi/.gitignore
new file mode 100644
index 000..d8f5468
--- /dev/null
+++ b/example/traffic_mgmt_multi/.gitignore
@@ -0,0 +1,3 @@
+odp_traffic_mgmt
+*.log
+*.trs
diff --git a/example/traffic_mgmt_multi/Makefile.am 
b/example/traffic_mgmt_multi/Makefile.am
new file mode 100644
index 000..a9a3561
--- /dev/null
+++ b/example/traffic_mgmt_multi/Makefile.am
@@ -0,0 +1,18 @@
+include $(top_srcdir)/example/Makefile.inc
+
+bin_PROGRAMS = odp_traffic_mgmt$(EXEEXT)
+odp_traffic_mgmt_LDFLAGS = $(AM_LDFLAGS) -static
+odp_traffic_mgmt_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example 
-I${top_srcdir}/test
+
+noinst_HEADERS = $(top_srcdir)/example/example_debug.h \
+$(top_srcdir)/example/traffic_mgmt_multi/odp_traffic_mgmt.h
+
+dist_odp_traffic_mgmt_SOURCES = odp_traffic_mgmt.c odp_traffic_pktio.c
+
+if test_example
+if HAVE_PCAP
+TESTS = traffic_mgmt_multi_run.sh
+endif
+endif
+
+EXTRA_DIST = traffic_mgmt_multi_run.sh udp64.pcap
diff --git a/example/traffic_mgmt_multi/odp_traffic_mgmt.c 
b/example/traffic_mgmt_multi/odp_traffic_mgmt.c
new file mode 100644
index 000..b8539b8
--- /dev/null
+++ b/example/traffic_mgmt_multi/odp_traffic_mgmt.c
@@ -0,0 +1,877 @@
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#define _GNU_SOURCE
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "odp_traffic_mgmt.h"
+
+#define TM_USER_IP_START 0x0A01
+#define NUM_SVC_CLASSES 4
+#define USERS_PER_SVC_CLASS 2
+#define APPS_PER_USER   1
+#define TM_QUEUES_PER_APP   1
+#define NUM_USERS   (USERS_PER_SVC_CLASS * NUM_SVC_CLASSES)
+#define NUM_TM_QUEUES   (NUM_USERS * APPS_PER_USER * TM_QUEUES_PER_APP)
+#define TM_QUEUES_PER_USER  (TM_QUEUES_PER_APP * APPS_PER_USER)
+#define TM_QUEUES_PER_CLASS (USERS_PER_SVC_CLASS * TM_QUEUES_PER_USER)
+#define MAX_NODES_PER_LEVEL (NUM_USERS * APPS_PER_USER)
+
+#define MAX_NB_PKTIO   32
+#define MAX_NB_USERS   (NUM_USERS * APPS_PER_USER * MAX_NB_PKTIO)
+
+#define KBPS   1000
+#define MBPS   100
+#define PERCENT(percent)  (100 * percent)
+
+#define FALSE  0
+#define TRUE   1
+
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+#define RANDOM_BUF_LEN  1024
+
+typedef struct {
+   odp_tm_shaper_params_tshaper_params;
+  

[lng-odp] [PATCH 1/2 v3] linux-gen: traffic_mgmr: support termination in barrier.

2017-02-27 Thread forrest.shi
From: Xuelin Shi 

While the tm_group(thread) is waiting for enquing at barrier,
it may receive destroy call. In this case, need a mechanism to exit.
This patch adds a variant of odp_barrier_wait to enable it.

Signed-off-by: Xuelin Shi 
---
 platform/linux-generic/odp_traffic_mngr.c | 93 ---
 1 file changed, 73 insertions(+), 20 deletions(-)

diff --git a/platform/linux-generic/odp_traffic_mngr.c 
b/platform/linux-generic/odp_traffic_mngr.c
index 309f237..9b61c50 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -91,6 +91,8 @@ static int g_main_thread_cpu = -1;
 static int g_tm_cpu_num;
 
 /* Forward function declarations. */
+static int _odp_tm_group_remove(_odp_tm_group_t odp_tm_group, odp_tm_t odp_tm);
+
 static void tm_queue_cnts_decrement(tm_system_t *tm_system,
tm_wred_node_t *tm_wred_node,
uint32_t priority,
@@ -2326,6 +2328,58 @@ static int thread_affinity_get(odp_cpumask_t 
*odp_cpu_mask)
return 0;
 }
 
+static tm_system_t *tm_system_find_run(tm_system_group_t *grp,
+  tm_system_t *tm_system)
+{
+   while (tm_system && odp_atomic_load_u64(_system->destroying)) {
+   tm_system_t *odp_tm;
+
+   odp_tm = tm_system->next;
+   odp_barrier_wait(_system->tm_system_destroy_barrier);
+   _odp_tm_group_remove(MAKE_ODP_TM_SYSTEM_GROUP(grp),
+MAKE_ODP_TM_HANDLE(tm_system));
+   tm_system = odp_tm;
+   if (!grp->num_tm_systems)
+   tm_system = NULL;
+   }
+
+   return tm_system;
+}
+
+static bool odp_barrier_wait_stop(tm_system_group_t *grp,
+ bool (*stop)(tm_system_group_t *grp))
+{
+   uint32_t count;
+   int wasless;
+   odp_barrier_t *barrier = >tm_group_barrier;
+
+   odp_mb_full();
+
+   count   = odp_atomic_fetch_inc_u32(>bar);
+   wasless = count < barrier->count;
+
+   if (count == 2 * barrier->count - 1) {
+   /* Wrap around *atomically* */
+   odp_atomic_sub_u32(>bar, 2 * barrier->count);
+   } else {
+   while ((odp_atomic_load_u32(>bar) < barrier->count)
+   == wasless)
+   if (!stop(grp))
+   odp_cpu_pause();
+   else
+   return true;
+   }
+
+   odp_mb_full();
+
+   return false;
+}
+
+static bool try_stop_tm_group(tm_system_group_t *grp)
+{
+   return tm_system_find_run(grp, grp->first_tm_system) == NULL;
+}
+
 static void *tm_system_thread(void *arg)
 {
_odp_timer_wheel_t _odp_int_timer_wheel;
@@ -2333,7 +2387,7 @@ static void *tm_system_thread(void *arg)
tm_system_group_t  *tm_group;
tm_system_t *tm_system;
uint64_t current_ns;
-   uint32_t destroying, work_queue_cnt, timer_cnt;
+   uint32_t work_queue_cnt, timer_cnt;
int rc;
 
rc = odp_init_local((odp_instance_t)odp_global_data.main_pid,
@@ -2341,20 +2395,28 @@ static void *tm_system_thread(void *arg)
ODP_ASSERT(rc == 0);
tm_group = arg;
 
-   tm_system = tm_group->first_tm_system;
-   _odp_int_timer_wheel = tm_system->_odp_int_timer_wheel;
-   input_work_queue = tm_system->input_work_queue;
+   /* Wait here until we have seen the first enqueue operation
+  or destroy. */
+   if (odp_barrier_wait_stop(tm_group, try_stop_tm_group)) {
+   odp_term_local();
+   return NULL;
+   }
 
-   /* Wait here until we have seen the first enqueue operation. */
-   odp_barrier_wait(_group->tm_group_barrier);
main_loop_running = true;
+   tm_system = tm_system_find_run(tm_group, tm_group->first_tm_system);
+   if (!tm_system) {
+   odp_term_local();
+   return NULL;
+   }
 
-   destroying = odp_atomic_load_u64(_system->destroying);
-
+   _odp_int_timer_wheel = tm_system->_odp_int_timer_wheel;
current_ns = odp_time_to_ns(odp_time_local());
_odp_timer_wheel_start(_odp_int_timer_wheel, current_ns);
 
-   while (destroying == 0) {
+   while (tm_system) {
+   _odp_int_timer_wheel = tm_system->_odp_int_timer_wheel;
+   input_work_queue = tm_system->input_work_queue;
+
/* See if another thread wants to make a configuration
 * change. */
check_for_request();
@@ -2392,16 +2454,12 @@ static void *tm_system_thread(void *arg)
tm_system->current_time = current_ns;
tm_system->is_idle = (timer_cnt == 0) &&
(work_queue_cnt == 0);
-   destroying = odp_atomic_load_u64(_system->destroying);
 
/* 

[lng-odp] Canceled Event: OpenDataPlane (ODP) Public Call @ Tue Mar 7, 2017 9am - 10am (CST) (lng-odp@lists.linaro.org)

2017-02-27 Thread Bill Fischofer

This event has been canceled and removed from your calendar.

Title: OpenDataPlane (ODP) Public Call
Meeting notes document:  
https://docs.google.com/a/linaro.org/document/d/1KjcdpidVqMCDa6FXURSxrTwFjkmb1_pKz54m7eYvVMo/edit


Note: Effective June 2nd we are moving this conference to Blue Jeans.  Go  
to meetings.opendataplane.org to join.  You can connect directly via your  
computer's microphone and web cam, or you can dial in via a phone line if  
you prefer.  There is also a Blue Jeans mobile app available for both iOS  
and Android.  See the meeting landing page for details.

When: Tue Mar 7, 2017 9am – 10am Central Time
Where: http://meetings.opendataplane.org
Calendar: lng-odp@lists.linaro.org
Who:
* Bill Fischofer - creator
* bogdan.pric...@linaro.org
* Petri Savolainen
* song@linaro.org
* Maxim Uvarov
* Yang Shi
* Christian Ziethén
* nikhil.agar...@linaro.org
* Krishna Garapati
* Dmitry Eremin-Solenikov
* Anders Roxell
* Dapeng Liu
* Hongbo Zhang
* Alexandru Badicioiu
* Christophe Milard
* Matthew Spencer
* Maxim Uvarov
* rizwan.ans...@linaro.org
* sreejith.surendrann...@linaro.org
* Linaro Internal Networking Group
* ola.liljed...@arm.com
* pvandenheu...@insidesecure.com
* sachin.sax...@linaro.org
* Mike Holmes
* forrest@linaro.org
* Yogesh Tillu
* Bala Manoharan
* huanggaoya...@huawei.com
* francois.o...@linaro.org
* lng-odp@lists.linaro.org
Attachments:
* LNG Dataplane Sub-Team -  
https://docs.google.com/a/linaro.org/document/d/1KjcdpidVqMCDa6FXURSxrTwFjkmb1_pKz54m7eYvVMo/edit?usp=drive_web



Invitation from Google Calendar: https://www.google.com/calendar/

You are receiving this courtesy email at the account  
lng-odp@lists.linaro.org because you are an attendee of this event.


To stop receiving future updates for this event, decline this event.  
Alternatively you can sign up for a Google account at  
https://www.google.com/calendar/ and control your notification settings for  
your entire calendar.


Forwarding this invitation could allow any recipient to modify your RSVP  
response. Learn more at  
https://support.google.com/calendar/answer/37135#forwarding


invite.ics
Description: application/ics


Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Maxim Uvarov
On 02/27/17 19:05, Marco Varlese wrote:
> On Mon, 2017-02-27 at 18:52 +0300, Maxim Uvarov wrote:
> 
> [nip]
>> maybe just define it as:
>>
>> #define ODP_CPUMASK_SIZE __CPU_SETSIZE
>> ?
> First of all, I don't think it's appropriate to set it to __CPU_SETSIZE but it
> should be (at most) the one exposed by one level up header (e.g. sched.h).
> 
> However, if we do what you propose... what is the purpose of having
> ODP_CPUMASK_SIZE in the first place then?
> 
> I'd say we could remove that ODP define and ASSERT altogether at that point?
> 

I think so. Define is used for string. And right size for that string
can be calculated under odp_init_global() with memory allocation.

./platform/linux-generic/include/odp/api/plat/cpumask_types.h:#define
ODP_CPUMASK_STR_SIZE ((ODP_CPUMASK_SIZE + 3) / 4 + 3)
./platform/linux-generic/include/odp/api/plat/cpumask_types.h:  uint8_t
_u8[ODP_CPUMASK_SIZE / 8];

>>>
>>>
>> with small note on top.
>>
>> Maxim.
>>
> [nip]
> 



Re: [lng-odp] [PATCH 1/2] linux-gen: ipc: use hdr to handle conversion function

2017-02-27 Thread Maxim Uvarov
On 02/27/17 19:02, Bill Fischofer wrote:
> On Mon, Feb 27, 2017 at 9:57 AM, Petri Savolainen <
> petri.savolai...@linaro.org> wrote:
> 
>> Use conversion function instead of casting.
>>
>> Signed-off-by: Petri Savolainen 
>> ---
>>  platform/linux-generic/include/odp_packet_internal.h | 6 ++
>>  platform/linux-generic/odp_packet.c  | 5 -
>>  platform/linux-generic/pktio/ipc.c   | 2 +-
>>  3 files changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/platform/linux-generic/include/odp_packet_internal.h
>> b/platform/linux-generic/include/odp_packet_internal.h
>> index 4f844d1..7a394dd 100644
>> --- a/platform/linux-generic/include/odp_packet_internal.h
>> +++ b/platform/linux-generic/include/odp_packet_internal.h
>> @@ -163,6 +163,12 @@ static inline odp_packet_hdr_t
>> *odp_packet_hdr(odp_packet_t pkt)
>> return (odp_packet_hdr_t *)(uintptr_t)pkt;
>>  }
>>
>> +/* Only one using this outside of packet.c is ipc.c */
>>
> 
> I'd delete this comment but otherwise this series looks good. Who else is
> using this function is potentially anyone who includes packet_internal.h
> and that will change over time.
> 

+1 to remove.

Maxim.

> 
>> +static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
>> +{
>> +   return (odp_packet_t)pkt_hdr;
>> +}
>> +
>>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
>>odp_packet_hdr_t *dst_hdr)
>>  {
>> diff --git a/platform/linux-generic/odp_packet.c
>> b/platform/linux-generic/odp_packet.c
>> index c21f635..3019418 100644
>> --- a/platform/linux-generic/odp_packet.c
>> +++ b/platform/linux-generic/odp_packet.c
>> @@ -48,11 +48,6 @@ static inline odp_packet_hdr_t *packet_hdr(odp_packet_t
>> pkt)
>> return (odp_packet_hdr_t *)(uintptr_t)pkt;
>>  }
>>
>> -static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
>> -{
>> -   return (odp_packet_t)pkt_hdr;
>> -}
>> -
>>  static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
>>  {
>> return pkt_hdr->buf_hdr.handle.handle;
>> diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/
>> pktio/ipc.c
>> index 377f20e..06175e5 100644
>> --- a/platform/linux-generic/pktio/ipc.c
>> +++ b/platform/linux-generic/pktio/ipc.c
>> @@ -409,7 +409,7 @@ static void _ipc_free_ring_packets(pktio_entry_t
>> *pktio_entry, _ring_t *r)
>> void *mbase = pktio_entry->s.ipc.pool_mdata_base;
>>
>> phdr = (void *)((uint8_t *)mbase + offsets[i]);
>> -   pkt = (odp_packet_t)phdr->buf_hdr.handle.handle;
>> +   pkt = packet_handle(phdr);
>> odp_packet_free(pkt);
>> }
>> }
>> --
>> 2.8.1
>>
>>



Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Marco Varlese
On Mon, 2017-02-27 at 18:52 +0300, Maxim Uvarov wrote:

[nip]
> maybe just define it as:
> 
> #define ODP_CPUMASK_SIZE __CPU_SETSIZE
> ?
First of all, I don't think it's appropriate to set it to __CPU_SETSIZE but it
should be (at most) the one exposed by one level up header (e.g. sched.h).

However, if we do what you propose... what is the purpose of having
ODP_CPUMASK_SIZE in the first place then?

I'd say we could remove that ODP define and ASSERT altogether at that point?

> > 
> > 
> with small note on top.
> 
> Maxim.
> 
[nip]


Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Maxim Uvarov
after some thinking

and looking to that link:
https://www.sourceware.org/ml/libc-alpha/2016-08/msg00236.html

I see that we do not know how many cpus will be there. And the more
clean fix will be dynamic allocation instead of static arrays.

Maxim.

On 02/27/17 18:42, Marco Varlese wrote:
> Cool. I posted here because it appeared strange to me to get that error...
> 
> On my system I checked that:
> CPU_SETSIZE is 4096 as first defined as __CPU_SETSIZE in bits/sched.h and then
> as CPU_SETSIZE in sched.h
> bits/sched.h:# define __CPU_SETSIZE   4096
> sched.h:# define CPU_SETSIZE __CPU_SETSIZE
> 
> While ODP_CPUMASK_SIZE is 1024 as defined in platform/linux-
> generic/include/odp/api/plat/cpumask_types.h
> 
> Would you think it makes sense to increase the size of ODP_CPUMASK_SIZE to 
> 4096?
> 
> 
> Cheers,
> Marco
> 
> On Mon, 2017-02-27 at 09:01 -0600, Bill Fischofer wrote:
 Thanks. I'm not sure if ODP has been tested in that environment. My guess 
 is
> it's something simple. That assert is testing sizeof(cpu_set_t) and it sounds
> like that's different in Suse then, say, Ubuntu.
>>
>>> On Mon, Feb 27, 2017 at 8:47 AM, Marco Varlese  
>>> wrote:
>>> OS: openSUSE Leap 42.2 
>>> Compiler: gcc-6
>>> Kernel: 4.10.0-rc4-1.g4f824f1-default
>>>
>>>
>>> Cheers,
>>> Marco
>>>
>>> On Mon, 2017-02-27 at 08:44 -0600, Bill Fischofer wrote:
 What environment are you running in (OS, compiler, service levels, etc.)? 
>> On Mon, Feb 27, 2017 at 8:35 AM, Marco Varlese 
>> 
> wrote:
> Hi,
>
>
> I've pulled latest code from the git repo and got into a compile-time
> error.
>
>
>
> I followed the steps provided in the README file under platform/linux-
> generic
>
> which are:
>
> ./bootstrap
>
> ./configure
>
> ./make
>
>
>
> Please, see below the output of the compilation.
>
>
>
>   CC   _fdserver.lo
>
>   CC   _ishm.lo
>
>   CC   _ishmphy.lo
>
>   CC   odp_atomic.lo
>
>   CC   odp_barrier.lo
>
>   CC   odp_buffer.lo
>
>   CC   odp_byteorder.lo
>
>   CC   odp_classification.lo
>
>   CC   odp_cpu.lo
>
>   CC   odp_cpumask.lo
>
> In file included from /usr/include/features.h:365:0,
>
>  from /usr/include/sched.h:22,
>
>  from odp_cpumask.c:9:
>
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
>
> '__error_if_negative'
>
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>
>^
>
> odp_cpumask.c:24:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>
>  ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE,
>
>  ^
>
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
>
> '__error_if_negative'
>
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>
>^
>
> odp_cpumask.c:28:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>
>  ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t),
>
>  ^
>
> Makefile:906: recipe for target 'odp_cpumask.lo' failed
>
> make[1]: *** [odp_cpumask.lo] Error 1
>
>
>
> I've also tried to pull the MONARCH LTS branch but I get exactly the
> same
>
> result.
>
>
>
> Any thoughts or help on this would be much appreciated.
>
>
>
>
>
> Thanks,
>
> Marco
>
>
>
>


>>>
>>>
>>>
>>
>>



Re: [lng-odp] [PATCH 1/2] linux-gen: ipc: use hdr to handle conversion function

2017-02-27 Thread Bill Fischofer
On Mon, Feb 27, 2017 at 9:57 AM, Petri Savolainen <
petri.savolai...@linaro.org> wrote:

> Use conversion function instead of casting.
>
> Signed-off-by: Petri Savolainen 
> ---
>  platform/linux-generic/include/odp_packet_internal.h | 6 ++
>  platform/linux-generic/odp_packet.c  | 5 -
>  platform/linux-generic/pktio/ipc.c   | 2 +-
>  3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_packet_internal.h
> b/platform/linux-generic/include/odp_packet_internal.h
> index 4f844d1..7a394dd 100644
> --- a/platform/linux-generic/include/odp_packet_internal.h
> +++ b/platform/linux-generic/include/odp_packet_internal.h
> @@ -163,6 +163,12 @@ static inline odp_packet_hdr_t
> *odp_packet_hdr(odp_packet_t pkt)
> return (odp_packet_hdr_t *)(uintptr_t)pkt;
>  }
>
> +/* Only one using this outside of packet.c is ipc.c */
>

I'd delete this comment but otherwise this series looks good. Who else is
using this function is potentially anyone who includes packet_internal.h
and that will change over time.


> +static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
> +{
> +   return (odp_packet_t)pkt_hdr;
> +}
> +
>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
>odp_packet_hdr_t *dst_hdr)
>  {
> diff --git a/platform/linux-generic/odp_packet.c
> b/platform/linux-generic/odp_packet.c
> index c21f635..3019418 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -48,11 +48,6 @@ static inline odp_packet_hdr_t *packet_hdr(odp_packet_t
> pkt)
> return (odp_packet_hdr_t *)(uintptr_t)pkt;
>  }
>
> -static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
> -{
> -   return (odp_packet_t)pkt_hdr;
> -}
> -
>  static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
>  {
> return pkt_hdr->buf_hdr.handle.handle;
> diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/
> pktio/ipc.c
> index 377f20e..06175e5 100644
> --- a/platform/linux-generic/pktio/ipc.c
> +++ b/platform/linux-generic/pktio/ipc.c
> @@ -409,7 +409,7 @@ static void _ipc_free_ring_packets(pktio_entry_t
> *pktio_entry, _ring_t *r)
> void *mbase = pktio_entry->s.ipc.pool_mdata_base;
>
> phdr = (void *)((uint8_t *)mbase + offsets[i]);
> -   pkt = (odp_packet_t)phdr->buf_hdr.handle.handle;
> +   pkt = packet_handle(phdr);
> odp_packet_free(pkt);
> }
> }
> --
> 2.8.1
>
>


Re: [lng-odp] [PATCH 1/2] linux-gen: ipc_pktio: fix conversion from hdr to pkt

2017-02-27 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Maxim
> Uvarov
> Sent: Monday, February 27, 2017 5:21 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH 1/2] linux-gen: ipc_pktio: fix conversion from
> hdr to pkt
> 
> commit:
> 5ebc1243 linux-gen: packet: packet handle is hdr pointer
> Changes odp_packet_t as it's relation to packet header. This
> needed to be adjusted in ipc pktio also.
> 
> Signed-off-by: Maxim Uvarov 
> ---
>  platform/linux-generic/pktio/ipc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-
> generic/pktio/ipc.c
> index 377f20e6..39fa6bda 100644
> --- a/platform/linux-generic/pktio/ipc.c
> +++ b/platform/linux-generic/pktio/ipc.c
> @@ -409,7 +409,7 @@ static void _ipc_free_ring_packets(pktio_entry_t
> *pktio_entry, _ring_t *r)
>   void *mbase = pktio_entry-
> >s.ipc.pool_mdata_base;
> 
>   phdr = (void *)((uint8_t *)mbase +
> offsets[i]);
> - pkt = (odp_packet_t)phdr-
> >buf_hdr.handle.handle;
> + pkt = (odp_packet_t)(uintptr_t)phdr;


Should not cast outside of packet files. Casting caused the bug in the first 
place. It even built but obviously crashed when handle representation was 
changed.

I sent a fix for this and for similar casting case in TM.

-Petri 



[lng-odp] [PATCH 2/2] linux-gen: tm: use handle conversion function

2017-02-27 Thread Petri Savolainen
Use (from buffer to packet handle) conversion function instead
of casting.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/odp_traffic_mngr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_traffic_mngr.c 
b/platform/linux-generic/odp_traffic_mngr.c
index 309f237..4e9358b 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -107,7 +107,7 @@ static int queue_tm_reenq(queue_entry_t *queue, 
odp_buffer_hdr_t *buf_hdr)
odp_tm_queue_t tm_queue = MAKE_ODP_TM_QUEUE((uint8_t *)queue -
offsetof(tm_queue_obj_t,
 tm_qentry));
-   odp_packet_t pkt = (odp_packet_t)buf_hdr->handle.handle;
+   odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle);
 
return odp_tm_enq(tm_queue, pkt);
 }
-- 
2.8.1



[lng-odp] [PATCH 1/2] linux-gen: ipc: use hdr to handle conversion function

2017-02-27 Thread Petri Savolainen
Use conversion function instead of casting.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/include/odp_packet_internal.h | 6 ++
 platform/linux-generic/odp_packet.c  | 5 -
 platform/linux-generic/pktio/ipc.c   | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 4f844d1..7a394dd 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -163,6 +163,12 @@ static inline odp_packet_hdr_t 
*odp_packet_hdr(odp_packet_t pkt)
return (odp_packet_hdr_t *)(uintptr_t)pkt;
 }
 
+/* Only one using this outside of packet.c is ipc.c */
+static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
+{
+   return (odp_packet_t)pkt_hdr;
+}
+
 static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
   odp_packet_hdr_t *dst_hdr)
 {
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index c21f635..3019418 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -48,11 +48,6 @@ static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt)
return (odp_packet_hdr_t *)(uintptr_t)pkt;
 }
 
-static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
-{
-   return (odp_packet_t)pkt_hdr;
-}
-
 static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
 {
return pkt_hdr->buf_hdr.handle.handle;
diff --git a/platform/linux-generic/pktio/ipc.c 
b/platform/linux-generic/pktio/ipc.c
index 377f20e..06175e5 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -409,7 +409,7 @@ static void _ipc_free_ring_packets(pktio_entry_t 
*pktio_entry, _ring_t *r)
void *mbase = pktio_entry->s.ipc.pool_mdata_base;
 
phdr = (void *)((uint8_t *)mbase + offsets[i]);
-   pkt = (odp_packet_t)phdr->buf_hdr.handle.handle;
+   pkt = packet_handle(phdr);
odp_packet_free(pkt);
}
}
-- 
2.8.1



Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Maxim Uvarov
On 02/27/17 18:42, Marco Varlese wrote:
> Cool. I posted here because it appeared strange to me to get that error...
> 
> On my system I checked that:
> CPU_SETSIZE is 4096 as first defined as __CPU_SETSIZE in bits/sched.h and then
> as CPU_SETSIZE in sched.h
> bits/sched.h:# define __CPU_SETSIZE   4096
> sched.h:# define CPU_SETSIZE __CPU_SETSIZE
> 
> While ODP_CPUMASK_SIZE is 1024 as defined in platform/linux-
> generic/include/odp/api/plat/cpumask_types.h
> 
> Would you think it makes sense to increase the size of ODP_CPUMASK_SIZE to 
> 4096?
> 
> 
> Cheers,
> Marco


maybe just define it as:

#define ODP_CPUMASK_SIZE __CPU_SETSIZE
?

with small note on top.

Maxim.

> 
> On Mon, 2017-02-27 at 09:01 -0600, Bill Fischofer wrote:
 Thanks. I'm not sure if ODP has been tested in that environment. My guess 
 is
> it's something simple. That assert is testing sizeof(cpu_set_t) and it sounds
> like that's different in Suse then, say, Ubuntu.
>>
>>> On Mon, Feb 27, 2017 at 8:47 AM, Marco Varlese  
>>> wrote:
>>> OS: openSUSE Leap 42.2 
>>> Compiler: gcc-6
>>> Kernel: 4.10.0-rc4-1.g4f824f1-default
>>>
>>>
>>> Cheers,
>>> Marco
>>>
>>> On Mon, 2017-02-27 at 08:44 -0600, Bill Fischofer wrote:
 What environment are you running in (OS, compiler, service levels, etc.)? 
>> On Mon, Feb 27, 2017 at 8:35 AM, Marco Varlese 
>> 
> wrote:
> Hi,
>
>
> I've pulled latest code from the git repo and got into a compile-time
> error.
>
>
>
> I followed the steps provided in the README file under platform/linux-
> generic
>
> which are:
>
> ./bootstrap
>
> ./configure
>
> ./make
>
>
>
> Please, see below the output of the compilation.
>
>
>
>   CC   _fdserver.lo
>
>   CC   _ishm.lo
>
>   CC   _ishmphy.lo
>
>   CC   odp_atomic.lo
>
>   CC   odp_barrier.lo
>
>   CC   odp_buffer.lo
>
>   CC   odp_byteorder.lo
>
>   CC   odp_classification.lo
>
>   CC   odp_cpu.lo
>
>   CC   odp_cpumask.lo
>
> In file included from /usr/include/features.h:365:0,
>
>  from /usr/include/sched.h:22,
>
>  from odp_cpumask.c:9:
>
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
>
> '__error_if_negative'
>
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>
>^
>
> odp_cpumask.c:24:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>
>  ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE,
>
>  ^
>
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
>
> '__error_if_negative'
>
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>
>^
>
> odp_cpumask.c:28:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>
>  ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t),
>
>  ^
>
> Makefile:906: recipe for target 'odp_cpumask.lo' failed
>
> make[1]: *** [odp_cpumask.lo] Error 1
>
>
>
> I've also tried to pull the MONARCH LTS branch but I get exactly the
> same
>
> result.
>
>
>
> Any thoughts or help on this would be much appreciated.
>
>
>
>
>
> Thanks,
>
> Marco
>
>
>
>


>>>
>>>
>>>
>>
>>



Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Marco Varlese
Cool. I posted here because it appeared strange to me to get that error...

On my system I checked that:
CPU_SETSIZE is 4096 as first defined as __CPU_SETSIZE in bits/sched.h and then
as CPU_SETSIZE in sched.h
bits/sched.h:# define __CPU_SETSIZE 4096
sched.h:# define CPU_SETSIZE __CPU_SETSIZE

While ODP_CPUMASK_SIZE is 1024 as defined in platform/linux-
generic/include/odp/api/plat/cpumask_types.h

Would you think it makes sense to increase the size of ODP_CPUMASK_SIZE to 4096?


Cheers,
Marco

On Mon, 2017-02-27 at 09:01 -0600, Bill Fischofer wrote:
> > > Thanks. I'm not sure if ODP has been tested in that environment. My guess 
> > > is
it's something simple. That assert is testing sizeof(cpu_set_t) and it sounds
like that's different in Suse then, say, Ubuntu.
> 
> > On Mon, Feb 27, 2017 at 8:47 AM, Marco Varlese  
> > wrote:
> > OS: openSUSE Leap 42.2 
> > Compiler: gcc-6
> > Kernel: 4.10.0-rc4-1.g4f824f1-default
> > 
> > 
> > Cheers,
> > Marco
> > 
> > On Mon, 2017-02-27 at 08:44 -0600, Bill Fischofer wrote:
> > > What environment are you running in (OS, compiler, service levels, etc.)? 
> > > > > > > > > On Mon, Feb 27, 2017 at 8:35 AM, Marco Varlese 
> > > > > > > > > 
wrote:
> > > > Hi,
> > > > 
> > > > 
> > > > > > > > I've pulled latest code from the git repo and got into a 
> > > > > > > > compile-time
error.
> > > > 
> > > > 
> > > > 
> > > > > > > > I followed the steps provided in the README file under 
> > > > > > > > platform/linux-
generic
> > > > 
> > > > which are:
> > > > 
> > > > ./bootstrap
> > > > 
> > > > ./configure
> > > > 
> > > > ./make
> > > > 
> > > > 
> > > > 
> > > > Please, see below the output of the compilation.
> > > > 
> > > > 
> > > > 
> > > >   CC   _fdserver.lo
> > > > 
> > > >   CC   _ishm.lo
> > > > 
> > > >   CC   _ishmphy.lo
> > > > 
> > > >   CC   odp_atomic.lo
> > > > 
> > > >   CC   odp_barrier.lo
> > > > 
> > > >   CC   odp_buffer.lo
> > > > 
> > > >   CC   odp_byteorder.lo
> > > > 
> > > >   CC   odp_classification.lo
> > > > 
> > > >   CC   odp_cpu.lo
> > > > 
> > > >   CC   odp_cpumask.lo
> > > > 
> > > > In file included from /usr/include/features.h:365:0,
> > > > 
> > > >  from /usr/include/sched.h:22,
> > > > 
> > > >  from odp_cpumask.c:9:
> > > > 
> > > > ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> > > > 
> > > > '__error_if_negative'
> > > > 
> > > >  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
> > > > 
> > > >    ^
> > > > 
> > > > odp_cpumask.c:24:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
> > > > 
> > > >  ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE,
> > > > 
> > > >  ^
> > > > 
> > > > ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> > > > 
> > > > '__error_if_negative'
> > > > 
> > > >  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
> > > > 
> > > >    ^
> > > > 
> > > > odp_cpumask.c:28:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
> > > > 
> > > >  ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t),
> > > > 
> > > >  ^
> > > > 
> > > > Makefile:906: recipe for target 'odp_cpumask.lo' failed
> > > > 
> > > > make[1]: *** [odp_cpumask.lo] Error 1
> > > > 
> > > > 
> > > > 
> > > > > > > > I've also tried to pull the MONARCH LTS branch but I get 
> > > > > > > > exactly the
same
> > > > 
> > > > result.
> > > > 
> > > > 
> > > > 
> > > > Any thoughts or help on this would be much appreciated.
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Thanks,
> > > > 
> > > > Marco
> > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > 
> > 
> > 
> 
> 


[lng-odp] [PATCH 2/2] linux-gen: remove pktio ipc option from configure

2017-02-27 Thread Maxim Uvarov
Options becomes stable and not need any entry in main
configure for platform specific pktio.

Signed-off-by: Maxim Uvarov 
---
 configure.ac   | 1 -
 platform/linux-generic/Makefile.am | 1 +
 platform/linux-generic/m4/configure.m4 | 1 -
 platform/linux-generic/m4/odp_ipc.m4   | 9 -
 test/linux-generic/Makefile.am | 3 ---
 5 files changed, 1 insertion(+), 14 deletions(-)
 delete mode 100644 platform/linux-generic/m4/odp_ipc.m4

diff --git a/configure.ac b/configure.ac
index d344e6ad..f4af6604 100644
--- a/configure.ac
+++ b/configure.ac
@@ -209,7 +209,6 @@ AC_SUBST([testdir])
 # Set conditionals as computed within platform specific files
 ##
 AM_CONDITIONAL([netmap_support], [test x$netmap_support = xyes ])
-AM_CONDITIONAL([PKTIO_IPC], [test x$pktio_ipc_support = xyes])
 AM_CONDITIONAL([PKTIO_DPDK], [test x$pktio_dpdk_support = xyes ])
 AM_CONDITIONAL([HAVE_PCAP], [test $have_pcap = yes])
 AM_CONDITIONAL([SDK_INSTALL_PATH_], [test "x${SDK_INSTALL_PATH_}" = "x1"])
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 32b5aab6..39d2921f 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -9,6 +9,7 @@ AM_CFLAGS +=  -I$(top_srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@
 AM_CFLAGS +=  -I$(top_builddir)/include
 AM_CFLAGS +=  -Iinclude
+AM_CFLAGS +=  -D_ODP_PKTIO_IPC
 
 include_HEADERS = \
  $(top_srcdir)/include/odp.h \
diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index d3e5528c..a2a25408 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -33,7 +33,6 @@ m4_include([platform/linux-generic/m4/odp_openssl.m4])
 m4_include([platform/linux-generic/m4/odp_pcap.m4])
 m4_include([platform/linux-generic/m4/odp_netmap.m4])
 m4_include([platform/linux-generic/m4/odp_dpdk.m4])
-m4_include([platform/linux-generic/m4/odp_ipc.m4])
 m4_include([platform/linux-generic/m4/odp_schedule.m4])
 
 AC_CONFIG_FILES([platform/linux-generic/Makefile
diff --git a/platform/linux-generic/m4/odp_ipc.m4 
b/platform/linux-generic/m4/odp_ipc.m4
deleted file mode 100644
index 78217e22..
--- a/platform/linux-generic/m4/odp_ipc.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-##
-# Enable IPC pktio support
-##
-AC_ARG_ENABLE([pktio_ipc_support],
-[  --enable-pktio_ipc-support  include ipc IO support],
-[if test x$enableval = xyes; then
-   pktio_ipc_support=yes
-   ODP_CFLAGS="$ODP_CFLAGS -D_ODP_PKTIO_IPC"
-fi])
diff --git a/test/linux-generic/Makefile.am b/test/linux-generic/Makefile.am
index 998ee561..0522550a 100644
--- a/test/linux-generic/Makefile.am
+++ b/test/linux-generic/Makefile.am
@@ -53,11 +53,8 @@ endif
 if PKTIO_DPDK
 TESTS += validation/api/pktio/pktio_run_dpdk.sh
 endif
-
-if PKTIO_IPC
 TESTS += pktio_ipc/pktio_ipc_run.sh
 SUBDIRS += pktio_ipc
-endif
 else
 #performance tests refer to pktio_env
 if test_perf
-- 
2.11.0.295.gd7dffce



[lng-odp] [PATCH 1/2] linux-gen: ipc_pktio: fix conversion from hdr to pkt

2017-02-27 Thread Maxim Uvarov
commit:
5ebc1243 linux-gen: packet: packet handle is hdr pointer
Changes odp_packet_t as it's relation to packet header. This
needed to be adjusted in ipc pktio also.

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/ipc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/ipc.c 
b/platform/linux-generic/pktio/ipc.c
index 377f20e6..39fa6bda 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -409,7 +409,7 @@ static void _ipc_free_ring_packets(pktio_entry_t 
*pktio_entry, _ring_t *r)
void *mbase = pktio_entry->s.ipc.pool_mdata_base;
 
phdr = (void *)((uint8_t *)mbase + offsets[i]);
-   pkt = (odp_packet_t)phdr->buf_hdr.handle.handle;
+   pkt = (odp_packet_t)(uintptr_t)phdr;
odp_packet_free(pkt);
}
}
-- 
2.11.0.295.gd7dffce



Re: [lng-odp] [PATCH] api: ipsec: make IPSEC protocol consistent with other types

2017-02-27 Thread Bill Fischofer
On Mon, Feb 27, 2017 at 7:02 AM, Andriy Berestovskyy <
andriy.berestovs...@cavium.com> wrote:

> Oops, sorry.
> Shall I resend the patch then?
>

Probably not necessary right now. Let's get some feedback on this. If a v2
is needed, then yes, please post it as an API-NEXT patch. Thanks.


>
> Andriy
>
> On 27.02.2017 13:55, Bill Fischofer wrote:
>
>> Thanks Andriy,
>>
>> Please note that all API changes should specify
>> --subject-prefix="API-NEXT PATCH" as we use the api-next branch to
>> accumulate all API changes.
>>
>> On Mon, Feb 27, 2017 at 5:24 AM, Andriy Berestovskyy
>> >
>> wrote:
>>
>> - rename odp_ipsec_protocol_t to odp_ipsec_proto_t
>> - rename ODP_IPSEC_AH to ODP_IPSEC_PROTO_AH
>> - rename ODP_IPSEC_ESP to ODP_IPSEC_PROTO_ESP
>>
>> Signed-off-by: Andriy Berestovskyy > >
>>
>> ---
>>  include/odp/api/spec/ipsec.h | 10 +-
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/odp/api/spec/ipsec.h
>> b/include/odp/api/spec/ipsec.h
>> index 66222d8..793e317 100644
>> --- a/include/odp/api/spec/ipsec.h
>> +++ b/include/odp/api/spec/ipsec.h
>> @@ -140,14 +140,14 @@ typedef enum odp_ipsec_mode_t {
>>  /**
>>   * IPSEC protocol
>>   */
>> -typedef enum odp_ipsec_protocol_t {
>> +typedef enum odp_ipsec_proto_t {
>> /** ESP protocol */
>> -   ODP_IPSEC_ESP = 0,
>> +   ODP_IPSEC_PROTO_ESP = 0,
>>
>> /** AH protocol */
>> -   ODP_IPSEC_AH
>> +   ODP_IPSEC_PROTO_AH
>>
>> -} odp_ipsec_protocol_t;
>> +} odp_ipsec_proto_t;
>>
>>  /**
>>   * IPSEC tunnel type
>> @@ -362,7 +362,7 @@ typedef struct odp_ipsec_sa_param_t {
>> odp_ipsec_dir_t dir;
>>
>> /** IPSEC protocol: ESP or AH */
>> -   odp_ipsec_protocol_t proto;
>> +   odp_ipsec_proto_t proto;
>>
>> /** IPSEC protocol mode: transport or tunnel */
>> odp_ipsec_mode_t mode;
>> --
>> 2.7.4
>>
>>
>>


Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Bill Fischofer
Thanks. I'm not sure if ODP has been tested in that environment. My guess
is it's something simple. That assert is testing sizeof(cpu_set_t) and it
sounds like that's different in Suse then, say, Ubuntu.

On Mon, Feb 27, 2017 at 8:47 AM, Marco Varlese 
wrote:

> OS: openSUSE Leap 42.2
> Compiler: gcc-6
> Kernel: 4.10.0-rc4-1.g4f824f1-default
>
>
> Cheers,
> Marco
>
> On Mon, 2017-02-27 at 08:44 -0600, Bill Fischofer wrote:
>
> What environment are you running in (OS, compiler, service levels, etc.)?
>
> On Mon, Feb 27, 2017 at 8:35 AM, Marco Varlese 
> wrote:
>
> Hi,
>
> I've pulled latest code from the git repo and got into a compile-time
> error.
>
> I followed the steps provided in the README file under
> platform/linux-generic
> which are:
> ./bootstrap
> ./configure
> ./make
>
> Please, see below the output of the compilation.
>
>   CC   _fdserver.lo
>   CC   _ishm.lo
>   CC   _ishmphy.lo
>   CC   odp_atomic.lo
>   CC   odp_barrier.lo
>   CC   odp_buffer.lo
>   CC   odp_byteorder.lo
>   CC   odp_classification.lo
>   CC   odp_cpu.lo
>   CC   odp_cpumask.lo
> In file included from /usr/include/features.h:365:0,
>  from /usr/include/sched.h:22,
>  from odp_cpumask.c:9:
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> '__error_if_negative'
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>^
> odp_cpumask.c:24:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>  ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE,
>  ^
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> '__error_if_negative'
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>^
> odp_cpumask.c:28:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>  ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t),
>  ^
> Makefile:906: recipe for target 'odp_cpumask.lo' failed
> make[1]: *** [odp_cpumask.lo] Error 1
>
> I've also tried to pull the MONARCH LTS branch but I get exactly the same
> result.
>
> Any thoughts or help on this would be much appreciated.
>
>
> Thanks,
> Marco
>
>
>
>


Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Marco Varlese
OS: openSUSE Leap 42.2 
Compiler: gcc-6
Kernel: 4.10.0-rc4-1.g4f824f1-default


Cheers,
Marco

On Mon, 2017-02-27 at 08:44 -0600, Bill Fischofer wrote:
> What environment are you running in (OS, compiler, service levels, etc.)? 
> 
> > On Mon, Feb 27, 2017 at 8:35 AM, Marco Varlese  
> > wrote:
> > Hi,
> > 
> > 
> > I've pulled latest code from the git repo and got into a compile-time error.
> > 
> > 
> > 
> > > > I followed the steps provided in the README file under platform/linux-
generic
> > 
> > which are:
> > 
> > ./bootstrap
> > 
> > ./configure
> > 
> > ./make
> > 
> > 
> > 
> > Please, see below the output of the compilation.
> > 
> > 
> > 
> >   CC   _fdserver.lo
> > 
> >   CC   _ishm.lo
> > 
> >   CC   _ishmphy.lo
> > 
> >   CC   odp_atomic.lo
> > 
> >   CC   odp_barrier.lo
> > 
> >   CC   odp_buffer.lo
> > 
> >   CC   odp_byteorder.lo
> > 
> >   CC   odp_classification.lo
> > 
> >   CC   odp_cpu.lo
> > 
> >   CC   odp_cpumask.lo
> > 
> > In file included from /usr/include/features.h:365:0,
> > 
> >  from /usr/include/sched.h:22,
> > 
> >  from odp_cpumask.c:9:
> > 
> > ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> > 
> > '__error_if_negative'
> > 
> >  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
> > 
> >    ^
> > 
> > odp_cpumask.c:24:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
> > 
> >  ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE,
> > 
> >  ^
> > 
> > ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> > 
> > '__error_if_negative'
> > 
> >  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
> > 
> >    ^
> > 
> > odp_cpumask.c:28:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
> > 
> >  ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t),
> > 
> >  ^
> > 
> > Makefile:906: recipe for target 'odp_cpumask.lo' failed
> > 
> > make[1]: *** [odp_cpumask.lo] Error 1
> > 
> > 
> > 
> > I've also tried to pull the MONARCH LTS branch but I get exactly the same
> > 
> > result.
> > 
> > 
> > 
> > Any thoughts or help on this would be much appreciated.
> > 
> > 
> > 
> > 
> > 
> > Thanks,
> > 
> > Marco
> > 
> > 
> > 
> > 
> 
> 


Re: [lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Bill Fischofer
What environment are you running in (OS, compiler, service levels, etc.)?

On Mon, Feb 27, 2017 at 8:35 AM, Marco Varlese 
wrote:

> Hi,
>
> I've pulled latest code from the git repo and got into a compile-time
> error.
>
> I followed the steps provided in the README file under
> platform/linux-generic
> which are:
> ./bootstrap
> ./configure
> ./make
>
> Please, see below the output of the compilation.
>
>   CC   _fdserver.lo
>   CC   _ishm.lo
>   CC   _ishmphy.lo
>   CC   odp_atomic.lo
>   CC   odp_barrier.lo
>   CC   odp_buffer.lo
>   CC   odp_byteorder.lo
>   CC   odp_classification.lo
>   CC   odp_cpu.lo
>   CC   odp_cpumask.lo
> In file included from /usr/include/features.h:365:0,
>  from /usr/include/sched.h:22,
>  from odp_cpumask.c:9:
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> '__error_if_negative'
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>^
> odp_cpumask.c:24:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>  ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE,
>  ^
> ./include/odp/api/debug.h:42:39: error: negative width in bit-field
> '__error_if_negative'
>  #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
>^
> odp_cpumask.c:28:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
>  ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t),
>  ^
> Makefile:906: recipe for target 'odp_cpumask.lo' failed
> make[1]: *** [odp_cpumask.lo] Error 1
>
> I've also tried to pull the MONARCH LTS branch but I get exactly the same
> result.
>
> Any thoughts or help on this would be much appreciated.
>
>
> Thanks,
> Marco
>
>


[lng-odp] Compilation error of ODP on Linux x86_64 platform

2017-02-27 Thread Marco Varlese
Hi,

I've pulled latest code from the git repo and got into a compile-time error.

I followed the steps provided in the README file under platform/linux-generic
which are:
./bootstrap
./configure
./make

Please, see below the output of the compilation.

  CC   _fdserver.lo
  CC   _ishm.lo
  CC   _ishmphy.lo
  CC   odp_atomic.lo
  CC   odp_barrier.lo
  CC   odp_buffer.lo
  CC   odp_byteorder.lo
  CC   odp_classification.lo
  CC   odp_cpu.lo
  CC   odp_cpumask.lo
In file included from /usr/include/features.h:365:0,
 from /usr/include/sched.h:22,
 from odp_cpumask.c:9:
./include/odp/api/debug.h:42:39: error: negative width in bit-field
'__error_if_negative'
 #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
   ^
odp_cpumask.c:24:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
 ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE,
 ^
./include/odp/api/debug.h:42:39: error: negative width in bit-field
'__error_if_negative'
 #define ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
   ^
odp_cpumask.c:28:1: note: in expansion of macro 'ODP_STATIC_ASSERT'
 ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t),
 ^
Makefile:906: recipe for target 'odp_cpumask.lo' failed
make[1]: *** [odp_cpumask.lo] Error 1

I've also tried to pull the MONARCH LTS branch but I get exactly the same
result.

Any thoughts or help on this would be much appreciated.


Thanks,
Marco



Re: [lng-odp] [API-NEXT PATCH 16/21] drv: complement parameters to the driver probe() function

2017-02-27 Thread Christophe Milard
On 23 February 2017 at 00:00, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> Of course, when probing a driver, the latter should be given the devio
>> handle to be used. This is what this patch adds. It also adds the index
>> of the devio, hence telling the driver which of the possible
>> ODPDRV_MAX_DEVIOS devios was selected, as this is going to be the first
>> thing the driver needs to know.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  include/odp/drv/spec/driver.h | 7 +--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h
>> index 221a6ce..b3c9b76 100644
>> --- a/include/odp/drv/spec/driver.h
>> +++ b/include/odp/drv/spec/driver.h
>> @@ -314,9 +314,12 @@ struct odpdrv_driver_param_t {
>>
>> /** Probe function:
>>  * Called by ODP to see if the driver can drive a given device
>> -*
>> +* -dev is obviously the device we try to handle.
>
>
> I'd delete "obviously" here. Sounds a bit condescending in a spec. Perhaps
> just "-dev the device to be probed"

OK: => V2

Christophe

>
>>
>> +* -devio is the devio to be used.
>> +* -devio_idx actually tells which devio was selected: it is the
>> +* index in the devios array above.
>>  */
>> -   int (*probe)(odpdrv_device_t *dev);
>> +   int (*probe)(odpdrv_device_t dev, odpdrv_devio_t devio, int
>> devio_idx);
>>
>> /** unbind function:
>>  * Only called with devices whose probe() returned true
>> --
>> 2.7.4
>>
>


Re: [lng-odp] [API-NEXT PATCH 15/21] drv: adding driver remove function

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 23:56, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> The remove function, as for other driver items (such as enumeratos...) is
>
>
> Typo: enumerators

=> V2

>
>>
>> called before the driver is to be removed, i.e. after all devices have
>> been
>> been unboud from the driver. remove() should release any resource held
>
>
> unbound

=> V2

Christophe

>
>>
>> by the driver.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  include/odp/drv/spec/driver.h | 8 
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h
>> index 0b62c1b..221a6ce 100644
>> --- a/include/odp/drv/spec/driver.h
>> +++ b/include/odp/drv/spec/driver.h
>> @@ -336,6 +336,14 @@ struct odpdrv_driver_param_t {
>> int (*unbind)(odpdrv_device_t dev,
>>   void (*callback)(odpdrv_device_t dev),
>>   uint32_t flags);
>> +
>> +   /** remove function:
>> +* remove any resource taken by the driver. Called when the driver
>> +* itself is to be removed, i.e. after all devices are unbound
>> +* Can be set to NULL if the driver has nothing to release.
>> +*
>> +*/
>> +   int (*remove)(void);
>>  };
>>
>>  /** The callback function must be called mmediately by the current ODP
>> thread */
>> --
>> 2.7.4
>>
>


Re: [lng-odp] [API-NEXT PATCH 13/21] linux-gen: drv: devio registration

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 23:54, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> devios (dev IO) provide a interface for drivers to access a device:
>> Devices enumerated by enumerators may be accessed in by different
>> mechanisms (depending on iommu presence or other factors). This extra
>> abstraction is provided by devios, which provide a sets of methods to
>> access the devices of a given type (i.e. registred enumerator(s)
>> enumerating devices of the same kind (e.g. PCI)).
>> This patch just implements the devio registration method provided by the
>> driver API.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  platform/linux-generic/drv_driver.c | 134
>> +++-
>>  1 file changed, 131 insertions(+), 3 deletions(-)
>>
>> diff --git a/platform/linux-generic/drv_driver.c
>> b/platform/linux-generic/drv_driver.c
>> index 517a3c6..eb0dc48 100644
>> --- a/platform/linux-generic/drv_driver.c
>> +++ b/platform/linux-generic/drv_driver.c
>> @@ -28,6 +28,7 @@ static _odp_ishm_pool_t *list_elt_pool;
>>  typedef struct _odpdrv_enumr_class_s _odpdrv_enumr_class_t;
>>  typedef struct _odpdrv_enumr_s _odpdrv_enumr_t;
>>  typedef struct _odpdrv_device_s _odpdrv_device_t;
>> +typedef struct _odpdrv_devio_s _odpdrv_devio_t;
>>
>>  /* an enumerator class (list element) */
>>  struct _odpdrv_enumr_class_s {
>> @@ -72,6 +73,20 @@ typedef struct _odpdrv_device_lst_t {
>>  } _odpdrv_device_lst_t;
>>  static struct _odpdrv_device_lst_t device_lst;
>>
>> +/* a devio (list element) */
>> +struct _odpdrv_devio_s {
>> +   odpdrv_devio_param_t param;
>> +   _odp_ishm_pool_t *pool;
>> +   struct _odpdrv_devio_s *next;
>> +} _odpdrv_devio_s;
>> +
>> +/* the devio list: */
>> +typedef struct _odpdrv_devio_lst_t {
>> +   odp_rwlock_recursive_t lock;
>> +   _odpdrv_devio_t *head;
>> +} _odpdrv_devio_lst_t;
>> +static struct _odpdrv_devio_lst_t devio_lst;
>> +
>>  /* some driver elements (such as enumeraor classes, drivers, devio) may
>>   * register before init_global and init_local complete. Mutex will fail
>>   * in this cases but should be used later on.
>> @@ -149,6 +164,30 @@ static void dev_list_write_unlock(void)
>> odp_rwlock_recursive_write_unlock(_lst.lock);
>>  }
>>
>> +static void devio_list_read_lock(void)
>> +{
>> +   if (init_global_status == DONE)
>
>
> Same comment on the need for these guards.

same answer :-)

>
>>
>> +   odp_rwlock_recursive_read_lock(_lst.lock);
>> +}
>> +
>> +static void devio_list_read_unlock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_read_unlock(_lst.lock);
>> +}
>> +
>> +static void devio_list_write_lock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_write_lock(_lst.lock);
>> +}
>> +
>> +static void devio_list_write_unlock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_write_unlock(_lst.lock);
>> +}
>> +
>>  odpdrv_enumr_class_t
>> odpdrv_enumr_class_register(odpdrv_enumr_class_param_t
>>  *param)
>>  {
>> @@ -415,10 +454,65 @@ odpdrv_device_t *odpdrv_device_query(odpdrv_enumr_t
>> enumr, const char *address)
>>
>>  odpdrv_devio_t odpdrv_devio_register(odpdrv_devio_param_t *param)
>>  {
>> -   ODP_ERR("NOT Supported yet! Driver %s Registration!\n.",
>> -   param->api_name);
>> +   _odpdrv_devio_t *devio;
>> +
>> +   /* parse the list of already registered devios to make
>> +* sure no devio providing the same interface using th esame
>> enumerator
>> +* already exists:
>> +*/
>> +   devio_list_read_lock();
>> +   devio = devio_lst.head;
>
>
> Same comment on needing to initialize the head field (should be done at init
> time along with the lock).

same answer :-)

>
>>
>> +   while (devio) {
>> +   if ((strncmp(param->api_name, devio->param.api_name,
>> +ODPDRV_NAME_SIZE) == 0) &&
>> +   (strncmp(param->enumr_api_name,
>> devio->param.enumr_api_name,
>> +ODPDRV_NAME_SIZE) == 0)) {
>> +   ODP_ERR("a devio providing interface '%s' for
>> devices "
>> +   "of type '%s' is already registered\n!",
>> +   param->api_name, param->enumr_api_name);
>> +   devio_list_read_unlock();
>> +   return ODPDRV_DEVIO_INVALID;
>> +   }
>> +   devio = devio->next;
>> +   }
>> +   devio_list_read_unlock();
>>
>> -   return ODPDRV_DEVIO_INVALID;
>> +   /* allocate memory for the new devio:
>> +* If init_global has not been done yet, then, we cannot allocate
>> +* from any _ishm pool (ishm has not 

Re: [lng-odp] [API-NEXT PATCH 11/21] test: drv: device creation and destruction

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 23:40, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> Testing that devices can be created and removed from ODP.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  .../validation/drv/drvdriver/.gitignore|   1 +
>>  .../validation/drv/drvdriver/Makefile.am   |  11 ++
>>  .../validation/drv/drvdriver/drvdriver_device.c| 218
>> +
>>  .../validation/drv/drvdriver/drvdriver_device.h|  24 +++
>>  .../drv/drvdriver/drvdriver_device_main.c  |  12 ++
>>  test/linux-generic/Makefile.am |   1 +
>>  6 files changed, 267 insertions(+)
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_device.c
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_device.h
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_device_main.c
>>
>> diff --git a/test/common_plat/validation/drv/drvdriver/.gitignore
>> b/test/common_plat/validation/drv/drvdriver/.gitignore
>> index a842448..97b4312 100644
>> --- a/test/common_plat/validation/drv/drvdriver/.gitignore
>> +++ b/test/common_plat/validation/drv/drvdriver/.gitignore
>> @@ -1,2 +1,3 @@
>>  drvdriver_enumr_class_main
>>  drvdriver_enumr_main
>> +drvdriver_device_main
>> diff --git a/test/common_plat/validation/drv/drvdriver/Makefile.am
>> b/test/common_plat/validation/drv/drvdriver/Makefile.am
>> index 3476c50..544586c 100644
>> --- a/test/common_plat/validation/drv/drvdriver/Makefile.am
>> +++ b/test/common_plat/validation/drv/drvdriver/Makefile.am
>> @@ -25,3 +25,14 @@ drvdriver_enumr_main_LDADD = libtestdrvdriverenumr.la \
>>$(LIBCUNIT_COMMON) $(LIBODP)
>>
>>  EXTRA_DIST += drvdriver_enumr.h
>> +
>> +#tests for device creation:
>> +noinst_LTLIBRARIES += libtestdrvdriverdevice.la
>> +libtestdrvdriverdevice_la_SOURCES = drvdriver_device.c
>> +
>> +test_PROGRAMS += drvdriver_device_main$(EXEEXT)
>> +dist_drvdriver_device_main_SOURCES = drvdriver_device_main.c
>> +drvdriver_device_main_LDADD = libtestdrvdriverdevice.la \
>> +  $(LIBCUNIT_COMMON) $(LIBODP)
>> +
>> +EXTRA_DIST += drvdriver_device.h
>> diff --git a/test/common_plat/validation/drv/drvdriver/drvdriver_device.c
>> b/test/common_plat/validation/drv/drvdriver/drvdriver_device.c
>> new file mode 100644
>> index 000..9254e17
>> --- /dev/null
>> +++ b/test/common_plat/validation/drv/drvdriver/drvdriver_device.c
>> @@ -0,0 +1,218 @@
>> +/* Copyright (c) 2017, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier: BSD-3-Clause
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include "drvdriver_device.h"
>> +#include 
>> +
>> +static odp_instance_t odp_instance;
>> +static odpdrv_enumr_class_t enumr_class1;
>> +static odpdrv_enumr_t enumr1;
>> +
>> +typedef struct dev_enumr_data_t { /* enumerator data for registered
>> devices */
>> +   odpdrv_shm_tshm_handle;
>> +   int device_number;
>> +} dev_enumr_data_t;
>> +
>> +#define NB_DEVICES 5
>> +
>> +/* forward declaration */
>> +static int enumr1_probe(void);
>> +static int enumr1_remove(void);
>> +static int enumr_class1_probe(void);
>> +static int enumr_class1_remove(void);
>> +
>> +/* because many things to be checked are performed during ODP
>> initialisation,
>> + * the initialisation functions have to be a part of the test
>> + */
>> +static int tests_global_init(void)
>> +{
>> +   if (0 != odp_init_global(_instance, NULL, NULL)) {
>> +   fprintf(stderr, "error: odp_init_global() failed.\n");
>> +   return -1;
>> +   }
>> +   if (0 != odp_init_local(odp_instance, ODP_THREAD_CONTROL)) {
>> +   fprintf(stderr, "error: odp_init_local() failed.\n");
>> +   return -1;
>> +   }
>> +
>> +   return 0;
>> +}
>> +
>> +static int tests_global_term(void)
>> +{
>> +   if (0 != odp_term_local()) {
>> +   fprintf(stderr, "error: odp_term_local() failed.\n");
>> +   return -1;
>> +   }
>> +
>> +   if (0 != odp_term_global(odp_instance)) {
>> +   fprintf(stderr, "error: odp_term_global() failed.\n");
>> +   return -1;
>> +   }
>> +
>> +   return 0;
>> +}
>> +
>> +/*enumerator register functions */
>> +static odpdrv_enumr_t enumr1_register(void)
>> +{
>> +   odpdrv_enumr_param_t param = {
>> +   .enumr_class = enumr_class1,
>> +   .api_name = "Enumerator_interface_1",
>> +   .api_version = 1,
>> +   .probe = enumr1_probe,
>> +   .remove = enumr1_remove,
>> +   .register_notifier = NULL
>> +   };
>> +
>> +   enumr1 = odpdrv_enumr_register();
>> +   return enumr1;
>> +}
>> +
>> +/*enumerator probe functions, just making sure they have 

Re: [lng-odp] [PATCH v2 3/5] linux-gen: packet: packet handle is hdr pointer

2017-02-27 Thread Maxim Uvarov
that commit broke IPC:
--enable-pktio_ipc-support

Maxim.

On 02/08/17 15:17, Petri Savolainen wrote:
> Changed packet handle (odp_packet_t) to store pointer to the packet
> header, instead a bit field structure of pool and index. Buffer and
> event handles are not changed.
> 
> Pointer as handle improves packet accessor function performance and
> enable accessor function inlining as mapping to pool/index is not needed.
> 
> Signed-off-by: Petri Savolainen 
> ---
>  .../include/odp/api/plat/packet_types.h|   2 +-
>  .../linux-generic/include/odp_packet_internal.h|   2 +-
>  platform/linux-generic/odp_packet.c| 163 
> -
>  3 files changed, 96 insertions(+), 71 deletions(-)
> 
> 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 34e5dd8..999130e 100644
> --- a/platform/linux-generic/include/odp/api/plat/packet_types.h
> +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h
> @@ -32,7 +32,7 @@ extern "C" {
>  
>  typedef ODP_HANDLE_T(odp_packet_t);
>  
> -#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0x)
> +#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0)
>  
>  #define ODP_PACKET_OFFSET_INVALID (0x0fff)
>  
> diff --git a/platform/linux-generic/include/odp_packet_internal.h 
> b/platform/linux-generic/include/odp_packet_internal.h
> index e3ada5c..499f8df 100644
> --- a/platform/linux-generic/include/odp_packet_internal.h
> +++ b/platform/linux-generic/include/odp_packet_internal.h
> @@ -209,7 +209,7 @@ typedef struct {
>   */
>  static inline odp_packet_hdr_t *odp_packet_hdr(odp_packet_t pkt)
>  {
> - return (odp_packet_hdr_t *)buf_hdl_to_hdr((odp_buffer_t)pkt);
> + return (odp_packet_hdr_t *)(uintptr_t)pkt;
>  }
>  
>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
> diff --git a/platform/linux-generic/odp_packet.c 
> b/platform/linux-generic/odp_packet.c
> index 024f694..9a8c112 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -23,9 +23,14 @@
>  /* Initial packet segment data length */
>  #define BASE_LEN  CONFIG_PACKET_MAX_SEG_LEN
>  
> +static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt)
> +{
> + return (odp_packet_hdr_t *)(uintptr_t)pkt;
> +}
> +
>  static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
>  {
> - return (odp_packet_t)pkt_hdr->buf_hdr.handle.handle;
> + return (odp_packet_t)pkt_hdr;
>  }
>  
>  static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
> @@ -33,6 +38,11 @@ static inline odp_buffer_t buffer_handle(odp_packet_hdr_t 
> *pkt_hdr)
>   return pkt_hdr->buf_hdr.handle.handle;
>  }
>  
> +static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf)
> +{
> + return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
> +}
> +
>  static inline uint32_t packet_seg_len(odp_packet_hdr_t *pkt_hdr,
> uint32_t seg_idx)
>  {
> @@ -485,8 +495,8 @@ static inline int packet_alloc(pool_t *pool, uint32_t 
> len, int max_pkt,
>   odp_packet_hdr_t *hdr;
>  
>   /* First buffer is the packet descriptor */
> - pkt[i] = (odp_packet_t)buf[i * num_seg];
>   hdr= pkt_hdr[i * num_seg];
> + pkt[i] = packet_handle(hdr);
>   init_segments(_hdr[i * num_seg], num_seg);
>  
>   packet_init(hdr, len, parse);
> @@ -552,11 +562,13 @@ int odp_packet_alloc_multi(odp_pool_t pool_hdl, 
> uint32_t len,
>  
>  void odp_packet_free(odp_packet_t pkt)
>  {
> - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
> + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
> + odp_buffer_t hdl = buffer_handle(pkt_hdr);
> +
>   int num_seg = pkt_hdr->buf_hdr.segcount;
>  
>   if (odp_likely(CONFIG_PACKET_MAX_SEGS == 1 || num_seg == 1))
> - buffer_free_multi((odp_buffer_t *), 1);
> + buffer_free_multi(, 1);
>   else
>   free_bufs(pkt_hdr, 0, num_seg);
>  }
> @@ -571,11 +583,11 @@ void odp_packet_free_multi(const odp_packet_t pkt[], 
> int num)
>   int bufs = 0;
>  
>   for (i = 0; i < num; i++) {
> - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt[i]);
> + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt[i]);
>   int num_seg = pkt_hdr->buf_hdr.segcount;
>   odp_buffer_hdr_t *buf_hdr = _hdr->buf_hdr;
>  
> - buf[bufs] = (odp_buffer_t)pkt[i];
> + buf[bufs] = buffer_handle(pkt_hdr);
>   bufs++;
>  
>   if (odp_likely(num_seg == 1))
> @@ -593,7 +605,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int 
> num)
>  
>  int odp_packet_reset(odp_packet_t pkt, uint32_t len)
>  {
> - odp_packet_hdr_t *const pkt_hdr = 

Re: [lng-odp] [API-NEXT PATCH 2/4] api: deprecated: add ODP_DEPRECATED configure option

2017-02-27 Thread Savolainen, Petri (Nokia - FI/Espoo)
> > /**
> >  * Deprecated API definitions
> >  *
> >  * Some API definitions may be deprecated by this or a previous API
> version.
> >  * This macro controls if those are enabled (and visible to the
> application)
> >  * or disabled.
> >  *
> >  * * 0: Deprecated API definitions are disabled
> >  * * 1: Deprecated API definitions are enabled
> >  */
> > #define ODP_DEPRECATED 0
> >
> > If an implementation does not use autotools, it may generate the same
> deprecated.h file with the same content anyway it likes (or hard code the
> file into the repo).
> 
> I disagree strongly.  Such API header files should contain pure C
> code, and not anything that requires the file to be run through
> autoconf or for people to maintain their own set of API header files.
> Things like @ODP_VERSION_API_GENERATION@ can be defined to a real
> concrete value.  Things like ODP_DEPRECATED can also be defined to a
> real value .. conditional on the compiler identification macro.

This is not far from other values being implementation specific. For example, 
the API spec defines that there is ODP_QUEUE_INVALID defined, but does not 
dictate the value (an ABI spec does when building for ABI compat). An 
implementation needs to make sure that application sees the macro through 
odp_api.h. So, it needs to have a (build) mechanism for that.

Similarly, API spec defines that ODP_DEPRECATED has value of 1, when deprecated 
APIs are present. Implementation needs to make that definition visible 
(somehow) through odp_api.h, when those APIs are enabled. Currently, in 
odp-linux, we use automake for that.


> 
> >
> > Second, this patch does not take any position how long a deprecated API
> remains there. The patch enables application build *with* or *without*
> deprecated APIs, so that it's easy to verify if deprecated APIs are
> (still) used in application or not. For example, I missed couple of those
> in IPSEC example app porting previously, but now with this option those
> were caught.
> 
> I am confused again. Use of the compiler's support for "deprecated"
> will cause a warning to be emitted if application code is still
> written to use said deprecated APIs.  Are you saying this is not good
> enough?  Or, are you trying to create a way to still support some idea
> of "deprecated" in the case that there is no support from the
> compiler?

It's not good enough, and it depends on an non-standard compiler feature when 
that dependency is not absolutely mandatory for what we are trying to achieve.

1) New API version. Some definition is now deprecated.
2) By default, --enable-deprecated=no. Old definitions are #ifdef'ed away. 
Application build fails if it still uses a deprecated definition.
3.1) Update the application to use new API definitions. This gives best 
performance, OR ...
3.2) Don't change application this time, but build it with 
--enable-deprecated=yes. Application builds, but may suffer from lower 
performance as implementation needs to include both code path the old and the 
new. The "new API" is now the default code path. The "old API" is likely to be 
less used/tested/supported - it will be removed soon anyway.
4) New API version. The deprecated definition (deprecated in 1) above) may be 
now removed for good. All application need to upgrade. Implementation may 
delete the #ifdef'ed old code path.


I think this is #if ODP_DEPRECATED is simple and strong way to enforce 
deprecation in API ...

+#if ODP_DEPRECATED
/** @deprecated  Use aes_cbc instead */
uint32_t aes128_cbc  : 1;
 
/** @deprecated  Use aes_gcm instead */
uint32_t aes128_gcm  : 1;
+#endif


... and gives implementation chance to optimize for the new API (the new 
default).


+#if ODP_DEPRECATED
case ODP_AUTH_ALG_AES128_GCM:
+   if (param->cipher_alg == ODP_CIPHER_ALG_AES128_GCM)
+   aes_gcm = 1;
+   /* Fallthrough */
+#endif
+   case ODP_AUTH_ALG_AES_GCM:
/* AES-GCM requires to do both auth and
 * cipher at the same time */
-   if (param->cipher_alg == ODP_CIPHER_ALG_AES_GCM ||
-   param->cipher_alg == ODP_CIPHER_ALG_AES128_GCM) {
+   if (param->cipher_alg == ODP_CIPHER_ALG_AES_GCM || aes_gcm) {
session->auth.func = null_crypto_routine;

In this example above, #if ODP_DEPRECATED allows implementation to do if(x == y 
|| 0), instead of if(x == y || x == z). Effectively, one compare instead of two.

I think it's better to clearly select: either deprecated APIs are enabled or 
disabled. So, that both application and implementation know which spec is used 
(the old or the new).

-Petri




Re: [lng-odp] [API-NEXT PATCH 10/21] linux-gen: drv: driver: adding device querry function

2017-02-27 Thread Christophe Milard
hmmm,
Sure it is applicable here, but while most function using this
strategy would be happy to have some part of the job done, this one
won't:
for instance: receiving N packets always makes sense, even if M>N
packet are waiting to be received.
In this case, getting half of an anwer does not really make sense...
But I see your point regarding allocation.
Didn't we say that libC was always supported (hence malloc).
There is no need for speed here...

Christophe

On 22 February 2017 at 23:38, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> Implementation of the device query function for the linux-gen ODP.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  platform/linux-generic/drv_driver.c | 37
>> +
>>  1 file changed, 37 insertions(+)
>>
>> diff --git a/platform/linux-generic/drv_driver.c
>> b/platform/linux-generic/drv_driver.c
>> index 48a90a2..517a3c6 100644
>> --- a/platform/linux-generic/drv_driver.c
>> +++ b/platform/linux-generic/drv_driver.c
>> @@ -376,6 +376,43 @@ static void device_destroy_terminate(odpdrv_device_t
>> drv_device)
>> _odp_ishm_pool_free(list_elt_pool, device);
>>  }
>>
>> +odpdrv_device_t *odpdrv_device_query(odpdrv_enumr_t enumr, const char
>> *address)
>> +{
>> +   _odpdrv_device_t *dev;
>> +   odpdrv_device_t *res;
>> +   int index = 0;
>> +
>> +   int size = sizeof(odpdrv_device_t); /* for the
>> ODPDRV_DEVICE_INVALID */
>> +
>> +   /* parse the list of device a first time to determine the size of
>> +* the memory to be allocated:
>> +*/
>> +   dev_list_read_lock();
>> +   dev = device_lst.head;
>> +   while (dev) {
>> +   if ((dev->param.enumerator == enumr) &&
>> +   ((address == NULL) ||
>> +(strcmp(dev->param.address, address) == 0)))
>> +   size += sizeof(odpdrv_device_t);
>> +   dev = dev->next;
>> +   }
>> +
>> +   /* then fill the list: */
>> +   res = (odpdrv_device_t *)malloc(size);
>> +   dev = device_lst.head;
>> +   while (dev) {
>> +   if ((dev->param.enumerator == enumr) &&
>> +   ((address == NULL) ||
>> +(strcmp(dev->param.address, address) == 0)))
>> +   res[index++] = (odpdrv_device_t)dev;
>> +   dev = dev->next;
>> +   }
>> +   dev_list_read_unlock();
>> +   res[index++] = ODPDRV_DEVICE_INVALID;
>> +
>> +   return res; /* must be freed by caller! */
>
>
> Most other ODP APIs that return a variable-number of return parameters have
> the caller supply a return array and size and the routine fills that in and
> returns the number of elements returned. Why is that model not suitable
> here? The concern about doing malloc() calls within ODP code is that
> constrains the caller as to the memory model being used. If the caller
> supplies the return array then it can obtain that memory from wherever it
> wishes.
>
>>
>> +}
>> +
>>  odpdrv_devio_t odpdrv_devio_register(odpdrv_devio_param_t *param)
>>  {
>> ODP_ERR("NOT Supported yet! Driver %s Registration!\n.",
>> --
>> 2.7.4
>>
>


Re: [lng-odp] [PATCH] api: ipsec: make IPSEC protocol consistent with other types

2017-02-27 Thread Andriy Berestovskyy

Oops, sorry.
Shall I resend the patch then?

Andriy

On 27.02.2017 13:55, Bill Fischofer wrote:

Thanks Andriy,

Please note that all API changes should specify
--subject-prefix="API-NEXT PATCH" as we use the api-next branch to
accumulate all API changes.

On Mon, Feb 27, 2017 at 5:24 AM, Andriy Berestovskyy
>
wrote:

- rename odp_ipsec_protocol_t to odp_ipsec_proto_t
- rename ODP_IPSEC_AH to ODP_IPSEC_PROTO_AH
- rename ODP_IPSEC_ESP to ODP_IPSEC_PROTO_ESP

Signed-off-by: Andriy Berestovskyy >
---
 include/odp/api/spec/ipsec.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 66222d8..793e317 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -140,14 +140,14 @@ typedef enum odp_ipsec_mode_t {
 /**
  * IPSEC protocol
  */
-typedef enum odp_ipsec_protocol_t {
+typedef enum odp_ipsec_proto_t {
/** ESP protocol */
-   ODP_IPSEC_ESP = 0,
+   ODP_IPSEC_PROTO_ESP = 0,

/** AH protocol */
-   ODP_IPSEC_AH
+   ODP_IPSEC_PROTO_AH

-} odp_ipsec_protocol_t;
+} odp_ipsec_proto_t;

 /**
  * IPSEC tunnel type
@@ -362,7 +362,7 @@ typedef struct odp_ipsec_sa_param_t {
odp_ipsec_dir_t dir;

/** IPSEC protocol: ESP or AH */
-   odp_ipsec_protocol_t proto;
+   odp_ipsec_proto_t proto;

/** IPSEC protocol mode: transport or tunnel */
odp_ipsec_mode_t mode;
--
2.7.4




Re: [lng-odp] [API-NEXT PATCH 08/21] linux-gen: drv: device creation and deletion

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 23:28, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> Functions to create and remove devices are populated to do
>> more proper things.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  platform/linux-generic/drv_driver.c | 172
>> ++--
>>  1 file changed, 164 insertions(+), 8 deletions(-)
>>
>> diff --git a/platform/linux-generic/drv_driver.c
>> b/platform/linux-generic/drv_driver.c
>> index f8844f5..48a90a2 100644
>> --- a/platform/linux-generic/drv_driver.c
>> +++ b/platform/linux-generic/drv_driver.c
>> @@ -19,12 +19,15 @@
>>
>>  static enum {UNDONE, IN_PROGRESS, DONE} init_global_status;
>>
>> +static void device_destroy_terminate(odpdrv_device_t device);
>> +
>>  /* pool from which different list elements are alocated: */
>>  #define ELT_POOL_SIZE (1 << 20)  /* 1Mb */
>>  static _odp_ishm_pool_t *list_elt_pool;
>>
>>  typedef struct _odpdrv_enumr_class_s _odpdrv_enumr_class_t;
>>  typedef struct _odpdrv_enumr_s _odpdrv_enumr_t;
>> +typedef struct _odpdrv_device_s _odpdrv_device_t;
>>
>>  /* an enumerator class (list element) */
>>  struct _odpdrv_enumr_class_s {
>> @@ -55,6 +58,20 @@ typedef struct _odpdrv_enumr_lst_t {
>>  } _odpdrv_enumr_lst_t;
>>  static struct _odpdrv_enumr_lst_t enumr_lst;
>>
>> +/* a device (list element) */
>> +struct _odpdrv_device_s {
>> +   odpdrv_device_param_t param;
>> +   void (*enumr_destroy_callback)(void *enum_dev);/*dev destroy
>> callback */
>> +   struct _odpdrv_device_s *next;
>> +} _odpdrv_device_s;
>> +
>> +/* the device list (all devices, from all enumerators): */
>> +typedef struct _odpdrv_device_lst_t {
>> +   odp_rwlock_recursive_t lock;
>> +   _odpdrv_device_t *head;
>> +} _odpdrv_device_lst_t;
>> +static struct _odpdrv_device_lst_t device_lst;
>> +
>>  /* some driver elements (such as enumeraor classes, drivers, devio) may
>>   * register before init_global and init_local complete. Mutex will fail
>>   * in this cases but should be used later on.
>> @@ -108,6 +125,30 @@ static void enumr_list_write_unlock(void)
>> odp_rwlock_recursive_write_unlock(_lst.lock);
>>  }
>>
>> +static void dev_list_read_lock(void)
>> +{
>> +   if (init_global_status == DONE)
>
>
> Same comment as for earlier locking routines regarding the necessity of
> these guards.

Hope my previous answer made that clear :-)

>
>>
>> +   odp_rwlock_recursive_read_lock(_lst.lock);
>> +}
>> +
>> +static void dev_list_read_unlock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_read_unlock(_lst.lock);
>> +}
>> +
>> +static void dev_list_write_lock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_write_lock(_lst.lock);
>> +}
>> +
>> +static void dev_list_write_unlock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_write_unlock(_lst.lock);
>> +}
>> +
>>  odpdrv_enumr_class_t
>> odpdrv_enumr_class_register(odpdrv_enumr_class_param_t
>>  *param)
>>  {
>> @@ -222,24 +263,119 @@ odpdrv_enumr_t
>> odpdrv_enumr_register(odpdrv_enumr_param_t *param)
>>
>>  odpdrv_device_t odpdrv_device_create(odpdrv_device_param_t *param)
>>  {
>> -   ODP_ERR("odpdrv_device_create not Supported yet! devaddress:
>> %s\n.",
>> -   param->address);
>> -   return ODPDRV_DEVICE_INVALID;
>> +   _odpdrv_device_t *dev;
>> +
>> +   /* If init_global has not been done yet, we have a big issue. */
>> +   if (init_global_status == UNDONE)
>> +   return ODPDRV_DEVICE_INVALID;
>> +
>> +   /* make sure that the provided device address does not already
>> exist: */
>> +   dev_list_read_lock();
>> +   dev = device_lst.head;
>
>
> Same question as for other lists. Where is the head field initialized? This
> should be done in the init routine along with lock initialization.

hope my previous answer made that clear

Christophe

>
>>
>> +   while (dev) {
>> +   if (strcmp(param->address, dev->param.address) == 0) {
>> +   ODP_ERR("device already exists!\n");
>> +   dev_list_read_unlock();
>> +   return ODPDRV_DEVICE_INVALID;
>> +   }
>> +   dev = dev->next;
>> +   }
>> +   dev_list_read_unlock();
>> +
>> +   dev = _odp_ishm_pool_alloc(list_elt_pool,
>> +  sizeof(_odpdrv_device_t));
>> +   if (!dev) {
>> +   ODP_ERR("_odp_ishm_pool_alloc failed!\n");
>> +   return ODPDRV_DEVICE_INVALID;
>> +   }
>> +
>> +   /* save and set dev init parameters and insert new device in list
>> */
>> +   dev->param = *param;
>> +   dev->enumr_destroy_callback = NULL;
>> +   

Re: [lng-odp] [API-NEXT PATCH 07/21] drv: driver: add callback function for device destruction

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 23:20, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> When a device is destroyed by an enumerator, odpdrv_device_destroy() is
>> called.
>> However, the complete device destruction may require waiting for IO to be
>> completed: the device destruction is therefore divided in 2 steps:
>> odpdrv_device_destroy() starts the device destruction, and the provided
>> callback function is called when the device can be fully removed, i.e.
>> when it no longer has any driver bound to it.
>> An extra flag is also added to select the destruction type:
>> The default is a graceful destruction, letting the time for any attached
>> driver to terminate. This may imply that the callback function is called
>> from another ODP thread, later on.
>> ODPDRV_DEV_DESTROY_IMMEDIATE forces an immediate device destruction,
>> possibly terminating things abrubtly, but it guarantees that the
>> callback is performed by the same ODP thread. This is to be used at ODP
>> terminaison time.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  include/odp/drv/spec/driver.h   | 31 +++
>>  platform/linux-generic/drv_driver.c |  9 -
>>  2 files changed, 35 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h
>> index a978d12..21a5fe1 100644
>> --- a/include/odp/drv/spec/driver.h
>> +++ b/include/odp/drv/spec/driver.h
>> @@ -357,12 +357,35 @@ odpdrv_device_t
>> odpdrv_device_create(odpdrv_device_param_t *param);
>>
>>  /**
>>  * Destroy a device
>> -* Called by each enumerator at probe time, or anytime later, for each
>> -* destroyed created device
>> +* Called by each enumerator after probe time, for each device to be
>> +* destroyed.
>> +* Destroying a device may require tearing down a driver and waiting for
>> some IO
>> +* to terminate: The device destruction is therefore done in 2 steps:
>> +* Calling this function starts the device destruction: when the device
>> has
>> +* no driver attached any longer, ODP calls the provided callback()
>> +* function  which should free the enumerator-allocated resources for
>> +* this device.
>> +* If the flag ODPDRV_DEV_DESTROY_IMMEDIATE is given, the device
>> destruction
>> +* is immediate, i.e. the callback function is guaranteed to be called by
>> the
>> +* same ODP thread: This might however not let the time for the bound
>> driver
>> +* (if any) to terminate gracefully. This would typically be used at ODP
>> +* terminaison. By default, the callback may be called later, when the
>> driver
>
>
> Typo: termination

=> V2

Christophe

>
>>
>> +* has gracefully terminated, hence possibly from another ODP thread.
>>  * @param dev A odpdrv device handle as returned by odpdrv_device_create.
>> -* @return 0 on success or a negative value on error.
>> +* @param callback a pointer to a function to be called when the device is
>> +*freed (no more driver). The parameter to the callback function
>> is
>> +*   the pointer to the enumerator specific part of the device as
>> provided
>> +*   at device creation time (void *enum_dev). The callback function
>> +*   should release these resources.
>> +* @param flags 0 or ODPDRV_DEV_DESTROY_IMMEDIATE for immediate shut down
>> +* @return 0 on success or a negative value on error. On error, the
>> callback
>> +* function is not called.
>>  */
>> -void odpdrv_device_destroy(odpdrv_device_t dev);
>> +int odpdrv_device_destroy(odpdrv_device_t dev,
>> + void (*callback)(void *enum_dev), uint32_t
>> flags);
>> +
>> +/** The callback function must be called by the current ODP thread */
>> +#define ODPDRV_DEV_DESTROY_IMMEDIATE   0x0001
>>
>>  /**
>>  * Register an devio.
>> diff --git a/platform/linux-generic/drv_driver.c
>> b/platform/linux-generic/drv_driver.c
>> index ee0a75c..f8844f5 100644
>> --- a/platform/linux-generic/drv_driver.c
>> +++ b/platform/linux-generic/drv_driver.c
>> @@ -227,10 +227,17 @@ odpdrv_device_t
>> odpdrv_device_create(odpdrv_device_param_t *param)
>> return ODPDRV_DEVICE_INVALID;
>>  }
>>
>> -void odpdrv_device_destroy(odpdrv_device_t dev)
>> +int odpdrv_device_destroy(odpdrv_device_t dev,
>> + void (*callback)(void *enum_dev), uint32_t
>> flags)
>>  {
>> if (dev == ODPDRV_DEVICE_INVALID)
>> ODP_ERR("Invalid device\n");
>> +   if (callback != NULL)
>> +   ODP_ERR("Callback not supported yet\n");
>> +   if (flags != 0)
>> +   ODP_ERR("flags not supported yet\n");
>> +
>> +   return 0;
>>  }
>>
>>  odpdrv_devio_t odpdrv_devio_register(odpdrv_devio_param_t *param)
>> --
>> 2.7.4
>>
>


Re: [lng-odp] [PATCH] api: ipsec: make IPSEC protocol consistent with other types

2017-02-27 Thread Bill Fischofer
Thanks Andriy,

Please note that all API changes should specify --subject-prefix="API-NEXT
PATCH" as we use the api-next branch to accumulate all API changes.

On Mon, Feb 27, 2017 at 5:24 AM, Andriy Berestovskyy <
andriy.berestovs...@cavium.com> wrote:

> - rename odp_ipsec_protocol_t to odp_ipsec_proto_t
> - rename ODP_IPSEC_AH to ODP_IPSEC_PROTO_AH
> - rename ODP_IPSEC_ESP to ODP_IPSEC_PROTO_ESP
>
> Signed-off-by: Andriy Berestovskyy 
> ---
>  include/odp/api/spec/ipsec.h | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
> index 66222d8..793e317 100644
> --- a/include/odp/api/spec/ipsec.h
> +++ b/include/odp/api/spec/ipsec.h
> @@ -140,14 +140,14 @@ typedef enum odp_ipsec_mode_t {
>  /**
>   * IPSEC protocol
>   */
> -typedef enum odp_ipsec_protocol_t {
> +typedef enum odp_ipsec_proto_t {
> /** ESP protocol */
> -   ODP_IPSEC_ESP = 0,
> +   ODP_IPSEC_PROTO_ESP = 0,
>
> /** AH protocol */
> -   ODP_IPSEC_AH
> +   ODP_IPSEC_PROTO_AH
>
> -} odp_ipsec_protocol_t;
> +} odp_ipsec_proto_t;
>
>  /**
>   * IPSEC tunnel type
> @@ -362,7 +362,7 @@ typedef struct odp_ipsec_sa_param_t {
> odp_ipsec_dir_t dir;
>
> /** IPSEC protocol: ESP or AH */
> -   odp_ipsec_protocol_t proto;
> +   odp_ipsec_proto_t proto;
>
> /** IPSEC protocol mode: transport or tunnel */
> odp_ipsec_mode_t mode;
> --
> 2.7.4
>
>


[lng-odp] [PATCH v3 1/3] linux-gen: dpdk: improve pmd driver linking

2017-02-27 Thread Matias Elo
Previously each dpdk pmd driver had to be individually referred in the odp
code to ensure proper gcc constructor linking. Using the -—whole-archive
option when linking the drivers removes this need. After this patch new
dpdk pmd drivers are automatically linked.

Signed-off-by: Matias Elo 
---
 platform/linux-generic/m4/odp_dpdk.m4 |  33 +---
 platform/linux-generic/pktio/dpdk.c   | 152 +-
 2 files changed, 22 insertions(+), 163 deletions(-)

diff --git a/platform/linux-generic/m4/odp_dpdk.m4 
b/platform/linux-generic/m4/odp_dpdk.m4
index 30347dc..58d1472 100644
--- a/platform/linux-generic/m4/odp_dpdk.m4
+++ b/platform/linux-generic/m4/odp_dpdk.m4
@@ -2,22 +2,10 @@
 # Enable DPDK support
 ##
 pktio_dpdk_support=no
-AC_ARG_ENABLE([dpdk_support],
-[  --enable-dpdk-support  include dpdk IO support],
-[if test x$enableval = xyes; then
-pktio_dpdk_support=yes
-fi])
-
-##
-# Set optional DPDK path
-##
 AC_ARG_WITH([dpdk-path],
-AC_HELP_STRING([--with-dpdk-path=DIR   path to dpdk build directory],
-   [(or in the default path if not specified).]),
+AC_HELP_STRING([--with-dpdk-path=DIR   path to dpdk build directory]),
 [DPDK_PATH=$withval
 AM_CPPFLAGS="$AM_CPPFLAGS -msse4.2 -isystem $DPDK_PATH/include"
-AM_LDFLAGS="$AM_LDFLAGS -L$DPDK_PATH/lib"
-LIBS="$LIBS -ldpdk -ldl -lpcap"
 pktio_dpdk_support=yes],[])
 
 ##
@@ -28,12 +16,31 @@ CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
 
 ##
 # Check for DPDK availability
+#
+# DPDK pmd drivers are not linked unless the --whole-archive option is
+# used. No spaces are allowed between the --whole-arhive flags.
 ##
 if test x$pktio_dpdk_support = xyes
 then
 AC_CHECK_HEADERS([rte_config.h], [],
 [AC_MSG_FAILURE(["can't find DPDK header"])])
+
+DPDK_PMD=--whole-archive,
+for filename in $with_dpdk_path/lib/*.a; do
+cur_driver=`echo $(basename "$filename" .a) | \
+sed -n 's/^\(librte_pmd_\)/-lrte_pmd_/p' | sed -n 's/$/,/p'`
+# rte_pmd_nfp has external dependencies which break linking
+if test "$cur_driver" = "-lrte_pmd_nfp,"; then
+echo "skip linking rte_pmd_nfp"
+else
+DPDK_PMD+=$cur_driver
+fi
+done
+DPDK_PMD+=--no-whole-archive
+
 ODP_CFLAGS="$ODP_CFLAGS -DODP_PKTIO_DPDK"
+AM_LDFLAGS="$AM_LDFLAGS -L$DPDK_PATH/lib -Wl,$DPDK_PMD"
+LIBS="$LIBS -ldpdk -ldl -lpcap"
 else
 pktio_dpdk_support=no
 fi
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 1922109..6ac89bd 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -34,49 +34,6 @@ static int disable_pktio; /** !0 this pktio disabled, 0 
enabled */
 /* Has dpdk_pktio_init() been called */
 static odp_bool_t dpdk_initialized;
 
-#define PMD_EXT(drv) \
-extern void devinitfn_##drv(void)
-
-PMD_EXT(aesni_gcm_pmd_drv);
-PMD_EXT(cryptodev_aesni_mb_pmd_drv);
-PMD_EXT(cryptodev_kasumi_pmd_drv);
-PMD_EXT(cryptodev_null_pmd_drv);
-PMD_EXT(cryptodev_snow3g_pmd_drv);
-PMD_EXT(pmd_qat_drv);
-PMD_EXT(pmd_af_packet_drv);
-PMD_EXT(rte_bnx2x_driver);
-PMD_EXT(rte_bnx2xvf_driver);
-PMD_EXT(bnxt_pmd_drv);
-PMD_EXT(bond_drv);
-PMD_EXT(rte_cxgbe_driver);
-PMD_EXT(em_pmd_drv);
-PMD_EXT(pmd_igb_drv);
-PMD_EXT(pmd_igbvf_drv);
-PMD_EXT(ena_pmd_drv);
-PMD_EXT(rte_enic_driver);
-PMD_EXT(rte_fm10k_driver);
-PMD_EXT(rte_i40e_driver);
-PMD_EXT(rte_i40evf_driver);
-PMD_EXT(rte_ixgbe_driver);
-PMD_EXT(rte_ixgbevf_driver);
-PMD_EXT(rte_mlx4_driver);
-PMD_EXT(rte_mlx5_driver);
-PMD_EXT(pmd_mpipe_xgbe_drv);
-PMD_EXT(pmd_mpipe_gbe_drv);
-PMD_EXT(rte_nfp_net_driver);
-PMD_EXT(pmd_null_drv);
-PMD_EXT(pmd_pcap_drv);
-PMD_EXT(rte_qede_driver);
-PMD_EXT(rte_qedevf_driver);
-PMD_EXT(pmd_ring_drv);
-PMD_EXT(pmd_szedata2_drv);
-PMD_EXT(rte_nicvf_driver);
-PMD_EXT(pmd_vhost_drv);
-PMD_EXT(rte_virtio_driver);
-PMD_EXT(virtio_user_driver);
-PMD_EXT(rte_vmxnet3_driver);
-PMD_EXT(pmd_xenvirt_drv);
-
 #define MEMPOOL_OPS(hdl) \
 extern void mp_hdlr_init_##hdl(void)
 
@@ -89,116 +46,11 @@ MEMPOOL_OPS(ops_stack);
 /*
  * This function is not called from anywhere, it's only purpose is to make sure
  * that if ODP and DPDK are statically linked to an application, the GCC
- * constructors of the PMDs are linked as well. Otherwise the linker would omit
- * them. It's not an issue with dynamic linking. */
+ * constructors of mempool handlers are linked as well. Otherwise the linker
+ * would omit them. It's not an issue with dynamic linking. */
 void 

[lng-odp] [PATCH v3 2/3] linux-gen: dpdk: disable pci devices when running make check

2017-02-27 Thread Matias Elo
Disable pci devices during DPDK pktio validation test. If the system has
pci devices mapped to DPDK pmd drivers they may overlap with the
test vdev device indices, which will cause the validation test to fail.

Signed-off-by: Matias Elo 
---
 test/linux-generic/validation/api/pktio/pktio_run_dpdk.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/linux-generic/validation/api/pktio/pktio_run_dpdk.sh 
b/test/linux-generic/validation/api/pktio/pktio_run_dpdk.sh
index fa46fa4..3060dc0 100755
--- a/test/linux-generic/validation/api/pktio/pktio_run_dpdk.sh
+++ b/test/linux-generic/validation/api/pktio/pktio_run_dpdk.sh
@@ -74,7 +74,7 @@ run()
 
if [ "$ODP_PKTIO_IF0" = "" ]; then
setup_pktio_env clean
-   export ODP_PKTIO_DPDK_PARAMS="--vdev eth_pcap0,iface=$IF0 
--vdev eth_pcap1,iface=$IF1"
+   export ODP_PKTIO_DPDK_PARAMS="--no-pci --vdev 
eth_pcap0,iface=$IF0 --vdev eth_pcap1,iface=$IF1"
export ODP_PKTIO_IF0=0
export ODP_PKTIO_IF1=1
fi
-- 
2.7.4



[lng-odp] [PATCH v3 3/3] linux-gen: dpdk: bump target dpdk version to 17.02

2017-02-27 Thread Matias Elo
Signed-off-by: Matias Elo 
---
V3:
- Update travis config (Maxim)

 .travis.yml  | 2 +-
 DEPENDENCIES | 2 +-
 scripts/build-pktio-dpdk | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 83ec65f..aa7ea01 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -80,7 +80,7 @@ before_install:
 
 #  DPDK pktio
 - TARGET=${TARGET:-"x86_64-native-linuxapp-gcc"}
-- git -c advice.detachedHead=false clone -q --depth=1 --single-branch 
--branch=v16.07 http://dpdk.org/git/dpdk dpdk
+- git -c advice.detachedHead=false clone -q --depth=1 --single-branch 
--branch=v17.02 http://dpdk.org/git/dpdk dpdk
 - pushd dpdk
 - git log --oneline --decorate
 - make config T=${TARGET} O=${TARGET}
diff --git a/DEPENDENCIES b/DEPENDENCIES
index 574859c..b97a7dd 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -165,7 +165,7 @@ Prerequisites for building the OpenDataPlane (ODP) API
 
 3.4.1 Building DPDK and ODP with DPDK pktio support
 
-   DPDK packet I/O has been tested to work with DPDK v16.07.
+   DPDK packet I/O has been tested to work with DPDK v17.02.
 
Follow steps in ./scripts/build-pktio-dpdk
 
diff --git a/scripts/build-pktio-dpdk b/scripts/build-pktio-dpdk
index 36727dd..6c6830a 100755
--- a/scripts/build-pktio-dpdk
+++ b/scripts/build-pktio-dpdk
@@ -10,7 +10,7 @@ if [ "$?" != "0" ]; then
echo "Error: pcap is not installed. You may need to install libpcap-dev"
 fi
 
-git -c advice.detachedHead=false clone -q --depth=1 --single-branch 
--branch=v16.07 http://dpdk.org/git/dpdk dpdk
+git -c advice.detachedHead=false clone -q --depth=1 --single-branch 
--branch=v17.02 http://dpdk.org/git/dpdk dpdk
 pushd dpdk
 git log --oneline --decorate
 
-- 
2.7.4



[lng-odp] [API-NEXT PATCH v2 1/2] validation: packet: increase test pool size

2017-02-27 Thread Matias Elo
Previously packet_test_concatsplit() could fail on some pool
implementations as the pool ran out of buffers. Increase default pools size
and use capability to make sure the value is valid.

Signed-off-by: Matias Elo 
---
V2:
- Add define PACKET_POOL_NUM for test packet pool size (Bala)

 test/common_plat/validation/api/packet/packet.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/common_plat/validation/api/packet/packet.c 
b/test/common_plat/validation/api/packet/packet.c
index 900c426..6ebc1fe 100644
--- a/test/common_plat/validation/api/packet/packet.c
+++ b/test/common_plat/validation/api/packet/packet.c
@@ -13,6 +13,8 @@
 #define PACKET_BUF_LEN ODP_CONFIG_PACKET_SEG_LEN_MIN
 /* Reserve some tailroom for tests */
 #define PACKET_TAILROOM_RESERVE  4
+/* Number of packets in the test packet pool */
+#define PACKET_POOL_NUM 200
 
 static odp_pool_t packet_pool, packet_pool_no_uarea, packet_pool_double_uarea;
 static uint32_t packet_len;
@@ -109,6 +111,7 @@ int packet_suite_init(void)
uint32_t udat_size;
uint8_t data = 0;
uint32_t i;
+   uint32_t num = PACKET_POOL_NUM;
 
if (odp_pool_capability() < 0) {
printf("pool_capability failed\n");
@@ -128,13 +131,15 @@ int packet_suite_init(void)
segmented_packet_len = capa.pkt.min_seg_len *
   capa.pkt.max_segs_per_pkt;
}
+   if (capa.pkt.max_num != 0 && capa.pkt.max_num < num)
+   num = capa.pkt.max_num;
 
odp_pool_param_init();
 
params.type   = ODP_POOL_PACKET;
params.pkt.seg_len= capa.pkt.min_seg_len;
params.pkt.len= capa.pkt.min_seg_len;
-   params.pkt.num= 100;
+   params.pkt.num= num;
params.pkt.uarea_size = sizeof(struct udata_struct);
 
packet_pool = odp_pool_create("packet_pool", );
-- 
2.7.4



[lng-odp] [API-NEXT PATCH v2 2/2] validation: packet: remove invalid check from packet_test_alloc_segmented()

2017-02-27 Thread Matias Elo
One can't assume that the packet should be segmented as this test is using
a different pool with different parameters than the default test pool.

Signed-off-by: Matias Elo 
---
 test/common_plat/validation/api/packet/packet.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/test/common_plat/validation/api/packet/packet.c 
b/test/common_plat/validation/api/packet/packet.c
index 6ebc1fe..b13ffb0 100644
--- a/test/common_plat/validation/api/packet/packet.c
+++ b/test/common_plat/validation/api/packet/packet.c
@@ -418,9 +418,6 @@ void packet_test_alloc_segmented(void)
CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
CU_ASSERT(odp_packet_len(pkt) == max_len);
 
-   if (segmentation_supported)
-   CU_ASSERT(odp_packet_is_segmented(pkt) == 1);
-
odp_packet_free(pkt);
 
num_alloc = 0;
-- 
2.7.4



Re: [lng-odp] [API-NEXT PATCH 1/2] validation: packet: increase test pool size

2017-02-27 Thread Elo, Matias (Nokia - FI/Espoo)

> IMO, It is better for the above num value to be a #define rather than
> a local variable so that its easy to modify for multiple platforms if
> required.
> 

True, will fix this.

-Matias



[lng-odp] [PATCH] api: ipsec: make IPSEC protocol consistent with other types

2017-02-27 Thread Andriy Berestovskyy
- rename odp_ipsec_protocol_t to odp_ipsec_proto_t
- rename ODP_IPSEC_AH to ODP_IPSEC_PROTO_AH
- rename ODP_IPSEC_ESP to ODP_IPSEC_PROTO_ESP

Signed-off-by: Andriy Berestovskyy 
---
 include/odp/api/spec/ipsec.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 66222d8..793e317 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -140,14 +140,14 @@ typedef enum odp_ipsec_mode_t {
 /**
  * IPSEC protocol
  */
-typedef enum odp_ipsec_protocol_t {
+typedef enum odp_ipsec_proto_t {
/** ESP protocol */
-   ODP_IPSEC_ESP = 0,
+   ODP_IPSEC_PROTO_ESP = 0,
 
/** AH protocol */
-   ODP_IPSEC_AH
+   ODP_IPSEC_PROTO_AH
 
-} odp_ipsec_protocol_t;
+} odp_ipsec_proto_t;
 
 /**
  * IPSEC tunnel type
@@ -362,7 +362,7 @@ typedef struct odp_ipsec_sa_param_t {
odp_ipsec_dir_t dir;
 
/** IPSEC protocol: ESP or AH */
-   odp_ipsec_protocol_t proto;
+   odp_ipsec_proto_t proto;
 
/** IPSEC protocol mode: transport or tunnel */
odp_ipsec_mode_t mode;
-- 
2.7.4



Re: [lng-odp] [API-NEXT PATCH 06/21] drv: driver: change drv unbind function name and pass correct parameter

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 23:14, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> The driver removal function expects a device, of course...
>> Also unbind seems a better name to disconnect from a device
>> since remove has been used for removing the object itself for
>> enumerators.
>> Some extra parameters to allow for graceful unbinding are also added.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  include/odp/drv/spec/driver.h | 21 ++---
>>  1 file changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h
>> index b08d7fb..a978d12 100644
>> --- a/include/odp/drv/spec/driver.h
>> +++ b/include/odp/drv/spec/driver.h
>> @@ -300,14 +300,29 @@ struct odpdrv_driver_param_t {
>>  */
>> int (*probe)(odpdrv_device_t *dev);
>>
>> -   /** Remove function:
>> +   /** unbind function:
>>  * Only called with devices whose probe() returned true
>>  *
>> +* dev: the device to unbind
>> +* callback: if flag ODPDRV_DRV_UNBIND_IMMEDIATE is not specified,
>> +*  unbind should be attempted gracefuly, meaning that some IO may
>> need
>> +*  to terminate before the driver is really unbound from the
>> device:
>> +*  In this case (when the flag is not set), the driver is due to
>> call
>> +*  the callback function when the driver is unbound from the
>> device.
>> +*  This callback may occurs within the unbind() call if the
>> driver
>> +*  does unbind immediately.
>> +*  If the ODPDRV_DRV_UNBIND_IMMEDIATE is specified, the driver is
>> due
>> +*  to release the device immediately (poosibly less gracefuly).
>
>
> Typo: possibly less gracefully

Wonder why check-odp did not catch that...
=> V2

Christophe

>
>>
>> +*  The callback must be called immediately in this case.
>>  */
>> -   int (*remove)(odpdrv_device_param_t *dev);
>> -
>> +   int (*unbind)(odpdrv_device_t dev,
>> + void (*callback)(odpdrv_device_t dev),
>> + uint32_t flags);
>>  };
>>
>> +/** The callback function must be called mmediately by the current ODP
>> thread */
>> +#define ODPDRV_DRV_UNBIND_IMMEDIATE0x0001
>> +
>>  /**
>>  * Register an enumerator class.
>>  * Each enumerator class calls this function at init time.
>> --
>> 2.7.4
>>
>


Re: [lng-odp] [API-NEXT PATCH 05/21] test: drv: enumerator registration tests

2017-02-27 Thread Christophe Milard
will fix all these in V2,

Christophe.

On 22 February 2017 at 22:52, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> making sure that enumerators are probed.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  .../validation/drv/drvdriver/.gitignore|   1 +
>>  .../validation/drv/drvdriver/Makefile.am   |  11 +
>>  .../validation/drv/drvdriver/drvdriver_enumr.c | 303
>> +
>>  .../validation/drv/drvdriver/drvdriver_enumr.h |  24 ++
>>  .../drv/drvdriver/drvdriver_enumr_main.c   |  12 +
>>  test/linux-generic/Makefile.am |   1 +
>>  6 files changed, 352 insertions(+)
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_enumr.c
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_enumr.h
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_enumr_main.c
>>
>> diff --git a/test/common_plat/validation/drv/drvdriver/.gitignore
>> b/test/common_plat/validation/drv/drvdriver/.gitignore
>> index 9268315..a842448 100644
>> --- a/test/common_plat/validation/drv/drvdriver/.gitignore
>> +++ b/test/common_plat/validation/drv/drvdriver/.gitignore
>> @@ -1 +1,2 @@
>>  drvdriver_enumr_class_main
>> +drvdriver_enumr_main
>> diff --git a/test/common_plat/validation/drv/drvdriver/Makefile.am
>> b/test/common_plat/validation/drv/drvdriver/Makefile.am
>> index 9e941ee..3476c50 100644
>> --- a/test/common_plat/validation/drv/drvdriver/Makefile.am
>> +++ b/test/common_plat/validation/drv/drvdriver/Makefile.am
>> @@ -14,3 +14,14 @@ drvdriver_enumr_class_main_LDADD =
>> libtestdrvdriverenumrclass.la \
>>$(LIBCUNIT_COMMON) $(LIBODP)
>>
>>  EXTRA_DIST = drvdriver_enumr_class.h
>> +
>> +#tests for enumerator registration:
>> +noinst_LTLIBRARIES += libtestdrvdriverenumr.la
>> +libtestdrvdriverenumr_la_SOURCES = drvdriver_enumr.c
>> +
>> +test_PROGRAMS += drvdriver_enumr_main$(EXEEXT)
>> +dist_drvdriver_enumr_main_SOURCES = drvdriver_enumr_main.c
>> +drvdriver_enumr_main_LDADD = libtestdrvdriverenumr.la \
>> +  $(LIBCUNIT_COMMON) $(LIBODP)
>> +
>> +EXTRA_DIST += drvdriver_enumr.h
>> diff --git a/test/common_plat/validation/drv/drvdriver/drvdriver_enumr.c
>> b/test/common_plat/validation/drv/drvdriver/drvdriver_enumr.c
>> new file mode 100644
>> index 000..cf844cf
>> --- /dev/null
>> +++ b/test/common_plat/validation/drv/drvdriver/drvdriver_enumr.c
>> @@ -0,0 +1,303 @@
>> +/* Copyright (c) 2017, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier: BSD-3-Clause
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include "drvdriver_enumr.h"
>> +#include 
>> +
>> +static odp_instance_t odp_instance;
>> +static odpdrv_enumr_class_t enumr_class1, enumr_class2;
>> +
>> +/* markers showing that different stages have been run */
>> +static int enumr1_probed;
>> +static int enumr2_probed;
>> +static int enumr3_probed;
>> +static int enumr4_probed;
>> +
>> +/* forward declaration */
>> +static int enumr1_probe(void);
>> +static int enumr2_probe(void);
>> +static int enumr3_probe(void);
>> +static int enumr4_probe(void);
>> +
>> +static int enumr1_remove(void);
>> +static int enumr2_remove(void);
>> +static int enumr3_remove(void);
>> +static int enumr4_remove(void);
>> +
>> +static int enumr_class1_probe(void);
>> +static int enumr_class2_probe(void);
>> +
>> +static int enumr_class1_remove(void);
>> +static int enumr_class2_remove(void);
>> +
>> +/* because many things to be checked are performed during ODP
>> initialisation,
>> + * the initialisation functions have to be a part of the test
>> + */
>> +static int tests_global_init(void)
>> +{
>> +   if (0 != odp_init_global(_instance, NULL, NULL)) {
>> +   fprintf(stderr, "error: odp_init_global() failed.\n");
>> +   return -1;
>> +   }
>> +   if (0 != odp_init_local(odp_instance, ODP_THREAD_CONTROL)) {
>> +   fprintf(stderr, "error: odp_init_local() failed.\n");
>> +   return -1;
>> +   }
>> +
>> +   return 0;
>> +}
>> +
>> +static int tests_global_term(void)
>> +{
>> +   if (0 != odp_term_local()) {
>> +   fprintf(stderr, "error: odp_term_local() failed.\n");
>> +   return -1;
>> +   }
>> +
>> +   if (0 != odp_term_global(odp_instance)) {
>> +   fprintf(stderr, "error: odp_term_global() failed.\n");
>> +   return -1;
>> +   }
>> +
>> +   return 0;
>> +}
>> +
>> +/*enumerator register functions */
>> +static odpdrv_enumr_t enumr1_register(void)
>> +{
>> +   odpdrv_enumr_param_t param = {
>> +   .enumr_class = enumr_class1,
>> +   .api_name = "Enumerator_interface_1",
>> +   .api_version = 1,
>> +   .probe = enumr1_probe,

Re: [lng-odp] [API-NEXT PATCH 04/21] linux-gen: drv: enumerator registration

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 22:46, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> The enumerator registration functions for the linux-gen ODP
>> implementation.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  platform/linux-generic/drv_driver.c | 135
>> +++-
>>  1 file changed, 132 insertions(+), 3 deletions(-)
>>
>> diff --git a/platform/linux-generic/drv_driver.c
>> b/platform/linux-generic/drv_driver.c
>> index 50956a7..ee0a75c 100644
>> --- a/platform/linux-generic/drv_driver.c
>> +++ b/platform/linux-generic/drv_driver.c
>> @@ -24,6 +24,7 @@ static enum {UNDONE, IN_PROGRESS, DONE}
>> init_global_status;
>>  static _odp_ishm_pool_t *list_elt_pool;
>>
>>  typedef struct _odpdrv_enumr_class_s _odpdrv_enumr_class_t;
>> +typedef struct _odpdrv_enumr_s _odpdrv_enumr_t;
>>
>>  /* an enumerator class (list element) */
>>  struct _odpdrv_enumr_class_s {
>> @@ -40,6 +41,20 @@ typedef struct _odpdrv_enumr_class_lst_t {
>>  } _odpdrv_enumr_class_lst_t;
>>  static struct _odpdrv_enumr_class_lst_t enumr_class_lst;
>>
>> +/* an enumerator (list element) */
>> +struct _odpdrv_enumr_s {
>> +   odpdrv_enumr_param_t param;
>> +   int probed;
>> +   struct _odpdrv_enumr_s *next;
>> +};
>> +
>> +/* the enumerator list: */
>> +typedef struct _odpdrv_enumr_lst_t {
>> +   odp_rwlock_recursive_t lock;
>> +   _odpdrv_enumr_t *head;
>> +} _odpdrv_enumr_lst_t;
>> +static struct _odpdrv_enumr_lst_t enumr_lst;
>> +
>>  /* some driver elements (such as enumeraor classes, drivers, devio) may
>>   * register before init_global and init_local complete. Mutex will fail
>>   * in this cases but should be used later on.
>> @@ -69,6 +84,29 @@ static void enumr_class_list_write_unlock(void)
>> odp_rwlock_recursive_write_unlock(_class_lst.lock);
>>  }
>>
>> +static void enumr_list_read_lock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_read_lock(_lst.lock);
>
>
> Same comments here as before with respect to the need for
> init_global_status. This seems unnecessarily complicated.

The problem is the folowing: there are two possible points (in time)
when a driver items (enumerator classes, drivers, devios...) may
register:
1) when ODP is running: this typically happens when a shared module is loaded
2) at early init, before main() is run, i.e. long before
odp_init_global(): this happens when the driver elements are
statically linked with ODP: their constructors are run before main().
This is a gcc construct. nothing we can do about it.
In case 1) we want to protect the lists again concurrent accesses.
in case 2) the ODP mutexes are not even initalised and won't work, but
we are monothreaded at thos time so we can ignore the mutex.

Hence this code

>
>>
>> +}
>> +
>> +static void enumr_list_read_unlock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_read_unlock(_lst.lock);
>> +}
>> +
>> +static void enumr_list_write_lock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_write_lock(_lst.lock);
>> +}
>> +
>> +static void enumr_list_write_unlock(void)
>> +{
>> +   if (init_global_status == DONE)
>> +   odp_rwlock_recursive_write_unlock(_lst.lock);
>> +}
>>
>>  odpdrv_enumr_class_t
>> odpdrv_enumr_class_register(odpdrv_enumr_class_param_t
>>  *param)
>> @@ -133,10 +171,53 @@ odpdrv_enumr_class_t
>> odpdrv_enumr_class_register(odpdrv_enumr_class_param_t
>>
>>  odpdrv_enumr_t odpdrv_enumr_register(odpdrv_enumr_param_t *param)
>>  {
>> -   ODP_ERR("NOT Supported yet! Enumerator API %s Registration!\n.",
>> -   param->api_name);
>> +   _odpdrv_enumr_t *enumr;
>> +   _odpdrv_enumr_class_t *enumr_c;
>> +   int found_class = 0;
>> +
>> +   /* make sure that the provided enumerator_class does indeed exist:
>> */
>> +   enumr_class_list_read_lock();
>> +   enumr_c = enumr_class_lst.head;
>
>
> Same question here regarding where is enumr_class_lst.head initialized? It
> seems we're referencing an uninitialized / stale value here. My guess is
> coverity would flag this.

The list heads are static, hence initialised to NULL.
Gcc actually provides means of executing constructor with different
priorities, but I dont really like using that: not sure  about
portability:
Assuming we are not using this hack, there is not way I can guarantee
that any of my (ODP) code gets executed before a enumerator class (or
other element) constructor get registered.
I.e. I have to rely on the static zeroing.

>
>>
>> +   while (enumr_c) {
>> +   if ((_odpdrv_enumr_class_t *)(void *)param->enumr_class ==
>> +enumr_c) {
>> +   found_class = 1;
>> +   break;
>> +  

Re: [lng-odp] [API-NEXT PATCH 03/21] test: drv: enumerator_class registration tests

2017-02-27 Thread Christophe Milard
On 22 February 2017 at 22:13, Bill Fischofer  wrote:
>
>
> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard
>  wrote:
>>
>> Testing that enumerators classes can register properly.
>> Saddly restricted to statically linked enumerators classes, as testing
>> with
>> modules in autotools seems to be an issue so far.
>>
>> Signed-off-by: Christophe Milard 
>> ---
>>  test/common_plat/m4/configure.m4   |   1 +
>>  test/common_plat/validation/drv/Makefile.am|   1 +
>>  .../validation/drv/drvdriver/.gitignore|   1 +
>>  .../validation/drv/drvdriver/Makefile.am   |  16 ++
>>  .../drv/drvdriver/drvdriver_enumr_class.c  | 174
>> +
>>  .../drv/drvdriver/drvdriver_enumr_class.h  |  24 +++
>>  .../drv/drvdriver/drvdriver_enumr_class_main.c |  12 ++
>>  test/linux-generic/Makefile.am |   1 +
>>  8 files changed, 230 insertions(+)
>>  create mode 100644 test/common_plat/validation/drv/drvdriver/.gitignore
>>  create mode 100644 test/common_plat/validation/drv/drvdriver/Makefile.am
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_enumr_class.c
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_enumr_class.h
>>  create mode 100644
>> test/common_plat/validation/drv/drvdriver/drvdriver_enumr_class_main.c
>>
>> diff --git a/test/common_plat/m4/configure.m4
>> b/test/common_plat/m4/configure.m4
>> index 13a13bd..400750c 100644
>> --- a/test/common_plat/m4/configure.m4
>> +++ b/test/common_plat/m4/configure.m4
>> @@ -34,4 +34,5 @@ AC_CONFIG_FILES([test/common_plat/Makefile
>>  test/common_plat/validation/api/traffic_mngr/Makefile
>>  test/common_plat/validation/drv/Makefile
>>  test/common_plat/validation/drv/drvatomic/Makefile
>> +test/common_plat/validation/drv/drvdriver/Makefile
>>  test/common_plat/validation/drv/drvshmem/Makefile])
>> diff --git a/test/common_plat/validation/drv/Makefile.am
>> b/test/common_plat/validation/drv/Makefile.am
>> index bcdb92e..7329a89 100644
>> --- a/test/common_plat/validation/drv/Makefile.am
>> +++ b/test/common_plat/validation/drv/Makefile.am
>> @@ -1,4 +1,5 @@
>>  ODPDRV_MODULES = drvatomic \
>> +drvdriver \
>>  drvshmem
>>
>>  SUBDIRS = $(ODPDRV_MODULES)
>> diff --git a/test/common_plat/validation/drv/drvdriver/.gitignore
>> b/test/common_plat/validation/drv/drvdriver/.gitignore
>> new file mode 100644
>> index 000..9268315
>> --- /dev/null
>> +++ b/test/common_plat/validation/drv/drvdriver/.gitignore
>> @@ -0,0 +1 @@
>> +drvdriver_enumr_class_main
>> diff --git a/test/common_plat/validation/drv/drvdriver/Makefile.am
>> b/test/common_plat/validation/drv/drvdriver/Makefile.am
>> new file mode 100644
>> index 000..9e941ee
>> --- /dev/null
>> +++ b/test/common_plat/validation/drv/drvdriver/Makefile.am
>> @@ -0,0 +1,16 @@
>> +include ../Makefile.inc
>> +
>> +# because most of driver activity occurs at init time, and due to the
>> +# fact that many sequential ODP runs are not allowed from the same
>> process,
>> +# we need different binaries for each things being tested (as API init)
>
>
> I'm not sure I understand this comment. While this may be a good idea from a
> test modularity standpoint, the intent of ODP is that after
> odp_term_global() is called it's perfectly fine to call odp_init_global()
> again to start up another ODP instance. What we haven't (yet) worked out is
> the full ramifications of supporting multiple ODP instances on the same
> platform simultaneously, something we need to do as part of the Cloud
> profile for NFV.
>

I did call odp_init_global() after odp_term_global() when I worked on
the init test suite a while ago: most ODP implementation failed on
that. We eventually agreed that once a given process has call
odp_term_global() is is not allowed to "restart a new odp instance",
i.e. to call odp_init_global() again.
This is why the init test are 3 different binaries rather than one
simgle test suite.

>>
>> +
>> +#tests for enumerator class registration:
>> +noinst_LTLIBRARIES = libtestdrvdriverenumrclass.la
>> +libtestdrvdriverenumrclass_la_SOURCES = drvdriver_enumr_class.c
>> +
>> +test_PROGRAMS = drvdriver_enumr_class_main$(EXEEXT)
>> +dist_drvdriver_enumr_class_main_SOURCES = drvdriver_enumr_class_main.c
>> +drvdriver_enumr_class_main_LDADD = libtestdrvdriverenumrclass.la \
>> +  $(LIBCUNIT_COMMON) $(LIBODP)
>> +
>> +EXTRA_DIST = drvdriver_enumr_class.h
>> diff --git
>> a/test/common_plat/validation/drv/drvdriver/drvdriver_enumr_class.c
>> b/test/common_plat/validation/drv/drvdriver/drvdriver_enumr_class.c
>> new file mode 100644
>> index 000..62b99ea
>> --- /dev/null
>> +++ b/test/common_plat/validation/drv/drvdriver/drvdriver_enumr_class.c
>> @@ -0,0 +1,174 @@
>> 

Re: [lng-odp] [API-NEXT PATCH 00/21] driver items registration and probing

2017-02-27 Thread Christophe Milard
Hi all,

Maxim, are you saying you prefer a pull request?
Last time I did one, you required the patch to be sent on the list, so
I am not sure what to do next time.

Thx,

Christophe.

On 27 February 2017 at 10:15, Maxim Uvarov  wrote:
> for big serries of patches >20  it's good to provide some git link to
> download all of that. That Might be Linaro's people git or github.
>
> Maxim.
>
> On 25 February 2017 at 01:03, Mike Holmes  wrote:
>
>> I did make a ticket for IT to look into this
>>
>> On 24 February 2017 at 16:55, Bill Fischofer 
>> wrote:
>>
>> > It looks like Christophe sent the original series to Mike, Forrest,
>> > Sachin, Yi, Me, and the odp mailing list. I suspect that's why Mike
>> > and I (and presumably the others on the direct mail list) have a
>> > complete copy of the series. A number of the parts didn't make it
>> > either to patchworks or the ODP mailing list archives, so I suspect
>> > some sort of IT glitch.
>> >
>> > On Fri, Feb 24, 2017 at 6:15 AM, Mike Holmes 
>> > wrote:
>> > > Christophe will be back next week and we can check into where they
>> went.
>> > I
>> > > will ping Philip if I can prove I got them on CC and the list lost
>> them.
>> > >
>> > > On Feb 24, 2017 3:31 AM, "Josep Puigdemont" <
>> josep.puigdem...@linaro.org
>> > >
>> > > wrote:
>> > >>
>> > >> On Thu, Feb 23, 2017 at 10:51:27AM -0600, Bill Fischofer wrote:
>> > >> > I see all the patches in this series on the mailing list, but it
>> > appears
>> > >> > that the patchwork series[1] is missing parts 14 and 16.
>> > >>
>> > >> and part 20.
>> > >>
>> > >> I don't have parts 14, 16, and 20 on my inbox either, and it doesn't
>> > look
>> > >> like they ever reached the list, since they are missing from the
>> > >> archives too. Part 16/21 in the archives is a reply from you, Bill, so
>> > >> you definitely got the email (maybe you were cc'd?).
>> > >>
>> > >> >
>> > >> > ---
>> > >> > [1] http://patches.opendataplane.org/project/lng-odp/list/?
>> series=65
>> > >> >
>> > >> > On Thu, Feb 23, 2017 at 4:16 AM, Yi He  wrote:
>> > >> >
>> > >> > > In patchwork for this series I saw 14, 16, 21 are missing, do you
>> > see
>> > >> > > the
>> > >> > > same problem?
>> > >> > >
>> > >> > > Best Regards, Yi
>> > >> > >
>> > >> > > On 23 February 2017 at 07:32, Bill Fischofer
>> > >> > > 
>> > >> > > wrote:
>> > >> > >
>> > >> > >> This series compiles and runs/tests fine using gcc and clang on
>> > both
>> > >> > >> 64
>> > >> > >> and 32 bit systems. Many comments, mostly cosmetic, however some
>> > >> > >> missing
>> > >> > >> field initializations are noted as well as some suggestions for
>> > >> > >> handling
>> > >> > >> type conversions.
>> > >> > >>
>> > >> > >> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard <
>> > >> > >> christophe.mil...@linaro.org> wrote:
>> > >> > >>
>> > >> > >>> This patch series implements the driver interface, i.e.
>> > >> > >>> enumerator class, enumerator, devio and drivers registration and
>> > >> > >>> probing.
>> > >> > >>> This interface is depicted in:
>> > >> > >>> https://docs.google.com/document/d/1eCKPJF6uSlOllXi_sKDvRwUD
>> > >> > >>> 2BXm-ZzxZoKT0nVEsl4/edit
>> > >> > >>> The associated tests are testing these mechanisms. Note that
>> these
>> > >> > >>> tests
>> > >> > >>> are testing staticaly linked modules only (hence avoiding the
>> > >> > >>> module/platform/test debate). Also note that these tests are
>> > >> > >>> gathering
>> > >> > >>> all the elements (enumerators, enumerator classes, devio,
>> drivers)
>> > >> > >>> making
>> > >> > >>> up the driver interface so as their interactions can be checked.
>> > >> > >>> Real elements (pci enumerators, drivers...) will likely be
>> written
>> > >> > >>> in a
>> > >> > >>> much
>> > >> > >>> more stand-alone way.
>> > >> > >>>
>> > >> > >>> Christophe Milard (21):
>> > >> > >>>   drv: making parameter strings dynamically computable
>> > >> > >>>   linux-gen: drv: enumerator_class registration
>> > >> > >>>   test: drv: enumerator_class registration tests
>> > >> > >>>   linux-gen: drv: enumerator registration
>> > >> > >>>   test: drv: enumerator registration tests
>> > >> > >>>   drv: driver: change drv unbind function name and pass correct
>> > >> > >>> parameter
>> > >> > >>>   drv: driver: add callback function for device destruction
>> > >> > >>>   linux-gen: drv: device creation and deletion
>> > >> > >>>   drv: driver: adding device query function
>> > >> > >>>   linux-gen: drv: driver: adding device querry function
>> > >> > >>>   test: drv: device creation and destruction
>> > >> > >>>   drv: driver: adding a probe and remove callback for devio
>> > >> > >>>   linux-gen: drv: devio registration
>> > >> > >>>   test: drv: devio creation and destruction
>> > >> > >>>   drv: adding driver remove function
>> > >> > >>>   drv: complement parameters to the driver 

Re: [lng-odp] [API-NEXT PATCH 00/21] driver items registration and probing

2017-02-27 Thread Maxim Uvarov
for big serries of patches >20  it's good to provide some git link to
download all of that. That Might be Linaro's people git or github.

Maxim.

On 25 February 2017 at 01:03, Mike Holmes  wrote:

> I did make a ticket for IT to look into this
>
> On 24 February 2017 at 16:55, Bill Fischofer 
> wrote:
>
> > It looks like Christophe sent the original series to Mike, Forrest,
> > Sachin, Yi, Me, and the odp mailing list. I suspect that's why Mike
> > and I (and presumably the others on the direct mail list) have a
> > complete copy of the series. A number of the parts didn't make it
> > either to patchworks or the ODP mailing list archives, so I suspect
> > some sort of IT glitch.
> >
> > On Fri, Feb 24, 2017 at 6:15 AM, Mike Holmes 
> > wrote:
> > > Christophe will be back next week and we can check into where they
> went.
> > I
> > > will ping Philip if I can prove I got them on CC and the list lost
> them.
> > >
> > > On Feb 24, 2017 3:31 AM, "Josep Puigdemont" <
> josep.puigdem...@linaro.org
> > >
> > > wrote:
> > >>
> > >> On Thu, Feb 23, 2017 at 10:51:27AM -0600, Bill Fischofer wrote:
> > >> > I see all the patches in this series on the mailing list, but it
> > appears
> > >> > that the patchwork series[1] is missing parts 14 and 16.
> > >>
> > >> and part 20.
> > >>
> > >> I don't have parts 14, 16, and 20 on my inbox either, and it doesn't
> > look
> > >> like they ever reached the list, since they are missing from the
> > >> archives too. Part 16/21 in the archives is a reply from you, Bill, so
> > >> you definitely got the email (maybe you were cc'd?).
> > >>
> > >> >
> > >> > ---
> > >> > [1] http://patches.opendataplane.org/project/lng-odp/list/?
> series=65
> > >> >
> > >> > On Thu, Feb 23, 2017 at 4:16 AM, Yi He  wrote:
> > >> >
> > >> > > In patchwork for this series I saw 14, 16, 21 are missing, do you
> > see
> > >> > > the
> > >> > > same problem?
> > >> > >
> > >> > > Best Regards, Yi
> > >> > >
> > >> > > On 23 February 2017 at 07:32, Bill Fischofer
> > >> > > 
> > >> > > wrote:
> > >> > >
> > >> > >> This series compiles and runs/tests fine using gcc and clang on
> > both
> > >> > >> 64
> > >> > >> and 32 bit systems. Many comments, mostly cosmetic, however some
> > >> > >> missing
> > >> > >> field initializations are noted as well as some suggestions for
> > >> > >> handling
> > >> > >> type conversions.
> > >> > >>
> > >> > >> On Wed, Feb 22, 2017 at 6:55 AM, Christophe Milard <
> > >> > >> christophe.mil...@linaro.org> wrote:
> > >> > >>
> > >> > >>> This patch series implements the driver interface, i.e.
> > >> > >>> enumerator class, enumerator, devio and drivers registration and
> > >> > >>> probing.
> > >> > >>> This interface is depicted in:
> > >> > >>> https://docs.google.com/document/d/1eCKPJF6uSlOllXi_sKDvRwUD
> > >> > >>> 2BXm-ZzxZoKT0nVEsl4/edit
> > >> > >>> The associated tests are testing these mechanisms. Note that
> these
> > >> > >>> tests
> > >> > >>> are testing staticaly linked modules only (hence avoiding the
> > >> > >>> module/platform/test debate). Also note that these tests are
> > >> > >>> gathering
> > >> > >>> all the elements (enumerators, enumerator classes, devio,
> drivers)
> > >> > >>> making
> > >> > >>> up the driver interface so as their interactions can be checked.
> > >> > >>> Real elements (pci enumerators, drivers...) will likely be
> written
> > >> > >>> in a
> > >> > >>> much
> > >> > >>> more stand-alone way.
> > >> > >>>
> > >> > >>> Christophe Milard (21):
> > >> > >>>   drv: making parameter strings dynamically computable
> > >> > >>>   linux-gen: drv: enumerator_class registration
> > >> > >>>   test: drv: enumerator_class registration tests
> > >> > >>>   linux-gen: drv: enumerator registration
> > >> > >>>   test: drv: enumerator registration tests
> > >> > >>>   drv: driver: change drv unbind function name and pass correct
> > >> > >>> parameter
> > >> > >>>   drv: driver: add callback function for device destruction
> > >> > >>>   linux-gen: drv: device creation and deletion
> > >> > >>>   drv: driver: adding device query function
> > >> > >>>   linux-gen: drv: driver: adding device querry function
> > >> > >>>   test: drv: device creation and destruction
> > >> > >>>   drv: driver: adding a probe and remove callback for devio
> > >> > >>>   linux-gen: drv: devio registration
> > >> > >>>   test: drv: devio creation and destruction
> > >> > >>>   drv: adding driver remove function
> > >> > >>>   drv: complement parameters to the driver probe() function
> > >> > >>>   linux-gen: driver registration and probing
> > >> > >>>   test: drv: driver registration and probing
> > >> > >>>   drv: driver: adding functions to attach driver's data to the
> > >> > >>> device
> > >> > >>>   linux-gen: adding functions to attach driver's data to the
> > device
> > >> > >>>   test: drv: test for setting and retrieving driver's