[lng-odp] [Linaro/odp] c0aeac: linux-gen: dpdk: create missing dpdk mempools in z...

2017-10-25 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/Linaro/odp
  Commit: c0aeacf23dddfb7feae47fef6e4d10d6bdb9c812
  
https://github.com/Linaro/odp/commit/c0aeacf23dddfb7feae47fef6e4d10d6bdb9c812
  Author: Matias Elo 
  Date:   2017-10-25 (Wed, 25 Oct 2017)

  Changed paths:
M platform/linux-generic/pktio/dpdk.c

  Log Message:
  ---
  linux-gen: dpdk: create missing dpdk mempools in zero-copy mode

In zero-copy dpdk pktio mode a matching dpdk mempool is required for each
odp packet pool from which packets are sent using dpdk pktio. This is
required for all packet pools, even for those which are not passed directly
to pktio devices as odp_pktio_open() parameters.

Signed-off-by: Matias Elo 
Signed-off-by: Maxim Uvarov 


  Commit: 82419a31e6d1846e0676edfa7fb511a23098f5a9
  
https://github.com/Linaro/odp/commit/82419a31e6d1846e0676edfa7fb511a23098f5a9
  Author: Matias Elo 
  Date:   2017-10-25 (Wed, 25 Oct 2017)

  Changed paths:
M .travis.yml
M DEPENDENCIES
M platform/linux-generic/m4/odp_dpdk.m4
M platform/linux-generic/pktio/dpdk.c
M platform/linux-generic/test/validation/api/pktio/pktio_run_dpdk.sh
M scripts/build-pktio-dpdk

  Log Message:
  ---
  linux-gen: dpdk: bump target dpdk version to 17.08

Changes:
- Function rte_set_log_level() is now deprecated. Replace it with
rte_log_set_global_level().
- New dependency added to libnuma.
- Pcap-based virtual devices are renamed to net_pcap.
- DPDK pktio devices cannot be restarted after calling rte_eth_dev_close().
Move rte_eth_dev_close() calls to global terminate from odp_pktio_close().

Signed-off-by: Matias Elo 
Signed-off-by: Maxim Uvarov 


Compare: https://github.com/Linaro/odp/compare/dd0498bb104c...82419a31e6d1


Re: [lng-odp] [PATCH v1] Netmap pktio fixes

2017-10-25 Thread Github ODP bot
Matias Elo(matiaselo) replied on github web page:

platform/linux-generic/pktio/netmap.c
line 14
@@ -388,13 +389,22 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
 
if (pkt_nm->is_virtual) {
static unsigned mac;
+   uint32_t tid = syscall(SYS_gettid);
+
+   if ((int)tid == -1)


Comment:
syscall() specification still defines -1 as an error return value and we should 
adhere to the spec regardless of the function implementation which may change.


> muvarov wrote
> .


>> muvarov wrote
>> man gettid says that it always passes.
>> 
>> kernel code is also:
>> pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
>>  struct pid_namespace *ns)
>> {
>>  pid_t nr = 0;
>> 
>>  rcu_read_lock();
>>  if (!ns)
>>  ns = task_active_pid_ns(current);
>>  if (likely(pid_alive(task))) {
>>  if (type != PIDTYPE_PID)
>>  task = task->group_leader;
>>  nr = pid_nr_ns(rcu_dereference(task->pids[type].pid), ns);
>>  }
>>  rcu_read_unlock();
>> 
>>  return nr;
>> }
>> EXPORT_SYMBOL(__task_pid_nr_ns);
>> 
>> I.e. it will return init process tid 0 in worst case. So this check is not 
>> correct and not needed.
>> 
>> It might be needed additional cast:
>> uint32_t tid = (uint32_t)syscall(SYS_gettid) because of syscall returns 
>> pid_t.


>>> muvarov wrote
>>> @lumag  we also use SYS_gettid() in shm and timer. I think that is not 
>>> subject for this PR. Just general clean up.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 See 
 [here](https://stackoverflow.com/questions/21279649/getting-error-in-c-program-undefined-reference-to-gettid)
  for an interesting discussion of why gettid() is not used.


> Dmitry Eremin-Solenikov(lumag) wrote:
> @matiaselo @muvarov Hmm. I thought that there is already a Glibc wrapper. 
> I would prefer this as a separate function, but it is of minor priority 
> then.


>> muvarov wrote
>> it was copied from netmap source  I think. gittid() will generate 
>> warning due to missing glibc wrapper: 
>> https://stackoverflow.com/questions/30680550/c-gettid-was-not-declared-in-this-scope
>>  Maybe something already changed...


>>> Matias Elo(matiaselo) wrote:
>>> What's the benefit from using gettid()? It seems like the only 
>>> difference is that gettid() cannot fail.


 Dmitry Eremin-Solenikov(lumag) wrote:
 Why don't you use `gettid()` function? Then you can check for its 
 existence in `configure.ac` and provide replacement implementation. 


https://github.com/Linaro/odp/pull/237#discussion_r146774223
updated_at 2017-10-25 07:32:34


Re: [lng-odp] [PATCH API-NEXT v2 1/3] api: ipsec: rework ODP_IPSEC_SA_DISABLE into packet error

2017-10-25 Thread Dmitry Eremin-Solenikov
> delete "either" and reflow comment.

done



[lng-odp] [PATCH API-NEXT v4 0/3] IPsec SA_DISABLE implementation

2017-10-25 Thread Github ODP bot
An implementaion of odp_ipsec_sa_disable() semantic changes. Use dummy packet 
to report sa_disable event completion.

github
/** Email created from pull request 256 (lumag:ipsec_sa_disable_v2)
 ** https://github.com/Linaro/odp/pull/256
 ** Patch: https://github.com/Linaro/odp/pull/256.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: ba520d0a3f4c46777c7aedca029e9979a89c69e7
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 86 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 34 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 244 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH API-NEXT v4 2/3] validation: ipsec: adapt to odp_ipsec_sa_disable() change

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 256 (lumag:ipsec_sa_disable_v2)
 ** https://github.com/Linaro/odp/pull/256
 ** Patch: https://github.com/Linaro/odp/pull/256.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: ba520d0a3f4c46777c7aedca029e9979a89c69e7
 **/
 test/validation/api/ipsec/ipsec.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/test/validation/api/ipsec/ipsec.c 
b/test/validation/api/ipsec/ipsec.c
index a8fdf2b14..ea385d2ae 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -315,7 +315,9 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param,
 void ipsec_sa_destroy(odp_ipsec_sa_t sa)
 {
odp_event_t event;
-   odp_ipsec_status_t status;
+   odp_packet_t packet;
+   odp_ipsec_packet_result_t result;
+   odp_event_subtype_t subtype;
 
CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_disable(sa));
 
@@ -324,14 +326,18 @@ void ipsec_sa_destroy(odp_ipsec_sa_t sa)
event = odp_queue_deq(suite_context.queue);
} while (event == ODP_EVENT_INVALID);
 
-   CU_ASSERT_EQUAL(ODP_EVENT_IPSEC_STATUS, odp_event_type(event));
+   CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
+   odp_event_types(event, &subtype));
+   CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC,
+   subtype);
 
-   CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_status(&status, event));
+   packet  = odp_ipsec_packet_from_event(event);
 
-   CU_ASSERT_EQUAL(ODP_IPSEC_STATUS_SA_DISABLE, status.id);
-   CU_ASSERT_EQUAL(sa, status.sa);
-   CU_ASSERT_EQUAL(0, status.result);
-   CU_ASSERT_EQUAL(0, status.warn.all);
+   CU_ASSERT_EQUAL(0, odp_ipsec_result(&result, packet));
+
+   CU_ASSERT_EQUAL(sa, result.sa);
+   CU_ASSERT_EQUAL(1, result.status.error.sa_disabled);
+   CU_ASSERT_EQUAL(0, result.status.warn.all);
 
odp_event_free(event);
}



[lng-odp] [PATCH API-NEXT v4 1/3] api: ipsec: rework ODP_IPSEC_SA_DISABLE into packet error

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

According to the discussion on mailing list, most of implementations
will not be able to support odp_ipsec_sa_disable() status event
directly.  Instead they will submit a dummy packet to that SA. Then
after receiving this packet after odp_ipsec_result() will detect this
packet and will report it as a packet with
odp_ipsec_error_t->sa_disabled bit set.

Signed-off-by: Dmitry Eremin-Solenikov 
Cc: Nikhil Agarwal 
Cc: Balasubramanian Manoharan 
---
/** Email created from pull request 256 (lumag:ipsec_sa_disable_v2)
 ** https://github.com/Linaro/odp/pull/256
 ** Patch: https://github.com/Linaro/odp/pull/256.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: ba520d0a3f4c46777c7aedca029e9979a89c69e7
 **/
 include/odp/api/spec/ipsec.h | 44 
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 26e852fca..b9ad282ce 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -843,10 +843,12 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param);
  *
  * When in synchronous operation mode, the call will return when it's possible
  * to destroy the SA. In asynchronous mode, the same is indicated by an
- * ODP_EVENT_IPSEC_STATUS event sent to the queue specified for the SA. The
- * status event is guaranteed to be the last event for the SA, i.e. all
- * in-progress operations have completed and resulting events (including status
- * events) have been enqueued before it.
+ * artificial packet event sent to the queue specified for the SA having
+ * sa_disabled error bit set in the odp_ipsec_packet_result_t returned by
+ * odp_ipsec_result(). The packet is guaranteed to be the last event for
+ * the SA, i.e. all in-progress operations have completed and resulting events
+ * (including status events) have been enqueued before it. No packets will come
+ * from SA after this one.
  *
  * @param sa  IPSEC SA to be disabled
  *
@@ -914,6 +916,12 @@ typedef struct odp_ipsec_error_t {
 
/** Hard lifetime expired: packets */
uint32_t hard_exp_packets : 1;
+
+   /**
+* SA is disabled, all packets are processed, it is
+* safe to destroy it now.
+*/
+   uint32_t sa_disabled : 1;
};
 
/** All error bits
@@ -927,7 +935,13 @@ typedef struct odp_ipsec_error_t {
 
 } odp_ipsec_error_t;
 
-/** IPSEC warnings */
+/**
+ * IPSEC warnings
+ *
+ * For outbound SAs in ODP_IPSEC_OP_MODE_INLINE mode warnings can be reported
+ * only as status events. In all other cases warnings are reported as a part of
+ * IPsec packet result metadata.
+ */
 typedef struct odp_ipsec_warn_t {
/** IPSEC warnings */
union {
@@ -1133,15 +1147,6 @@ typedef struct odp_ipsec_packet_result_t {
  * IPSEC status ID
  */
 typedef enum odp_ipsec_status_id_t {
-   /** Response to SA disable command
-*
-*  Following status event (odp_ipsec_status_t) fields have valid
-*  content, other fields must be ignored:
-*  - sa:   The SA that was requested to be disabled
-*  - result:   Operation result
-*/
-   ODP_IPSEC_STATUS_SA_DISABLE = 0,
-
/** Warning from inline IPSEC processing
 *
 *  Following status event (odp_ipsec_status_t) fields have valid
@@ -1152,7 +1157,7 @@ typedef enum odp_ipsec_status_id_t {
 *  This status event is generated only for outbound SAs in
 *  ODP_IPSEC_OP_MODE_INLINE mode.
 */
-   ODP_IPSEC_STATUS_WARN
+   ODP_IPSEC_STATUS_WARN = 0
 
 } odp_ipsec_status_id_t;
 
@@ -1166,13 +1171,6 @@ typedef struct odp_ipsec_status_t {
/** IPSEC SA that was target of the operation */
odp_ipsec_sa_t sa;
 
-   /** Result of the operation
-*
-*   0:Success
-*  <0:Failure
-*/
-   int result;
-
/** Warnings of an ODP_IPSEC_STATUS_WARN status event */
odp_ipsec_warn_t warn;
 
@@ -1469,8 +1467,6 @@ int odp_ipsec_result(odp_ipsec_packet_result_t *result, 
odp_packet_t packet);
  *
  * @retval  0 On success
  * @retval <0 On failure
- *
- * @see odp_ipsec_sa_disable()
  */
 int odp_ipsec_status(odp_ipsec_status_t *status, odp_event_t event);
 



[lng-odp] [PATCH API-NEXT v4 3/3] linux-gen: implement odp_ipsec_sa_disable() changes

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 256 (lumag:ipsec_sa_disable_v2)
 ** https://github.com/Linaro/odp/pull/256
 ** Patch: https://github.com/Linaro/odp/pull/256.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: ba520d0a3f4c46777c7aedca029e9979a89c69e7
 **/
 .../linux-generic/include/odp_ipsec_internal.h | 20 +++-
 platform/linux-generic/odp_ipsec.c | 18 
 platform/linux-generic/odp_ipsec_events.c  | 54 +-
 platform/linux-generic/odp_ipsec_sad.c | 16 ++-
 4 files changed, 84 insertions(+), 24 deletions(-)

diff --git a/platform/linux-generic/include/odp_ipsec_internal.h 
b/platform/linux-generic/include/odp_ipsec_internal.h
index 1340ca7bd..09a7ac126 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -74,9 +74,20 @@ void _odp_ipsec_status_free(ipsec_status_t status);
 int _odp_ipsec_status_send(odp_queue_t queue,
   odp_ipsec_status_id_t id,
   odp_ipsec_sa_t sa,
-  int result,
   odp_ipsec_warn_t warn);
 
+/**
+ * @internal Send SA_DISABLED event
+ *
+ * Sends the packet notifying application that SA finished all processing and
+ * is now disabled.
+ *
+ * @param queue destination queue
+ * @param saSA respective to the operation
+ */
+int _odp_ipsec_sa_disabled_send(odp_queue_t queue,
+   odp_ipsec_sa_t sa);
+
 #define IPSEC_MAX_IV_LEN   32   /**< Maximum IV length in bytes */
 
 #define IPSEC_MAX_SALT_LEN 4/**< Maximum salt length in bytes */
@@ -191,6 +202,13 @@ int _odp_ipsec_sa_update_stats(ipsec_sa_t *ipsec_sa, 
uint32_t len,
 int _odp_ipsec_try_inline(odp_packet_t pkt);
 
 /**
+ * Return IPsec result instance connected to the IPsec packet
+ *
+ * @param packet packet of ODP_EVENT_PACKET_IPSEC subtype
+ */
+odp_ipsec_packet_result_t *_odp_ipsec_pkt_result(odp_packet_t packet);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index e57736c2a..e9bf88c17 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -93,7 +93,7 @@ int odp_ipsec_config(const odp_ipsec_config_t *config)
return 0;
 }
 
-static odp_ipsec_packet_result_t *ipsec_pkt_result(odp_packet_t packet)
+odp_ipsec_packet_result_t *_odp_ipsec_pkt_result(odp_packet_t packet)
 {
ODP_ASSERT(ODP_EVENT_PACKET_IPSEC ==
   odp_event_subtype(odp_packet_to_event(packet)));
@@ -902,7 +902,7 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in,
 
_odp_buffer_event_subtype_set(packet_to_buffer(pkt),
  ODP_EVENT_PACKET_IPSEC);
-   result = ipsec_pkt_result(pkt);
+   result = _odp_ipsec_pkt_result(pkt);
memset(result, 0, sizeof(*result));
result->status = status;
if (NULL != ipsec_sa)
@@ -966,7 +966,7 @@ int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in,
 
_odp_buffer_event_subtype_set(packet_to_buffer(pkt),
  ODP_EVENT_PACKET_IPSEC);
-   result = ipsec_pkt_result(pkt);
+   result = _odp_ipsec_pkt_result(pkt);
memset(result, 0, sizeof(*result));
result->status = status;
result->sa = ipsec_sa->ipsec_sa_hdl;
@@ -1014,7 +1014,7 @@ int odp_ipsec_in_enq(const odp_packet_t pkt_in[], int 
num_in,
 
_odp_buffer_event_subtype_set(packet_to_buffer(pkt),
  ODP_EVENT_PACKET_IPSEC);
-   result = ipsec_pkt_result(pkt);
+   result = _odp_ipsec_pkt_result(pkt);
memset(result, 0, sizeof(*result));
result->status = status;
if (NULL != ipsec_sa) {
@@ -1075,7 +1075,7 @@ int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int 
num_in,
 
_odp_buffer_event_subtype_set(packet_to_buffer(pkt),
  ODP_EVENT_PACKET_IPSEC);
-   result = ipsec_pkt_result(pkt);
+   result = _odp_ipsec_pkt_result(pkt);
memset(result, 0, sizeof(*result));
result->status = status;
result->sa = ipsec_sa->ipsec_sa_hdl;
@@ -1115,7 +1115,7 @@ int _odp_ipsec_try_inline(odp_packet_t pkt)
 
_odp_buffer_event_subtype_set(packet_to_buffer(pkt),
  ODP_EVENT_PACKET_IPSEC);
-   result = ipsec_pkt_result(pkt);
+   result = _odp_ipsec_pkt_result(pkt);
memset(result, 0, sizeof(*result));
result->status = status;
result->sa = ipsec_sa->ipsec_sa_hdl;
@@ -1192,7 +1192,7 @@ int odp_ipsec_o

[lng-odp] [PATCH API-NEXT v3 0/11] IPsec implementation updates

2017-10-25 Thread Github ODP bot
security fix for GCM mode: proper IV generation
implementation of 32-bit replay window support
implementation of PIPELINE_CLS support

github
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 77 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 0 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 62 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 79 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 113 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 54 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 315 lines checked


to_send-p-006.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 133 lines checked


to_send-p-007.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 66 lines checked


to_send-p-008.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 151 lines checked


to_send-p-009.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 244 lines checked


to_send-p-010.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH API-NEXT v3 1/11] linux-gen: ipsec: use counter instead of random IV for GCM

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Reusing IV block with GCM results in disastrous consequences. Use
counter instead of random-generated IV to remove possibility for IV
reuse.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 platform/linux-generic/include/odp_ipsec_internal.h | 16 +---
 platform/linux-generic/odp_ipsec.c  | 19 ++-
 platform/linux-generic/odp_ipsec_sad.c  |  6 ++
 3 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/include/odp_ipsec_internal.h 
b/platform/linux-generic/include/odp_ipsec_internal.h
index 1340ca7bd..afc2f686e 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -118,9 +118,17 @@ struct ipsec_sa_s {
uint8_t salt[IPSEC_MAX_SALT_LEN];
uint32_tsalt_length;
 
-   unsigneddec_ttl : 1;
-   unsignedcopy_dscp : 1;
-   unsignedcopy_df : 1;
+   union {
+   unsigned flags;
+   struct {
+   unsigneddec_ttl : 1;
+   unsignedcopy_dscp : 1;
+   unsignedcopy_df : 1;
+
+   /* Only for outbound */
+   unsigneduse_counter_iv : 1;
+   };
+   };
 
union {
struct {
@@ -136,6 +144,8 @@ struct ipsec_sa_s {
odp_atomic_u32_t tun_hdr_id;
odp_atomic_u32_t seq;
 
+   odp_atomic_u64_t counter; /* for CTR/GCM */
+
uint8_t tun_ttl;
uint8_t tun_dscp;
uint8_t tun_df;
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index e57736c2a..1aa437b8e 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -676,7 +676,24 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
   ip_data_len +
   ipsec_sa->icv_len;
 
-   if (ipsec_sa->esp_iv_len) {
+   if (ipsec_sa->use_counter_iv) {
+   uint64_t ctr;
+
+   /* Both GCM and CTR use 8-bit counters */
+   ODP_ASSERT(sizeof(ctr) == ipsec_sa->esp_iv_len);
+
+   ctr = odp_atomic_fetch_add_u64(&ipsec_sa->out.counter,
+  1);
+   /* Check for overrun */
+   if (ctr == 0)
+   goto out;
+
+   memcpy(iv, ipsec_sa->salt, ipsec_sa->salt_length);
+   memcpy(iv + ipsec_sa->salt_length, &ctr,
+  ipsec_sa->esp_iv_len);
+
+   param.override_iv_ptr = iv;
+   } else if (ipsec_sa->esp_iv_len) {
uint32_t len;
 
len = odp_random_data(iv + ipsec_sa->salt_length,
diff --git a/platform/linux-generic/odp_ipsec_sad.c 
b/platform/linux-generic/odp_ipsec_sad.c
index f0b5b9e4a..5d20bb66c 100644
--- a/platform/linux-generic/odp_ipsec_sad.c
+++ b/platform/linux-generic/odp_ipsec_sad.c
@@ -207,6 +207,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param)
ipsec_sa->context = param->context;
ipsec_sa->queue = param->dest_queue;
ipsec_sa->mode = param->mode;
+   ipsec_sa->flags = 0;
if (ODP_IPSEC_DIR_INBOUND == param->dir) {
ipsec_sa->in.lookup_mode = param->inbound.lookup_mode;
if (ODP_IPSEC_LOOKUP_DSTADDR_SPI == ipsec_sa->in.lookup_mode)
@@ -315,6 +316,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param)
case ODP_CIPHER_ALG_AES128_GCM:
 #endif
case ODP_CIPHER_ALG_AES_GCM:
+   ipsec_sa->use_counter_iv = 1;
ipsec_sa->esp_iv_len = 8;
ipsec_sa->esp_block_len = 16;
crypto_param.iv.length = 12;
@@ -323,6 +325,10 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param)
return ODP_IPSEC_SA_INVALID;
}
 
+   if (1 == ipsec_sa->use_counter_iv &&
+   ODP_IPSEC_DIR_OUTBOUND == param->dir)
+   odp_atomic_init_u64(&ipsec_sa->out.counter, 1);
+
crypto_param.auth_digest_len = ipsec_sa->icv_len;
 
if (param->crypto.cipher_key_extra.length) {



[lng-odp] [PATCH API-NEXT v3 2/11] validation: ipsec: drop unused file

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 test/validation/api/ipsec/ipsec_sync_in.c | 27 ---
 1 file changed, 27 deletions(-)
 delete mode 100644 test/validation/api/ipsec/ipsec_sync_in.c

diff --git a/test/validation/api/ipsec/ipsec_sync_in.c 
b/test/validation/api/ipsec/ipsec_sync_in.c
deleted file mode 100644
index 8a7fc4680..0
--- a/test/validation/api/ipsec/ipsec_sync_in.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (c) 2017, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#include "ipsec.h"
-
-int main(int argc, char *argv[])
-{
-   int ret;
-
-   /* parse common options: */
-   if (odp_cunit_parse_options(argc, argv))
-   return -1;
-
-   odp_cunit_register_global_init(ipsec_init);
-   odp_cunit_register_global_term(ipsec_term);
-
-   ret = odp_cunit_register(ipsec_suites);
-   if (ret == 0)
-   ret = odp_cunit_run();
-
-   return ret;
-}



[lng-odp] [PATCH API-NEXT v3 4/11] linux-gen: ipsec: fix soft/hard limits check

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Split count expiration check into two phases:
 - optional precheck, run before crypto, which fails only if hard limit
   is already breached
 - update, run after crypto in INBOUND case, so that limits will not be
   updated for packets failing ICV check.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 .../linux-generic/include/odp_ipsec_internal.h | 10 +-
 platform/linux-generic/odp_ipsec.c | 12 +--
 platform/linux-generic/odp_ipsec_sad.c | 23 +-
 3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/platform/linux-generic/include/odp_ipsec_internal.h 
b/platform/linux-generic/include/odp_ipsec_internal.h
index afc2f686e..68ab195c7 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -185,11 +185,19 @@ void _odp_ipsec_sa_unuse(ipsec_sa_t *ipsec_sa);
 ipsec_sa_t *_odp_ipsec_sa_lookup(const ipsec_sa_lookup_t *lookup);
 
 /**
+ * Run pre-check on SA usage statistics.
+ *
+ * @retval <0 if hard limits were breached
+ */
+int _odp_ipsec_sa_stats_precheck(ipsec_sa_t *ipsec_sa,
+odp_ipsec_op_status_t *status);
+
+/**
  * Update SA usage statistics, filling respective status for the packet.
  *
  * @retval <0 if hard limits were breached
  */
-int _odp_ipsec_sa_update_stats(ipsec_sa_t *ipsec_sa, uint32_t len,
+int _odp_ipsec_sa_stats_update(ipsec_sa_t *ipsec_sa, uint32_t len,
   odp_ipsec_op_status_t *status);
 
 /**
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index 1aa437b8e..55b60162d 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -412,9 +412,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
goto out;
}
 
-   if (_odp_ipsec_sa_update_stats(ipsec_sa,
-  stats_length,
-  status) < 0)
+   if (_odp_ipsec_sa_stats_precheck(ipsec_sa, status) < 0)
goto out;
 
param.session = ipsec_sa->session;
@@ -449,6 +447,9 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
goto out;
}
 
+   if (_odp_ipsec_sa_stats_update(ipsec_sa, stats_length, status) < 0)
+   goto out;
+
ip_offset = odp_packet_l3_offset(pkt);
ip = odp_packet_l3_ptr(pkt, NULL);
ip_hdr_len = ipv4_hdr_len(ip);
@@ -835,9 +836,8 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
goto out;
}
 
-   if (_odp_ipsec_sa_update_stats(ipsec_sa,
-  stats_length,
-  status) < 0)
+   /* No need to run precheck here, we know that packet is authentic */
+   if (_odp_ipsec_sa_stats_update(ipsec_sa, stats_length, status) < 0)
goto out;
 
param.session = ipsec_sa->session;
diff --git a/platform/linux-generic/odp_ipsec_sad.c 
b/platform/linux-generic/odp_ipsec_sad.c
index 5d20bb66c..fe8dfd0e4 100644
--- a/platform/linux-generic/odp_ipsec_sad.c
+++ b/platform/linux-generic/odp_ipsec_sad.c
@@ -476,7 +476,28 @@ ipsec_sa_t *_odp_ipsec_sa_lookup(const ipsec_sa_lookup_t 
*lookup)
return best;
 }
 
-int _odp_ipsec_sa_update_stats(ipsec_sa_t *ipsec_sa, uint32_t len,
+int _odp_ipsec_sa_stats_precheck(ipsec_sa_t *ipsec_sa,
+odp_ipsec_op_status_t *status)
+{
+   uint64_t bytes = odp_atomic_load_u64(&ipsec_sa->bytes);
+   uint64_t packets = odp_atomic_load_u64(&ipsec_sa->packets);
+   int rc = 0;
+
+   if (ipsec_sa->hard_limit_bytes > 0 &&
+   bytes > ipsec_sa->hard_limit_bytes) {
+   status->error.hard_exp_bytes = 1;
+   rc = -1;
+   }
+   if (ipsec_sa->hard_limit_packets > 0 &&
+   packets > ipsec_sa->hard_limit_packets) {
+   status->error.hard_exp_packets = 1;
+   rc = -1;
+   }
+
+   return rc;
+}
+
+int _odp_ipsec_sa_stats_update(ipsec_sa_t *ipsec_sa, uint32_t len,
   odp_ipsec_op_status_t *status)
 {
uint64_t bytes = odp_atomic_fetch_add_u64(&ipsec_sa->bytes, len) + len;



[lng-odp] [PATCH API-NEXT v3 3/11] validation: ipsec: verify odp_ipsec_sa_context

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 test/validation/api/ipsec/ipsec.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/test/validation/api/ipsec/ipsec.c 
b/test/validation/api/ipsec/ipsec.c
index a8fdf2b14..853bd88a9 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -19,6 +19,9 @@ struct suite_context_s suite_context;
 #define PKT_POOL_NUM  64
 #define PKT_POOL_LEN  (1 * 1024)
 
+#define PACKET_USER_PTR((void *)0x1212fefe)
+#define IPSEC_SA_CTX   ((void *)0xfefefafa)
+
 static odp_pktio_t pktio_create(odp_pool_t pool)
 {
odp_pktio_t pktio;
@@ -300,6 +303,8 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param,
 
param->dest_queue = suite_context.queue;
 
+   param->context = IPSEC_SA_CTX;
+
param->crypto.cipher_alg = cipher_alg;
if (cipher_key)
param->crypto.cipher_key = *cipher_key;
@@ -317,6 +322,8 @@ void ipsec_sa_destroy(odp_ipsec_sa_t sa)
odp_event_t event;
odp_ipsec_status_t status;
 
+   CU_ASSERT_EQUAL(IPSEC_SA_CTX, odp_ipsec_sa_context(sa));
+
CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_disable(sa));
 
if (ODP_QUEUE_INVALID != suite_context.queue) {
@@ -339,8 +346,6 @@ void ipsec_sa_destroy(odp_ipsec_sa_t sa)
CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_destroy(sa));
 }
 
-#define PACKET_USER_PTR((void *)0x1212fefe)
-
 odp_packet_t ipsec_packet(const ipsec_test_packet *itp)
 {
odp_packet_t pkt = odp_packet_alloc(suite_context.pool, itp->len);
@@ -608,7 +613,13 @@ void ipsec_check_in_one(const ipsec_test_part *part, 
odp_ipsec_sa_t sa)
CU_ASSERT_EQUAL(0, odp_ipsec_result(&result, pkto[i]));
CU_ASSERT_EQUAL(part->out[i].status.error.all,
result.status.error.all);
+   CU_ASSERT_EQUAL(suite_context.inbound_op_mode ==
+   ODP_IPSEC_OP_MODE_INLINE,
+   result.flag.inline_mode);
CU_ASSERT_EQUAL(sa, result.sa);
+   if (ODP_IPSEC_SA_INVALID != sa)
+   CU_ASSERT_EQUAL(IPSEC_SA_CTX,
+   odp_ipsec_sa_context(sa));
}
ipsec_check_packet(part->out[i].pkt_out,
   pkto[i]);
@@ -642,6 +653,8 @@ void ipsec_check_out_one(const ipsec_test_part *part, 
odp_ipsec_sa_t sa)
CU_ASSERT_EQUAL(part->out[i].status.error.all,
result.status.error.all);
CU_ASSERT_EQUAL(sa, result.sa);
+   CU_ASSERT_EQUAL(IPSEC_SA_CTX,
+   odp_ipsec_sa_context(sa));
}
ipsec_check_packet(part->out[i].pkt_out,
   pkto[i]);
@@ -679,6 +692,8 @@ void ipsec_check_out_in_one(const ipsec_test_part *part,
CU_ASSERT_EQUAL(part->out[i].status.error.all,
result.status.error.all);
CU_ASSERT_EQUAL(sa, result.sa);
+   CU_ASSERT_EQUAL(IPSEC_SA_CTX,
+   odp_ipsec_sa_context(sa));
}
CU_ASSERT_FATAL(odp_packet_len(pkto[i]) <=
sizeof(pkt_in.data));



[lng-odp] [PATCH API-NEXT v3 5/11] linux-gen: ipsec: add replay window support to SAD

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 .../linux-generic/include/odp_ipsec_internal.h | 20 
 platform/linux-generic/odp_ipsec_sad.c | 60 ++
 2 files changed, 80 insertions(+)

diff --git a/platform/linux-generic/include/odp_ipsec_internal.h 
b/platform/linux-generic/include/odp_ipsec_internal.h
index 68ab195c7..0a7f96256 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -81,6 +81,9 @@ int _odp_ipsec_status_send(odp_queue_t queue,
 
 #define IPSEC_MAX_SALT_LEN 4/**< Maximum salt length in bytes */
 
+/* 32 is minimum required by the standard. We do not support more */
+#define IPSEC_ANTIREPLAY_WS32
+
 /**
  * Maximum number of available SAs
  */
@@ -127,6 +130,9 @@ struct ipsec_sa_s {
 
/* Only for outbound */
unsigneduse_counter_iv : 1;
+
+   /* Only for inbound */
+   unsignedantireplay : 1;
};
};
 
@@ -134,6 +140,7 @@ struct ipsec_sa_s {
struct {
odp_ipsec_lookup_mode_t lookup_mode;
odp_u32be_t lookup_dst_ip;
+   odp_atomic_u64_t antireplay;
} in;
 
struct {
@@ -200,6 +207,19 @@ int _odp_ipsec_sa_stats_precheck(ipsec_sa_t *ipsec_sa,
 int _odp_ipsec_sa_stats_update(ipsec_sa_t *ipsec_sa, uint32_t len,
   odp_ipsec_op_status_t *status);
 
+/* Run pre-check on sequence number of the packet.
+ *
+ * @retval <0 if the packet falls out of window
+ */
+int _odp_ipsec_sa_replay_precheck(ipsec_sa_t *ipsec_sa, uint32_t seq,
+ odp_ipsec_op_status_t *status);
+
+/* Run check on sequence number of the packet and update window if necessary.
+ *
+ * @retval <0 if the packet falls out of window
+ */
+int _odp_ipsec_sa_replay_update(ipsec_sa_t *ipsec_sa, uint32_t seq,
+   odp_ipsec_op_status_t *status);
 /**
  * Try inline IPsec processing of provided packet.
  *
diff --git a/platform/linux-generic/odp_ipsec_sad.c 
b/platform/linux-generic/odp_ipsec_sad.c
index fe8dfd0e4..e010cfaa3 100644
--- a/platform/linux-generic/odp_ipsec_sad.c
+++ b/platform/linux-generic/odp_ipsec_sad.c
@@ -215,6 +215,10 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param)
   param->inbound.lookup_param.dst_addr,
   sizeof(ipsec_sa->in.lookup_dst_ip));
 
+   if (param->inbound.antireplay_ws > IPSEC_ANTIREPLAY_WS)
+   return ODP_IPSEC_SA_INVALID;
+   ipsec_sa->antireplay = (param->inbound.antireplay_ws != 0);
+   odp_atomic_init_u64(&ipsec_sa->in.antireplay, 0);
} else {
odp_atomic_store_u32(&ipsec_sa->out.seq, 1);
}
@@ -525,3 +529,59 @@ int _odp_ipsec_sa_stats_update(ipsec_sa_t *ipsec_sa, 
uint32_t len,
 
return rc;
 }
+
+int _odp_ipsec_sa_replay_precheck(ipsec_sa_t *ipsec_sa, uint32_t seq,
+ odp_ipsec_op_status_t *status)
+{
+   /* Try to be as quick as possible, we will discard packets later */
+   if (ipsec_sa->antireplay &&
+   seq + IPSEC_ANTIREPLAY_WS <=
+   (odp_atomic_load_u64(&ipsec_sa->in.antireplay) & 0x)) {
+   status->error.antireplay = 1;
+   return -1;
+   }
+
+   return 0;
+}
+
+int _odp_ipsec_sa_replay_update(ipsec_sa_t *ipsec_sa, uint32_t seq,
+   odp_ipsec_op_status_t *status)
+{
+   int cas = 0;
+   uint64_t state, new_state;
+
+   if (!ipsec_sa->antireplay)
+   return 0;
+
+   state = odp_atomic_load_u64(&ipsec_sa->in.antireplay);
+
+   while (0 == cas) {
+   uint32_t max_seq = state & 0x;
+   uint32_t mask = state >> 32;
+
+   if (seq + IPSEC_ANTIREPLAY_WS <= max_seq) {
+   status->error.antireplay = 1;
+   return -1;
+   }
+
+   if (seq > max_seq) {
+   mask <<= seq - max_seq;
+   mask |= 1;
+   max_seq = seq;
+   } else {
+   if (mask & (1U << (max_seq - seq))) {
+   status->error.antireplay = 1;
+   return -1;
+   }
+
+   mask |= (1U << (max_seq - seq));
+   }
+
+   new_state = (((uint64_t)mask) << 32) | ma

[lng-odp] [PATCH API-NEXT v3 6/11] linux-gen: ipsec: support replay window checks

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 platform/linux-generic/odp_ipsec.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index 55b60162d..5bb8330cb 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -42,6 +42,8 @@ int odp_ipsec_capability(odp_ipsec_capability_t *capa)
 
capa->max_num_sa = ODP_CONFIG_IPSEC_SAS;
 
+   capa->max_antireplay_ws = IPSEC_ANTIREPLAY_WS;
+
rc = odp_crypto_capability(&crypto_capa);
if (rc < 0)
return rc;
@@ -402,6 +404,12 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
ip->frag_offset = 0;
ip->ttl = 0;
 
+   aad.spi = ah.spi;
+   aad.seq_no = ah.seq_no;
+
+   param.aad.ptr = (uint8_t *)&aad;
+   param.aad.length = sizeof(aad);
+
param.auth_range.offset = ip_offset;
param.auth_range.length = odp_be_to_cpu_16(ip->tot_len);
param.hash_result_offset = ipsec_offset + _ODP_AHHDR_LEN;
@@ -412,6 +420,11 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
goto out;
}
 
+   if (_odp_ipsec_sa_replay_precheck(ipsec_sa,
+ odp_be_to_cpu_32(aad.seq_no),
+ status) < 0)
+   goto out;
+
if (_odp_ipsec_sa_stats_precheck(ipsec_sa, status) < 0)
goto out;
 
@@ -450,6 +463,11 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
if (_odp_ipsec_sa_stats_update(ipsec_sa, stats_length, status) < 0)
goto out;
 
+   if (_odp_ipsec_sa_replay_update(ipsec_sa,
+   odp_be_to_cpu_32(aad.seq_no),
+   status) < 0)
+   goto out;
+
ip_offset = odp_packet_l3_offset(pkt);
ip = odp_packet_l3_ptr(pkt, NULL);
ip_hdr_len = ipv4_hdr_len(ip);
@@ -814,6 +832,12 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
ah.next_header = ip->proto;
ip->proto = _ODP_IPPROTO_AH;
 
+   aad.spi = ah.spi;
+   aad.seq_no = ah.seq_no;
+
+   param.aad.ptr = (uint8_t *)&aad;
+   param.aad.length = sizeof(aad);
+
odp_packet_copy_from_mem(pkt,
 ipsec_offset, _ODP_AHHDR_LEN,
 &ah);



[lng-odp] [PATCH API-NEXT v3 8/11] linux-gen: classification: provide _odp_cos_get_entry() function

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Provide function mapping from odp_cos_t to internal cos_t type.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 .../include/odp_classification_datamodel.h |  4 +++
 platform/linux-generic/odp_classification.c| 33 +++---
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/platform/linux-generic/include/odp_classification_datamodel.h 
b/platform/linux-generic/include/odp_classification_datamodel.h
index 29b39f9c3..a40541986 100644
--- a/platform/linux-generic/include/odp_classification_datamodel.h
+++ b/platform/linux-generic/include/odp_classification_datamodel.h
@@ -123,6 +123,10 @@ typedef union cos_u {
uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct cos_s))];
 } cos_t;
 
+/**
+ * Get classification entry basing on the id
+ */
+cos_t *_odp_cos_get_entry(odp_cos_t cos_id);
 
 /**
 Packet Matching Rule
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index a5cba56a4..6ece74fca 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -302,8 +302,7 @@ odp_pmr_t alloc_pmr(pmr_t **pmr)
return ODP_PMR_INVAL;
 }
 
-static
-cos_t *get_cos_entry(odp_cos_t cos_id)
+cos_t *_odp_cos_get_entry(odp_cos_t cos_id)
 {
if (_odp_typeval(cos_id) >= CLS_COS_MAX_ENTRY ||
cos_id == ODP_COS_INVALID)
@@ -326,7 +325,7 @@ pmr_t *get_pmr_entry(odp_pmr_t pmr_id)
 
 int odp_cos_destroy(odp_cos_t cos_id)
 {
-   cos_t *cos = get_cos_entry(cos_id);
+   cos_t *cos = _odp_cos_get_entry(cos_id);
 
if (NULL == cos) {
ODP_ERR("Invalid odp_cos_t handle");
@@ -339,7 +338,7 @@ int odp_cos_destroy(odp_cos_t cos_id)
 
 int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id)
 {
-   cos_t *cos = get_cos_entry(cos_id);
+   cos_t *cos = _odp_cos_get_entry(cos_id);
 
if (cos == NULL) {
ODP_ERR("Invalid odp_cos_t handle");
@@ -353,7 +352,7 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t 
queue_id)
 
 odp_queue_t odp_cos_queue(odp_cos_t cos_id)
 {
-   cos_t *cos = get_cos_entry(cos_id);
+   cos_t *cos = _odp_cos_get_entry(cos_id);
 
if (!cos) {
ODP_ERR("Invalid odp_cos_t handle");
@@ -365,7 +364,7 @@ odp_queue_t odp_cos_queue(odp_cos_t cos_id)
 
 uint32_t odp_cls_cos_num_queue(odp_cos_t cos_id)
 {
-   cos_t *cos = get_cos_entry(cos_id);
+   cos_t *cos = _odp_cos_get_entry(cos_id);
 
if (!cos) {
ODP_ERR("Invalid odp_cos_t handle");
@@ -383,7 +382,7 @@ uint32_t odp_cls_cos_queues(odp_cos_t cos_id, odp_queue_t 
queue[],
uint32_t tbl_index;
uint32_t i;
 
-   cos  = get_cos_entry(cos_id);
+   cos  = _odp_cos_get_entry(cos_id);
if (!cos) {
ODP_ERR("Invalid odp_cos_t handle");
return 0;
@@ -403,7 +402,7 @@ uint32_t odp_cls_cos_queues(odp_cos_t cos_id, odp_queue_t 
queue[],
 
 int odp_cos_drop_set(odp_cos_t cos_id, odp_cls_drop_t drop_policy)
 {
-   cos_t *cos = get_cos_entry(cos_id);
+   cos_t *cos = _odp_cos_get_entry(cos_id);
 
if (!cos) {
ODP_ERR("Invalid odp_cos_t handle");
@@ -417,7 +416,7 @@ int odp_cos_drop_set(odp_cos_t cos_id, odp_cls_drop_t 
drop_policy)
 
 odp_cls_drop_t odp_cos_drop(odp_cos_t cos_id)
 {
-   cos_t *cos = get_cos_entry(cos_id);
+   cos_t *cos = _odp_cos_get_entry(cos_id);
 
if (!cos) {
ODP_ERR("Invalid odp_cos_t handle");
@@ -437,7 +436,7 @@ int odp_pktio_default_cos_set(odp_pktio_t pktio_in, 
odp_cos_t default_cos)
ODP_ERR("Invalid odp_pktio_t handle");
return -1;
}
-   cos = get_cos_entry(default_cos);
+   cos = _odp_cos_get_entry(default_cos);
if (cos == NULL) {
ODP_ERR("Invalid odp_cos_t handle");
return -1;
@@ -458,7 +457,7 @@ int odp_pktio_error_cos_set(odp_pktio_t pktio_in, odp_cos_t 
error_cos)
return -1;
}
 
-   cos = get_cos_entry(error_cos);
+   cos = _odp_cos_get_entry(error_cos);
if (cos == NULL) {
ODP_ERR("Invalid odp_cos_t handle");
return -1;
@@ -512,7 +511,7 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
LOCK(&l2_cos->lock);
/* Update the L2 QoS table*/
for (i = 0; i < num_qos; i++) {
-   cos = get_cos_entry(cos_table[i]);
+   cos = _odp_cos_get_entry(cos_table[i]);
if (cos != NULL) {
if (CLS_COS_MAX_L2_QOS > qos_table[i])
l2_cos->cos[qos_table[i]] = cos;
@@ -544,7 +543,7 @@ i

[lng-odp] [PATCH API-NEXT v3 7/11] validation: ipsec: add replay window checks

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 test/validation/api/ipsec/ipsec_test_in.c | 204 ++
 test/validation/api/ipsec/test_vectors.h  |  87 +
 2 files changed, 291 insertions(+)

diff --git a/test/validation/api/ipsec/ipsec_test_in.c 
b/test/validation/api/ipsec/ipsec_test_in.c
index 25fc00e11..598a83e3f 100644
--- a/test/validation/api/ipsec/ipsec_test_in.c
+++ b/test/validation/api/ipsec/ipsec_test_in.c
@@ -284,6 +284,202 @@ static void test_in_esp_null_sha256_tun(void)
ipsec_sa_destroy(sa);
 }
 
+static void test_in_ah_sha256_noreplay(void)
+{
+   odp_ipsec_sa_param_t param;
+   odp_ipsec_sa_t sa;
+
+   ipsec_sa_param_fill(¶m,
+   true, true, 123, NULL,
+   ODP_CIPHER_ALG_NULL, NULL,
+   ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256,
+   NULL);
+   param.inbound.antireplay_ws = 0;
+
+   sa = odp_ipsec_sa_create(¶m);
+
+   CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa);
+
+   ipsec_test_part test = {
+   .pkt_in = &pkt_icmp_0_ah_sha256_1,
+   .out_pkt = 1,
+   .out = {
+   { .status.warn.all = 0,
+ .status.error.all = 0,
+ .pkt_out = &pkt_icmp_0 },
+   },
+   };
+
+   ipsec_test_part test_1235 = {
+   .pkt_in = &pkt_icmp_0_ah_sha256_1235,
+   .out_pkt = 1,
+   .out = {
+   { .status.warn.all = 0,
+ .status.error.all = 0,
+ .pkt_out = &pkt_icmp_0 },
+   },
+   };
+
+   ipsec_check_in_one(&test, sa);
+   ipsec_check_in_one(&test, sa);
+   ipsec_check_in_one(&test_1235, sa);
+   ipsec_check_in_one(&test, sa);
+
+   ipsec_sa_destroy(sa);
+}
+
+static void test_in_ah_sha256_replay(void)
+{
+   odp_ipsec_sa_param_t param;
+   odp_ipsec_sa_t sa;
+
+   ipsec_sa_param_fill(¶m,
+   true, true, 123, NULL,
+   ODP_CIPHER_ALG_NULL, NULL,
+   ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256,
+   NULL);
+   param.inbound.antireplay_ws = 32;
+
+   sa = odp_ipsec_sa_create(¶m);
+
+   CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa);
+
+   ipsec_test_part test = {
+   .pkt_in = &pkt_icmp_0_ah_sha256_1,
+   .out_pkt = 1,
+   .out = {
+   { .status.warn.all = 0,
+ .status.error.all = 0,
+ .pkt_out = &pkt_icmp_0 },
+   },
+   };
+
+   ipsec_test_part test_repl = {
+   .pkt_in = &pkt_icmp_0_ah_sha256_1,
+   .out_pkt = 1,
+   .out = {
+   { .status.warn.all = 0,
+ .status.error.antireplay = 1,
+ .pkt_out = NULL },
+   },
+   };
+
+   ipsec_test_part test_1235 = {
+   .pkt_in = &pkt_icmp_0_ah_sha256_1235,
+   .out_pkt = 1,
+   .out = {
+   { .status.warn.all = 0,
+ .status.error.all = 0,
+ .pkt_out = &pkt_icmp_0 },
+   },
+   };
+
+   ipsec_check_in_one(&test, sa);
+   ipsec_check_in_one(&test_repl, sa);
+   ipsec_check_in_one(&test_1235, sa);
+   ipsec_check_in_one(&test_repl, sa);
+
+   ipsec_sa_destroy(sa);
+}
+
+static void test_in_esp_null_sha256_noreplay(void)
+{
+   odp_ipsec_sa_param_t param;
+   odp_ipsec_sa_t sa;
+
+   ipsec_sa_param_fill(¶m,
+   true, false, 123, NULL,
+   ODP_CIPHER_ALG_NULL, NULL,
+   ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256,
+   NULL);
+   param.inbound.antireplay_ws = 0;
+
+   sa = odp_ipsec_sa_create(¶m);
+
+   CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa);
+
+   ipsec_test_part test = {
+   .pkt_in = &pkt_icmp_0_esp_null_sha256_1,
+   .out_pkt = 1,
+   .out = {
+   { .status.warn.all = 0,
+ .status.error.all = 0,
+ .pkt_out = &pkt_icmp_0 },
+   },
+   };
+
+   ipsec_test_part test_1235 = {
+   .pkt_in = &pkt_icmp_0_esp_null_sha256_1235,
+   .out_pkt = 1,
+   .out = {
+   { .status.warn.all = 0,
+ .status.error.all = 0,
+  

[lng-odp] [PATCH API-NEXT v3 9/11] linux-gen: classification: split cls_pkt_get_queue() function

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Separate function returning destination queue from cos_t instance.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 .../include/odp_classification_internal.h  |  7 +
 platform/linux-generic/odp_classification.c| 34 --
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/platform/linux-generic/include/odp_classification_internal.h 
b/platform/linux-generic/include/odp_classification_internal.h
index 8882a7177..4cadb9bdb 100644
--- a/platform/linux-generic/include/odp_classification_internal.h
+++ b/platform/linux-generic/include/odp_classification_internal.h
@@ -42,6 +42,13 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t 
*base,
odp_packet_hdr_t *pkt_hdr);
 
 /**
+ * @internal
+ * Select packet destination queue basing on provided cos entry
+ */
+odp_queue_t cls_pkt_get_queue(odp_packet_hdr_t *pkt_hdr, cos_t *cos,
+ const uint8_t *base);
+
+/**
 Packet IO classifier init
 
 This function does initialization of classifier object associated with pktio.
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index 6ece74fca..317caefbf 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -961,8 +961,7 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t 
*base,
odp_packet_hdr_t *pkt_hdr)
 {
cos_t *cos;
-   uint32_t tbl_index;
-   uint32_t hash;
+   odp_queue_t queue;
 
packet_parse_reset(pkt_hdr);
packet_set_len(pkt_hdr, pkt_len);
@@ -979,20 +978,37 @@ int cls_classify_packet(pktio_entry_t *entry, const 
uint8_t *base,
return -EFAULT;
 
*pool = cos->s.pool;
+
pkt_hdr->p.input_flags.dst_queue = 1;
 
-   if (!cos->s.queue_group) {
-   pkt_hdr->dst_queue = queue_fn->from_ext(cos->s.queue);
-   return 0;
-   }
+   queue = cls_pkt_get_queue(pkt_hdr, cos, base);
+   pkt_hdr->dst_queue = queue_fn->from_ext(queue);
+
+   return 0;
+}
+
+/**
+ * Set packet destination queue basing on the cos
+ *
+ * @param cos
+ * @param pkt_hdr  Packet header
+ * @param base Packet data
+ */
+odp_queue_t cls_pkt_get_queue(odp_packet_hdr_t *pkt_hdr, cos_t *cos,
+ const uint8_t *base)
+{
+   uint32_t tbl_index;
+   uint32_t hash;
+
+   if (!cos->s.queue_group)
+   return cos->s.queue;
 
hash = packet_rss_hash(pkt_hdr, cos->s.hash_proto, base);
/* CLS_COS_QUEUE_MAX is a power of 2 */
hash = hash & (CLS_COS_QUEUE_MAX - 1);
tbl_index = (cos->s.index * CLS_COS_QUEUE_MAX) + hash;
-   pkt_hdr->dst_queue = queue_fn->from_ext(queue_grp_tbl->
-   s.queue[tbl_index]);
-   return 0;
+
+   return queue_grp_tbl->s.queue[tbl_index];
 }
 
 static uint32_t packet_rss_hash(odp_packet_hdr_t *pkt_hdr,



[lng-odp] [PATCH API-NEXT v3 10/11] linux-gen: ipsec: support pipelining to cos_t

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 .../include/odp_classification_datamodel.h |  2 --
 .../linux-generic/include/odp_ipsec_internal.h |  7 
 platform/linux-generic/odp_ipsec.c | 37 --
 platform/linux-generic/odp_ipsec_sad.c | 16 +-
 4 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp_classification_datamodel.h 
b/platform/linux-generic/include/odp_classification_datamodel.h
index a40541986..25c488497 100644
--- a/platform/linux-generic/include/odp_classification_datamodel.h
+++ b/platform/linux-generic/include/odp_classification_datamodel.h
@@ -22,8 +22,6 @@ extern "C" {
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 
diff --git a/platform/linux-generic/include/odp_ipsec_internal.h 
b/platform/linux-generic/include/odp_ipsec_internal.h
index 0a7f96256..81ecec08e 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -23,6 +23,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 
 /** @ingroup odp_ipsec
  *  @{
@@ -141,6 +142,7 @@ struct ipsec_sa_s {
odp_ipsec_lookup_mode_t lookup_mode;
odp_u32be_t lookup_dst_ip;
odp_atomic_u64_t antireplay;
+   cos_t   *cos;
} in;
 
struct {
@@ -229,6 +231,11 @@ int _odp_ipsec_sa_replay_update(ipsec_sa_t *ipsec_sa, 
uint32_t seq,
 int _odp_ipsec_try_inline(odp_packet_t pkt);
 
 /**
+ * Returns ODP IPsec configuration
+ */
+const odp_ipsec_config_t *_odp_ipsec_config_get(void);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index 5bb8330cb..74a1c5766 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -30,6 +31,7 @@ int odp_ipsec_capability(odp_ipsec_capability_t *capa)
int rc;
odp_crypto_capability_t crypto_capa;
odp_queue_capability_t queue_capa;
+   odp_cls_capability_t cls_capa;
 
memset(capa, 0, sizeof(odp_ipsec_capability_t));
 
@@ -39,6 +41,7 @@ int odp_ipsec_capability(odp_ipsec_capability_t *capa)
capa->op_mode_inline_out = ODP_SUPPORT_PREFERRED;
 
capa->proto_ah = ODP_SUPPORT_YES;
+   capa->pipeline_cls = ODP_SUPPORT_YES;
 
capa->max_num_sa = ODP_CONFIG_IPSEC_SAS;
 
@@ -57,6 +60,12 @@ int odp_ipsec_capability(odp_ipsec_capability_t *capa)
 
capa->max_queues = queue_capa.max_queues;
 
+   rc = odp_cls_capability(&cls_capa);
+   if (rc < 0)
+   return rc;
+
+   capa->max_cls_cos = cls_capa.max_cos;
+
return 0;
 }
 
@@ -95,6 +104,11 @@ int odp_ipsec_config(const odp_ipsec_config_t *config)
return 0;
 }
 
+const odp_ipsec_config_t *_odp_ipsec_config_get(void)
+{
+   return &ipsec_config;
+}
+
 static odp_ipsec_packet_result_t *ipsec_pkt_result(odp_packet_t packet)
 {
ODP_ASSERT(ODP_EVENT_PACKET_IPSEC ==
@@ -1060,7 +1074,16 @@ int odp_ipsec_in_enq(const odp_packet_t pkt_in[], int 
num_in,
result->status = status;
if (NULL != ipsec_sa) {
result->sa = ipsec_sa->ipsec_sa_hdl;
-   queue = ipsec_sa->queue;
+   if (ipsec_sa->in.cos && !status.error.all) {
+   odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+   const uint8_t *base = odp_packet_data(pkt);
+
+   queue = cls_pkt_get_queue(pkt_hdr,
+ ipsec_sa->in.cos,
+ base);
+   } else {
+   queue = ipsec_sa->queue;
+   }
} else {
result->sa = ODP_IPSEC_SA_INVALID;
queue = ipsec_config.inbound.default_queue;
@@ -1143,6 +1166,7 @@ int _odp_ipsec_try_inline(odp_packet_t pkt)
ipsec_sa_t *ipsec_sa;
odp_ipsec_packet_result_t *result;
odp_packet_hdr_t *pkt_hdr;
+   odp_queue_t queue;
 
memset(&status, 0, sizeof(status));
 
@@ -1160,10 +1184,19 @@ int _odp_ipsec_try_inline(odp_packet_t pkt)
memset(result, 0, sizeof(*result));
result->status = status;
result->sa = ipsec_sa->ipsec_sa_hdl;
+   result->flag.inline_mode = 1;
 
pkt_hdr = odp_packet_hdr(pkt);
 

[lng-odp] [PATCH API-NEXT v3 11/11] validation: ipsec: add support for PIPELINE_CLS testing

2017-10-25 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 42beb7e73df5f59ecb1d29f3adb5d8669c61bca7
 **/
 test/validation/api/ipsec/ipsec.c   | 165 ++--
 test/validation/api/ipsec/ipsec.h   |   3 +
 test/validation/api/ipsec/ipsec_async.c |   1 +
 test/validation/api/ipsec/ipsec_inline_in.c |   1 +
 4 files changed, 159 insertions(+), 11 deletions(-)

diff --git a/test/validation/api/ipsec/ipsec.c 
b/test/validation/api/ipsec/ipsec.c
index 853bd88a9..5883f23e2 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -117,6 +117,35 @@ static void pktio_stop(odp_pktio_t pktio)
}
 }
 
+static odp_cos_t ipsec_cos_create(void)
+{
+   odp_cls_cos_param_t param;
+   odp_cos_t cos;
+
+   odp_cls_cos_param_init(¶m);
+   param.pool = suite_context.pool;
+   param.num_queue = 1;
+   param.queue = odp_queue_create("ipsec-cos-queue", NULL);
+
+   if (ODP_QUEUE_INVALID == param.queue)
+   return ODP_COS_INVALID;
+
+   cos = odp_cls_cos_create("ipsec-cos", ¶m);
+   if (ODP_COS_INVALID != cos)
+   suite_context.cos_queue = odp_cos_queue(cos);
+
+   return cos;
+}
+
+static void ipsec_cos_destroy(void)
+{
+   odp_queue_t queue = odp_cos_queue(suite_context.cos);
+
+   suite_context.cos_queue = ODP_QUEUE_INVALID;
+   odp_cos_destroy(suite_context.cos);
+   odp_queue_destroy(queue);
+}
+
 #define MAX_ALG_CAPA 32
 
 int ipsec_check(odp_bool_t ah,
@@ -147,6 +176,11 @@ int ipsec_check(odp_bool_t ah,
 ODP_SUPPORT_NO == capa.op_mode_inline_out))
return ODP_TEST_INACTIVE;
 
+   if (ODP_COS_INVALID != suite_context.cos &&
+   (capa.pipeline_cls == ODP_SUPPORT_NO ||
+capa.max_cls_cos < 1))
+   return ODP_TEST_INACTIVE;
+
if (ah && (ODP_SUPPORT_NO == capa.proto_ah))
return ODP_TEST_INACTIVE;
 
@@ -288,6 +322,11 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param,
if (in)
param->inbound.lookup_mode = ODP_IPSEC_LOOKUP_SPI;
 
+   if (in && (ODP_COS_INVALID != suite_context.cos)) {
+   param->inbound.pipeline = ODP_IPSEC_PIPELINE_CLS;
+   param->inbound.dest_cos = suite_context.cos;
+   }
+
param->proto = ah ? ODP_IPSEC_AH :
ODP_IPSEC_ESP;
 
@@ -438,23 +477,53 @@ static int ipsec_send_in_one(const ipsec_test_part *part,
pkto, &num_out,
¶m));
CU_ASSERT_EQUAL(num_out, part->out_pkt);
-   } else if (ODP_IPSEC_OP_MODE_ASYNC == suite_context.inbound_op_mode) {
+   } else if (ODP_IPSEC_OP_MODE_ASYNC == suite_context.inbound_op_mode &&
+  ODP_QUEUE_INVALID == suite_context.cos_queue) {
CU_ASSERT_EQUAL(1, odp_ipsec_in_enq(&pkt, 1, ¶m));
 
-   for (i = 0; i < num_out; i++) {
-   odp_event_t event;
+   for (i = 0; i < num_out;) {
+   odp_event_t ev;
odp_event_subtype_t subtype;
 
-   do {
-   event = odp_queue_deq(suite_context.queue);
-   } while (event == ODP_EVENT_INVALID);
+   ev = odp_queue_deq(suite_context.queue);
+   if (ODP_EVENT_INVALID != ev) {
+   CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
+   odp_event_types(ev, &subtype));
+   CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC,
+   subtype);
+   pkto[i++] = odp_ipsec_packet_from_event(ev);
+   }
+   }
+   } else if (ODP_IPSEC_OP_MODE_ASYNC == suite_context.inbound_op_mode &&
+  ODP_QUEUE_INVALID != suite_context.cos_queue) {
+   CU_ASSERT_EQUAL(1, odp_ipsec_in_enq(&pkt, 1, ¶m));
 
-   CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
-   odp_event_types(event, &subtype));
-   CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC, subtype);
-   pkto[i] = odp_ipsec_packet_from_event(event);
+   for (i = 0; i < num_out;) {
+   odp_event_t ev;
+   odp_event_subtype_t subtype;
+
+   ev = odp_queue_deq(suite_context.queue);
+   if (ODP_EVENT_INVALID != ev) {
+   CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
+  

[lng-odp] [Linaro/odp] 74d880: travis: fix doxygen error capture

2017-10-25 Thread GitHub
  Branch: refs/heads/api-next
  Home:   https://github.com/Linaro/odp
  Commit: 74d880d7e20ab4825868bd2013b164d4bc90eb45
  
https://github.com/Linaro/odp/commit/74d880d7e20ab4825868bd2013b164d4bc90eb45
  Author: Maxim Uvarov 
  Date:   2017-10-24 (Tue, 24 Oct 2017)

  Changed paths:
M .travis.yml

  Log Message:
  ---
  travis: fix doxygen error capture

grep in doxygen log, not in some test.log

Signed-off-by: Maxim Uvarov 
Reviewed-by: Bill Fischofer 


  Commit: 5329228e260d36de62c3edf3c1a3f08ab95fd558
  
https://github.com/Linaro/odp/commit/5329228e260d36de62c3edf3c1a3f08ab95fd558
  Author: Tom Trahan 
  Date:   2017-10-24 (Tue, 24 Oct 2017)

  Changed paths:
A .shippable.yml
A scripts/Dockerfile

  Log Message:
  ---
  add sample shippable.yml and Dockerfile for Aarch64 builds

Signed-off-by: Tom Trahan 
Signed-off-by: Maxim Uvarov 


  Commit: 503722802274ff5de09144613d9262e2cfdb3077
  
https://github.com/Linaro/odp/commit/503722802274ff5de09144613d9262e2cfdb3077
  Author: Bill Fischofer 
  Date:   2017-10-24 (Tue, 24 Oct 2017)

  Changed paths:
M test/validation/api/.gitignore

  Log Message:
  ---
  test: validation: add missing file to .gitignore

Add the tests-validation.env file to .gitignore.

Signed-off-by: Bill Fischofer 
Signed-off-by: Dmitry Eremin-Solenikov 
Signed-off-by: Maxim Uvarov 


  Commit: e826613858543e50a2ec74598f8c2c6fd4bfa064
  
https://github.com/Linaro/odp/commit/e826613858543e50a2ec74598f8c2c6fd4bfa064
  Author: Bill Fischofer 
  Date:   2017-10-24 (Tue, 24 Oct 2017)

  Changed paths:
M platform/linux-generic/test/.gitignore

  Log Message:
  ---
  linux-generic: test: add missing file to .gitignore

Add the tests-linux-generic.env file to .gitignore

Signed-off-by: Bill Fischofer 
Signed-off-by: Dmitry Eremin-Solenikov 
Signed-off-by: Maxim Uvarov 


  Commit: dd0498bb104c7319e2ec56b61e4d585167ea6c53
  
https://github.com/Linaro/odp/commit/dd0498bb104c7319e2ec56b61e4d585167ea6c53
  Author: Maxim Uvarov 
  Date:   2017-10-25 (Wed, 25 Oct 2017)

  Changed paths:
M platform/linux-generic/odp_packet_io.c

  Log Message:
  ---
  linux-gen: pktio: ignore num_queues parameter if classifier enabled

Api defines statemet:
  "When classifier is enabled in odp_pktin_queue_config() this
   value is ignored, otherwise at least one queue is required."
https://bugs.linaro.org/show_bug.cgi?id=3289

Signed-off-by: Maxim Uvarov 
Reviewed-by: Bill Fischofer 


  Commit: c0aeacf23dddfb7feae47fef6e4d10d6bdb9c812
  
https://github.com/Linaro/odp/commit/c0aeacf23dddfb7feae47fef6e4d10d6bdb9c812
  Author: Matias Elo 
  Date:   2017-10-25 (Wed, 25 Oct 2017)

  Changed paths:
M platform/linux-generic/pktio/dpdk.c

  Log Message:
  ---
  linux-gen: dpdk: create missing dpdk mempools in zero-copy mode

In zero-copy dpdk pktio mode a matching dpdk mempool is required for each
odp packet pool from which packets are sent using dpdk pktio. This is
required for all packet pools, even for those which are not passed directly
to pktio devices as odp_pktio_open() parameters.

Signed-off-by: Matias Elo 
Signed-off-by: Maxim Uvarov 


  Commit: 82419a31e6d1846e0676edfa7fb511a23098f5a9
  
https://github.com/Linaro/odp/commit/82419a31e6d1846e0676edfa7fb511a23098f5a9
  Author: Matias Elo 
  Date:   2017-10-25 (Wed, 25 Oct 2017)

  Changed paths:
M .travis.yml
M DEPENDENCIES
M platform/linux-generic/m4/odp_dpdk.m4
M platform/linux-generic/pktio/dpdk.c
M platform/linux-generic/test/validation/api/pktio/pktio_run_dpdk.sh
M scripts/build-pktio-dpdk

  Log Message:
  ---
  linux-gen: dpdk: bump target dpdk version to 17.08

Changes:
- Function rte_set_log_level() is now deprecated. Replace it with
rte_log_set_global_level().
- New dependency added to libnuma.
- Pcap-based virtual devices are renamed to net_pcap.
- DPDK pktio devices cannot be restarted after calling rte_eth_dev_close().
Move rte_eth_dev_close() calls to global terminate from odp_pktio_close().

Signed-off-by: Matias Elo 
Signed-off-by: Maxim Uvarov 


  Commit: 63d92eb289261d1534b5b9e1e04291faa5e45d30
  
https://github.com/Linaro/odp/commit/63d92eb289261d1534b5b9e1e04291faa5e45d30
  Author: Maxim Uvarov 
  Date:   2017-10-25 (Wed, 25 Oct 2017)

  Changed paths:
A .shippable.yml
M .travis.yml
M DEPENDENCIES
M platform/linux-generic/m4/odp_dpdk.m4
M platform/linux-generic/odp_packet_io.c
M platform/linux-generic/pktio/dpdk.c
M platform/linux-generic/test/.gitignore
M platform/linux-generic/test/validation/api/pktio/pktio_run_dpdk.sh
A scripts/Dockerfile
M scripts/build-pktio-dpdk
M test/validation/api/.gitignore

  Log Message:
  ---
  Merge branch 'master' into api-next

Signed-off-by: Maxim Uvarov 


Compare: https://github.com/Linaro/odp/compare/825f75ed8644...63d92eb28926


[lng-odp] [Bug 3289] [PKTIO] 'num_queues' isn't ignored when ''classifier_enable' is enabled

2017-10-25 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=3289

--- Comment #3 from Maxim Uvarov  ---
https://github.com/Linaro/odp/commit/dd0498bb104c7319e2ec56b61e4d585167ea6c53
refs/heads/api-next
2017-10-25T09:52:58+03:00
Maxim Uvarov maxim.uva...@linaro.org
linux-gen: pktio: ignore num_queues parameter if classifier enabled

Api defines statemet:
  "When classifier is enabled in odp_pktin_queue_config() this
   value is ignored, otherwise at least one queue is required."
https://bugs.linaro.org/show_bug.cgi?id=3289

Signed-off-by: Maxim Uvarov 
Reviewed-by: Bill Fischofer 

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[lng-odp] [PATCH API-NEXT v12 1/2] api: classification: add random early detection and back pressure

2017-10-25 Thread Github ODP bot
From: Balasubramanian Manoharan 

Adds random early detection and Back pressure feature to CoS

Signed-off-by: Balasubramanian Manoharan 
---
/** Email created from pull request 172 (bala-manoharan:random_early_discard)
 ** https://github.com/Linaro/odp/pull/172
 ** Patch: https://github.com/Linaro/odp/pull/172.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 00781af865ca4957425afd4ef3d6041aa63244e0
 **/
 include/odp/api/spec/classification.h | 54 +++
 1 file changed, 54 insertions(+)

diff --git a/include/odp/api/spec/classification.h 
b/include/odp/api/spec/classification.h
index 0c4a95c5f..1ed0dcd5c 100644
--- a/include/odp/api/spec/classification.h
+++ b/include/odp/api/spec/classification.h
@@ -135,6 +135,13 @@ typedef struct odp_cls_capability_t {
 
/** A Boolean to denote support of PMR range */
odp_bool_t pmr_range_supported;
+
+   /** Support for Random Early Detection */
+   odp_support_t random_early_detection;
+
+   /** Support for Back Pressure to the remote peer */
+   odp_support_t back_pressure;
+
 } odp_cls_capability_t;
 
 /**
@@ -206,6 +213,53 @@ typedef struct odp_cls_cos_param {
 
/** Drop policy associated with CoS */
odp_cls_drop_t drop_policy;
+
+   /** Random Early Detection (RED)
+* Random Early Detection is enabled to initiate a drop probability
+* for the incoming packet when the packets in the queue/pool reaches
+* a specified threshold.
+* When RED is enabled for a particular flow then further incoming
+* packets are assigned a drop probability based on the size of the
+* pool/queue and the drop probability becomes 100% when the queue/pool
+* is full.
+* RED is logically configured in the CoS and could be implemented
+* in either pool or queue linked to the CoS depending on
+* platform capabilities. Application should make sure not to link
+* multiple CoS with different RED or BP configuration to the same queue
+* or pool.
+* RED is enabled when the resource limit is equal to or greater than
+* the maximum threshold value and is disabled when resource limit
+* is less than or equal to minimum threshold value. */
+
+   /** A boolean to enable RED
+* When true, RED is enabled and configured with RED parameters.
+* Otherwise, RED parameters are ignored. */
+   odp_bool_t red_enable;
+
+   /** RED parameters */
+   struct {
+   /** Maximum threshold value for RED */
+   uint32_t max_threshold;
+
+   /** Minimum threshold value for RED */
+   uint32_t min_threshold;
+   } red;
+
+   /** A boolean to enable Back pressure
+* When true, back pressure is enabled and configured with the BP
+* parameters. Otherwise BP parameters are ignored. When back pressure
+* is enabled for a particular flow, the HW can send back pressure
+* information to the remote peer indicating a network congestion */
+   odp_bool_t bp_enable;
+
+   /** BP parameters */
+   struct {
+   /** Threshold value for back pressure.
+* BP is enabled when queue or pool size is equal to or greater
+* than the backpressure threshold. BP threshold is expressed
+* as number packets in either queue or pool. */
+   uint32_t bp_threshold;
+   } bp;
 } odp_cls_cos_param_t;
 
 /**



[lng-odp] [PATCH API-NEXT v12 0/2] api: classification: add random early detection

2017-10-25 Thread Github ODP bot
Adds random early discard and back pressure feature configurable per CoS
Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org

github
/** Email created from pull request 172 (bala-manoharan:random_early_discard)
 ** https://github.com/Linaro/odp/pull/172
 ** Patch: https://github.com/Linaro/odp/pull/172.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 00781af865ca4957425afd4ef3d6041aa63244e0
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 66 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH API-NEXT v12 2/2] linux-generic: classification: implement random early detection and back pressure

2017-10-25 Thread Github ODP bot
From: Balasubramanian Manoharan 

Implements Random early detection and Back pressure

Signed-off-by: Balasubramanian Manoharan 
---
/** Email created from pull request 172 (bala-manoharan:random_early_discard)
 ** https://github.com/Linaro/odp/pull/172
 ** Patch: https://github.com/Linaro/odp/pull/172.patch
 ** Base sha: 825f75ed8644ef57c5648961e7982daf13cd9375
 ** Merge commit sha: 00781af865ca4957425afd4ef3d6041aa63244e0
 **/
 platform/linux-generic/odp_classification.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index a5cba56a4..7fa125ec2 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -190,6 +190,8 @@ int odp_cls_capability(odp_cls_capability_t *capability)
capability->supported_terms.bit.tcp_sport = 1;
capability->supported_terms.bit.sip_addr = 1;
capability->supported_terms.bit.dip_addr = 1;
+   capability->random_early_detection = ODP_SUPPORT_NO;
+   capability->back_pressure = ODP_SUPPORT_NO;
return 0;
 }
 



[lng-odp] [PATCH API-NEXT v1 3/3] validation: packet: add packet_print_data test

2017-10-25 Thread Github ODP bot
From: Petri Savolainen 

Test the new packet payload print function with couple of
lengths and offsets. Added line feeds to separate packet print
output from CUnit prints.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 258 (psavol:next-packet-dump)
 ** https://github.com/Linaro/odp/pull/258
 ** Patch: https://github.com/Linaro/odp/pull/258.patch
 ** Base sha: 63d92eb289261d1534b5b9e1e04291faa5e45d30
 ** Merge commit sha: 08d635e94f01265704fddd47cd98b0ccbdc669d4
 **/
 test/validation/api/packet/packet.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/test/validation/api/packet/packet.c 
b/test/validation/api/packet/packet.c
index 431444cf3..37550a2f5 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -554,7 +554,10 @@ void packet_test_prefetch(void)
 void packet_test_debug(void)
 {
CU_ASSERT(odp_packet_is_valid(test_packet) == 1);
+   printf("\n\n");
odp_packet_print(test_packet);
+   odp_packet_print_data(test_packet, 0, 100);
+   odp_packet_print_data(test_packet, 14, 20);
 }
 
 void packet_test_context(void)
@@ -2152,7 +2155,10 @@ void packet_test_ref(void)
packet_compare_data(pkt3, ref2);
 
/* Try print function on a reference */
+   printf("\n\n");
odp_packet_print(ref2);
+   odp_packet_print_data(ref2, 0, 100);
+   odp_packet_print_data(ref2, 14, 20);
 
odp_packet_free(ref);
odp_packet_free(ref2);



[lng-odp] [PATCH API-NEXT v1 2/3] linux-gen: packet: implement odp_packet_data_print

2017-10-25 Thread Github ODP bot
From: Petri Savolainen 

Implemented the new packet payload print function using
ODP_PRINT macro. Removed an extra space from the print
macro as well as extra null char and line feed from
odp_packet_print.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 258 (psavol:next-packet-dump)
 ** https://github.com/Linaro/odp/pull/258
 ** Patch: https://github.com/Linaro/odp/pull/258.patch
 ** Base sha: 63d92eb289261d1534b5b9e1e04291faa5e45d30
 ** Merge commit sha: 08d635e94f01265704fddd47cd98b0ccbdc669d4
 **/
 .../linux-generic/include/odp_debug_internal.h |  2 +-
 platform/linux-generic/odp_packet.c| 63 +-
 2 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index 02ae87a90..4c44bebe0 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -81,7 +81,7 @@ extern "C" {
  * specifically for dumping internal data.
  */
 #define ODP_PRINT(fmt, ...) \
-   odp_global_data.log_fn(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__)
+   odp_global_data.log_fn(ODP_LOG_PRINT, fmt, ##__VA_ARGS__)
 
 #ifdef __cplusplus
 }
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 603ac7181..67f103b32 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1739,9 +1739,68 @@ void odp_packet_print(odp_packet_t pkt)
seg = odp_packet_next_seg(pkt, seg);
}
 
-   str[len] = '\0';
+   ODP_PRINT("%s\n", str);
+}
+
+void odp_packet_print_data(odp_packet_t pkt, uint32_t offset,
+  uint32_t byte_len)
+{
+   odp_packet_hdr_t *hdr = packet_hdr(pkt);
+   uint32_t bytes_per_row = 16;
+   int num_rows = (byte_len + bytes_per_row - 1) / bytes_per_row;
+   int max_len = 256 + (3 * byte_len) + (3 * num_rows);
+   char str[max_len];
+   int len = 0;
+   int n = max_len - 1;
+   uint32_t data_len = odp_packet_len(pkt);
+   pool_t *pool = hdr->buf_hdr.pool_ptr;
+
+   len += snprintf(&str[len], n - len, "Packet\n--\n");
+   len += snprintf(&str[len], n - len,
+   "  pool index%" PRIu32 "\n", pool->pool_idx);
+   len += snprintf(&str[len], n - len,
+   "  buf index %" PRIu32 "\n", hdr->buf_hdr.index);
+   len += snprintf(&str[len], n - len,
+   "  segcount  %" PRIu16 "\n", hdr->buf_hdr.segcount);
+   len += snprintf(&str[len], n - len,
+   "  data len  %" PRIu32 "\n", data_len);
+   len += snprintf(&str[len], n - len,
+   "  data ptr  %p\n", odp_packet_data(pkt));
+   len += snprintf(&str[len], n - len,
+   "  print offset  %" PRIu32 "\n", offset);
+   len += snprintf(&str[len], n - len,
+   "  print length  %" PRIu32 "\n", byte_len);
+
+   if (offset + byte_len > data_len) {
+   len += snprintf(&str[len], n - len, " BAD OFFSET OR LEN\n");
+   ODP_PRINT("%s\n", str);
+   return;
+   }
+
+   while (byte_len) {
+   uint32_t copy_len;
+   uint8_t data[bytes_per_row];
+   uint32_t i;
+
+   if (byte_len > bytes_per_row)
+   copy_len = bytes_per_row;
+   else
+   copy_len = byte_len;
+
+   odp_packet_copy_to_mem(pkt, offset, copy_len, data);
+
+   len += snprintf(&str[len], n - len, " ");
+
+   for (i = 0; i < copy_len; i++)
+   len += snprintf(&str[len], n - len, " %02x", data[i]);
+
+   len += snprintf(&str[len], n - len, "\n");
+
+   byte_len -= copy_len;
+   offset   += copy_len;
+   }
 
-   ODP_PRINT("\n%s\n", str);
+   ODP_PRINT("%s\n", str);
 }
 
 int odp_packet_is_valid(odp_packet_t pkt)



[lng-odp] [PATCH API-NEXT v1 0/3] api: packet: print data

2017-10-25 Thread Github ODP bot
Added debug print function which includes packet payload bytes.
Printing starts from an offset, so it's easy to e.g. limit print to IPv4 header 
bytes only:
odp_packet_print_data(pkt, l3_offset(pkt), 20)

github
/** Email created from pull request 258 (psavol:next-packet-dump)
 ** https://github.com/Linaro/odp/pull/258
 ** Patch: https://github.com/Linaro/odp/pull/258.patch
 ** Base sha: 63d92eb289261d1534b5b9e1e04291faa5e45d30
 ** Merge commit sha: 08d635e94f01265704fddd47cd98b0ccbdc669d4
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 30 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
CHECK: Avoid CamelCase: 
#68: FILE: platform/linux-generic/odp_packet.c:1764:
+   "  segcount  %" PRIu16 "\n", hdr->buf_hdr.segcount);

total: 0 errors, 0 warnings, 1 checks, 78 lines checked


to_send-p-001.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 20 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH API-NEXT v1 1/3] api: packet: print packet data

2017-10-25 Thread Github ODP bot
From: Petri Savolainen 

Added debug print function which includes packet payload bytes.
Printing starts from offset, so it's easy to e.g. limit print
to IPv4 header bytes only:
odp_packet_print_data(pkt, l3_offset(pkt), 20)

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 258 (psavol:next-packet-dump)
 ** https://github.com/Linaro/odp/pull/258
 ** Patch: https://github.com/Linaro/odp/pull/258.patch
 ** Base sha: 63d92eb289261d1534b5b9e1e04291faa5e45d30
 ** Merge commit sha: 08d635e94f01265704fddd47cd98b0ccbdc669d4
 **/
 include/odp/api/spec/packet.h | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 62ecf70e1..3fc460641 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1561,15 +1561,28 @@ void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, 
int8_t adj);
  */
 
 /**
- * Print packet to the console
+ * Print packet debug information
  *
- * Print all packet debug information to the console.
+ * Print all packet debug information to the ODP log.
  *
  * @param pkt  Packet handle
  */
 void odp_packet_print(odp_packet_t pkt);
 
 /**
+ * Print packet data
+ *
+ * Print packet debug information with packet data to the ODP log. Operation
+ * prints 'len' bytes of packet data starting from 'offset' byte. Offset plus
+ * length must not exceed packet length (odp_packet_len()).
+ *
+ * @param pkt Packet handle
+ * @param offset  Byte offset into the packet
+ * @param len Number of bytes to print
+ */
+void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, uint32_t len);
+
+/**
  * Perform full packet validity check
  *
  * The operation may consume considerable number of cpu cycles depending on



Re: [lng-odp] [Linaro/odp] [PATCH API-NEXT v1] api: packet: print data (#258)

2017-10-25 Thread Savolainen, Petri (Nokia - FI/Espoo)
Hi Petri there's no check on snprintf regarding the returned len. Is there any 
possibility in this code that the final buffer will be bigger than max_len?
—


I calculate max string len from number of bytes to print:

int num_rows = (byte_len + bytes_per_row - 1) / bytes_per_row;
int max_len = 256 + (3 * byte_len) + (3 * num_rows);


As long as the math is right the buffer size is larger than the string. The 
same snprintf code is used in the current odp_packet_print().

-Petri



Re: [lng-odp] [Linaro/odp] [PATCH API-NEXT v1] api: packet: print data (#258)

2017-10-25 Thread Savolainen, Petri (Nokia - FI/Espoo)
that has to be odp helper, not need for that in odp api
—

Helper is not API, in general all applications cannot rely that. Out 
validation/example/etc apps can rely on helpers, but not all. This solves a 
very common debug need for data plane application - print a received packet on 
the screen.

-Petri


Re: [lng-odp] [PATCH v1] Netmap pktio fixes

2017-10-25 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

platform/linux-generic/pktio/netmap.c
line 14
@@ -388,13 +389,22 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
 
if (pkt_nm->is_virtual) {
static unsigned mac;
+   uint32_t tid = syscall(SYS_gettid);
+
+   if ((int)tid == -1)


Comment:
@matiaselo yes, so this is fine.

> Matias Elo(matiaselo) wrote:
> syscall() specification still defines -1 as an error return value and we 
> should adhere to the spec regardless of the function implementation which may 
> change.


>> muvarov wrote
>> .


>>> muvarov wrote
>>> man gettid says that it always passes.
>>> 
>>> kernel code is also:
>>> pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
>>> struct pid_namespace *ns)
>>> {
>>> pid_t nr = 0;
>>> 
>>> rcu_read_lock();
>>> if (!ns)
>>> ns = task_active_pid_ns(current);
>>> if (likely(pid_alive(task))) {
>>> if (type != PIDTYPE_PID)
>>> task = task->group_leader;
>>> nr = pid_nr_ns(rcu_dereference(task->pids[type].pid), ns);
>>> }
>>> rcu_read_unlock();
>>> 
>>> return nr;
>>> }
>>> EXPORT_SYMBOL(__task_pid_nr_ns);
>>> 
>>> I.e. it will return init process tid 0 in worst case. So this check is not 
>>> correct and not needed.
>>> 
>>> It might be needed additional cast:
>>> uint32_t tid = (uint32_t)syscall(SYS_gettid) because of syscall returns 
>>> pid_t.


 muvarov wrote
 @lumag  we also use SYS_gettid() in shm and timer. I think that is not 
 subject for this PR. Just general clean up.


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> See 
> [here](https://stackoverflow.com/questions/21279649/getting-error-in-c-program-undefined-reference-to-gettid)
>  for an interesting discussion of why gettid() is not used.


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> @matiaselo @muvarov Hmm. I thought that there is already a Glibc 
>> wrapper. I would prefer this as a separate function, but it is of minor 
>> priority then.


>>> muvarov wrote
>>> it was copied from netmap source  I think. gittid() will generate 
>>> warning due to missing glibc wrapper: 
>>> https://stackoverflow.com/questions/30680550/c-gettid-was-not-declared-in-this-scope
>>>  Maybe something already changed...


 Matias Elo(matiaselo) wrote:
 What's the benefit from using gettid()? It seems like the only 
 difference is that gettid() cannot fail.


> Dmitry Eremin-Solenikov(lumag) wrote:
> Why don't you use `gettid()` function? Then you can check for its 
> existence in `configure.ac` and provide replacement implementation. 


https://github.com/Linaro/odp/pull/237#discussion_r146858117
updated_at 2017-10-25 13:36:15


[lng-odp] API-next branch

2017-10-25 Thread Dmitry Eremin-Solenikov
Hello,

I tried to actually check, which patches are sitting in the api-next.
And actually I failed
to do that in a timely manner. git cherry produces a list of patches,
that contains a lot of patches, which already landed to the master.

Quick proposal would be to stop using api-next as a long-lived branch
which received updates from master and rather use it as a branch being
regularly rebased on top of current master.

Another possiblity would be to abandon api-next completely, develop
features on topic branches, which get merged to master, rather than to
api-next. At least this would save us from situations, when there is
API definition (or change), but no actual implementation behind.

-- 
With best wishes
Dmitry


Re: [lng-odp] API-next branch

2017-10-25 Thread Bill Fischofer
I'm all for using topic branches, especially since we've switched to GitHub
and most contributors are now familiar with it and using pull requests
rather than raw patches sent to the mailing list. The whole reason for
api-next was to separate in-progress API changes from regular maintenance
patches since they were all mixed together on the mailing list. The PR
structure is much cleaner in that regard.

IPsec in particular clearly could have been a separate branch. We've talked
about doing this in the context of 2.0 as well since that's also going to
involve some major subsystems that could benefit from collaborative
development before being merged back into the 2.0 main development branch.


On Wed, Oct 25, 2017 at 10:39 AM, Dmitry Eremin-Solenikov <
dmitry.ereminsoleni...@linaro.org> wrote:

> Hello,
>
> I tried to actually check, which patches are sitting in the api-next.
> And actually I failed
> to do that in a timely manner. git cherry produces a list of patches,
> that contains a lot of patches, which already landed to the master.
>
> Quick proposal would be to stop using api-next as a long-lived branch
> which received updates from master and rather use it as a branch being
> regularly rebased on top of current master.
>
> Another possiblity would be to abandon api-next completely, develop
> features on topic branches, which get merged to master, rather than to
> api-next. At least this would save us from situations, when there is
> API definition (or change), but no actual implementation behind.
>
> --
> With best wishes
> Dmitry
>


[lng-odp] Ingress Metering/Policing

2017-10-25 Thread Liron Himi
Hi,

Is there any intention to add support for Ingress Metering/Policing (RFC 2697, 
RFC2698) in future releases?

Regards,
Liron


Re: [lng-odp] [EXT] Re: ODP1.15 with gcc-linaro-5.3.1

2017-10-25 Thread Liron Himi
Hi,

The GCC5.3.1 is a Linaro's GCC, maybe it is more of a question to Linaro as 
this crosstools version doesn't compile well with the linux-generic 
implementation in ODP1.15 due to the need for libatomic.

Liron

-Original Message-
From: Brian Brooks [mailto:brian.bro...@linaro.org] 
Sent: Tuesday, October 24, 2017 23:34
To: Liron Himi 
Subject: Re: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1

Hi Liron,

I am not familiar with your crosstools environment. That is why I asked if 
support for libatomic needs to be enabled.

The ODP build will simply try to -latomic.

Brian


On Tue, Oct 24, 2017 at 8:57 AM, Liron Himi  wrote:
> Hi Brian,
>
>
>
> See comments in RED
>
>
>
> Liron
>
> -Original Message-
>
> From: Liron Himi
>
> Sent: Wednesday, October 18, 2017 21:01
>
> To: Brian Brooks 
>
> Cc: Liron Himi 
>
> Subject: RE: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
>
>
>
> Hi Brian,
>
>
>
> See inline
>
>
>
> -Original Message-
>
> From: Brian Brooks [mailto:brian.bro...@linaro.org]
>
> Sent: Wednesday, October 18, 2017 20:43
>
> To: Liron Himi 
>
> Cc: lng-odp@lists.linaro.org
>
> Subject: Re: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
>
>
>
> checking for GCC atomic builtins... yes
>
> checking whether -latomic is needed for 64-bit atomic built-ins... no 
> checking whether -latomic is needed for 128-bit atomic built-ins... 
> yes
>
>
>
> So, GCC 5.3.1 will not lower __atomic/__sync builtins on a 128-bit 
> data type to machine instructions, and instead emit a call to a 
> function (which is assumed to be provided by libatomic).
>
>
>
> There is some timer and scheduler code that makes use of atomics on 
> 128-bit types.
>
>
>
> Can you enable libatomic in the crosstools environment?
>
> [L.H.] Not sure I understood what do you mean? The libatomic.a/.so is 
> located in both aarch64-linux-gnu/lib64 and aarch64-linux-gnu/libc/lib.
>
> The problem is with the libatomic.la where the setting of LIBDIR is to 
> some weird location.
>
>
>
> Note that with GCC 7.1.1 (latest release) there is no problem, and I 
> also noticed that libatomic.la is not there anymore
>
>
>
>
>
> On Wed, Oct 18, 2017 at 11:51 AM, Liron Himi  wrote:
>
>> Hi Brian,
>
>>
>
>> I attached full configure output.
>
>>
>
>> Liron
>
>>
>
>> -Original Message-
>
>> From: Brian Brooks [mailto:brian.bro...@linaro.org]
>
>> Sent: Wednesday, October 18, 2017 18:50
>
>> To: Liron Himi 
>
>> Cc: lng-odp@lists.linaro.org
>
>> Subject: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
>
>>
>
>> External Email
>
>>
>
>> -
>> -
>
>> Hi Liron,
>
>>
>
>> Can you paste a full copy of the ./configure output?
>
>>
>
>> Brian
>
>>
>
>> On Wed, Oct 18, 2017 at 9:58 AM, Liron Himi  wrote:
>
>>> Hi,
>
>>>
>
>>> We are using 'gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu' as 
>>> our tool-chain.
>
>>> When I compile ODP1.15 with it I get a lot of:
>
>>> 'libtool: warning: library
>>> '/home/userlab/work/crosstools/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/lib64/libatomic.la'
>>> was moved.'
>
>>>
>
>>> The main problem is that we have another package that uses our ODP
>
>>> outcome and it doesn't compile due to
>
>>> '/bin/sed: can't read
>>> /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/lib/../lib64/libatomic.la:
>>> No such file or directory
>
>>> libtool:   error:
>>> '/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/lib/../lib64/libatomic.la'
>>> is not a valid libtool archive'
>
>>>
>
>>> I notice that it is related to added lines (compared to ODP1.11) in 
>>> 'linux-generic/m4/configure.m4'.
>
>>> dnl Check whether -latomic is needed
>
>>> use_libatomic=no
>
>>>
>
>>> AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic
>
>>> built-ins) AC_LINK_IFELSE(
>
>>>   [AC_LANG_SOURCE([[
>
>>> static int loc;
>
>>> int main(void)
>
>>> {
>
>>> int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
>
>>> return 0;
>
>>> }
>
>>> ]])],
>
>>>   [AC_MSG_RESULT(no)],
>
>>>   [AC_MSG_RESULT(yes)
>
>>>AC_CHECK_LIB(
>
>>>  [atomic], [__atomic_exchange_8],
>
>>>  [use_libatomic=yes],
>
>>>  [AC_MSG_FAILURE([__atomic_exchange_8 is not available])])
>
>>>   ])
>
>>>
>
>>> AC_MSG_CHECKING(whether -latomic is needed for 128-bit atomic
>
>>> built-ins) AC_LINK_IFELSE(
>
>>>   [AC_LANG_SOURCE([[
>
>>> static __int128 loc;
>
>>> int main(void)
>
>>> {
>
>>> __int128 prev;
>
>>> prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
>
>>> return 0;
>
>>> }
>
>>> ]])],
>
>>>   [AC_MSG_RESULT(no)],
>
>>>   [AC_MSG_RESULT(yes)
>
>>>AC_CHECK_LIB(
>
>>>  [atomic], [__atomic_exchange_

Re: [lng-odp] Ingress Metering/Policing

2017-10-25 Thread Bill Fischofer
There are no immediate plans for this feature. As an open source project,
ODP moves in the direction of its contributors. If this is of importance to
you, please consider submitting patches to add it.

On Wed, Oct 25, 2017 at 11:54 AM, Liron Himi  wrote:

> Hi,
>
> Is there any intention to add support for Ingress Metering/Policing (RFC
> 2697, RFC2698) in future releases?
>
> Regards,
> Liron
>


Re: [lng-odp] [EXT] Re: ODP1.15 with gcc-linaro-5.3.1

2017-10-25 Thread Bill Fischofer
Hi Liron,

Can you try this against the master or api-next branches of odp.git? I know
we are currently doing cross-compile testing for aarch64 in Travis and
aren't seeing this problem. If that's the case then this problem should
resolve itself in the next tagged release, which should be out within the
next few weeks.

On Wed, Oct 25, 2017 at 11:56 AM, Liron Himi  wrote:

> Hi,
>
> The GCC5.3.1 is a Linaro's GCC, maybe it is more of a question to Linaro
> as this crosstools version doesn't compile well with the linux-generic
> implementation in ODP1.15 due to the need for libatomic.
>
> Liron
>
> -Original Message-
> From: Brian Brooks [mailto:brian.bro...@linaro.org]
> Sent: Tuesday, October 24, 2017 23:34
> To: Liron Himi 
> Subject: Re: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
>
> Hi Liron,
>
> I am not familiar with your crosstools environment. That is why I asked if
> support for libatomic needs to be enabled.
>
> The ODP build will simply try to -latomic.
>
> Brian
>
>
> On Tue, Oct 24, 2017 at 8:57 AM, Liron Himi  wrote:
> > Hi Brian,
> >
> >
> >
> > See comments in RED
> >
> >
> >
> > Liron
> >
> > -Original Message-
> >
> > From: Liron Himi
> >
> > Sent: Wednesday, October 18, 2017 21:01
> >
> > To: Brian Brooks 
> >
> > Cc: Liron Himi 
> >
> > Subject: RE: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
> >
> >
> >
> > Hi Brian,
> >
> >
> >
> > See inline
> >
> >
> >
> > -Original Message-
> >
> > From: Brian Brooks [mailto:brian.bro...@linaro.org]
> >
> > Sent: Wednesday, October 18, 2017 20:43
> >
> > To: Liron Himi 
> >
> > Cc: lng-odp@lists.linaro.org
> >
> > Subject: Re: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
> >
> >
> >
> > checking for GCC atomic builtins... yes
> >
> > checking whether -latomic is needed for 64-bit atomic built-ins... no
> > checking whether -latomic is needed for 128-bit atomic built-ins...
> > yes
> >
> >
> >
> > So, GCC 5.3.1 will not lower __atomic/__sync builtins on a 128-bit
> > data type to machine instructions, and instead emit a call to a
> > function (which is assumed to be provided by libatomic).
> >
> >
> >
> > There is some timer and scheduler code that makes use of atomics on
> > 128-bit types.
> >
> >
> >
> > Can you enable libatomic in the crosstools environment?
> >
> > [L.H.] Not sure I understood what do you mean? The libatomic.a/.so is
> > located in both aarch64-linux-gnu/lib64 and aarch64-linux-gnu/libc/lib.
> >
> > The problem is with the libatomic.la where the setting of LIBDIR is to
> > some weird location.
> >
> >
> >
> > Note that with GCC 7.1.1 (latest release) there is no problem, and I
> > also noticed that libatomic.la is not there anymore
> >
> >
> >
> >
> >
> > On Wed, Oct 18, 2017 at 11:51 AM, Liron Himi  wrote:
> >
> >> Hi Brian,
> >
> >>
> >
> >> I attached full configure output.
> >
> >>
> >
> >> Liron
> >
> >>
> >
> >> -Original Message-
> >
> >> From: Brian Brooks [mailto:brian.bro...@linaro.org]
> >
> >> Sent: Wednesday, October 18, 2017 18:50
> >
> >> To: Liron Himi 
> >
> >> Cc: lng-odp@lists.linaro.org
> >
> >> Subject: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
> >
> >>
> >
> >> External Email
> >
> >>
> >
> >> -
> >> -
> >
> >> Hi Liron,
> >
> >>
> >
> >> Can you paste a full copy of the ./configure output?
> >
> >>
> >
> >> Brian
> >
> >>
> >
> >> On Wed, Oct 18, 2017 at 9:58 AM, Liron Himi  wrote:
> >
> >>> Hi,
> >
> >>>
> >
> >>> We are using 'gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu' as
> >>> our tool-chain.
> >
> >>> When I compile ODP1.15 with it I get a lot of:
> >
> >>> 'libtool: warning: library
> >>> '/home/userlab/work/crosstools/gcc-linaro-5.3.1-
> 2016.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/lib64/libatomic.la'
> >>> was moved.'
> >
> >>>
> >
> >>> The main problem is that we have another package that uses our ODP
> >
> >>> outcome and it doesn't compile due to
> >
> >>> '/bin/sed: can't read
> >>> /home/tcwg-buildslave/workspace/tcwg-make-release/
> label/docker-trusty-amd64-tcwg/target/aarch64-linux-gnu/
> _build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-
> linux-gnu/lib/../lib64/libatomic.la:
> >>> No such file or directory
> >
> >>> libtool:   error:
> >>> '/home/tcwg-buildslave/workspace/tcwg-make-release/
> label/docker-trusty-amd64-tcwg/target/aarch64-linux-gnu/
> _build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-
> linux-gnu/lib/../lib64/libatomic.la'
> >>> is not a valid libtool archive'
> >
> >>>
> >
> >>> I notice that it is related to added lines (compared to ODP1.11) in
> >>> 'linux-generic/m4/configure.m4'.
> >
> >>> dnl Check whether -latomic is needed
> >
> >>> use_libatomic=no
> >
> >>>
> >
> >>> AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic
> >
> >>> built-ins) AC_LINK_IFELSE(
> >
> >>>   [AC_LANG_SOURCE([[
> >
> >>> static int loc;
> >
> >>> int main(void)
> >
> >>> {
> >
> >>> int prev = __atomic_exchange_n(&

Re: [lng-odp] [PATCH 2.0 v2] Remove duplicate pktio_ops subsystem implementation

2017-10-25 Thread Github ODP bot
nagarahalli replied on github web page:

platform/linux-generic/pktio/subsystem.c
line 42
@@ -44,15 +54,23 @@ ODP_SUBSYSTEM_CONSTRUCTOR(pktio_ops)
 #ifdef ODP_PKTIO_DPDK
enable_link_dpdk_pktio_ops = 1;
 #endif
+#ifdef ODP_PKTIO_IPC
enable_link_ipc_pktio_ops = 1;
+#endif
enable_link_loopback_pktio_ops = 1;


Comment:
Any reason to keep loopback pkt IO enabled all the time?

> bogdanPricope wrote
> True... and should be removed at that point. This is an intermediary step so 
> we can remove  duplicate pktio_ops subsystem implementation


>> He Yi(heyi-linaro) wrote:
>> These are temporary flags, which I was planned to remove after Makefiles 
>> update to build all pktio_ops into real individual modules and use 
>> --whole-archive or --as-no-needed to link them in.


https://github.com/Linaro/odp/pull/255#discussion_r146983298
updated_at 2017-10-25 20:55:33


Re: [lng-odp] [EXT] Re: ODP1.15 with gcc-linaro-5.3.1

2017-10-25 Thread Liron Himi
Hi Bill,

I also checked it with GCC7.1.1(latest release) with no problem. I noticed that 
in this version the libatomic.la is not there anymore.

The problem is with the GCC5.3.1’s libatomic.la where the 
setting of LIBDIR is to some weird location.

To overcome this issue with GCC5.3.1 I currently removed the new lines that add 
latomic to the game.

Liron

From: Bill Fischofer [mailto:bill.fischo...@linaro.org]
Sent: Wednesday, October 25, 2017 23:42
To: Liron Himi 
Cc: Brian Brooks ; lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [EXT] Re: ODP1.15 with gcc-linaro-5.3.1

Hi Liron,

Can you try this against the master or api-next branches of odp.git? I know we 
are currently doing cross-compile testing for aarch64 in Travis and aren't 
seeing this problem. If that's the case then this problem should resolve itself 
in the next tagged release, which should be out within the next few weeks.

On Wed, Oct 25, 2017 at 11:56 AM, Liron Himi 
mailto:lir...@marvell.com>> wrote:
Hi,

The GCC5.3.1 is a Linaro's GCC, maybe it is more of a question to Linaro as 
this crosstools version doesn't compile well with the linux-generic 
implementation in ODP1.15 due to the need for libatomic.

Liron

-Original Message-
From: Brian Brooks 
[mailto:brian.bro...@linaro.org]
Sent: Tuesday, October 24, 2017 23:34
To: Liron Himi mailto:lir...@marvell.com>>
Subject: Re: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1

Hi Liron,

I am not familiar with your crosstools environment. That is why I asked if 
support for libatomic needs to be enabled.

The ODP build will simply try to -latomic.

Brian


On Tue, Oct 24, 2017 at 8:57 AM, Liron Himi 
mailto:lir...@marvell.com>> wrote:
> Hi Brian,
>
>
>
> See comments in RED
>
>
>
> Liron
>
> -Original Message-
>
> From: Liron Himi
>
> Sent: Wednesday, October 18, 2017 21:01
>
> To: Brian Brooks mailto:brian.bro...@linaro.org>>
>
> Cc: Liron Himi mailto:lir...@marvell.com>>
>
> Subject: RE: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
>
>
>
> Hi Brian,
>
>
>
> See inline
>
>
>
> -Original Message-
>
> From: Brian Brooks 
> [mailto:brian.bro...@linaro.org]
>
> Sent: Wednesday, October 18, 2017 20:43
>
> To: Liron Himi mailto:lir...@marvell.com>>
>
> Cc: lng-odp@lists.linaro.org
>
> Subject: Re: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
>
>
>
> checking for GCC atomic builtins... yes
>
> checking whether -latomic is needed for 64-bit atomic built-ins... no
> checking whether -latomic is needed for 128-bit atomic built-ins...
> yes
>
>
>
> So, GCC 5.3.1 will not lower __atomic/__sync builtins on a 128-bit
> data type to machine instructions, and instead emit a call to a
> function (which is assumed to be provided by libatomic).
>
>
>
> There is some timer and scheduler code that makes use of atomics on
> 128-bit types.
>
>
>
> Can you enable libatomic in the crosstools environment?
>
> [L.H.] Not sure I understood what do you mean? The libatomic.a/.so is
> located in both aarch64-linux-gnu/lib64 and aarch64-linux-gnu/libc/lib.
>
> The problem is with the libatomic.la where the setting 
> of LIBDIR is to
> some weird location.
>
>
>
> Note that with GCC 7.1.1 (latest release) there is no problem, and I
> also noticed that libatomic.la is not there anymore
>
>
>
>
>
> On Wed, Oct 18, 2017 at 11:51 AM, Liron Himi 
> mailto:lir...@marvell.com>> wrote:
>
>> Hi Brian,
>
>>
>
>> I attached full configure output.
>
>>
>
>> Liron
>
>>
>
>> -Original Message-
>
>> From: Brian Brooks 
>> [mailto:brian.bro...@linaro.org]
>
>> Sent: Wednesday, October 18, 2017 18:50
>
>> To: Liron Himi mailto:lir...@marvell.com>>
>
>> Cc: lng-odp@lists.linaro.org
>
>> Subject: [EXT] Re: [lng-odp] ODP1.15 with gcc-linaro-5.3.1
>
>>
>
>> External Email
>
>>
>
>> -
>> -
>
>> Hi Liron,
>
>>
>
>> Can you paste a full copy of the ./configure output?
>
>>
>
>> Brian
>
>>
>
>> On Wed, Oct 18, 2017 at 9:58 AM, Liron Himi 
>> mailto:lir...@marvell.com>> wrote:
>
>>> Hi,
>
>>>
>
>>> We are using 'gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu' as
>>> our tool-chain.
>
>>> When I compile ODP1.15 with it I get a lot of:
>
>>> 'libtool: warning: library
>>> '/home/userlab/work/crosstools/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/lib64/libatomic.la'
>>> was moved.'
>
>>>
>
>>> The main problem is that we have another package that uses our ODP
>
>>> outcome and it doesn't compile due to
>
>>> '/bin/sed: can't read
>>> /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/lib/../lib64/libatomic.la:
>>> No such file or di

Re: [lng-odp] [PATCH 2.0 v2] Remove duplicate pktio_ops subsystem implementation

2017-10-25 Thread Github ODP bot
bogdanPricope replied on github web page:

platform/linux-generic/pktio/subsystem.c
line 42
@@ -44,15 +54,23 @@ ODP_SUBSYSTEM_CONSTRUCTOR(pktio_ops)
 #ifdef ODP_PKTIO_DPDK
enable_link_dpdk_pktio_ops = 1;
 #endif
+#ifdef ODP_PKTIO_IPC
enable_link_ipc_pktio_ops = 1;
+#endif
enable_link_loopback_pktio_ops = 1;


Comment:
Right now, loopback pktio is built for both linux-generic and linux-dpdk (so I 
did not needed to disable it for one of the platforms). In the next step (see 
Yi's comment above), a pktio will be enable/disable at build time and all those 
flags will be removed.

> nagarahalli wrote
> Any reason to keep loopback pkt IO enabled all the time?


>> bogdanPricope wrote
>> True... and should be removed at that point. This is an intermediary step so 
>> we can remove  duplicate pktio_ops subsystem implementation


>>> He Yi(heyi-linaro) wrote:
>>> These are temporary flags, which I was planned to remove after Makefiles 
>>> update to build all pktio_ops into real individual modules and use 
>>> --whole-archive or --as-no-needed to link them in.


https://github.com/Linaro/odp/pull/255#discussion_r147049864
updated_at 2017-10-26 05:48:59


Re: [lng-odp] API-next branch

2017-10-25 Thread Savolainen, Petri (Nokia - FI/Espoo)
We need one branch that holds all new API changes before those are released (> 
4 months currently): either it's master or api-next. If we change API 
development to master, then applications would need follow the latest release 
branch instead of master. At least previous there was resistance to change 
master into API development branch.

Separate topic branches for API changes won't scale ... we would not have a 
common view (e.g. for 4 months) what the API is before all those are merged 
together. Implementation changes are easier in topic branches as there's less 
dependency to other files and applications (other files and apps already agree 
what the API is).

Api-next does not cause the problem (big delta), it's caused by the lack of 
steady release cycle. The big  delta won't go away before we have a short 
enough release cycle (merge often => small delta).

-Petri



> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Bill
> Fischofer
> Sent: Wednesday, October 25, 2017 6:53 PM
> To: Dmitry Eremin-Solenikov 
> Cc: lng-odp-forward 
> Subject: Re: [lng-odp] API-next branch
> 
> I'm all for using topic branches, especially since we've switched to
> GitHub
> and most contributors are now familiar with it and using pull requests
> rather than raw patches sent to the mailing list. The whole reason for
> api-next was to separate in-progress API changes from regular maintenance
> patches since they were all mixed together on the mailing list. The PR
> structure is much cleaner in that regard.
> 
> IPsec in particular clearly could have been a separate branch. We've
> talked
> about doing this in the context of 2.0 as well since that's also going to
> involve some major subsystems that could benefit from collaborative
> development before being merged back into the 2.0 main development branch.
> 
> 
> On Wed, Oct 25, 2017 at 10:39 AM, Dmitry Eremin-Solenikov <
> dmitry.ereminsoleni...@linaro.org> wrote:
> 
> > Hello,
> >
> > I tried to actually check, which patches are sitting in the api-next.
> > And actually I failed
> > to do that in a timely manner. git cherry produces a list of patches,
> > that contains a lot of patches, which already landed to the master.
> >
> > Quick proposal would be to stop using api-next as a long-lived branch
> > which received updates from master and rather use it as a branch being
> > regularly rebased on top of current master.
> >
> > Another possiblity would be to abandon api-next completely, develop
> > features on topic branches, which get merged to master, rather than to
> > api-next. At least this would save us from situations, when there is
> > API definition (or change), but no actual implementation behind.
> >
> > --
> > With best wishes
> > Dmitry
> >