[lng-odp] [PATCH] linux-gen: barrier: Use correct memory ordering

2017-08-25 Thread Brian Brooks
Memory accesses that happen-before, in program order, a call to
odp_barrier_wait() cannot be reordered to after the call. Similarly,
memory accesses that happen-after, in program order, a call to
odp_barrier_wait() cannot be reordered to before the call.

The current implementation of barriers uses sequentially consistent
fences on either side of odp_barrier_wait().

The correct memory ordering for barriers is release upon entering
odp_barrier_wait(), to prevent reordering to after the barrier, and
acquire upon exiting odp_barrier_wait(), to prevent reordering to
before the barrier.

The measurable performance difference is negligible on weakly ordered
architectures such as ARM, so the highlight of this change is correctness.

Signed-off-by: Brian Brooks 
---
 platform/linux-generic/odp_barrier.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_barrier.c 
b/platform/linux-generic/odp_barrier.c
index 5eb354de..f70bdbf8 100644
--- a/platform/linux-generic/odp_barrier.c
+++ b/platform/linux-generic/odp_barrier.c
@@ -34,7 +34,7 @@ void odp_barrier_wait(odp_barrier_t *barrier)
uint32_t count;
int wasless;
 
-   odp_mb_full();
+   odp_mb_release();
 
count   = odp_atomic_fetch_inc_u32(>bar);
wasless = count < barrier->count;
@@ -48,5 +48,5 @@ void odp_barrier_wait(odp_barrier_t *barrier)
odp_cpu_pause();
}
 
-   odp_mb_full();
+   odp_mb_acquire();
 }
-- 
2.14.1



[lng-odp] [Linaro/odp] f637a3: configure: move configure header to include dir

2017-08-25 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/Linaro/odp
  Commit: f637a36cd2a7fc125a2d90ed5a93933007987e95
  
https://github.com/Linaro/odp/commit/f637a36cd2a7fc125a2d90ed5a93933007987e95
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-08-25 (Fri, 25 Aug 2017)

  Changed paths:
M .gitignore
M configure.ac
R helper/.gitignore

  Log Message:
  ---
  configure: move configure header to include dir

It does not make sense to have config.h just in helper tree. It should
be also used by the rest of the code.

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


  Commit: 6a9971dd8dd1cf982e7ae34ae2b62ccdadaed1c9
  
https://github.com/Linaro/odp/commit/6a9971dd8dd1cf982e7ae34ae2b62ccdadaed1c9
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-08-25 (Fri, 25 Aug 2017)

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

  Log Message:
  ---
  linux-gen: pktio: ethtool: add void pointer type casts

It makes sense to convert ifr_data to void pointer, since exact type is
implementation-defined.

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


  Commit: 26e1a355c7312e2fcc7196eb82ef49c74232035b
  
https://github.com/Linaro/odp/commit/26e1a355c7312e2fcc7196eb82ef49c74232035b
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-08-25 (Fri, 25 Aug 2017)

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

  Log Message:
  ---
  linux-gen: tm: do not redefine _GNU_SOURCE

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


  Commit: 36a7c389d3e00d4c3987236bd8229c54d812f533
  
https://github.com/Linaro/odp/commit/36a7c389d3e00d4c3987236bd8229c54d812f533
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-08-25 (Fri, 25 Aug 2017)

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

  Log Message:
  ---
  linux-gen: pktio: ethtool: don't include linux/if.h

net/if.h together with _USE_MISC (from _GNU_SOURCE) includes necessary
definitions, so no point in including platform-specific linux/if.h.

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


  Commit: 0a7686e47e40db0f5f6b862d16e8b021da23f90b
  
https://github.com/Linaro/odp/commit/0a7686e47e40db0f5f6b862d16e8b021da23f90b
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-08-25 (Fri, 25 Aug 2017)

  Changed paths:
M platform/linux-generic/_fdserver.c
M platform/linux-generic/_ishm.c
M platform/linux-generic/_ishmphy.c
M platform/linux-generic/arch/arm/odp_cpu_arch.c
M platform/linux-generic/arch/arm/odp_sysinfo_parse.c
M platform/linux-generic/arch/default/odp_cpu_arch.c
M platform/linux-generic/arch/default/odp_sysinfo_parse.c
M platform/linux-generic/arch/mips64/odp_cpu_arch.c
M platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
M platform/linux-generic/arch/powerpc/odp_cpu_arch.c
M platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
M platform/linux-generic/arch/x86/cpu_flags.c
M platform/linux-generic/arch/x86/odp_cpu_arch.c
M platform/linux-generic/arch/x86/odp_sysinfo_parse.c
M platform/linux-generic/odp_atomic.c
M platform/linux-generic/odp_barrier.c
M platform/linux-generic/odp_bitmap.c
M platform/linux-generic/odp_buffer.c
M platform/linux-generic/odp_byteorder.c
M platform/linux-generic/odp_classification.c
M platform/linux-generic/odp_cpu.c
M platform/linux-generic/odp_cpumask.c
M platform/linux-generic/odp_cpumask_task.c
M platform/linux-generic/odp_crypto.c
M platform/linux-generic/odp_errno.c
M platform/linux-generic/odp_event.c
M platform/linux-generic/odp_hash.c
M platform/linux-generic/odp_impl.c
M platform/linux-generic/odp_init.c
M platform/linux-generic/odp_name_table.c
M platform/linux-generic/odp_packet.c
M platform/linux-generic/odp_packet_flags.c
M platform/linux-generic/odp_packet_io.c
M platform/linux-generic/odp_pkt_queue.c
M platform/linux-generic/odp_pool.c
M platform/linux-generic/odp_queue.c
M platform/linux-generic/odp_queue_if.c
M platform/linux-generic/odp_rwlock.c
M platform/linux-generic/odp_rwlock_recursive.c
M platform/linux-generic/odp_schedule.c
M platform/linux-generic/odp_schedule_if.c
M platform/linux-generic/odp_schedule_iquery.c
M platform/linux-generic/odp_schedule_sp.c
M platform/linux-generic/odp_shared_memory.c
M platform/linux-generic/odp_sorted_list.c
M platform/linux-generic/odp_spinlock.c
M platform/linux-generic/odp_spinlock_recursive.c
 

[lng-odp] [PATCH v5 1/3] helper: chksum: odph_chksum returns value in network byte order

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

All examples and usecases assumed network byte order for odph_chksum()
return value. Instead of changing this convention, rather document that
odph_chksum returns value in network byte order.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 132 (lumag:fix-checksum)
 ** https://github.com/Linaro/odp/pull/132
 ** Patch: https://github.com/Linaro/odp/pull/132.patch
 ** Base sha: 8705e548f330d23173283fcca62f4afb835a6380
 ** Merge commit sha: 7ad532c561535935fe0e51774755fcd4c5bb7ebc
 **/
 helper/include/odp/helper/chksum.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/helper/include/odp/helper/chksum.h 
b/helper/include/odp/helper/chksum.h
index 520e9275..1bf950c8 100644
--- a/helper/include/odp/helper/chksum.h
+++ b/helper/include/odp/helper/chksum.h
@@ -40,7 +40,7 @@ typedef enum {
  * @param buffer calculate chksum for buffer
  * @param lenbuffer length
  *
- * @return checksum value in host cpu order
+ * @return checksum value in network order
  */
 static inline odp_u16sum_t odph_chksum(void *buffer, int len)
 {



[lng-odp] [PATCH v5 3/3] helper: chksum: verify odph_ipv4_chksum_*() functions

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

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 132 (lumag:fix-checksum)
 ** https://github.com/Linaro/odp/pull/132
 ** Patch: https://github.com/Linaro/odp/pull/132.patch
 ** Base sha: 8705e548f330d23173283fcca62f4afb835a6380
 ** Merge commit sha: 7ad532c561535935fe0e51774755fcd4c5bb7ebc
 **/
 helper/test/chksum.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/helper/test/chksum.c b/helper/test/chksum.c
index 1beae47f..4a957c32 100644
--- a/helper/test/chksum.c
+++ b/helper/test/chksum.c
@@ -108,9 +108,17 @@ int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED)
   ODPH_IPV4HDR_LEN);
ip->proto = ODPH_IPPROTO_UDP;
ip->id = odp_cpu_to_be_16(1);
-   ip->chksum = 0;
odp_packet_has_ipv4_set(test_packet, 1);
-   odph_ipv4_csum_update(test_packet);
+   if (odph_ipv4_csum_update(test_packet) < 0)
+   status = -1;
+
+   if (!odph_ipv4_csum_valid(test_packet))
+   status = -1;
+
+   printf("IP chksum = 0x%x\n", odp_be_to_cpu_16(ip->chksum));
+
+   if (odp_be_to_cpu_16(ip->chksum) != 0x3965)
+   status = -1;
 
/* udp */
odp_packet_l4_offset_set(test_packet, ODPH_ETHHDR_LEN



[lng-odp] [PATCH v5 2/3] helper: ip: correct ipv4 header checksum calculation

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

Current code for IPv4 header checksum calculation assumes that packet
data is aligned on 2-byte boundary, that there are no optional headers,
etc. Rewrite checksumming code to properly copy & process headers.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 132 (lumag:fix-checksum)
 ** https://github.com/Linaro/odp/pull/132
 ** Patch: https://github.com/Linaro/odp/pull/132.patch
 ** Base sha: 8705e548f330d23173283fcca62f4afb835a6380
 ** Merge commit sha: 7ad532c561535935fe0e51774755fcd4c5bb7ebc
 **/
 helper/include/odp/helper/ip.h | 75 +++---
 .../api/classification/odp_classification_common.c |  3 +-
 .../classification/odp_classification_test_pmr.c   |  2 +-
 .../api/classification/odp_classification_tests.c  |  9 +--
 4 files changed, 58 insertions(+), 31 deletions(-)

diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h
index 91776fad..e0d5c3bf 100644
--- a/helper/include/odp/helper/ip.h
+++ b/helper/include/odp/helper/ip.h
@@ -74,6 +74,9 @@ extern "C" {
 /** @internal Returns true if IPv4 packet is a fragment */
 #define ODPH_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff)
 
+/** @internal Checksum offset in IPv4 header */
+#define ODPH_IPV4HDR_CSUM_OFFSET   10
+
 /** IPv4 header */
 typedef struct ODP_PACKED {
uint8_tver_ihl; /**< Version / Header length */
@@ -92,6 +95,28 @@ typedef struct ODP_PACKED {
 ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == ODPH_IPV4HDR_LEN,
  "ODPH_IPV4HDR_T__SIZE_ERROR");
 
+static inline int odph_ipv4_csum(odp_packet_t pkt,
+uint32_t offset,
+odph_ipv4hdr_t *ip,
+odp_u16sum_t *chksum)
+{
+   int nleft = ODPH_IPV4HDR_IHL(ip->ver_ihl) * 4;
+   uint16_t buf[nleft / 2];
+   int res;
+
+   ip->chksum = 0;
+   memcpy(buf, ip, sizeof(*ip));
+   res = odp_packet_copy_to_mem(pkt, offset + sizeof(*ip),
+nleft - sizeof(*ip),
+buf + sizeof(*ip) / 2);
+   if (odp_unlikely(res < 0))
+   return res;
+
+   *chksum = odph_chksum(buf, nleft);
+
+   return 0;
+}
+
 /**
  * Check if IPv4 checksum is valid
  *
@@ -102,11 +127,9 @@ ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == 
ODPH_IPV4HDR_LEN,
 static inline int odph_ipv4_csum_valid(odp_packet_t pkt)
 {
uint32_t offset;
-   odp_u16be_t res = 0;
-   uint16_t *w;
-   int nleft = sizeof(odph_ipv4hdr_t);
+   int res;
odph_ipv4hdr_t ip;
-   odp_u16be_t chksum;
+   odp_u16sum_t chksum, cur_chksum;
 
offset = odp_packet_l3_offset(pkt);
if (offset == ODP_PACKET_OFFSET_INVALID)
@@ -114,37 +137,45 @@ static inline int odph_ipv4_csum_valid(odp_packet_t pkt)
 
odp_packet_copy_to_mem(pkt, offset, sizeof(odph_ipv4hdr_t), );
 
-   w = (uint16_t *)(void *)
chksum = ip.chksum;
-   ip.chksum = 0x0;
 
-   res = odph_chksum(w, nleft);
-   return (res == chksum) ? 1 : 0;
+   res = odph_ipv4_csum(pkt, offset, , _chksum);
+   if (odp_unlikely(res < 0))
+   return 0;
+
+   return (cur_chksum == chksum) ? 1 : 0;
 }
 
 /**
  * Calculate and fill in IPv4 checksum
  *
- * @note when using this api to populate data destined for the wire
- * odp_cpu_to_be_16() can be used to remove sparse warnings
- *
  * @param pkt  ODP packet
  *
- * @return IPv4 checksum in host cpu order, or 0 on failure
+ * @retval 0 on success
+ * @retval <0 on failure
  */
-static inline odp_u16sum_t odph_ipv4_csum_update(odp_packet_t pkt)
+static inline int odph_ipv4_csum_update(odp_packet_t pkt)
 {
-   uint16_t *w;
-   odph_ipv4hdr_t *ip;
-   int nleft = sizeof(odph_ipv4hdr_t);
+   uint32_t offset;
+   odph_ipv4hdr_t ip;
+   odp_u16sum_t chksum;
+   int res;
 
-   ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
-   if (ip == NULL)
-   return 0;
+   offset = odp_packet_l3_offset(pkt);
+   if (offset == ODP_PACKET_OFFSET_INVALID)
+   return -1;
+
+   res = odp_packet_copy_to_mem(pkt, offset, sizeof(ip), );
+   if (odp_unlikely(res < 0))
+   return res;
+
+   res = odph_ipv4_csum(pkt, offset, , );
+   if (odp_unlikely(res < 0))
+   return res;
 
-   w = (uint16_t *)(void *)ip;
-   ip->chksum = odph_chksum(w, nleft);
-   return ip->chksum;
+   return odp_packet_copy_from_mem(pkt,
+   offset + ODPH_IPV4HDR_CSUM_OFFSET,
+   2, );
 }
 
 /** IPv6 version */
diff --git 
a/test/common_plat/validation/api/classification/odp_classification_common.c 
b/test/common_plat/validation/api/classification/odp_classification_common.c
index de8a9327..e4c49648 100644

[lng-odp] [PATCH v5 0/3] helper: ip: correct ipv4 header checksum calculation

2017-08-25 Thread Github ODP bot
Current code for IPv4 header checksum calculation assumes that packet
data is aligned on 2-byte boundary, that there are no optional headers,
etc. Rewrite checksumming code to properly copy & process headers.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsoleni...@linaro.org

github
/** Email created from pull request 132 (lumag:fix-checksum)
 ** https://github.com/Linaro/odp/pull/132
 ** Patch: https://github.com/Linaro/odp/pull/132.patch
 ** Base sha: 8705e548f330d23173283fcca62f4afb835a6380
 ** Merge commit sha: 7ad532c561535935fe0e51774755fcd4c5bb7ebc
 **/
/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, 157 lines checked


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


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


[lng-odp] v1.11.0.1_monarch was tagged

2017-08-25 Thread Maxim Uvarov
Hello,

update for Monarch release was published under v1.11.0.1 tag:

https://github.com/Linaro/odp/releases/tag/v1.11.0.1_monarch

Please find changes in it's changelog:
https://github.com/Linaro/odp/blob/monarch_lts/CHANGELOG

Best regards,
Maxim.


[lng-odp] [PATCH CLOUD-DEV v1 1/2] linux-gen: buffer: apply buffer framework and create subsystem

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

Signed-off-by: Kevin Wang 
---
/** Email created from pull request 145 (kevinwangsk:cloud_dev_shadow)
 ** https://github.com/Linaro/odp/pull/145
 ** Patch: https://github.com/Linaro/odp/pull/145.patch
 ** Base sha: 0242ecfa64a663b7584054edcf02a8f9913391d6
 ** Merge commit sha: 60587b8ceb232c1d2a8a223e3d4ec0eb1d71ac58
 **/
 platform/linux-generic/Makefile.am |  2 +
 platform/linux-generic/buffer/subsystem.c  | 17 ++
 .../linux-generic/include/odp_buffer_subsystem.h   | 60 ++
 3 files changed, 79 insertions(+)
 create mode 100644 platform/linux-generic/buffer/subsystem.c
 create mode 100644 platform/linux-generic/include/odp_buffer_subsystem.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 36d9290c..e904046e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -171,6 +171,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_bitmap_internal.h \
  ${srcdir}/include/odp_bitset.h \
  ${srcdir}/include/odp_buffer_internal.h \
+ ${srcdir}/include/odp_buffer_subsystem.h \
  ${srcdir}/include/odp_classification_datamodel.h \
  ${srcdir}/include/odp_classification_inlines.h \
  ${srcdir}/include/odp_classification_internal.h \
@@ -242,6 +243,7 @@ __LIB__libodp_linux_la_SOURCES = \
   odp_barrier.c \
   odp_bitmap.c \
   odp_buffer.c \
+  buffer/subsystem.c \
   odp_byteorder.c \
   odp_classification.c \
   odp_cpu.c \
diff --git a/platform/linux-generic/buffer/subsystem.c 
b/platform/linux-generic/buffer/subsystem.c
new file mode 100644
index ..96ddb012
--- /dev/null
+++ b/platform/linux-generic/buffer/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(buffer, "memory buffer public APIs", SUBSYSTEM_VERSION);
+
+ODP_SUBSYSTEM_CONSTRUCTOR(buffer)
+{
+   odp_subsystem_constructor(buffer);
+}
+
diff --git a/platform/linux-generic/include/odp_buffer_subsystem.h 
b/platform/linux-generic/include/odp_buffer_subsystem.h
new file mode 100644
index ..60f8b646
--- /dev/null
+++ b/platform/linux-generic/include/odp_buffer_subsystem.h
@@ -0,0 +1,60 @@
+/* Copyright (c) 2017, ARM Limited. All rights reserved.
+ *
+ * Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_BUFFER_SUBSYSTEM_H_
+#define ODP_BUFFER_SUBSYSTEM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/* ODP buffer public APIs subsystem */
+ODP_SUBSYSTEM_DECLARE(buffer);
+
+/* Subsystem APIs declarations */
+ODP_SUBSYSTEM_API(buffer, odp_buffer_t, buffer_from_event, odp_event_t ev);
+ODP_SUBSYSTEM_API(buffer, odp_event_t, buffer_to_event, odp_buffer_t buf);
+ODP_SUBSYSTEM_API(buffer, void *, buffer_addr, odp_buffer_t buf);
+ODP_SUBSYSTEM_API(buffer, uint32_t, buffer_size, odp_buffer_t buf);
+ODP_SUBSYSTEM_API(buffer, int, buffer_is_valid, odp_buffer_t buf);
+ODP_SUBSYSTEM_API(buffer, odp_pool_t, buffer_pool, odp_buffer_t buf);
+ODP_SUBSYSTEM_API(buffer, odp_buffer_t, buffer_alloc, odp_pool_t pool_hdl);
+ODP_SUBSYSTEM_API(buffer, int, buffer_alloc_multi, odp_pool_t pool_hdl,
+ odp_buffer_t buf[], int num);
+ODP_SUBSYSTEM_API(buffer, void, buffer_free, odp_buffer_t buf);
+ODP_SUBSYSTEM_API(buffer, void, buffer_free_multi,
+ const odp_buffer_t buf[], int num);
+ODP_SUBSYSTEM_API(buffer, void, buffer_print, odp_buffer_t buf);
+ODP_SUBSYSTEM_API(buffer, uint64_t, buffer_to_u64, odp_buffer_t hdl);
+
+typedef ODP_MODULE_CLASS(buffer) {
+   odp_module_base_t base;
+
+   odp_api_proto(buffer, buffer_from_event) buffer_from_event;
+   odp_api_proto(buffer, buffer_to_event) buffer_to_event;
+   odp_api_proto(buffer, buffer_addr) buffer_addr;
+   odp_api_proto(buffer, buffer_alloc_multi) buffer_alloc_multi;
+   odp_api_proto(buffer, buffer_free_multi) buffer_free_multi;
+   odp_api_proto(buffer, buffer_alloc) buffer_alloc;
+   odp_api_proto(buffer, buffer_free) buffer_free;
+   odp_api_proto(buffer, buffer_size) buffer_size;
+   odp_api_proto(buffer, buffer_is_valid) buffer_is_valid;
+   odp_api_proto(buffer, buffer_pool) buffer_pool;
+   odp_api_proto(buffer, buffer_print) buffer_print;
+   odp_api_proto(buffer, buffer_to_u64) buffer_to_u64;
+} odp_buffer_module_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+



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

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

Signed-off-by: Kevin Wang 
---
/** Email created from pull request 145 (kevinwangsk:cloud_dev_shadow)
 ** https://github.com/Linaro/odp/pull/145
 ** Patch: https://github.com/Linaro/odp/pull/145.patch
 ** Base sha: 0242ecfa64a663b7584054edcf02a8f9913391d6
 ** Merge commit sha: 60587b8ceb232c1d2a8a223e3d4ec0eb1d71ac58
 **/
 platform/linux-generic/Makefile.am |   3 +-
 .../{odp_buffer.c => buffer/generic.c} |  67 ++
 platform/linux-generic/buffer/subsystem.c  | 103 -
 .../linux-generic/include/odp_buffer_subsystem.h   |   2 +
 4 files changed, 154 insertions(+), 21 deletions(-)
 rename platform/linux-generic/{odp_buffer.c => buffer/generic.c} (76%)

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index e904046e..3e3e0c22 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -242,7 +242,7 @@ __LIB__libodp_linux_la_SOURCES = \
   odp_atomic.c \
   odp_barrier.c \
   odp_bitmap.c \
-  odp_buffer.c \
+  buffer/generic.c \
   buffer/subsystem.c \
   odp_byteorder.c \
   odp_classification.c \
@@ -331,6 +331,7 @@ __LIB__libodp_linux_la_SOURCES += pktio/pcap.c
 endif
 
 pool/generic.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE
+buffer/generic.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE
 
 # Build modular framework into odp-linux library
 modularframeworkdir = $(top_srcdir)/frameworks/modular
diff --git a/platform/linux-generic/odp_buffer.c 
b/platform/linux-generic/buffer/generic.c
similarity index 76%
rename from platform/linux-generic/odp_buffer.c
rename to platform/linux-generic/buffer/generic.c
index b7ea88e6..c896e3d0 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/buffer/generic.c
@@ -9,29 +9,30 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 
-odp_buffer_t odp_buffer_from_event(odp_event_t ev)
+static odp_buffer_t generic_buffer_from_event(odp_event_t ev)
 {
return (odp_buffer_t)ev;
 }
 
-odp_event_t odp_buffer_to_event(odp_buffer_t buf)
+static odp_event_t generic_buffer_to_event(odp_buffer_t buf)
 {
return (odp_event_t)buf;
 }
 
-void *odp_buffer_addr(odp_buffer_t buf)
+static void *generic_buffer_addr(odp_buffer_t buf)
 {
odp_buffer_hdr_t *hdr = buf_hdl_to_hdr(buf);
 
return hdr->seg[0].data;
 }
 
-uint32_t odp_buffer_size(odp_buffer_t buf)
+static uint32_t generic_buffer_size(odp_buffer_t buf)
 {
odp_buffer_hdr_t *hdr = buf_hdl_to_hdr(buf);
 
@@ -52,34 +53,34 @@ int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t 
buf)
hdr = buf_hdl_to_hdr(buf);
pool = hdr->pool_ptr;
 
-   len += snprintf([len], n-len,
+   len += snprintf([len], n - len,
"Buffer\n");
-   len += snprintf([len], n-len,
+   len += snprintf([len], n - len,
"  pool %" PRIu64 "\n",
odp_pool_to_u64(pool->pool_hdl));
-   len += snprintf([len], n-len,
+   len += snprintf([len], n - len,
"  addr %p\n",  hdr->seg[0].data);
-   len += snprintf([len], n-len,
+   len += snprintf([len], n - len,
"  size %" PRIu32 "\n", hdr->size);
-   len += snprintf([len], n-len,
+   len += snprintf([len], n - len,
"  type %i\n",  hdr->type);
 
return len;
 }
 
-void odp_buffer_print(odp_buffer_t buf)
+static void generic_buffer_print(odp_buffer_t buf)
 {
int max_len = 512;
char str[max_len];
int len;
 
-   len = odp_buffer_snprint(str, max_len-1, buf);
+   len = odp_buffer_snprint(str, max_len - 1, buf);
str[len] = 0;
 
ODP_PRINT("\n%s\n", str);
 }
 
-uint64_t odp_buffer_to_u64(odp_buffer_t hdl)
+static uint64_t generic_buffer_to_u64(odp_buffer_t hdl)
 {
return _odp_pri(hdl);
 }
@@ -265,7 +266,7 @@ void buffer_free_multi(odp_buffer_hdr_t *buf_hdr[], int 
num_total)
}
 }
 
-odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
+static odp_buffer_t generic_buffer_alloc(odp_pool_t pool_hdl)
 {
odp_buffer_t buf;
pool_t *pool;
@@ -282,7 +283,8 @@ odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
return ODP_BUFFER_INVALID;
 }
 
-int odp_buffer_alloc_multi(odp_pool_t pool_hdl, odp_buffer_t buf[], int num)
+static int generic_buffer_alloc_multi(odp_pool_t pool_hdl,
+ odp_buffer_t buf[], int num)
 {
pool_t *pool;
 
@@ -293,24 +295,24 @@ int odp_buffer_alloc_multi(odp_pool_t pool_hdl, 
odp_buffer_t buf[], int num)
return buffer_alloc_multi(pool, (odp_buffer_hdr_t **)buf, num);
 }
 
-void 

[lng-odp] [PATCH CLOUD-DEV v1 0/2] linux-gen: buffer: move buffer to modular framework

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

github
/** Email created from pull request 145 (kevinwangsk:cloud_dev_shadow)
 ** https://github.com/Linaro/odp/pull/145
 ** Patch: https://github.com/Linaro/odp/pull/145.patch
 ** Base sha: 0242ecfa64a663b7584054edcf02a8f9913391d6
 ** Merge commit sha: 60587b8ceb232c1d2a8a223e3d4ec0eb1d71ac58
 **/
/github

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


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


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