[lng-odp] [PATCH API-NEXT v4 4/4] linux-gen: scalable queue: mark queue_shm_pool as static

2017-08-14 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 108 (lumag:symbols-cleanup)
 ** https://github.com/Linaro/odp/pull/108
 ** Patch: https://github.com/Linaro/odp/pull/108.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: 96b4b72d57a270b2b7ac6609852c867ee2de5a1b
 **/
 platform/linux-generic/odp_queue_scalable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_queue_scalable.c 
b/platform/linux-generic/odp_queue_scalable.c
index 503b40f5..79148060 100644
--- a/platform/linux-generic/odp_queue_scalable.c
+++ b/platform/linux-generic/odp_queue_scalable.c
@@ -49,7 +49,7 @@ typedef struct queue_table_t {
 } queue_table_t;
 
 static queue_table_t *queue_tbl;
-_odp_ishm_pool_t *queue_shm_pool;
+static _odp_ishm_pool_t *queue_shm_pool;
 
 static inline odp_queue_t queue_from_id(uint32_t queue_id)
 {



[lng-odp] [PATCH API-NEXT v4 3/4] linux-gen: scalable sched: mark sched_grp_lock as static

2017-08-14 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 108 (lumag:symbols-cleanup)
 ** https://github.com/Linaro/odp/pull/108
 ** Patch: https://github.com/Linaro/odp/pull/108.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: 96b4b72d57a270b2b7ac6609852c867ee2de5a1b
 **/
 platform/linux-generic/odp_schedule_scalable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_schedule_scalable.c 
b/platform/linux-generic/odp_schedule_scalable.c
index 78159b53..a289a7d7 100644
--- a/platform/linux-generic/odp_schedule_scalable.c
+++ b/platform/linux-generic/odp_schedule_scalable.c
@@ -87,7 +87,7 @@ ODP_STATIC_ASSERT(CHECK_IS_POWER2(ODP_CONFIG_QUEUES),
 static sched_group_mask_t sg_free;
 static sched_group_t *sg_vec[MAX_SCHED_GROUP];
 /* Group lock for MT-safe APIs */
-odp_spinlock_t sched_grp_lock;
+static odp_spinlock_t sched_grp_lock;
 
 #define SCHED_GROUP_JOIN 0
 #define SCHED_GROUP_LEAVE 1



[lng-odp] [PATCH API-NEXT v4 2/4] linux-gen: scalable sched: mark several function as static

2017-08-14 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 108 (lumag:symbols-cleanup)
 ** https://github.com/Linaro/odp/pull/108
 ** Patch: https://github.com/Linaro/odp/pull/108.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: 96b4b72d57a270b2b7ac6609852c867ee2de5a1b
 **/
 .../include/odp_schedule_scalable_ordered.h   |  9 -
 .../linux-generic/odp_schedule_scalable_ordered.c | 19 ++-
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/platform/linux-generic/include/odp_schedule_scalable_ordered.h 
b/platform/linux-generic/include/odp_schedule_scalable_ordered.h
index 941304b7..1c365a2b 100644
--- a/platform/linux-generic/include/odp_schedule_scalable_ordered.h
+++ b/platform/linux-generic/include/odp_schedule_scalable_ordered.h
@@ -115,17 +115,8 @@ reorder_window_t *rwin_alloc(_odp_ishm_pool_t *pool,
 unsigned lock_count);
 int rwin_free(_odp_ishm_pool_t *pool, reorder_window_t *rwin);
 bool rwin_reserve(reorder_window_t *rwin, uint32_t *sn);
-void rwin_insert(reorder_window_t *rwin,
-reorder_context_t *rctx,
-uint32_t sn,
-void (*callback)(reorder_context_t *));
 void rctx_init(reorder_context_t *rctx, uint16_t idx,
   reorder_window_t *rwin, uint32_t sn);
-void rctx_free(const reorder_context_t *rctx);
-void olock_unlock(const reorder_context_t *rctx, reorder_window_t *rwin,
- uint32_t lock_index);
-void olock_release(const reorder_context_t *rctx);
-void rctx_retire(reorder_context_t *first);
 void rctx_release(reorder_context_t *rctx);
 int rctx_save(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], int num);
 
diff --git a/platform/linux-generic/odp_schedule_scalable_ordered.c 
b/platform/linux-generic/odp_schedule_scalable_ordered.c
index 90ddb61c..e4468a90 100644
--- a/platform/linux-generic/odp_schedule_scalable_ordered.c
+++ b/platform/linux-generic/odp_schedule_scalable_ordered.c
@@ -71,10 +71,10 @@ bool rwin_reserve(reorder_window_t *rwin, uint32_t *sn)
return true;
 }
 
-void rwin_insert(reorder_window_t *rwin,
-reorder_context_t *rctx,
-uint32_t sn,
-void (*callback)(reorder_context_t *))
+static void rwin_insert(reorder_window_t *rwin,
+   reorder_context_t *rctx,
+   uint32_t sn,
+   void (*callback)(reorder_context_t *))
 {
/* Initialise to silence scan-build */
hc_t old = {0, 0};
@@ -172,7 +172,7 @@ void rctx_init(reorder_context_t *rctx, uint16_t idx,
rctx->numevts = 0;
 }
 
-inline void rctx_free(const reorder_context_t *rctx)
+static inline void rctx_free(const reorder_context_t *rctx)
 {
const reorder_context_t *const base = [-(int)rctx->idx];
const uint32_t first = rctx->idx;
@@ -206,8 +206,9 @@ inline void rctx_free(const reorder_context_t *rctx)
}
 }
 
-inline void olock_unlock(const reorder_context_t *rctx, reorder_window_t *rwin,
-uint32_t lock_index)
+static inline void olock_unlock(const reorder_context_t *rctx,
+   reorder_window_t *rwin,
+   uint32_t lock_index)
 {
if ((rctx->olock_flags & (1U << lock_index)) == 0) {
/* Use relaxed ordering, we are not releasing any updates */
@@ -215,7 +216,7 @@ inline void olock_unlock(const reorder_context_t *rctx, 
reorder_window_t *rwin,
}
 }
 
-void olock_release(const reorder_context_t *rctx)
+static void olock_release(const reorder_context_t *rctx)
 {
reorder_window_t *rwin;
int i;
@@ -246,7 +247,7 @@ static void blocking_enqueue(queue_entry_t *q, 
odp_buffer_hdr_t **evts, int num)
}
 }
 
-void rctx_retire(reorder_context_t *first)
+static void rctx_retire(reorder_context_t *first)
 {
reorder_context_t *rctx;
queue_entry_t *q;



[lng-odp] [PATCH API-NEXT v4 1/4] linux-gen: classification: mark several functions as static

2017-08-14 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 108 (lumag:symbols-cleanup)
 ** https://github.com/Linaro/odp/pull/108
 ** Patch: https://github.com/Linaro/odp/pull/108.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: 96b4b72d57a270b2b7ac6609852c867ee2de5a1b
 **/
 .../linux-generic/include/odp_classification_internal.h   |  7 ---
 platform/linux-generic/odp_classification.c   | 15 ++-
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/platform/linux-generic/include/odp_classification_internal.h 
b/platform/linux-generic/include/odp_classification_internal.h
index 208b0f5b..8882a717 100644
--- a/platform/linux-generic/include/odp_classification_internal.h
+++ b/platform/linux-generic/include/odp_classification_internal.h
@@ -49,13 +49,6 @@ This function should be called during pktio initialization.
 **/
 int pktio_classifier_init(pktio_entry_t *pktio);
 
-void _odp_cls_update_hash_proto(cos_t *cos,
-   odp_pktin_hash_proto_t hash_proto);
-
-uint32_t packet_rss_hash(odp_packet_hdr_t *pkt_hdr,
-odp_cls_hash_proto_t hash_proto,
-const uint8_t *base);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index f9a82a2e..a785c604 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -33,7 +33,7 @@ static cos_tbl_t *cos_tbl;
 static pmr_tbl_t   *pmr_tbl;
 static _cls_queue_grp_tbl_t *queue_grp_tbl;
 
-const rss_key default_rss = {
+static const rss_key default_rss = {
.u8 = {
0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
@@ -191,7 +191,8 @@ int odp_cls_capability(odp_cls_capability_t *capability)
return 0;
 }
 
-void _odp_cls_update_hash_proto(cos_t *cos, odp_pktin_hash_proto_t hash_proto)
+static void _odp_cls_update_hash_proto(cos_t *cos,
+  odp_pktin_hash_proto_t hash_proto)
 {
if (hash_proto.proto.ipv4 || hash_proto.proto.ipv4_tcp ||
hash_proto.proto.ipv4_udp)
@@ -934,6 +935,10 @@ static inline cos_t *cls_select_cos(pktio_entry_t *entry,
return cls->default_cos;
 }
 
+static uint32_t packet_rss_hash(odp_packet_hdr_t *pkt_hdr,
+   odp_cls_hash_proto_t hash_proto,
+   const uint8_t *base);
+
 /**
  * Classify packet
  *
@@ -989,9 +994,9 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t 
*base,
return 0;
 }
 
-uint32_t packet_rss_hash(odp_packet_hdr_t *pkt_hdr,
-odp_cls_hash_proto_t hash_proto,
-const uint8_t *base)
+static uint32_t packet_rss_hash(odp_packet_hdr_t *pkt_hdr,
+   odp_cls_hash_proto_t hash_proto,
+   const uint8_t *base)
 {
thash_tuple_t tuple;
const _odp_ipv4hdr_t *ipv4;



[lng-odp] [PATCH API-NEXT v4 0/4] Symbols cleanup

2017-08-14 Thread Github ODP bot
Several low-hanging fruits for https://bugs.linaro.org/show_bug.cgi?id=2988

github
/** Email created from pull request 108 (lumag:symbols-cleanup)
 ** https://github.com/Linaro/odp/pull/108
 ** Patch: https://github.com/Linaro/odp/pull/108.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: 96b4b72d57a270b2b7ac6609852c867ee2de5a1b
 **/
/github

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


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


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


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


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


[lng-odp] [PATCH API-NEXT v6 1/1] API:IPSEC: IPSEC events may be reported synchronously.

2017-08-14 Thread Github ODP bot
From: Nikhil Agarwal 

IPSEC events may be delivered synchronous or ansynchrous
depending on implementation. Application will know based on
return value of odp_ipsec_sa_disable API.

Signed-off-by: Nikhil Agarwal 
---
/** Email created from pull request 109 (NikhilA-Linaro:disable_event)
 ** https://github.com/Linaro/odp/pull/109
 ** Patch: https://github.com/Linaro/odp/pull/109.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: c5a312d1fbf91fbf3ffab109a84d4bb658db1e2f
 **/
 include/odp/api/spec/ipsec.h | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 7085bc0d..f502c7fa 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -831,16 +831,19 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
odp_ipsec_sa_param_t *param);
  * before calling disable. Packets in progress during the call may still match
  * the SA and be processed successfully.
  *
- * 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.
+ * A return value 0 indicates that the disable request has completed
+ * synchronously and the SA is now disabled. A return value 1 indicates that 
the
+ * disable request has been accepted and completion will be indicated by an
+ * ODP_EVENT_IPSEC_STATUS sent to the queue specified for the SA. This 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. In synchronous mode of operation, disable requests are
+ * gauranteed to complete synchronously as there is no queue associated with 
SA.
  *
  * @param sa  IPSEC SA to be disabled
  *
- * @retval 0  On success
+ * @retval 0  When SA is disabled successfully.
+ * @retval 1  Disable event will be posted on SA queue.
  * @retval <0 On failure
  *
  * @see odp_ipsec_sa_destroy()



[lng-odp] [PATCH API-NEXT v6 0/1] API:IPSEC: IPSEC events may be reported synchronously

2017-08-14 Thread Github ODP bot
IPSEC events may be delivered synchronous or ansynchrous
depending on implementation. Application will know based on
return value of odp_ipsec_sa_disable API.
Signed-off-by: Nikhil Agarwal nikhil.agar...@linaro.org

github
/** Email created from pull request 109 (NikhilA-Linaro:disable_event)
 ** https://github.com/Linaro/odp/pull/109
 ** Patch: https://github.com/Linaro/odp/pull/109.patch
 ** Base sha: 3547226b19e6982bf74fc8c258b89db2c5f6a39c
 ** Merge commit sha: c5a312d1fbf91fbf3ffab109a84d4bb658db1e2f
 **/
/github

checkpatch.pl
WARNING: 'gauranteed' may be misspelled - perhaps 'guaranteed'?
#43: FILE: include/odp/api/spec/ipsec.h:841:
+ * gauranteed to complete synchronously as there is no queue associated with 
SA.

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


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

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
/checkpatch.pl


[lng-odp] [PATCH CLOUD-DEV v3 2/2] linux-gen: pool: add generic pool module to mempool subsystem

2017-08-14 Thread Github ODP bot
From: Kevin Wang 

Signed-off-by: Kevin Wang 
---
/** Email created from pull request 120 (kevinwangsk:cloud-dev-pool-modular)
 ** https://github.com/Linaro/odp/pull/120
 ** Patch: https://github.com/Linaro/odp/pull/120.patch
 ** Base sha: 7dce7af2c3a936f711e845ffcf765bfb1cc3c95a
 ** Merge commit sha: a91c6f2ff94be1cd2b03c28ca7a720025f6fe8b6
 **/
 platform/linux-generic/Makefile.am |   4 +-
 platform/linux-generic/include/odp_pool_internal.h |  37 +++
 platform/linux-generic/odp_buffer.c| 244 
 .../linux-generic/{odp_pool.c => pool/generic.c}   | 324 +++--
 platform/linux-generic/pool/subsystem.c| 220 ++
 5 files changed, 540 insertions(+), 289 deletions(-)
 rename platform/linux-generic/{odp_pool.c => pool/generic.c} (69%)

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index d74e2e31..cdb868b1 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -268,9 +268,9 @@ __LIB__libodp_linux_la_SOURCES = \
   pktio/sysfs.c \
   pktio/tap.c \
   pktio/ring.c \
+  pool/generic.c \
   pool/subsystem.c \
   odp_pkt_queue.c \
-  odp_pool.c \
   odp_queue.c \
   odp_queue_if.c \
   odp_queue_scalable.c \
@@ -326,6 +326,8 @@ if HAVE_PCAP
 __LIB__libodp_linux_la_SOURCES += pktio/pcap.c
 endif
 
+pool/generic.lo: CFLAGS += -DIM_ACTIVE_MODULE
+
 # Build modular framework into odp-linux library
 modularframeworkdir = $(top_srcdir)/frameworks/modular
 noinst_HEADERS += $(modularframeworkdir)/list.h \
diff --git a/platform/linux-generic/include/odp_pool_internal.h 
b/platform/linux-generic/include/odp_pool_internal.h
index f2d2e2ca..bc7305c4 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -21,11 +21,14 @@ extern "C" {
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#define CACHE_BURST32
+
 typedef struct pool_cache_t {
uint32_t num;
uint32_t buf_index[CONFIG_POOL_CACHE_SIZE];
@@ -88,6 +91,14 @@ typedef struct pool_table_t {
 
 extern pool_table_t *pool_tbl;
 
+/* Thread local variables */
+typedef struct pool_local_t {
+   pool_cache_t *cache[ODP_CONFIG_POOLS];
+   int thr_id;
+} pool_local_t;
+
+extern __thread pool_local_t local;
+
 static inline pool_t *pool_entry(uint32_t pool_idx)
 {
return _tbl->pool[pool_idx];
@@ -103,6 +114,32 @@ static inline odp_buffer_hdr_t 
*buf_hdl_to_hdr(odp_buffer_t buf)
return (odp_buffer_hdr_t *)(uintptr_t)buf;
 }
 
+static inline odp_pool_t pool_index_to_handle(uint32_t pool_idx)
+{
+   return _odp_cast_scalar(odp_pool_t, pool_idx);
+}
+
+static inline pool_t *pool_from_buf(odp_buffer_t buf)
+{
+   odp_buffer_hdr_t *buf_hdr = buf_hdl_to_hdr(buf);
+
+   return buf_hdr->pool_ptr;
+}
+
+static inline odp_buffer_hdr_t *buf_hdr_from_index(pool_t *pool,
+  uint32_t buffer_idx)
+{
+   uint32_t block_offset;
+   odp_buffer_hdr_t *buf_hdr;
+
+   block_offset = buffer_idx * pool->block_size;
+
+   /* clang requires cast to uintptr_t */
+   buf_hdr = (odp_buffer_hdr_t *)(uintptr_t)>base_addr[block_offset];
+
+   return buf_hdr;
+}
+
 int buffer_alloc_multi(pool_t *pool, odp_buffer_hdr_t *buf_hdr[], int num);
 void buffer_free_multi(odp_buffer_hdr_t *buf_hdr[], int num_free);
 
diff --git a/platform/linux-generic/odp_buffer.c 
b/platform/linux-generic/odp_buffer.c
index 9c7dc1f5..b7ea88e6 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
@@ -83,3 +83,247 @@ uint64_t odp_buffer_to_u64(odp_buffer_t hdl)
 {
return _odp_pri(hdl);
 }
+
+odp_event_type_t _odp_buffer_event_type(odp_buffer_t buf)
+{
+   return buf_hdl_to_hdr(buf)->event_type;
+}
+
+void _odp_buffer_event_type_set(odp_buffer_t buf, int ev)
+{
+   buf_hdl_to_hdr(buf)->event_type = ev;
+}
+
+odp_event_subtype_t _odp_buffer_event_subtype(odp_buffer_t buf)
+{
+   return buf_hdl_to_hdr(buf)->event_subtype;
+}
+
+void _odp_buffer_event_subtype_set(odp_buffer_t buf, int ev)
+{
+   buf_hdl_to_hdr(buf)->event_subtype = ev;
+}
+
+int buffer_alloc_multi(pool_t *pool, odp_buffer_hdr_t *buf_hdr[], int max_num)
+{
+   ring_t *ring;
+   uint32_t mask, i;
+   pool_cache_t *cache;
+   uint32_t cache_num, num_ch, num_deq, burst;
+   odp_buffer_hdr_t *hdr;
+
+   cache = local.cache[pool->pool_idx];
+
+   cache_num = cache->num;
+   num_ch= max_num;
+   num_deq   = 0;
+   burst = CACHE_BURST;
+
+   if (odp_unlikely(cache_num < (uint32_t)max_num)) {
+   /* Cache does 

[lng-odp] [PATCH CLOUD-DEV v3 1/2] linux-gen: pool: apply modular framework and create subsystem

2017-08-14 Thread Github ODP bot
From: Kevin Wang 

Signed-off-by: Kevin Wang 
---
/** Email created from pull request 120 (kevinwangsk:cloud-dev-pool-modular)
 ** https://github.com/Linaro/odp/pull/120
 ** Patch: https://github.com/Linaro/odp/pull/120.patch
 ** Base sha: 7dce7af2c3a936f711e845ffcf765bfb1cc3c95a
 ** Merge commit sha: a91c6f2ff94be1cd2b03c28ca7a720025f6fe8b6
 **/
 platform/linux-generic/Makefile.am |  2 +
 .../linux-generic/include/odp_pool_subsystem.h | 50 ++
 platform/linux-generic/pool/subsystem.c| 17 
 3 files changed, 69 insertions(+)
 create mode 100644 platform/linux-generic/include/odp_pool_subsystem.h
 create mode 100644 platform/linux-generic/pool/subsystem.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 1d703cea..d74e2e31 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -190,6 +190,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_packet_tap.h \
  ${srcdir}/include/odp_pkt_queue_internal.h \
  ${srcdir}/include/odp_pool_internal.h \
+ ${srcdir}/include/odp_pool_subsystem.h \
  ${srcdir}/include/odp_posix_extensions.h \
  ${srcdir}/include/odp_queue_internal.h \
  ${srcdir}/include/odp_queue_scalable_internal.h \
@@ -267,6 +268,7 @@ __LIB__libodp_linux_la_SOURCES = \
   pktio/sysfs.c \
   pktio/tap.c \
   pktio/ring.c \
+  pool/subsystem.c \
   odp_pkt_queue.c \
   odp_pool.c \
   odp_queue.c \
diff --git a/platform/linux-generic/include/odp_pool_subsystem.h 
b/platform/linux-generic/include/odp_pool_subsystem.h
new file mode 100644
index ..45537a86
--- /dev/null
+++ b/platform/linux-generic/include/odp_pool_subsystem.h
@@ -0,0 +1,50 @@
+/* Copyright (c) 2017, ARM Limited. All rights reserved.
+ *
+ * Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_POOL_SUBSYSTEM_H_
+#define ODP_POOL_SUBSYSTEM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/* ODP pool public APIs subsystem */
+ODP_SUBSYSTEM_DECLARE(pool);
+
+/* Subsystem APIs declarations */
+ODP_SUBSYSTEM_API(pool, int, capability, odp_pool_capability_t *capa);
+ODP_SUBSYSTEM_API(pool, odp_pool_t, create, const char *name,
+ odp_pool_param_t *params);
+ODP_SUBSYSTEM_API(pool, int, destroy, odp_pool_t pool);
+ODP_SUBSYSTEM_API(pool, odp_pool_t, lookup, const char *name);
+ODP_SUBSYSTEM_API(pool, int, info, odp_pool_t pool, odp_pool_info_t *info);
+ODP_SUBSYSTEM_API(pool, void, print, odp_pool_t pool);
+ODP_SUBSYSTEM_API(pool, uint64_t, to_u64, odp_pool_t pool);
+ODP_SUBSYSTEM_API(pool, void, param_init, odp_pool_param_t *params);
+
+typedef ODP_MODULE_CLASS(pool) {
+   odp_module_base_t base;
+
+   odp_api_proto(pool, capability) capability;
+   odp_api_proto(pool, create) create;
+   odp_api_proto(pool, destroy) destroy;
+   odp_api_proto(pool, lookup) lookup;
+   odp_api_proto(pool, info) info;
+   odp_api_proto(pool, print) print;
+   odp_api_proto(pool, to_u64) to_u64;
+   odp_api_proto(pool, param_init) param_init;
+} pool_module_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/pool/subsystem.c 
b/platform/linux-generic/pool/subsystem.c
new file mode 100644
index ..2750149c
--- /dev/null
+++ b/platform/linux-generic/pool/subsystem.c
@@ -0,0 +1,17 @@
+/* Copyright (c) 2017, ARM Limited. All rights reserved.
+ *
+ * Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include 
+
+#define SUBSYSTEM_VERSION 0x0001UL
+ODP_SUBSYSTEM_DEFINE(pool, "memory pool public APIs", SUBSYSTEM_VERSION);
+
+ODP_SUBSYSTEM_CONSTRUCTOR(pool)
+{
+   odp_subsystem_constructor(pool);
+}
+



[lng-odp] [PATCH CLOUD-DEV v3 0/2] Move pool to modular framework

2017-08-14 Thread Github ODP bot
Separate with two commits.
First one is to add the pool subsystem in modular framework.
Second one is to add the generic pool implementation to the pool subsystem.

github
/** Email created from pull request 120 (kevinwangsk:cloud-dev-pool-modular)
 ** https://github.com/Linaro/odp/pull/120
 ** Patch: https://github.com/Linaro/odp/pull/120.patch
 ** Base sha: 7dce7af2c3a936f711e845ffcf765bfb1cc3c95a
 ** Merge commit sha: a91c6f2ff94be1cd2b03c28ca7a720025f6fe8b6
 **/
/github

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


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


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


Re: [lng-odp] [PATCH API-NEXT v5 1/1] API:IPSEC: IPSEC events may be reported synchronously.

2017-08-14 Thread Peltonen, Janne (Nokia - FI/Espoo)
> The definition of odp_ipsec_sa_disable() is that RC = 0 means the SA is now 
> guaranteed idle

It means that no further events for that SA will be posted to the SA queue.

> and may be safely destroyed,

Only from ODP point-of-view. The application may still have IPsec subtype 
packets for the SA
in flight in other threads.

> so there would be no other events to dequeue.

There can still be unhandled events in the event queues and outside event 
queues in other threads.

My point in my comments is that the application needs to synchronize between 
regular IPsec
completion event handling and destroying an SA and for that an “end marker” 
event in the SA
queue would be quite convenient, or even necessary to avoid more costly 
synchronization.

Let’s consider IPsec packet reception in inline mode as an example:

As long as an SA is active (not disabled) incoming packets can match it and end 
up as
IPsec packet events in the SA queue. Thus when an application disables the SA, 
there can
be unhandled events for that SA in the event queues and/or under processing in 
other threads.
If the thread that disabled the SA immediately destroyed the SA, then event 
handling
would attempt to use a destroyed SA (e.g. it would call odp_ipsec_sa_context()) 
for an
SA that was already destroyed, resulting in undefined behavior.

If ODP sent SA disable completion event to the SA queue or if the application 
did it
itself after the proposed synchronous SA disable completion, then it would be 
able to
postpone the destroying of an SA until all events for the SA have been fully 
handled.

 Janne


From: Bill Fischofer [mailto:bill.fischo...@linaro.org]
Sent: Monday, August 14, 2017 9:19 PM
To: Peltonen, Janne (Nokia - FI/Espoo) 
Cc: Github ODP bot ; lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH API-NEXT v5 1/1] API:IPSEC: IPSEC events may be 
reported synchronously.



On Mon, Aug 14, 2017 at 9:41 AM, Peltonen, Janne (Nokia - FI/Espoo) 
> wrote:

Hi,

Why is this change needed or preferred over the current API?

I would guess that many applications that use inline or asynchronous
mode need an end marker in the SA queue so that they know when they
can free their own per-SA state and destroy the ODP SA (i.e. when
all events for the SA being disabled have been dequeued and processed).

If odp_ipsec_sa_disable() may return synchronously, then such an
application would need to submit an end marker event to the SA queue
itself. The application cannot create an IPsec status event itself so
it has to define another type of event. But the application still has
to be able to process both the IPsec status event and its own event
in the event handler.

So, based on the above, it does not look like this change would make
the life of an application any easier, but maybe even the opposite.
Does it make ODP implementation significantly easier?

If this change is anyway made, the API should make it clear that after
return with retval 0 the implementation will not enqueue any further
events for that SA to the SA queue.

The definition of odp_ipsec_sa_disable() is that RC = 0 means the SA is now 
guaranteed idle and may be safely destroyed, so there would be no other events 
to dequeue. If the implementation cannot guarantee this then it cannot return 
synchronously, so I don't see any ambiguity here.

Aside to Maxim: the GitHub to mailing list path has been working well but the 
mailing list to GitHub return path is not. Any idea what's needed to enable 
that path?  Alternatively, Janne, you might want to reply via GitHub to help 
keep the discussion in one place along with the PR.


Janne


> -Original Message-
> From: lng-odp 
> [mailto:lng-odp-boun...@lists.linaro.org]
>  On Behalf Of Github ODP bot
> Sent: Thursday, August 10, 2017 9:00 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH API-NEXT v5 1/1] API:IPSEC: IPSEC events may be 
> reported
> synchronously.
>
> From: Nikhil Agarwal 
> >
>
> IPSEC events may be delivered synchronous or ansynchrous
> depending on implementation. Application will know based on
> return value of odp_ipsec_sa_disable API.
>
> Signed-off-by: Nikhil Agarwal 
> >
> ---
> /** Email created from pull request 109 (NikhilA-Linaro:disable_event)
>  ** https://github.com/Linaro/odp/pull/109
>  ** Patch: https://github.com/Linaro/odp/pull/109.patch
>  ** Base sha: e420668cd3886f003c8bd6022e210bf08a0ee3b5
>  ** Merge commit sha: f65d49b122f2f60a7fc9af3e0a09067dcfd369d9
>  **/
>  include/odp/api/spec/ipsec.h | 17 ++---
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
> 

[lng-odp] [Linaro/odp] 4e11ef: merge: squashed commit: odp-dpdk to odp cloud

2017-08-14 Thread GitHub
  Branch: refs/heads/cloud-dev
  Home:   https://github.com/Linaro/odp
  Commit: 4e11ef454d383b9637541c53ad4eeda65751742b
  
https://github.com/Linaro/odp/commit/4e11ef454d383b9637541c53ad4eeda65751742b
  Author: Maxim Uvarov 
  Date:   2017-08-15 (Tue, 15 Aug 2017)

  Changed paths:
A README.DPDK
A pkgconfig/libodp-dpdk.pc.in
A platform/linux-dpdk/.gitignore
A platform/linux-dpdk/Makefile.am
A platform/linux-dpdk/Makefile.inc
A platform/linux-dpdk/README
A platform/linux-dpdk/arch
A platform/linux-dpdk/doc/platform_specific.dox
A platform/linux-dpdk/include/odp/api/align.h
A platform/linux-dpdk/include/odp/api/atomic.h
A platform/linux-dpdk/include/odp/api/barrier.h
A platform/linux-dpdk/include/odp/api/buffer.h
A platform/linux-dpdk/include/odp/api/byteorder.h
A platform/linux-dpdk/include/odp/api/classification.h
A platform/linux-dpdk/include/odp/api/compiler.h
A platform/linux-dpdk/include/odp/api/cpu.h
A platform/linux-dpdk/include/odp/api/cpumask.h
A platform/linux-dpdk/include/odp/api/crypto.h
A platform/linux-dpdk/include/odp/api/debug.h
A platform/linux-dpdk/include/odp/api/deprecated.h
A platform/linux-dpdk/include/odp/api/errno.h
A platform/linux-dpdk/include/odp/api/event.h
A platform/linux-dpdk/include/odp/api/hash.h
A platform/linux-dpdk/include/odp/api/hints.h
A platform/linux-dpdk/include/odp/api/init.h
A platform/linux-dpdk/include/odp/api/packet.h
A platform/linux-dpdk/include/odp/api/packet_flags.h
A platform/linux-dpdk/include/odp/api/packet_io.h
A platform/linux-dpdk/include/odp/api/packet_io_stats.h
A platform/linux-dpdk/include/odp/api/plat/atomic_inlines.h
A platform/linux-dpdk/include/odp/api/plat/atomic_types.h
A platform/linux-dpdk/include/odp/api/plat/barrier_types.h
A platform/linux-dpdk/include/odp/api/plat/buffer_types.h
A platform/linux-dpdk/include/odp/api/plat/byteorder_inlines.h
A platform/linux-dpdk/include/odp/api/plat/byteorder_types.h
A platform/linux-dpdk/include/odp/api/plat/classification_types.h
A platform/linux-dpdk/include/odp/api/plat/cpumask_types.h
A platform/linux-dpdk/include/odp/api/plat/crypto_types.h
A platform/linux-dpdk/include/odp/api/plat/event_types.h
A platform/linux-dpdk/include/odp/api/plat/init_types.h
A platform/linux-dpdk/include/odp/api/plat/packet_flag_inlines.h
A platform/linux-dpdk/include/odp/api/plat/packet_flag_inlines_api.h
A platform/linux-dpdk/include/odp/api/plat/packet_inlines.h
A platform/linux-dpdk/include/odp/api/plat/packet_inlines_api.h
A platform/linux-dpdk/include/odp/api/plat/packet_io_types.h
A platform/linux-dpdk/include/odp/api/plat/packet_types.h
A platform/linux-dpdk/include/odp/api/plat/pool_types.h
A platform/linux-dpdk/include/odp/api/plat/queue_types.h
A platform/linux-dpdk/include/odp/api/plat/rwlock_recursive_types.h
A platform/linux-dpdk/include/odp/api/plat/rwlock_types.h
A platform/linux-dpdk/include/odp/api/plat/schedule_types.h
A platform/linux-dpdk/include/odp/api/plat/shared_memory_types.h
A platform/linux-dpdk/include/odp/api/plat/spinlock_recursive_types.h
A platform/linux-dpdk/include/odp/api/plat/spinlock_types.h
A platform/linux-dpdk/include/odp/api/plat/static_inline.h.in
A platform/linux-dpdk/include/odp/api/plat/std_clib_inlines.h
A platform/linux-dpdk/include/odp/api/plat/strong_types.h
A platform/linux-dpdk/include/odp/api/plat/sync_inlines.h
A platform/linux-dpdk/include/odp/api/plat/thread_types.h
A platform/linux-dpdk/include/odp/api/plat/thrmask_types.h
A platform/linux-dpdk/include/odp/api/plat/ticketlock_inlines.h
A platform/linux-dpdk/include/odp/api/plat/ticketlock_inlines_api.h
A platform/linux-dpdk/include/odp/api/plat/ticketlock_types.h
A platform/linux-dpdk/include/odp/api/plat/time_types.h
A platform/linux-dpdk/include/odp/api/plat/timer_types.h
A platform/linux-dpdk/include/odp/api/plat/traffic_mngr_types.h
A platform/linux-dpdk/include/odp/api/plat/version_types.h
A platform/linux-dpdk/include/odp/api/pool.h
A platform/linux-dpdk/include/odp/api/queue.h
A platform/linux-dpdk/include/odp/api/random.h
A platform/linux-dpdk/include/odp/api/rwlock.h
A platform/linux-dpdk/include/odp/api/rwlock_recursive.h
A platform/linux-dpdk/include/odp/api/schedule.h
A platform/linux-dpdk/include/odp/api/schedule_types.h
A platform/linux-dpdk/include/odp/api/shared_memory.h
A platform/linux-dpdk/include/odp/api/spinlock.h
A platform/linux-dpdk/include/odp/api/spinlock_recursive.h
A platform/linux-dpdk/include/odp/api/std_clib.h
A platform/linux-dpdk/include/odp/api/std_types.h
A platform/linux-dpdk/include/odp/api/sync.h
A platform/linux-dpdk/include/odp/api/system_info.h
A platform/linux-dpdk/include/odp/api/thread.h
A 

[lng-odp] [PATCH v2 3/3] linux-generic: packet: reorder reference fields for performance

2017-08-14 Thread Github ODP bot
From: Bill Fischofer 

The ref_count and ref_hdr fields are the only fields referenced in
non-reference packet processing paths, so move them to be closer to
the current frame_len field so they are in the same cache line. This
results in significant improvement in odp_bench_packet measurements.

Signed-off-by: Bill Fischofer 
---
/** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt)
 ** https://github.com/Linaro/odp/pull/125
 ** Patch: https://github.com/Linaro/odp/pull/125.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: 6d464aeb30e24833ae787e3997a411103c16c70c
 **/
 platform/linux-generic/include/odp/api/plat/packet_types.h | 4 ++--
 platform/linux-generic/include/odp_packet_internal.h   | 7 ---
 platform/linux-generic/odp_packet.c| 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h 
b/platform/linux-generic/include/odp/api/plat/packet_types.h
index 1554c3af..b7236412 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_types.h
@@ -84,14 +84,14 @@ typedef struct _odp_packet_inline_offset_t {
/** @internal field offset */
size_t tailroom;
/** @internal field offset */
-   size_t unshared_len;
-   /** @internal field offset */
size_t ref_hdr;
/** @internal field offset */
size_t ref_offset;
/** *internal field offset */
size_t ref_len;
/** @internal field offset */
+   size_t unshared_len;
+   /** @internal field offset */
size_t pool;
/** @internal field offset */
size_t input;
diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 48c2463f..dfe131b1 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -124,7 +124,8 @@ typedef struct odp_packet_hdr_t {
uint32_t tailroom;
 
/* Fields used to support packet references */
-   uint32_t unshared_len;
+   /* Incremented on refs, decremented on frees. */
+   odp_atomic_u32_t ref_count;
/* Next pkt_hdr in reference chain */
struct odp_packet_hdr_t *ref_hdr;
/* Offset into next pkt_hdr that ref was created at */
@@ -133,8 +134,8 @@ typedef struct odp_packet_hdr_t {
 * allows original offset to be maintained when base pkt len
 * is changed */
uint32_t ref_len;
-   /* Incremented on refs, decremented on frees. */
-   odp_atomic_u32_t ref_count;
+   /* Track unshared portion of frame_len */
+   uint32_t unshared_len;
 
/*
 * Members below are not initialized by packet_init()
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index a71a5926..dd5be38a 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -33,10 +33,10 @@ const _odp_packet_inline_offset_t _odp_packet_inline 
ODP_ALIGNED_CACHE = {
.frame_len  = offsetof(odp_packet_hdr_t, frame_len),
.headroom   = offsetof(odp_packet_hdr_t, headroom),
.tailroom   = offsetof(odp_packet_hdr_t, tailroom),
-   .unshared_len   = offsetof(odp_packet_hdr_t, unshared_len),
.ref_hdr= offsetof(odp_packet_hdr_t, ref_hdr),
.ref_offset = offsetof(odp_packet_hdr_t, ref_offset),
.ref_len= offsetof(odp_packet_hdr_t, ref_len),
+   .unshared_len   = offsetof(odp_packet_hdr_t, unshared_len),
.pool   = offsetof(odp_packet_hdr_t, buf_hdr.pool_hdl),
.input  = offsetof(odp_packet_hdr_t, input),
.segcount   = offsetof(odp_packet_hdr_t, buf_hdr.segcount),



[lng-odp] [PATCH v2 0/3] Pktrefs opt

2017-08-14 Thread Github ODP bot
Optimizations to the zero-copy packet reference code to partially address 
issues raised in
https://bugs.linaro.org/show_bug.cgi?id=3201

github
/** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt)
 ** https://github.com/Linaro/odp/pull/125
 ** Patch: https://github.com/Linaro/odp/pull/125.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: 6d464aeb30e24833ae787e3997a411103c16c70c
 **/
/github

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


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


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


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


[lng-odp] [PATCH v2 2/3] linux-generic: packet: add branch hints for reference optimization

2017-08-14 Thread Github ODP bot
From: Bill Fischofer 

Add odp_likely() and odp_unlikely() hints on critical paths in packet
allocation / free processing to optimize reference support.

Signed-off-by: Bill Fischofer 
---
/** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt)
 ** https://github.com/Linaro/odp/pull/125
 ** Patch: https://github.com/Linaro/odp/pull/125.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: 6d464aeb30e24833ae787e3997a411103c16c70c
 **/
 platform/linux-generic/odp_packet.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index f18bd4dd..a71a5926 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -444,13 +444,14 @@ static inline void free_bufs(odp_packet_hdr_t *pkt_hdr, 
int first, int num)
for (i = 0, nfree = 0; i < num; i++) {
odp_packet_hdr_t *hdr = pkt_hdr->buf_hdr.seg[first + i].hdr;
 
-   if (packet_ref_count(hdr) == 1 || packet_ref_dec(hdr) == 1) {
+   if (odp_likely(packet_ref_count(hdr) == 1 ||
+  packet_ref_dec(hdr) == 1)) {
ODP_ASSERT((packet_ref_count_set(hdr, 0), 1));
buf_hdr[nfree++] = >buf_hdr;
}
}
 
-   if (nfree > 0)
+   if (odp_likely(nfree > 0))
buffer_free_multi(buf_hdr, nfree);
 }
 
@@ -468,8 +469,8 @@ static inline odp_packet_hdr_t 
*free_segments(odp_packet_hdr_t *pkt_hdr,
for (i = 0, nfree = 0; i < num; i++) {
new_hdr = pkt_hdr->buf_hdr.seg[i].hdr;
 
-   if (packet_ref_count(new_hdr) == 1 ||
-   packet_ref_dec(new_hdr) == 1) {
+   if (odp_likely(packet_ref_count(new_hdr) == 1 ||
+  packet_ref_dec(new_hdr) == 1)) {
ODP_ASSERT((packet_ref_count_set(new_hdr, 0),
1));
buf_hdr[nfree++] = _hdr->buf_hdr;
@@ -492,7 +493,7 @@ static inline odp_packet_hdr_t 
*free_segments(odp_packet_hdr_t *pkt_hdr,
 
pkt_hdr = new_hdr;
 
-   if (nfree > 0)
+   if (odp_likely(nfree > 0))
buffer_free_multi(buf_hdr, nfree);
} else {
/* Free last 'num' bufs */
@@ -658,7 +659,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int 
num)
ref_hdr = pkt_hdr->ref_hdr;
 
/* Make sure we have enough space for this pkt's segs */
-   if (nfree + num_seg > nbufs) {
+   if (odp_unlikely(nfree + num_seg > nbufs)) {
buffer_free_multi(buf_hdr, nfree);
nfree = 0;
}
@@ -681,7 +682,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int 
num)
} while (pkt_hdr);
}
 
-   if (nfree > 0)
+   if (odp_likely(nfree > 0))
buffer_free_multi(buf_hdr, nfree);
 }
 



[lng-odp] [PATCH v2 1/3] linux-generic: packet: improve packet_init() performance

2017-08-14 Thread Github ODP bot
From: Bill Fischofer 

Streamline packet_init() performance by eliminating the redundant
initialization of the unshared_len field of the packet hdr. This field
is initialized when references are created so this processing is not
required here.

Signed-off-by: Bill Fischofer 
---
/** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt)
 ** https://github.com/Linaro/odp/pull/125
 ** Patch: https://github.com/Linaro/odp/pull/125.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: 6d464aeb30e24833ae787e3997a411103c16c70c
 **/
 platform/linux-generic/include/odp_packet_internal.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index d923ee23..48c2463f 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -269,7 +269,6 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, 
uint32_t len)
pkt_hdr->input = ODP_PKTIO_INVALID;
 
/* By default packet has no references */
-   pkt_hdr->unshared_len = len;
pkt_hdr->ref_hdr = NULL;
 }
 



Re: [lng-odp] [PATCH API-NEXT v5 1/1] API:IPSEC: IPSEC events may be reported synchronously.

2017-08-14 Thread Bill Fischofer
On Mon, Aug 14, 2017 at 9:41 AM, Peltonen, Janne (Nokia - FI/Espoo) <
janne.pelto...@nokia.com> wrote:

>
> Hi,
>
> Why is this change needed or preferred over the current API?
>
> I would guess that many applications that use inline or asynchronous
> mode need an end marker in the SA queue so that they know when they
> can free their own per-SA state and destroy the ODP SA (i.e. when
> all events for the SA being disabled have been dequeued and processed).
>
> If odp_ipsec_sa_disable() may return synchronously, then such an
> application would need to submit an end marker event to the SA queue
> itself. The application cannot create an IPsec status event itself so
> it has to define another type of event. But the application still has
> to be able to process both the IPsec status event and its own event
> in the event handler.
>
> So, based on the above, it does not look like this change would make
> the life of an application any easier, but maybe even the opposite.
> Does it make ODP implementation significantly easier?
>
> If this change is anyway made, the API should make it clear that after
> return with retval 0 the implementation will not enqueue any further
> events for that SA to the SA queue.
>

The definition of odp_ipsec_sa_disable() is that RC = 0 means the SA is now
guaranteed idle and may be safely destroyed, so there would be no other
events to dequeue. If the implementation cannot guarantee this then it
cannot return synchronously, so I don't see any ambiguity here.

Aside to Maxim: the GitHub to mailing list path has been working well but
the mailing list to GitHub return path is not. Any idea what's needed to
enable that path?  Alternatively, Janne, you might want to reply via GitHub
to help keep the discussion in one place along with the PR.


>
> Janne
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> Github ODP bot
> > Sent: Thursday, August 10, 2017 9:00 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH API-NEXT v5 1/1] API:IPSEC: IPSEC events may
> be reported
> > synchronously.
> >
> > From: Nikhil Agarwal 
> >
> > IPSEC events may be delivered synchronous or ansynchrous
> > depending on implementation. Application will know based on
> > return value of odp_ipsec_sa_disable API.
> >
> > Signed-off-by: Nikhil Agarwal 
> > ---
> > /** Email created from pull request 109 (NikhilA-Linaro:disable_event)
> >  ** https://github.com/Linaro/odp/pull/109
> >  ** Patch: https://github.com/Linaro/odp/pull/109.patch
> >  ** Base sha: e420668cd3886f003c8bd6022e210bf08a0ee3b5
> >  ** Merge commit sha: f65d49b122f2f60a7fc9af3e0a09067dcfd369d9
> >  **/
> >  include/odp/api/spec/ipsec.h | 17 ++---
> >  1 file changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
> > index 7085bc0d..3f02635a 100644
> > --- a/include/odp/api/spec/ipsec.h
> > +++ b/include/odp/api/spec/ipsec.h
> > @@ -831,16 +831,19 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const
> odp_ipsec_sa_param_t
> > *param);
> >   * before calling disable. Packets in progress during the call may
> still match
> >   * the SA and be processed successfully.
> >   *
> > - * 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.
> > + * A return value 0 indicates that the disable request has completed
> > + * synchronously and the SA is now disabled. A return value 1 indicates
> that the
> > + * disable request has been accepted and completion will be indicated
> by an
> > + * ODP_EVENT_IPSEC_STATUS sent to the queue specified for the SA. This
> 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. In synchronous mode of operation, disable
> requests are
> > + * gauranteed to complete synchronously as there is no queue assciated
> with SA.
> >   *
> >   * @param sa  IPSEC SA to be disabled
> >   *
> > - * @retval 0  On success
> > + * @retval 0  When SA is disabled successfully.
> > + * @retval 1  Disable event will be posted on SA queue.
> >   * @retval <0 On failure
> >   *
> >   * @see odp_ipsec_sa_destroy()
>
>


[lng-odp] [PATCH v1 2/3] linux-generic: classification: update classifier enable boolean

2017-08-14 Thread Github ODP bot
From: Balasubramanian Manoharan 

removes classifier enable boolean default setting
Fixes https://bugs.linaro.org/show_bug.cgi?id=3177

Signed-off-by: Balasubramanian Manoharan 
Signed-off-by: Maxim Uvarov 
---
/** Email created from pull request 126 (muvarov:monarch_lts)
 ** https://github.com/Linaro/odp/pull/126
 ** Patch: https://github.com/Linaro/odp/pull/126.patch
 ** Base sha: 759b6d5da6617af244765983d0b8bfbb26f41890
 ** Merge commit sha: 2c095e7e4fe1c0fc39b552b84d2374988f5920ca
 **/
 platform/linux-generic/odp_classification.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index ea223bfb..05dea14e 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -331,7 +331,6 @@ int odp_pktio_default_cos_set(odp_pktio_t pktio_in, 
odp_cos_t default_cos)
}
 
entry->s.cls.default_cos = cos;
-   pktio_cls_enabled_set(entry, 1);
return 0;
 }
 
@@ -406,7 +405,6 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
l2_cos->cos[qos_table[i]] = cos;
}
}
-   pktio_cls_enabled_set(entry, 1);
UNLOCK(_cos->lock);
return 0;
 }
@@ -439,7 +437,6 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
l3_cos->cos[qos_table[i]] = cos;
}
}
-   pktio_cls_enabled_set(entry, 1);
UNLOCK(_cos->lock);
return 0;
 }



[lng-odp] [PATCH v1 3/3] validation: classification: add test case for classifier enable boolean

2017-08-14 Thread Github ODP bot
From: Balasubramanian Manoharan 

updates test suite to enable classifier in odp_pktin_queue_param_t config
adds test case for classifier enable boolean

Fixes https://bugs.linaro.org/show_bug.cgi?id=3177

Signed-off-by: Balasubramanian Manoharan 
Signed-off-by: Maxim Uvarov 
---
/** Email created from pull request 126 (muvarov:monarch_lts)
 ** https://github.com/Linaro/odp/pull/126
 ** Patch: https://github.com/Linaro/odp/pull/126.patch
 ** Base sha: 759b6d5da6617af244765983d0b8bfbb26f41890
 ** Merge commit sha: 2c095e7e4fe1c0fc39b552b84d2374988f5920ca
 **/
 test/validation/classification/classification.h|   1 +
 .../classification/odp_classification_basic.c  |   4 +-
 .../classification/odp_classification_common.c |   5 +-
 .../classification/odp_classification_test_pmr.c   | 118 +++--
 .../classification/odp_classification_tests.c  |   2 +
 .../classification/odp_classification_testsuites.h |   3 +-
 6 files changed, 119 insertions(+), 14 deletions(-)

diff --git a/test/validation/classification/classification.h 
b/test/validation/classification/classification.h
index d73c8216..629484d0 100644
--- a/test/validation/classification/classification.h
+++ b/test/validation/classification/classification.h
@@ -77,6 +77,7 @@ void classification_test_pmr_term_udp_sport(void);
 void classification_test_pmr_term_ipproto(void);
 void classification_test_pmr_term_dmac(void);
 void classification_test_pmr_term_packet_len(void);
+void classification_test_pktin_classifier_flag(void);
 
 /* test arrays: */
 extern odp_testinfo_t classification_suite_basic[];
diff --git a/test/validation/classification/odp_classification_basic.c 
b/test/validation/classification/odp_classification_basic.c
index 372377d8..9e83fc3d 100644
--- a/test/validation/classification/odp_classification_basic.c
+++ b/test/validation/classification/odp_classification_basic.c
@@ -89,7 +89,7 @@ void classification_test_create_pmr_match(void)
pkt_pool = pool_create("pkt_pool");
CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID);
 
-   pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool);
+   pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
 
configure_default_cos(pktio, _cos,
@@ -273,7 +273,7 @@ void classification_test_pmr_composite_create(void)
pkt_pool = pool_create("pkt_pool");
CU_ASSERT_FATAL(pkt_pool != ODP_POOL_INVALID);
 
-   pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool);
+   pktio = create_pktio(ODP_QUEUE_TYPE_SCHED, pkt_pool, true);
CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID);
 
configure_default_cos(pktio, _cos,
diff --git a/test/validation/classification/odp_classification_common.c 
b/test/validation/classification/odp_classification_common.c
index 7a42ac74..e0012cdc 100644
--- a/test/validation/classification/odp_classification_common.c
+++ b/test/validation/classification/odp_classification_common.c
@@ -17,7 +17,8 @@ typedef struct cls_test_packet {
odp_u32be_t seq;
 } cls_test_packet_t;
 
-odp_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool)
+odp_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t pool,
+odp_bool_t cls_enable)
 {
odp_pktio_t pktio;
odp_pktio_param_t pktio_param;
@@ -43,6 +44,8 @@ odp_pktio_t create_pktio(odp_queue_type_t q_type, odp_pool_t 
pool)
 
odp_pktin_queue_param_init(_param);
pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
+   pktin_param.classifier_enable = cls_enable;
+   pktin_param.hash_enable = false;
 
if (odp_pktin_queue_config(pktio, _param)) {
fprintf(stderr, "pktin queue config failed.\n");
diff --git a/test/validation/classification/odp_classification_test_pmr.c 
b/test/validation/classification/odp_classification_test_pmr.c
index 7c7d07ea..c9c0fe39 100644
--- a/test/validation/classification/odp_classification_test_pmr.c
+++ b/test/validation/classification/odp_classification_test_pmr.c
@@ -85,6 +85,102 @@ int classification_suite_pmr_term(void)
return retcode;
 }
 
+void classification_test_pktin_classifier_flag(void)
+{
+   odp_packet_t pkt;
+   odph_tcphdr_t *tcp;
+   uint32_t seqno;
+   uint16_t val;
+   uint16_t mask;
+   int retval;
+   odp_pktio_t pktio;
+   odp_queue_t queue;
+   odp_queue_t retqueue;
+   odp_queue_t default_queue;
+   odp_cos_t default_cos;
+   odp_pool_t default_pool;
+   odp_pmr_t pmr;
+   odp_cos_t cos;
+   char cosname[ODP_COS_NAME_LEN];
+   odp_cls_cos_param_t cls_param;
+   odp_pool_t pool;
+   odp_pool_t pool_recv;
+   odp_pmr_param_t pmr_param;
+   odph_ethhdr_t *eth;
+
+   val = CLS_DEFAULT_DPORT;
+   mask = 0x;
+   seqno = 0;
+
+   /* classifier is disabled in pktin queue configuration */
+  

[lng-odp] [PATCH v1 1/3] linux-generic: pktio: update classifier enable boolean

2017-08-14 Thread Github ODP bot
From: Balasubramanian Manoharan 

sets classifer enable based on boolean setting on odp_pktin_queue_param_t
Fixes https://bugs.linaro.org/show_bug.cgi?id=3177

Signed-off-by: Balasubramanian Manoharan 
Signed-off-by: Maxim Uvarov 
---
/** Email created from pull request 126 (muvarov:monarch_lts)
 ** https://github.com/Linaro/odp/pull/126
 ** Patch: https://github.com/Linaro/odp/pull/126.patch
 ** Base sha: 759b6d5da6617af244765983d0b8bfbb26f41890
 ** Merge commit sha: 2c095e7e4fe1c0fc39b552b84d2374988f5920ca
 **/
 platform/linux-generic/odp_packet_io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 0b9939bd..9f8bade2 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -1216,6 +1216,8 @@ int odp_pktin_queue_config(odp_pktio_t pktio,
return -1;
}
 
+   pktio_cls_enabled_set(entry, param->classifier_enable);
+
if (num_queues > capa.max_input_queues) {
ODP_DBG("pktio %s: too many input queues\n", entry->s.name);
return -1;



[lng-odp] [PATCH v1 0/3] merge classification commits from master to monarch_lts

2017-08-14 Thread Github ODP bot
merge classification commits from master to monarch_lts.

github
/** Email created from pull request 126 (muvarov:monarch_lts)
 ** https://github.com/Linaro/odp/pull/126
 ** Patch: https://github.com/Linaro/odp/pull/126.patch
 ** Base sha: 759b6d5da6617af244765983d0b8bfbb26f41890
 ** Merge commit sha: 2c095e7e4fe1c0fc39b552b84d2374988f5920ca
 **/
/github

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


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


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


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


Re: [lng-odp] [PATCH API-NEXT v5 1/1] API:IPSEC: IPSEC events may be reported synchronously.

2017-08-14 Thread Peltonen, Janne (Nokia - FI/Espoo)

Hi,

Why is this change needed or preferred over the current API?

I would guess that many applications that use inline or asynchronous
mode need an end marker in the SA queue so that they know when they
can free their own per-SA state and destroy the ODP SA (i.e. when
all events for the SA being disabled have been dequeued and processed).

If odp_ipsec_sa_disable() may return synchronously, then such an
application would need to submit an end marker event to the SA queue
itself. The application cannot create an IPsec status event itself so
it has to define another type of event. But the application still has
to be able to process both the IPsec status event and its own event
in the event handler.

So, based on the above, it does not look like this change would make
the life of an application any easier, but maybe even the opposite.
Does it make ODP implementation significantly easier?

If this change is anyway made, the API should make it clear that after
return with retval 0 the implementation will not enqueue any further
events for that SA to the SA queue.

Janne


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Github 
> ODP bot
> Sent: Thursday, August 10, 2017 9:00 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH API-NEXT v5 1/1] API:IPSEC: IPSEC events may be 
> reported
> synchronously.
> 
> From: Nikhil Agarwal 
> 
> IPSEC events may be delivered synchronous or ansynchrous
> depending on implementation. Application will know based on
> return value of odp_ipsec_sa_disable API.
> 
> Signed-off-by: Nikhil Agarwal 
> ---
> /** Email created from pull request 109 (NikhilA-Linaro:disable_event)
>  ** https://github.com/Linaro/odp/pull/109
>  ** Patch: https://github.com/Linaro/odp/pull/109.patch
>  ** Base sha: e420668cd3886f003c8bd6022e210bf08a0ee3b5
>  ** Merge commit sha: f65d49b122f2f60a7fc9af3e0a09067dcfd369d9
>  **/
>  include/odp/api/spec/ipsec.h | 17 ++---
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
> index 7085bc0d..3f02635a 100644
> --- a/include/odp/api/spec/ipsec.h
> +++ b/include/odp/api/spec/ipsec.h
> @@ -831,16 +831,19 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const 
> odp_ipsec_sa_param_t
> *param);
>   * before calling disable. Packets in progress during the call may still 
> match
>   * the SA and be processed successfully.
>   *
> - * 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.
> + * A return value 0 indicates that the disable request has completed
> + * synchronously and the SA is now disabled. A return value 1 indicates that 
> the
> + * disable request has been accepted and completion will be indicated by an
> + * ODP_EVENT_IPSEC_STATUS sent to the queue specified for the SA. This 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. In synchronous mode of operation, disable requests are
> + * gauranteed to complete synchronously as there is no queue assciated with 
> SA.
>   *
>   * @param sa  IPSEC SA to be disabled
>   *
> - * @retval 0  On success
> + * @retval 0  When SA is disabled successfully.
> + * @retval 1  Disable event will be posted on SA queue.
>   * @retval <0 On failure
>   *
>   * @see odp_ipsec_sa_destroy()



Re: [lng-odp] [PATCH v1 1/6] Initialize pktio configuration structure

2017-08-14 Thread Maxim Uvarov
this patch has to be:

linux-gen: pktio:


Re: [lng-odp] [EXT] Re: ODP1.15 buffer alignment issue

2017-08-14 Thread Maxim Uvarov
After discussion we can reword that:


/** Minimum buffer alignment in bytes. Valid values are
powers of two. Use 0 for default alignment.
Default will always be a multiple of 8. */
uint32_t align;



to:

/** Minimum buffer data alignment in bytes. Valid 
values are
powers of two. Use 0 for default alignment.
Default will always be a multiple of 8. */
uint32_t align;


Will it be more clear?

Maxim.


On 08/14/17 11:03, Peltonen, Janne (Nokia - FI/Espoo) wrote:
> Hi,
> 
> The alignment must be for the buffer start address that is
> returned by odp_buffer_addr(), since that is the only memory
> address visible in the buffer API.
> 
> The internal representation of the buffer and the associated
> metadata is not visible to the application through the API
> so the alignment of those is up to the implementation.
> 
> odp_buffer_t is an opaque handle. Therefore it does not
> make sense for an application to request any specific
> "alignment" for it. In some implementations the handle may
> actually be a pointer to an implementation specific internal
> buffer structure, but in that case its alignment is not
> an API issue.
> 
>   Janne
> 
> 
>> -Original Message-
>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of shally 
>> verma
>> Sent: Friday, August 11, 2017 8:05 AM
>> To: Maxim Uvarov 
>> Cc: Elo, Matias (Nokia - FI/Espoo) ; Petri Savolainen
>> ; lng-odp@lists.linaro.org
>> Subject: Re: [lng-odp] [EXT] Re: ODP1.15 buffer alignment issue
>>
>> just to add for some implementation Buffer == data itself (without any
>> metadata or headroom). So while you work on this, please get us
>> clarity for such implementations as well.
>>
>> On Fri, Aug 11, 2017 at 12:36 AM, Maxim Uvarov  
>> wrote:
>>> On 08/10/17 21:41, Liron Himi wrote:
 Hi,

 I think it is more than just naming replacement.
 The odp-pool API state that the alignment is for buffer alignment and not 
 for data. So
>> it seems like a bug, right?

 Here is a snipped from the API:
   /** Minimum buffer alignment in bytes. Valid values 
 are
   powers of two. Use 0 for default alignment.
   Default will always be a multiple of 8. */
   uint32_t align;
   } buf;

 Regards,
 Liron

>>>
>>>
>>> Ok, in my understanding this value comes from:
>>>
>>> typedef struct odp_pool_capability_t {
>>> .
>>>
>>> /** Buffer pool capabilities  */
>>> struct {
>>> /** Maximum buffer data alignment in bytes */
>>> uint32_t max_align;
>>>
>>>
>>> So it has to be "buffer data alignment". Please give me some time to
>>> double check with community that we all understand this api definition
>>> right.
>>>
>>> Thank you,
>>> Maxim.
>>>
>>>
 -Original Message-
 From: Maxim Uvarov [mailto:maxim.uva...@linaro.org]
 Sent: Thursday, August 10, 2017 19:45
 To: Liron Himi ; lng-odp@lists.linaro.org
 Cc: Petri Savolainen ; Elo, Matias (Nokia - 
 FI/Espoo)
>> 
 Subject: [EXT] Re: [lng-odp] ODP1.15 buffer alignment issue

 External Email

 --
 On 08/08/17 09:49, Liron Himi wrote:
> Hi,
>
> See comments inline
>
> Regards,
> Liron
>
> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> Maxim Uvarov
> Sent: Monday, August 07, 2017 23:21
> To: lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] ODP1.15 buffer alignment issue
>
> it's implementation specific.
>
> Full code is:
>
> +   offset = pool->headroom;
> +
> +   /* move to correct align */
> +   while (((uintptr_t)[offset]) % pool->align != 0)
> +   offset++;
> 
> +
> +   /* Pointer to data start (of the first segment) */
> +   buf_hdr->addr[0] = [offset];
> +   /* Store buffer into the global pool */
> +   ring_enq(ring, mask, (uint32_t)(uintptr_t)buf_hdl);
>
> If I understood idea right there should be odp specific packet header 
> with odp fields
>> which is needed to implement api but missing in hardware buffer field. Then 
>> hw buffer
>> which is aligned by default with pointer to data. Everything depends on 
>> implementation and
>> it's not mandatory.
> [L.H.] As part of the linux-generic there is a 

[lng-odp] [PATCH v1 2/2] linux-generic: packet: add branch hints for reference optimization

2017-08-14 Thread Github ODP bot
From: Bill Fischofer 

Add odp_likely() and odp_unlikely() hints on critical paths in packet
allocation / free processing to optimize reference support.

Signed-off-by: Bill Fischofer 
---
/** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt)
 ** https://github.com/Linaro/odp/pull/125
 ** Patch: https://github.com/Linaro/odp/pull/125.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: a2b797cf85fe42d302f94c7ec24cc61959e08a4e
 **/
 platform/linux-generic/odp_packet.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index f18bd4dd..a71a5926 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -444,13 +444,14 @@ static inline void free_bufs(odp_packet_hdr_t *pkt_hdr, 
int first, int num)
for (i = 0, nfree = 0; i < num; i++) {
odp_packet_hdr_t *hdr = pkt_hdr->buf_hdr.seg[first + i].hdr;
 
-   if (packet_ref_count(hdr) == 1 || packet_ref_dec(hdr) == 1) {
+   if (odp_likely(packet_ref_count(hdr) == 1 ||
+  packet_ref_dec(hdr) == 1)) {
ODP_ASSERT((packet_ref_count_set(hdr, 0), 1));
buf_hdr[nfree++] = >buf_hdr;
}
}
 
-   if (nfree > 0)
+   if (odp_likely(nfree > 0))
buffer_free_multi(buf_hdr, nfree);
 }
 
@@ -468,8 +469,8 @@ static inline odp_packet_hdr_t 
*free_segments(odp_packet_hdr_t *pkt_hdr,
for (i = 0, nfree = 0; i < num; i++) {
new_hdr = pkt_hdr->buf_hdr.seg[i].hdr;
 
-   if (packet_ref_count(new_hdr) == 1 ||
-   packet_ref_dec(new_hdr) == 1) {
+   if (odp_likely(packet_ref_count(new_hdr) == 1 ||
+  packet_ref_dec(new_hdr) == 1)) {
ODP_ASSERT((packet_ref_count_set(new_hdr, 0),
1));
buf_hdr[nfree++] = _hdr->buf_hdr;
@@ -492,7 +493,7 @@ static inline odp_packet_hdr_t 
*free_segments(odp_packet_hdr_t *pkt_hdr,
 
pkt_hdr = new_hdr;
 
-   if (nfree > 0)
+   if (odp_likely(nfree > 0))
buffer_free_multi(buf_hdr, nfree);
} else {
/* Free last 'num' bufs */
@@ -658,7 +659,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int 
num)
ref_hdr = pkt_hdr->ref_hdr;
 
/* Make sure we have enough space for this pkt's segs */
-   if (nfree + num_seg > nbufs) {
+   if (odp_unlikely(nfree + num_seg > nbufs)) {
buffer_free_multi(buf_hdr, nfree);
nfree = 0;
}
@@ -681,7 +682,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int 
num)
} while (pkt_hdr);
}
 
-   if (nfree > 0)
+   if (odp_likely(nfree > 0))
buffer_free_multi(buf_hdr, nfree);
 }
 



[lng-odp] [PATCH v1 1/2] linux-generic: packet: improve packet_init() performance

2017-08-14 Thread Github ODP bot
From: Bill Fischofer 

Streamline packet_init() performance by eliminating the redundant
initialization of the unshared_len field of the packet hdr. This field
is initialized when references are created so this processing is not
required here.

Signed-off-by: Bill Fischofer 
---
/** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt)
 ** https://github.com/Linaro/odp/pull/125
 ** Patch: https://github.com/Linaro/odp/pull/125.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: a2b797cf85fe42d302f94c7ec24cc61959e08a4e
 **/
 platform/linux-generic/include/odp_packet_internal.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index d923ee23..48c2463f 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -269,7 +269,6 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, 
uint32_t len)
pkt_hdr->input = ODP_PKTIO_INVALID;
 
/* By default packet has no references */
-   pkt_hdr->unshared_len = len;
pkt_hdr->ref_hdr = NULL;
 }
 



[lng-odp] [PATCH v1 0/2] Pktrefs opt

2017-08-14 Thread Github ODP bot
Optimizations to the zero-copy packet reference code to partially address 
issues raised in
https://bugs.linaro.org/show_bug.cgi?id=3201

github
/** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt)
 ** https://github.com/Linaro/odp/pull/125
 ** Patch: https://github.com/Linaro/odp/pull/125.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: a2b797cf85fe42d302f94c7ec24cc61959e08a4e
 **/
/github

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


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


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


[lng-odp] [Bug 3201] Performance degradation due to no-copy packet reference commits

2017-08-14 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=3201

Bill Fischofer  changed:

   What|Removed |Added

 Status|UNCONFIRMED |IN_PROGRESS
 Ever confirmed|0   |1

--- Comment #4 from Bill Fischofer  ---
PR https://github.com/Linaro/odp/pull/125 posted to address this issue, at
least in part.

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

[lng-odp] [PATCH v1 6/6] examples: generator: update odp_generator to use HW checksum capabilities

2017-08-14 Thread Github ODP bot
From: Bogdan Pricope 

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr)
 ** https://github.com/Linaro/odp/pull/124
 ** Patch: https://github.com/Linaro/odp/pull/124.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de
 **/
 example/generator/odp_generator.c | 156 ++
 1 file changed, 124 insertions(+), 32 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index f3ec43be..65471f54 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -46,6 +46,7 @@
 
 typedef struct {
odp_pktio_t pktio;
+   odp_pktio_config_t config;
odp_pktout_queue_t pktout[MAX_WORKERS];
unsigned pktout_count;
 } interface_t;
@@ -91,7 +92,16 @@ static struct {
 /** * Thread specific arguments
  */
 typedef struct {
-   odp_pktout_queue_t pktout; /**< Packet output queue to use*/
+   union {
+   struct {
+   odp_pktout_queue_t pktout; /**< Packet output queue */
+   odp_pktout_config_opt_t *pktout_cfg; /**< Packet output 
config*/
+   } tx;
+   struct {
+   interface_t *ifs; /**< Interfaces array */
+   int ifs_count; /**< Interfaces array size */
+   } rx;
+   };
odp_pool_t pool;/**< Pool for packet IO */
odp_timer_pool_t tp;/**< Timer pool handle */
odp_queue_t tq; /**< Queue for timeouts */
@@ -116,6 +126,10 @@ static args_t *args;
 /** Barrier to sync threads execution */
 static odp_barrier_t barrier;
 
+/** Packet processing function types */
+typedef odp_packet_t (*setup_pkt_ref_t)(odp_pool_t, odp_pktout_config_opt_t *);
+typedef int (*setup_pkt_t)(odp_packet_t, odp_pktout_config_opt_t *);
+
 /* helper funcs */
 static void parse_args(int argc, char *argv[], appl_args_t *appl_args);
 static void print_info(char *progname, appl_args_t *appl_args);
@@ -190,20 +204,22 @@ static int scan_ip(char *buf, unsigned int *paddr)
  * Setup array of reference packets
  *
  * @param pool Packet pool
+ * @param pktout_cfg Interface output configuration
  * @param pkt_ref_array Packet array
  * @param pkt_ref_array_size Packet array size
  * @param setup_ref Packet setup function
  * @return 0 success, -1 failed
 */
 static int setup_pkt_ref_array(odp_pool_t pool,
+  odp_pktout_config_opt_t *pktout_cfg,
   odp_packet_t *pkt_ref_array,
   int pkt_ref_array_size,
-  odp_packet_t (*setup_ref)(odp_pool_t))
+  setup_pkt_ref_t setup_ref)
 {
int i;
 
for (i = 0; i < pkt_ref_array_size; i++) {
-   pkt_ref_array[i] = (*setup_ref)(pool);
+   pkt_ref_array[i] = (*setup_ref)(pool, pktout_cfg);
if (pkt_ref_array[i] == ODP_PACKET_INVALID)
break;
}
@@ -218,21 +234,23 @@ static int setup_pkt_ref_array(odp_pool_t pool,
 /**
  * Setup array of packets
  *
+ * @param pktout_cfg Interface output configuration
  * @param pkt_ref_array Reference packet array
  * @param pkt_array Packet array
  * @param pkt_array_size Packet array size
  * @param setup_pkt Packet setup function
  * @return 0 success, -1 failed
 */
-static int setup_pkt_array(odp_packet_t *pkt_ref_array,
+static int setup_pkt_array(odp_pktout_config_opt_t *pktout_cfg,
+  odp_packet_t *pkt_ref_array,
   odp_packet_t  *pkt_array,
   int pkt_array_size,
-  int (*setup_pkt)(odp_packet_t))
+  setup_pkt_t setup_pkt)
 {
int i;
 
for (i = 0; i < pkt_array_size; i++) {
-   if ((*setup_pkt)(pkt_ref_array[i]))
+   if ((*setup_pkt)(pkt_ref_array[i], pktout_cfg))
break;
 
pkt_array[i] = odp_packet_ref_static(pkt_ref_array[i]);
@@ -252,13 +270,15 @@ static int setup_pkt_array(odp_packet_t *pkt_ref_array,
  * set up an udp packet reference
  *
  * @param pool Buffer pool to create packet in
+ * @param pktout_cfg Interface output configuration
  *
  *
  * @retval Handle of created packet
  * @retval ODP_PACKET_INVALID  Packet could not be created
  *
  */
-static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool)
+static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool,
+ odp_pktout_config_opt_t *pktout_cfg)
 {
odp_packet_t pkt;
char *buf;
@@ -302,8 +322,10 @@ static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool)
udp->src_port = odp_cpu_to_be_16(args->appl.srcport);
udp->dst_port = odp_cpu_to_be_16(args->appl.dstport);

[lng-odp] [PATCH v1 5/6] dpdk: TX - set checksum calculation offload flags

2017-08-14 Thread Github ODP bot
From: Bogdan Pricope 

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr)
 ** https://github.com/Linaro/odp/pull/124
 ** Patch: https://github.com/Linaro/odp/pull/124.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de
 **/
 platform/linux-generic/pktio/dpdk.c | 109 
 1 file changed, 109 insertions(+)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index af727ae0..1172e9e2 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -30,6 +30,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 
 #if ODP_DPDK_ZERO_COPY
@@ -426,6 +430,96 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
return (i > 0 ? i : -1);
 }
 
+static inline int packet_parse(void *l3_hdr, uint8_t *l3_proto_v4,
+  uint8_t *l4_proto)
+{
+   uint8_t l3_proto_ver = _ODP_IPV4HDR_VER(*(uint8_t *)l3_hdr);
+
+   if (l3_proto_ver == _ODP_IPV4) {
+   struct ipv4_hdr *ip = (struct ipv4_hdr *)l3_hdr;
+
+   *l3_proto_v4 = 1;
+   if (!rte_ipv4_frag_pkt_is_fragmented(ip))
+   *l4_proto = ip->next_proto_id;
+   else
+   *l4_proto = 0;
+
+   return 0;
+   } else if (l3_proto_ver == _ODP_IPV6) {
+   struct ipv6_hdr *ipv6 = (struct ipv6_hdr *)l3_hdr;
+
+   *l3_proto_v4 = 0;
+   *l4_proto = ipv6->proto;
+   return 0;
+   }
+
+   return -1;
+}
+
+static inline uint16_t phdr_csum(int ipv4, void *l3_hdr,
+uint64_t ol_flags)
+{
+   if (ipv4)
+   return rte_ipv4_phdr_cksum(l3_hdr, ol_flags);
+   else /*ipv6*/
+   return rte_ipv6_phdr_cksum(l3_hdr, ol_flags);
+}
+
+static inline int pkt_set_ol_tx(odp_pktout_config_opt_t *pktout_cfg,
+   odp_packet_hdr_t *pkt_hdr,
+   struct rte_mbuf *mbuf,
+   char *mbuf_data)
+{
+   void *l3_hdr, *l4_hdr;
+   uint8_t l3_proto_v4, l4_proto;
+   odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt;
+   packet_parser_t *pkt_p = _hdr->p;
+
+   l3_hdr = (void *)(mbuf_data + pkt_p->l3_offset);
+
+   if (packet_parse(l3_hdr, _proto_v4, _proto))
+   return 0;
+
+   ipv4_chksum_pkt = pktout_cfg->bit.ipv4_chksum && l3_proto_v4;
+   udp_chksum_pkt =  pktout_cfg->bit.udp_chksum &&
+   (l4_proto == _ODP_IPPROTO_UDP);
+   tcp_chksum_pkt = pktout_cfg->bit.tcp_chksum &&
+   (l4_proto == _ODP_IPPROTO_TCP);
+
+   if (!ipv4_chksum_pkt && !udp_chksum_pkt && !tcp_chksum_pkt)
+   return 0;
+
+   mbuf->l2_len = pkt_p->l3_offset - pkt_p->l2_offset;
+   mbuf->l3_len = pkt_p->l4_offset - pkt_p->l3_offset;
+
+   if (l3_proto_v4)
+   mbuf->ol_flags = PKT_TX_IPV4;
+   else
+   mbuf->ol_flags = PKT_TX_IPV6;
+
+   if (ipv4_chksum_pkt) {
+   mbuf->ol_flags |=  PKT_TX_IP_CKSUM;
+
+   ((struct ipv4_hdr *)l3_hdr)->hdr_checksum = 0;
+   }
+
+   l4_hdr = (void *)(mbuf_data + pkt_p->l4_offset);
+
+   if (udp_chksum_pkt) {
+   mbuf->ol_flags |= PKT_TX_UDP_CKSUM;
+
+   ((struct udp_hdr *)l4_hdr)->dgram_cksum =
+   phdr_csum(l3_proto_v4, l3_hdr, mbuf->ol_flags);
+   } else if (tcp_chksum_pkt) {
+   mbuf->ol_flags |= PKT_TX_TCP_CKSUM;
+
+   ((struct tcp_hdr *)l4_hdr)->cksum =
+   phdr_csum(l3_proto_v4, l3_hdr, mbuf->ol_flags);
+   }
+
+   return 0;
+}
+
 static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry,
  struct rte_mbuf *mbuf_table[],
  const odp_packet_t pkt_table[], uint16_t num)
@@ -434,6 +528,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry,
int i, j;
char *data;
uint16_t pkt_len;
+   odp_pktout_config_opt_t *pktout_cfg = _entry->s.config.pktout;
 
if (odp_unlikely((rte_pktmbuf_alloc_bulk(pkt_dpdk->pkt_pool,
 mbuf_table, num {
@@ -453,6 +548,11 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry,
data = rte_pktmbuf_append(mbuf_table[i], pkt_len);
 
odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data);
+
+   if (pktout_cfg->all_bits)
+   pkt_set_ol_tx(pktout_cfg,
+ odp_packet_hdr(pkt_table[i]),
+ mbuf_table[i], data);
}
return i;
 
@@ -539,6 +639,7 @@ static inline int 

[lng-odp] [PATCH v1 3/6] dpdk: enable per pktio RX IP/UDP/TCP checksum offload

2017-08-14 Thread Github ODP bot
From: Bogdan Pricope 

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr)
 ** https://github.com/Linaro/odp/pull/124
 ** Patch: https://github.com/Linaro/odp/pull/124.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de
 **/
 platform/linux-generic/pktio/dpdk.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 9b402478..a5e1d4b5 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -666,6 +666,7 @@ static int dpdk_setup_port(pktio_entry_t *pktio_entry)
int ret;
pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
struct rte_eth_rss_conf rss_conf;
+   uint16_t hw_ip_checksum = 0;
 
/* Always set some hash functions to enable DPDK RSS hash calculation */
if (pkt_dpdk->hash.all_bits == 0) {
@@ -675,12 +676,17 @@ static int dpdk_setup_port(pktio_entry_t *pktio_entry)
rss_conf_to_hash_proto(_conf, _dpdk->hash);
}
 
+   if (pktio_entry->s.config.pktin.bit.ipv4_chksum ||
+   pktio_entry->s.config.pktin.bit.udp_chksum ||
+   pktio_entry->s.config.pktin.bit.tcp_chksum)
+   hw_ip_checksum = 1;
+
struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_RSS,
.split_hdr_size = 0,
.header_split   = 0,
-   .hw_ip_checksum = 0,
+   .hw_ip_checksum = hw_ip_checksum,
.hw_vlan_filter = 0,
.hw_strip_crc   = 0,
.enable_scatter = 0,



[lng-odp] [PATCH v1 2/6] dpdk: retrieve offload capabilities

2017-08-14 Thread Github ODP bot
From: Bogdan Pricope 

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr)
 ** https://github.com/Linaro/odp/pull/124
 ** Patch: https://github.com/Linaro/odp/pull/124.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de
 **/
 platform/linux-generic/pktio/dpdk.c | 52 +
 1 file changed, 52 insertions(+)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 19310651..9b402478 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -897,6 +897,11 @@ static void dpdk_init_capability(pktio_entry_t 
*pktio_entry,
 {
pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
odp_pktio_capability_t *capa = _dpdk->capa;
+   int ptype_cnt;
+   int ptype_l3_ipv4 = 0;
+   int ptype_l4_tcp = 0;
+   int ptype_l4_udp = 0;
+   uint32_t ptype_mask = RTE_PTYPE_L3_MASK | RTE_PTYPE_L4_MASK;
 
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
memset(capa, 0, sizeof(odp_pktio_capability_t));
@@ -908,9 +913,56 @@ static void dpdk_init_capability(pktio_entry_t 
*pktio_entry,
  PKTIO_MAX_QUEUES);
capa->set_op.op.promisc_mode = 1;
 
+   ptype_cnt = rte_eth_dev_get_supported_ptypes(pkt_dpdk->port_id,
+ptype_mask, NULL, 0);
+   if (ptype_cnt > 0) {
+   uint32_t ptypes[ptype_cnt];
+   int i;
+
+   ptype_cnt = rte_eth_dev_get_supported_ptypes(pkt_dpdk->port_id,
+ptype_mask, ptypes,
+ptype_cnt);
+   for (i = 0; i < ptype_cnt; i++)
+   switch (ptypes[i]) {
+   case RTE_PTYPE_L3_IPV4:
+   case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN:
+   case RTE_PTYPE_L3_IPV4_EXT:
+   ptype_l3_ipv4 = 1;
+   break;
+   case RTE_PTYPE_L4_TCP:
+   ptype_l4_tcp = 1;
+   break;
+   case RTE_PTYPE_L4_UDP:
+   ptype_l4_udp = 1;
+   break;
+   }
+   }
+
odp_pktio_config_init(>config);
capa->config.pktin.bit.ts_all = 1;
capa->config.pktin.bit.ts_ptp = 1;
+
+   capa->config.pktin.bit.ipv4_chksum = ptype_l3_ipv4 &&
+   (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) ? 1 : 0;
+   if (capa->config.pktin.bit.ipv4_chksum)
+   capa->config.pktin.bit.drop_ipv4_err = 1;
+
+   capa->config.pktin.bit.udp_chksum = ptype_l4_udp &&
+   (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) ? 1 : 0;
+   if (capa->config.pktin.bit.udp_chksum)
+   capa->config.pktin.bit.drop_udp_err = 1;
+
+   capa->config.pktin.bit.tcp_chksum = ptype_l4_tcp &&
+   (dev_info->rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) ? 1 : 0;
+   if (capa->config.pktin.bit.tcp_chksum)
+   capa->config.pktin.bit.drop_tcp_err = 1;
+
+   capa->config.pktout.bit.ipv4_chksum =
+   (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) ? 1 : 0;
+   capa->config.pktout.bit.udp_chksum =
+   (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) ? 1 : 0;
+   capa->config.pktout.bit.tcp_chksum =
+   (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) ? 1 : 0;
 }
 
 static int dpdk_open(odp_pktio_t id ODP_UNUSED,



[lng-odp] [PATCH v1 4/6] dpdk: RX - process checksum validation offload flags

2017-08-14 Thread Github ODP bot
From: Bogdan Pricope 

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr)
 ** https://github.com/Linaro/odp/pull/124
 ** Patch: https://github.com/Linaro/odp/pull/124.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de
 **/
 platform/linux-generic/pktio/dpdk.c | 47 +
 1 file changed, 47 insertions(+)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index a5e1d4b5..af727ae0 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -301,6 +301,40 @@ static struct rte_mempool_ops ops_stack = {
 
 MEMPOOL_REGISTER_OPS(ops_stack);
 
+#define HAS_L4_PROTO(m, proto) ((m->packet_type & RTE_PTYPE_L4_MASK) == proto)
+
+static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg,
+   odp_packet_hdr_t *pkt_hdr,
+   struct rte_mbuf *mbuf)
+{
+   if (pktin_cfg->bit.ipv4_chksum &&
+   (mbuf->packet_type & RTE_PTYPE_L3_IPV4) &&
+   mbuf->ol_flags & PKT_RX_IP_CKSUM_BAD) {
+   if (pktin_cfg->bit.drop_ipv4_err)
+   return -1;
+
+   pkt_hdr->p.error_flags.ip_err = 1;
+   }
+
+   if (pktin_cfg->bit.udp_chksum &&
+   HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_UDP) &&
+   mbuf->ol_flags & PKT_RX_L4_CKSUM_BAD) {
+   if (pktin_cfg->bit.drop_udp_err)
+   return -1;
+
+   pkt_hdr->p.error_flags.udp_err = 1;
+   } else if (pktin_cfg->bit.tcp_chksum &&
+  HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_TCP)  &&
+  mbuf->ol_flags & PKT_RX_L4_CKSUM_BAD) {
+   if (pktin_cfg->bit.drop_tcp_err)
+   return -1;
+
+   pkt_hdr->p.error_flags.tcp_err = 1;
+   }
+
+   return 0;
+}
+
 static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
  odp_packet_t pkt_table[],
  struct rte_mbuf *mbuf_table[],
@@ -315,6 +349,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
int nb_pkts = 0;
int alloc_len, num;
odp_pool_t pool = pktio_entry->s.pkt_dpdk.pool;
+   odp_pktin_config_opt_t *pktin_cfg = _entry->s.config.pktin;
 
/* Allocate maximum sized packets */
alloc_len = pktio_entry->s.pkt_dpdk.data_room;
@@ -369,6 +404,12 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
 
packet_set_ts(pkt_hdr, ts);
 
+   if (pkt_set_ol_rx(pktin_cfg, pkt_hdr, mbuf)) {
+   odp_packet_free(pkt);
+   rte_pktmbuf_free(mbuf);
+   continue;
+   }
+
pkt_table[nb_pkts++] = pkt;
 
rte_pktmbuf_free(mbuf);
@@ -435,6 +476,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t 
*pktio_entry,
int i;
int nb_pkts = 0;
odp_pool_t pool = pktio_entry->s.pkt_dpdk.pool;
+   odp_pktin_config_opt_t *pktin_cfg = _entry->s.config.pktin;
 
for (i = 0; i < mbuf_num; i++) {
odp_packet_hdr_t parsed_hdr;
@@ -480,6 +522,11 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t 
*pktio_entry,
 
packet_set_ts(pkt_hdr, ts);
 
+   if (pkt_set_ol_rx(pktin_cfg, pkt_hdr, mbuf)) {
+   rte_pktmbuf_free(mbuf);
+   continue;
+   }
+
pkt_table[nb_pkts++] = pkt;
}
 



[lng-odp] [PATCH v1 1/6] Initialize pktio configuration structure

2017-08-14 Thread Github ODP bot
From: Bogdan Pricope 

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr)
 ** https://github.com/Linaro/odp/pull/124
 ** Patch: https://github.com/Linaro/odp/pull/124.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de
 **/
 platform/linux-generic/odp_packet_io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 9419adf6..70a488cc 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -150,6 +150,8 @@ static void init_pktio_entry(pktio_entry_t *entry)
init_out_queues(entry);
 
pktio_classifier_init(entry);
+
+   odp_pktio_config_init(>s.config);
 }
 
 static odp_pktio_t alloc_lock_pktio_entry(void)



[lng-odp] [PATCH v1 0/6] dpdk pktio: enable hardware checksum support

2017-08-14 Thread Github ODP bot
Add HW checksum calculation/validation support for dpdk pktio.
Note: No UDP/TCP HW checksum calculation/validation support for:

IPv4 fragments
IPv6 packets with extension headers (including fragments)

github
/** Email created from pull request 124 (bogdanPricope:dpdk_hw_csum_pr)
 ** https://github.com/Linaro/odp/pull/124
 ** Patch: https://github.com/Linaro/odp/pull/124.patch
 ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191
 ** Merge commit sha: de5ffd818401be95fd7eb3398670d1b92d27d2de
 **/
/github

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


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


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


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


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


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


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


Re: [lng-odp] [PATCH API-NEXT v1 1/1] api:pktio: Adds MTU set function.

2017-08-14 Thread Peltonen, Janne (Nokia - FI/Espoo)
Hi,

The API patch should make it more clear what MTU means in the
context of ODP packet I/O.

I think it should mean something close to this:

ODP must be able to send and receive packets up to the MTU size
succesfully. Packets larger than the MTU may get dropped or may
get received successfully (i.e. setting MTU does not guarantee
that larger packets get dropped by ODP). Trying to send packets
larger than MTU results in undefined behavior (or maybe that is
too harsh and it should be that such packets may get dropped?).

The transmit behavior with respect to MTU in case of IPsec inline
output probably requires clarification.

An exact definition of which packet (or L2 frame) bytes get counted
towards the MTU is also needed (e.g. is Ethernet FCS counted? Or
VLAN tag?)

The API should document what the default MTU value is before
the API user calls odp_pktio_mtu_set().

> >> +   /** Allow app to set MTU size */
> >> +   uint32_t mtu_set : 1;

It is not clear why this would be needed. If the underlying
implementation has a fixed MTU, then at API level ODP could
still allow the MTU to be set to any lower value. It just would
not affect anything. 

> sure, will add min_mtu_size field in odp_paktio_capability_t.

Similarly, it is not clear why min MTU is needed. If an application
says MTU of 1 byte is enough, the ODP implementation could just
accept it, even if some underlying HW MTU would be left to some
larger value.

If the MTU setting guaranteed that all packets bigger than the
MTU would be accurately dropped, then the API would probably
need the min MTU. But I do not see a real use case for such
accurate packet length based filtering and it could be a bit
of a paint for some implementations or some pktio types.

Janne


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of vamsi a
> Sent: Friday, August 11, 2017 8:22 AM
> To: Bill Fischofer 
> Cc: Mahipal Challa ; vattun...@cavium.com; Shally Verma
> ; lng-odp-forward 
> Subject: Re: [lng-odp] [PATCH API-NEXT v1 1/1] api:pktio: Adds MTU set 
> function.
> 
> On Tue, Aug 8, 2017 at 5:08 PM, Bill Fischofer 
> wrote:
> 
> >
> >
> > On Tue, Aug 8, 2017 at 2:38 AM, Vamsi Attunuru 
> > wrote:
> >
> >> Signed-off-by: Vamsi Attunuru 
> >> Signed-off-by: Shally Verma 
> >> Signed-off-by: Mahipal Challa 
> >>
> >> ---
> >>  include/odp/api/spec/packet_io.h | 21 +
> >>  1 file changed, 21 insertions(+)
> >>
> >> diff --git a/include/odp/api/spec/packet_io.h
> >> b/include/odp/api/spec/packet_io.h
> >> index d42cebf..be81c3d 100644
> >> --- a/include/odp/api/spec/packet_io.h
> >> +++ b/include/odp/api/spec/packet_io.h
> >> @@ -452,6 +452,9 @@ typedef union odp_pktio_set_op_t {
> >> struct {
> >> /** Promiscuous mode */
> >> uint32_t promisc_mode : 1;
> >> +
> >> +   /** Allow app to set MTU size */
> >> +   uint32_t mtu_set : 1;
> >> } op;
> >> /** All bits of the bit field structure.
> >>   * This field can be used to set/clear all flags, or bitwise
> >> @@ -480,6 +483,9 @@ typedef struct odp_pktio_capability_t {
> >>
> >> /** @deprecated Use enable_loop inside odp_pktin_config_t */
> >> odp_bool_t ODP_DEPRECATE(loop_supported);
> >> +
> >> +   /** Maximum MTU size supported */
> >> +   uint32_t max_mtu_size;
> >>  } odp_pktio_capability_t;
> >>
> >>  /**
> >> @@ -910,6 +916,21 @@ int odp_pktout_send(odp_pktout_queue_t queue, const
> >> odp_packet_t packets[],
> >>  uint32_t odp_pktio_mtu(odp_pktio_t pktio);
> >>
> >>  /**
> >> + * Set MTU value of a packet IO interface.
> >> + *
> >> + * Application should pass value upto max_mtu_size as indicated by
> >> + * odp_pktio_capability_t:max_mtu_size. Any value beyond max_mtu_size
> >> + * limit will result in failure. mtu value < 68 also results in failure.
> >>
> >
> > Seems like it would be better to have an explicit min_mtu_size in the
> > odp_pktio_capability() than this arbitrary note buried as a comment.
> >
> 
> sure, will add min_mtu_size field in odp_paktio_capability_t.
> 
> From the last discussion, odp_pktio_config() api was suggested instead of
> set_mtu() api, if my understanding is correct, Is the following sequence
> allowed to occur multiple times like stop pktio interface, call
> pktio_config() and start pktio interface.
> 
> >
> >
> >> + *
> >> + * @param pktio  Packet IO handle.
> >> + * @param mtuMTU value to be set.
> >> + *
> >> + * @return  0 on success
> >> + * @retval <0 on failure
> >> + */
> >> +int odp_pktio_mtu_set(odp_pktio_t pktio, uint32_t mtu);
> >> +
> >> +/**
> >>   * Enable/Disable promiscuous mode on a packet IO interface.
> >>   *
> >>   * @param[in] pktioPacket IO 

Re: [lng-odp] [EXT] Re: ODP1.15 buffer alignment issue

2017-08-14 Thread Peltonen, Janne (Nokia - FI/Espoo)
Hi,

The alignment must be for the buffer start address that is
returned by odp_buffer_addr(), since that is the only memory
address visible in the buffer API.

The internal representation of the buffer and the associated
metadata is not visible to the application through the API
so the alignment of those is up to the implementation.

odp_buffer_t is an opaque handle. Therefore it does not
make sense for an application to request any specific
"alignment" for it. In some implementations the handle may
actually be a pointer to an implementation specific internal
buffer structure, but in that case its alignment is not
an API issue.

Janne


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of shally 
> verma
> Sent: Friday, August 11, 2017 8:05 AM
> To: Maxim Uvarov 
> Cc: Elo, Matias (Nokia - FI/Espoo) ; Petri Savolainen
> ; lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [EXT] Re: ODP1.15 buffer alignment issue
> 
> just to add for some implementation Buffer == data itself (without any
> metadata or headroom). So while you work on this, please get us
> clarity for such implementations as well.
> 
> On Fri, Aug 11, 2017 at 12:36 AM, Maxim Uvarov  
> wrote:
> > On 08/10/17 21:41, Liron Himi wrote:
> >> Hi,
> >>
> >> I think it is more than just naming replacement.
> >> The odp-pool API state that the alignment is for buffer alignment and not 
> >> for data. So
> it seems like a bug, right?
> >>
> >> Here is a snipped from the API:
> >>   /** Minimum buffer alignment in bytes. Valid values 
> >> are
> >>   powers of two. Use 0 for default alignment.
> >>   Default will always be a multiple of 8. */
> >>   uint32_t align;
> >>   } buf;
> >>
> >> Regards,
> >> Liron
> >>
> >
> >
> > Ok, in my understanding this value comes from:
> >
> > typedef struct odp_pool_capability_t {
> > .
> >
> > /** Buffer pool capabilities  */
> > struct {
> > /** Maximum buffer data alignment in bytes */
> > uint32_t max_align;
> >
> >
> > So it has to be "buffer data alignment". Please give me some time to
> > double check with community that we all understand this api definition
> > right.
> >
> > Thank you,
> > Maxim.
> >
> >
> >> -Original Message-
> >> From: Maxim Uvarov [mailto:maxim.uva...@linaro.org]
> >> Sent: Thursday, August 10, 2017 19:45
> >> To: Liron Himi ; lng-odp@lists.linaro.org
> >> Cc: Petri Savolainen ; Elo, Matias (Nokia - 
> >> FI/Espoo)
> 
> >> Subject: [EXT] Re: [lng-odp] ODP1.15 buffer alignment issue
> >>
> >> External Email
> >>
> >> --
> >> On 08/08/17 09:49, Liron Himi wrote:
> >>> Hi,
> >>>
> >>> See comments inline
> >>>
> >>> Regards,
> >>> Liron
> >>>
> >>> -Original Message-
> >>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> >>> Maxim Uvarov
> >>> Sent: Monday, August 07, 2017 23:21
> >>> To: lng-odp@lists.linaro.org
> >>> Subject: Re: [lng-odp] ODP1.15 buffer alignment issue
> >>>
> >>> it's implementation specific.
> >>>
> >>> Full code is:
> >>>
> >>> +   offset = pool->headroom;
> >>> +
> >>> +   /* move to correct align */
> >>> +   while (((uintptr_t)[offset]) % pool->align != 0)
> >>> +   offset++;
> >>> 
> >>> +
> >>> +   /* Pointer to data start (of the first segment) */
> >>> +   buf_hdr->addr[0] = [offset];
> >>> +   /* Store buffer into the global pool */
> >>> +   ring_enq(ring, mask, (uint32_t)(uintptr_t)buf_hdl);
> >>>
> >>> If I understood idea right there should be odp specific packet header 
> >>> with odp fields
> which is needed to implement api but missing in hardware buffer field. Then 
> hw buffer
> which is aligned by default with pointer to data. Everything depends on 
> implementation and
> it's not mandatory.
> >>> [L.H.] As part of the linux-generic there is a 
> >>> 'ODP_CONFIG_BUFFER_ALIGN_MIN' which
> should be used for the buffer alignment.
> >>> However, the code above use this value for the data section alignment in 
> >>> the buffer
> and not the buffer address alignment.
> >>> On ODP1.11 the 'ODP_CONFIG_BUFFER_ALIGN_MIN' was used correctly for 
> >>> buffer alignment.
> >>> In order to continue we need to understand what was the real intention 
> >>> here:
> >>> 1. To make sure the data section is aligned?
> >>> 2. To make sure the buffer address is aligned? If so, there is a bug in 
> >>> this code. A
> possible fix is as follow:
> >>>  -   offset = pool->headroom;
> >>>  +   offset = 0;
> >>>
> >>>  /* move to correct