Re: [lng-odp] [API-NEXT PATCHv8 0/4] Egress Traffic Manager

2015-11-11 Thread Maxim Uvarov

Bill, can you please update that TM patches on top of new ordered queues?

Maxim.
On 11/05/2015 17:13, Alexandru Badicioiu wrote:

In fact the definition is here :

https://wiki.linaro.org/LEG/Engineering/OPTIM/CRC

On 5 November 2015 at 16:06, Bill Fischofer > wrote:


Changes in v8
- add ARM definition for __crc32w() function (from Alex)

Changes in v7 (review comments by Maxim)
- Correct architecture ifdefs (use of arch dir in later patch)
- Correct doxygen for queue types
- Change internal APIs that use odp_ prefix to use _odp prefix
- Rebase to latest api-next

Changes in v6
- Move documentation of packet colors to main API file
- Add ODP prefix to odp_tm_egress_kind_t enums

Changes in v5
- Add include file odp_traffic_mngr_internal.h
- Add support for odp_tm_enq() from packets originating from
ordered queues

Changes in v4
- Incorporate API changes suggested by Petri

Changes in v3
- Fix checkpatch errors (Bill)

Changes in v2
- Full patch submission (Barry)

Barry Spinney (4):
  api: tm: add tm API definitions
  linux-generic: tm: implement traffic manager
  linux-generic: tm: add tm to build
  example: tm: traffic manager example

configure.ac 
 |1 +

 example/Makefile.am| 2 +-
 example/traffic_mgmt/.gitignore| 1 +
 example/traffic_mgmt/Makefile.am   | 9 +
 example/traffic_mgmt/odp_traffic_mgmt.c| 781 ++
 include/odp.h  | 1 +
 include/odp/api/packet.h   |  69 +
 include/odp/api/traffic_mngr.h | 1611 +++
 platform/linux-generic/Makefile.am |  13 +
 .../linux-generic/include/odp/plat/packet_types.h  |  11 +
 .../linux-generic/include/odp/plat/queue_types.h   | 7 +
 .../include/odp/plat/traffic_mngr_types.h  | 185 ++
 platform/linux-generic/include/odp/traffic_mngr.h  |  35 +
 platform/linux-generic/include/odp_internal.h  | 2 +
 .../include/odp_name_table_internal.h  |  61 +
 .../linux-generic/include/odp_packet_internal.h| 5 +
 .../linux-generic/include/odp_pkt_queue_internal.h |  62 +
 .../linux-generic/include/odp_queue_internal.h | 6 +
 .../include/odp_sorted_list_internal.h |  78 +
 .../include/odp_timer_wheel_internal.h |  68 +
 .../include/odp_traffic_mngr_internal.h| 324 +++
 platform/linux-generic/odp_init.c  | 5 +
 platform/linux-generic/odp_name_table.c| 1365 ++
 platform/linux-generic/odp_packet_flags.c  |  46 +-
 platform/linux-generic/odp_pkt_queue.c | 379 +++
 platform/linux-generic/odp_queue.c |  59 +
 platform/linux-generic/odp_sorted_list.c   | 271 ++
 platform/linux-generic/odp_timer_wheel.c   | 907 +++
 platform/linux-generic/odp_traffic_mngr.c  | 2799

 29 files changed, 9161 insertions(+), 2 deletions(-)
 create mode 100644 example/traffic_mgmt/.gitignore
 create mode 100644 example/traffic_mgmt/Makefile.am
 create mode 100644 example/traffic_mgmt/odp_traffic_mgmt.c
 create mode 100644 include/odp/api/traffic_mngr.h
 create mode 100644
platform/linux-generic/include/odp/plat/traffic_mngr_types.h
 create mode 100644 platform/linux-generic/include/odp/traffic_mngr.h
 create mode 100644
platform/linux-generic/include/odp_name_table_internal.h
 create mode 100644
platform/linux-generic/include/odp_pkt_queue_internal.h
 create mode 100644
platform/linux-generic/include/odp_sorted_list_internal.h
 create mode 100644
platform/linux-generic/include/odp_timer_wheel_internal.h
 create mode 100644
platform/linux-generic/include/odp_traffic_mngr_internal.h
 create mode 100644 platform/linux-generic/odp_name_table.c
 create mode 100644 platform/linux-generic/odp_pkt_queue.c
 create mode 100644 platform/linux-generic/odp_sorted_list.c
 create mode 100644 platform/linux-generic/odp_timer_wheel.c
 create mode 100644 platform/linux-generic/odp_traffic_mngr.c

--
2.1.4

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




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


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


Re: [lng-odp] [API-NEXT PATCH 1/3] api: config: add odp_config_threads() API

2015-11-11 Thread Bill Fischofer
See the commit msg in part 3 for the rationale behind this patch.

On Tuesday, November 10, 2015, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> There's already API for this:
>
> /**
>  * Maximum thread count
>  *
>  * Returns the maximum thread count, which is a constant value and set in
>  * ODP initialization phase.
>  *
>  * @return Maximum thread count
>  */
> int odp_thread_count_max(void);
>
>
> Also new #define ODP_CONFIG_THREADS should not be added.
>
> -Petri
>
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org ]
> On Behalf Of
> > EXT Bill Fischofer
> > Sent: Wednesday, November 11, 2015 3:43 AM
> > To: lng-odp@lists.linaro.org 
> > Subject: [lng-odp] [API-NEXT PATCH 1/3] api: config: add
> > odp_config_threads() API
> >
> > Signed-off-by: Bill Fischofer >
> > ---
> >  include/odp/api/config.h | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/include/odp/api/config.h b/include/odp/api/config.h
> > index c9879d6..beb69d3 100644
> > --- a/include/odp/api/config.h
> > +++ b/include/odp/api/config.h
> > @@ -32,6 +32,12 @@ extern "C" {
> >   */
> >
> >  /**
> > + * Maximum number of threads
> > + * @return The maximum thread count supported by this platform
> > + */
> > +int odp_config_threads(void);
> > +
> > +/**
> >   * Maximum number of pools
> >   * @return The maximum number of pools supported by this platform
> >   */
> > --
> > 2.1.4
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org 
> > https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1890] socket pktios drop all packets on tx

2015-11-11 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1890

--- Comment #3 from Maxim Uvarov  ---
We run odp_l2fwd in make check also. It will be good to add some case there to
capture such fails.

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1873] odp process-mode is broken

2015-11-11 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1873

--- Comment #4 from Maxim Uvarov  ---
Carl, we agreed to apply IPC patches but to add some readme with description
and notes about limitations. I will add and resend patches.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] Runtime inlining

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


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> EXT Nicolas Morey-Chaisemartin
> Sent: Tuesday, November 10, 2015 5:13 PM
> To: Zoltan Kiss; linaro-toolch...@lists.linaro.org
> Cc: lng-odp
> Subject: Re: [lng-odp] Runtime inlining
> 
> As I said in the call last week, the problem is wider than that.
> 
> ODP specifies a lot of types but not their sizes, a lot of
> enums/defines (things like ODP_PKTIO_INVALID) but not their value
> either.
> For our port a lot of those values were changed for
> performance/implementation reason. So I'm not even compatible between
> one version of our ODP port and another one.
> 
> The only way I can see to solve this is for ODP to fix the size of all
> these types.
> Default/Invalid values are not that easy, as a pointer would have a
> completely different behaviour from structs/bitfields
> 
> Nicolas
> 

Type sizes do not need to be fixed in general, but only when an application is 
build for binary compatibility (the use case we are talking here). Binary 
compatibility and thus the fixed type sizes are defined per ISA.

We can e.g. define a configure target (for our reference implementation == 
linux-generic) "--binary-compatible=armv8.x" or "--binary-compatible=x86_64". 
When you build your application with that option, "platform dependent" types 
and constants would be fixed to pre-defined values specified in (new) ODP API 
arch files.

So instead of building against 
odp/platform/linux-generic/include/odp/plat/queue_types.h ...

typedef ODP_HANDLE_T(odp_queue_t);
#define ODP_QUEUE_INVALID  _odp_cast_scalar(odp_queue_t, 0)
#define ODP_QUEUE_NAME_LEN 32


... you'd build against odp/arch/armv8.x/include/odp/queue_types.h ...

typedef uintptr_t odp_queue_t;
#define ODP_QUEUE_INVALID  ((uintptr_t)0)
#define ODP_QUEUE_NAME_LEN 64


... or odp/arch/x86_64/include/odp/queue_types.h

typedef uint64_t odp_queue_t;
#define ODP_QUEUE_INVALID  ((uint64_t)0x)
#define ODP_QUEUE_NAME_LEN 32


For highest performance on a fixed target platform, you'd still build against 
the platform directly

odp/platform//include/odp/plat/queue_types.h

typedef xyz_queue_desc_t * odp_queue_t;
#define ODP_QUEUE_INVALID  ((xyz_queue_desc_t *)0xdeadbeef)
#define ODP_QUEUE_NAME_LEN 20


-Petri




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


Re: [lng-odp] [PATCH] linux-generic: netmap: replace nm_dispatch() helper

2015-11-11 Thread Stuart Haslam
On Fri, Nov 06, 2015 at 12:56:37PM +0200, Matias Elo wrote:
> Implement nm_dispatch() functionality in ODP code to
> optimize performance and enable future feature additions.
> 
> Signed-off-by: Matias Elo 

Reviewed-and-Tested-by: Stuart Haslam 

> ---
>  platform/linux-generic/pktio/netmap.c | 94 
> +++
>  1 file changed, 61 insertions(+), 33 deletions(-)
> 
> diff --git a/platform/linux-generic/pktio/netmap.c 
> b/platform/linux-generic/pktio/netmap.c
> index 794c82e..d064323 100644
> --- a/platform/linux-generic/pktio/netmap.c
> +++ b/platform/linux-generic/pktio/netmap.c
> @@ -31,12 +31,6 @@ static struct nm_desc mmap_desc;   /** Used to store the 
> mmap address;
>  #define NM_OPEN_RETRIES 5
>  #define NM_INJECT_RETRIES 10
>  
> -struct dispatch_args {
> - odp_packet_t *pkt_table;
> - unsigned nb_rx;
> - pktio_entry_t *pktio_entry;
> -};
> -
>  static int netmap_do_ioctl(pktio_entry_t *pktio_entry, unsigned long cmd,
>  int subcmd)
>  {
> @@ -187,64 +181,98 @@ error:
>   return -1;
>  }
>  
> -static void netmap_recv_cb(u_char *arg, const struct nm_pkthdr *hdr,
> -const u_char *buf)
> +/**
> + * Create ODP packet from netmap packet
> + *
> + * @param pktio_entryPacket IO handle
> + * @param pkt_outStorage for new ODP packet handle
> + * @param bufNetmap buffer address
> + * @param lenNetmap buffer length
> + *
> + * @retval 0 on success
> + * @retval <0 on failure
> + */
> +static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry,
> + odp_packet_t *pkt_out, const char *buf,
> + uint16_t len)
>  {
> - struct dispatch_args *args = (struct dispatch_args *)(void *)arg;
> - pkt_netmap_t *pkt_nm = >pktio_entry->s.pkt_nm;
>   odp_packet_t pkt;
>   odp_packet_hdr_t *pkt_hdr;
> - size_t frame_len = (size_t)hdr->len;
>  
> - if (odp_unlikely(frame_len > pkt_nm->max_frame_len)) {
> - ODP_ERR("RX: frame too big %u %lu!\n", (unsigned)frame_len,
> - pkt_nm->max_frame_len);
> - return;
> + if (odp_unlikely(len > pktio_entry->s.pkt_nm.max_frame_len)) {
> + ODP_ERR("RX: frame too big %" PRIu16 " %zu!\n", len,
> + pktio_entry->s.pkt_nm.max_frame_len);
> + return -1;
>   }
>  
> - if (odp_unlikely(frame_len < ODPH_ETH_LEN_MIN)) {
> - ODP_ERR("RX: Frame truncated: %u\n", (unsigned)frame_len);
> - return;
> + if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) {
> + ODP_ERR("RX: Frame truncated: %" PRIu16 "\n", len);
> + return -1;
>   }
>  
> - pkt = packet_alloc(pkt_nm->pool, frame_len, 1);
> + pkt = packet_alloc(pktio_entry->s.pkt_nm.pool, len, 1);
>   if (pkt == ODP_PACKET_INVALID)
> - return;
> + return -1;
>  
>   pkt_hdr = odp_packet_hdr(pkt);
>  
>   /* For now copy the data in the mbuf,
>  worry about zero-copy later */
> - if (odp_packet_copydata_in(pkt, 0, frame_len, buf) != 0) {
> + if (odp_packet_copydata_in(pkt, 0, len, buf) != 0) {
>   odp_packet_free(pkt);
> - return;
> + return -1;
>   }
> -
>   packet_parse_l2(pkt_hdr);
>  
> - args->pkt_table[args->nb_rx++] = pkt;
> + *pkt_out = pkt;
> + return 0;
>  }
>  
>  static int netmap_recv(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[],
>  unsigned num)
>  {
> - struct dispatch_args args;
> - struct nm_desc *nm_desc = pktio_entry->s.pkt_nm.rx_desc;
> + struct netmap_ring *ring;
> + struct nm_desc *desc = pktio_entry->s.pkt_nm.rx_desc;
>   struct pollfd polld;
> + char *buf;
> + int i;
> + int num_rings = desc->last_rx_ring - desc->first_rx_ring + 1;
> + int ring_id = desc->cur_rx_ring;
> + unsigned num_rx = 0;
> + uint32_t slot_id;
>  
> - polld.fd = nm_desc->fd;
> + polld.fd = desc->fd;
>   polld.events = POLLIN;
>  
> - args.pkt_table = pkt_table;
> - args.nb_rx = 0;
> - args.pktio_entry = pktio_entry;
> + for (i = 0; i < num_rings && num_rx != num; i++) {
> + ring_id = desc->cur_rx_ring + i;
>  
> - nm_dispatch(nm_desc, num, netmap_recv_cb, (u_char *));
> - if (args.nb_rx == 0) {
> + if (ring_id > desc->last_rx_ring)
> + ring_id = desc->first_rx_ring;
> +
> + ring = NETMAP_RXRING(desc->nifp, ring_id);
> +
> + while (!nm_ring_empty(ring) && num_rx != num) {
> + slot_id = ring->cur;
> + buf = NETMAP_BUF(ring, ring->slot[slot_id].buf_idx);
> +
> + odp_prefetch(buf);
> +
> + if (!netmap_pkt_to_odp(pktio_entry, _table[num_rx],
> +buf, 

Re: [lng-odp] [API-NEXT PATCH v2] api: atomic: added atomic_lock_free_u64

2015-11-11 Thread Ola Liljedahl
On 11 November 2015 at 15:24, Petri Savolainen 
wrote:

> Platforms may support some uint64 operations lock-free and
> others not. For example, inc_64 can be natively supported but
> cas_64 (or max_64/min_64) not. User may be able to switch to
> 32 bit variables when a 64 bit operation uses locks. The same
> atomic operation struture could be used for platform init to guide
>
structure?


> lock vs. lock-free implementation (e.g. if cas_64 is never
> called, inc_64 can be lock-free).
>
I think this also should be added to the patch. It feels incomplete now.


> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/atomic.h| 51
> +
>  platform/linux-generic/Makefile.am  |  1 +
>  platform/linux-generic/odp_atomic.c | 26 +++
>  3 files changed, 78 insertions(+)
>  create mode 100644 platform/linux-generic/odp_atomic.c
>
> diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
> index 316f13a..17a38fb 100644
> --- a/include/odp/api/atomic.h
> +++ b/include/odp/api/atomic.h
> @@ -388,6 +388,57 @@ void odp_atomic_add_rls_u32(odp_atomic_u32_t *atom,
> uint32_t val);
>  void odp_atomic_sub_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
>
>  /**
> + * Atomic operations
> + *
> + * Atomic operations listed in a bit field structure.
> + */
> +typedef union odp_atomic_op_t {
> +   /** Operation flags */
> +   struct {
> +   uint32_t init  : 1;  /**< Atomic init */
>
Init doesn't have to be atomic. No other thread is supposed to operate on
an atomic/shared variable before being signalled that this is OK (and
initialisation has been done). The signalling will include the necessary
ordering.

+   uint32_t load  : 1;  /**< Atomic load */
> +   uint32_t store : 1;  /**< Atomic store */
> +   uint32_t fetch_add : 1;  /**< Atomic fetch and add */
> +   uint32_t add   : 1;  /**< Atomic add */
> +   uint32_t fetch_sub : 1;  /**< Atomic fetch and substract */
> +   uint32_t sub   : 1;  /**< Atomic substract */
> +   uint32_t fetch_inc : 1;  /**< Atomic fetch and increment */
> +   uint32_t inc   : 1;  /**< Atomic increment */
> +   uint32_t fetch_dec : 1;  /**< Atomic fetch and decrement */
> +   uint32_t dec   : 1;  /**< Atomic decrement */
> +   uint32_t min   : 1;  /**< Atomic minimum */
> +   uint32_t max   : 1;  /**< Atomic maximum */
>
I am missing atomic exchange here.


> +   uint32_t cas   : 1;  /**< Atomic compare and swap */
> +   uint32_t _reserved : 18; /**< Reserved - do not use */
>
Is this field actually needed?


> +   } op;
> +
> +   /** All flags */
> +   union {
> +   uint32_t ops   : 14; /**< All operations*/
> +   uint32_t _reserved : 18; /**< Reserved - do not use */
>
You are missing a struct here?


> +
> +   uint32_t bits;   /**< All bits */
> +   } all;
> +} odp_atomic_op_t;
>
Feels a little bit too complicated. Wouldn't it be enough with just a union
of the op bitfield struct and the uint32_t bits?

+
> +/**
> + * Query which atomic uint64 operations are lock-free
> + *
> + * Lock-free implementations have higher performance and scale better than
> + * implementations using locks. User can decide to use e.g. uint32 atomic
> + * variables instead of uint64 to optimize performance on platforms that
> + * implement a performance critical operation using locks.
> + *
> + * @param atomic_op  Pointer to atomic operation structure for storing
> + *   operation flags. All bits are initialized to zero
> during
> + *   the operation. The parameter is ignored when NULL.
> + * @retval 0 None of the operations are lock-free
> + * @retval 1 Some of the operations are lock-free
> + * @retval 2 All operations are lock-free
> + */
> +int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op);
> +
> +/**
>   * @}
>   */
>
> diff --git a/platform/linux-generic/Makefile.am
> b/platform/linux-generic/Makefile.am
> index a6b6029..0b7234e 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -151,6 +151,7 @@ noinst_HEADERS = \
>   ${srcdir}/Makefile.inc
>
>  __LIB__libodp_la_SOURCES = \
> +  odp_atomic.c \
>odp_barrier.c \
>odp_buffer.c \
>odp_classification.c \
> diff --git a/platform/linux-generic/odp_atomic.c
> b/platform/linux-generic/odp_atomic.c
> new file mode 100644
> index 000..8955b41
> --- /dev/null
> +++ b/platform/linux-generic/odp_atomic.c
> @@ -0,0 +1,26 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> 

[lng-odp] [PATCH v2] linux-generic: pktio: print out the name of pktio used

2015-11-11 Thread Zoltan Kiss
For debug purposes, otherwise it's not trivial to figure out which pktio was
successful.

Signed-off-by: Zoltan Kiss 
--

v2:
- change the string for loopback and socket interfaces
- also add it to odp_pktio_print()

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 1a1118c..a46c6fe 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -100,6 +100,7 @@ typedef struct {
 } pktio_table_t;
 
 typedef struct pktio_if_ops {
+   const char *name;
int (*init)(void);
int (*term)(void);
int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry,
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 3ef400f..e542af3 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, 
odp_pool_t pool,
 
if (!ret) {
pktio_entry->s.ops = pktio_if_ops[pktio_if];
+   ODP_ERR("%s uses %s\n",
+   dev, pktio_if_ops[pktio_if]->name);
break;
}
}
@@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id)
len += snprintf([len], n - len,
"  name %s\n", entry->s.name);
len += snprintf([len], n - len,
+   "  type %s\n", entry->s.ops->name);
+   len += snprintf([len], n - len,
"  state%s\n",
entry->s.state ==  STATE_START ? "start" :
   (entry->s.state ==  STATE_STOP ? "stop" : "unknown"));
diff --git a/platform/linux-generic/pktio/loop.c 
b/platform/linux-generic/pktio/loop.c
index ce19add..44da917 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t 
*pktio_entry)
 }
 
 const pktio_if_ops_t loopback_pktio_ops = {
+   .name = "loop",
.init = NULL,
.term = NULL,
.open = loopback_open,
diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 794c82e..bc4ab1c 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t 
*pktio_entry)
 }
 
 const pktio_if_ops_t netmap_pktio_ops = {
+   .name = "netmap",
.init = NULL,
.term = NULL,
.open = netmap_open,
diff --git a/platform/linux-generic/pktio/pcap.c 
b/platform/linux-generic/pktio/pcap.c
index 0817bf5..94b506d 100644
--- a/platform/linux-generic/pktio/pcap.c
+++ b/platform/linux-generic/pktio/pcap.c
@@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t 
*pktio_entry)
 }
 
 const pktio_if_ops_t pcap_pktio_ops = {
+   .name = "pcap",
.open = pcapif_init,
.close = pcapif_close,
.recv = pcapif_recv_pkt,
diff --git a/platform/linux-generic/pktio/socket.c 
b/platform/linux-generic/pktio/socket.c
index 5f5e0ae..56b0a8b 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry)
 }
 
 const pktio_if_ops_t sock_mmsg_pktio_ops = {
+   .name = "socket",
.init = NULL,
.term = NULL,
.open = sock_mmsg_open,
diff --git a/platform/linux-generic/pktio/socket_mmap.c 
b/platform/linux-generic/pktio/socket_mmap.c
index 79ff82d..3a51179 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t 
*pktio_entry)
 }
 
 const pktio_if_ops_t sock_mmap_pktio_ops = {
+   .name = "socket_mmap",
.init = NULL,
.term = NULL,
.open = sock_mmap_open,
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv9 0/4] Egress Traffic Manager

2015-11-11 Thread Bill Fischofer
Changes in v9
- Rebase on top of latest queue fixes

Changes in v8
- add ARM definition for __crc32w() function (from Alex)

Changes in v7 (review comments by Maxim)
- Correct architecture ifdefs (use of arch dir in later patch)
- Correct doxygen for queue types
- Change internal APIs that use odp_ prefix to use _odp prefix
- Rebase to latest api-next

Changes in v6
- Move documentation of packet colors to main API file
- Add ODP prefix to odp_tm_egress_kind_t enums

Changes in v5
- Add include file odp_traffic_mngr_internal.h
- Add support for odp_tm_enq() from packets originating from ordered queues

Changes in v4
- Incorporate API changes suggested by Petri

Changes in v3
- Fix checkpatch errors (Bill)

Changes in v2
- Full patch submission (Barry)


Barry Spinney (4):
  api: tm: add tm API definitions
  linux-generic: tm: implement traffic manager
  linux-generic: tm: add tm to build
  example: tm: traffic manager example

 configure.ac   |1 +
 example/Makefile.am|2 +-
 example/traffic_mgmt/.gitignore|1 +
 example/traffic_mgmt/Makefile.am   |9 +
 example/traffic_mgmt/odp_traffic_mgmt.c|  781 ++
 include/odp.h  |1 +
 include/odp/api/packet.h   |   69 +
 include/odp/api/traffic_mngr.h | 1611 +++
 platform/linux-generic/Makefile.am |   13 +
 .../linux-generic/include/odp/plat/packet_types.h  |   11 +
 .../linux-generic/include/odp/plat/queue_types.h   |7 +
 .../include/odp/plat/traffic_mngr_types.h  |  185 ++
 platform/linux-generic/include/odp/traffic_mngr.h  |   35 +
 platform/linux-generic/include/odp_internal.h  |2 +
 .../include/odp_name_table_internal.h  |   61 +
 .../linux-generic/include/odp_packet_internal.h|5 +
 .../linux-generic/include/odp_pkt_queue_internal.h |   62 +
 .../linux-generic/include/odp_queue_internal.h |6 +
 .../include/odp_sorted_list_internal.h |   78 +
 .../include/odp_timer_wheel_internal.h |   68 +
 .../include/odp_traffic_mngr_internal.h|  324 +++
 platform/linux-generic/odp_init.c  |5 +
 platform/linux-generic/odp_name_table.c| 1365 ++
 platform/linux-generic/odp_packet_flags.c  |   46 +-
 platform/linux-generic/odp_pkt_queue.c |  379 +++
 platform/linux-generic/odp_queue.c |   60 +
 platform/linux-generic/odp_sorted_list.c   |  271 ++
 platform/linux-generic/odp_timer_wheel.c   |  907 +++
 platform/linux-generic/odp_traffic_mngr.c  | 2799 
 29 files changed, 9162 insertions(+), 2 deletions(-)
 create mode 100644 example/traffic_mgmt/.gitignore
 create mode 100644 example/traffic_mgmt/Makefile.am
 create mode 100644 example/traffic_mgmt/odp_traffic_mgmt.c
 create mode 100644 include/odp/api/traffic_mngr.h
 create mode 100644 platform/linux-generic/include/odp/plat/traffic_mngr_types.h
 create mode 100644 platform/linux-generic/include/odp/traffic_mngr.h
 create mode 100644 platform/linux-generic/include/odp_name_table_internal.h
 create mode 100644 platform/linux-generic/include/odp_pkt_queue_internal.h
 create mode 100644 platform/linux-generic/include/odp_sorted_list_internal.h
 create mode 100644 platform/linux-generic/include/odp_timer_wheel_internal.h
 create mode 100644 platform/linux-generic/include/odp_traffic_mngr_internal.h
 create mode 100644 platform/linux-generic/odp_name_table.c
 create mode 100644 platform/linux-generic/odp_pkt_queue.c
 create mode 100644 platform/linux-generic/odp_sorted_list.c
 create mode 100644 platform/linux-generic/odp_timer_wheel.c
 create mode 100644 platform/linux-generic/odp_traffic_mngr.c

-- 
2.1.4

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


Re: [lng-odp] [API-NEXT PATCH] api: sync: update spec and add odp_sync_loads

2015-11-11 Thread Ola Liljedahl
On 9 November 2015 at 10:39, Savolainen, Petri (Nokia - FI/Espoo)
 wrote:
>
>
>
> From: EXT Nicolas Morey-Chaisemartin [mailto:nmo...@kalray.eu]
> Sent: Thursday, November 05, 2015 6:23 PM
> To: Savolainen, Petri (Nokia - FI/Espoo); Bill Fischofer
> Cc: LNG ODP Mailman List
> Subject: Re: [lng-odp] [API-NEXT PATCH] api: sync: update spec and add 
> odp_sync_loads
>
>
> On 11/05/2015 04:54 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> Majority of platforms are cache coherent, for a  non-coherent platform you’d 
> need to define some additional API calls. This is documenting the current 
> assumption that application does this …

Depending on how you signal the consumer of the shared data, you might
need different barriers. E.g. if signalling the consumer by writing to
some device register which generates an interrupt to the consumer, on
ARM you need DSB, DMB is normally not enough. I doubt
__atomic_thread_fence generates a DSB instruction. So defining a
generic mechanism which can be used regardless of the signalling
method would require the strongest barrier. But this might still not
be enough for the actual scenarios which these calls are intended for.

If there is no synchronisation between producer and consumer, you have
a data race and the program behaviour is undefined. The only
work-around is to make *all* shared data atomically read and written,
variable by variable. But then you couldn't atomically read a set of
variables (if that is important).

>
> // data in shared memory
> int foo;
>
> Thread A  Thread B
>
> ev = schedule();
> msg = event_to_message(ev);
>
> if (msg == UPDATE_FOO) {
> foo++;
> msg = FOO_UPDATED;
> queue_enq(msg);

release operation with release ordering, all stores before queue_enq()
observable when the msg event can be observe (e.g. by dequeueing it
explicitly or from odp_schedule). Also guarantees that loads before
queue_enq() have completed so that a load that misses in the cache
will not read some data that was updated after queue_enq().

> }
>
>  ev = 
> schedule();

acquire operation, guarantees that following loads (and stores but
they are seldom speculated) will not be issued before the event has
been seen and properly "acquired".

>
>  msg = 
> event_to_message(ev);
>
>  if (msg == 
> FOO_UPDATED) {
>  
> printf(“foo is now %\n”, foo);
>  }
>
>
> … intead of this …
>
> Thread A  Thread B
>
> ev = schedule();
> msg = event_to_message(ev);
>
> if (msg == UPDATE_FOO) {
> // Make sure that load of “foo” is not moved before schedule()
> odp_sync_loads();

odp_sync_acquire() would be a better name.

>
> foo++;
> // Make sure that store of “foo” is not moved after queue_enq()
>odp_sync_stores();

odp_sync_release() would be a better name.

I am somewhat OK with odp_sync_acquire/odp_sync_release (should also
take vector of memory segments per suggestion below) as long as it is
required that producer and consumer use the same ODP calls.

> msg = FOO_UPDATED;
> queue_enq(msg);
> }
>
>  ev = 
> schedule();
>  msg = 
> event_to_message(ev);
>
>  if (msg == 
> FOO_UPDATED) {
>  // Make 
> sure that load of “foo” is not moved before schedule()
>  
> odp_sync_loads();
>  
> printf(“foo is now %\n”, foo);
>  }
>
>
> As you can see it would a lot of waste if application must always sync for 
> stores and loads explicitly.
> I see your point.
> I re-read carefully the documentation and maybe we can work around it.
> The sync_stores explicitly states that all store operations are globally 
> visible. So cache needs to be flushed.

If the Kalray HW isn't cache coherent between CPU's, neither old-style
(volatile + barriers) or C11-style shared memory programming will
work. Probably some platform specific code is necessary in order to
share data between CPU's and to properly synchronise the access.
Perhaps the acquire and release operations should take a vector of
addresses and sizes, specifying which data is being shared so to
minimise cache flushing (in the producer) and invalidation (in the
consumer).

>
> The load part only states that previous 

Re: [lng-odp] [PATCH] linux-generic: netmap: replace nm_dispatch() helper

2015-11-11 Thread Maxim Uvarov

took that patch to next branch, will be in master just after 1.4.1

Maxim.

On 11/11/2015 14:34, Stuart Haslam wrote:

On Fri, Nov 06, 2015 at 12:56:37PM +0200, Matias Elo wrote:

Implement nm_dispatch() functionality in ODP code to
optimize performance and enable future feature additions.

Signed-off-by: Matias Elo 

Reviewed-and-Tested-by: Stuart Haslam 


---
  platform/linux-generic/pktio/netmap.c | 94 +++
  1 file changed, 61 insertions(+), 33 deletions(-)

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 794c82e..d064323 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -31,12 +31,6 @@ static struct nm_desc mmap_desc; /** Used to store the 
mmap address;
  #define NM_OPEN_RETRIES 5
  #define NM_INJECT_RETRIES 10
  
-struct dispatch_args {

-   odp_packet_t *pkt_table;
-   unsigned nb_rx;
-   pktio_entry_t *pktio_entry;
-};
-
  static int netmap_do_ioctl(pktio_entry_t *pktio_entry, unsigned long cmd,
   int subcmd)
  {
@@ -187,64 +181,98 @@ error:
return -1;
  }
  
-static void netmap_recv_cb(u_char *arg, const struct nm_pkthdr *hdr,

-  const u_char *buf)
+/**
+ * Create ODP packet from netmap packet
+ *
+ * @param pktio_entryPacket IO handle
+ * @param pkt_outStorage for new ODP packet handle
+ * @param bufNetmap buffer address
+ * @param lenNetmap buffer length
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry,
+   odp_packet_t *pkt_out, const char *buf,
+   uint16_t len)
  {
-   struct dispatch_args *args = (struct dispatch_args *)(void *)arg;
-   pkt_netmap_t *pkt_nm = >pktio_entry->s.pkt_nm;
odp_packet_t pkt;
odp_packet_hdr_t *pkt_hdr;
-   size_t frame_len = (size_t)hdr->len;
  
-	if (odp_unlikely(frame_len > pkt_nm->max_frame_len)) {

-   ODP_ERR("RX: frame too big %u %lu!\n", (unsigned)frame_len,
-   pkt_nm->max_frame_len);
-   return;
+   if (odp_unlikely(len > pktio_entry->s.pkt_nm.max_frame_len)) {
+   ODP_ERR("RX: frame too big %" PRIu16 " %zu!\n", len,
+   pktio_entry->s.pkt_nm.max_frame_len);
+   return -1;
}
  
-	if (odp_unlikely(frame_len < ODPH_ETH_LEN_MIN)) {

-   ODP_ERR("RX: Frame truncated: %u\n", (unsigned)frame_len);
-   return;
+   if (odp_unlikely(len < ODPH_ETH_LEN_MIN)) {
+   ODP_ERR("RX: Frame truncated: %" PRIu16 "\n", len);
+   return -1;
}
  
-	pkt = packet_alloc(pkt_nm->pool, frame_len, 1);

+   pkt = packet_alloc(pktio_entry->s.pkt_nm.pool, len, 1);
if (pkt == ODP_PACKET_INVALID)
-   return;
+   return -1;
  
  	pkt_hdr = odp_packet_hdr(pkt);
  
  	/* For now copy the data in the mbuf,

   worry about zero-copy later */
-   if (odp_packet_copydata_in(pkt, 0, frame_len, buf) != 0) {
+   if (odp_packet_copydata_in(pkt, 0, len, buf) != 0) {
odp_packet_free(pkt);
-   return;
+   return -1;
}
-
packet_parse_l2(pkt_hdr);
  
-	args->pkt_table[args->nb_rx++] = pkt;

+   *pkt_out = pkt;
+   return 0;
  }
  
  static int netmap_recv(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[],

   unsigned num)
  {
-   struct dispatch_args args;
-   struct nm_desc *nm_desc = pktio_entry->s.pkt_nm.rx_desc;
+   struct netmap_ring *ring;
+   struct nm_desc *desc = pktio_entry->s.pkt_nm.rx_desc;
struct pollfd polld;
+   char *buf;
+   int i;
+   int num_rings = desc->last_rx_ring - desc->first_rx_ring + 1;
+   int ring_id = desc->cur_rx_ring;
+   unsigned num_rx = 0;
+   uint32_t slot_id;
  
-	polld.fd = nm_desc->fd;

+   polld.fd = desc->fd;
polld.events = POLLIN;
  
-	args.pkt_table = pkt_table;

-   args.nb_rx = 0;
-   args.pktio_entry = pktio_entry;
+   for (i = 0; i < num_rings && num_rx != num; i++) {
+   ring_id = desc->cur_rx_ring + i;
  
-	nm_dispatch(nm_desc, num, netmap_recv_cb, (u_char *));

-   if (args.nb_rx == 0) {
+   if (ring_id > desc->last_rx_ring)
+   ring_id = desc->first_rx_ring;
+
+   ring = NETMAP_RXRING(desc->nifp, ring_id);
+
+   while (!nm_ring_empty(ring) && num_rx != num) {
+   slot_id = ring->cur;
+   buf = NETMAP_BUF(ring, ring->slot[slot_id].buf_idx);
+
+   odp_prefetch(buf);
+
+   if (!netmap_pkt_to_odp(pktio_entry, _table[num_rx],
+  buf, 

[lng-odp] [API-NEXT PATCH v2] api: atomic: added atomic_lock_free_u64

2015-11-11 Thread Petri Savolainen
Platforms may support some uint64 operations lock-free and
others not. For example, inc_64 can be natively supported but
cas_64 (or max_64/min_64) not. User may be able to switch to
32 bit variables when a 64 bit operation uses locks. The same
atomic operation struture could be used for platform init to guide
lock vs. lock-free implementation (e.g. if cas_64 is never
called, inc_64 can be lock-free).

Signed-off-by: Petri Savolainen 
---
 include/odp/api/atomic.h| 51 +
 platform/linux-generic/Makefile.am  |  1 +
 platform/linux-generic/odp_atomic.c | 26 +++
 3 files changed, 78 insertions(+)
 create mode 100644 platform/linux-generic/odp_atomic.c

diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
index 316f13a..17a38fb 100644
--- a/include/odp/api/atomic.h
+++ b/include/odp/api/atomic.h
@@ -388,6 +388,57 @@ void odp_atomic_add_rls_u32(odp_atomic_u32_t *atom, 
uint32_t val);
 void odp_atomic_sub_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
 
 /**
+ * Atomic operations
+ *
+ * Atomic operations listed in a bit field structure.
+ */
+typedef union odp_atomic_op_t {
+   /** Operation flags */
+   struct {
+   uint32_t init  : 1;  /**< Atomic init */
+   uint32_t load  : 1;  /**< Atomic load */
+   uint32_t store : 1;  /**< Atomic store */
+   uint32_t fetch_add : 1;  /**< Atomic fetch and add */
+   uint32_t add   : 1;  /**< Atomic add */
+   uint32_t fetch_sub : 1;  /**< Atomic fetch and substract */
+   uint32_t sub   : 1;  /**< Atomic substract */
+   uint32_t fetch_inc : 1;  /**< Atomic fetch and increment */
+   uint32_t inc   : 1;  /**< Atomic increment */
+   uint32_t fetch_dec : 1;  /**< Atomic fetch and decrement */
+   uint32_t dec   : 1;  /**< Atomic decrement */
+   uint32_t min   : 1;  /**< Atomic minimum */
+   uint32_t max   : 1;  /**< Atomic maximum */
+   uint32_t cas   : 1;  /**< Atomic compare and swap */
+   uint32_t _reserved : 18; /**< Reserved - do not use */
+   } op;
+
+   /** All flags */
+   union {
+   uint32_t ops   : 14; /**< All operations*/
+   uint32_t _reserved : 18; /**< Reserved - do not use */
+
+   uint32_t bits;   /**< All bits */
+   } all;
+} odp_atomic_op_t;
+
+/**
+ * Query which atomic uint64 operations are lock-free
+ *
+ * Lock-free implementations have higher performance and scale better than
+ * implementations using locks. User can decide to use e.g. uint32 atomic
+ * variables instead of uint64 to optimize performance on platforms that
+ * implement a performance critical operation using locks.
+ *
+ * @param atomic_op  Pointer to atomic operation structure for storing
+ *   operation flags. All bits are initialized to zero during
+ *   the operation. The parameter is ignored when NULL.
+ * @retval 0 None of the operations are lock-free
+ * @retval 1 Some of the operations are lock-free
+ * @retval 2 All operations are lock-free
+ */
+int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index a6b6029..0b7234e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -151,6 +151,7 @@ noinst_HEADERS = \
  ${srcdir}/Makefile.inc
 
 __LIB__libodp_la_SOURCES = \
+  odp_atomic.c \
   odp_barrier.c \
   odp_buffer.c \
   odp_classification.c \
diff --git a/platform/linux-generic/odp_atomic.c 
b/platform/linux-generic/odp_atomic.c
new file mode 100644
index 000..8955b41
--- /dev/null
+++ b/platform/linux-generic/odp_atomic.c
@@ -0,0 +1,26 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+
+int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op)
+{
+#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2
+   /* All operations have locks */
+   if (atomic_op)
+   atomic_op->all.bits = 0;
+
+   return 0;
+#else
+   /* All operations are lock-free */
+   if (atomic_op) {
+   atomic_op->all.bits = 0;
+   atomic_op->all.ops  = 0x3fff;
+   }
+
+   return 2;
+#endif
+}
-- 
2.6.2

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


[lng-odp] [API-NEXT PATCHv9 1/4] api: tm: add tm API definitions

2015-11-11 Thread Bill Fischofer
From: Barry Spinney 

This introduces an API for configuring and using Traffic Management
systems.

The purpose of this API is as a general packet scheduling system that
accepts packets from input queues and applies strict priority
scheduling, weighted fair queuing scheduling and/or bandwidth controls
to decide which input packet should be chosen as the next output
packet and when this output packet can be sent onwards.

Signed-off-by: Barry Spinney 
Signed-off-by: Bill Fischofer 
---
 include/odp.h  |1 +
 include/odp/api/packet.h   |   69 +
 include/odp/api/traffic_mngr.h | 1611 
 .../linux-generic/include/odp/plat/packet_types.h  |   11 +
 .../include/odp/plat/traffic_mngr_types.h  |  185 +++
 platform/linux-generic/include/odp/traffic_mngr.h  |   35 +
 .../linux-generic/include/odp_packet_internal.h|5 +
 7 files changed, 1917 insertions(+)
 create mode 100644 include/odp/api/traffic_mngr.h
 create mode 100644 platform/linux-generic/include/odp/plat/traffic_mngr_types.h
 create mode 100644 platform/linux-generic/include/odp/traffic_mngr.h

diff --git a/include/odp.h b/include/odp.h
index 2adcb8b..4a93c23 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -55,6 +55,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 85cc9c9..9c63b5f 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -48,6 +48,26 @@ extern "C" {
  * Invalid packet segment
  */
 
+ /**
+  * @typedef odp_packet_color_t
+  * Color of packet for shaper/drop processing
+  */
+
+ /**
+  * @def ODP_PACKET_GREEN
+  * Packet is green
+  */
+
+ /**
+  * @def ODP_PACKET_YELLOW
+  * Packet is yellow
+  */
+
+ /**
+  * @def ODP_PACKET_RED
+  * Packet is red
+  */
+
 /*
  *
  * Alloc and free
@@ -729,6 +749,55 @@ odp_packet_seg_t odp_packet_last_seg(odp_packet_t pkt);
  */
 odp_packet_seg_t odp_packet_next_seg(odp_packet_t pkt, odp_packet_seg_t seg);
 
+/**
+ * Get packet color
+ *
+ * @param pkt Packet handle
+ * @return packet color
+ */
+odp_packet_color_t odp_packet_color(odp_packet_t pkt);
+
+/**
+ * Set packet color
+ *
+ * @param pkt Packet handle
+ * @param color Color to set
+ */
+void odp_packet_color_set(odp_packet_t pkt, odp_packet_color_t color);
+
+/**
+ * Get drop eligible status
+ *
+ * @param pkt Packet handle
+ * @return Packet drop eligibility status
+ * @retval 0 Packet is not drop eligible
+ * @retval 1 Packet is drop
+ */
+odp_bool_t odp_packet_drop_eligible(odp_packet_t pkt);
+
+/**
+ * Set drop eligible status
+ *
+ * @param pkt Packet handle
+ * @param status Drop eligibility status
+ */
+void odp_packet_drop_eligible_set(odp_packet_t pkt, odp_bool_t status);
+
+/**
+ * Get shaper length adjustment
+ *
+ * @param pkt Packet handle
+ * @return Shaper adjustment (-128..127)
+ */
+int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt);
+
+/**
+ * Set shaper length adjustment
+ *
+ * @param pkt Packet handle
+ * @param adj Signed adjustment value
+ */
+void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj);
 
 /*
  *
diff --git a/include/odp/api/traffic_mngr.h b/include/odp/api/traffic_mngr.h
new file mode 100644
index 000..2459a8b
--- /dev/null
+++ b/include/odp/api/traffic_mngr.h
@@ -0,0 +1,1611 @@
+/** Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_TRAFFIC_MNGR_H_
+#define ODP_TRAFFIC_MNGR_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/**
+ * @file
+ *
+ */
+
+/** @defgroup odp_traffic_mngr ODP TRAFFIC MNGR
+ * @{
+ *
+ * An API for configuring and using Traffic Management systems
+ *
+ * This file forms a simple interface for creating, configuring and using
+ * Traffic Management (TM) subsystems.  By TM subsystem it is meant a general
+ * packet scheduling system that accepts packets from input queues and applies
+ * strict priority scheduling, weighted fair queueing scheduling and/or
+ * bandwidth controls to decide which input packet should be chosen as the
+ * next output packet and when this output packet can be sent onwards.
+ *
+ * A given platform supporting this TM API could support one or more pure
+ * hardware based packet scheduling systems, one or more pure software
+ * based systems or one or more hybrid systems - where because of
+ * hardware constraints some of the packet scheduling is done in hardware
+ * and some is done in software.  In addition, there may also be additional
+ * API's beyond those described here for (a) controlling advanced capabilities
+ * supported by specific hardware, software or hybrid subsystems or (b)
+ * dealing with constraints and limitations of specific implementations.
+ * The intention here is to be the simplest API that covers the vast majority

[lng-odp] [API-NEXT PATCHv9 4/4] example: tm: traffic manager example

2015-11-11 Thread Bill Fischofer
From: Barry Spinney 

This commit includes all of the changes to build the traffic_mgr example
application.

Signed-off-by: Barry Spinney 
Signed-off-by: Bill Fischofer 
---
 configure.ac|   1 +
 example/Makefile.am |   2 +-
 example/traffic_mgmt/.gitignore |   1 +
 example/traffic_mgmt/Makefile.am|   9 +
 example/traffic_mgmt/odp_traffic_mgmt.c | 781 
 5 files changed, 793 insertions(+), 1 deletion(-)
 create mode 100644 example/traffic_mgmt/.gitignore
 create mode 100644 example/traffic_mgmt/Makefile.am
 create mode 100644 example/traffic_mgmt/odp_traffic_mgmt.c

diff --git a/configure.ac b/configure.ac
index 9887589..8d43b2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,6 +302,7 @@ AC_CONFIG_FILES([Makefile
 example/ipsec/Makefile
 example/packet/Makefile
 example/timer/Makefile
+example/traffic_mgmt/Makefile
 helper/Makefile
 helper/test/Makefile
 pkgconfig/libodp.pc
diff --git a/example/Makefile.am b/example/Makefile.am
index 353f397..6b67bf5 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -1 +1 @@
-SUBDIRS = classifier generator ipsec packet timer
+SUBDIRS = classifier generator ipsec packet timer traffic_mgmt
diff --git a/example/traffic_mgmt/.gitignore b/example/traffic_mgmt/.gitignore
new file mode 100644
index 000..9e742f0
--- /dev/null
+++ b/example/traffic_mgmt/.gitignore
@@ -0,0 +1 @@
+odp_traffic_mgmt
\ No newline at end of file
diff --git a/example/traffic_mgmt/Makefile.am b/example/traffic_mgmt/Makefile.am
new file mode 100644
index 000..c8ff797
--- /dev/null
+++ b/example/traffic_mgmt/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/example/Makefile.inc
+
+bin_PROGRAMS = odp_traffic_mgmt$(EXEEXT)
+odp_traffic_mgmt_LDFLAGS = $(AM_LDFLAGS) -static
+odp_traffic_mgmt_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+
+noinst_HEADERS = $(top_srcdir)/example/example_debug.h
+
+dist_odp_traffic_mgmt_SOURCES = odp_traffic_mgmt.c
diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c 
b/example/traffic_mgmt/odp_traffic_mgmt.c
new file mode 100644
index 000..37a85c7
--- /dev/null
+++ b/example/traffic_mgmt/odp_traffic_mgmt.c
@@ -0,0 +1,781 @@
+/* Copyright 2015 EZchip Semiconductor Ltd. All Rights Reserved.
+ *
+ * Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#define _GNU_SOURCE
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define NUM_SVC_CLASSES 4
+#define USERS_PER_SVC_CLASS 2
+#define APPS_PER_USER   2
+#define TM_QUEUES_PER_APP   2
+#define NUM_USERS   (USERS_PER_SVC_CLASS * NUM_SVC_CLASSES)
+#define NUM_TM_QUEUES   (NUM_USERS * APPS_PER_USER * TM_QUEUES_PER_APP)
+#define TM_QUEUES_PER_USER  (TM_QUEUES_PER_APP * APPS_PER_USER)
+#define TM_QUEUES_PER_CLASS (USERS_PER_SVC_CLASS * TM_QUEUES_PER_USER)
+
+#define Kbps   1000
+#define Mbps   100
+#define PERCENT(percent)  (100 * percent)
+
+#define FALSE  0
+#define TRUE   1
+
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+#define RANDOM_BUF_LEN  1024
+
+typedef struct {
+   odp_tm_shaper_params_tshaper_params;
+   odp_tm_threshold_params_t threshold_params;
+   odp_tm_wred_params_t  wred_params[ODP_NUM_PACKET_COLORS];
+} profile_params_set_t;
+
+typedef struct {
+   odp_tm_shaper_tshaper_profile;
+   odp_tm_threshold_t threshold_profile;
+   odp_tm_wred_t  wred_profiles[ODP_NUM_PACKET_COLORS];
+} profile_set_t;
+
+static const odp_init_t ODP_INIT_PARAMS = {
+   .log_fn   = odp_override_log,
+   .abort_fn = odp_override_abort
+};
+
+static const odp_platform_init_t PLATFORM_PARAMS = {
+};
+
+static profile_params_set_t COMPANY_PROFILE_PARAMS = {
+   .shaper_params = {
+   .commit_bps = 50  * Mbps,  .commit_burst  = 100,
+   .peak_bps   = 0,   .peak_burst= 0,
+   .dual_rate  = FALSE,   .shaper_len_adjust = 20
+   },
+
+   .threshold_params = {
+   .max_pkts  = 10,.enable_max_pkts  = TRUE,
+   .max_bytes = 1000,  .enable_max_bytes = TRUE
+   },
+
+   .wred_params = {
+   [ODP_PACKET_GREEN ... ODP_PACKET_YELLOW] = {
+   .min_threshold = PERCENT(70),
+   .med_threshold = PERCENT(90),
+   .med_drop_prob = PERCENT(80),
+   .max_drop_prob = PERCENT(100),
+   .enable_wred   = TRUE,
+   .use_byte_fullness = FALSE,
+   },
+
+   [ODP_PACKET_RED] = {
+   .min_threshold = PERCENT(40),
+ 

[lng-odp] [PATCH] test: performance: set a packet rate pass threshold for l2fwd

2015-11-11 Thread Stuart Haslam
Report a failure if the maximum achieved packet rate is less than a
predefined threshold (currently set at 5000pps).

Signed-off-by: Stuart Haslam 
---
 test/performance/odp_l2fwd_run | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_l2fwd_run b/test/performance/odp_l2fwd_run
index e0c61e7..001d8c2 100755
--- a/test/performance/odp_l2fwd_run
+++ b/test/performance/odp_l2fwd_run
@@ -61,16 +61,35 @@ run_l2fwd()
2>&1 > /dev/null &
GEN_PID=$!
 
-   echo "Run odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2"
-   odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2
+   # this just turns off output buffering so that you still get periodic
+   # output while piping to tee, as long as stdbuf is available.
+   if [ "$(which stdbuf)" != "" ]; then
+   STDBUF="stdbuf -o 0"
+   else
+   STDBUF=
+   fi
+   LOG=odp_l2fwd_tmp.log
+   $STDBUF odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2 | tee $LOG
ret=$?
 
kill ${GEN_PID}
 
+   if [ ! -f $LOG ]; then
+   echo "FAIL: $LOG not found"
+   ret=1
+   elif [ $ret -eq 0 ]; then
+   PASS_PPS=5000
+   MAX_PPS=$(awk '/TEST RESULT/ {print $3}' $LOG)
+   if [ "$MAX_PPS" -lt "$PASS_PPS" ]; then
+   echo "FAIL: pps below threshold $MAX_PPS < $PASS_PPS"
+   ret=1
+   fi
+   fi
+
+   rm -f $LOG
cleanup_pktio_env
if [ $? -ne 0 ]; then
echo "cleanup_pktio_env error $?"
-   exit $TEST_SKIPPED
fi
 
exit $ret
-- 
2.1.1

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


[lng-odp] [API-NEXT PATCHv9 3/4] linux-generic: tm: add tm to build

2015-11-11 Thread Bill Fischofer
From: Barry Spinney 

This commit causes the traffic_mgr to become part of the ODP linux-generic
build.

Signed-off-by: Barry Spinney 
Signed-off-by: Bill Fischofer 
---
 platform/linux-generic/Makefile.am| 13 
 platform/linux-generic/include/odp_internal.h |  2 ++
 platform/linux-generic/odp_init.c |  5 +++
 platform/linux-generic/odp_packet_flags.c | 46 ++-
 4 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index a6b6029..3025809 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -51,6 +51,7 @@ odpinclude_HEADERS = \
  $(srcdir)/include/odp/ticketlock.h \
  $(srcdir)/include/odp/time.h \
  $(srcdir)/include/odp/timer.h \
+ $(srcdir)/include/odp/traffic_mngr.h \
  $(srcdir)/include/odp/version.h
 
 odpplatincludedir= $(includedir)/odp/plat
@@ -78,6 +79,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/ticketlock_types.h \
  $(srcdir)/include/odp/plat/time_types.h \
  $(srcdir)/include/odp/plat/timer_types.h \
+ $(srcdir)/include/odp/plat/traffic_mngr_types.h \
  $(srcdir)/include/odp/plat/version_types.h
 
 odpapiincludedir= $(includedir)/odp/api
@@ -122,6 +124,7 @@ odpapiinclude_HEADERS = \
  $(top_srcdir)/include/odp/api/ticketlock.h \
  $(top_srcdir)/include/odp/api/time.h \
  $(top_srcdir)/include/odp/api/timer.h \
+ $(top_srcdir)/include/odp/api/traffic_mngr.h \
  $(top_srcdir)/include/odp/api/version.h
 
 noinst_HEADERS = \
@@ -137,16 +140,21 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_debug_internal.h \
  ${srcdir}/include/odp_forward_typedefs_internal.h \
  ${srcdir}/include/odp_internal.h \
+ ${srcdir}/include/odp_name_table_internal.h \
  ${srcdir}/include/odp_packet_internal.h \
  ${srcdir}/include/odp_packet_io_internal.h \
  ${srcdir}/include/odp_packet_io_queue.h \
  ${srcdir}/include/odp_packet_netmap.h \
  ${srcdir}/include/odp_packet_socket.h \
+ ${srcdir}/include/odp_pkt_queue_internal.h \
  ${srcdir}/include/odp_pool_internal.h \
  ${srcdir}/include/odp_queue_internal.h \
  ${srcdir}/include/odp_schedule_internal.h \
+ ${srcdir}/include/odp_sorted_list_internal.h \
  ${srcdir}/include/odp_spin_internal.h \
  ${srcdir}/include/odp_timer_internal.h \
+ ${srcdir}/include/odp_timer_wheel_internal.h \
+ ${srcdir}/include/odp_traffic_mngr_internal.h \
  ${srcdir}/include/odp_cpu_internal.h \
  ${srcdir}/Makefile.inc
 
@@ -163,6 +171,7 @@ __LIB__libodp_la_SOURCES = \
   odp_hash.c \
   odp_init.c \
   odp_impl.c \
+  odp_name_table.c \
   odp_packet.c \
   odp_packet_flags.c \
   odp_packet_io.c \
@@ -171,12 +180,14 @@ __LIB__libodp_la_SOURCES = \
   pktio/netmap.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
+  odp_pkt_queue.c \
   odp_pool.c \
   odp_queue.c \
   odp_rwlock.c \
   odp_rwlock_recursive.c \
   odp_schedule.c \
   odp_shared_memory.c \
+  odp_sorted_list.c \
   odp_spinlock.c \
   odp_spinlock_recursive.c \
   odp_system_info.c \
@@ -185,6 +196,8 @@ __LIB__libodp_la_SOURCES = \
   odp_ticketlock.c \
   odp_time.c \
   odp_timer.c \
+  odp_timer_wheel.c \
+  odp_traffic_mngr.c \
   odp_version.c \
   odp_weak.c \
   arch/@ARCH@/odp_cpu_cycles.c
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 14ba159..74e48a9 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -79,6 +79,8 @@ int odp_schedule_term_local(void);
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
 
+int odp_tm_init_global(void);
+
 void _odp_flush_caches(void);
 
 #ifdef 

Re: [lng-odp] [PATCH 2/3 v4] linux-generic: odp_timer: warn if tick is late

2015-11-11 Thread Ivan Khoronzhuk

Ola,

I've sent new v2 series with your suggestions,
Could you please review it,
[lng-odp] [PATCH 0/3 v2] add warnings to improve timer usage
https://lists.linaro.org/pipermail/lng-odp/2015-November/017195.html

On 10.11.15 16:47, Ola Liljedahl wrote:



On 10 November 2015 at 15:40, Ivan Khoronzhuk > wrote:

If tick is late then application should be warned about this.
It means that actual timer resolution is worse than expected.
The default timer resolution is set 10ms, that is equal to jiffy
on most systems. The default resolution is set bearing in mind
that on a CPU runs maximum two threads that ideally fits in 10ms.
But user can change it to be smaller, in case if CPU0 is isolated
and it handles only the timer ticks. This patch helps user to set
correct timer resolution.

Signed-off-by: Ivan Khoronzhuk >
---
  platform/linux-generic/odp_timer.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/platform/linux-generic/odp_timer.c 
b/platform/linux-generic/odp_timer.c
index e8f0267..917ee5a 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -632,7 +632,13 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t 
tpid, uint64_t tick)

  static void timer_notify(sigval_t sigval)
  {
+   int overrun;
 odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr;
+
+   overrun = timer_getoverrun(tp->timerid);
+   if (overrun)
+   ODP_ERR("\n\tlow resolution!, overrun ticks: %d\n", 
overrun);

Actually the timer resolution isn't too low (low resolution <=> long period) 
but too high (too short period for the system to handle).

"Ticks lost on timer %s, timer resolution too high\n", tpid->name

+
  #ifdef __ARM_ARCH
 odp_timer *array = >timers[0];
 uint32_t i;
--
1.9.1

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




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


Re: [lng-odp] [PATCH 1/2] linux-generic: pktio: recover from transmit errors

2015-11-11 Thread Elo, Matias (Nokia - FI/Espoo)
Sure, I'll check them.

-Matias

> -Original Message-
> From: EXT Maxim Uvarov [mailto:maxim.uva...@linaro.org]
> Sent: Wednesday, November 11, 2015 1:53 PM
> To: lng-odp@lists.linaro.org; Elo, Matias (Nokia - FI/Espoo)
> 
> Subject: Re: [lng-odp] [PATCH 1/2] linux-generic: pktio: recover from transmit
> errors
> 
> Hello Matias,
> 
> can you please review and test that patches in your env? To be sure that
> bug is totally fixed.
> 
> Thank you,
> Maxim.
> 
> On 11/10/2015 21:24, Stuart Haslam wrote:
> > Fix the way transmit errors are handled to avoid getting out of sync
> > between kernel and user space, which causes transmission to hang.
> >
> > Fixes bug https://bugs.linaro.org/show_bug.cgi?id=1890
> >
> > Signed-off-by: Stuart Haslam 
> > ---
> >   platform/linux-generic/pktio/socket_mmap.c | 59
> +-
> >   1 file changed, 41 insertions(+), 18 deletions(-)
> >
> > diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-
> generic/pktio/socket_mmap.c
> > index 79ff82d..2bdb72b 100644
> > --- a/platform/linux-generic/pktio/socket_mmap.c
> > +++ b/platform/linux-generic/pktio/socket_mmap.c
> > @@ -182,6 +182,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct
> ring *ring,
> > unsigned n, i = 0;
> > unsigned nb_tx = 0;
> > int send_errno;
> > +   int total_len = 0;
> >
> > first_frame_num = ring->frame_num;
> > frame_num = first_frame_num;
> > @@ -195,6 +196,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct
> ring *ring,
> > pkt_len = odp_packet_len(pkt_table[i]);
> > ppd.v2->tp_h.tp_snaplen = pkt_len;
> > ppd.v2->tp_h.tp_len = pkt_len;
> > +   total_len += pkt_len;
> >
> > buf = (uint8_t *)ppd.raw + TPACKET2_HDRLEN -
> >sizeof(struct sockaddr_ll);
> > @@ -215,28 +217,49 @@ static inline unsigned pkt_mmap_v2_tx(int sock,
> struct ring *ring,
> >  * failure a value of -1 is returned, even if the failure occurred
> >  * after some of the packets in the ring have already been sent, so we
> >  * need to inspect the packet status to determine which were sent. */
> > -   for (frame_num = first_frame_num, n = 0; n < i; ++n) {
> > -   struct tpacket2_hdr *hdr = ring->rd[frame_num].iov_base;
> > +   if (odp_likely(ret == total_len)) {
> > +   nb_tx = i;
> > +   ring->frame_num = frame_num;
> > +   } else if (ret == -1) {
> > +   for (frame_num = first_frame_num, n = 0; n < i; ++n) {
> > +   struct tpacket2_hdr *hdr = ring-
> >rd[frame_num].iov_base;
> > +
> > +   if (odp_likely(hdr->tp_status == TP_STATUS_AVAILABLE
> ||
> > +  hdr->tp_status == TP_STATUS_SENDING)) {
> > +   nb_tx++;
> > +   } else {
> > +   /* The remaining frames weren't sent, clear
> > +* their status to indicate we're not waiting
> > +* for the kernel to process them. */
> > +   hdr->tp_status = TP_STATUS_AVAILABLE;
> > +   }
> >
> > -   if (odp_likely(hdr->tp_status == TP_STATUS_AVAILABLE)) {
> > -   nb_tx++;
> > -   } else if (hdr->tp_status & TP_STATUS_WRONG_FORMAT) {
> > -   /* status will be cleared on the next send request */
> > -   break;
> > +   if (++frame_num >= frame_count)
> > +   frame_num = 0;
> > }
> >
> > -   if (++frame_num >= frame_count)
> > -   frame_num = 0;
> > -   }
> > -
> > -   ring->frame_num = (ring->frame_num + nb_tx) % frame_count;
> > +   ring->frame_num = (first_frame_num + nb_tx) % frame_count;
> > +
> > +   if (nb_tx == 0 && SOCK_ERR_REPORT(send_errno)) {
> > +   __odp_errno = send_errno;
> > +   /* ENOBUFS indicates that the transmit queue is full,
> > +* which will happen regularly when overloaded so don't
> > +* print it */
> > +   if (errno != ENOBUFS)
> > +   ODP_ERR("sendto(pkt mmap): %s\n",
> > +   strerror(send_errno));
> > +   return -1;
> > +   }
> > +   } else {
> > +   /* Short send, return value is number of bytes sent so use this
> > +* to determine number of complete frames sent. */
> > +   for (n = 0; n < i && ret > 0; ++n) {
> > +   ret -= odp_packet_len(pkt_table[n]);
> > +   if (ret >= 0)
> > +   nb_tx++;
> > +   }
> >
> > -   if (odp_unlikely(ret == -1 &&
> > -nb_tx == 0 &&
> > -SOCK_ERR_REPORT(send_errno))) {
> > -   __odp_errno = send_errno;
> > -   

Re: [lng-odp] [PATCH 1/2] linux-generic: pktio: recover from transmit errors

2015-11-11 Thread Maxim Uvarov

Hello Matias,

can you please review and test that patches in your env? To be sure that 
bug is totally fixed.


Thank you,
Maxim.

On 11/10/2015 21:24, Stuart Haslam wrote:

Fix the way transmit errors are handled to avoid getting out of sync
between kernel and user space, which causes transmission to hang.

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

Signed-off-by: Stuart Haslam 
---
  platform/linux-generic/pktio/socket_mmap.c | 59 +-
  1 file changed, 41 insertions(+), 18 deletions(-)

diff --git a/platform/linux-generic/pktio/socket_mmap.c 
b/platform/linux-generic/pktio/socket_mmap.c
index 79ff82d..2bdb72b 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -182,6 +182,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring 
*ring,
unsigned n, i = 0;
unsigned nb_tx = 0;
int send_errno;
+   int total_len = 0;
  
  	first_frame_num = ring->frame_num;

frame_num = first_frame_num;
@@ -195,6 +196,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring 
*ring,
pkt_len = odp_packet_len(pkt_table[i]);
ppd.v2->tp_h.tp_snaplen = pkt_len;
ppd.v2->tp_h.tp_len = pkt_len;
+   total_len += pkt_len;
  
  		buf = (uint8_t *)ppd.raw + TPACKET2_HDRLEN -

   sizeof(struct sockaddr_ll);
@@ -215,28 +217,49 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct 
ring *ring,
 * failure a value of -1 is returned, even if the failure occurred
 * after some of the packets in the ring have already been sent, so we
 * need to inspect the packet status to determine which were sent. */
-   for (frame_num = first_frame_num, n = 0; n < i; ++n) {
-   struct tpacket2_hdr *hdr = ring->rd[frame_num].iov_base;
+   if (odp_likely(ret == total_len)) {
+   nb_tx = i;
+   ring->frame_num = frame_num;
+   } else if (ret == -1) {
+   for (frame_num = first_frame_num, n = 0; n < i; ++n) {
+   struct tpacket2_hdr *hdr = ring->rd[frame_num].iov_base;
+
+   if (odp_likely(hdr->tp_status == TP_STATUS_AVAILABLE ||
+  hdr->tp_status == TP_STATUS_SENDING)) {
+   nb_tx++;
+   } else {
+   /* The remaining frames weren't sent, clear
+* their status to indicate we're not waiting
+* for the kernel to process them. */
+   hdr->tp_status = TP_STATUS_AVAILABLE;
+   }
  
-		if (odp_likely(hdr->tp_status == TP_STATUS_AVAILABLE)) {

-   nb_tx++;
-   } else if (hdr->tp_status & TP_STATUS_WRONG_FORMAT) {
-   /* status will be cleared on the next send request */
-   break;
+   if (++frame_num >= frame_count)
+   frame_num = 0;
}
  
-		if (++frame_num >= frame_count)

-   frame_num = 0;
-   }
-
-   ring->frame_num = (ring->frame_num + nb_tx) % frame_count;
+   ring->frame_num = (first_frame_num + nb_tx) % frame_count;
+
+   if (nb_tx == 0 && SOCK_ERR_REPORT(send_errno)) {
+   __odp_errno = send_errno;
+   /* ENOBUFS indicates that the transmit queue is full,
+* which will happen regularly when overloaded so don't
+* print it */
+   if (errno != ENOBUFS)
+   ODP_ERR("sendto(pkt mmap): %s\n",
+   strerror(send_errno));
+   return -1;
+   }
+   } else {
+   /* Short send, return value is number of bytes sent so use this
+* to determine number of complete frames sent. */
+   for (n = 0; n < i && ret > 0; ++n) {
+   ret -= odp_packet_len(pkt_table[n]);
+   if (ret >= 0)
+   nb_tx++;
+   }
  
-	if (odp_unlikely(ret == -1 &&

-nb_tx == 0 &&
-SOCK_ERR_REPORT(send_errno))) {
-   __odp_errno = send_errno;
-   ODP_ERR("sendto(pkt mmap): %s\n", strerror(send_errno));
-   return -1;
+   ring->frame_num = (first_frame_num + nb_tx) % frame_count;
}
  
  	for (i = 0; i < nb_tx; ++i)


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


Re: [lng-odp] [API-NEXT PATCHv4 0/6] Add HMAC-SHA-256-128 and AES128 CBC support

2015-11-11 Thread Maxim Uvarov

Merged,
Maxim.

On 11/11/2015 10:33, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Reviewed-by: Petri Savolainen 



-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
EXT Nicolas Morey-Chaisemartin
Sent: Tuesday, November 10, 2015 5:30 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [API-NEXT PATCHv4 0/6] Add HMAC-SHA-256-128 and
AES128 CBC support

The first patch is a cleanup suggested by Petri.
All the crypto enums are moved from linux-generic back to ODP API, and
renamed (odp__t)
Following patches add support for the new HMAC function, then a
validation test and finally support in odp-ipsec
And then same things for AES128

v4:
  * add mising "api:"
  * Fix typo in API doxygen
v3:
  * correct patch name
  * add AES128 CBC support
v2:
  * Correct test vectors to match the ones from RFC4868

Jerome Reybert (1):
   api: crypto: add AES128-CBC encrypt/decrypt methods

Nicolas Morey-Chaisemartin (5):
   api: crypto: move enums from platform types to odp and rename to fit
 the API format
   api: crypto: add HMAC-SHA-256-128 support
   validation: crypto: add test for HMAC-SHA-256-128
   example: ipsec: add support for HMAC-SHA-256-128
   validation: crypto: add test for AES128 CBC

  example/ipsec/odp_ipsec.c  |   2 +-
  example/ipsec/odp_ipsec_cache.c|   2 +-
  example/ipsec/odp_ipsec_cache.h|   4 +-
  example/ipsec/odp_ipsec_misc.h |  12 +-
  example/ipsec/odp_ipsec_sa_db.c|   4 +
  example/ipsec/odp_ipsec_stream.c   |   3 +-
  include/odp/api/crypto.h   | 144 +++--
--
  .../linux-generic/include/odp/plat/crypto_types.h  |  42 -
  .../linux-generic/include/odp_crypto_internal.h|  20 +-
  platform/linux-generic/odp_crypto.c| 205
+++--
  test/validation/crypto/crypto.h|   5 +
  test/validation/crypto/odp_crypto_test_inp.c   | 182
+-
  test/validation/crypto/test_vectors.h  | 111 +++
  test/validation/crypto/test_vectors_len.h  |  10 +
  14 files changed, 592 insertions(+), 154 deletions(-)

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

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


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


Re: [lng-odp] [API-NEXT PATCH v2] api: atomic: added atomic_lock_free_u64

2015-11-11 Thread Maxim Uvarov

On 11/11/2015 17:24, Petri Savolainen wrote:

Platforms may support some uint64 operations lock-free and
others not. For example, inc_64 can be natively supported but
cas_64 (or max_64/min_64) not. User may be able to switch to
32 bit variables when a 64 bit operation uses locks. The same
atomic operation struture could be used for platform init to guide
lock vs. lock-free implementation (e.g. if cas_64 is never
called, inc_64 can be lock-free).

Signed-off-by: Petri Savolainen 
---
  include/odp/api/atomic.h| 51 +
  platform/linux-generic/Makefile.am  |  1 +
  platform/linux-generic/odp_atomic.c | 26 +++
  3 files changed, 78 insertions(+)
  create mode 100644 platform/linux-generic/odp_atomic.c

diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
index 316f13a..17a38fb 100644
--- a/include/odp/api/atomic.h
+++ b/include/odp/api/atomic.h
@@ -388,6 +388,57 @@ void odp_atomic_add_rls_u32(odp_atomic_u32_t *atom, 
uint32_t val);
  void odp_atomic_sub_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
  
  /**

+ * Atomic operations
+ *
+ * Atomic operations listed in a bit field structure.
+ */
+typedef union odp_atomic_op_t {
+   /** Operation flags */
+   struct {
+   uint32_t init  : 1;  /**< Atomic init */
+   uint32_t load  : 1;  /**< Atomic load */
+   uint32_t store : 1;  /**< Atomic store */
+   uint32_t fetch_add : 1;  /**< Atomic fetch and add */
+   uint32_t add   : 1;  /**< Atomic add */
+   uint32_t fetch_sub : 1;  /**< Atomic fetch and substract */
+   uint32_t sub   : 1;  /**< Atomic substract */
+   uint32_t fetch_inc : 1;  /**< Atomic fetch and increment */
+   uint32_t inc   : 1;  /**< Atomic increment */
+   uint32_t fetch_dec : 1;  /**< Atomic fetch and decrement */
+   uint32_t dec   : 1;  /**< Atomic decrement */
+   uint32_t min   : 1;  /**< Atomic minimum */
+   uint32_t max   : 1;  /**< Atomic maximum */
+   uint32_t cas   : 1;  /**< Atomic compare and swap */
+   uint32_t _reserved : 18; /**< Reserved - do not use */
+   } op;
+
+   /** All flags */
+   union {
+   uint32_t ops   : 14; /**< All operations*/
+   uint32_t _reserved : 18; /**< Reserved - do not use */
+
+   uint32_t bits;   /**< All bits */

bug in union.

+   } all;
+} odp_atomic_op_t;
+
+/**
+ * Query which atomic uint64 operations are lock-free
+ *
+ * Lock-free implementations have higher performance and scale better than
+ * implementations using locks. User can decide to use e.g. uint32 atomic
+ * variables instead of uint64 to optimize performance on platforms that
+ * implement a performance critical operation using locks.
+ *
+ * @param atomic_op  Pointer to atomic operation structure for storing
+ *   operation flags. All bits are initialized to zero during
+ *   the operation. The parameter is ignored when NULL.
+ * @retval 0 None of the operations are lock-free
+ * @retval 1 Some of the operations are lock-free
+ * @retval 2 All operations are lock-free
+ */
+int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op);
+
+/**
   * @}
   */
  
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am

index a6b6029..0b7234e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -151,6 +151,7 @@ noinst_HEADERS = \
  ${srcdir}/Makefile.inc
  
  __LIB__libodp_la_SOURCES = \

+  odp_atomic.c \
   odp_barrier.c \
   odp_buffer.c \
   odp_classification.c \
diff --git a/platform/linux-generic/odp_atomic.c 
b/platform/linux-generic/odp_atomic.c
new file mode 100644
index 000..8955b41
--- /dev/null
+++ b/platform/linux-generic/odp_atomic.c
@@ -0,0 +1,26 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+
+int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op)
+{
+#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2
+   /* All operations have locks */
+   if (atomic_op)
+   atomic_op->all.bits = 0;
+
+   return 0;
+#else
+   /* All operations are lock-free */
+   if (atomic_op) {
+   atomic_op->all.bits = 0;
+   atomic_op->all.ops  = 0x3fff;
+   }
+
+   return 2;
+#endif
+}


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


Re: [lng-odp] Runtime inlining

2015-11-11 Thread Mike Holmes
On 11 November 2015 at 00:45, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> > EXT Nicolas Morey-Chaisemartin
> > Sent: Tuesday, November 10, 2015 5:13 PM
> > To: Zoltan Kiss; linaro-toolch...@lists.linaro.org
> > Cc: lng-odp
> > Subject: Re: [lng-odp] Runtime inlining
> >
> > As I said in the call last week, the problem is wider than that.
> >
> > ODP specifies a lot of types but not their sizes, a lot of
> > enums/defines (things like ODP_PKTIO_INVALID) but not their value
> > either.
> > For our port a lot of those values were changed for
> > performance/implementation reason. So I'm not even compatible between
> > one version of our ODP port and another one.
> >
> > The only way I can see to solve this is for ODP to fix the size of all
> > these types.
> > Default/Invalid values are not that easy, as a pointer would have a
> > completely different behaviour from structs/bitfields
> >
> > Nicolas
> >
>
> Type sizes do not need to be fixed in general, but only when an
> application is build for binary compatibility (the use case we are talking
> here). Binary compatibility and thus the fixed type sizes are defined per
> ISA.
>
> We can e.g. define a configure target (for our reference implementation ==
> linux-generic) "--binary-compatible=armv8.x" or
> "--binary-compatible=x86_64". When you build your application with that
> option, "platform dependent" types and constants would be fixed to
> pre-defined values specified in (new) ODP API arch files.
>
> So instead of building against
> odp/platform/linux-generic/include/odp/plat/queue_types.h ...
>
> typedef ODP_HANDLE_T(odp_queue_t);
> #define ODP_QUEUE_INVALID  _odp_cast_scalar(odp_queue_t, 0)
> #define ODP_QUEUE_NAME_LEN 32
>
>
> ... you'd build against odp/arch/armv8.x/include/odp/queue_types.h ...
>


With the introduction of odp/arch at the top level I think we should also
move platform/linux-generic/arch to the same location


> typedef uintptr_t odp_queue_t;
> #define ODP_QUEUE_INVALID  ((uintptr_t)0)
> #define ODP_QUEUE_NAME_LEN 64
>
>
> ... or odp/arch/x86_64/include/odp/queue_types.h
>
> typedef uint64_t odp_queue_t;
> #define ODP_QUEUE_INVALID  ((uint64_t)0x)
> #define ODP_QUEUE_NAME_LEN 32
>
>
> For highest performance on a fixed target platform, you'd still build
> against the platform directly
>
> odp/platform//include/odp/plat/queue_types.h
>
> typedef xyz_queue_desc_t * odp_queue_t;
> #define ODP_QUEUE_INVALID  ((xyz_queue_desc_t *)0xdeadbeef)
> #define ODP_QUEUE_NAME_LEN 20
>
>
> -Petri
>
>
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org  *│ *Open source software for ARM SoCs
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 3/3] linux-generic: locks: revise implementation of recursive rwlocks

2015-11-11 Thread Savolainen, Petri (Nokia - FI/Espoo)
The problem should be solved by shared memory alloc, instead of using #define. 
We should minimize #defines in the API.

-Petri


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> EXT Bill Fischofer
> Sent: Wednesday, November 11, 2015 3:43 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCH 3/3] linux-generic: locks: revise
> implementation of recursive rwlocks
> 
> Change linux-generic implementation of rwlock_recursive types to
> reference the externally visible ODP_CONFIG_THREADS symbol rather than
> the internal _ODP_INTERNAL_MAX_THREADS symbol. This avoids causing
> issues with installed copies of ODP that do not export internal
> symbols.
> 
> Signed-off-by: Bill Fischofer 
> ---
>  platform/linux-generic/include/odp/plat/rwlock_recursive_types.h | 4
> ++--
>  platform/linux-generic/include/odp_config_internal.h | 2
> +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/platform/linux-
> generic/include/odp/plat/rwlock_recursive_types.h b/platform/linux-
> generic/include/odp/plat/rwlock_recursive_types.h
> index d5bfb92..5989e26 100644
> --- a/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
> +++ b/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
> @@ -19,14 +19,14 @@ extern "C" {
> 
>  #include 
>  #include 
> -#include 
> +#include 
> 
>  /** @internal */
>  struct odp_rwlock_recursive_s {
>   odp_rwlock_t lock;   /**< the lock */
>   int wr_owner;/**< write owner thread
> */
>   uint32_t wr_cnt; /**< write recursion
> count */
> - uint8_t  rd_cnt[_ODP_INTERNAL_MAX_THREADS]; /**< read recursion
> count */
> + uint8_t  rd_cnt[ODP_CONFIG_THREADS]; /**< read recursion
> count */
>  };
> 
>  typedef struct odp_rwlock_recursive_s odp_rwlock_recursive_t;
> diff --git a/platform/linux-generic/include/odp_config_internal.h
> b/platform/linux-generic/include/odp_config_internal.h
> index 4f20ff8..c484ce6 100644
> --- a/platform/linux-generic/include/odp_config_internal.h
> +++ b/platform/linux-generic/include/odp_config_internal.h
> @@ -20,7 +20,7 @@ extern "C" {
>  /**
>   * Maximum number of threads
>   */
> -#define _ODP_INTERNAL_MAX_THREADS  128
> +#define _ODP_INTERNAL_MAX_THREADS  ODP_CONFIG_THREADS
> 
>  #ifdef __cplusplus
>  }
> --
> 2.1.4
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH 3/3] linux-generic: locks: revise implementation of recursive rwlocks

2015-11-11 Thread Bill Fischofer
Do you want to revise your patch to do this?  I'm just looking for a simple
way of resolving the compile issue.  The alternative would be to move the
#define you're currently using to a public platform file (e.g.,
platform/linux-generic/include/odp/plat/rwlock_recursive_types.h

On Wed, Nov 11, 2015 at 4:04 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> The problem should be solved by shared memory alloc, instead of using
> #define. We should minimize #defines in the API.
>
> -Petri
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> > EXT Bill Fischofer
> > Sent: Wednesday, November 11, 2015 3:43 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCH 3/3] linux-generic: locks: revise
> > implementation of recursive rwlocks
> >
> > Change linux-generic implementation of rwlock_recursive types to
> > reference the externally visible ODP_CONFIG_THREADS symbol rather than
> > the internal _ODP_INTERNAL_MAX_THREADS symbol. This avoids causing
> > issues with installed copies of ODP that do not export internal
> > symbols.
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> >  platform/linux-generic/include/odp/plat/rwlock_recursive_types.h | 4
> > ++--
> >  platform/linux-generic/include/odp_config_internal.h | 2
> > +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/platform/linux-
> > generic/include/odp/plat/rwlock_recursive_types.h b/platform/linux-
> > generic/include/odp/plat/rwlock_recursive_types.h
> > index d5bfb92..5989e26 100644
> > --- a/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
> > +++ b/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
> > @@ -19,14 +19,14 @@ extern "C" {
> >
> >  #include 
> >  #include 
> > -#include 
> > +#include 
> >
> >  /** @internal */
> >  struct odp_rwlock_recursive_s {
> >   odp_rwlock_t lock;   /**< the lock */
> >   int wr_owner;/**< write owner thread
> > */
> >   uint32_t wr_cnt; /**< write recursion
> > count */
> > - uint8_t  rd_cnt[_ODP_INTERNAL_MAX_THREADS]; /**< read recursion
> > count */
> > + uint8_t  rd_cnt[ODP_CONFIG_THREADS]; /**< read recursion
> > count */
> >  };
> >
> >  typedef struct odp_rwlock_recursive_s odp_rwlock_recursive_t;
> > diff --git a/platform/linux-generic/include/odp_config_internal.h
> > b/platform/linux-generic/include/odp_config_internal.h
> > index 4f20ff8..c484ce6 100644
> > --- a/platform/linux-generic/include/odp_config_internal.h
> > +++ b/platform/linux-generic/include/odp_config_internal.h
> > @@ -20,7 +20,7 @@ extern "C" {
> >  /**
> >   * Maximum number of threads
> >   */
> > -#define _ODP_INTERNAL_MAX_THREADS  128
> > +#define _ODP_INTERNAL_MAX_THREADS  ODP_CONFIG_THREADS
> >
> >  #ifdef __cplusplus
> >  }
> > --
> > 2.1.4
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv9 0/4] Egress Traffic Manager

2015-11-11 Thread Maxim Uvarov

odp_name_table.c: In function 'hash_name_and_kind':
odp_name_table.c:277:2: error: implicit declaration of function 
'__crc32w' [-Werror=implicit-function-declaration]

  PLATFORM_HASH32_INIT(hash_state, name_len);
  ^
odp_name_table.c:277:2: error: nested extern declaration of '__crc32w' 
[-Werror=nested-externs]



On 11/11/2015 18:25, Bill Fischofer wrote:

Changes in v9
- Rebase on top of latest queue fixes

Changes in v8
- add ARM definition for __crc32w() function (from Alex)

Changes in v7 (review comments by Maxim)
- Correct architecture ifdefs (use of arch dir in later patch)
- Correct doxygen for queue types
- Change internal APIs that use odp_ prefix to use _odp prefix
- Rebase to latest api-next

Changes in v6
- Move documentation of packet colors to main API file
- Add ODP prefix to odp_tm_egress_kind_t enums

Changes in v5
- Add include file odp_traffic_mngr_internal.h
- Add support for odp_tm_enq() from packets originating from ordered queues

Changes in v4
- Incorporate API changes suggested by Petri

Changes in v3
- Fix checkpatch errors (Bill)

Changes in v2
- Full patch submission (Barry)


Barry Spinney (4):
   api: tm: add tm API definitions
   linux-generic: tm: implement traffic manager
   linux-generic: tm: add tm to build
   example: tm: traffic manager example

  configure.ac   |1 +
  example/Makefile.am|2 +-
  example/traffic_mgmt/.gitignore|1 +
  example/traffic_mgmt/Makefile.am   |9 +
  example/traffic_mgmt/odp_traffic_mgmt.c|  781 ++
  include/odp.h  |1 +
  include/odp/api/packet.h   |   69 +
  include/odp/api/traffic_mngr.h | 1611 +++
  platform/linux-generic/Makefile.am |   13 +
  .../linux-generic/include/odp/plat/packet_types.h  |   11 +
  .../linux-generic/include/odp/plat/queue_types.h   |7 +
  .../include/odp/plat/traffic_mngr_types.h  |  185 ++
  platform/linux-generic/include/odp/traffic_mngr.h  |   35 +
  platform/linux-generic/include/odp_internal.h  |2 +
  .../include/odp_name_table_internal.h  |   61 +
  .../linux-generic/include/odp_packet_internal.h|5 +
  .../linux-generic/include/odp_pkt_queue_internal.h |   62 +
  .../linux-generic/include/odp_queue_internal.h |6 +
  .../include/odp_sorted_list_internal.h |   78 +
  .../include/odp_timer_wheel_internal.h |   68 +
  .../include/odp_traffic_mngr_internal.h|  324 +++
  platform/linux-generic/odp_init.c  |5 +
  platform/linux-generic/odp_name_table.c| 1365 ++
  platform/linux-generic/odp_packet_flags.c  |   46 +-
  platform/linux-generic/odp_pkt_queue.c |  379 +++
  platform/linux-generic/odp_queue.c |   60 +
  platform/linux-generic/odp_sorted_list.c   |  271 ++
  platform/linux-generic/odp_timer_wheel.c   |  907 +++
  platform/linux-generic/odp_traffic_mngr.c  | 2799 
  29 files changed, 9162 insertions(+), 2 deletions(-)
  create mode 100644 example/traffic_mgmt/.gitignore
  create mode 100644 example/traffic_mgmt/Makefile.am
  create mode 100644 example/traffic_mgmt/odp_traffic_mgmt.c
  create mode 100644 include/odp/api/traffic_mngr.h
  create mode 100644 
platform/linux-generic/include/odp/plat/traffic_mngr_types.h
  create mode 100644 platform/linux-generic/include/odp/traffic_mngr.h
  create mode 100644 platform/linux-generic/include/odp_name_table_internal.h
  create mode 100644 platform/linux-generic/include/odp_pkt_queue_internal.h
  create mode 100644 platform/linux-generic/include/odp_sorted_list_internal.h
  create mode 100644 platform/linux-generic/include/odp_timer_wheel_internal.h
  create mode 100644 platform/linux-generic/include/odp_traffic_mngr_internal.h
  create mode 100644 platform/linux-generic/odp_name_table.c
  create mode 100644 platform/linux-generic/odp_pkt_queue.c
  create mode 100644 platform/linux-generic/odp_sorted_list.c
  create mode 100644 platform/linux-generic/odp_timer_wheel.c
  create mode 100644 platform/linux-generic/odp_traffic_mngr.c



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


Re: [lng-odp] [PATCH 7/9] linux-generic: netmap: support segmented packets

2015-11-11 Thread Maxim Uvarov

Hi Stuart,

You will send updated patch, right?

Maxim.

On 10/30/2015 13:05, Stuart Haslam wrote:

On Thu, Oct 29, 2015 at 02:54:59PM +0300, Maxim Uvarov wrote:

On 10/28/2015 22:29, Stuart Haslam wrote:

Replace the nm_inject() helper with our own version so that
odp_packet_copydata_out() can be used as this understands segmented
packets.

Signed-off-by: Stuart Haslam 
---
  platform/linux-generic/pktio/netmap.c | 59 ---
  1 file changed, 54 insertions(+), 5 deletions(-)

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 7d47fc1..d72af3d 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -268,32 +268,81 @@ static int netmap_recv(pktio_entry_t *pktio_entry, 
odp_packet_t pkt_table[],
return args.nb_rx;
  }
+static struct netmap_ring *netmap_tx_ring(struct nm_desc *d)
+{
+   unsigned c, n = d->last_tx_ring - d->first_tx_ring + 1;
+
+   for (c = 0; c < n ; c++) {

why c and not i as everywhere? Also can n be some read friendly
name, like num_rings?

Maxim.

OK. This started out as a copy of nm_inject() and the variable names
initially came from there.



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