Re: [lng-odp] [API-NEXT PATCHv4 1/6] api: packet: add user metadata APIs

2015-04-20 Thread Mike Holmes
On 20 April 2015 at 15:56, Bill Fischofer bill.fischo...@linaro.org wrote:

 User metadata is orthogonal to the existing user_ptr/u64 because we didn't
 change the latter when we added the former.  If we want to deprecate the
 latter in favor of the former, that's a separate API change.

 We have to be very careful to not make unnecessary changes to existing
 APIs at this point. Introducing new APIs is fine and deprecating old ones
 is fine (with an appropriate transition period), but yanking APIs as part
 of introducing new ones is a no-no.  That's the sort of gratuitous change
 that applications really don't like.


I think you have a good point - we have a marker in the API already

#define ODP_DEPRECATED
http://docs.opendataplane.org/linux-generic-doxygen-html/group__odp__compiler__optim.html#ga76d645458c64fb14622e94b5bceae186
   __attribute__((__deprecated__)) Indicate deprecated variables, functions
or types.

But we have never before had to depreciate anything, our guide lines
http://docs.opendataplane.org/linux-generic-doxygen-html/api_guide_lines.html
should
be updated to state our deprecation policy, I will try gather some words.

I propose we can leave it in the public API for the next 2 major releases
perhaps. Of course then a vendor should possibly be free to not implement
deprecated APIs, their customers may not be happy. This ripples on becasue
then those deprecated APIs need to be come part of the optional tests in
test/validation.

On Mon, Apr 20, 2015 at 6:39 AM, Ola Liljedahl ola.liljed...@linaro.org
 wrote:

 On 16 April 2015 at 15:01, Savolainen, Petri (Nokia - FI/Espoo) 
 petri.savolai...@nokia.com wrote:



  -Original Message-
  From: ext Taras Kondratiuk [mailto:taras.kondrat...@linaro.org]
  Sent: Thursday, April 16, 2015 3:13 PM
  To: Savolainen, Petri (Nokia - FI/Espoo); Bill Fischofer
  Cc: lng-odp@lists.linaro.org
  Subject: Re: [lng-odp] [API-NEXT PATCHv4 1/6] api: packet: add user
  metadata APIs
 
  On 04/16/2015 02:40 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:
  
  
   -Original Message-
   From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf
 Of
  ext
   Taras Kondratiuk
   Sent: Thursday, April 16, 2015 12:05 PM
   To: Bill Fischofer; lng-odp@lists.linaro.org
   Subject: Re: [lng-odp] [API-NEXT PATCHv4 1/6] api: packet: add user
   metadata APIs
  
   On 04/10/2015 06:52 PM, Bill Fischofer wrote:
   Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
   ---
  include/odp/api/packet.h | 20 
  1 file changed, 20 insertions(+)
  
   diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
   index a31c54d..840e152 100644
   --- a/include/odp/api/packet.h
   +++ b/include/odp/api/packet.h
   @@ -467,6 +467,26 @@ uint64_t odp_packet_user_u64(odp_packet_t
 pkt);
  void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx);
  
  /**
   + * Get address of user metadata associated with a packet
   + *
   + * @param pkt Packet handle
   + *
   + * @retval addr   Address of the user metadata associated
  with
   pkt
   + * @retval NULL   The packet has no user metadata.
   + */
   +void *odp_packet_user_data(odp_packet_t pkt);
   +
   +/**
   + * Get size of user metadata associated with a packet
   + *
   + * @param pkt Packet handle
   + *
   + * @returnNumber of bytes of user metadata
 associated
   + *with pkt.
   + */
   +uint32_t odp_packet_user_data_size(odp_packet_t pkt);
   +
   +/**
   * Layer 2 start pointer
   *
   * Returns pointer to the start of the layer 2 header.
 Optionally,
   outputs
  
  
   I assume usage of user_data, user_ptr and user_u64 are all mutually
   exclusive. I mean the same memory location can be used to store all
 of
   them. It should be noted somewhere.
  
   I was thinking this as a separate area, but maybe it's clearer that
 we
  have only one user metadata area, which is always at least 8 bytes
  (user_ptr / user_64). An additional area is allocated, when user
 requests
  pool_param.udata_size 8 bytes. Implementation can always reserve 8
 bytes
  in the descriptor and use the same bytes for the pointer to a larger
 udata
  area.
 
  Actually having three ways (and six! API functions) to access packets'
  user data is too much. And it is confusing. Now we have to explain in
  comments how all these three ways affect each other.
 
  IMO only one user_data is enough. This is exactly what we had in the
  initial Buffer/Packet design document. Then for some reason we decided
  to switch to just a single pointer. Then we have added u64. And now we
  are bringing configurable udata back. I haven't quite followed the
  logic.

 Simple set/get ptr is easier to pack into the packet descriptor itself
 (those bytes do not have to aligned or even linear in the memory). And
 usually one pointer is enough for the application. U64 is there to avoid
 ptr vs. uint cast problems.

 The 

Re: [lng-odp] [PATCH 1/9] api: packet_io: change word instance to interface

2015-04-20 Thread Savolainen, Petri (Nokia - FI/Espoo)
Ignore this series. I forgot to prefix it with API-NEXT. Just sent out those 
again with the correct subject line.

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


[lng-odp] [PATCH 5/9] api: packet_io: added start and stop

2015-04-20 Thread Petri Savolainen
Packet IO start and stop enable a controlled setup and
tear down phases.

Interface control sequence:
* odp_pktio_open() creates a pktio interface object
* potential interface configurations (classification, input queues, etc)
* odp_pktio_start() enables packet input/output
* receive / transmit packets
* odp_pktio_stop() disables packet input/output
* drain remaining packets from queues
* remove / destroy input queues
* odp_pktio_close() destroys the pktio interface object

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 include/odp/api/packet_io.h | 20 
 1 file changed, 20 insertions(+)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 97f79ee..6e77705 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -118,6 +118,26 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t 
pool,
   const odp_pktio_param_t *param);
 
 /**
+ * Start packet receive and transmit
+ *
+ * @param pktio  Packet IO handle
+ *
+ * @retval 0 on success
+ * @retval 0 on failure
+ */
+int odp_pktio_start(odp_pktio_t pktio);
+
+/**
+ * Stop packet receive and transmit
+ *
+ * @param pktio  Packet IO handle
+ *
+ * @retval 0 on success
+ * @retval 0 on failure
+ */
+int odp_pktio_stop(odp_pktio_t pktio);
+
+/**
  * Close a packet IO interface
  *
  * @param pktio  Packet IO handle
-- 
2.3.5

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


[lng-odp] [PATCH 4/9] api: packet_io: added parse mode

2015-04-20 Thread Petri Savolainen
Application can indicate which packet parsing results it is
interested in (all, none or selected).

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 include/odp/api/packet_flags.h | 26 ++
 include/odp/api/packet_io.h| 19 +++
 2 files changed, 45 insertions(+)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index bfbcc94..9444fdc 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -26,6 +26,32 @@ extern C {
  *  @{
  */
 
+
+/**
+ * Packet input parsing flags
+ *
+ * Each flag represents a parser output. See parser output functions for
+ * details.
+ */
+typedef struct odp_packet_parse_flags_t {
+   uint32_t eth:1;   /** See odp_packet_has_eth() */
+   uint32_t jumbo:1; /** See odp_packet_has_jumbo() */
+   uint32_t vlan:1;  /** See odp_packet_has_vlan() */
+   uint32_t vlan_qinq:1; /** See odp_packet_has_vlan_qinq() */
+   uint32_t arp:1;   /** See odp_packet_has_arp() */
+   uint32_t ipv4:1;  /** See odp_packet_has_ipv4() */
+   uint32_t ipv6:1;  /** See odp_packet_has_ipv6() */
+   uint32_t ipfrag:1;/** See odp_packet_has_ipfrag() */
+   uint32_t ipopt:1; /** See odp_packet_has_ipopt() */
+   uint32_t ipsec:1; /** See odp_packet_has_ipsec() */
+   uint32_t udp:1;   /** See odp_packet_has_udp() */
+   uint32_t tcp:1;   /** See odp_packet_has_tcp() */
+   uint32_t sctp:1;  /** See odp_packet_has_sctp() */
+   uint32_t icmp:1;  /** See odp_packet_has_icmp() */
+
+   uint32_t _reserved1:18; /** Reserved. Do not use. */
+} odp_packet_parse_flags_t;
+
 /**
  * Check for packet errors
  *
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 77c207e..97f79ee 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -18,6 +18,8 @@
 extern C {
 #endif
 
+#include odp/packet_flags.h
+
 /** @defgroup odp_packet_io ODP PACKET IO
  *  Operations on a packet.
  *  @{
@@ -58,6 +60,19 @@ enum odp_pktio_input_mode {
 };
 
 /**
+ * Packet parsing mode
+ */
+enum odp_pktio_parse_mode {
+   /** Parse all protocols */
+   ODP_PKTIN_PARSE_ALL = 0,
+   /** Parsing not needed */
+   ODP_PKTIN_PARSE_NONE,
+   /** Parsing can be limited to the flags set in
+   odp_packet_parse_flags_t */
+   ODP_PKTIN_PARSE_SELECTED
+};
+
+/**
  * Packet IO parameters
  *
  * In minimum, user must select the input mode. Use 0 for defaults. Initialize
@@ -66,6 +81,10 @@ enum odp_pktio_input_mode {
 typedef struct odp_pktio_param_t {
/** Packet input mode */
enum odp_pktio_input_mode in_mode;
+   /** Packet parse mode */
+   enum odp_pktio_parse_mode parse_mode;
+   /** Parse selection when parse_mode is ODP_PKTIN_PARSE_SELECTED */
+   odp_packet_parse_flags_t parse;
 } odp_pktio_param_t;
 
 /**
-- 
2.3.5

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


[lng-odp] [PATCH 2/9] api: packet_io: remove excess references to ODP

2015-04-20 Thread Petri Savolainen
All handles are ODP types, no need to repeat that.

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 include/odp/api/packet_io.h | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 5446999..ed85390 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -25,7 +25,7 @@ extern C {
 
 /**
  * @typedef odp_pktio_t
- * ODP packet IO handle
+ * Packet IO handle
  */
 
 /**
@@ -45,7 +45,7 @@ extern C {
  */
 
 /**
- * Open an ODP packet IO interface
+ * Open a packet IO interface
  *
  * An ODP program can open a single packet IO interface per device, attempts
  * to open an already open device will fail, returning ODP_PKTIO_INVALID with
@@ -56,7 +56,7 @@ extern C {
  * @param pool   Default pool from which to allocate buffers for storing 
packets
  *   received over this packet IO
  *
- * @return ODP packet IO handle
+ * @return Packet IO handle
  * @retval ODP_PKTIO_INVALID on failure
  *
  * @note dev name loop is specially pktio reserved name for device used for
@@ -73,9 +73,9 @@ extern C {
 odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool);
 
 /**
- * Close an ODP packet IO interface
+ * Close a packet IO interface
  *
- * @param pktio  ODP packet IO handle
+ * @param pktio  Packet IO handle
  *
  * @retval 0 on success
  * @retval 0 on failure
@@ -87,7 +87,7 @@ int odp_pktio_close(odp_pktio_t pktio);
  *
  * @param dev Packet IO device name
  *
- * @return ODP packet IO handle
+ * @return Packet IO handle
  * @retval ODP_PKTIO_INVALID on failure
  */
 odp_pktio_t odp_pktio_lookup(const char *dev);
@@ -95,7 +95,7 @@ odp_pktio_t odp_pktio_lookup(const char *dev);
 /**
  * Receive packets
  *
- * @param pktio   ODP packet IO handle
+ * @param pktio   Packet IO handle
  * @param pkt_table[] Storage for received packets (filled by function)
  * @param len Length of pkt_table[], i.e. max number of pkts to receive
  *
@@ -107,7 +107,7 @@ int odp_pktio_recv(odp_pktio_t pktio, odp_packet_t 
pkt_table[], int len);
 /**
  * Send packets
  *
- * @param pktioODP packet IO handle
+ * @param pktioPacket IO handle
  * @param pkt_table[]  Array of packets to send
  * @param len  length of pkt_table[]
  *
@@ -119,7 +119,7 @@ int odp_pktio_send(odp_pktio_t pktio, odp_packet_t 
pkt_table[], int len);
 /**
  * Set the default input queue to be associated with a pktio handle
  *
- * @param pktioODP packet IO handle
+ * @param pktioPacket IO handle
  * @param queuedefault input queue set
  * @retval  0 on success
  * @retval 0 on failure
@@ -129,7 +129,7 @@ int odp_pktio_inq_setdef(odp_pktio_t pktio, odp_queue_t 
queue);
 /**
  * Get default input queue associated with a pktio handle
  *
- * @param pktio  ODP packet IO handle
+ * @param pktio  Packet IO handle
  *
  * @return Default input queue set
  * @retval ODP_QUEUE_INVALID on failure
@@ -139,7 +139,7 @@ odp_queue_t odp_pktio_inq_getdef(odp_pktio_t pktio);
 /**
  * Remove default input queue (if set)
  *
- * @param pktio  ODP packet IO handle
+ * @param pktio  Packet IO handle
  *
  * @retval 0 on success
  * @retval 0 on failure
@@ -149,7 +149,7 @@ int odp_pktio_inq_remdef(odp_pktio_t pktio);
 /**
  * Query default output queue
  *
- * @param pktio ODP packet IO handle
+ * @param pktio Packet IO handle
  *
  * @return Default out queue
  * @retval ODP_QUEUE_INVALID on failure
@@ -159,7 +159,7 @@ odp_queue_t odp_pktio_outq_getdef(odp_pktio_t pktio);
 /**
  * Return the currently configured MTU value of a packet IO interface.
  *
- * @param[in] pktio  ODP packet IO handle.
+ * @param[in] pktio  Packet IO handle.
  *
  * @return MTU value on success
  * @retval 0 on failure
@@ -169,7 +169,7 @@ int odp_pktio_mtu(odp_pktio_t pktio);
 /**
  * Enable/Disable promiscuous mode on a packet IO interface.
  *
- * @param[in] pktioODP packet IO handle.
+ * @param[in] pktioPacket IO handle.
  * @param[in] enable   1 to enable, 0 to disable.
  *
  * @retval 0 on success
@@ -180,7 +180,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t pktio, 
odp_bool_t enable);
 /**
  * Determine if promiscuous mode is enabled for a packet IO interface.
  *
- * @param[in] pktio ODP packet IO handle.
+ * @param[in] pktio Packet IO handle.
  *
  * @retval  1 if promiscuous mode is enabled.
  * @retval  0 if promiscuous mode is disabled.
@@ -191,7 +191,7 @@ int odp_pktio_promisc_mode(odp_pktio_t pktio);
 /**
  * Get the default MAC address of a packet IO interface.
  *
- * @param  pktio ODP packet IO handle
+ * @param  pktio Packet IO handle
  * @param[out] mac_addr  Output buffer (use ODP_PKTIO_MACADDR_MAXSIZE)
  * @param   size  Size of output buffer
  *
-- 
2.3.5

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


[lng-odp] [Bug 1450] odp_timer_test: unstable results

2015-04-20 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1450

--- Comment #3 from Ola Liljedahl ola.liljed...@linaro.org ---
http://patches.opendataplane.org/patch/1409/

-- 
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] [PATCH 3/9] api: packet_io: added odp_pktio_param_t

2015-04-20 Thread Petri Savolainen
Packet IO interface level parameters are needed e.g. to
select input mode. User must select and use one input mode
(sched, poll or recv) per pktio interface.

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 example/generator/odp_generator.c  |  6 +++-
 example/ipsec/odp_ipsec.c  | 11 +-
 example/packet/odp_pktio.c | 19 +-
 include/odp/api/packet_io.h| 30 ++--
 .../linux-generic/include/odp_packet_io_internal.h |  1 +
 platform/linux-generic/odp_packet_io.c | 10 --
 test/performance/odp_l2fwd.c   | 10 +-
 .../classification/odp_classification_tests.c  |  6 +++-
 test/validation/odp_pktio.c| 41 +++---
 9 files changed, 112 insertions(+), 22 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 2ac0b47..1f9df0a 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -331,9 +331,13 @@ static odp_pktio_t create_pktio(const char *dev, 
odp_pool_t pool)
odp_pktio_t pktio;
int ret;
odp_queue_t inq_def;
+   odp_pktio_param_t pktio_param;
+
+   memset(pktio_param, 0, sizeof(pktio_param));
+   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
 
/* Open a packet IO instance */
-   pktio = odp_pktio_open(dev, pool);
+   pktio = odp_pktio_open(dev, pool, pktio_param);
 
if (pktio == ODP_PKTIO_INVALID)
EXAMPLE_ABORT(Error: pktio create failed for %s\n, dev);
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index cb8f535..99ccd6b 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -493,11 +493,20 @@ void initialize_intf(char *intf)
int ret;
uint8_t src_mac[ODPH_ETHADDR_LEN];
char src_mac_str[MAX_STRING];
+   odp_pktio_param_t pktio_param;
+
+   memset(pktio_param, 0, sizeof(pktio_param));
+
+#ifdef IPSEC_POLL_QUEUES
+   pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
+#else
+   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
+#endif
 
/*
 * Open a packet IO instance for thread and get default output queue
 */
-   pktio = odp_pktio_open(intf, pkt_pool);
+   pktio = odp_pktio_open(intf, pkt_pool, pktio_param);
if (ODP_PKTIO_INVALID == pktio) {
EXAMPLE_ERR(Error: pktio create failed for %s\n, intf);
exit(EXIT_FAILURE);
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 61af855..6f638c6 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -122,9 +122,26 @@ static odp_pktio_t create_pktio(const char *dev, 
odp_pool_t pool, int mode)
odp_queue_param_t qparam;
char inq_name[ODP_QUEUE_NAME_LEN];
int ret;
+   odp_pktio_param_t pktio_param;
+
+   memset(pktio_param, 0, sizeof(pktio_param));
+
+   switch (mode) {
+   case  APPL_MODE_PKT_BURST:
+   pktio_param.in_mode = ODP_PKTIN_MODE_RECV;
+   break;
+   case APPL_MODE_PKT_QUEUE:
+   pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
+   break;
+   case APPL_MODE_PKT_SCHED:
+   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
+   break;
+   default:
+   EXAMPLE_ABORT(invalid mode %d\n, mode);
+   }
 
/* Open a packet IO instance */
-   pktio = odp_pktio_open(dev, pool);
+   pktio = odp_pktio_open(dev, pool, pktio_param);
if (pktio == ODP_PKTIO_INVALID)
EXAMPLE_ABORT(Error: pktio create failed for %s\n, dev);
 
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index ed85390..77c207e 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -44,17 +44,42 @@ extern C {
  * Actual MAC address sizes may be different.
  */
 
+
+/**
+ * Packet input mode
+ */
+enum odp_pktio_input_mode {
+   /** Application polls packet input directly with odp_pktio_recv() */
+   ODP_PKTIN_MODE_RECV = 0,
+   /** Packet input through scheduled queues */
+   ODP_PKTIN_MODE_SCHED,
+   /** Application polls packet input queues */
+   ODP_PKTIN_MODE_POLL
+};
+
+/**
+ * Packet IO parameters
+ *
+ * In minimum, user must select the input mode. Use 0 for defaults. Initialize
+ * entire struct with zero to maintain API compatibility.
+ */
+typedef struct odp_pktio_param_t {
+   /** Packet input mode */
+   enum odp_pktio_input_mode in_mode;
+} odp_pktio_param_t;
+
 /**
  * Open a packet IO interface
  *
  * An ODP program can open a single packet IO interface per device, attempts
  * to open an already open device will fail, returning ODP_PKTIO_INVALID with
  * errno set. Use odp_pktio_lookup() to obtain a handle to an already open
- * device.
+ * device. Packet IO parameters provide interface level configuration options.
  *
  * 

[lng-odp] [PATCH] example: timer: clean up prescheduled events

2015-04-20 Thread Ola Liljedahl
Fixes https://bugs.linaro.org/show_bug.cgi?id=1450

Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org
---
(This document/code contribution attached is provided under the terms of
agreement LES-LTM-21309)

 example/timer/odp_timer_test.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 6b60ec4..fd31466 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -79,6 +79,41 @@ struct test_timer {
 static struct test_timer tt[256];
 
 /** @private test timeout */
+static void free_event(odp_event_t ev)
+{
+   switch (odp_event_type(ev)) {
+   case ODP_EVENT_BUFFER:
+   odp_buffer_free(odp_buffer_from_event(ev));
+   break;
+   case ODP_EVENT_PACKET:
+   odp_packet_free(odp_packet_from_event(ev));
+   break;
+   case ODP_EVENT_TIMEOUT:
+   odp_timeout_free(odp_timeout_from_event(ev));
+   break;
+   case ODP_EVENT_CRYPTO_COMPL:
+   odp_crypto_compl_free(odp_crypto_compl_from_event(ev));
+   break;
+   default:
+   fprintf(stderr, Unrecognized event type %d\n,
+   odp_event_type(ev));
+   abort();
+   }
+}
+
+/** @private test timeout */
+static void remove_prescheduled_events(void)
+{
+   odp_event_t ev;
+   odp_queue_t queue;
+   odp_schedule_pause();
+   while ((ev = odp_schedule(queue, ODP_SCHED_NO_WAIT)) !=
+   ODP_EVENT_INVALID) {
+   free_event(ev);
+   }
+}
+
+/** @private test timeout */
 static void test_abs_timeouts(int thr, test_args_t *args)
 {
uint64_t period;
@@ -173,6 +208,9 @@ static void test_abs_timeouts(int thr, test_args_t *args)
/* Since we have cancelled the timer, there is no timeout event to
 * return from odp_timer_free() */
(void)odp_timer_free(ttp-tim);
+
+   /* Remove any prescheduled events */
+   remove_prescheduled_events();
 }
 
 
-- 
1.9.1

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


[lng-odp] [PATCH API-NEXT 3/5] api: packet_io: added odp_pktio_param_t

2015-04-20 Thread Petri Savolainen
Packet IO interface level parameters are needed e.g. to
select input mode. User must select and use one input mode
(sched, poll or recv) per pktio interface.

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 example/generator/odp_generator.c  |  6 +++-
 example/ipsec/odp_ipsec.c  | 11 +-
 example/packet/odp_pktio.c | 19 +-
 include/odp/api/packet_io.h| 30 ++--
 .../linux-generic/include/odp_packet_io_internal.h |  1 +
 platform/linux-generic/odp_packet_io.c | 10 --
 test/performance/odp_l2fwd.c   | 10 +-
 .../classification/odp_classification_tests.c  |  6 +++-
 test/validation/odp_pktio.c| 41 +++---
 9 files changed, 112 insertions(+), 22 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 2ac0b47..1f9df0a 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -331,9 +331,13 @@ static odp_pktio_t create_pktio(const char *dev, 
odp_pool_t pool)
odp_pktio_t pktio;
int ret;
odp_queue_t inq_def;
+   odp_pktio_param_t pktio_param;
+
+   memset(pktio_param, 0, sizeof(pktio_param));
+   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
 
/* Open a packet IO instance */
-   pktio = odp_pktio_open(dev, pool);
+   pktio = odp_pktio_open(dev, pool, pktio_param);
 
if (pktio == ODP_PKTIO_INVALID)
EXAMPLE_ABORT(Error: pktio create failed for %s\n, dev);
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index cb8f535..99ccd6b 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -493,11 +493,20 @@ void initialize_intf(char *intf)
int ret;
uint8_t src_mac[ODPH_ETHADDR_LEN];
char src_mac_str[MAX_STRING];
+   odp_pktio_param_t pktio_param;
+
+   memset(pktio_param, 0, sizeof(pktio_param));
+
+#ifdef IPSEC_POLL_QUEUES
+   pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
+#else
+   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
+#endif
 
/*
 * Open a packet IO instance for thread and get default output queue
 */
-   pktio = odp_pktio_open(intf, pkt_pool);
+   pktio = odp_pktio_open(intf, pkt_pool, pktio_param);
if (ODP_PKTIO_INVALID == pktio) {
EXAMPLE_ERR(Error: pktio create failed for %s\n, intf);
exit(EXIT_FAILURE);
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 61af855..6f638c6 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -122,9 +122,26 @@ static odp_pktio_t create_pktio(const char *dev, 
odp_pool_t pool, int mode)
odp_queue_param_t qparam;
char inq_name[ODP_QUEUE_NAME_LEN];
int ret;
+   odp_pktio_param_t pktio_param;
+
+   memset(pktio_param, 0, sizeof(pktio_param));
+
+   switch (mode) {
+   case  APPL_MODE_PKT_BURST:
+   pktio_param.in_mode = ODP_PKTIN_MODE_RECV;
+   break;
+   case APPL_MODE_PKT_QUEUE:
+   pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
+   break;
+   case APPL_MODE_PKT_SCHED:
+   pktio_param.in_mode = ODP_PKTIN_MODE_SCHED;
+   break;
+   default:
+   EXAMPLE_ABORT(invalid mode %d\n, mode);
+   }
 
/* Open a packet IO instance */
-   pktio = odp_pktio_open(dev, pool);
+   pktio = odp_pktio_open(dev, pool, pktio_param);
if (pktio == ODP_PKTIO_INVALID)
EXAMPLE_ABORT(Error: pktio create failed for %s\n, dev);
 
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index ed85390..77c207e 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -44,17 +44,42 @@ extern C {
  * Actual MAC address sizes may be different.
  */
 
+
+/**
+ * Packet input mode
+ */
+enum odp_pktio_input_mode {
+   /** Application polls packet input directly with odp_pktio_recv() */
+   ODP_PKTIN_MODE_RECV = 0,
+   /** Packet input through scheduled queues */
+   ODP_PKTIN_MODE_SCHED,
+   /** Application polls packet input queues */
+   ODP_PKTIN_MODE_POLL
+};
+
+/**
+ * Packet IO parameters
+ *
+ * In minimum, user must select the input mode. Use 0 for defaults. Initialize
+ * entire struct with zero to maintain API compatibility.
+ */
+typedef struct odp_pktio_param_t {
+   /** Packet input mode */
+   enum odp_pktio_input_mode in_mode;
+} odp_pktio_param_t;
+
 /**
  * Open a packet IO interface
  *
  * An ODP program can open a single packet IO interface per device, attempts
  * to open an already open device will fail, returning ODP_PKTIO_INVALID with
  * errno set. Use odp_pktio_lookup() to obtain a handle to an already open
- * device.
+ * device. Packet IO parameters provide interface level configuration options.
  *
  * 

[lng-odp] [PATCH API-NEXT 4/5] api: packet_io: added parse mode

2015-04-20 Thread Petri Savolainen
Application can indicate which packet parsing results it is
interested in (all, none or selected).

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 include/odp/api/packet_flags.h | 26 ++
 include/odp/api/packet_io.h| 19 +++
 2 files changed, 45 insertions(+)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index bfbcc94..9444fdc 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -26,6 +26,32 @@ extern C {
  *  @{
  */
 
+
+/**
+ * Packet input parsing flags
+ *
+ * Each flag represents a parser output. See parser output functions for
+ * details.
+ */
+typedef struct odp_packet_parse_flags_t {
+   uint32_t eth:1;   /** See odp_packet_has_eth() */
+   uint32_t jumbo:1; /** See odp_packet_has_jumbo() */
+   uint32_t vlan:1;  /** See odp_packet_has_vlan() */
+   uint32_t vlan_qinq:1; /** See odp_packet_has_vlan_qinq() */
+   uint32_t arp:1;   /** See odp_packet_has_arp() */
+   uint32_t ipv4:1;  /** See odp_packet_has_ipv4() */
+   uint32_t ipv6:1;  /** See odp_packet_has_ipv6() */
+   uint32_t ipfrag:1;/** See odp_packet_has_ipfrag() */
+   uint32_t ipopt:1; /** See odp_packet_has_ipopt() */
+   uint32_t ipsec:1; /** See odp_packet_has_ipsec() */
+   uint32_t udp:1;   /** See odp_packet_has_udp() */
+   uint32_t tcp:1;   /** See odp_packet_has_tcp() */
+   uint32_t sctp:1;  /** See odp_packet_has_sctp() */
+   uint32_t icmp:1;  /** See odp_packet_has_icmp() */
+
+   uint32_t _reserved1:18; /** Reserved. Do not use. */
+} odp_packet_parse_flags_t;
+
 /**
  * Check for packet errors
  *
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 77c207e..97f79ee 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -18,6 +18,8 @@
 extern C {
 #endif
 
+#include odp/packet_flags.h
+
 /** @defgroup odp_packet_io ODP PACKET IO
  *  Operations on a packet.
  *  @{
@@ -58,6 +60,19 @@ enum odp_pktio_input_mode {
 };
 
 /**
+ * Packet parsing mode
+ */
+enum odp_pktio_parse_mode {
+   /** Parse all protocols */
+   ODP_PKTIN_PARSE_ALL = 0,
+   /** Parsing not needed */
+   ODP_PKTIN_PARSE_NONE,
+   /** Parsing can be limited to the flags set in
+   odp_packet_parse_flags_t */
+   ODP_PKTIN_PARSE_SELECTED
+};
+
+/**
  * Packet IO parameters
  *
  * In minimum, user must select the input mode. Use 0 for defaults. Initialize
@@ -66,6 +81,10 @@ enum odp_pktio_input_mode {
 typedef struct odp_pktio_param_t {
/** Packet input mode */
enum odp_pktio_input_mode in_mode;
+   /** Packet parse mode */
+   enum odp_pktio_parse_mode parse_mode;
+   /** Parse selection when parse_mode is ODP_PKTIN_PARSE_SELECTED */
+   odp_packet_parse_flags_t parse;
 } odp_pktio_param_t;
 
 /**
-- 
2.3.5

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


[lng-odp] [PATCH API-NEXT 5/5] api: packet_io: added start and stop

2015-04-20 Thread Petri Savolainen
Packet IO start and stop enable a controlled setup and
tear down phases.

Interface control sequence:
* odp_pktio_open() creates a pktio interface object
* potential interface configurations (classification, input queues, etc)
* odp_pktio_start() enables packet input/output
* receive / transmit packets
* odp_pktio_stop() disables packet input/output
* drain remaining packets from queues
* remove / destroy input queues
* odp_pktio_close() destroys the pktio interface object

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 include/odp/api/packet_io.h | 20 
 1 file changed, 20 insertions(+)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 97f79ee..6e77705 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -118,6 +118,26 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t 
pool,
   const odp_pktio_param_t *param);
 
 /**
+ * Start packet receive and transmit
+ *
+ * @param pktio  Packet IO handle
+ *
+ * @retval 0 on success
+ * @retval 0 on failure
+ */
+int odp_pktio_start(odp_pktio_t pktio);
+
+/**
+ * Stop packet receive and transmit
+ *
+ * @param pktio  Packet IO handle
+ *
+ * @retval 0 on success
+ * @retval 0 on failure
+ */
+int odp_pktio_stop(odp_pktio_t pktio);
+
+/**
  * Close a packet IO interface
  *
  * @param pktio  Packet IO handle
-- 
2.3.5

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


[lng-odp] [PATCH API-NEXT 2/5] api: packet_io: remove excess references to ODP

2015-04-20 Thread Petri Savolainen
All handles are ODP types, no need to repeat that.

Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 include/odp/api/packet_io.h | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 5446999..ed85390 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -25,7 +25,7 @@ extern C {
 
 /**
  * @typedef odp_pktio_t
- * ODP packet IO handle
+ * Packet IO handle
  */
 
 /**
@@ -45,7 +45,7 @@ extern C {
  */
 
 /**
- * Open an ODP packet IO interface
+ * Open a packet IO interface
  *
  * An ODP program can open a single packet IO interface per device, attempts
  * to open an already open device will fail, returning ODP_PKTIO_INVALID with
@@ -56,7 +56,7 @@ extern C {
  * @param pool   Default pool from which to allocate buffers for storing 
packets
  *   received over this packet IO
  *
- * @return ODP packet IO handle
+ * @return Packet IO handle
  * @retval ODP_PKTIO_INVALID on failure
  *
  * @note dev name loop is specially pktio reserved name for device used for
@@ -73,9 +73,9 @@ extern C {
 odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool);
 
 /**
- * Close an ODP packet IO interface
+ * Close a packet IO interface
  *
- * @param pktio  ODP packet IO handle
+ * @param pktio  Packet IO handle
  *
  * @retval 0 on success
  * @retval 0 on failure
@@ -87,7 +87,7 @@ int odp_pktio_close(odp_pktio_t pktio);
  *
  * @param dev Packet IO device name
  *
- * @return ODP packet IO handle
+ * @return Packet IO handle
  * @retval ODP_PKTIO_INVALID on failure
  */
 odp_pktio_t odp_pktio_lookup(const char *dev);
@@ -95,7 +95,7 @@ odp_pktio_t odp_pktio_lookup(const char *dev);
 /**
  * Receive packets
  *
- * @param pktio   ODP packet IO handle
+ * @param pktio   Packet IO handle
  * @param pkt_table[] Storage for received packets (filled by function)
  * @param len Length of pkt_table[], i.e. max number of pkts to receive
  *
@@ -107,7 +107,7 @@ int odp_pktio_recv(odp_pktio_t pktio, odp_packet_t 
pkt_table[], int len);
 /**
  * Send packets
  *
- * @param pktioODP packet IO handle
+ * @param pktioPacket IO handle
  * @param pkt_table[]  Array of packets to send
  * @param len  length of pkt_table[]
  *
@@ -119,7 +119,7 @@ int odp_pktio_send(odp_pktio_t pktio, odp_packet_t 
pkt_table[], int len);
 /**
  * Set the default input queue to be associated with a pktio handle
  *
- * @param pktioODP packet IO handle
+ * @param pktioPacket IO handle
  * @param queuedefault input queue set
  * @retval  0 on success
  * @retval 0 on failure
@@ -129,7 +129,7 @@ int odp_pktio_inq_setdef(odp_pktio_t pktio, odp_queue_t 
queue);
 /**
  * Get default input queue associated with a pktio handle
  *
- * @param pktio  ODP packet IO handle
+ * @param pktio  Packet IO handle
  *
  * @return Default input queue set
  * @retval ODP_QUEUE_INVALID on failure
@@ -139,7 +139,7 @@ odp_queue_t odp_pktio_inq_getdef(odp_pktio_t pktio);
 /**
  * Remove default input queue (if set)
  *
- * @param pktio  ODP packet IO handle
+ * @param pktio  Packet IO handle
  *
  * @retval 0 on success
  * @retval 0 on failure
@@ -149,7 +149,7 @@ int odp_pktio_inq_remdef(odp_pktio_t pktio);
 /**
  * Query default output queue
  *
- * @param pktio ODP packet IO handle
+ * @param pktio Packet IO handle
  *
  * @return Default out queue
  * @retval ODP_QUEUE_INVALID on failure
@@ -159,7 +159,7 @@ odp_queue_t odp_pktio_outq_getdef(odp_pktio_t pktio);
 /**
  * Return the currently configured MTU value of a packet IO interface.
  *
- * @param[in] pktio  ODP packet IO handle.
+ * @param[in] pktio  Packet IO handle.
  *
  * @return MTU value on success
  * @retval 0 on failure
@@ -169,7 +169,7 @@ int odp_pktio_mtu(odp_pktio_t pktio);
 /**
  * Enable/Disable promiscuous mode on a packet IO interface.
  *
- * @param[in] pktioODP packet IO handle.
+ * @param[in] pktioPacket IO handle.
  * @param[in] enable   1 to enable, 0 to disable.
  *
  * @retval 0 on success
@@ -180,7 +180,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t pktio, 
odp_bool_t enable);
 /**
  * Determine if promiscuous mode is enabled for a packet IO interface.
  *
- * @param[in] pktio ODP packet IO handle.
+ * @param[in] pktio Packet IO handle.
  *
  * @retval  1 if promiscuous mode is enabled.
  * @retval  0 if promiscuous mode is disabled.
@@ -191,7 +191,7 @@ int odp_pktio_promisc_mode(odp_pktio_t pktio);
 /**
  * Get the default MAC address of a packet IO interface.
  *
- * @param  pktio ODP packet IO handle
+ * @param  pktio Packet IO handle
  * @param[out] mac_addr  Output buffer (use ODP_PKTIO_MACADDR_MAXSIZE)
  * @param   size  Size of output buffer
  *
-- 
2.3.5

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


Re: [lng-odp] [RFC API-NEXT PATCH] timer: Add missing platform handles to u64 conversion functions

2015-04-20 Thread Savolainen, Petri (Nokia - FI/Espoo)
This OK, but you need to send another patch without RFC. With that change,

Reviewed-by: Petri Savolainen petri.savolai...@nokia.com


 -Original Message-
 From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext
 Jerin Jacob
 Sent: Monday, April 20, 2015 11:53 AM
 To: lng-odp@lists.linaro.org
 Subject: [lng-odp] [RFC API-NEXT PATCH] timer: Add missing platform
 handles to u64 conversion functions
 
 Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com
 ---
  include/odp/api/timer.h | 39 +++
  1 file changed, 39 insertions(+)
 
 diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
 index 0dc9415..435c004 100644
 --- a/include/odp/api/timer.h
 +++ b/include/odp/api/timer.h
 @@ -366,6 +366,45 @@ odp_timeout_t odp_timeout_alloc(odp_pool_t pool);
  void odp_timeout_free(odp_timeout_t tmo);
 
  /**
 + * Get printable value for an odp_timer_pool_t
 + *
 + * @param hdl  odp_timer_pool_t handle to be printed
 + * @return uint64_t value that can be used to print/display this
 + * handle
 + *
 + * @note This routine is intended to be used for diagnostic purposes
 + * to enable applications to generate a printable value that represents
 + * an odp_timer_pool_t handle.
 + */
 +uint64_t odp_timer_pool_to_u64(odp_timer_pool_t hdl);
 +
 +/**
 + * Get printable value for an odp_timer_t
 + *
 + * @param hdl  odp_timer_t handle to be printed
 + * @return uint64_t value that can be used to print/display this
 + * handle
 + *
 + * @note This routine is intended to be used for diagnostic purposes
 + * to enable applications to generate a printable value that represents
 + * an odp_timer_t handle.
 + */
 +uint64_t odp_timer_to_u64(odp_timer_t hdl);
 +
 +/**
 + * Get printable value for an odp_timeout_t
 + *
 + * @param hdl  odp_timeout_t handle to be printed
 + * @return uint64_t value that can be used to print/display this
 + * handle
 + *
 + * @note This routine is intended to be used for diagnostic purposes
 + * to enable applications to generate a printable value that represents
 + * an odp_timeout_t handle.
 + */
 +uint64_t odp_timeout_to_u64(odp_timeout_t hdl);
 +
 +/**
   * @}
   */
 
 --
 2.1.0
 
 ___
 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] [PATCH 1/9] api: packet_io: change word instance to interface

2015-04-20 Thread Petri Savolainen
Signed-off-by: Petri Savolainen petri.savolai...@nokia.com
---
 include/odp/api/packet_io.h | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index e960f10..5446999 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -45,11 +45,12 @@ extern C {
  */
 
 /**
- * Open an ODP packet IO instance
+ * Open an ODP packet IO interface
  *
- * Packet IO handles are single instance per device, attempts to open an 
already
- * open device will fail, returning ODP_PKTIO_INVALID with errno set.
- * odp_pktio_lookup() may be used to obtain a handle to an already open device.
+ * An ODP program can open a single packet IO interface per device, attempts
+ * to open an already open device will fail, returning ODP_PKTIO_INVALID with
+ * errno set. Use odp_pktio_lookup() to obtain a handle to an already open
+ * device.
  *
  * @param devPacket IO device name
  * @param pool   Default pool from which to allocate buffers for storing 
packets
@@ -72,7 +73,7 @@ extern C {
 odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool);
 
 /**
- * Close an ODP packet IO instance
+ * Close an ODP packet IO interface
  *
  * @param pktio  ODP packet IO handle
  *
-- 
2.3.5

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


Re: [lng-odp] [PATCH] example: timer: remove global variables to share the data between workers

2015-04-20 Thread Jerin Jacob
Adding the the complete git commit log for the commit

example: timer: remove global variables to share the data between workers.
use the odp_shared_memory allocater instead to enable the timer example
to run on baremetal/linux process execution environments.


On Mon, Apr 20, 2015 at 01:58:01PM +0530, Jerin Jacob wrote:
 Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com
 ---
  example/timer/odp_timer_test.c | 124 
 +
  1 file changed, 65 insertions(+), 59 deletions(-)
 
 diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
 index 6b60ec4..876bf33 100644
 --- a/example/timer/odp_timer_test.c
 +++ b/example/timer/odp_timer_test.c
 @@ -39,18 +39,21 @@ typedef struct {
   int tmo_count; /** Timeout count*/
  } test_args_t;
  
 -
 -/** @private Barrier for test synchronisation */
 -static odp_barrier_t test_barrier;
 -
 -/** @private Pool handle */
 -static odp_pool_t pool;
 -
 -/** @private Timer pool handle */
 -static odp_timer_pool_t tp;
 -
 -/** @private Number of timeouts to receive */
 -static odp_atomic_u32_t remain;
 +/** @private Helper struct for timers */
 +struct test_timer {
 + odp_timer_t tim;
 + odp_event_t ev;
 +};
 +
 +/** Test global variables */
 +typedef struct {
 + test_args_t args;   /** Test argunments*/
 + odp_barrier_t test_barrier; /** Barrier for test synchronisation*/
 + odp_pool_t pool;/** pool handle*/
 + odp_timer_pool_t tp;/** Timer pool handle*/
 + odp_atomic_u32_t remain;/** Number of timeouts to receive*/
 + struct test_timer tt[256];  /** Array of all timer helper structs*/
 +} test_globals_t;
  
  /** @private Timer set status ASCII strings */
  static const char *timerset2str(odp_timer_set_t val)
 @@ -69,17 +72,9 @@ static const char *timerset2str(odp_timer_set_t val)
   }
  };
  
 -/** @private Helper struct for timers */
 -struct test_timer {
 - odp_timer_t tim;
 - odp_event_t ev;
 -};
 -
 -/** @private Array of all timer helper structs */
 -static struct test_timer tt[256];
  
  /** @private test timeout */
 -static void test_abs_timeouts(int thr, test_args_t *args)
 +static void test_abs_timeouts(int thr, test_globals_t *gbls)
  {
   uint64_t period;
   uint64_t period_ns;
 @@ -92,30 +87,30 @@ static void test_abs_timeouts(int thr, test_args_t *args)
  
   queue = odp_queue_lookup(timer_queue);
  
 - period_ns = args-period_us*ODP_TIME_USEC;
 - period= odp_timer_ns_to_tick(tp, period_ns);
 + period_ns = gbls-args.period_us*ODP_TIME_USEC;
 + period= odp_timer_ns_to_tick(gbls-tp, period_ns);
  
   EXAMPLE_DBG(  [%i] period %PRIu64 ticks,  %PRIu64 ns\n, thr,
   period, period_ns);
  
   EXAMPLE_DBG(  [%i] current tick %PRIu64\n, thr,
 - odp_timer_current_tick(tp));
 + odp_timer_current_tick(gbls-tp));
  
 - ttp = tt[thr - 1]; /* Thread starts at 1 */
 - ttp-tim = odp_timer_alloc(tp, queue, ttp);
 + ttp = gbls-tt[thr];
 + ttp-tim = odp_timer_alloc(gbls-tp, queue, ttp);
   if (ttp-tim == ODP_TIMER_INVALID) {
   EXAMPLE_ERR(Failed to allocate timer\n);
   return;
   }
 - tmo = odp_timeout_alloc(pool);
 + tmo = odp_timeout_alloc(gbls-pool);
   if (tmo == ODP_TIMEOUT_INVALID) {
   EXAMPLE_ERR(Failed to allocate timeout\n);
   return;
   }
   ttp-ev = odp_timeout_to_event(tmo);
 - tick = odp_timer_current_tick(tp);
 + tick = odp_timer_current_tick(gbls-tp);
  
 - while ((int)odp_atomic_load_u32(remain)  0) {
 + while ((int)odp_atomic_load_u32(gbls-remain)  0) {
   odp_event_t ev;
   odp_timer_set_t rc;
  
 @@ -140,7 +135,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
   /* Check if odp_schedule() timed out, possibly there
* are no remaining timeouts to receive */
   } while (ev == ODP_EVENT_INVALID 
 -  (int)odp_atomic_load_u32(remain)  0);
 +  (int)odp_atomic_load_u32(gbls-remain)  0);
  
   if (ev == ODP_EVENT_INVALID)
   break; /* No more timeouts */
 @@ -161,7 +156,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
   }
   EXAMPLE_DBG(  [%i] timeout, tick %PRIu64\n, thr, tick);
  
 - odp_atomic_dec_u32(remain);
 + odp_atomic_dec_u32(gbls-remain);
   }
  
   /* Cancel and free last timer used */
 @@ -187,9 +182,9 @@ static void *run_thread(void *ptr)
  {
   int thr;
   odp_pool_t msg_pool;
 - test_args_t *args;
 + test_globals_t *gbls;
  
 - args = ptr;
 + gbls = ptr;
   thr  = odp_thread_id();
  
   printf(Thread %i starts on cpu %i\n, thr, odp_cpu_id());
 @@ -204,9 +199,9 @@ static void *run_thread(void *ptr)
   return 

[lng-odp] [RFC API-NEXT PATCH] timer: Add missing platform handles to u64 conversion functions

2015-04-20 Thread Jerin Jacob
Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com
---
 include/odp/api/timer.h | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
index 0dc9415..435c004 100644
--- a/include/odp/api/timer.h
+++ b/include/odp/api/timer.h
@@ -366,6 +366,45 @@ odp_timeout_t odp_timeout_alloc(odp_pool_t pool);
 void odp_timeout_free(odp_timeout_t tmo);
 
 /**
+ * Get printable value for an odp_timer_pool_t
+ *
+ * @param hdl  odp_timer_pool_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timer_pool_t handle.
+ */
+uint64_t odp_timer_pool_to_u64(odp_timer_pool_t hdl);
+
+/**
+ * Get printable value for an odp_timer_t
+ *
+ * @param hdl  odp_timer_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timer_t handle.
+ */
+uint64_t odp_timer_to_u64(odp_timer_t hdl);
+
+/**
+ * Get printable value for an odp_timeout_t
+ *
+ * @param hdl  odp_timeout_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_timeout_t handle.
+ */
+uint64_t odp_timeout_to_u64(odp_timeout_t hdl);
+
+/**
  * @}
  */
 
-- 
2.1.0

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


Re: [lng-odp] [PATCH NETMAP 0/2] Minor fixes for odp-netmap

2015-04-20 Thread Maxim Uvarov

On 04/20/15 13:17, Ciprian Barbu wrote:

Ciprian Barbu (2):
   linux-netmap: fix device control sockfd leakage
   linux-netmap: fix buffer not null terminated

  platform/linux-netmap/odp_packet_netmap.c | 11 ---
  1 file changed, 8 insertions(+), 3 deletions(-)


Reviewed-by: Maxim Uvarov maxim.uva...@linaro.org
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] Use inttypes defines to print (u)int32_t values

2015-04-20 Thread Nicolas Morey-Chaisemartin
I used Thunderbird and lost the git compatible settings sometime ago it seems.
I'll send it again, in the right format this time :)

Nicolas

On 04/17/2015 03:03 PM, Maxim Uvarov wrote:
 Nicolas, looks like something wrong with patch format. I can convert this 
 email to plain text with git am -3 --utf8  but I can not apply it even after 
 that.
 Did you use git send-email command?

 Thanks,
 Maxim.

 On 04/16/15 12:31, Nicolas Morey-Chaisemartin wrote:
 ---
  platform/linux-generic/odp_buffer.c |  4 ++--
  platform/linux-generic/odp_packet.c | 14 +++---
  2 files changed, 9 insertions(+), 9 deletions(-)

 diff --git a/platform/linux-generic/odp_buffer.c 
 b/platform/linux-generic/odp_buffer.c
 index a9d0e24..0803805 100644
 --- a/platform/linux-generic/odp_buffer.c
 +++ b/platform/linux-generic/odp_buffer.c
 @@ -81,9 +81,9 @@ int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t 
 buf)
  len += snprintf(str[len], n-len,
addr %p\n,hdr-addr);
  len += snprintf(str[len], n-len,
 -  size %u\n,hdr-size);
 +  size % PRIu32 \n,hdr-size);
  len += snprintf(str[len], n-len,
 -  ref_count%i\n,
 +  ref_count% PRIu32 \n,
  odp_atomic_load_u32(hdr-ref_count));
  len += snprintf(str[len], n-len,
type %i\n,hdr-type);
 diff --git a/platform/linux-generic/odp_packet.c 
 b/platform/linux-generic/odp_packet.c
 index c5a3f7d..815c57f 100644
 --- a/platform/linux-generic/odp_packet.c
 +++ b/platform/linux-generic/odp_packet.c
 @@ -558,19 +558,19 @@ void odp_packet_print(odp_packet_t pkt)
  len += snprintf(str[len], n-len, Packet );
  len += odp_buffer_snprint(str[len], n-len, (odp_buffer_t) pkt);
  len += snprintf(str[len], n-len,
 -  input_flags  0x%x\n, hdr-input_flags.all);
 +  input_flags  0x% PRIx32 \n, hdr-input_flags.all);
  len += snprintf(str[len], n-len,
 -  error_flags  0x%x\n, hdr-error_flags.all);
 +  error_flags  0x% PRIx32 \n, hdr-error_flags.all);
  len += snprintf(str[len], n-len,
 -  output_flags 0x%x\n, hdr-output_flags.all);
 +  output_flags 0x% PRIx32 \n, hdr-output_flags.all);
  len += snprintf(str[len], n-len,
 -  l2_offset%u\n, hdr-l2_offset);
 +  l2_offset% PRIu32 \n, hdr-l2_offset);
  len += snprintf(str[len], n-len,
 -  l3_offset%u\n, hdr-l3_offset);
 +  l3_offset% PRIu32 \n, hdr-l3_offset);
  len += snprintf(str[len], n-len,
 -  l4_offset%u\n, hdr-l4_offset);
 +  l4_offset% PRIu32 \n, hdr-l4_offset);
  len += snprintf(str[len], n-len,
 -  frame_len%u\n, hdr-frame_len);
 +  frame_len% PRIu32 \n, hdr-frame_len);
  len += snprintf(str[len], n-len,
input% PRIu64 \n,
  odp_pktio_to_u64(hdr-input));
 ___
 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] [PATCHv2] Use inttypes defines to print (u)int32_t values

2015-04-20 Thread Nicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin nmo...@kalray.eu
---
 platform/linux-generic/odp_buffer.c |  4 ++--
 platform/linux-generic/odp_packet.c | 14 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/platform/linux-generic/odp_buffer.c 
b/platform/linux-generic/odp_buffer.c
index a9d0e24..0803805 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
@@ -81,9 +81,9 @@ int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t 
buf)
len += snprintf(str[len], n-len,
  addr %p\n,hdr-addr);
len += snprintf(str[len], n-len,
- size %u\n,hdr-size);
+ size % PRIu32 \n,hdr-size);
len += snprintf(str[len], n-len,
- ref_count%i\n,
+ ref_count% PRIu32 \n,
odp_atomic_load_u32(hdr-ref_count));
len += snprintf(str[len], n-len,
  type %i\n,hdr-type);
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index c5a3f7d..815c57f 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -558,19 +558,19 @@ void odp_packet_print(odp_packet_t pkt)
len += snprintf(str[len], n-len, Packet );
len += odp_buffer_snprint(str[len], n-len, (odp_buffer_t) pkt);
len += snprintf(str[len], n-len,
- input_flags  0x%x\n, hdr-input_flags.all);
+ input_flags  0x% PRIx32 \n, hdr-input_flags.all);
len += snprintf(str[len], n-len,
- error_flags  0x%x\n, hdr-error_flags.all);
+ error_flags  0x% PRIx32 \n, hdr-error_flags.all);
len += snprintf(str[len], n-len,
- output_flags 0x%x\n, hdr-output_flags.all);
+ output_flags 0x% PRIx32 \n, 
hdr-output_flags.all);
len += snprintf(str[len], n-len,
- l2_offset%u\n, hdr-l2_offset);
+ l2_offset% PRIu32 \n, hdr-l2_offset);
len += snprintf(str[len], n-len,
- l3_offset%u\n, hdr-l3_offset);
+ l3_offset% PRIu32 \n, hdr-l3_offset);
len += snprintf(str[len], n-len,
- l4_offset%u\n, hdr-l4_offset);
+ l4_offset% PRIu32 \n, hdr-l4_offset);
len += snprintf(str[len], n-len,
- frame_len%u\n, hdr-frame_len);
+ frame_len% PRIu32 \n, hdr-frame_len);
len += snprintf(str[len], n-len,
  input% PRIu64 \n,
odp_pktio_to_u64(hdr-input));
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1394] CID 56895: Buffer not null terminated: odp_packet_netmap.c

2015-04-20 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1394

--- Comment #1 from Ciprian Barbu ciprian.ba...@linaro.org ---
Patch sent:
https://patches.linaro.org/47338/

-- 
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


Re: [lng-odp] [PATCH] api_test: remove odp_shm_test

2015-04-20 Thread Savolainen, Petri (Nokia - FI/Espoo)
I expect that we cannot modify every current and future example app to be OS 
agnostic (== bare metal ready). Some examples, like IPsec, depend on third 
party libraries, which in turn may depend on other Linux/Posix interfaces. 
Third party code may expect either process or pthread model. It’s good to 
demonstrate explicitly how ODP is setup in both of those cases. Majority of the 
applications will run Linux anyway.

I recommend that we support OS agnostic validation suite (triple the testing 
effort there) - but examples/other test apps  can choose which from the three 
models (OS agnostic, Linux process or pthread) suite them the best. So, all 
three helper APIs are needed.

-Petri


From: ext Mike Holmes [mailto:mike.hol...@linaro.org]
Sent: Friday, April 17, 2015 4:04 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: ext Benoît Ganne; Taras Kondratiuk; lng-odp
Subject: Re: [lng-odp] [PATCH] api_test: remove odp_shm_test



On 17 April 2015 at 03:22, Savolainen, Petri (Nokia - FI/Espoo) 
petri.savolai...@nokia.commailto:petri.savolai...@nokia.com wrote:
It’s a good idea to add odph_worker, but that would be added in parallel to 
odph_linux.

This raises a question in my mind, if we only need to support the tests and 
examples we provide and can test,  why would we have that parallel linux 
specific api in our code base - we wont be using it at all.

So that applications which  explicitly need to create Linux processes, pthreads 
or both can still do that.

Who's application ? anyone is free to do that if needed that is why they are 
helpers and not part of the API, but why do we add support if we wont be using 
it. It will be like rings, in the code base and never used with its test rotten 
and core dumping.

All validation tests can use odp_worker (only), but e.g. some examples/apps may 
need direct access to Linux process/thread data structs.

We dont have any to date and if we do get to this situation in linux-generic I 
start to question if we are heading away from the core of ODP being agnostic to 
OS etc and so should we do that ?


I do see us running  odph_worker in both of the linux modes in the validation 
of linux generic so that we test odp_worker as a process and thread under Linux.



Agree that test/api_test and helper/ring should be removed.

-Petri


From: ext Mike Holmes 
[mailto:mike.hol...@linaro.orgmailto:mike.hol...@linaro.org]
Sent: Thursday, April 16, 2015 5:34 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: ext Benoît Ganne; Taras Kondratiuk; lng-odp

Subject: Re: [lng-odp] [PATCH] api_test: remove odp_shm_test

Major mistake odp_worker_create  == odph_worker_create the h matters :)

On 16 April 2015 at 10:31, Mike Holmes 
mike.hol...@linaro.orgmailto:mike.hol...@linaro.org wrote:
Before this valuable thread hijacks the patch can some one review it ? I dont 
think there is any good reason to keep odp_shm.

I have been working with Christophe and a really clean solution is emerging 
that untangles  a lot of this.

So to state my vision in rough form

  *   helper implementation is under helpers not in Linux generic, it is os 
dependent not platform dependent.
  *   test/api_test is deleted
  *   helpers do have tests in the appropriate place in the structure if they 
are functional in any way.
  *   A helper that supports creating an odp_worker that is OS independent at 
the API level is needed. It will have a Linux implementation equal to what we 
have now. We need this to make tests and examples a little more portable. We 
will not provide support for bare metal etc so this is an API change only at 
heart. The choice between process or thread for the linux odp_worker create 
will be at compile time.  We dont use the process model in the validation tests 
currently anyway.
  *   We delete rings unless some one has a use case to keep them.
  *   We need to account for OS and platform specific configuration that is 
needed for the tests to run - Christophe now have a very elegant patch brewing. 
It makes the pktio_run etc much cleaner and make the tests a truly independent 
library potentially,  with no hacks to get platform specifics solved to run 
them.
  *   Helpers like the protocol headers are clearly used by implementations and 
applications this should be allowed, but helpers should be separated where they 
only support apps, examples and tests, thus creating odp_workers is a different 
kind of helper.
  *   ODP != OS independence but tests need to be closer to that than we have 
now unless we downplay the validation suite. I think with an OS independent 
odp_wroker_create  + Christophes work we will hit the sweet spot avoiding the 
hard work for non linux cases,  but leaving the door open for bare-metal folks  
to do what they need to.
Would love to have this discussion in next Tuesdays public call if we dont beat 
it ti death before then.


On 16 April 2015 at 07:16, Savolainen, Petri (Nokia - FI/Espoo) 
petri.savolai...@nokia.commailto:petri.savolai...@nokia.com wrote:


[lng-odp] [PATCH] example: timer: remove global variables to share the data between workers

2015-04-20 Thread Jerin Jacob
Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com
---
 example/timer/odp_timer_test.c | 124 +
 1 file changed, 65 insertions(+), 59 deletions(-)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 6b60ec4..876bf33 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -39,18 +39,21 @@ typedef struct {
int tmo_count; /** Timeout count*/
 } test_args_t;
 
-
-/** @private Barrier for test synchronisation */
-static odp_barrier_t test_barrier;
-
-/** @private Pool handle */
-static odp_pool_t pool;
-
-/** @private Timer pool handle */
-static odp_timer_pool_t tp;
-
-/** @private Number of timeouts to receive */
-static odp_atomic_u32_t remain;
+/** @private Helper struct for timers */
+struct test_timer {
+   odp_timer_t tim;
+   odp_event_t ev;
+};
+
+/** Test global variables */
+typedef struct {
+   test_args_t args;   /** Test argunments*/
+   odp_barrier_t test_barrier; /** Barrier for test synchronisation*/
+   odp_pool_t pool;/** pool handle*/
+   odp_timer_pool_t tp;/** Timer pool handle*/
+   odp_atomic_u32_t remain;/** Number of timeouts to receive*/
+   struct test_timer tt[256];  /** Array of all timer helper structs*/
+} test_globals_t;
 
 /** @private Timer set status ASCII strings */
 static const char *timerset2str(odp_timer_set_t val)
@@ -69,17 +72,9 @@ static const char *timerset2str(odp_timer_set_t val)
}
 };
 
-/** @private Helper struct for timers */
-struct test_timer {
-   odp_timer_t tim;
-   odp_event_t ev;
-};
-
-/** @private Array of all timer helper structs */
-static struct test_timer tt[256];
 
 /** @private test timeout */
-static void test_abs_timeouts(int thr, test_args_t *args)
+static void test_abs_timeouts(int thr, test_globals_t *gbls)
 {
uint64_t period;
uint64_t period_ns;
@@ -92,30 +87,30 @@ static void test_abs_timeouts(int thr, test_args_t *args)
 
queue = odp_queue_lookup(timer_queue);
 
-   period_ns = args-period_us*ODP_TIME_USEC;
-   period= odp_timer_ns_to_tick(tp, period_ns);
+   period_ns = gbls-args.period_us*ODP_TIME_USEC;
+   period= odp_timer_ns_to_tick(gbls-tp, period_ns);
 
EXAMPLE_DBG(  [%i] period %PRIu64 ticks,  %PRIu64 ns\n, thr,
period, period_ns);
 
EXAMPLE_DBG(  [%i] current tick %PRIu64\n, thr,
-   odp_timer_current_tick(tp));
+   odp_timer_current_tick(gbls-tp));
 
-   ttp = tt[thr - 1]; /* Thread starts at 1 */
-   ttp-tim = odp_timer_alloc(tp, queue, ttp);
+   ttp = gbls-tt[thr];
+   ttp-tim = odp_timer_alloc(gbls-tp, queue, ttp);
if (ttp-tim == ODP_TIMER_INVALID) {
EXAMPLE_ERR(Failed to allocate timer\n);
return;
}
-   tmo = odp_timeout_alloc(pool);
+   tmo = odp_timeout_alloc(gbls-pool);
if (tmo == ODP_TIMEOUT_INVALID) {
EXAMPLE_ERR(Failed to allocate timeout\n);
return;
}
ttp-ev = odp_timeout_to_event(tmo);
-   tick = odp_timer_current_tick(tp);
+   tick = odp_timer_current_tick(gbls-tp);
 
-   while ((int)odp_atomic_load_u32(remain)  0) {
+   while ((int)odp_atomic_load_u32(gbls-remain)  0) {
odp_event_t ev;
odp_timer_set_t rc;
 
@@ -140,7 +135,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
/* Check if odp_schedule() timed out, possibly there
 * are no remaining timeouts to receive */
} while (ev == ODP_EVENT_INVALID 
-(int)odp_atomic_load_u32(remain)  0);
+(int)odp_atomic_load_u32(gbls-remain)  0);
 
if (ev == ODP_EVENT_INVALID)
break; /* No more timeouts */
@@ -161,7 +156,7 @@ static void test_abs_timeouts(int thr, test_args_t *args)
}
EXAMPLE_DBG(  [%i] timeout, tick %PRIu64\n, thr, tick);
 
-   odp_atomic_dec_u32(remain);
+   odp_atomic_dec_u32(gbls-remain);
}
 
/* Cancel and free last timer used */
@@ -187,9 +182,9 @@ static void *run_thread(void *ptr)
 {
int thr;
odp_pool_t msg_pool;
-   test_args_t *args;
+   test_globals_t *gbls;
 
-   args = ptr;
+   gbls = ptr;
thr  = odp_thread_id();
 
printf(Thread %i starts on cpu %i\n, thr, odp_cpu_id());
@@ -204,9 +199,9 @@ static void *run_thread(void *ptr)
return NULL;
}
 
-   odp_barrier_wait(test_barrier);
+   odp_barrier_wait(gbls-test_barrier);
 
-   test_abs_timeouts(thr, args);
+   test_abs_timeouts(thr, gbls);
 
 
printf(Thread %i exits\n, thr);
@@ -308,7 +303,6 @@ static void parse_args(int argc, char *argv[], test_args_t 
*args)
 int main(int 

[lng-odp] [PATCH NETMAP 1/2] linux-netmap: fix device control sockfd leakage

2015-04-20 Thread Ciprian Barbu
The get_mac_addr function created a socket that was never freed. The device
control socket should have been used instead

Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org
---
 platform/linux-netmap/odp_packet_netmap.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/platform/linux-netmap/odp_packet_netmap.c 
b/platform/linux-netmap/odp_packet_netmap.c
index a4236cf..2988b96 100644
--- a/platform/linux-netmap/odp_packet_netmap.c
+++ b/platform/linux-netmap/odp_packet_netmap.c
@@ -87,8 +87,13 @@ struct dispatch_args {
 
 int odp_netmap_init_global(void)
 {
+   int i;
odp_spinlock_init(nm_global_lock);
memset(netmap_devs, 0, sizeof(netmap_devs));
+
+   for (i = 0; i  MAX_DEVS; i++)
+   netmap_devs[i].sockfd = -1;
+
return 0;
 }
 
@@ -148,9 +153,9 @@ static int get_mac_addr(pkt_netmap_t *pkt_nm)
int sockfd;
int err;
 
-   sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+   sockfd = pkt_nm-nm_dev-sockfd;
if (sockfd == -1) {
-   ODP_ERR(socket(): %s\n, strerror(errno));
+   ODP_ERR(Error: invalid device control socket\n);
goto error;
}
 
-- 
1.8.3.2

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


[lng-odp] [PATCH NETMAP 2/2] linux-netmap: fix buffer not null terminated

2015-04-20 Thread Ciprian Barbu
CID 56895: Buffer not null terminated: odp_packet_netmap.c
https://bugs.linaro.org/show_bug.cgi?id=1394

Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org
---
 platform/linux-netmap/odp_packet_netmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-netmap/odp_packet_netmap.c 
b/platform/linux-netmap/odp_packet_netmap.c
index 2988b96..b2a4e0a 100644
--- a/platform/linux-netmap/odp_packet_netmap.c
+++ b/platform/linux-netmap/odp_packet_netmap.c
@@ -106,7 +106,7 @@ static int nm_do_ioctl(pkt_netmap_t * const pkt_nm, 
unsigned long cmd,
int fd = pkt_nm-nm_dev-sockfd;
 
memset(ifr, 0, sizeof(ifr));
-   strncpy(ifr.ifr_name, pkt_nm-nm_dev-ifname, sizeof(ifr.ifr_name));
+   snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), %s, 
pkt_nm-nm_dev-ifname);
 
switch (cmd) {
case SIOCSIFFLAGS:
-- 
1.8.3.2

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


Re: [lng-odp] [RFC API-NEXT PATCH] packet_io: add bitmap to specify what level of parsing needed

2015-04-20 Thread Maxim Uvarov

How that supposed to increase performance?

The code will be like:

if (parse_vlan)
do_parse_vlan
if (parse_ipv4)
do_parse_ipv4

and etc. I.e. You will add about 20-30 if branches.

I think that this code is not sufficient. And parsing has to be under 
#ifdefs because it's critical

for performance per packet functions.

Best regards,
Maxim.


On 04/17/15 14:07, Zoltan Kiss wrote:



On 17/04/15 07:53, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: ext Zoltan Kiss [mailto:zoltan.k...@linaro.org]
Sent: Thursday, April 16, 2015 11:05 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [RFC API-NEXT PATCH] packet_io: add bitmap to
specify what level of parsing needed



On 16/04/15 13:33, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Hi,

I think this should be typed (as bit field) and part of the
odp_pktio_param_t params that I introduced in patch api: packet_io: 
added

odp_pktio_param_t. I could rework those patches and add it there.
Ok, that would be probably even better.



Something like this,

typedef struct odp_pktio_input_flags_t {
struct {
uint64_t eth:1;
uint64_t jumbo:1;
uint64_t vlan:1;
...

uint64_t _reserved:27;
};
} odp_pktio_input_flags_t;
I think it would be better to have a name which contains parse in 
some

way.


This same definition could be reused somewhere else in the API ...






typedef struct odp_pktio_param_t {
/** Packet input mode */
enum odp_pktio_input_mode in_mode;
/** Packet input parser flags */
odp_pktio_input_flags_t flags;


... but here it could be contained.

odp_pktio_input_flags_t parse;


Ok, sounds good.


-petri


} odp_pktio_param_t;


odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool,
   const odp_pktio_param_t *param);


-Petri



-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of

ext

Zoltan Kiss
Sent: Wednesday, April 15, 2015 7:01 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [RFC API-NEXT PATCH] packet_io: add bitmap to

specify

what level of parsing needed

odp_pktio_open() will have a 32 bit bitmask to specify what kind of

header

parsing is required by the application.

Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org
---
   include/odp/api/packet_flags.h | 49
++
   include/odp/api/packet_io.h| 14 
   2 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/include/odp/api/packet_flags.h
b/include/odp/api/packet_flags.h
index b1e179e..467d4f1 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -327,6 +327,55 @@ void odp_packet_has_sctp_set(odp_packet_t 
pkt, int

val);
   void odp_packet_has_icmp_set(odp_packet_t pkt, int val);

   /**
+ * Shift values for enum odp_packet_parse. Has to be updated 
together

with
+ * odp_packet_parse_e type. The parameter passed to 
odp_pktio_open is

a

32 bit
+ * mask.
+ */
+typedef enum odp_packet_parse_shift {
+  ODP_PARSE_SHIFT_ETH,
+  ODP_PARSE_SHIFT_JUMBO,
+  ODP_PARSE_SHIFT_VLAN,
+  ODP_PARSE_SHIFT_VLAN_QINQ,
+  ODP_PARSE_SHIFT_ARP,
+  ODP_PARSE_SHIFT_IPV4,
+  ODP_PARSE_SHIFT_IPV6,
+  ODP_PARSE_SHIFT_IPFRAG,
+  ODP_PARSE_SHIFT_IPOPT,
+  ODP_PARSE_SHIFT_IPSEC,
+  ODP_PARSE_SHIFT_UDP,
+  ODP_PARSE_SHIFT_TCP,
+  ODP_PARSE_SHIFT_SCTP,
+  ODP_PARSE_SHIFT_ICMP,
+  ODP_PARSE_SHIFT_MAX = 31
+} odp_packet_parse_shift_e;
+
+#define ODP_PARSE(FIELD) ODP_PARSE_##FIELD = 
(ODP_PARSE_SHIFT_##FIELD



1)
+
+/**
+ * Values to be used when calling odp_pktio_open. The parser_mask
parameter has
+ * to be one or more of these values joined with bitwise OR. Or 
one of

the two
+ * special values: ODP_PARSE_NONE or ODP_PARSE_ALL.
+ * Has to be updated together with odp_packet_parse_shift_e
+ */
+typedef enum odp_packet_parse {
+  ODP_PARSE_NONE = 0,/* The application don't want any

parsing */

+  ODP_PARSE(ETH),/* Parse Ethernet header */
+  ODP_PARSE(JUMBO),/* Parse Ethernet header if a jumbo 
frame */

+  ODP_PARSE(VLAN),/* Parse VLAN header */
+  ODP_PARSE(VLAN_QINQ),/* Parse VLAN QinQ header */
+  ODP_PARSE(ARP),/* Parse ARP header */
+  ODP_PARSE(IPV4),/* Parse IPv4 header */
+  ODP_PARSE(IPV6),/* Parse IPv6 header */
+  ODP_PARSE(IPFRAG),/* Parse IPv4 header if fragmented */
+  ODP_PARSE(IPOPT),/* Parse IP options */
+  ODP_PARSE(IPSEC),/* Parse IPsec header */
+  ODP_PARSE(UDP),/* Parse UDP header */
+  ODP_PARSE(TCP),/* Parse TCP header */
+  ODP_PARSE(SCTP),/* Parse SCTP header */
+  ODP_PARSE(ICMP),/* Parse ICMP header */
+  ODP_PARSE_ALL = UINT32_MAX/* The application wants full 
parsing

*/

+} odp_packet_parse_e;
+/**
* @}
*/

diff --git a/include/odp/api/packet_io.h 
b/include/odp/api/packet_io.h

index 6d31aeb..8c989f3 100644
--- a/include/odp/api/packet_io.h
+++ 

Re: [lng-odp] [API-NEXT PATCH] api: classification: connect PMR on creation

2015-04-20 Thread Taras Kondratiuk
On 04/17/2015 11:55 PM, Rosenboim, Leonid wrote:
 
 Guys,
 
 There are several versions of the Classifier API document floating in Google 
 docs, here is one such copy:
 
 https://docs.google.com/document/d/14KMqNPIgd7InwGzdP2EaI9g_V3o0_wxpgp3N-nd-RBE/edit?usp=sharing
 
 Here is a different perspective on what PMR and COS mean,  perhaps in terms 
 of an abstract hardware implementation:
 
 CoS is a meta-data field assigned to each packet as it traverses the 
 classifier pipe-line.
 
 A packet is assigned an initial CoS by the pktio port which received it.
 
 Then, the packet is compared multiple times against a set of rules, and as it 
 is common with TCAMs, each comparisons happens against all rules in parallel.
 
 Each rule has two values to match: 1. the current CoS meta-data field; and 2. 
 a certain packet header field (value with a mask).
 If both these values match, the packet met-data CoS field is changed (Action 
 taken) with the destination CoS of the matching rule.
 
 It is assumed that up to  one such rule has matched.
 
 If a rule has matched, CoS has changed, the process continues one more time.
 
 If NO MATCH occured, the classification process is finished, and the packet 
 is delivered in accordance to the current CoS (i.e. the last matching rule or 
 the pktio default CoS if the first rule match failed).
 
 According to CoS, the packet buffer pool and the destination queue are 
 selected, and the packet is ready for application processing.
 
 Here are some additional observations with regads to use of CoS values:
 
 Multiple pktio may assign the same CoS initially. (eaming many pktio to one 
 CoS)
 
 Multple rules can assign the same CoS as destination (action). (meaning 
 multuple PMR to one destination CoS).
 
 Regarding the source CoS of a PMR, I can not rule out a PMR that can match 
 multiple CoS values (that is creating a many-to-many src-CoS to PMR 
 relationship), but this scheme seems problematic for ease of use as well as 
 implementation, so I would recommend to assume that each PMR should only have 
 a single source CoS.
 
 Multiple PMRs may have the same source-CoS, but different header fields ot 
 value/mask (creating an OR  combination of PMRs).
 
 I felt that I had to take this discussion ina completely different direction 
 to avoid infinite recursion ;-)

Thanks, Leo.
This exactly matches my understanding.

Could you please add Reviewed-by tag if you are ok with the patch?

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


Re: [lng-odp] [API-NEXT PATCHv1 1/3] api: classification: remove odp_pmr_create_range() function definition.

2015-04-20 Thread Maxim Uvarov

Merged, to api-next.

Maxim.

On 04/17/15 13:17, Savolainen, Petri (Nokia - FI/Espoo) wrote:

The patch series

Reviewed-by: Petri Savolainen petri.savolai...@nokia.com



-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext
bala.manoha...@linaro.org
Sent: Friday, April 10, 2015 1:27 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [API-NEXT PATCHv1 1/3] api: classification: remove
odp_pmr_create_range() function definition.

From: Balasubramanian Manoharan bala.manoha...@linaro.org

The support for a range based packet matching rule is not available in
most of
the hardwares and hence this API is removed.

Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org
---
  include/odp/api/classification.h | 61 +++
-
  1 file changed, 10 insertions(+), 51 deletions(-)

diff --git a/include/odp/api/classification.h
b/include/odp/api/classification.h
index 7db3645..f597b26 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -50,8 +50,8 @@ extern C {
  /**
   * @def ODP_PMR_INVAL
   * Invalid odp_pmr_t value.
- * This value is returned from odp_pmr_create_match() and
- * odp_pmr_create_range() functions on failure.
+ * This value is returned from odp_pmr_create()
+ * function on failure.
   */

  /**
@@ -236,30 +236,10 @@ typedef enum odp_pmr_term {
   * @returnHandle of the matching rule
   * @retvalODP_PMR_INVAL on failure
   */
-odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
-  const void *val,
-  const void *mask,
-  uint32_t val_sz);
+odp_pmr_t odp_pmr_create(odp_pmr_term_e term, const void *val,
+const void *mask, uint32_t val_sz);

  /**
- * Create a packet match rule with value range
- *
- * @param[in]  termOne of the enumerated values supported
- * @param[in]  val1Lower bound of the header field range.
- * @param[in]  val2Upper bound of the header field range.
- * @param[in]  val_sz  Size of the val1 and val2 arguments,
- * that must match the value size requirement of the
- * specific term.
- *
- * @return Handle of the matching rule
- * @retval ODP_PMR_INVAL on failure
- * @note: Range is inclusive [val1..val2].
- */
-odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
-  const void *val1,
-  const void *val2,
-  uint32_t val_sz);
-/**
   * Invalidate a packet match rule and vacate its resources
   *
   * @param[in] pmr_id  Identifier of the PMR to be destroyed
@@ -310,39 +290,18 @@ unsigned long long odp_pmr_terms_cap(void);
  unsigned odp_pmr_terms_avail(void);

  /**
- * Packet Match Type field enumeration
- * for fields that may be used to identify
- * the different PMR match type.
- */
-typedef enum odp_pmr_match_type {
-   ODP_PMR_MASK,   /** Match a masked set of bits */
-   ODP_PMR_RANGE,  /** Match an integer range */
-   } odp_pmr_match_type_e;
-
-/**
   * Following structure is used to define composite packet matching rules
- * in the form of an array of individual match or range rules.
+ * in the form of an array of individual match rules.
   * The underlying platform may not support all or any specific
combination
- * of value match or range rules, and the application should take care
+ * of value match rules, and the application should take care
   * of inspecting the return value when installing such rules, and perform
   * appropriate fallback action.
   */
  typedef struct odp_pmr_match_t {
-   odp_pmr_match_type_e match_type; /** Packet Match Type*/
-   union {
-   struct {
-   odp_pmr_term_e  term;
-   const void  *val;
-   const void  *mask;
-   unsigned int val_sz;
-   } mask; /** Match a masked set of bits */
-   struct {
-   odp_pmr_term_e  term;
-   const void  *val1;
-   const void  *val2;
-   unsigned int val_sz;
-   } range; /** Match an integer range */
-   };
+   odp_pmr_term_e  term;   /** PMR term value to be matched */
+   const void  *val;   /** Value to be matched */
+   const void  *mask;  /** Masked set of bits to be matched */
+   unsigned intval_sz;  /** Size of the term value */
  } odp_pmr_match_t;

  /**
--
2.0.1.472.g6f92e5f

___
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] api: classification: connect PMR on creation

2015-04-20 Thread Ola Liljedahl
On 17 April 2015 at 22:55, Rosenboim, Leonid 
leonid.rosenb...@caviumnetworks.com wrote:


 Guys,

 There are several versions of the Classifier API document floating in
 Google docs, here is one such copy:


 https://docs.google.com/document/d/14KMqNPIgd7InwGzdP2EaI9g_V3o0_wxpgp3N-nd-RBE/edit?usp=sharing

 Here is a different perspective on what PMR and COS mean,  perhaps in
 terms of an abstract hardware implementation:

 CoS is a meta-data field assigned to each packet as it traverses the
 classifier pipe-line.

 A packet is assigned an initial CoS by the pktio port which received it.

 Then, the packet is compared multiple times against a set of rules, and as
 it is common with TCAMs, each comparisons happens against all rules in
 parallel.

 Each rule has two values to match: 1. the current CoS meta-data field; and
 2. a certain packet header field (value with a mask).
 If both these values match, the packet met-data CoS field is changed
 (Action taken) with the destination CoS of the matching rule.

 It is assumed that up to  one such rule has matched.

 If a rule has matched, CoS has changed, the process continues one more
 time.

 If NO MATCH occured, the classification process is finished, and the
 packet is delivered in accordance to the current CoS (i.e. the last
 matching rule or the pktio default CoS if the first rule match failed).

So partial matches are valid. Is this what we want, e.g. from application
point of view and from HW point of view?

Is partial matches what is commonly supported by HW classifiers?

A classifier which supports these longest prefix matches can easily
implement perfect matching (all partial matches just specify the default
CoS). But a classifier which only supports perfect matching cannot directly
support partial matches. I assume you would have to internally create
rules/patterns for all (relevant) partial matches as well. The
implementation can find all relevant partial matches (prefix rules which
specify a CoS different from the default CoS) and add those to the list of
rules. Longer prefix matches should be prioritized (however that is done)
over shorter prefix matches.

The reason I really want to understand the required semantics is that I am
planning to design an optimized parser/classifier in SW. Pointer-chasing is
a no-no, performance will come from cache-friendly access pattern and some
kind of parallelism (e.g. SIMD). I don't know how good it can get.



 According to CoS, the packet buffer pool and the destination queue are
 selected, and the packet is ready for application processing.

 Here are some additional observations with regads to use of CoS values:

 Multiple pktio may assign the same CoS initially. (eaming many pktio to
 one CoS)

 Multple rules can assign the same CoS as destination (action). (meaning
 multuple PMR to one destination CoS).

 Regarding the source CoS of a PMR, I can not rule out a PMR that can match
 multiple CoS values (that is creating a many-to-many src-CoS to PMR
 relationship), but this scheme seems problematic for ease of use as well as
 implementation, so I would recommend to assume that each PMR should only
 have a single source CoS.

 Multiple PMRs may have the same source-CoS, but different header fields ot
 value/mask (creating an OR  combination of PMRs).

 I felt that I had to take this discussion ina completely different
 direction to avoid infinite recursion ;-)

 Good weekend all,

 - Leo



 ___
 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] [PATCH] api_test: remove odp_shm_test

2015-04-20 Thread Mike Holmes
We clarified the direction this thread took on the call this morning.

The Linux dependency window will stay open for examples to potentially be
Linux dependent,  the assumption here being that as we develop more
sophisticated examples they may need many Linux features.  Currently there
is nothing that has a level of complexity that requires this, so all the
current executables can be platform independent.
Any Linux dependent examples will be gathered  - probably via the directory
hierarchy - so that they can be optionally compiled and run so as not to
hinder bare metal cases.

PING the original patch still needs a review and is fully in line with our
direction.

On 20 April 2015 at 03:27, Savolainen, Petri (Nokia - FI/Espoo) 
petri.savolai...@nokia.com wrote:

  I expect that we cannot modify every current and future example app to
 be OS agnostic (== bare metal ready). Some examples, like IPsec, depend on
 third party libraries, which in turn may depend on other Linux/Posix
 interfaces. Third party code may expect either process or pthread model.
 It’s good to demonstrate explicitly how ODP is setup in both of those
 cases. Majority of the applications will run Linux anyway.



 I recommend that we support OS agnostic validation suite (triple the
 testing effort there) - but examples/other test apps  can choose which from
 the three models (OS agnostic, Linux process or pthread) suite them the
 best. So, all three helper APIs are needed.



 -Petri





 *From:* ext Mike Holmes [mailto:mike.hol...@linaro.org]
 *Sent:* Friday, April 17, 2015 4:04 PM

 *To:* Savolainen, Petri (Nokia - FI/Espoo)
 *Cc:* ext Benoît Ganne; Taras Kondratiuk; lng-odp
 *Subject:* Re: [lng-odp] [PATCH] api_test: remove odp_shm_test







 On 17 April 2015 at 03:22, Savolainen, Petri (Nokia - FI/Espoo) 
 petri.savolai...@nokia.com wrote:

 It’s a good idea to add odph_worker, but that would be added in parallel
 to odph_linux.



 This raises a question in my mind, if we only need to support the tests
 and examples we provide and can test,  why would we have that parallel
 linux specific api in our code base - we wont be using it at all.



  So that applications which  explicitly need to create Linux processes,
 pthreads or both can still do that.



 Who's application ? anyone is free to do that if needed that is why they
 are helpers and not part of the API, but why do we add support if we wont
 be using it. It will be like rings, in the code base and never used with
 its test rotten and core dumping.



  All validation tests can use odp_worker (only), but e.g. some
 examples/apps may need direct access to Linux process/thread data structs.



 We dont have any to date and if we do get to this situation in
 linux-generic I start to question if we are heading away from the core of
 ODP being agnostic to OS etc and so should we do that ?





 I do see us running  odph_worker in both of the linux modes in the
 validation of linux generic so that we test odp_worker as a process and
 thread under Linux.







 Agree that test/api_test and helper/ring should be removed.



 -Petri





 *From:* ext Mike Holmes [mailto:mike.hol...@linaro.org]
 *Sent:* Thursday, April 16, 2015 5:34 PM
 *To:* Savolainen, Petri (Nokia - FI/Espoo)
 *Cc:* ext Benoît Ganne; Taras Kondratiuk; lng-odp


 *Subject:* Re: [lng-odp] [PATCH] api_test: remove odp_shm_test



 Major mistake odp_worker_create  == odph_worker_create the h matters :)



 On 16 April 2015 at 10:31, Mike Holmes mike.hol...@linaro.org wrote:

 Before this valuable thread hijacks the patch can some one review it ? I
 dont think there is any good reason to keep odp_shm.



 I have been working with Christophe and a really clean solution is
 emerging that untangles  a lot of this.



 So to state my vision in rough form

- helper implementation is under helpers not in Linux generic, it is
os dependent not platform dependent.
- test/api_test is deleted
- helpers do have tests in the appropriate place in the structure if
they are functional in any way.
- A helper that supports creating an odp_worker that is OS independent
at the API level is needed. It will have a Linux implementation equal to
what we have now. We need this to make tests and examples a little more
portable. We will not provide support for bare metal etc so this is an API
change only at heart. The choice between process or thread for the linux
odp_worker create will be at compile time.  We dont use the process model
in the validation tests currently anyway.
- We delete rings unless some one has a use case to keep them.
- We need to account for OS and platform specific configuration that
is needed for the tests to run - Christophe now have a very elegant patch
brewing. It makes the pktio_run etc much cleaner and make the tests a truly
independent library potentially,  with no hacks to get platform specifics
solved to run them.
- Helpers like the 

Re: [lng-odp] [PATCH v2] example: doxygen: remove examples from src path

2015-04-20 Thread Mike Holmes
ping - copyright from v1 was added.

On 13 April 2015 at 17:05, Mike Holmes mike.hol...@linaro.org wrote:

 If the examples are on the src path they pollute the documentation
 with their own declarations.

 The correct mechanism is to declare the examples to be seen in the
 documentation in one location that is on the .dox path, and have the
 EXAMPLE_PATH locate the actual example code.

 Signed-off-by: Mike Holmes mike.hol...@linaro.org
 ---
 v2 add copyright

 note this patch assumes that the l2fwd application has migrated to
 test/performance
 and that the ipsec which is currently not visible as an example will do
 the same.

  doc/doxygen.cfg   |  2 +-
  doc/examples.dox  | 18 ++
  example/generator/odp_generator.c |  6 --
  example/packet/odp_pktio.c|  6 --
  example/timer/odp_timer_test.c|  6 --
  5 files changed, 19 insertions(+), 19 deletions(-)
  create mode 100644 doc/examples.dox

 diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
 index 52c83a9..34a1000 100644
 --- a/doc/doxygen.cfg
 +++ b/doc/doxygen.cfg
 @@ -10,7 +10,7 @@ TYPEDEF_HIDES_STRUCT = NO
  EXTRACT_STATIC = YES
  SORT_MEMBER_DOCS = NO
  WARN_NO_PARAMDOC = YES
 -INPUT = $(SRCDIR)/doc $(SRCDIR)/doc/users-guide $(SRCDIR)/include
 $(SRCDIR)/platform/linux-generic/include/odp
 $(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp $(SRCDIR)/helper/include
 $(SRCDIR)/example/packet $(SRCDIR)/example/l2fwd
 $(SRCDIR)/example/generator $(SRCDIR)/example/timer
 +INPUT = $(SRCDIR)/doc $(SRCDIR)/doc/users-guide $(SRCDIR)/include
 $(SRCDIR)/platform/linux-generic/include/odp
 $(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp $(SRCDIR)/helper/include
  FILE_PATTERNS = *.h odp*.c *.dox
  RECURSIVE = YES
  SOURCE_BROWSER = YES
 diff --git a/doc/examples.dox b/doc/examples.dox
 new file mode 100644
 index 000..b72ee0d
 --- /dev/null
 +++ b/doc/examples.dox
 @@ -0,0 +1,18 @@
 +/* Copyright (c) 2015, Linaro Limited
 + * All rights reserved.
 + *
 + * SPDX-License-Identifier: BSD-3-Clause
 + */
 +
 +/**
 +@example odp_generator.c
 +ODP loopback demo application
 +*/
 +/**
 +@example odp_pktio.c
 +ODP basic packet IO loopback test application
 +*/
 +/**
 +@example odp_timer_test.c
 +ODP timer example application
 +*/
 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index 2ac0b47..8ae5b29 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -4,12 +4,6 @@
   * SPDX-License-Identifier: BSD-3-Clause
   */

 -/**
 - * @file
 - *
 - * @example odp_generator.c ODP loopback demo application
 - */
 -
  /** enable strtok */
  #define _POSIX_C_SOURCE 200112L

 diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
 index 61af855..f08d9f4 100644
 --- a/example/packet/odp_pktio.c
 +++ b/example/packet/odp_pktio.c
 @@ -4,12 +4,6 @@
   * SPDX-License-Identifier: BSD-3-Clause
   */

 -/**
 - * @file
 - *
 - * @example odp_pktio.c  ODP basic packet IO loopback test application
 - */
 -
  #include stdlib.h
  #include string.h
  #include getopt.h
 diff --git a/example/timer/odp_timer_test.c
 b/example/timer/odp_timer_test.c
 index 6b60ec4..acac580 100644
 --- a/example/timer/odp_timer_test.c
 +++ b/example/timer/odp_timer_test.c
 @@ -4,12 +4,6 @@
   * SPDX-License-Identifier: BSD-3-Clause
   */

 -/**
 - * @file
 - *
 - * @example  odp_timer_test.c ODP timer example application
 - */
 -
  #include string.h
  #include stdlib.h

 --
 2.1.0




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org http://www.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


[lng-odp] cpumask size

2015-04-20 Thread Christophe Milard
Hi,

I am not sure we came to any conclusion when it comes the getting the size
of the CPU mask. There was a proposal from Petri which made sense to me...

/**

 * @return Maximum number of CPUs a mask can hold

 */

int odp_cpumask_max_cpus(void)


But the discussion just died off...


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


Re: [lng-odp] [PATCHv3] example: ODP classifier example

2015-04-20 Thread Mike Holmes
On 16 April 2015 at 07:41, bala.manoha...@linaro.org wrote:

 From: Balasubramanian Manoharan bala.manoha...@linaro.org

 ODP Classifier example

 This programs gets pmr rules as command-line parameter and configures the
 classification engine
 in the system.

 This initial version supports the following
 * ODP_PMR_SIP_ADDR pmr term
 * PMR term MATCH and RANGE type
 * Multiple PMR rule can be set on a single pktio interface with different
 queues associated to each PMR rule
 * Automatically configures a default queue and provides statistics for the
 same

 Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org


With the addition of .gitignore for example/classifier/odp_classifier, not
sure if you are happy to add that Maxim?

Reviewed-by: Mike Holmes mike.hol...@linaro.org



 ---
 V3: Incorporates review comments from Mike and Maxim
 Adds a timeout variable to configure the time in seconds for classifier
 example to run.

  configure.ac|   1 +
  example/Makefile.am |   2 +-
  example/classifier/Makefile.am  |  10 +
  example/classifier/odp_classifier.c | 820
 
  4 files changed, 832 insertions(+), 1 deletion(-)
  create mode 100644 example/classifier/Makefile.am
  create mode 100644 example/classifier/odp_classifier.c

 diff --git a/configure.ac b/configure.ac
 index 78ff245..d20bad2 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -272,6 +272,7 @@ AM_CXXFLAGS=-std=c++11
  AC_CONFIG_FILES([Makefile
  doc/Makefile
  example/Makefile
 +example/classifier/Makefile
  example/generator/Makefile
  example/ipsec/Makefile
  example/packet/Makefile
 diff --git a/example/Makefile.am b/example/Makefile.am
 index 6bb4f5c..353f397 100644
 --- a/example/Makefile.am
 +++ b/example/Makefile.am
 @@ -1 +1 @@
 -SUBDIRS = generator ipsec packet timer
 +SUBDIRS = classifier generator ipsec packet timer
 diff --git a/example/classifier/Makefile.am
 b/example/classifier/Makefile.am
 new file mode 100644
 index 000..938f094
 --- /dev/null
 +++ b/example/classifier/Makefile.am
 @@ -0,0 +1,10 @@
 +include $(top_srcdir)/example/Makefile.inc
 +
 +bin_PROGRAMS = odp_classifier
 +odp_classifier_LDFLAGS = $(AM_LDFLAGS) -static
 +odp_classifier_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
 +
 +noinst_HEADERS = \
 + $(top_srcdir)/example/example_debug.h
 +
 +dist_odp_classifier_SOURCES = odp_classifier.c
 diff --git a/example/classifier/odp_classifier.c
 b/example/classifier/odp_classifier.c
 new file mode 100644
 index 000..85b6e00
 --- /dev/null
 +++ b/example/classifier/odp_classifier.c
 @@ -0,0 +1,820 @@
 +/* Copyright (c) 2015, Linaro Limited
 + * All rights reserved.
 + *
 + * SPDX-License-Identifier: BSD-3-Clause
 + */
 +
 +#include stdlib.h
 +#include string.h
 +#include getopt.h
 +#include unistd.h
 +#include example_debug.h
 +
 +#include odp.h
 +#include odp/helper/linux.h
 +#include odp/helper/eth.h
 +#include odp/helper/ip.h
 +#include strings.h
 +#include stdio.h
 +
 +/** @def MAX_WORKERS
 + * @brief Maximum number of worker threads
 + */
 +#define MAX_WORKERS32
 +
 +/** @def SHM_PKT_POOL_SIZE
 + * @brief Size of the shared memory block
 + */
 +#define SHM_PKT_POOL_SIZE  (512*2048)
 +
 +/** @def SHM_PKT_POOL_BUF_SIZE
 + * @brief Buffer size of the packet pool buffer
 + */
 +#define SHM_PKT_POOL_BUF_SIZE  1856
 +
 +/** @def MAX_PMR_COUNT
 + * @brief Maximum number of Classification Policy
 + */
 +#define MAX_PMR_COUNT  8
 +
 +/** @def DISPLAY_STRING_LEN
 + * @brief Length of string used to display term value
 + */
 +#define DISPLAY_STRING_LEN 32
 +
 +/** Get rid of path in filename - only for unix-type paths using '/' */
 +#define NO_PATH(file_name) (strrchr((file_name), '/') ? \
 +   strrchr((file_name), '/') + 1 : (file_name))
 +
 +typedef struct {
 +   odp_queue_t queue;  /** Associated queue handle */
 +   odp_cos_t cos;  /** Associated cos handle */
 +   odp_pmr_t pmr;  /** Associated pmr handle */
 +   odp_atomic_u64_t packet_count;  /** count of received packets */
 +   odp_pmr_term_e term;/** odp pmr term value */
 +   char queue_name[ODP_QUEUE_NAME_LEN];/** queue name */
 +   odp_pmr_match_type_e match_type;/** pmr match type */
 +   int val_sz; /** size of the pmr term */
 +   union {
 +   struct {
 +   uint32_t val;   /** pmr term value */
 +   uint32_t mask;  /** pmr term mask */
 +   } match;
 +   struct  {
 +   uint32_t val1;  /** pmr term start range */
 +   uint32_t val2;  /** pmr term end range */
 +   } range;
 +   };
 +   char value1[DISPLAY_STRING_LEN];/** Display string1 */
 +   char value2[DISPLAY_STRING_LEN];/** Display 

Re: [lng-odp] [PATCH] example: timer: clean up prescheduled events

2015-04-20 Thread Mike Holmes
I think the current patch solves the bug, there are no longer failures to
terminate threads which is a bug in the implementation.

It sounds like there is a new lower priority bug to clean out the example
which throws up EXAMPLE_ERR.

If that makes sense I am happy to add reviewed by.

On 20 April 2015 at 08:32, Ola Liljedahl ola.liljed...@linaro.org wrote:

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

 Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org


Tested-


 ---
 (This document/code contribution attached is provided under the terms of
 agreement LES-LTM-21309)

  example/timer/odp_timer_test.c | 38 ++
  1 file changed, 38 insertions(+)

 diff --git a/example/timer/odp_timer_test.c
 b/example/timer/odp_timer_test.c
 index 6b60ec4..fd31466 100644
 --- a/example/timer/odp_timer_test.c
 +++ b/example/timer/odp_timer_test.c
 @@ -79,6 +79,41 @@ struct test_timer {
  static struct test_timer tt[256];

  /** @private test timeout */
 +static void free_event(odp_event_t ev)
 +{
 +   switch (odp_event_type(ev)) {
 +   case ODP_EVENT_BUFFER:
 +   odp_buffer_free(odp_buffer_from_event(ev));
 +   break;
 +   case ODP_EVENT_PACKET:
 +   odp_packet_free(odp_packet_from_event(ev));
 +   break;
 +   case ODP_EVENT_TIMEOUT:
 +   odp_timeout_free(odp_timeout_from_event(ev));
 +   break;
 +   case ODP_EVENT_CRYPTO_COMPL:
 +   odp_crypto_compl_free(odp_crypto_compl_from_event(ev));
 +   break;
 +   default:
 +   fprintf(stderr, Unrecognized event type %d\n,
 +   odp_event_type(ev));
 +   abort();
 +   }
 +}
 +
 +/** @private test timeout */
 +static void remove_prescheduled_events(void)
 +{
 +   odp_event_t ev;
 +   odp_queue_t queue;
 +   odp_schedule_pause();
 +   while ((ev = odp_schedule(queue, ODP_SCHED_NO_WAIT)) !=
 +   ODP_EVENT_INVALID) {
 +   free_event(ev);
 +   }
 +}
 +
 +/** @private test timeout */
  static void test_abs_timeouts(int thr, test_args_t *args)
  {
 uint64_t period;
 @@ -173,6 +208,9 @@ static void test_abs_timeouts(int thr, test_args_t
 *args)
 /* Since we have cancelled the timer, there is no timeout event to
  * return from odp_timer_free() */
 (void)odp_timer_free(ttp-tim);
 +
 +   /* Remove any prescheduled events */
 +   remove_prescheduled_events();
  }


 --
 1.9.1

 ___
 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 http://www.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


[lng-odp] ODP Website updated

2015-04-20 Thread Marshall Guillory
All-

Several minor updates completed to the web site today.

changelog:
http://www.opendataplane.org/ - new menu item, updated platform details
callout
http://www.opendataplane.org/status/opendataplane-roadmap/ - updated
roadmap 1.0.3.
http://www.opendataplane.org/testing/ - removed outdated test results.

​New menu / page item: Press.

​

-- 
Sincerely,

Marshall Guillory

Technical Program Enabler, Agile Coach, Scrum master
Networking (LNG) and Platform (LAB, QAS, SYS, Builds) Groups
Engineering Group
Content Manager - opendataplane.org

M:  +1.405.609.4491 IRC: marshallg
E: marshall.guill...@linaro.org
Peoria, Arizona, USA

Linaro.org │ Open source software for ARM SoCs

[image: Twitter] https://twitter.com/LinaroOrg  [image: Facebook]
https://www.facebook.com/LinaroOrg  [image: Google Plus]
https://plus.google.com/u/0/112814496864921562564/posts  [image:
Youtube] https://www.youtube.com/user/LinaroOrg
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] helper: linux: doxygen: group linux api

2015-04-20 Thread Anders Roxell
On 2015-04-17 15:33, Mike Holmes wrote:
 Signed-off-by: Mike Holmes mike.hol...@linaro.org
 ---
  helper/include/odp/helper/linux.h | 8 
  1 file changed, 8 insertions(+)
 
 diff --git a/helper/include/odp/helper/linux.h 
 b/helper/include/odp/helper/linux.h
 index 146e26c..b4f011b 100644
 --- a/helper/include/odp/helper/linux.h
 +++ b/helper/include/odp/helper/linux.h
 @@ -27,6 +27,11 @@ extern C {
  #include pthread.h
  #include sys/types.h
  
 +
 +/** @addtogroup odph_linux ODPH LINUX

Can we add some description here?

Cheers,
Anders

 + *  @{
 + */
 +
  /** The thread starting arguments */
  typedef struct {
   void *(*start_routine) (void *); /** The function to run */
 @@ -129,6 +134,9 @@ int odph_linux_process_fork_n(odph_linux_process_t 
 *proc_tbl,
   */
  int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num);
  
 +/**
 + * @}
 + */
  
  #ifdef __cplusplus
  }
 -- 
 2.1.0
 
 ___
 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] api: classification: connect PMR on creation

2015-04-20 Thread Bill Fischofer
Classification is a collaboration between the implementation and the
application.  It is the application's responsibility to write unambiguous
classification rules and it is the implementation's job to perform the
match as efficiently and as specifically as possible.

On Mon, Apr 20, 2015 at 7:33 AM, Ola Liljedahl ola.liljed...@linaro.org
wrote:

 On 17 April 2015 at 22:55, Rosenboim, Leonid 
 leonid.rosenb...@caviumnetworks.com wrote:


 Guys,

 There are several versions of the Classifier API document floating in
 Google docs, here is one such copy:


 https://docs.google.com/document/d/14KMqNPIgd7InwGzdP2EaI9g_V3o0_wxpgp3N-nd-RBE/edit?usp=sharing

 Here is a different perspective on what PMR and COS mean,  perhaps in
 terms of an abstract hardware implementation:

 CoS is a meta-data field assigned to each packet as it traverses the
 classifier pipe-line.

 A packet is assigned an initial CoS by the pktio port which received it.

 Then, the packet is compared multiple times against a set of rules, and
 as it is common with TCAMs, each comparisons happens against all rules in
 parallel.

 Each rule has two values to match: 1. the current CoS meta-data field;
 and 2. a certain packet header field (value with a mask).
 If both these values match, the packet met-data CoS field is changed
 (Action taken) with the destination CoS of the matching rule.

 It is assumed that up to  one such rule has matched.

 If a rule has matched, CoS has changed, the process continues one more
 time.

 If NO MATCH occured, the classification process is finished, and the
 packet is delivered in accordance to the current CoS (i.e. the last
 matching rule or the pktio default CoS if the first rule match failed).

 So partial matches are valid. Is this what we want, e.g. from application
 point of view and from HW point of view?

 Is partial matches what is commonly supported by HW classifiers?

 A classifier which supports these longest prefix matches can easily
 implement perfect matching (all partial matches just specify the default
 CoS). But a classifier which only supports perfect matching cannot directly
 support partial matches. I assume you would have to internally create
 rules/patterns for all (relevant) partial matches as well. The
 implementation can find all relevant partial matches (prefix rules which
 specify a CoS different from the default CoS) and add those to the list of
 rules. Longer prefix matches should be prioritized (however that is done)
 over shorter prefix matches.

 The reason I really want to understand the required semantics is that I am
 planning to design an optimized parser/classifier in SW. Pointer-chasing is
 a no-no, performance will come from cache-friendly access pattern and some
 kind of parallelism (e.g. SIMD). I don't know how good it can get.



 According to CoS, the packet buffer pool and the destination queue are
 selected, and the packet is ready for application processing.

 Here are some additional observations with regads to use of CoS values:

 Multiple pktio may assign the same CoS initially. (eaming many pktio to
 one CoS)

 Multple rules can assign the same CoS as destination (action). (meaning
 multuple PMR to one destination CoS).

 Regarding the source CoS of a PMR, I can not rule out a PMR that can
 match multiple CoS values (that is creating a many-to-many src-CoS to PMR
 relationship), but this scheme seems problematic for ease of use as well as
 implementation, so I would recommend to assume that each PMR should only
 have a single source CoS.

 Multiple PMRs may have the same source-CoS, but different header fields
 ot value/mask (creating an OR  combination of PMRs).

 I felt that I had to take this discussion ina completely different
 direction to avoid infinite recursion ;-)

 Good weekend all,

 - Leo



 ___
 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


[lng-odp] [PATCH v3] example: doxygen: remove examples from src path

2015-04-20 Thread Mike Holmes
If the examples are on the src path they pollute the documentation
with their own declarations.

The correct mechanism is to declare the examples to be seen in the
documentation in one location that is on the .dox path, and have the
EXAMPLE_PATH locate the actual example code.

Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
v3 fix * in comments to look like all the other files

 doc/doxygen.cfg   |  7 ++-
 doc/examples.dox  | 20 
 example/generator/odp_generator.c |  6 --
 example/packet/odp_pktio.c|  6 --
 example/timer/odp_timer_test.c|  6 --
 5 files changed, 26 insertions(+), 19 deletions(-)
 create mode 100644 doc/examples.dox

diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
index 4208afa..6283387 100644
--- a/doc/doxygen.cfg
+++ b/doc/doxygen.cfg
@@ -10,7 +10,12 @@ TYPEDEF_HIDES_STRUCT = NO
 EXTRACT_STATIC = YES
 SORT_MEMBER_DOCS = NO
 WARN_NO_PARAMDOC = YES
-INPUT = $(SRCDIR)/doc $(SRCDIR)/doc/users-guide $(SRCDIR)/include 
$(SRCDIR)/platform/linux-generic/include/odp 
$(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp $(SRCDIR)/helper/include 
$(SRCDIR)/example/packet $(SRCDIR)/example/generator $(SRCDIR)/example/timer
+INPUT = $(SRCDIR)/doc \
+   $(SRCDIR)/doc/users-guide \
+   $(SRCDIR)/include \
+   $(SRCDIR)/platform/linux-generic/include/odp \
+   $(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp \
+   $(SRCDIR)/helper/include
 FILE_PATTERNS = *.h odp*.c *.dox
 RECURSIVE = YES
 SOURCE_BROWSER = YES
diff --git a/doc/examples.dox b/doc/examples.dox
new file mode 100644
index 000..2a7c597
--- /dev/null
+++ b/doc/examples.dox
@@ -0,0 +1,20 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @example odp_generator.c
+ * ODP loopback demo application
+ */
+
+/**
+ *@example odp_pktio.c
+ * ODP basic packet IO loopback test application
+ */
+
+/**
+ * @example odp_timer_test.c
+ * ODP timer example application
+ */
diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 2ac0b47..8ae5b29 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -4,12 +4,6 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-/**
- * @file
- *
- * @example odp_generator.c ODP loopback demo application
- */
-
 /** enable strtok */
 #define _POSIX_C_SOURCE 200112L
 
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 61af855..f08d9f4 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -4,12 +4,6 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-/**
- * @file
- *
- * @example odp_pktio.c  ODP basic packet IO loopback test application
- */
-
 #include stdlib.h
 #include string.h
 #include getopt.h
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 6b60ec4..acac580 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -4,12 +4,6 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-/**
- * @file
- *
- * @example  odp_timer_test.c ODP timer example application
- */
-
 #include string.h
 #include stdlib.h
 
-- 
2.1.0

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


Re: [lng-odp] [API-NEXT PATCHv4 1/6] api: packet: add user metadata APIs

2015-04-20 Thread Bill Fischofer
User metadata is orthogonal to the existing user_ptr/u64 because we didn't
change the latter when we added the former.  If we want to deprecate the
latter in favor of the former, that's a separate API change.

We have to be very careful to not make unnecessary changes to existing APIs
at this point. Introducing new APIs is fine and deprecating old ones is
fine (with an appropriate transition period), but yanking APIs as part of
introducing new ones is a no-no.  That's the sort of gratuitous change that
applications really don't like.

On Mon, Apr 20, 2015 at 6:39 AM, Ola Liljedahl ola.liljed...@linaro.org
wrote:

 On 16 April 2015 at 15:01, Savolainen, Petri (Nokia - FI/Espoo) 
 petri.savolai...@nokia.com wrote:



  -Original Message-
  From: ext Taras Kondratiuk [mailto:taras.kondrat...@linaro.org]
  Sent: Thursday, April 16, 2015 3:13 PM
  To: Savolainen, Petri (Nokia - FI/Espoo); Bill Fischofer
  Cc: lng-odp@lists.linaro.org
  Subject: Re: [lng-odp] [API-NEXT PATCHv4 1/6] api: packet: add user
  metadata APIs
 
  On 04/16/2015 02:40 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:
  
  
   -Original Message-
   From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
  ext
   Taras Kondratiuk
   Sent: Thursday, April 16, 2015 12:05 PM
   To: Bill Fischofer; lng-odp@lists.linaro.org
   Subject: Re: [lng-odp] [API-NEXT PATCHv4 1/6] api: packet: add user
   metadata APIs
  
   On 04/10/2015 06:52 PM, Bill Fischofer wrote:
   Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
   ---
  include/odp/api/packet.h | 20 
  1 file changed, 20 insertions(+)
  
   diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
   index a31c54d..840e152 100644
   --- a/include/odp/api/packet.h
   +++ b/include/odp/api/packet.h
   @@ -467,6 +467,26 @@ uint64_t odp_packet_user_u64(odp_packet_t pkt);
  void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx);
  
  /**
   + * Get address of user metadata associated with a packet
   + *
   + * @param pkt Packet handle
   + *
   + * @retval addr   Address of the user metadata associated
  with
   pkt
   + * @retval NULL   The packet has no user metadata.
   + */
   +void *odp_packet_user_data(odp_packet_t pkt);
   +
   +/**
   + * Get size of user metadata associated with a packet
   + *
   + * @param pkt Packet handle
   + *
   + * @returnNumber of bytes of user metadata
 associated
   + *with pkt.
   + */
   +uint32_t odp_packet_user_data_size(odp_packet_t pkt);
   +
   +/**
   * Layer 2 start pointer
   *
   * Returns pointer to the start of the layer 2 header.
 Optionally,
   outputs
  
  
   I assume usage of user_data, user_ptr and user_u64 are all mutually
   exclusive. I mean the same memory location can be used to store all
 of
   them. It should be noted somewhere.
  
   I was thinking this as a separate area, but maybe it's clearer that we
  have only one user metadata area, which is always at least 8 bytes
  (user_ptr / user_64). An additional area is allocated, when user
 requests
  pool_param.udata_size 8 bytes. Implementation can always reserve 8
 bytes
  in the descriptor and use the same bytes for the pointer to a larger
 udata
  area.
 
  Actually having three ways (and six! API functions) to access packets'
  user data is too much. And it is confusing. Now we have to explain in
  comments how all these three ways affect each other.
 
  IMO only one user_data is enough. This is exactly what we had in the
  initial Buffer/Packet design document. Then for some reason we decided
  to switch to just a single pointer. Then we have added u64. And now we
  are bringing configurable udata back. I haven't quite followed the
  logic.

 Simple set/get ptr is easier to pack into the packet descriptor itself
 (those bytes do not have to aligned or even linear in the memory). And
 usually one pointer is enough for the application. U64 is there to avoid
 ptr vs. uint cast problems.

 The variable size user data area has to be contiguous and in a certain
 alignment (8 bytes ?) and thus more difficult to fit into the descriptor
 itself (= lower  performance due to extra pointer reference and potential
 cache miss).

 So, to get benefit from these we should specify that:

 - If pool_param.udata_size != 0, udata is supported but user_ptr/user_u64
 is not
* packet descriptor needs to have space only for one pointer

 System-provided userdata area.

 - If pool_param.udata_size == 0, user_ptr/user_u64 are supported but udata
 is not
* the pointer space in the descriptor does not have to be aligned and
 contiguous

 User-provided userdata area (if the pointer is used, the corresponding
 64-bit userdata area *is* provided by the system by reusing the memory for
 the pointer).

 Or call it application-provided userdata if the use of user in
 multiple places is confusing?




 -Petri