[lng-odp] [Bug 1203] New: Clang build now fails with _ODP_STATIC_ASSERT

2015-02-03 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1203

Bug ID: 1203
   Summary: Clang build now fails with  _ODP_STATIC_ASSERT
   Product: OpenDataPlane
   Version: 0.10
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: ---
 Component: General ODP API or linux-generic implimentation
  Assignee: lng-odp@lists.linaro.org
  Reporter: mike.hol...@linaro.org

To reproduce make CC=clang

make[2]: Entering directory '/home/mike/git/odp/platform/linux-generic'
  CC   odp_barrier.lo
  CC   odp_buffer.lo
In file included from odp_buffer.c:8:
In file included from ./include/odp_buffer_pool_internal.h:25:
./include/odp_buffer_internal.h:53:1: error: expected identifier or '('
_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_BUF_LEN_MIN = 256,
^
../../include/odp/api/debug.h:48:40: note: expanded from macro
'_ODP_STATIC_ASSERT'
#define _ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
   ^
../../include/odp/api/debug.h:34:31: note: expanded from macro '_Static_assert'
#define _Static_assert(e, s) (extern int (*static_assert_checker(void)) \
  ^
In file included from odp_buffer.c:8:
In file included from ./include/odp_buffer_pool_internal.h:25:
./include/odp_buffer_internal.h:53:1: error: expected ')'
../../include/odp/api/debug.h:48:40: note: expanded from macro
'_ODP_STATIC_ASSERT'
#define _ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
   ^
../../include/odp/api/debug.h:34:31: note: expanded from macro '_Static_assert'
#define _Static_assert(e, s) (extern int (*static_assert_checker(void)) \
  ^
./include/odp_buffer_internal.h:53:1: note: to match this '('
../../include/odp/api/debug.h:48:40: note: expanded from macro
'_ODP_STATIC_ASSERT'
#define _ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
   ^
../../include/odp/api/debug.h:34:30: note: expanded from macro '_Static_assert'
#define _Static_assert(e, s) (extern int (*static_assert_checker(void)) \
 ^
In file included from odp_buffer.c:8:

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


Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h

2015-02-03 Thread Savolainen, Petri (NSN - FI/Espoo)
Sorry about top posting … just cannot reply cleanly on HTML mails.

Mike, I have seen same thing happening on your patches. On a patch series, one 
patch modifies a file in one direction and another patch modifies the same in 
other direction, but as long as the end result is OK - I have not minded. Maybe 
we have a new rule then on top of check patch and make check passing on each 
step: “each patch set must be optimized for minimum number of changes per file”.

Sure, I can fix it if it’s worth of the delay.

-Petri


From: ext Mike Holmes [mailto:mike.hol...@linaro.org]
Sent: Wednesday, February 04, 2015 12:59 AM
To: Bill Fischofer
Cc: Anders Roxell; Savolainen, Petri (NSN - FI/Espoo); LNG ODP Mailman List
Subject: Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h



On 3 February 2015 at 17:10, Bill Fischofer 
bill.fischo...@linaro.orgmailto:bill.fischo...@linaro.org wrote:
My review simply says I'm happy with it.  Others can NAK it if they choose.

On Tue, Feb 3, 2015 at 3:54 PM, Anders Roxell 
anders.rox...@linaro.orgmailto:anders.rox...@linaro.org wrote:
On 2015-02-03 11:16, Bill Fischofer wrote:
 For this series:

 Reviewed-by: Bill Fischofer 
 bill.fischo...@linaro.orgmailto:bill.fischo...@linaro.org

 On Tue, Feb 3, 2015 at 5:25 AM, Savolainen, Petri (NSN - FI/Espoo) 
 petri.savolai...@nsn.commailto:petri.savolai...@nsn.com wrote:

 
 

[...]

+ *
+ * CPU number where the thread is currently running. CPU numbering is
   system
+ * specific.
+ *
+ * @return CPU number
+ */
+int odp_cpu(void);
Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
odp_cpu is missing something and does not lead to direct
understanding of what the function does or returns.
  
   I become odp_cpu_id() in the second patch.
   Why not to name it like this in the first patch?
 
  I rebased the second commit (should have rebased the first). The commit
  history is not perfect, but I think we can live with that.

Why do we think this is good enough when others have to redo their
patches?

nack: I don't think it is ok to accept something when we know it is incorrect.



Cheers,
Anders


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



--
Mike Holmes
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv5 00/19] Add Strong Typing for ODP Abstract Types

2015-02-03 Thread Mike Holmes
I think  we need to add unit tests for the new APIs introduced

On 2 February 2015 at 23:44, Bill Fischofer bill.fischo...@linaro.org
wrote:

 This patch series adds strong typing support for ODP abstract types. This
 prevents incorrect types from being used with ODP APIs. Misuse of types
 will
 now result in a compile-time error.

 To allow handles to be printed for diagnostic purposes the following new
 APIs
 are added that have the signatures:

 uint64_t odp_buffer_to_u64(odp_buffer_t hdl);
 uint64_t odp_cos_to_u64(odp_cos_t hdl);
 uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
 uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl);
 uint64_t odp_pmr_to_u64(odp_pmr_t_hdl);
 uint64_t odp_pmr_set_to_u64(odp_pmr_set_t hdl);
 uint64_t odp_event_to_u64(odp_event_t hdl);
 uint64_t odp_packet_to_u64(odp_packet_t hdl);
 uint64_t odp_packet_seg_to_u64(odp_packet_seg_t_print);
 uint64_t odp_pool_to_u64(odp_pool_t hdl);
 uint64_t odp_pktio_to_u64(odp_pktio_t hdl);
 uint64_t odp_queue_to_u64(odp_queue_t hdl);
 uint64_t odp_shm_to_u64(odp_shm_t hdl);

 The output of these routines should be printed using the C99 PRIu64 format
 code, and examples are updated to this convention.

 Patch change history:
 v2 - Adds print functions for the remaining public ODP types. It is also
 rebased to apply on the 0.10.0 release of ODP.

 v3 - Corrects the definition of odp_buffer_bits to ensure that correct
 fields
 are referenced on both big and little endian systems.

 v4 - Add missing strong typing support for odp_crypto_session_t and
 odp_crypto_compl_t types.

 v5 - Change display function names from odp_type_t_print() to
 odp_type_to_u64(). Split out API changes from linux-generic
 implementation
 changes.

 Petri: Please review these new APIs. All other changes as a result of this
 patch are internal and transparent to ODP applications.

 Bill Fischofer (19):
   api: buffers: add strong typing handle diplay function
   api: classification: add strong typing handle display functions
   api: crypto: add strong typing handle display functions
   api: events: add strong typing handle display function
   api: packets: add strong typing handle display function
   api: pktio: add strong typing handle display function
   api: pool: add strong typing handle display function
   api: queues: add strong typing handle display function
   api: shm: add strong typing handle display function
   linux-generic: add base macros for strong typing support
   linux-generic: buffers: add strong typing support
   linux-generic: classification: add strong typing support
   linux-generic: crypto: add strong typing support
   linux-generic: events: add strong typing support
   linux-generic: pktio: add strong typing support
   linux-generic: packets: add strong typing support
   linux-generic: pool: add strong typing support
   linux-generic: queues: add strong typing support
   linux-generic: shm: add strong typing support

  example/generator/odp_generator.c  | 12 +++--
  example/ipsec/odp_ipsec.c  | 18 +---
  example/l2fwd/odp_l2fwd.c  | 11 +++--
  example/packet/odp_pktio.c | 22 ++
  include/odp/api/buffer.h   | 13 ++
  include/odp/api/classification.h   | 44
 ---
  include/odp/api/crypto.h   | 26 +++
  include/odp/api/event.h| 12 +
  include/odp/api/packet.h   | 25 +++
  include/odp/api/packet_io.h| 12 +
  include/odp/api/pool.h | 13 ++
  include/odp/api/queue.h| 13 ++
  include/odp/api/shared_memory.h| 13 ++
  platform/linux-generic/Makefile.am |  1 +
  .../linux-generic/include/odp/plat/buffer_types.h  | 15 +--
  .../include/odp/plat/classification_types.h| 34 ---
  .../linux-generic/include/odp/plat/crypto_types.h  | 13 +-
  .../linux-generic/include/odp/plat/event_types.h   | 14 --
  .../include/odp/plat/packet_io_types.h | 15 +--
  .../linux-generic/include/odp/plat/packet_types.h  | 24 +++---
  .../linux-generic/include/odp/plat/pool_types.h| 13 +-
  .../linux-generic/include/odp/plat/queue_types.h   | 14 --
  .../include/odp/plat/shared_memory_types.h | 13 +-
  .../linux-generic/include/odp/plat/strong_types.h  | 38 
  .../linux-generic/include/odp_buffer_inlines.h | 16 ---
  .../linux-generic/include/odp_buffer_internal.h| 31 ++---
  .../include/odp_buffer_pool_internal.h |  4 +-
  .../linux-generic/include/odp_packet_io_internal.h |  4 +-
  .../linux-generic/include/odp_queue_internal.h |  4 +-
  platform/linux-generic/odp_buffer.c|  3 +-
  platform/linux-generic/odp_buffer_pool.c   |  3 

[lng-odp] classification tests scheduled queues

2015-02-03 Thread Radu-Andrei Bulie
Hi,

I have a comment regarding the scheduling approach in the classification 
validation tests (this also can be extended to other tests which use the same 
pattern).
The schedule function should be called in context of a data path thread that is 
bound to a known core (the same model as in pktio application for instance).  
Otherwise
(as in the mentioned test) the main process (in this case the cunit test) can 
be scheduled by Linux on any core - e.g core 0 - that is not in the data path. 
In this situation no dequeue will occur,  because the scheduling does not take 
place on a data path thread (unlike  the case for pktio application where there 
is a  cpu dedicated to control path).
From the linux-generic perspective,  there is no apparent issue in using the 
schedule function in this context. But as it is given in the reference 
application, the purpose of the scheduling is to function on the data path and 
thus to provide the advantages given by different SoCs acceleration 
implementations. (there will always be a control core and some data path 
cores).
Thus, being in accordance with the reference applications from odp, I suggest 
replacing the scheduled queues with poll queues or create a separate thread 
which receives the packet, otherwise the test will function only on linux 
generic implementation.

PS: I could send the patch (using poll queues approach) if we reach a consensus.


Regards,

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


[lng-odp] [PATCHv4 13/18] api: odp_schedule.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/schedule.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
index 71264a7..3019b84 100644
--- a/include/odp/api/schedule.h
+++ b/include/odp/api/schedule.h
@@ -65,7 +65,8 @@ uint64_t odp_schedule_wait_time(uint64_t ns);
  *Use odp_schedule_wait_time() to convert time to other wait
  *values.
  *
- * @return Next highest priority event, or ODP_EVENT_INVALID
+ * @return Next highest priority event
+ * @retval ODP_EVENT_INVALID on timeout and no events available
  */
 odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait);
 
-- 
1.9.1


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


[lng-odp] [PATCHv4 16/18] api: odp_timer.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.
Documented API calls which are guaranteed to handle invalid/stale handles.
Removed unnecessary warnings of undefined behavior.

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

 include/odp/api/timer.h | 52 -
 1 file changed, 17 insertions(+), 35 deletions(-)

diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
index 64ccc4b..1b813da 100644
--- a/include/odp/api/timer.h
+++ b/include/odp/api/timer.h
@@ -112,8 +112,8 @@ typedef struct {
  * @param name   Name of the timer pool. The string will be copied.
  * @param params Timer pool parameters. The content will be copied.
  *
- * @return Timer pool handle if successful, otherwise ODP_TIMER_POOL_INVALID
- * and errno set
+ * @return Timer pool handle on success
+ * @retval ODP_TIMER_POOL_INVALID on failure and errno set
  */
 odp_timer_pool_t
 odp_timer_pool_create(const char *name,
@@ -135,14 +135,14 @@ void odp_timer_pool_start(void);
  * Destroy a timer pool, freeing all resources.
  * All timers must have been freed.
  *
- * @param tpid  Timer pool identifier
+ * @param tpid  Timer pool handle
  */
 void odp_timer_pool_destroy(odp_timer_pool_t tpid);
 
 /**
  * Convert timer ticks to nanoseconds
  *
- * @param tpid  Timer pool identifier
+ * @param tpid  Timer pool handle
  * @param ticks Timer ticks
  *
  * @return Nanoseconds
@@ -152,7 +152,7 @@ uint64_t odp_timer_tick_to_ns(odp_timer_pool_t tpid, 
uint64_t ticks);
 /**
  * Convert nanoseconds to timer ticks
  *
- * @param tpid  Timer pool identifier
+ * @param tpid  Timer pool handle
  * @param nsNanoseconds
  *
  * @return Timer ticks
@@ -162,7 +162,7 @@ uint64_t odp_timer_ns_to_tick(odp_timer_pool_t tpid, 
uint64_t ns);
 /**
  * Current tick value
  *
- * @param tpid Timer pool identifier
+ * @param tpid Timer pool handle
  *
  * @return Current time in timer ticks
  */
@@ -181,12 +181,14 @@ typedef struct {
 
 /**
  * Query timer pool configuration and current state
+ * @note This is the only timer API function which accepts invalid handles
+ * (any bit value) without causing undefined behavior.
  *
- * @param tpid Timer pool identifier
+ * @param tpid Timer pool handle
  * @param[out] info Pointer to information buffer
  *
- * @retval 0 Success
- * @retval -1 Failure. Info could not be retrieved.
+ * @retval 0 on success
+ * @retval 0 on failure. Info could not be retrieved.
  */
 int odp_timer_pool_info(odp_timer_pool_t tpid,
odp_timer_pool_info_t *info);
@@ -198,12 +200,12 @@ int odp_timer_pool_info(odp_timer_pool_t tpid,
  * the timer pool. The user_ptr is copied to timeouts and can be retrieved
  * using the odp_timeout_user_ptr() call.
  *
- * @param tpid Timer pool identifier
+ * @param tpid Timer pool handle
  * @param queueDestination queue for timeout notifications
  * @param user_ptr User defined pointer or NULL to be copied to timeouts
  *
- * @return Timer handle if successful, otherwise ODP_TIMER_INVALID and
- *errno set.
+ * @return Timer handle on success
+ * @retval ODP_TIMER_INVALID on failure and errno set.
  */
 odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid,
odp_queue_t queue,
@@ -218,7 +220,8 @@ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid,
  * responsibility of the application to handle this timeout when it is 
received.
  *
  * @param tim  Timer handle
- * @return Event handle of timeout event or ODP_EVENT_INVALID
+ * @return Event handle of timeout event
+ * @retval ODP_EVENT_INVALID on failure
  */
 odp_event_t odp_timer_free(odp_timer_t tim);
 
@@ -228,9 +231,6 @@ odp_event_t odp_timer_free(odp_timer_t tim);
  * Set (arm) the timer to expire at specific time. The timeout
  * event will be enqueued when the timer expires.
  *
- * Note: any invalid parameters will be treated as programming errors and will
- * cause the application to abort.
- *
  * @param tim  Timer
  * @param abs_tck  Expiration time in absolute timer ticks
  * @param[in,out] tmo_ev  Reference to an event variable that points to
@@ -255,9 +255,6 @@ int odp_timer_set_abs(odp_timer_t tim,
  *
  * Set (arm) the timer to expire at a relative future time.
  *
- * Note: any invalid parameters will be treated as programming errors and will
- * cause the application to abort.
- *
  * @param tim  Timer
  * @param rel_tck  Expiration time in timer ticks relative to current time of
  *the timer pool the timer belongs to
@@ -287,22 +284,16 @@ int odp_timer_set_rel(odp_timer_t tim,
  * A timer that has already expired may be impossible to cancel and the timeout
  * will instead be delivered to the destination queue.
  *
- * Note: any invalid parameters will be treated as programming errors and will
- * cause the 

[lng-odp] [PATCHv4 10/18] api: odp_packet_flags.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/packet_flags.h | 51 --
 1 file changed, 34 insertions(+), 17 deletions(-)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index df1486b..f9e8ae8 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -41,7 +41,8 @@ int odp_packet_has_error(odp_packet_t pkt);
  * Check for L2 header, e.g. ethernet
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid  known L2 header, 0 otherwise
+ * @retval 1 if packet contains a valid  known L2 header
+ * @retval 0 if packet does not contain a valid  known L2 header
  */
 int odp_packet_has_l2(odp_packet_t pkt);
 
@@ -49,7 +50,8 @@ int odp_packet_has_l2(odp_packet_t pkt);
  * Check for L3 header, e.g. IPv4, IPv6
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid  known L3 header, 0 otherwise
+ * @retval 1 if packet contains a valid  known L3 header
+ * @retval 0 if packet does not contain a valid  known L3 header
  */
 int odp_packet_has_l3(odp_packet_t pkt);
 
@@ -57,7 +59,8 @@ int odp_packet_has_l3(odp_packet_t pkt);
  * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP)
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid  known L4 header, 0 otherwise
+ * @retval 1 if packet contains a valid  known L4 header
+ * @retval 0 if packet does not contain a valid  known L4 header
  */
 int odp_packet_has_l4(odp_packet_t pkt);
 
@@ -65,7 +68,8 @@ int odp_packet_has_l4(odp_packet_t pkt);
  * Check for Ethernet header
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid eth header, 0 otherwise
+ * @retval 1 if packet contains a valid eth header
+ * @retval 0 if packet does not contain a valid  known eth header
  */
 int odp_packet_has_eth(odp_packet_t pkt);
 
@@ -73,7 +77,8 @@ int odp_packet_has_eth(odp_packet_t pkt);
  * Check for jumbo frame
  *
  * @param pkt Packet handle
- * @return 1 if packet contains jumbo frame, 0 otherwise
+ * @retval 1 if packet contains a jumbo frame
+ * @retval 0 if packet does not contain a jumbo frame
  */
 int odp_packet_has_jumbo(odp_packet_t pkt);
 
@@ -81,7 +86,8 @@ int odp_packet_has_jumbo(odp_packet_t pkt);
  * Check for VLAN
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a VLAN header, 0 otherwise
+ * @retval 1 if packet contains a VLAN header
+ * @retval 0 if packet does not contain a VLAN header
  */
 int odp_packet_has_vlan(odp_packet_t pkt);
 
@@ -89,7 +95,8 @@ int odp_packet_has_vlan(odp_packet_t pkt);
  * Check for VLAN QinQ (stacked VLAN)
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a VLAN QinQ header, 0 otherwise
+ * @retval 1 if packet contains a VLAN QinQ header
+ * @retval 0 if packet does not contain a VLAN QinQ header
  */
 int odp_packet_has_vlan_qinq(odp_packet_t pkt);
 
@@ -97,7 +104,8 @@ int odp_packet_has_vlan_qinq(odp_packet_t pkt);
  * Check for ARP
  *
  * @param pkt Packet handle
- * @return 1 if packet contains an ARP header, 0 otherwise
+ * @retval 1 if packet contains an ARP message
+ * @retval 0 if packet does not contain an ARP message
  */
 int odp_packet_has_arp(odp_packet_t pkt);
 
@@ -105,7 +113,8 @@ int odp_packet_has_arp(odp_packet_t pkt);
  * Check for IPv4
  *
  * @param pkt Packet handle
- * @return 1 if packet contains an IPv4 header, 0 otherwise
+ * @retval 1 if packet contains an IPv4 header
+ * @retval 0 if packet does not contain an IPv4 header
  */
 int odp_packet_has_ipv4(odp_packet_t pkt);
 
@@ -113,7 +122,8 @@ int odp_packet_has_ipv4(odp_packet_t pkt);
  * Check for IPv6
  *
  * @param pkt Packet handle
- * @return 1 if packet contains an IPv6 header, 0 otherwise
+ * @retval 1 if packet contains an IPv6 header
+ * @retval 0 if packet does not contain an IPv6 header
  */
 int odp_packet_has_ipv6(odp_packet_t pkt);
 
@@ -121,7 +131,8 @@ int odp_packet_has_ipv6(odp_packet_t pkt);
  * Check for IP fragment
  *
  * @param pkt Packet handle
- * @return 1 if packet is an IP fragment, 0 otherwise
+ * @retval 1 if packet is an IP fragment
+ * @retval 0 if packet is not an IP fragment
  */
 int odp_packet_has_ipfrag(odp_packet_t pkt);
 
@@ -129,7 +140,8 @@ int odp_packet_has_ipfrag(odp_packet_t pkt);
  * Check for IP options
  *
  * @param pkt Packet handle
- * @return 1 if packet contains IP options, 0 otherwise
+ * @retval 1 if packet contains IP options
+ * @retval 0 if packet does not contain IP options
  */
 int odp_packet_has_ipopt(odp_packet_t pkt);
 
@@ -137,7 +149,8 @@ int odp_packet_has_ipopt(odp_packet_t pkt);
  * Check for IPSec
  *
  * @param pkt Packet handle
- * @return 1 if packet requires IPSec processing, 0 otherwise
+ * @retval 1 if packet requires IPSec processing
+ * @retval 0 

[lng-odp] [PATCHv4 15/18] api: odp_thread.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/thread.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
index 469d298..d6016cb 100644
--- a/include/odp/api/thread.h
+++ b/include/odp/api/thread.h
@@ -23,9 +23,9 @@ extern C {
  */
 
 /**
- * Get thread id
+ * Get thread identifier
  *
- * @return Thread id of the current thread
+ * @return Thread identifier of the current thread
  */
 int odp_thread_id(void);
 
@@ -33,7 +33,7 @@ int odp_thread_id(void);
 /**
  * Get CPU number
  *
- * @return CPU ID where the thread is currently running
+ * @return CPU number where the thread is currently running
  */
 int odp_thread_cpu(void);
 
-- 
1.9.1


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


[lng-odp] [PATCHv4 18/18] api: odp_crypto.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/crypto.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index e9530a3..0ee9d83 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -265,7 +265,8 @@ typedef struct odp_crypto_op_result {
  * @param session   Created session else ODP_CRYPTO_SESSION_INVALID
  * @param statusFailure code if unsuccessful
  *
- * @return 0 if successful else -1
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int
 odp_crypto_session_create(odp_crypto_session_params_t *params,
@@ -314,7 +315,8 @@ odp_crypto_compl_free(odp_crypto_compl_t completion_event);
  * @param postedPointer to return posted, TRUE for async operation
  * @param resultResults of operation (when posted returns FALSE)
  *
- * @return 0 if successful else -1
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int
 odp_crypto_operation(odp_crypto_op_params_t *params,
-- 
1.9.1


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


[lng-odp] [PATCHv4 17/18] api: odp_cpumask.h: updated descriptions, added const

2015-02-03 Thread Ola Liljedahl
Updated function, parameter and return descriptions.
Added const to some input parameters passed by reference.

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

 include/odp/api/cpumask.h| 100 +--
 platform/linux-generic/odp_cpumask.c |  12 ++---
 2 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/include/odp/api/cpumask.h b/include/odp/api/cpumask.h
index 65969c3..3007c87 100644
--- a/include/odp/api/cpumask.h
+++ b/include/odp/api/cpumask.h
@@ -53,102 +53,118 @@ void odp_cpumask_from_str(odp_cpumask_t *mask, const char 
*str);
 ssize_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *buf, ssize_t 
bufsz);
 
 /**
- * Clear entire mask
- * @param mask CPU mask to flush with zero value
+ * Clear entire CPU mask
+ * @param mask CPU mask to clear
  */
 void odp_cpumask_zero(odp_cpumask_t *mask);
 
 /**
- * Add cpu to mask
- * @param mask  add cpu number in CPU mask
+ * Add CPU to mask
+ * @param mask  CPU mask to update
  * @param cpu   CPU number
  */
 void odp_cpumask_set(odp_cpumask_t *mask, int cpu);
 
 /**
- * Remove cpu from mask
- * @param mask  clear cpu number from CPU mask
+ * Remove CPU from mask
+ * @param mask  CPU mask to update
  * @param cpu   CPU number
  */
 void odp_cpumask_clr(odp_cpumask_t *mask, int cpu);
 
 /**
- * Test if cpu is a member of mask
- * @param mask  CPU mask to check if cpu num set or not
+ * Test if CPU is a member of mask
+ *
+ * @param mask  CPU mask to test
  * @param cpu   CPU number
- * @return  non-zero if set otherwise 0
+ * @return  non-zero if set
+ * @retval  0 if not set
  */
 int odp_cpumask_isset(const odp_cpumask_t *mask, int cpu);
 
 /**
- * Count number of cpus in mask
+ * Count number of CPU's in mask
+ *
  * @param mask  CPU mask
- * @return cpumask count
+ * @return population count
  */
 int odp_cpumask_count(const odp_cpumask_t *mask);
 
 /**
- * Logical AND over two source masks.
+ * Member-wise AND over two CPU masks
  *
- * @param destDestination mask, can be one of the source masks
- * @param src1Source mask 1
- * @param src2Source mask 2
+ * @param destDestination CPU mask (may be one of the source masks)
+ * @param src1Source CPU mask 1
+ * @param src2Source CPU mask 2
  */
-void odp_cpumask_and(odp_cpumask_t *dest, odp_cpumask_t *src1,
-odp_cpumask_t *src2);
+void odp_cpumask_and(odp_cpumask_t *dest, const odp_cpumask_t *src1,
+const odp_cpumask_t *src2);
 
 /**
- * Logical OR over two source masks.
+ * Member-wise OR over two CPU masks
  *
- * @param destDestination mask, can be one of the source masks
- * @param src1Source mask 1
- * @param src2Source mask 2
+ * @param destDestination CPU mask (may be one of the source masks)
+ * @param src1Source CPU mask 1
+ * @param src2Source CPU mask 2
  */
-void odp_cpumask_or(odp_cpumask_t *dest, odp_cpumask_t *src1,
-   odp_cpumask_t *src2);
+void odp_cpumask_or(odp_cpumask_t *dest, const odp_cpumask_t *src1,
+   const odp_cpumask_t *src2);
 
 /**
- * Logical XOR over two source masks.
+ * Member-wise XOR over two CPU masks
  *
- * @param destDestination mask, can be one of the source masks
- * @param src1Source mask 1
- * @param src2Source mask 2
+ * @param destDestination CPU mask (may be one of the source masks)
+ * @param src1Source CPU mask 1
+ * @param src2Source CPU mask 2
  */
-void odp_cpumask_xor(odp_cpumask_t *dest, odp_cpumask_t *src1,
-odp_cpumask_t *src2);
+void odp_cpumask_xor(odp_cpumask_t *dest, const odp_cpumask_t *src1,
+const odp_cpumask_t *src2);
 
 /**
- * Test if two masks contain the same cpus
+ * Test if two CPU masks contain the same CPU's
+ *
+ * @param mask1CPU mask 1
+ * @param mask2CPU mask 2
+ *
+ * @retval non-zero if CPU masks equal
+ * @retval 0 if CPU masks not equal
  */
 int odp_cpumask_equal(const odp_cpumask_t *mask1,
  const odp_cpumask_t *mask2);
 
 /**
  * Copy a CPU mask
+ *
+ * @param destDestination CPU mask
+ * @param src Source CPU mask
  */
 void odp_cpumask_copy(odp_cpumask_t *dest, const odp_cpumask_t *src);
 
 /**
- * Find first CPU that is set in the mask
+ * Find first set CPU in mask
+ *
+ * @param maskCPU mask
  *
- * @param mask is the mask to be searched
- * @return cpu else -1 if no bits set in cpumask
+ * @return cpu number
+ * @retval 0 if no CPU found
  */
 int odp_cpumask_first(const odp_cpumask_t *mask);
 
 /**
- * Find last CPU that is set in the mask
+ * Find last set CPU in mask
  *
- * @param mask is the mask to be searched
- * @return cpu else -1 if no bits set in cpumask
+ * @param maskCPU mask
+ *
+ * @return cpu number
+ * @retval 0 if no CPU found
  */
 int odp_cpumask_last(const odp_cpumask_t *mask);
 
 /**
- * Find next cpu in 

[lng-odp] [PATCHv4 11/18] api: odp_packet_io.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/packet_io.h | 89 ++---
 1 file changed, 51 insertions(+), 38 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 096198c..3bde888 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -56,7 +56,8 @@ extern C {
  * @param pool   Pool from which to allocate buffers for storing packets
  *   received over this packet IO
  *
- * @return ODP packet IO handle or ODP_PKTIO_INVALID on error
+ * @return ODP packet IO handle
+ * @retval ODP_PKTIO_INVALID on failure
  *
  * @note dev name loop is specially pktio reserved name for
  *  device used for testing. Usually it's loop back
@@ -67,110 +68,118 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t 
pool);
 /**
  * Close an ODP packet IO instance
  *
- * @param id  ODP packet IO handle
+ * @param hdl  ODP packet IO handle
  *
- * @return 0 on success or -1 on error
+ * @retval 0 on success
+ * @retval 0 on failure
  */
-int odp_pktio_close(odp_pktio_t id);
+int odp_pktio_close(odp_pktio_t hdl);
 
 /**
  * Return a packet IO handle for an already open device
  *
  * @param dev Packet IO device name
  *
- * @return ODP packet IO handle or ODP_PKTIO_INVALID
+ * @return ODP packet IO handle
+ * @retval ODP_PKTIO_INVALID on failure
  */
 odp_pktio_t odp_pktio_lookup(const char *dev);
 
 /**
  * Receive packets
  *
- * @param id  ODP packet IO handle
+ * @param hdl ODP 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
  *
- * @return Number of packets received or -1 on error
+ * @return Number of packets received
+ * @retval 0 on failure
  */
-int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len);
+int odp_pktio_recv(odp_pktio_t hdl, odp_packet_t pkt_table[], unsigned len);
 
 /**
  * Send packets
  *
- * @param id   ODP packet IO handle
+ * @param hdl  ODP packet IO handle
  * @param pkt_table[]  Array of packets to send
  * @param len  length of pkt_table[]
  *
- * @return Number of packets sent or -1 on error
+ * @return Number of packets sent
+ * @retval 0 on failure
  */
-int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len);
+int odp_pktio_send(odp_pktio_t hdl, odp_packet_t pkt_table[], unsigned len);
 
 /**
  * Set the default input queue to be associated with a pktio handle
  *
- * @param id   ODP packet IO handle
+ * @param hdl  ODP packet IO handle
  * @param queue default input queue set
- * @return  0 on success or -1 on error
+ * @retval  0 on success
+ * @retval 0 on failure
  */
-int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue);
+int odp_pktio_inq_setdef(odp_pktio_t hdl, odp_queue_t queue);
 
 /**
  * Get default input queue associated with a pktio handle
  *
- * @param id  ODP packet IO handle
+ * @param hdl ODP packet IO handle
  *
- * @return Default input queue set or ODP_QUEUE_INVALID on error
+ * @return Default input queue set
+ * @retval ODP_QUEUE_INVALID on failure
  */
-odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id);
+odp_queue_t odp_pktio_inq_getdef(odp_pktio_t hdl);
 
 /**
  * Remove default input queue (if set)
  *
- * @param id  ODP packet IO handle
+ * @param hdl ODP packet IO handle
  *
- * @return 0 on success or -1 on error
+ * @retval 0 on success
+ * @retval 0 on failure
  */
-int odp_pktio_inq_remdef(odp_pktio_t id);
+int odp_pktio_inq_remdef(odp_pktio_t hdl);
 
 /**
  * Query default output queue
  *
- * @param id ODP packet IO handle
+ * @param hdl ODP packet IO handle
  *
- * @return Default out queue or ODP_QUEUE_INVALID on error
+ * @return Default out queue
+ * @retval ODP_QUEUE_INVALID on failure
  */
-odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id);
+odp_queue_t odp_pktio_outq_getdef(odp_pktio_t hdl);
 
 /**
  * Return the currently configured MTU value of a packet IO interface.
  *
- * @param[in] id  ODP packet IO handle.
+ * @param[in] hdl  ODP packet IO handle.
  *
- * @retval MTU value 0 on success.
- * @retval -1 on any error or not existance pktio id.
+ * @return MTU value on success
+ * @retval 0 on failure
  */
-int odp_pktio_mtu(odp_pktio_t id);
+int odp_pktio_mtu(odp_pktio_t hdl);
 
 /**
  * Enable/Disable promiscuous mode on a packet IO interface.
  *
- * @param[in] id   ODP packet IO handle.
+ * @param[in] hdl  ODP packet IO handle.
  * @param[in] enable   1 to enable, 0 to disable.
  *
- * @retval 0 on success.
- * @retval non-zero on any error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
-int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t enable);
+int 

[lng-odp] UberConference Reminder

2015-02-03 Thread UberConference
UberConference Reminder___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCHv4 12/18] api: odp_queue.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/queue.h | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h
index 377a7da..b06522c 100644
--- a/include/odp/api/queue.h
+++ b/include/odp/api/queue.h
@@ -158,7 +158,8 @@ typedef struct odp_queue_param_t {
  * @param typeQueue type
  * @param param   Queue parameters. Uses defaults if NULL.
  *
- * @return Queue handle or ODP_QUEUE_INVALID
+ * @return Queue handle
+ * @retval ODP_QUEUE_INVALID on failure
  */
 odp_queue_t odp_queue_create(const char *name, odp_queue_type_t type,
 odp_queue_param_t *param);
@@ -173,7 +174,8 @@ odp_queue_t odp_queue_create(const char *name, 
odp_queue_type_t type,
  *
  * @param queueQueue handle
  *
- * @return 0 if successful
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_queue_destroy(odp_queue_t queue);
 
@@ -182,7 +184,8 @@ int odp_queue_destroy(odp_queue_t queue);
  *
  * @param nameQueue name
  *
- * @return Queue handle or ODP_QUEUE_INVALID
+ * @return Queue handle
+ * @retval ODP_QUEUE_INVALID on failure
  */
 odp_queue_t odp_queue_lookup(const char *name);
 
@@ -196,7 +199,8 @@ odp_queue_t odp_queue_lookup(const char *name);
  * @param queueQueue handle
  * @param context  Address to the queue context
  *
- * @return 0 if successful
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_queue_set_context(odp_queue_t queue, void *context);
 
@@ -205,8 +209,8 @@ int odp_queue_set_context(odp_queue_t queue, void *context);
  *
  * @param queueQueue handle
  *
- * @return If successful, a pointer to the queue context,
- * NULL for failure.
+ * @return pointer to the queue context
+ * @retval NULL on failure
  */
 void *odp_queue_get_context(odp_queue_t queue);
 
@@ -216,7 +220,8 @@ void *odp_queue_get_context(odp_queue_t queue);
  * @param queue   Queue handle
  * @param ev  Event handle
  *
- * @return 0 if succesful
+ * @retval 0 on success
+ * @retval 0 on failure (e.g. queue full)
  */
 int odp_queue_enq(odp_queue_t queue, odp_event_t ev);
 
@@ -240,7 +245,8 @@ int odp_queue_enq_multi(odp_queue_t queue, const 
odp_event_t events[], int num);
  *
  * @param queue   Queue handle
  *
- * @return Event handle, or ODP_EVENT_INVALID
+ * @return Event handle
+ * @retval ODP_EVENT_INVALID on failure (e.g. queue empty)
  */
 odp_event_t odp_queue_deq(odp_queue_t queue);
 
@@ -251,10 +257,11 @@ odp_event_t odp_queue_deq(odp_queue_t queue);
  * ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead).
  *
  * @param queue   Queue handle
- * @param events  Event handle array for output
- * @param num Maximum number of event handles
+ * @param[out] events  Array of event handles for output
+ * @param num Maximum number of events to dequeue
 
- * @return Number of events written (0 ... num)
+ * @return Number of events actually dequeued (0 ... num)
+ * @retval 0 on failure
  */
 int odp_queue_deq_multi(odp_queue_t queue, odp_event_t events[], int num);
 
-- 
1.9.1


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


[lng-odp] [PATCHv4 00/18] Cleanup return semantics and descriptions

2015-02-03 Thread Ola Liljedahl
Changes since version 3:
Removed unnecessary braces from odp_cpumask.c in patch #1.

Changes since version 2:
Rebased, e.g. due to API restructuring.
Split two patches, separating documentation updates from API changes.
Reordered patches, all serious API changes are now contained in patches 1-4.

Patches #1-#3:
odp_cpumask_to_str(), odp_pktio_mac_addr() and odp_hw_random_get() takes
output buffer size as input and returns number of chars/bytes written (on
success), a negative value on failure.
Added defines (ODP_CPUMASK_BUFSIZE, ODP_PKTIO_MACADDRSIZE) for recommended
output buffer sizes.
Updated the implementations of these calls.
Updated all usages of these calls in example and test programs.

Patch #4:
Changed the definition of odp_queue_enq_multi() to support partial success
(e.g. enqueued some but not all of the events specified). Returns the number
of events enqueued (equivalent to odp_queue_deq_multi()). This change is
necessary to support ODP implementations that use fixed size queues (e.g.
ODP linux-dpdk).
Updated the implementation in odp_queue.c to conform to the new semantics.
Updated the necessary test/validation/performance programs.

Patches #5-#18:
Updated doxygen descriptions, particularly the @return/@retval descriptions.
Specifically documented those API calls which are guaranteed to handle
invalid/stale handles.
No change of implementation necessary.

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

Ola Liljedahl (18):
  api: odp_cpumask.h: odp_cpumask_to_str() return chars written or error
  api: odp_pktio.h: odp_pktio_mac_addr() return chars written or error
  api: odp_crypto.h: odp_hw_random_get(): return number of bytes written
  api: odp_queue.h: odp_queue_enq_multi() returns partial success
  api: odp_buffer.h: undefined behavior description
  api: odp_byteorder.h: updated comment
  api: odp_classification.h: updated return descriptions
  api: odp_init.h: updated return descriptions
  api: odp_packet.h: updated return descriptions
  api: odp_packet_flags.h: updated return descriptions
  api: odp_packet_io.h: updated return descriptions
  api: odp_queue.h: updated return descriptions
  api: odp_schedule.h: updated return descriptions
  api: odp_shared_memory.h: updated return descriptions
  api: odp_thread.h: updated return descriptions
  api: odp_timer.h: updated return descriptions
  api: odp_cpumask.h: updated descriptions, added const
  api: odp_crypto.h: updated return descriptions

 example/generator/odp_generator.c  |   4 +-
 example/ipsec/odp_ipsec.c  |   4 +-
 example/ipsec/odp_ipsec_cache.c|   6 +-
 example/l2fwd/odp_l2fwd.c  |   4 +-
 example/packet/odp_pktio.c |   4 +-
 example/timer/odp_timer_test.c |   4 +-
 include/odp/api/buffer.h   |   4 +-
 include/odp/api/byteorder.h|   2 +-
 include/odp/api/classification.h   |  48 
 include/odp/api/cpumask.h  | 123 +
 include/odp/api/crypto.h   |  23 ++--
 include/odp/api/init.h |  20 ++--
 include/odp/api/packet.h   |  68 ++--
 include/odp/api/packet_flags.h |  51 ++---
 include/odp/api/packet_io.h| 109 ++
 include/odp/api/queue.h|  38 ---
 include/odp/api/schedule.h |   3 +-
 include/odp/api/shared_memory.h|  17 +--
 include/odp/api/thread.h   |   6 +-
 include/odp/api/timer.h|  52 +++--
 .../linux-generic/include/odp/plat/cpumask_types.h |   5 +
 .../include/odp/plat/packet_io_types.h |   2 +
 platform/linux-generic/odp_cpumask.c   |  38 ---
 platform/linux-generic/odp_crypto.c|   8 +-
 platform/linux-generic/odp_packet_io.c |  15 +--
 platform/linux-generic/odp_queue.c |   4 +-
 test/api_test/odp_common.c |   4 +-
 test/performance/odp_scheduling.c  |  14 ++-
 test/validation/crypto/odp_crypto_test_rng.c   |   6 +-
 test/validation/odp_pktio.c|  24 ++--
 test/validation/odp_queue.c|   3 +-
 31 files changed, 408 insertions(+), 305 deletions(-)

-- 
1.9.1


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


[lng-odp] [PATCHv4 03/18] api: odp_crypto.h: odp_hw_random_get(): return number of bytes written

2015-02-03 Thread Ola Liljedahl
odp_hw_random_get() takes output buffer size as input and returns number
of bytes written (on success), 0 on failure.
Updated the implementation.
Updated all usages in example and test programs.

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/ipsec/odp_ipsec_cache.c  |  6 --
 include/odp/api/crypto.h | 17 ++---
 platform/linux-generic/odp_crypto.c  |  8 
 test/validation/crypto/odp_crypto_test_rng.c |  6 ++
 4 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index 904e7b6..ab05829 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -96,9 +96,11 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 
/* Generate an IV */
if (params.iv.length) {
-   size_t size = params.iv.length;
+   ssize_t size = params.iv.length;
 
-   odp_hw_random_get(params.iv.data, size, 1);
+   ssize_t ret = odp_hw_random_get(params.iv.data, size, 1);
+   if (ret != size)
+   return -1;
}
 
/* Synchronous session create for now */
diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index 545c1a5..e9530a3 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -18,6 +18,8 @@
 extern C {
 #endif
 
+#include sys/types.h
+
 /** @defgroup odp_crypto ODP CRYPTO
  *  Macros, enums, types and operations to utilise crypto.
  *  @{
@@ -330,18 +332,19 @@ odp_crypto_compl_result(odp_crypto_compl_t 
completion_event,
odp_crypto_op_result_t *result);
 
 /**
- * Generate random byte string
+ * Generate random byte data
  *
- * @param buf  Pointer to store result
- * @param len  Pointer to input length value as well as return value
- * @param use_entropy  Use entropy
+ * @param[out]buf   Output buffer
+ * @param bufsz Size of output buffer
+ * @param use_entropy   Use entropy
  *
  * @todo Define the implication of the use_entropy parameter
  *
- * @return 0 if succesful
+ * @return Number of bytes written
+ * @retval 0 on failure
  */
-int
-odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
+ssize_t
+odp_hw_random_get(uint8_t *buf, ssize_t bufsz, bool use_entropy);
 
 /**
  * @}
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 46766fa..b553306 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -446,12 +446,12 @@ odp_crypto_init_global(void)
return 0;
 }
 
-int
-odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED)
+ssize_t
+odp_hw_random_get(uint8_t *buf, ssize_t len, bool use_entropy ODP_UNUSED)
 {
int rc;
-   rc = RAND_bytes(buf, *len);
-   return ((1 == rc) ? 0 : -1);
+   rc = RAND_bytes(buf, len);
+   return (1 == rc) ? len /*success*/: -1 /*failure*/;
 }
 
 odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev)
diff --git a/test/validation/crypto/odp_crypto_test_rng.c 
b/test/validation/crypto/odp_crypto_test_rng.c
index 458f908..a9de5b9 100644
--- a/test/validation/crypto/odp_crypto_test_rng.c
+++ b/test/validation/crypto/odp_crypto_test_rng.c
@@ -16,12 +16,10 @@
 static void rng_get_size(void)
 {
int ret;
-   size_t len = TDES_CBC_IV_LEN;
uint8_t buf[TDES_CBC_IV_LEN];
 
-   ret = odp_hw_random_get(buf, len, false);
-   CU_ASSERT(!ret);
-   CU_ASSERT(len == TDES_CBC_IV_LEN);
+   ret = odp_hw_random_get(buf, sizeof(buf), false);
+   CU_ASSERT(ret == TDES_CBC_IV_LEN);
 }
 
 CU_TestInfo test_rng[] = {
-- 
1.9.1


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


[lng-odp] [PATCHv4 01/18] api: odp_cpumask.h: odp_cpumask_to_str() return chars written or error

2015-02-03 Thread Ola Liljedahl
Add define ODP_CPUMASK_BUFSIZE for minimum output buffer size for
odp_cpumask_to_str().
odp_cpumask_to_str() takes output buffer size as input and returns number
of chars written (on success), 0 on failure.
Updated the implementation.
Updated all usages in example and test programs.

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/generator/odp_generator.c  |  4 ++--
 example/ipsec/odp_ipsec.c  |  4 ++--
 example/l2fwd/odp_l2fwd.c  |  4 ++--
 example/packet/odp_pktio.c |  4 ++--
 example/timer/odp_timer_test.c |  4 ++--
 include/odp/api/cpumask.h  | 23 ++-
 .../linux-generic/include/odp/plat/cpumask_types.h |  5 +
 platform/linux-generic/odp_cpumask.c   | 26 +-
 test/api_test/odp_common.c |  4 ++--
 test/performance/odp_scheduling.c  |  4 ++--
 10 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 03dab50..2433cb6 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -545,7 +545,7 @@ int main(int argc, char *argv[])
int i;
odp_shm_t shm;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
/* Init ODP before calling anything else */
@@ -596,7 +596,7 @@ int main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 03f2419..869fd3a 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1193,7 +1193,7 @@ main(int argc, char *argv[])
int stream_count;
odp_shm_t shm;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
/* Init ODP before calling anything else */
@@ -1242,7 +1242,7 @@ main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 7a520fb..e22ec0c 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
int num_workers;
odp_shm_t shm;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
/* Init ODP before calling anything else */
@@ -336,7 +336,7 @@ int main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 28ed98c..e38029a 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
int i;
int cpu;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
args = calloc(1, sizeof(args_t));
@@ -324,7 +324,7 @@ int main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 0df041f..299ed89 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -317,7 +317,7 @@ int main(int argc, 

[lng-odp] [PATCHv4 02/18] api: odp_pktio.h: odp_pktio_mac_addr() return chars written or error

2015-02-03 Thread Ola Liljedahl
Added define ODP_PKTIO_MACADDRSIZE which specifies the recommended
output buffer size for odp_pktio_mac_addr().
odp_pktio_mac_addr() takes output buffer size as input and returns number
of chars written (on success), 0 on failure.
Updated the implementation.
Updated all usages in example and test programs.

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

 include/odp/api/packet_io.h  | 20 +---
 .../linux-generic/include/odp/plat/packet_io_types.h |  2 ++
 platform/linux-generic/odp_packet_io.c   | 11 ++-
 test/validation/odp_pktio.c  |  8 
 4 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index da7bc3f..096198c 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -18,6 +18,7 @@
 extern C {
 #endif
 
+#include sys/types.h
 
 /** @defgroup odp_packet_io ODP PACKET IO
  *  Operations on a packet.
@@ -39,6 +40,11 @@ extern C {
  * odp_pktio_t value to indicate any port
  */
 
+/*
+ * @def ODP_PKTIO_MACADDRSIZE
+ * Minimum size of output buffer for odp_pktio_mac_addr()
+ */
+
 /**
  * Open an ODP packet IO instance
  *
@@ -167,16 +173,16 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t 
enable);
 int odp_pktio_promisc_mode(odp_pktio_t id);
 
 /**
- * Get the default MAC address of a packet IO interface.
+ * Get the native MAC address of a packet IO interface.
  *
- * @param  idODP packet IO handle.
- * @param[out] mac_addr  Storage for MAC address of the packet IO interface.
- * @param  addr_size Storage size for the address
+ * @param  hdl  ODP packet IO handle
+ * @param[out] buf  Output buffer (use ODP_PKTIO_MACADDRSIZE)
+ * @param   bufsz Size of output buffer
  *
- * @retval Number of bytes written on success, 0 on failure.
+ * @return Number of bytes written to buffer
+ * @retval 0 on failure
  */
-size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
- size_t addr_size);
+ssize_t odp_pktio_mac_addr(odp_pktio_t hdl, void *buf, ssize_t bufsz);
 
 /**
  * Setup per-port default class-of-service.
diff --git a/platform/linux-generic/include/odp/plat/packet_io_types.h 
b/platform/linux-generic/include/odp/plat/packet_io_types.h
index a6bbacf..61dca13 100644
--- a/platform/linux-generic/include/odp/plat/packet_io_types.h
+++ b/platform/linux-generic/include/odp/plat/packet_io_types.h
@@ -23,6 +23,8 @@ extern C {
  *  @{
  */
 
+#define ODP_PKTIO_MACADDRSIZE 16
+
 typedef uint32_t odp_pktio_t;
 
 #define ODP_PKTIO_INVALID 0
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index bdb690e..f156dd3 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -798,18 +798,19 @@ int odp_pktio_promisc_mode(odp_pktio_t id)
 }
 
 
-size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
-  size_t addr_size)
+ssize_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, ssize_t addr_size)
 {
pktio_entry_t *entry;
 
-   if (addr_size  ETH_ALEN)
-   return 0;
+   if (addr_size  ETH_ALEN) {
+   /* Output buffer too small */
+   return -1;
+   }
 
entry = get_pktio_entry(id);
if (entry == NULL) {
ODP_DBG(pktio entry %d does not exist\n, id);
-   return 0;
+   return -1;
}
 
lock_entry(entry);
diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 84121f5..e1ca793 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -450,22 +450,22 @@ static void test_odp_pktio_promisc(void)
 static void test_odp_pktio_mac(void)
 {
unsigned char mac_addr[ODPH_ETHADDR_LEN];
-   size_t mac_len;
+   ssize_t mac_len;
int ret;
odp_pktio_t pktio = create_pktio(iface_name[0]);
 
printf(testing mac for %s\n, iface_name[0]);
 
-   mac_len = odp_pktio_mac_addr(pktio, mac_addr, ODPH_ETHADDR_LEN);
+   mac_len = odp_pktio_mac_addr(pktio, mac_addr, sizeof(mac_addr));
CU_ASSERT(ODPH_ETHADDR_LEN == mac_len);
 
printf( %X:%X:%X:%X:%X:%X ,
   mac_addr[0], mac_addr[1], mac_addr[2],
   mac_addr[3], mac_addr[4], mac_addr[5]);
 
-   /* Fail case: wrong addr_size. Expected 0. */
+   /* Fail case: wrong addr_size. Expected 0. */
mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2);
-   CU_ASSERT(0 == mac_len);
+   CU_ASSERT(mac_len  0);
 
ret = odp_pktio_close(pktio);
CU_ASSERT(0 == ret);
-- 
1.9.1


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


[lng-odp] [PATCHv4 07/18] api: odp_classification.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/classification.h | 48 
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index 5c6636f..35e21cb 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -81,8 +81,8 @@ typedef enum odp_cos_hdr_flow_fields {
  *
  * @param[in]  nameString intended for debugging purposes.
  *
- * @return Class of service instance identifier,
- * or ODP_COS_INVALID on error.
+ * @return Class of service instance identifier
+ * @retval ODP_COS_INVALID on failure.
  */
 odp_cos_t odp_cos_create(const char *name);
 
@@ -91,7 +91,8 @@ odp_cos_t odp_cos_create(const char *name);
  *
  * @param[in]  cos_id  class-of-service instance.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_cos_destroy(odp_cos_t cos_id);
 
@@ -104,7 +105,8 @@ int odp_cos_destroy(odp_cos_t cos_id);
  * of this specific class of service
  * will be enqueued.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id);
 
@@ -114,7 +116,8 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t 
queue_id);
  * @param[in]  cos_id  class-of-service instance.
  * @param[in]  drop_policy Desired packet drop policy for this class.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  *
  * @note Optional.
  */
@@ -129,7 +132,8 @@ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e 
drop_policy);
  * @param[in]  qos_table   Values of the Layer-2 QoS header field.
  * @param[in]  cos_table   Class-of-service assigned to each of the
  * allowed Layer-2 QOS levels.
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
 uint8_t num_qos,
@@ -148,7 +152,8 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
  * @param[in]  l3_preference   when true, Layer-3 QoS overrides
  * L2 QoS when present.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  *
  * @note Optional.
  */
@@ -221,7 +226,8 @@ typedef enum odp_pmr_term {
  * that must match the value size requirement of the
  * specific term.
  *
- * @return Handle of the matching rule or ODP_PMR_INVAL on error
+ * @return Handle of the matching rule
+ * @retval ODP_PMR_INVAL on failure
  */
 odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
   const void *val,
@@ -238,7 +244,8 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
  * that must match the value size requirement of the
  * specific term.
  *
- * @return Handle of the matching rule or ODP_PMR_INVAL on error
+ * @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,
@@ -250,7 +257,8 @@ odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
  *
  * @param[in]  pmr_id  Identifier of the PMR to be destroyed
  *
- * @return 0 on success, non-zero or error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_pmr_destroy(odp_pmr_t pmr_id);
 
@@ -261,7 +269,8 @@ int odp_pmr_destroy(odp_pmr_t pmr_id);
  * @param[in]  src_pktio   pktio to which this PMR is to be applied
  * @param[in]  dst_cos CoS to be assigned by this PMR
  *
- * @return 0 on success, non-zero or error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
  odp_pktio_t src_pktio, odp_cos_t dst_cos);
@@ -274,7 +283,8 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
  * @param[in]  dst_cos CoS to be assigned to packets filtered
  * from src_cos that match pmr_id.
  *
- * @return 0 on success, non-zero on error.
+ * 

[lng-odp] [PATCHv4 09/18] api: odp_packet.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/packet.h | 68 ++--
 1 file changed, 37 insertions(+), 31 deletions(-)

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 3c1c646..fbf4f04 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -110,8 +110,8 @@ void odp_packet_free(odp_packet_t pkt);
  * @param pkt   Packet handle
  * @param len   Packet data length
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  *
  * @see odp_packet_buf_len()
  */
@@ -304,7 +304,7 @@ void *odp_packet_push_head(odp_packet_t pkt, uint32_t len);
  * @param pkt  Packet handle
  * @param len  Number of bytes to pull the head (0 ... seg_len - 1)
  *
- * @return The new data pointer, or NULL in case of an error.
+ * @return The new data pointer
  * @retval NULL  Requested offset exceeds packet segment length
  *
  * @see odp_packet_seg_len(), odp_packet_push_head()
@@ -416,7 +416,7 @@ odp_pool_t odp_packet_pool(odp_packet_t pkt);
  * @param pkt   Packet handle
  *
  * @return Packet interface handle
- * @retval ODP_PKTIO_INVALID  Packet was not received
+ * @retval ODP_PKTIO_INVALID  Packet was not received on any interface
  */
 odp_pktio_t odp_packet_input(odp_packet_t pkt);
 
@@ -476,8 +476,8 @@ void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t 
ctx);
  * @param[out] len  Number of data bytes remaining in the segment (output).
  *  Ignored when NULL.
  *
- * @return  Layer 2 start pointer, or NULL when packet does not contain a valid
- *  L2 header.
+ * @return  Layer 2 start pointer
+ * @retval  NULL packet does not contain a valid L2 header
  *
  * @see odp_packet_l2_offset(), odp_packet_l2_offset_set(), odp_packet_has_l2()
  */
@@ -494,8 +494,8 @@ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len);
  *
  * @param pkt  Packet handle
  *
- * @return  Layer 2 start offset, or ODP_PACKET_OFFSET_INVALID when packet does
- *  not contain a valid L2 header.
+ * @return  Layer 2 start offset
+ * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L2 header
  *
  * @see odp_packet_l2_offset_set(), odp_packet_has_l2()
  */
@@ -511,8 +511,8 @@ uint32_t odp_packet_l2_offset(odp_packet_t pkt);
  * @param pkt Packet handle
  * @param offset  Layer 2 start offset (0 ... odp_packet_len()-1)
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset);
 
@@ -526,8 +526,8 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t 
offset);
  * @param[out] len  Number of data bytes remaining in the segment (output).
  *  Ignored when NULL.
  *
- * @return  Layer 3 start pointer, or NULL when packet does not contain a valid
- *  L3 header.
+ * @return  Layer 3 start pointer
+ * @retval NULL packet does not contain a valid L3 header
  *
  * @see odp_packet_l3_offset(), odp_packet_l3_offset_set(), odp_packet_has_l3()
  */
@@ -561,8 +561,8 @@ uint32_t odp_packet_l3_offset(odp_packet_t pkt);
  * @param pkt Packet handle
  * @param offset  Layer 3 start offset (0 ... odp_packet_len()-1)
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset);
 
@@ -576,8 +576,8 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t 
offset);
  * @param[out] len  Number of data bytes remaining in the segment (output).
  *  Ignored when NULL.
  *
- * @return  Layer 4 start pointer, or NULL when packet does not contain a valid
- *  L4 header.
+ * @return  Layer 4 start pointer
+ * @retval NULL packet does not contain a valid L4 header
  *
  * @see odp_packet_l4_offset(), odp_packet_l4_offset_set(), odp_packet_has_l4()
  */
@@ -594,8 +594,8 @@ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len);
  *
  * @param pkt  Packet handle
  *
- * @return  Layer 4 start offset, or ODP_PACKET_OFFSET_INVALID when packet does
- *  not contain a valid L4 header.
+ * @return  Layer 4 start offset
+ * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L4 header
  *
  * @see odp_packet_l4_offset_set(), odp_packet_has_l4()
  */
@@ -611,8 +611,8 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
  * @param pkt Packet handle
  * @param offset  Layer 4 start offset (0 ... odp_packet_len()-1)
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
 
@@ -670,7 +670,8 @@ 

[lng-odp] [PATCHv4 05/18] api: odp_buffer.h: undefined behavior description

2015-02-03 Thread Ola Liljedahl
Documented API calls which are guaranteed to handle invalid/stale handles.

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

 include/odp/api/buffer.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/buffer.h b/include/odp/api/buffer.h
index 12b2f5a..1eb2e5a 100644
--- a/include/odp/api/buffer.h
+++ b/include/odp/api/buffer.h
@@ -88,7 +88,9 @@ uint32_t odp_buffer_size(odp_buffer_t buf);
 /**
  * Tests if buffer is valid
  *
- * @param buf  Buffer handle
+ * @param buf  Buffer handle (possibly invalid)
+ * @note This is the only buffer API function which accepts invalid buffer
+ * handles (any bit value) without causing undefined behavior.
  *
  * @retval 1 Buffer handle represents a valid buffer.
  * @retval 0 Buffer handle does not represent a valid buffer.
-- 
1.9.1


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


[lng-odp] [PATCHv4 08/18] api: odp_init.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/init.h | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index c73b321..c14769f 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -66,8 +66,8 @@ typedef enum odp_log_level {
  * @param[in] level   Log level
  * @param[in] fmt printf-style message format
  *
- * @return The number of characters logged if succeeded. Otherwise returns
- * a negative number.
+ * @return The number of characters logged on success
+ * @retval 0 on failure
  */
 int odp_override_log(odp_log_level_e level, const char *fmt, ...);
 
@@ -108,8 +108,8 @@ typedef struct odp_platform_init_t {
  * @param[in] platform_params Those parameters that are passed without
  * interpretation by the ODP API to the implementation.
  *
- * @retval 0 if successful
- * @retval -1 on failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
 
@@ -133,8 +133,8 @@ int odp_init_global(odp_init_t *params, odp_platform_init_t 
*platform_params);
  * @sa odp_init_global()
  * @sa odp_term_local() which must have been called prior to this.
  *
- * @retval 0 if successful
- * @retval -1 on failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_term_global(void);
 
@@ -147,8 +147,8 @@ int odp_term_global(void);
  * @sa odp_term_local()
  * @sa odp_init_global() which must have been called prior to this.
  *
- * @retval 0 if successful
- * @retval -1 on failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_init_local(void);
 
@@ -170,8 +170,8 @@ int odp_init_local(void);
  * @warning The unwinding of HW resources to allow them to be re used without 
reseting
  * the device is a complex task that the application is expected to coordinate.
  *
- * @retval 1 if successful and more ODP thread exists
- * @retval 0 if successful and it was the last ODP thread
+ * @retval 1 on success and more ODP threads exist
+ * @retval 0 on success and no more ODP threads exist
  * @retval -1 on failure
  */
 int odp_term_local(void);
-- 
1.9.1


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


[lng-odp] [PATCH] api: fix odp_version_api_str()

2015-02-03 Thread Maxim Uvarov
odp_version_api_str() has to be in API header while
odp_version_impl_str() should be in linux-generic.
That change fixes:
https://bugs.linaro.org/show_bug.cgi?id=1194

Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
---
 include/odp/api/version.h| 29 +++-
 platform/linux-generic/include/odp/version.h | 25 +++-
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/include/odp/api/version.h b/include/odp/api/version.h
index 0889d9c..bfeb40b 100644
--- a/include/odp/api/version.h
+++ b/include/odp/api/version.h
@@ -48,24 +48,27 @@ extern C {
  */
 #define ODP_VERSION_API_MINOR 0
 
+/** @internal Version string expand */
+#define ODP_VERSION_STR_EXPAND(x)  #x
+
+/** @internal Version to string */
+#define ODP_VERSION_TO_STR(x)  ODP_VERSION_STR_EXPAND(x)
+
+/** @internal API version string */
+#define ODP_VERSION_API_STR \
+ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) . \
+ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) . \
+ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR)
+
 /**
  * Returns ODP API version string
  */
-const char *odp_version_api_str(void);
-
+static inline const char *odp_version_api_str(void)
+{
+   return ODP_VERSION_API_STR;
+}
 
 /**
- * Returns ODP implementation version string
- *
- * Every implementation of ODP may receive bug fixes independent of the version
- * of the API changing, this function returns that indication string.
- * @note This string is implementation specific.
- * @sa odp_version_api_str()
- *
- * @return null terminated implementation specific version identifier string
-  */
-const char *odp_version_impl_str(void);
-/**
  * @}
  */
 
diff --git a/platform/linux-generic/include/odp/version.h 
b/platform/linux-generic/include/odp/version.h
index f29320a..33cc5ba 100644
--- a/platform/linux-generic/include/odp/version.h
+++ b/platform/linux-generic/include/odp/version.h
@@ -17,22 +17,19 @@
 extern C {
 #endif
 
-#include odp/plat/version_types.h
-
-/** @ingroup odp_ver_abt_log_dbg
- *  @{
- */
-
-static inline const char *odp_version_api_str(void)
-{
-   return ODP_VERSION_API_STR;
-}
+#include odp/api/version.h
 
 /**
- * @}
- */
-
-#include odp/api/version.h
+ * Returns ODP implementation version string
+ *
+ * Every implementation of ODP may receive bug fixes independent of the version
+ * of the API changing, this function returns that indication string.
+ * @note This string is implementation specific.
+ * @sa odp_version_api_str()
+ *
+ * @return null terminated implementation specific version identifier string
+  */
+const char *odp_version_impl_str(void);
 
 #ifdef __cplusplus
 }
-- 
1.8.5.1.163.gd7aced9


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


Re: [lng-odp] [PATCHv5 00/19] Add Strong Typing for ODP Abstract Types

2015-02-03 Thread Mike Holmes
Agreed on call to add tests in 1.1, taking API change now for 1.0

On 3 February 2015 at 09:55, Savolainen, Petri (NSN - FI/Espoo) 
petri.savolai...@nsn.com wrote:

 APIs OK.

 Reviewed-by: Petri Savolainen petri.savolai...@linaro.org



  -Original Message-
  From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
  boun...@lists.linaro.org] On Behalf Of ext Bill Fischofer
  Sent: Tuesday, February 03, 2015 6:45 AM
  To: lng-odp@lists.linaro.org
  Subject: [lng-odp] [PATCHv5 00/19] Add Strong Typing for ODP Abstract
  Types
 
  This patch series adds strong typing support for ODP abstract types. This
  prevents incorrect types from being used with ODP APIs. Misuse of types
  will
  now result in a compile-time error.
 
  To allow handles to be printed for diagnostic purposes the following new
  APIs
  are added that have the signatures:
 
  uint64_t odp_buffer_to_u64(odp_buffer_t hdl);
  uint64_t odp_cos_to_u64(odp_cos_t hdl);
  uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
  uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl);
  uint64_t odp_pmr_to_u64(odp_pmr_t_hdl);
  uint64_t odp_pmr_set_to_u64(odp_pmr_set_t hdl);
  uint64_t odp_event_to_u64(odp_event_t hdl);
  uint64_t odp_packet_to_u64(odp_packet_t hdl);
  uint64_t odp_packet_seg_to_u64(odp_packet_seg_t_print);
  uint64_t odp_pool_to_u64(odp_pool_t hdl);
  uint64_t odp_pktio_to_u64(odp_pktio_t hdl);
  uint64_t odp_queue_to_u64(odp_queue_t hdl);
  uint64_t odp_shm_to_u64(odp_shm_t hdl);
 
  The output of these routines should be printed using the C99 PRIu64
 format
  code, and examples are updated to this convention.
 
  Patch change history:
  v2 - Adds print functions for the remaining public ODP types. It is also
  rebased to apply on the 0.10.0 release of ODP.
 
  v3 - Corrects the definition of odp_buffer_bits to ensure that correct
  fields
  are referenced on both big and little endian systems.
 
  v4 - Add missing strong typing support for odp_crypto_session_t and
  odp_crypto_compl_t types.
 
  v5 - Change display function names from odp_type_t_print() to
  odp_type_to_u64(). Split out API changes from linux-generic
  implementation
  changes.
 
  Petri: Please review these new APIs. All other changes as a result of
 this
  patch are internal and transparent to ODP applications.
 
  Bill Fischofer (19):
api: buffers: add strong typing handle diplay function
api: classification: add strong typing handle display functions
api: crypto: add strong typing handle display functions
api: events: add strong typing handle display function
api: packets: add strong typing handle display function
api: pktio: add strong typing handle display function
api: pool: add strong typing handle display function
api: queues: add strong typing handle display function
api: shm: add strong typing handle display function
linux-generic: add base macros for strong typing support
linux-generic: buffers: add strong typing support
linux-generic: classification: add strong typing support
linux-generic: crypto: add strong typing support
linux-generic: events: add strong typing support
linux-generic: pktio: add strong typing support
linux-generic: packets: add strong typing support
linux-generic: pool: add strong typing support
linux-generic: queues: add strong typing support
linux-generic: shm: add strong typing support
 
   example/generator/odp_generator.c  | 12 +++--
   example/ipsec/odp_ipsec.c  | 18 +---
   example/l2fwd/odp_l2fwd.c  | 11 +++--
   example/packet/odp_pktio.c | 22 ++
   include/odp/api/buffer.h   | 13 ++
   include/odp/api/classification.h   | 44
 -
  --
   include/odp/api/crypto.h   | 26 +++
   include/odp/api/event.h| 12 +
   include/odp/api/packet.h   | 25 +++
   include/odp/api/packet_io.h| 12 +
   include/odp/api/pool.h | 13 ++
   include/odp/api/queue.h| 13 ++
   include/odp/api/shared_memory.h| 13 ++
   platform/linux-generic/Makefile.am |  1 +
   .../linux-generic/include/odp/plat/buffer_types.h  | 15 +--
   .../include/odp/plat/classification_types.h| 34 ---
   .../linux-generic/include/odp/plat/crypto_types.h  | 13 +-
   .../linux-generic/include/odp/plat/event_types.h   | 14 --
   .../include/odp/plat/packet_io_types.h | 15 +--
   .../linux-generic/include/odp/plat/packet_types.h  | 24 +++---
   .../linux-generic/include/odp/plat/pool_types.h| 13 +-
   .../linux-generic/include/odp/plat/queue_types.h   | 14 --
   .../include/odp/plat/shared_memory_types.h | 13 +-
   

Re: [lng-odp] [PATCH v2 0/5] Add replaceable odp abort mechanism

2015-02-03 Thread Maxim Uvarov

Merged!

Maxim.

On 02/03/2015 03:17 PM, Taras Kondratiuk wrote:

On 02/03/2015 01:35 PM, Mike Holmes wrote:
v2 just splits the test out to its own executable, forcing an abort 
is a problem

but the replace mechanism is tested

Mike Holmes (5):
   api: odp_hints: Add ODP_NORETURN
   api: abort: add weak replacement for abort
   api: abort: use globaly stored abort function
   api: init_global: allow abort fn to be overidden
   validation: init: add test for replace abort


For a whole series:
Reviewed-by: Taras Kondratiuk taras.kondrat...@linaro.org

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



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


Re: [lng-odp] [PATCHv5 00/19] Add Strong Typing for ODP Abstract Types

2015-02-03 Thread Savolainen, Petri (NSN - FI/Espoo)
APIs OK.

Reviewed-by: Petri Savolainen petri.savolai...@linaro.org



 -Original Message-
 From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
 boun...@lists.linaro.org] On Behalf Of ext Bill Fischofer
 Sent: Tuesday, February 03, 2015 6:45 AM
 To: lng-odp@lists.linaro.org
 Subject: [lng-odp] [PATCHv5 00/19] Add Strong Typing for ODP Abstract
 Types
 
 This patch series adds strong typing support for ODP abstract types. This
 prevents incorrect types from being used with ODP APIs. Misuse of types
 will
 now result in a compile-time error.
 
 To allow handles to be printed for diagnostic purposes the following new
 APIs
 are added that have the signatures:
 
 uint64_t odp_buffer_to_u64(odp_buffer_t hdl);
 uint64_t odp_cos_to_u64(odp_cos_t hdl);
 uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
 uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl);
 uint64_t odp_pmr_to_u64(odp_pmr_t_hdl);
 uint64_t odp_pmr_set_to_u64(odp_pmr_set_t hdl);
 uint64_t odp_event_to_u64(odp_event_t hdl);
 uint64_t odp_packet_to_u64(odp_packet_t hdl);
 uint64_t odp_packet_seg_to_u64(odp_packet_seg_t_print);
 uint64_t odp_pool_to_u64(odp_pool_t hdl);
 uint64_t odp_pktio_to_u64(odp_pktio_t hdl);
 uint64_t odp_queue_to_u64(odp_queue_t hdl);
 uint64_t odp_shm_to_u64(odp_shm_t hdl);
 
 The output of these routines should be printed using the C99 PRIu64 format
 code, and examples are updated to this convention.
 
 Patch change history:
 v2 - Adds print functions for the remaining public ODP types. It is also
 rebased to apply on the 0.10.0 release of ODP.
 
 v3 - Corrects the definition of odp_buffer_bits to ensure that correct
 fields
 are referenced on both big and little endian systems.
 
 v4 - Add missing strong typing support for odp_crypto_session_t and
 odp_crypto_compl_t types.
 
 v5 - Change display function names from odp_type_t_print() to
 odp_type_to_u64(). Split out API changes from linux-generic
 implementation
 changes.
 
 Petri: Please review these new APIs. All other changes as a result of this
 patch are internal and transparent to ODP applications.
 
 Bill Fischofer (19):
   api: buffers: add strong typing handle diplay function
   api: classification: add strong typing handle display functions
   api: crypto: add strong typing handle display functions
   api: events: add strong typing handle display function
   api: packets: add strong typing handle display function
   api: pktio: add strong typing handle display function
   api: pool: add strong typing handle display function
   api: queues: add strong typing handle display function
   api: shm: add strong typing handle display function
   linux-generic: add base macros for strong typing support
   linux-generic: buffers: add strong typing support
   linux-generic: classification: add strong typing support
   linux-generic: crypto: add strong typing support
   linux-generic: events: add strong typing support
   linux-generic: pktio: add strong typing support
   linux-generic: packets: add strong typing support
   linux-generic: pool: add strong typing support
   linux-generic: queues: add strong typing support
   linux-generic: shm: add strong typing support
 
  example/generator/odp_generator.c  | 12 +++--
  example/ipsec/odp_ipsec.c  | 18 +---
  example/l2fwd/odp_l2fwd.c  | 11 +++--
  example/packet/odp_pktio.c | 22 ++
  include/odp/api/buffer.h   | 13 ++
  include/odp/api/classification.h   | 44 -
 --
  include/odp/api/crypto.h   | 26 +++
  include/odp/api/event.h| 12 +
  include/odp/api/packet.h   | 25 +++
  include/odp/api/packet_io.h| 12 +
  include/odp/api/pool.h | 13 ++
  include/odp/api/queue.h| 13 ++
  include/odp/api/shared_memory.h| 13 ++
  platform/linux-generic/Makefile.am |  1 +
  .../linux-generic/include/odp/plat/buffer_types.h  | 15 +--
  .../include/odp/plat/classification_types.h| 34 ---
  .../linux-generic/include/odp/plat/crypto_types.h  | 13 +-
  .../linux-generic/include/odp/plat/event_types.h   | 14 --
  .../include/odp/plat/packet_io_types.h | 15 +--
  .../linux-generic/include/odp/plat/packet_types.h  | 24 +++---
  .../linux-generic/include/odp/plat/pool_types.h| 13 +-
  .../linux-generic/include/odp/plat/queue_types.h   | 14 --
  .../include/odp/plat/shared_memory_types.h | 13 +-
  .../linux-generic/include/odp/plat/strong_types.h  | 38 
  .../linux-generic/include/odp_buffer_inlines.h | 16 ---
  .../linux-generic/include/odp_buffer_internal.h| 31 ++---
  .../include/odp_buffer_pool_internal.h |  4 +-
  

Re: [lng-odp] [PATCH] api: packet_flags: Removed odp_packet_override_l4_chksum

2015-02-03 Thread Maxim Uvarov

Bill, you wanted to review that patch.

Maxim.

On 02/03/2015 04:13 PM, Petri Savolainen wrote:

This is currently the only output side packet flag. It's removed
now and re-defined later with all other output side control flags.

Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
---
  include/odp/api/packet_flags.h| 7 ---
  platform/linux-generic/odp_packet_flags.c | 7 ---
  test/validation/buffer/odp_packet_test.c  | 7 ---
  3 files changed, 21 deletions(-)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index df1486b..f864bba 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -174,13 +174,6 @@ int odp_packet_has_sctp(odp_packet_t pkt);
  int odp_packet_has_icmp(odp_packet_t pkt);
  
  /**

- * Request L4 checksum calculation
- *
- * @param pkt Packet handle
- */
-void odp_packet_override_l4_chksum(odp_packet_t pkt);
-
-/**
   * Set flag for L2 header, e.g. ethernet
   *
   * @param pkt Packet handle
diff --git a/platform/linux-generic/odp_packet_flags.c 
b/platform/linux-generic/odp_packet_flags.c
index f2ef61d..ab3d12f 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -100,13 +100,6 @@ int odp_packet_has_icmp(odp_packet_t pkt)
return odp_packet_hdr(pkt)-input_flags.icmp;
  }
  
-/* Set Output Flags */

-
-void odp_packet_override_l4_chksum(odp_packet_t pkt)
-{
-   odp_packet_hdr(pkt)-output_flags.l4_chksum = 1;
-}
-
  /* Set Input Flags */
  
  void odp_packet_has_l2_set(odp_packet_t pkt, int val)

diff --git a/test/validation/buffer/odp_packet_test.c 
b/test/validation/buffer/odp_packet_test.c
index 0a5d32e..b8995f7 100644
--- a/test/validation/buffer/odp_packet_test.c
+++ b/test/validation/buffer/odp_packet_test.c
@@ -443,12 +443,6 @@ static void packet_error_flags(void)
CU_ASSERT(err == 0 || err == 1);
  }
  
-static void packet_out_flags(void)

-{
-   odp_packet_override_l4_chksum(test_packet);
-   CU_PASS(Current API doesn't return any error code\n);
-}
-
  struct packet_metadata {
uint32_t l2_off;
uint32_t l3_off;
@@ -659,7 +653,6 @@ CU_TestInfo packet_tests[] = {
_CU_TEST_INFO(packet_segments),
_CU_TEST_INFO(packet_segment_last),
_CU_TEST_INFO(packet_in_flags),
-   _CU_TEST_INFO(packet_out_flags),
_CU_TEST_INFO(packet_error_flags),
_CU_TEST_INFO(packet_add_rem_data),
_CU_TEST_INFO(packet_copy),



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


Re: [lng-odp] [PATCH] api: odp_event.h: remove ODP_EVENT_TYPE_INVALID

2015-02-03 Thread Ola Liljedahl
On 3 February 2015 at 09:15, Savolainen, Petri (NSN - FI/Espoo)
petri.savolai...@nsn.com wrote:


 -Original Message-
 From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
 boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl
 Sent: Monday, February 02, 2015 6:01 PM
 To: lng-odp@lists.linaro.org
 Subject: [lng-odp] [PATCH] api: odp_event.h: remove ODP_EVENT_TYPE_INVALID

 Remove ODP_EVENT_TYPE_INVALID from odp_event.h.
 Update description of odp_event_type(), is does not return
 ODP_EVENT_TYPE_INVALID.
 Remove ODP_POOL_TYPE_INVALID from odp_pool.h. It was defined to
 ODP_EVENT_TYPE_INVALID.

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

  include/odp/api/event.h   | 9 ++---
  include/odp/api/pool.h| 2 --
  platform/linux-generic/include/odp/plat/event_types.h | 1 -
  3 files changed, 2 insertions(+), 10 deletions(-)

 diff --git a/include/odp/api/event.h b/include/odp/api/event.h
 index 50c031a..ce97bdc 100644
 --- a/include/odp/api/event.h
 +++ b/include/odp/api/event.h
 @@ -36,11 +36,6 @@ extern C {
   */

  /**
 - * @def ODP_EVENT_TYPE_INVALID
 - * Invalid event type
 - */
 -
 -/**
   * @def ODP_EVENT_BUFFER
   * Buffer event
   */
 @@ -61,11 +56,11 @@ extern C {
   */

  /**
 - * Event type
 + * Return type of event

 Don't change the Doxygen brief description. Almost every function return 
 something, no need to mention that in the brief description. The detail 
 description is there for full description/sentences.
Most functions have side effects and it is the side effect you are
after. What they return is normally just a status code or other
information on how successful they were (e.g. number of items
processed or written etc) in that side effect. This function *only*
returns something with no side effects. Thus the difference in
description.


 Otherwise OK.

 -Petri


   *
   * @param eventEvent handle
   *
 - * @return Event type or ODP_EVENT_TYPE_INVALID
 + * @return Event type
   */
  int odp_event_type(odp_event_t event);

 diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
 index 1582102..d09d92e 100644
 --- a/include/odp/api/pool.h
 +++ b/include/odp/api/pool.h
 @@ -79,8 +79,6 @@ typedef struct odp_pool_param_t {

  } odp_pool_param_t;

 -/** Invalid pool type */
 -#define ODP_POOL_TYPE_INVALID ODP_EVENT_TYPE_INVALID
  /** Packet pool*/
  #define ODP_POOL_PACKET   ODP_EVENT_PACKET
  /** Buffer pool */
 diff --git a/platform/linux-generic/include/odp/plat/event_types.h
 b/platform/linux-generic/include/odp/plat/event_types.h
 index 4a0756b..c98d416 100644
 --- a/platform/linux-generic/include/odp/plat/event_types.h
 +++ b/platform/linux-generic/include/odp/plat/event_types.h
 @@ -30,7 +30,6 @@ typedef odp_buffer_t odp_event_t;

  #define ODP_EVENT_INVALID ODP_BUFFER_INVALID

 -#define ODP_EVENT_TYPE_INVALID (-1)
  #define ODP_EVENT_BUFFER 1
  #define ODP_EVENT_PACKET 2
  #define ODP_EVENT_TIMEOUT3
 --
 1.9.1


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

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


Re: [lng-odp] [PATCH] api: odp_event.h: remove ODP_EVENT_TYPE_INVALID

2015-02-03 Thread Savolainen, Petri (NSN - FI/Espoo)


 -Original Message-
 From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
 boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl
 Sent: Monday, February 02, 2015 6:01 PM
 To: lng-odp@lists.linaro.org
 Subject: [lng-odp] [PATCH] api: odp_event.h: remove ODP_EVENT_TYPE_INVALID
 
 Remove ODP_EVENT_TYPE_INVALID from odp_event.h.
 Update description of odp_event_type(), is does not return
 ODP_EVENT_TYPE_INVALID.
 Remove ODP_POOL_TYPE_INVALID from odp_pool.h. It was defined to
 ODP_EVENT_TYPE_INVALID.
 
 Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org
 ---
 (This document/code contribution attached is provided under the terms of
 agreement LES-LTM-21309)
 
  include/odp/api/event.h   | 9 ++---
  include/odp/api/pool.h| 2 --
  platform/linux-generic/include/odp/plat/event_types.h | 1 -
  3 files changed, 2 insertions(+), 10 deletions(-)
 
 diff --git a/include/odp/api/event.h b/include/odp/api/event.h
 index 50c031a..ce97bdc 100644
 --- a/include/odp/api/event.h
 +++ b/include/odp/api/event.h
 @@ -36,11 +36,6 @@ extern C {
   */
 
  /**
 - * @def ODP_EVENT_TYPE_INVALID
 - * Invalid event type
 - */
 -
 -/**
   * @def ODP_EVENT_BUFFER
   * Buffer event
   */
 @@ -61,11 +56,11 @@ extern C {
   */
 
  /**
 - * Event type
 + * Return type of event

Don't change the Doxygen brief description. Almost every function return 
something, no need to mention that in the brief description. The detail 
description is there for full description/sentences.

Otherwise OK.

-Petri


   *
   * @param eventEvent handle
   *
 - * @return Event type or ODP_EVENT_TYPE_INVALID
 + * @return Event type
   */
  int odp_event_type(odp_event_t event);
 
 diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
 index 1582102..d09d92e 100644
 --- a/include/odp/api/pool.h
 +++ b/include/odp/api/pool.h
 @@ -79,8 +79,6 @@ typedef struct odp_pool_param_t {
 
  } odp_pool_param_t;
 
 -/** Invalid pool type */
 -#define ODP_POOL_TYPE_INVALID ODP_EVENT_TYPE_INVALID
  /** Packet pool*/
  #define ODP_POOL_PACKET   ODP_EVENT_PACKET
  /** Buffer pool */
 diff --git a/platform/linux-generic/include/odp/plat/event_types.h
 b/platform/linux-generic/include/odp/plat/event_types.h
 index 4a0756b..c98d416 100644
 --- a/platform/linux-generic/include/odp/plat/event_types.h
 +++ b/platform/linux-generic/include/odp/plat/event_types.h
 @@ -30,7 +30,6 @@ typedef odp_buffer_t odp_event_t;
 
  #define ODP_EVENT_INVALID ODP_BUFFER_INVALID
 
 -#define ODP_EVENT_TYPE_INVALID (-1)
  #define ODP_EVENT_BUFFER 1
  #define ODP_EVENT_PACKET 2
  #define ODP_EVENT_TIMEOUT3
 --
 1.9.1
 
 
 ___
 lng-odp mailing list
 lng-odp@lists.linaro.org
 http://lists.linaro.org/mailman/listinfo/lng-odp

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


[lng-odp] [PATCH v2] api: classification: pmr statistics counter API removal

2015-02-03 Thread bala . manoharan
From: Balasubramanian Manoharan bala.manoha...@linaro.org

odp_pmr_match_count() API related to statistics count of PMR has been moved out 
of ODP 1.0
version and the same will be incorporated once an ODP level common statistics 
counter design has
been achieved.

Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org
---
v2: Incorporated review comments from Mike

 include/odp/api/classification.h|  9 -
 platform/linux-generic/odp_classification.c |  8 
 .../classification/odp_classification_tests.c   | 21 -
 3 files changed, 38 deletions(-)

diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index 5c6636f..609d529 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -279,15 +279,6 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
 int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t dst_cos);
 
 /**
- * Retrieve packet matcher statistics
- *
- * @param[in]  pmr_id  PMR from which to retrieve the count
- *
- * @return Current number of matches for a given matcher 
instance.
- */
-signed long odp_pmr_match_count(odp_pmr_t pmr_id);
-
-/**
  * Inquire about matching terms supported by the classifier
  *
  * @return A mask one bit per enumerated term, one for each of op_pmr_term_e
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index 78597ef..31d1328 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -505,14 +505,6 @@ int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, 
odp_cos_t dst_cos)
return 0;
 }
 
-signed long odp_pmr_match_count(odp_pmr_t pmr_id)
-{
-   pmr_t *pmr = get_pmr_entry(pmr_id);
-   if (pmr == NULL)
-   return -1;
-   return (signed long)odp_atomic_load_u32(pmr-s.count);
-}
-
 unsigned long long odp_pmr_terms_cap(void)
 {
unsigned long long term_cap = 0;
diff --git a/test/validation/classification/odp_classification_tests.c 
b/test/validation/classification/odp_classification_tests.c
index e4b3260..45822d3 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -423,8 +423,6 @@ void test_cls_pmr_chain(void)
pkt = receive_packet(queue, ODP_TIME_SEC);
CU_ASSERT(queue == queue_list[CLS_PMR_CHAIN_SRC]);
CU_ASSERT(seq == cls_pkt_get_seq(pkt));
-
-   CU_ASSERT(1 == odp_pmr_match_count(pmr_list[CLS_PMR_CHAIN_DST]));
odp_packet_free(pkt);
 }
 
@@ -657,7 +655,6 @@ void test_pmr_cos(void)
pkt = receive_packet(queue, ODP_TIME_SEC);
CU_ASSERT(queue == queue_list[CLS_PMR]);
CU_ASSERT(seq == cls_pkt_get_seq(pkt));
-   CU_ASSERT(1 == odp_pmr_match_count(pmr_list[CLS_PMR]));
odp_packet_free(pkt);
 }
 
@@ -740,23 +737,6 @@ void test_pktio_pmr_match_set_cos(void)
odp_packet_free(pkt);
 }
 
-static void classification_pmr_match_count(void)
-{
-   odp_pmr_t pmr;
-   uint16_t val;
-   uint16_t mask;
-   val = 1024;
-   mask = 0x;
-   int retval;
-   pmr = odp_pmr_create_match(ODP_PMR_TCP_SPORT, val, mask, sizeof(val));
-   CU_ASSERT(pmr != ODP_PMR_INVAL);
-
-   retval = odp_pmr_match_count(pmr);
-   CU_ASSERT(retval == 0);
-
-   odp_pmr_destroy(pmr);
-}
-
 static void classification_pmr_terms_avail(void)
 {
int retval;
@@ -814,6 +794,5 @@ CU_TestInfo classification_tests[] = {
_CU_TEST_INFO(classification_pmr_terms_cap),
_CU_TEST_INFO(classification_pktio_configure),
_CU_TEST_INFO(classification_pktio_test),
-   _CU_TEST_INFO(classification_pmr_match_count),
CU_TEST_INFO_NULL,
 };
-- 
2.0.1.472.g6f92e5f


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


Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h

2015-02-03 Thread Taras Kondratiuk

On 02/03/2015 01:07 PM, Ola Liljedahl wrote:

On 3 February 2015 at 11:59, Petri Savolainen
petri.savolai...@linaro.org wrote:

This file contains cpu related API calls. The calls are
renames from odp_thread_cpu() and odp_sys_cpu_count().

Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
---
  include/odp.h|  1 +
  include/odp/api/cpu.h| 54 
  platform/linux-generic/Makefile.am   |  2 ++
  platform/linux-generic/include/odp/cpu.h | 26 +++
  4 files changed, 83 insertions(+)
  create mode 100644 include/odp/api/cpu.h
  create mode 100644 platform/linux-generic/include/odp/cpu.h

diff --git a/include/odp.h b/include/odp.h
index 30bed8e..99e01eb 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -27,6 +27,7 @@ extern C {
  #include odp/hints.h
  #include odp/debug.h
  #include odp/byteorder.h
+#include odp/cpu.h
  #include odp/cpumask.h
  #include odp/barrier.h
  #include odp/spinlock.h
diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
new file mode 100644
index 000..16461a3
--- /dev/null
+++ b/include/odp/api/cpu.h
@@ -0,0 +1,54 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP CPU API
+ */
+
+#ifndef ODP_CPU_H_
+#define ODP_CPU_H_
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+/** @defgroup odp_cpu ODP CPU
+ *  @{
+ */
+
+
+/**
+ * CPU number
+ *
+ * CPU number where the thread is currently running. CPU numbering is system
+ * specific.
+ *
+ * @return CPU number
+ */
+int odp_cpu(void);

Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
odp_cpu is missing something and does not lead to direct
understanding of what the function does or returns.


I become odp_cpu_id() in the second patch.
Why not to name it like this in the first patch?

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


Re: [lng-odp] [PATCH v2] api: classification: pmr statistics counter API removal

2015-02-03 Thread Mike Holmes
On 3 February 2015 at 03:42, bala.manoha...@linaro.org wrote:

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

 odp_pmr_match_count() API related to statistics count of PMR has been
 moved out of ODP 1.0
 version and the same will be incorporated once an ODP level common
 statistics counter design has
 been achieved.

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


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


 ---
 v2: Incorporated review comments from Mike

  include/odp/api/classification.h|  9 -
  platform/linux-generic/odp_classification.c |  8 
  .../classification/odp_classification_tests.c   | 21
 -
  3 files changed, 38 deletions(-)

 diff --git a/include/odp/api/classification.h
 b/include/odp/api/classification.h
 index 5c6636f..609d529 100644
 --- a/include/odp/api/classification.h
 +++ b/include/odp/api/classification.h
 @@ -279,15 +279,6 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
  int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t
 dst_cos);

  /**
 - * Retrieve packet matcher statistics
 - *
 - * @param[in]  pmr_id  PMR from which to retrieve the count
 - *
 - * @return Current number of matches for a given
 matcher instance.
 - */
 -signed long odp_pmr_match_count(odp_pmr_t pmr_id);
 -
 -/**
   * Inquire about matching terms supported by the classifier
   *
   * @return A mask one bit per enumerated term, one for each of
 op_pmr_term_e
 diff --git a/platform/linux-generic/odp_classification.c
 b/platform/linux-generic/odp_classification.c
 index 78597ef..31d1328 100644
 --- a/platform/linux-generic/odp_classification.c
 +++ b/platform/linux-generic/odp_classification.c
 @@ -505,14 +505,6 @@ int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t
 src_cos, odp_cos_t dst_cos)
 return 0;
  }

 -signed long odp_pmr_match_count(odp_pmr_t pmr_id)
 -{
 -   pmr_t *pmr = get_pmr_entry(pmr_id);
 -   if (pmr == NULL)
 -   return -1;
 -   return (signed long)odp_atomic_load_u32(pmr-s.count);
 -}
 -
  unsigned long long odp_pmr_terms_cap(void)
  {
 unsigned long long term_cap = 0;
 diff --git a/test/validation/classification/odp_classification_tests.c
 b/test/validation/classification/odp_classification_tests.c
 index e4b3260..45822d3 100644
 --- a/test/validation/classification/odp_classification_tests.c
 +++ b/test/validation/classification/odp_classification_tests.c
 @@ -423,8 +423,6 @@ void test_cls_pmr_chain(void)
 pkt = receive_packet(queue, ODP_TIME_SEC);
 CU_ASSERT(queue == queue_list[CLS_PMR_CHAIN_SRC]);
 CU_ASSERT(seq == cls_pkt_get_seq(pkt));
 -
 -   CU_ASSERT(1 == odp_pmr_match_count(pmr_list[CLS_PMR_CHAIN_DST]));
 odp_packet_free(pkt);
  }

 @@ -657,7 +655,6 @@ void test_pmr_cos(void)
 pkt = receive_packet(queue, ODP_TIME_SEC);
 CU_ASSERT(queue == queue_list[CLS_PMR]);
 CU_ASSERT(seq == cls_pkt_get_seq(pkt));
 -   CU_ASSERT(1 == odp_pmr_match_count(pmr_list[CLS_PMR]));
 odp_packet_free(pkt);
  }

 @@ -740,23 +737,6 @@ void test_pktio_pmr_match_set_cos(void)
 odp_packet_free(pkt);
  }

 -static void classification_pmr_match_count(void)
 -{
 -   odp_pmr_t pmr;
 -   uint16_t val;
 -   uint16_t mask;
 -   val = 1024;
 -   mask = 0x;
 -   int retval;
 -   pmr = odp_pmr_create_match(ODP_PMR_TCP_SPORT, val, mask,
 sizeof(val));
 -   CU_ASSERT(pmr != ODP_PMR_INVAL);
 -
 -   retval = odp_pmr_match_count(pmr);
 -   CU_ASSERT(retval == 0);
 -
 -   odp_pmr_destroy(pmr);
 -}
 -
  static void classification_pmr_terms_avail(void)
  {
 int retval;
 @@ -814,6 +794,5 @@ CU_TestInfo classification_tests[] = {
 _CU_TEST_INFO(classification_pmr_terms_cap),
 _CU_TEST_INFO(classification_pktio_configure),
 _CU_TEST_INFO(classification_pktio_test),
 -   _CU_TEST_INFO(classification_pmr_match_count),
 CU_TEST_INFO_NULL,
  };
 --
 2.0.1.472.g6f92e5f


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




-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h

2015-02-03 Thread Savolainen, Petri (NSN - FI/Espoo)


 -Original Message-
 From: ext Taras Kondratiuk [mailto:taras.kondrat...@linaro.org]
 Sent: Tuesday, February 03, 2015 1:19 PM
 To: Ola Liljedahl; Petri Savolainen
 Cc: LNG ODP Mailman List
 Subject: Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h
 
 On 02/03/2015 01:07 PM, Ola Liljedahl wrote:
  On 3 February 2015 at 11:59, Petri Savolainen
  petri.savolai...@linaro.org wrote:
  This file contains cpu related API calls. The calls are
  renames from odp_thread_cpu() and odp_sys_cpu_count().
 
  Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
  ---
include/odp.h|  1 +
include/odp/api/cpu.h| 54
 
platform/linux-generic/Makefile.am   |  2 ++
platform/linux-generic/include/odp/cpu.h | 26 +++
4 files changed, 83 insertions(+)
create mode 100644 include/odp/api/cpu.h
create mode 100644 platform/linux-generic/include/odp/cpu.h
 
  diff --git a/include/odp.h b/include/odp.h
  index 30bed8e..99e01eb 100644
  --- a/include/odp.h
  +++ b/include/odp.h
  @@ -27,6 +27,7 @@ extern C {
#include odp/hints.h
#include odp/debug.h
#include odp/byteorder.h
  +#include odp/cpu.h
#include odp/cpumask.h
#include odp/barrier.h
#include odp/spinlock.h
  diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
  new file mode 100644
  index 000..16461a3
  --- /dev/null
  +++ b/include/odp/api/cpu.h
  @@ -0,0 +1,54 @@
  +/* Copyright (c) 2015, Linaro Limited
  + * All rights reserved.
  + *
  + * SPDX-License-Identifier: BSD-3-Clause
  + */
  +
  +
  +/**
  + * @file
  + *
  + * ODP CPU API
  + */
  +
  +#ifndef ODP_CPU_H_
  +#define ODP_CPU_H_
  +
  +#ifdef __cplusplus
  +extern C {
  +#endif
  +
  +/** @defgroup odp_cpu ODP CPU
  + *  @{
  + */
  +
  +
  +/**
  + * CPU number
  + *
  + * CPU number where the thread is currently running. CPU numbering is
 system
  + * specific.
  + *
  + * @return CPU number
  + */
  +int odp_cpu(void);
  Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
  odp_cpu is missing something and does not lead to direct
  understanding of what the function does or returns.
 
 I become odp_cpu_id() in the second patch.
 Why not to name it like this in the first patch?

I rebased the second commit (should have rebased the first). The commit history 
is not perfect, but I think we can live with that.

-Petri






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


[lng-odp] [PATCH v2 1/5] api: odp_hints: Add ODP_NORETURN

2015-02-03 Thread Mike Holmes
Add the ability to mark a function as never returning to the caller.

Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
 include/odp/api/hints.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/odp/api/hints.h b/include/odp/api/hints.h
index 7f04886..a7aa90e 100644
--- a/include/odp/api/hints.h
+++ b/include/odp/api/hints.h
@@ -25,6 +25,10 @@ extern C {
 
 #ifdef __GNUC__
 
+/** Define a fn that does not return
+ */
+#define ODP_NORETURN __attribute__((__noreturn__))
+
 /** Define a weak symbol
  * This is primarily useful in defining library functions that can be
  * overridden in user code.
-- 
2.1.0


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


[lng-odp] [PATCH v2 3/5] api: abort: use globaly stored abort function

2015-02-03 Thread Mike Holmes
Use the abort function stored in the global data structure.

Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
 include/odp/api/init.h  | 3 +++
 platform/linux-generic/include/odp_debug_internal.h | 4 ++--
 platform/linux-generic/include/odp_internal.h   | 1 +
 platform/linux-generic/odp_init.c   | 1 +
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 4b9296b..c5b4e9b 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -91,6 +91,9 @@ void odp_override_abort(void) ODP_NORETURN;
 /** Replaceable logging function */
 typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...);
 
+/** Replaceable abort function */
+typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
+
 /** ODP initialization data.
  * Data that is required to initialize the ODP API with the
  * application specific data such as specifying a logging callback, the log
diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index 20b6fcc..2b643eb 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -54,7 +54,7 @@ extern C {
 #define ODP_ASSERT(cond, msg) \
do { if ((ODP_DEBUG == 1)  (!(cond))) { \
ODP_ERR(%s\n, msg); \
-   odp_override_abort(); } \
+   odp_global_data.abort_fn(); } \
} while (0)
 
 /**
@@ -86,7 +86,7 @@ extern C {
 #define ODP_ABORT(fmt, ...) \
do { \
ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \
-   odp_override_abort(); \
+   odp_global_data.abort_fn(); \
} while (0)
 
 /**
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 608aafd..9a6e29d 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -22,6 +22,7 @@ extern C {
 
 struct odp_global_data {
odp_log_func_t log_fn;
+   odp_abort_func_t abort_fn;
 } odp_global_data;
 
 int odp_system_info_init(void);
diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index 6db05b3..e91e910 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -14,6 +14,7 @@ int odp_init_global(odp_init_t *params  ODP_UNUSED,
odp_platform_init_t *platform_params ODP_UNUSED)
 {
odp_global_data.log_fn = odp_override_log;
+   odp_global_data.abort_fn = odp_override_abort;
 
if (params != NULL) {
if (params-log_fn != NULL)
-- 
2.1.0


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


[lng-odp] [PATCH v2 2/5] api: abort: add weak replacement for abort

2015-02-03 Thread Mike Holmes
Introduce replaceable abort function using weak symbols.

Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
 include/odp/api/init.h  | 16 
 platform/linux-generic/include/odp_debug_internal.h |  4 ++--
 platform/linux-generic/odp_weak.c   |  5 +
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index c73b321..4b9296b 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -29,6 +29,7 @@ extern C {
 
 
 #include odp/std_types.h
+#include odp/hints.h
 
 /** @defgroup odp_initialization ODP INITIALIZATION
  *  Initialisation operations.
@@ -71,6 +72,21 @@ typedef enum odp_log_level {
  */
 int odp_override_log(odp_log_level_e level, const char *fmt, ...);
 
+/**
+ * ODP abort function
+ *
+ * Instead of directly calling abort, all abort calls in the implementation
+ * should be done via this function or its wrappers.
+ *
+ * An Application can override the ODP implementation default abort function
+ * odp_override_abort() by providing an alternative to this weak symbol.
+ *
+ * @warning The override option is not portable and GNU linker dependent
+ * (utilizes function attribute weak).
+ *
+ * @warning this function shall not return
+ */
+void odp_override_abort(void) ODP_NORETURN;
 
 /** Replaceable logging function */
 typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...);
diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index a665644..20b6fcc 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -54,7 +54,7 @@ extern C {
 #define ODP_ASSERT(cond, msg) \
do { if ((ODP_DEBUG == 1)  (!(cond))) { \
ODP_ERR(%s\n, msg); \
-   abort(); } \
+   odp_override_abort(); } \
} while (0)
 
 /**
@@ -86,7 +86,7 @@ extern C {
 #define ODP_ABORT(fmt, ...) \
do { \
ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \
-   abort(); \
+   odp_override_abort(); \
} while (0)
 
 /**
diff --git a/platform/linux-generic/odp_weak.c 
b/platform/linux-generic/odp_weak.c
index 2592fe9..9dc3a4a 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -21,3 +21,8 @@ ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level 
ODP_UNUSED,
 
return r;
 }
+
+ODP_WEAK_SYMBOL void odp_override_abort(void)
+{
+   abort();
+}
-- 
2.1.0


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


[lng-odp] [PATCH v2 4/5] api: init_global: allow abort fn to be overidden

2015-02-03 Thread Mike Holmes
Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
 include/odp/api/init.h| 14 ++
 platform/linux-generic/odp_init.c |  2 ++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index c5b4e9b..6af032d 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -78,11 +78,16 @@ int odp_override_log(odp_log_level_e level, const char 
*fmt, ...);
  * Instead of directly calling abort, all abort calls in the implementation
  * should be done via this function or its wrappers.
  *
- * An Application can override the ODP implementation default abort function
- * odp_override_abort() by providing an alternative to this weak symbol.
+ * The application can provide this function to the ODP implementation in two
+ * ways:
+ *
+ * - A callback passed in via odp_init_t and odp_init_global()
+ * - By overriding the ODP implementation default abort function
+ *   odp_override_abort().
  *
- * @warning The override option is not portable and GNU linker dependent
- * (utilizes function attribute weak).
+ * @warning The latter option is less portable and GNU linker dependent
+ * (utilizes function attribute weak). If both are defined, the odp_init_t
+ * function pointer has priority over the override function.
  *
  * @warning this function shall not return
  */
@@ -101,6 +106,7 @@ typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
  */
 typedef struct odp_init_t {
odp_log_func_t log_fn;
+   odp_abort_func_t abort_fn;
 } odp_init_t;
 
 /** ODP platform initialization data.
diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index e91e910..74c893f 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -19,6 +19,8 @@ int odp_init_global(odp_init_t *params  ODP_UNUSED,
if (params != NULL) {
if (params-log_fn != NULL)
odp_global_data.log_fn = params-log_fn;
+   if (params-abort_fn != NULL)
+   odp_global_data.abort_fn = params-abort_fn;
}
 
 
-- 
2.1.0


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


[lng-odp] [PATCH v2 5/5] validation: init: add test for replace abort

2015-02-03 Thread Mike Holmes
Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
 test/validation/.gitignore   |  1 +
 test/validation/Makefile.am  |  5 ++--
 test/validation/odp_init_abort.c | 62 
 3 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 test/validation/odp_init_abort.c

diff --git a/test/validation/.gitignore b/test/validation/.gitignore
index 4a1ccb4..242e576 100644
--- a/test/validation/.gitignore
+++ b/test/validation/.gitignore
@@ -1,6 +1,7 @@
 *.log
 *.trs
 odp_init
+odp_init_abort
 odp_queue
 odp_crypto
 odp_classification
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 703d9b6..a57be1a 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,17 +6,18 @@ AM_LDFLAGS += -static
 TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
 
 if test_vald
-TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run 
odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification
+TESTS = odp_init odp_init_abort odp_queue odp_crypto odp_shm odp_schedule 
odp_pktio_run odp_buffer odp_system odp_timer odp_time odp_synchronizers 
odp_classification
 endif
 
 dist_bin_SCRIPTS = $(srcdir)/odp_pktio_run
 
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio 
odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification
+bin_PROGRAMS = odp_init odp_init_abort odp_queue odp_crypto odp_shm 
odp_schedule odp_pktio odp_buffer odp_system odp_timer odp_time 
odp_synchronizers odp_classification
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
 odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
 odp_classification_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/classification
 
 dist_odp_init_SOURCES = odp_init.c
+dist_odp_init_abort_SOURCES = odp_init_abort.c
 dist_odp_pktio_SOURCES = odp_pktio.c common/odp_cunit_common.c
 dist_odp_queue_SOURCES = odp_queue.c common/odp_cunit_common.c
 dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
diff --git a/test/validation/odp_init_abort.c b/test/validation/odp_init_abort.c
new file mode 100644
index 000..c291146
--- /dev/null
+++ b/test/validation/odp_init_abort.c
@@ -0,0 +1,62 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include stdarg.h
+#include odp.h
+#include CUnit/Basic.h
+
+static void odp_init_abort(void) ODP_NORETURN;
+
+static void test_odp_init_global_replace_abort(void)
+{
+   int status;
+   struct odp_init_t init_data;
+
+   memset(init_data, 0, sizeof(init_data));
+   init_data.abort_fn = odp_init_abort;
+
+   status = odp_init_global(init_data, NULL);
+   CU_ASSERT_FATAL(status == 0);
+
+   status = odp_term_global();
+   CU_ASSERT(status == 0);
+}
+
+CU_TestInfo test_odp_init[] = {
+   {replace abort,  test_odp_init_global_replace_abort},
+   CU_TEST_INFO_NULL,
+};
+
+CU_SuiteInfo odp_testsuites[] = {
+   {Init, NULL, NULL, NULL, NULL, test_odp_init},
+   CU_SUITE_INFO_NULL,
+};
+
+int main(void)
+{
+   int ret;
+
+   printf(\tODP API version: %s\n, odp_version_api_str());
+   printf(\tODP implementation version: %s\n, odp_version_impl_str());
+
+   CU_set_error_action(CUEA_ABORT);
+
+   CU_initialize_registry();
+   CU_register_suites(odp_testsuites);
+   CU_basic_set_mode(CU_BRM_VERBOSE);
+   CU_basic_run_tests();
+
+   ret = CU_get_number_of_failure_records();
+
+   CU_cleanup_registry();
+
+   return ret;
+}
+
+void odp_init_abort(void)
+{
+   abort();
+}
-- 
2.1.0


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


Re: [lng-odp] classification tests scheduled queues

2015-02-03 Thread Radu-Andrei Bulie
Hi,

I think it's a good approach. One could see the functional test behavior using 
either poll or schedule
on the classification path.



-Original Message-
From: Jerin Jacob [mailto:jerin.ja...@caviumnetworks.com] 
Sent: Tuesday, February 03, 2015 3:29 PM
To: Bulie Radu-Andrei-B37577
Cc: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] classification tests scheduled queues

On Tue, Feb 03, 2015 at 01:07:15PM +, Radu-Andrei Bulie wrote:
 As I said in my comment we could use two approaches.(poll or data path 
 thread).

How about the scheme(#define IPSEC_POLL_QUEUES) followed in existing 
example/ipsec to abstract polled vs schedule mode ?

 The one you mentioned reflects the model of the reference applications. 
 Classification test itself, for the present moment,  is a functional 
 test and does not target performance. So I don't see a major difference in 
 using poll or a data path thread.
 
 
 Regards,
 
 Radu
 
 
 
 -Original Message-
 From: Ola Liljedahl [mailto:ola.liljed...@linaro.org]
 Sent: Tuesday, February 03, 2015 2:59 PM
 To: Bulie Radu-Andrei-B37577
 Cc: lng-odp@lists.linaro.org
 Subject: Re: [lng-odp] classification tests scheduled queues
 
 Wouldn't it be better to modify the validation program to make sure 
 scheduling is always performed on a data path thread?
 We want to promote usage of the scheduler, HW-accelerated classification and 
 scheduling are some of the differentiators of ODP.
 
 On 3 February 2015 at 13:53, Radu-Andrei Bulie radu.bu...@freescale.com 
 wrote:
  Hi,
 
 
 
  I have a comment regarding the scheduling approach in the 
  classification validation tests (this also can be extended to other 
  tests which use the same pattern).
 
  The schedule function should be called in context of a data path 
  thread that is bound to a known core (the same model as in pktio 
  application for instance).  Otherwise
 
  (as in the mentioned test) the main process (in this case the cunit
  test) can be scheduled by Linux on any core – e.g core 0 – that is 
  not in the data path. In this situation no dequeue will occur,  
  because the scheduling does not take place on a data path thread 
  (unlike  the case for pktio application where there is a  cpu dedicated to 
  control path).
 
  From the linux-generic perspective,  there is no apparent issue in 
  using the schedule function in this context. But as it is given in 
  the reference application, the purpose of the scheduling is to 
  function on the data path and thus to provide the advantages given 
  by different SoCs acceleration implementations. (there will always 
  be a control core and some data path cores).
 
  Thus, being in accordance with the reference applications from odp, 
  I suggest replacing the scheduled queues with poll queues or create 
  a separate thread which receives the packet, otherwise the test will 
  function only on linux generic implementation.
 
 
 
  PS: I could send the patch (using poll queues approach) if we reach 
  a consensus.
 
 
 
 
 
  Regards,
 
 
 
  Radu
 
 
  ___
  lng-odp mailing list
  lng-odp@lists.linaro.org
  http://lists.linaro.org/mailman/listinfo/lng-odp
 
 ___
 lng-odp mailing list
 lng-odp@lists.linaro.org
 http://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv5 00/19] Add Strong Typing for ODP Abstract Types

2015-02-03 Thread Bill Fischofer
That can be done as a separate patch as this one is large enough already.
Three of them (odp_pool_to_u64(), odp_pktio_to_u64(), and
odp_queue_to_u64()) are already exercised as part of the examples.  These
are trivial conversion APIs so I'm not worried about the linux-generic
implementation of the others (they're all identical).  But having them as
validation tests for other implementations would be reasonable.

On Tue, Feb 3, 2015 at 6:43 AM, Mike Holmes mike.hol...@linaro.org wrote:

 I think  we need to add unit tests for the new APIs introduced

 On 2 February 2015 at 23:44, Bill Fischofer bill.fischo...@linaro.org
 wrote:

 This patch series adds strong typing support for ODP abstract types. This
 prevents incorrect types from being used with ODP APIs. Misuse of types
 will
 now result in a compile-time error.

 To allow handles to be printed for diagnostic purposes the following new
 APIs
 are added that have the signatures:

 uint64_t odp_buffer_to_u64(odp_buffer_t hdl);
 uint64_t odp_cos_to_u64(odp_cos_t hdl);
 uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
 uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl);
 uint64_t odp_pmr_to_u64(odp_pmr_t_hdl);
 uint64_t odp_pmr_set_to_u64(odp_pmr_set_t hdl);
 uint64_t odp_event_to_u64(odp_event_t hdl);
 uint64_t odp_packet_to_u64(odp_packet_t hdl);
 uint64_t odp_packet_seg_to_u64(odp_packet_seg_t_print);
 uint64_t odp_pool_to_u64(odp_pool_t hdl);
 uint64_t odp_pktio_to_u64(odp_pktio_t hdl);
 uint64_t odp_queue_to_u64(odp_queue_t hdl);
 uint64_t odp_shm_to_u64(odp_shm_t hdl);

 The output of these routines should be printed using the C99 PRIu64 format
 code, and examples are updated to this convention.

 Patch change history:
 v2 - Adds print functions for the remaining public ODP types. It is also
 rebased to apply on the 0.10.0 release of ODP.

 v3 - Corrects the definition of odp_buffer_bits to ensure that correct
 fields
 are referenced on both big and little endian systems.

 v4 - Add missing strong typing support for odp_crypto_session_t and
 odp_crypto_compl_t types.

 v5 - Change display function names from odp_type_t_print() to
 odp_type_to_u64(). Split out API changes from linux-generic
 implementation
 changes.

 Petri: Please review these new APIs. All other changes as a result of this
 patch are internal and transparent to ODP applications.

 Bill Fischofer (19):
   api: buffers: add strong typing handle diplay function
   api: classification: add strong typing handle display functions
   api: crypto: add strong typing handle display functions
   api: events: add strong typing handle display function
   api: packets: add strong typing handle display function
   api: pktio: add strong typing handle display function
   api: pool: add strong typing handle display function
   api: queues: add strong typing handle display function
   api: shm: add strong typing handle display function
   linux-generic: add base macros for strong typing support
   linux-generic: buffers: add strong typing support
   linux-generic: classification: add strong typing support
   linux-generic: crypto: add strong typing support
   linux-generic: events: add strong typing support
   linux-generic: pktio: add strong typing support
   linux-generic: packets: add strong typing support
   linux-generic: pool: add strong typing support
   linux-generic: queues: add strong typing support
   linux-generic: shm: add strong typing support

  example/generator/odp_generator.c  | 12 +++--
  example/ipsec/odp_ipsec.c  | 18 +---
  example/l2fwd/odp_l2fwd.c  | 11 +++--
  example/packet/odp_pktio.c | 22 ++
  include/odp/api/buffer.h   | 13 ++
  include/odp/api/classification.h   | 44
 ---
  include/odp/api/crypto.h   | 26 +++
  include/odp/api/event.h| 12 +
  include/odp/api/packet.h   | 25 +++
  include/odp/api/packet_io.h| 12 +
  include/odp/api/pool.h | 13 ++
  include/odp/api/queue.h| 13 ++
  include/odp/api/shared_memory.h| 13 ++
  platform/linux-generic/Makefile.am |  1 +
  .../linux-generic/include/odp/plat/buffer_types.h  | 15 +--
  .../include/odp/plat/classification_types.h| 34 ---
  .../linux-generic/include/odp/plat/crypto_types.h  | 13 +-
  .../linux-generic/include/odp/plat/event_types.h   | 14 --
  .../include/odp/plat/packet_io_types.h | 15 +--
  .../linux-generic/include/odp/plat/packet_types.h  | 24 +++---
  .../linux-generic/include/odp/plat/pool_types.h| 13 +-
  .../linux-generic/include/odp/plat/queue_types.h   | 14 --
  .../include/odp/plat/shared_memory_types.h | 13 +-
  

Re: [lng-odp] [PATCH v2] api: classification: pmr statistics counter API removal

2015-02-03 Thread Maxim Uvarov

Merged!

Maxim.

On 02/03/2015 02:17 PM, Mike Holmes wrote:



On 3 February 2015 at 03:42, bala.manoha...@linaro.org 
mailto:bala.manoha...@linaro.org wrote:


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

odp_pmr_match_count() API related to statistics count of PMR has
been moved out of ODP 1.0
version and the same will be incorporated once an ODP level common
statistics counter design has
been achieved.

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


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


---
v2: Incorporated review comments from Mike

 include/odp/api/classification.h|  9 -
 platform/linux-generic/odp_classification.c |  8 
 .../classification/odp_classification_tests.c   | 21
-
 3 files changed, 38 deletions(-)

diff --git a/include/odp/api/classification.h
b/include/odp/api/classification.h
index 5c6636f..609d529 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -279,15 +279,6 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
 int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos,
odp_cos_t dst_cos);

 /**
- * Retrieve packet matcher statistics
- *
- * @param[in]  pmr_id  PMR from which to retrieve the count
- *
- * @return Current number of matches for a
given matcher instance.
- */
-signed long odp_pmr_match_count(odp_pmr_t pmr_id);
-
-/**
  * Inquire about matching terms supported by the classifier
  *
  * @return A mask one bit per enumerated term, one for each of
op_pmr_term_e
diff --git a/platform/linux-generic/odp_classification.c
b/platform/linux-generic/odp_classification.c
index 78597ef..31d1328 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -505,14 +505,6 @@ int odp_cos_pmr_cos(odp_pmr_t pmr_id,
odp_cos_t src_cos, odp_cos_t dst_cos)
return 0;
 }

-signed long odp_pmr_match_count(odp_pmr_t pmr_id)
-{
-   pmr_t *pmr = get_pmr_entry(pmr_id);
-   if (pmr == NULL)
-   return -1;
-   return (signed long)odp_atomic_load_u32(pmr-s.count);
-}
-
 unsigned long long odp_pmr_terms_cap(void)
 {
unsigned long long term_cap = 0;
diff --git
a/test/validation/classification/odp_classification_tests.c
b/test/validation/classification/odp_classification_tests.c
index e4b3260..45822d3 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -423,8 +423,6 @@ void test_cls_pmr_chain(void)
pkt = receive_packet(queue, ODP_TIME_SEC);
CU_ASSERT(queue == queue_list[CLS_PMR_CHAIN_SRC]);
CU_ASSERT(seq == cls_pkt_get_seq(pkt));
-
-   CU_ASSERT(1 ==
odp_pmr_match_count(pmr_list[CLS_PMR_CHAIN_DST]));
odp_packet_free(pkt);
 }

@@ -657,7 +655,6 @@ void test_pmr_cos(void)
pkt = receive_packet(queue, ODP_TIME_SEC);
CU_ASSERT(queue == queue_list[CLS_PMR]);
CU_ASSERT(seq == cls_pkt_get_seq(pkt));
-   CU_ASSERT(1 == odp_pmr_match_count(pmr_list[CLS_PMR]));
odp_packet_free(pkt);
 }

@@ -740,23 +737,6 @@ void test_pktio_pmr_match_set_cos(void)
odp_packet_free(pkt);
 }

-static void classification_pmr_match_count(void)
-{
-   odp_pmr_t pmr;
-   uint16_t val;
-   uint16_t mask;
-   val = 1024;
-   mask = 0x;
-   int retval;
-   pmr = odp_pmr_create_match(ODP_PMR_TCP_SPORT, val, mask,
sizeof(val));
-   CU_ASSERT(pmr != ODP_PMR_INVAL);
-
-   retval = odp_pmr_match_count(pmr);
-   CU_ASSERT(retval == 0);
-
-   odp_pmr_destroy(pmr);
-}
-
 static void classification_pmr_terms_avail(void)
 {
int retval;
@@ -814,6 +794,5 @@ CU_TestInfo classification_tests[] = {
_CU_TEST_INFO(classification_pmr_terms_cap),
_CU_TEST_INFO(classification_pktio_configure),
_CU_TEST_INFO(classification_pktio_test),
-   _CU_TEST_INFO(classification_pmr_match_count),
CU_TEST_INFO_NULL,
 };
--
2.0.1.472.g6f92e5f


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




--
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP


___
lng-odp mailing list
lng-odp@lists.linaro.org

Re: [lng-odp] [PATCHv4 6/6] validation: odp_timer.c: run at least one thread

2015-02-03 Thread Ola Liljedahl
On 3 February 2015 at 22:42, Anders Roxell anders.rox...@linaro.org wrote:
 On 2015-02-03 16:44, Ola Liljedahl wrote:
 Ensure we run at least one worker thread.

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

 Reviewed-by: Anders Roxell anders.rox...@linaro.org
Fabulous! Have you reviewed the whole patch set now (this was the last one)?

If I had received all the review feedback from the start, I could have
done one update and made the split into six separate patches then.
That would have been more efficient use of *my* time (don't know about
others).





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

  test/validation/odp_timer.c | 10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

 diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
 index 5218406..1f673c0 100644
 --- a/test/validation/odp_timer.c
 +++ b/test/validation/odp_timer.c
 @@ -270,9 +270,13 @@ static void test_odp_timer_all(void)
  {
   odp_pool_param_t params;
   odp_timer_pool_param_t tparam;
 - /* This is a stressfull test - need to reserve some cpu cycles
 -  * @TODO move to test/performance */
 - int num_workers = min(odp_sys_cpu_count()-1, MAX_WORKERS);
 + /* Reserve at least one core for running other processes so the timer
 +  * test hopefully can run undisturbed and thus get better timing
 +  * results. */
 + int num_workers = min(odp_sys_cpu_count() - 1, MAX_WORKERS);
 + /* On a single-CPU machine run at least one thread */
 + if (num_workers  1)
 + num_workers = 1;

   /* Create timeout pools */
   params.tmo.num = (NTIMERS + 1) * num_workers;
 --
 1.9.1


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

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


Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h

2015-02-03 Thread Bill Fischofer
My review simply says I'm happy with it.  Others can NAK it if they choose.

On Tue, Feb 3, 2015 at 3:54 PM, Anders Roxell anders.rox...@linaro.org
wrote:

 On 2015-02-03 11:16, Bill Fischofer wrote:
  For this series:
 
  Reviewed-by: Bill Fischofer bill.fischo...@linaro.org
 
  On Tue, Feb 3, 2015 at 5:25 AM, Savolainen, Petri (NSN - FI/Espoo) 
  petri.savolai...@nsn.com wrote:
 
  
  

 [...]

 + *
 + * CPU number where the thread is currently running. CPU
 numbering is
system
 + * specific.
 + *
 + * @return CPU number
 + */
 +int odp_cpu(void);
 Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
 odp_cpu is missing something and does not lead to direct
 understanding of what the function does or returns.
   
I become odp_cpu_id() in the second patch.
Why not to name it like this in the first patch?
  
   I rebased the second commit (should have rebased the first). The commit
   history is not perfect, but I think we can live with that.

 Why do we think this is good enough when others have to redo their
 patches?

 Cheers,
 Anders

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


Re: [lng-odp] [PATCHv5 11/19] linux-generic: buffers: add strong typing support

2015-02-03 Thread Taras Kondratiuk
On 02/03/2015 11:50 PM, Bill Fischofer wrote:
 The changes here are to
 platform/linux-generic/include/odp/plat/type_types.h.  This is where
 the strong typing is actually implemented for each ODP type in
 linux-generic.  The converter functions are part of that implementation,
 and are also inlined for performance, which is why they are here.
 
 All other changes within each patch part are the modifications to other
 ODP files needed as a result of switching to strong typing for this
 type.  They are not separable since once strong typing is enabled for
 that type the code won't compile without these changes.
 
 The doxygen stuff is in the APIs which are in include/odp/api/*.h as you
 mention.  The main difference between v4 and v5 was to break out the API
 definition changes separately, which is why this has gone from 10 to 19
 parts.
 
 So it sounds like this is doing exactly what you suggest, no?

As I've commented in the previous message it is OK, because these API
are kind of exceptional. All other 'static inline' implementations
should not be in *_types.h. That is not related to your series. Just a
reminder.

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


Re: [lng-odp] [PATCHv5 11/19] linux-generic: buffers: add strong typing support

2015-02-03 Thread Taras Kondratiuk
On 02/03/2015 11:57 PM, Ola Liljedahl wrote:
 The re-org has make it easier for the implementors of ODP.
 However, its a bit harder to follow the structure now maybe.

 static inline functions should go into:
 platform/linux-generic/include/odp/*.h

 and typedefs, defines, enums, and structs that are platform specific
 should go into:
 platform/linux-generic/include/odp/plat/*_types.h
 Me thinks there should be a couple more directory levels here. Why not
 repeat plat and platform a couple of times?

'plat' is a header namespace to separate files after they are installed
and keep destination directory organized.
If you don't like the name please send a patch to rename it ;)



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


Re: [lng-odp] [PATCHv5 11/19] linux-generic: buffers: add strong typing support

2015-02-03 Thread Ola Liljedahl
On 3 February 2015 at 23:24, Taras Kondratiuk
taras.kondrat...@linaro.org wrote:
 On 02/03/2015 11:57 PM, Ola Liljedahl wrote:
 The re-org has make it easier for the implementors of ODP.
 However, its a bit harder to follow the structure now maybe.

 static inline functions should go into:
 platform/linux-generic/include/odp/*.h

 and typedefs, defines, enums, and structs that are platform specific
 should go into:
 platform/linux-generic/include/odp/plat/*_types.h
 Me thinks there should be a couple more directory levels here. Why not
 repeat plat and platform a couple of times?

 'plat' is a header namespace to separate files after they are installed
 and keep destination directory organized.
 If you don't like the name please send a patch to rename it ;)
Taras if there was a description of the complete ODP directory
structure somewhere it would probably make sense.




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


[lng-odp] [PATCHv5 01/18] api: odp_cpumask.h: odp_cpumask_to_str() return chars written or error

2015-02-03 Thread Ola Liljedahl
Add define ODP_CPUMASK_BUFSIZE for minimum output buffer size for
odp_cpumask_to_str().
odp_cpumask_to_str() takes output buffer size as input and returns
number
of chars written (on success), 0 on failure.
Updated the implementation.
Updated all usages in example and test programs.

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/generator/odp_generator.c  |  4 ++--
 example/ipsec/odp_ipsec.c  |  4 ++--
 example/l2fwd/odp_l2fwd.c  |  4 ++--
 example/packet/odp_pktio.c |  4 ++--
 example/timer/odp_timer_test.c |  4 ++--
 include/odp/api/cpumask.h  | 23 ++-
 .../linux-generic/include/odp/plat/cpumask_types.h |  5 +
 platform/linux-generic/odp_cpumask.c   | 26 +-
 test/api_test/odp_common.c |  4 ++--
 test/performance/odp_scheduling.c  |  4 ++--
 10 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 03dab50..2433cb6 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -545,7 +545,7 @@ int main(int argc, char *argv[])
int i;
odp_shm_t shm;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
/* Init ODP before calling anything else */
@@ -596,7 +596,7 @@ int main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 03f2419..869fd3a 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1193,7 +1193,7 @@ main(int argc, char *argv[])
int stream_count;
odp_shm_t shm;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
/* Init ODP before calling anything else */
@@ -1242,7 +1242,7 @@ main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 7a520fb..e22ec0c 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
int num_workers;
odp_shm_t shm;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
/* Init ODP before calling anything else */
@@ -336,7 +336,7 @@ int main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 28ed98c..e38029a 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
int i;
int cpu;
odp_cpumask_t cpumask;
-   char cpumaskstr[64];
+   char cpumaskstr[ODP_CPUMASK_BUFSIZE];
odp_pool_param_t params;
 
args = calloc(1, sizeof(args_t));
@@ -324,7 +324,7 @@ int main(int argc, char *argv[])
 * Start mapping thread from CPU #1
 */
num_workers = odph_linux_cpumask_default(cpumask, num_workers);
-   odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
+   (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf(num worker threads: %i\n, num_workers);
printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 0df041f..299ed89 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -317,7 +317,7 @@ int main(int argc, 

[lng-odp] [PATCHv5 02/18] api: odp_pktio.h: odp_pktio_mac_addr() return chars written or error

2015-02-03 Thread Ola Liljedahl
Added define ODP_PKTIO_MACADDRSIZE which specifies the recommended
output buffer size for odp_pktio_mac_addr().
odp_pktio_mac_addr() takes output buffer size as input and returns
number
of chars written (on success), 0 on failure.
Updated the implementation.
Updated all usages in example and test programs.

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

 include/odp/api/packet_io.h  | 20 +---
 .../linux-generic/include/odp/plat/packet_io_types.h |  2 ++
 platform/linux-generic/odp_packet_io.c   | 11 ++-
 test/validation/odp_pktio.c  |  8 
 4 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index da7bc3f..0c8af0c 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -18,6 +18,7 @@
 extern C {
 #endif
 
+#include sys/types.h
 
 /** @defgroup odp_packet_io ODP PACKET IO
  *  Operations on a packet.
@@ -39,6 +40,11 @@ extern C {
  * odp_pktio_t value to indicate any port
  */
 
+/*
+ * @def ODP_PKTIO_MACADDRSIZE
+ * Minimum size of output buffer for odp_pktio_mac_addr()
+ */
+
 /**
  * Open an ODP packet IO instance
  *
@@ -167,16 +173,16 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t 
enable);
 int odp_pktio_promisc_mode(odp_pktio_t id);
 
 /**
- * Get the default MAC address of a packet IO interface.
+ * Get the native MAC address of a packet IO interface.
  *
- * @param  idODP packet IO handle.
- * @param[out] mac_addr  Storage for MAC address of the packet IO interface.
- * @param  addr_size Storage size for the address
+ * @param  hdl  ODP packet IO handle
+ * @param[out] mac_addr  Output buffer (use ODP_PKTIO_MACADDRSIZE)
+ * @param   size Size of output buffer
  *
- * @retval Number of bytes written on success, 0 on failure.
+ * @return Number of bytes written to buffer
+ * @retval 0 on failure
  */
-size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
- size_t addr_size);
+ssize_t odp_pktio_mac_addr(odp_pktio_t hdl, void *mac_addr, ssize_t size);
 
 /**
  * Setup per-port default class-of-service.
diff --git a/platform/linux-generic/include/odp/plat/packet_io_types.h 
b/platform/linux-generic/include/odp/plat/packet_io_types.h
index a6bbacf..61dca13 100644
--- a/platform/linux-generic/include/odp/plat/packet_io_types.h
+++ b/platform/linux-generic/include/odp/plat/packet_io_types.h
@@ -23,6 +23,8 @@ extern C {
  *  @{
  */
 
+#define ODP_PKTIO_MACADDRSIZE 16
+
 typedef uint32_t odp_pktio_t;
 
 #define ODP_PKTIO_INVALID 0
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index bdb690e..f156dd3 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -798,18 +798,19 @@ int odp_pktio_promisc_mode(odp_pktio_t id)
 }
 
 
-size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
-  size_t addr_size)
+ssize_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, ssize_t addr_size)
 {
pktio_entry_t *entry;
 
-   if (addr_size  ETH_ALEN)
-   return 0;
+   if (addr_size  ETH_ALEN) {
+   /* Output buffer too small */
+   return -1;
+   }
 
entry = get_pktio_entry(id);
if (entry == NULL) {
ODP_DBG(pktio entry %d does not exist\n, id);
-   return 0;
+   return -1;
}
 
lock_entry(entry);
diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 84121f5..e1ca793 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -450,22 +450,22 @@ static void test_odp_pktio_promisc(void)
 static void test_odp_pktio_mac(void)
 {
unsigned char mac_addr[ODPH_ETHADDR_LEN];
-   size_t mac_len;
+   ssize_t mac_len;
int ret;
odp_pktio_t pktio = create_pktio(iface_name[0]);
 
printf(testing mac for %s\n, iface_name[0]);
 
-   mac_len = odp_pktio_mac_addr(pktio, mac_addr, ODPH_ETHADDR_LEN);
+   mac_len = odp_pktio_mac_addr(pktio, mac_addr, sizeof(mac_addr));
CU_ASSERT(ODPH_ETHADDR_LEN == mac_len);
 
printf( %X:%X:%X:%X:%X:%X ,
   mac_addr[0], mac_addr[1], mac_addr[2],
   mac_addr[3], mac_addr[4], mac_addr[5]);
 
-   /* Fail case: wrong addr_size. Expected 0. */
+   /* Fail case: wrong addr_size. Expected 0. */
mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2);
-   CU_ASSERT(0 == mac_len);
+   CU_ASSERT(mac_len  0);
 
ret = odp_pktio_close(pktio);
CU_ASSERT(0 == ret);
-- 
1.9.1


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


[lng-odp] [PATCHv5 05/18] api: odp_buffer.h: undefined behavior description

2015-02-03 Thread Ola Liljedahl
Documented API calls which are guaranteed to handle invalid/stale handles.

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

 include/odp/api/buffer.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/buffer.h b/include/odp/api/buffer.h
index 12b2f5a..1eb2e5a 100644
--- a/include/odp/api/buffer.h
+++ b/include/odp/api/buffer.h
@@ -88,7 +88,9 @@ uint32_t odp_buffer_size(odp_buffer_t buf);
 /**
  * Tests if buffer is valid
  *
- * @param buf  Buffer handle
+ * @param buf  Buffer handle (possibly invalid)
+ * @note This is the only buffer API function which accepts invalid buffer
+ * handles (any bit value) without causing undefined behavior.
  *
  * @retval 1 Buffer handle represents a valid buffer.
  * @retval 0 Buffer handle does not represent a valid buffer.
-- 
1.9.1


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


[lng-odp] [PATCHv5 12/18] api: odp_queue.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/queue.h | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h
index 377a7da..b06522c 100644
--- a/include/odp/api/queue.h
+++ b/include/odp/api/queue.h
@@ -158,7 +158,8 @@ typedef struct odp_queue_param_t {
  * @param typeQueue type
  * @param param   Queue parameters. Uses defaults if NULL.
  *
- * @return Queue handle or ODP_QUEUE_INVALID
+ * @return Queue handle
+ * @retval ODP_QUEUE_INVALID on failure
  */
 odp_queue_t odp_queue_create(const char *name, odp_queue_type_t type,
 odp_queue_param_t *param);
@@ -173,7 +174,8 @@ odp_queue_t odp_queue_create(const char *name, 
odp_queue_type_t type,
  *
  * @param queueQueue handle
  *
- * @return 0 if successful
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_queue_destroy(odp_queue_t queue);
 
@@ -182,7 +184,8 @@ int odp_queue_destroy(odp_queue_t queue);
  *
  * @param nameQueue name
  *
- * @return Queue handle or ODP_QUEUE_INVALID
+ * @return Queue handle
+ * @retval ODP_QUEUE_INVALID on failure
  */
 odp_queue_t odp_queue_lookup(const char *name);
 
@@ -196,7 +199,8 @@ odp_queue_t odp_queue_lookup(const char *name);
  * @param queueQueue handle
  * @param context  Address to the queue context
  *
- * @return 0 if successful
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_queue_set_context(odp_queue_t queue, void *context);
 
@@ -205,8 +209,8 @@ int odp_queue_set_context(odp_queue_t queue, void *context);
  *
  * @param queueQueue handle
  *
- * @return If successful, a pointer to the queue context,
- * NULL for failure.
+ * @return pointer to the queue context
+ * @retval NULL on failure
  */
 void *odp_queue_get_context(odp_queue_t queue);
 
@@ -216,7 +220,8 @@ void *odp_queue_get_context(odp_queue_t queue);
  * @param queue   Queue handle
  * @param ev  Event handle
  *
- * @return 0 if succesful
+ * @retval 0 on success
+ * @retval 0 on failure (e.g. queue full)
  */
 int odp_queue_enq(odp_queue_t queue, odp_event_t ev);
 
@@ -240,7 +245,8 @@ int odp_queue_enq_multi(odp_queue_t queue, const 
odp_event_t events[], int num);
  *
  * @param queue   Queue handle
  *
- * @return Event handle, or ODP_EVENT_INVALID
+ * @return Event handle
+ * @retval ODP_EVENT_INVALID on failure (e.g. queue empty)
  */
 odp_event_t odp_queue_deq(odp_queue_t queue);
 
@@ -251,10 +257,11 @@ odp_event_t odp_queue_deq(odp_queue_t queue);
  * ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead).
  *
  * @param queue   Queue handle
- * @param events  Event handle array for output
- * @param num Maximum number of event handles
+ * @param[out] events  Array of event handles for output
+ * @param num Maximum number of events to dequeue
 
- * @return Number of events written (0 ... num)
+ * @return Number of events actually dequeued (0 ... num)
+ * @retval 0 on failure
  */
 int odp_queue_deq_multi(odp_queue_t queue, odp_event_t events[], int num);
 
-- 
1.9.1


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


[lng-odp] [PATCHv5 10/18] api: odp_packet_flags.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/packet_flags.h | 51 --
 1 file changed, 34 insertions(+), 17 deletions(-)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index df1486b..f9e8ae8 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -41,7 +41,8 @@ int odp_packet_has_error(odp_packet_t pkt);
  * Check for L2 header, e.g. ethernet
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid  known L2 header, 0 otherwise
+ * @retval 1 if packet contains a valid  known L2 header
+ * @retval 0 if packet does not contain a valid  known L2 header
  */
 int odp_packet_has_l2(odp_packet_t pkt);
 
@@ -49,7 +50,8 @@ int odp_packet_has_l2(odp_packet_t pkt);
  * Check for L3 header, e.g. IPv4, IPv6
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid  known L3 header, 0 otherwise
+ * @retval 1 if packet contains a valid  known L3 header
+ * @retval 0 if packet does not contain a valid  known L3 header
  */
 int odp_packet_has_l3(odp_packet_t pkt);
 
@@ -57,7 +59,8 @@ int odp_packet_has_l3(odp_packet_t pkt);
  * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP)
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid  known L4 header, 0 otherwise
+ * @retval 1 if packet contains a valid  known L4 header
+ * @retval 0 if packet does not contain a valid  known L4 header
  */
 int odp_packet_has_l4(odp_packet_t pkt);
 
@@ -65,7 +68,8 @@ int odp_packet_has_l4(odp_packet_t pkt);
  * Check for Ethernet header
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a valid eth header, 0 otherwise
+ * @retval 1 if packet contains a valid eth header
+ * @retval 0 if packet does not contain a valid  known eth header
  */
 int odp_packet_has_eth(odp_packet_t pkt);
 
@@ -73,7 +77,8 @@ int odp_packet_has_eth(odp_packet_t pkt);
  * Check for jumbo frame
  *
  * @param pkt Packet handle
- * @return 1 if packet contains jumbo frame, 0 otherwise
+ * @retval 1 if packet contains a jumbo frame
+ * @retval 0 if packet does not contain a jumbo frame
  */
 int odp_packet_has_jumbo(odp_packet_t pkt);
 
@@ -81,7 +86,8 @@ int odp_packet_has_jumbo(odp_packet_t pkt);
  * Check for VLAN
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a VLAN header, 0 otherwise
+ * @retval 1 if packet contains a VLAN header
+ * @retval 0 if packet does not contain a VLAN header
  */
 int odp_packet_has_vlan(odp_packet_t pkt);
 
@@ -89,7 +95,8 @@ int odp_packet_has_vlan(odp_packet_t pkt);
  * Check for VLAN QinQ (stacked VLAN)
  *
  * @param pkt Packet handle
- * @return 1 if packet contains a VLAN QinQ header, 0 otherwise
+ * @retval 1 if packet contains a VLAN QinQ header
+ * @retval 0 if packet does not contain a VLAN QinQ header
  */
 int odp_packet_has_vlan_qinq(odp_packet_t pkt);
 
@@ -97,7 +104,8 @@ int odp_packet_has_vlan_qinq(odp_packet_t pkt);
  * Check for ARP
  *
  * @param pkt Packet handle
- * @return 1 if packet contains an ARP header, 0 otherwise
+ * @retval 1 if packet contains an ARP message
+ * @retval 0 if packet does not contain an ARP message
  */
 int odp_packet_has_arp(odp_packet_t pkt);
 
@@ -105,7 +113,8 @@ int odp_packet_has_arp(odp_packet_t pkt);
  * Check for IPv4
  *
  * @param pkt Packet handle
- * @return 1 if packet contains an IPv4 header, 0 otherwise
+ * @retval 1 if packet contains an IPv4 header
+ * @retval 0 if packet does not contain an IPv4 header
  */
 int odp_packet_has_ipv4(odp_packet_t pkt);
 
@@ -113,7 +122,8 @@ int odp_packet_has_ipv4(odp_packet_t pkt);
  * Check for IPv6
  *
  * @param pkt Packet handle
- * @return 1 if packet contains an IPv6 header, 0 otherwise
+ * @retval 1 if packet contains an IPv6 header
+ * @retval 0 if packet does not contain an IPv6 header
  */
 int odp_packet_has_ipv6(odp_packet_t pkt);
 
@@ -121,7 +131,8 @@ int odp_packet_has_ipv6(odp_packet_t pkt);
  * Check for IP fragment
  *
  * @param pkt Packet handle
- * @return 1 if packet is an IP fragment, 0 otherwise
+ * @retval 1 if packet is an IP fragment
+ * @retval 0 if packet is not an IP fragment
  */
 int odp_packet_has_ipfrag(odp_packet_t pkt);
 
@@ -129,7 +140,8 @@ int odp_packet_has_ipfrag(odp_packet_t pkt);
  * Check for IP options
  *
  * @param pkt Packet handle
- * @return 1 if packet contains IP options, 0 otherwise
+ * @retval 1 if packet contains IP options
+ * @retval 0 if packet does not contain IP options
  */
 int odp_packet_has_ipopt(odp_packet_t pkt);
 
@@ -137,7 +149,8 @@ int odp_packet_has_ipopt(odp_packet_t pkt);
  * Check for IPSec
  *
  * @param pkt Packet handle
- * @return 1 if packet requires IPSec processing, 0 otherwise
+ * @retval 1 if packet requires IPSec processing
+ * @retval 0 

[lng-odp] [PATCHv5 11/18] api: odp_packet_io.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/packet_io.h | 89 ++---
 Updated doxygen descriptions, particularly the @return/@retval descriptions.
 No change of implementation necessary.

 1 file changed, 51 insertions(+), 38 deletions(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 0c8af0c..3fa4063 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -56,7 +56,8 @@ extern C {
  * @param pool   Pool from which to allocate buffers for storing packets
  *   received over this packet IO
  *
- * @return ODP packet IO handle or ODP_PKTIO_INVALID on error
+ * @return ODP packet IO handle
+ * @retval ODP_PKTIO_INVALID on failure
  *
  * @note dev name loop is specially pktio reserved name for
  *  device used for testing. Usually it's loop back
@@ -67,110 +68,118 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t 
pool);
 /**
  * Close an ODP packet IO instance
  *
- * @param id  ODP packet IO handle
+ * @param hdl  ODP packet IO handle
  *
- * @return 0 on success or -1 on error
+ * @retval 0 on success
+ * @retval 0 on failure
  */
-int odp_pktio_close(odp_pktio_t id);
+int odp_pktio_close(odp_pktio_t hdl);
 
 /**
  * Return a packet IO handle for an already open device
  *
  * @param dev Packet IO device name
  *
- * @return ODP packet IO handle or ODP_PKTIO_INVALID
+ * @return ODP packet IO handle
+ * @retval ODP_PKTIO_INVALID on failure
  */
 odp_pktio_t odp_pktio_lookup(const char *dev);
 
 /**
  * Receive packets
  *
- * @param id  ODP packet IO handle
+ * @param hdl ODP 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
  *
- * @return Number of packets received or -1 on error
+ * @return Number of packets received
+ * @retval 0 on failure
  */
-int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len);
+int odp_pktio_recv(odp_pktio_t hdl, odp_packet_t pkt_table[], unsigned len);
 
 /**
  * Send packets
  *
- * @param id   ODP packet IO handle
+ * @param hdl  ODP packet IO handle
  * @param pkt_table[]  Array of packets to send
  * @param len  length of pkt_table[]
  *
- * @return Number of packets sent or -1 on error
+ * @return Number of packets sent
+ * @retval 0 on failure
  */
-int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len);
+int odp_pktio_send(odp_pktio_t hdl, odp_packet_t pkt_table[], unsigned len);
 
 /**
  * Set the default input queue to be associated with a pktio handle
  *
- * @param id   ODP packet IO handle
+ * @param hdl  ODP packet IO handle
  * @param queue default input queue set
- * @return  0 on success or -1 on error
+ * @retval  0 on success
+ * @retval 0 on failure
  */
-int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue);
+int odp_pktio_inq_setdef(odp_pktio_t hdl, odp_queue_t queue);
 
 /**
  * Get default input queue associated with a pktio handle
  *
- * @param id  ODP packet IO handle
+ * @param hdl ODP packet IO handle
  *
- * @return Default input queue set or ODP_QUEUE_INVALID on error
+ * @return Default input queue set
+ * @retval ODP_QUEUE_INVALID on failure
  */
-odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id);
+odp_queue_t odp_pktio_inq_getdef(odp_pktio_t hdl);
 
 /**
  * Remove default input queue (if set)
  *
- * @param id  ODP packet IO handle
+ * @param hdl ODP packet IO handle
  *
- * @return 0 on success or -1 on error
+ * @retval 0 on success
+ * @retval 0 on failure
  */
-int odp_pktio_inq_remdef(odp_pktio_t id);
+int odp_pktio_inq_remdef(odp_pktio_t hdl);
 
 /**
  * Query default output queue
  *
- * @param id ODP packet IO handle
+ * @param hdl ODP packet IO handle
  *
- * @return Default out queue or ODP_QUEUE_INVALID on error
+ * @return Default out queue
+ * @retval ODP_QUEUE_INVALID on failure
  */
-odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id);
+odp_queue_t odp_pktio_outq_getdef(odp_pktio_t hdl);
 
 /**
  * Return the currently configured MTU value of a packet IO interface.
  *
- * @param[in] id  ODP packet IO handle.
+ * @param[in] hdl  ODP packet IO handle.
  *
- * @retval MTU value 0 on success.
- * @retval -1 on any error or not existance pktio id.
+ * @return MTU value on success
+ * @retval 0 on failure
  */
-int odp_pktio_mtu(odp_pktio_t id);
+int odp_pktio_mtu(odp_pktio_t hdl);
 
 /**
  * Enable/Disable promiscuous mode on a packet IO interface.
  *
- * @param[in] id   ODP packet IO handle.
+ * @param[in] hdl  ODP packet IO handle.
  * @param[in] enable   1 to enable, 0 to disable.
  *
- * @retval 0 on success.
- * @retval non-zero on any error.
+ * @retval 0 on 

[lng-odp] [PATCHv5 08/18] api: odp_init.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/init.h | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index c73b321..c14769f 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -66,8 +66,8 @@ typedef enum odp_log_level {
  * @param[in] level   Log level
  * @param[in] fmt printf-style message format
  *
- * @return The number of characters logged if succeeded. Otherwise returns
- * a negative number.
+ * @return The number of characters logged on success
+ * @retval 0 on failure
  */
 int odp_override_log(odp_log_level_e level, const char *fmt, ...);
 
@@ -108,8 +108,8 @@ typedef struct odp_platform_init_t {
  * @param[in] platform_params Those parameters that are passed without
  * interpretation by the ODP API to the implementation.
  *
- * @retval 0 if successful
- * @retval -1 on failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
 
@@ -133,8 +133,8 @@ int odp_init_global(odp_init_t *params, odp_platform_init_t 
*platform_params);
  * @sa odp_init_global()
  * @sa odp_term_local() which must have been called prior to this.
  *
- * @retval 0 if successful
- * @retval -1 on failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_term_global(void);
 
@@ -147,8 +147,8 @@ int odp_term_global(void);
  * @sa odp_term_local()
  * @sa odp_init_global() which must have been called prior to this.
  *
- * @retval 0 if successful
- * @retval -1 on failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_init_local(void);
 
@@ -170,8 +170,8 @@ int odp_init_local(void);
  * @warning The unwinding of HW resources to allow them to be re used without 
reseting
  * the device is a complex task that the application is expected to coordinate.
  *
- * @retval 1 if successful and more ODP thread exists
- * @retval 0 if successful and it was the last ODP thread
+ * @retval 1 on success and more ODP threads exist
+ * @retval 0 on success and no more ODP threads exist
  * @retval -1 on failure
  */
 int odp_term_local(void);
-- 
1.9.1


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


[lng-odp] [PATCHv5 03/18] api: odp_crypto.h: odp_hw_random_get(): return number of bytes written

2015-02-03 Thread Ola Liljedahl
odp_hw_random_get() takes output buffer size as input and returns number
of bytes written (on success), 0 on failure.
Updated the implementation.
Updated all usages in example and test programs.

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/ipsec/odp_ipsec_cache.c  |  6 --
 include/odp/api/crypto.h | 17 ++---
 platform/linux-generic/odp_crypto.c  |  8 
 test/validation/crypto/odp_crypto_test_rng.c |  6 ++
 4 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index 904e7b6..ab05829 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -96,9 +96,11 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 
/* Generate an IV */
if (params.iv.length) {
-   size_t size = params.iv.length;
+   ssize_t size = params.iv.length;
 
-   odp_hw_random_get(params.iv.data, size, 1);
+   ssize_t ret = odp_hw_random_get(params.iv.data, size, 1);
+   if (ret != size)
+   return -1;
}
 
/* Synchronous session create for now */
diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index 545c1a5..1e15775 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -18,6 +18,8 @@
 extern C {
 #endif
 
+#include sys/types.h
+
 /** @defgroup odp_crypto ODP CRYPTO
  *  Macros, enums, types and operations to utilise crypto.
  *  @{
@@ -330,18 +332,19 @@ odp_crypto_compl_result(odp_crypto_compl_t 
completion_event,
odp_crypto_op_result_t *result);
 
 /**
- * Generate random byte string
+ * Generate random byte data
  *
- * @param buf  Pointer to store result
- * @param len  Pointer to input length value as well as return value
- * @param use_entropy  Use entropy
+ * @param[out]buf   Output buffer
+ * @param size  Size of output buffer
+ * @param use_entropy   Use entropy
  *
  * @todo Define the implication of the use_entropy parameter
  *
- * @return 0 if succesful
+ * @return Number of bytes written
+ * @retval 0 on failure
  */
-int
-odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
+ssize_t
+odp_hw_random_get(uint8_t *buf, ssize_t size, odp_bool_t use_entropy);
 
 /**
  * @}
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 46766fa..94ebaeb 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -446,12 +446,12 @@ odp_crypto_init_global(void)
return 0;
 }
 
-int
-odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED)
+ssize_t
+odp_hw_random_get(uint8_t *buf, ssize_t len, odp_bool_t use_entropy ODP_UNUSED)
 {
int rc;
-   rc = RAND_bytes(buf, *len);
-   return ((1 == rc) ? 0 : -1);
+   rc = RAND_bytes(buf, len);
+   return (1 == rc) ? len /*success*/: -1 /*failure*/;
 }
 
 odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev)
diff --git a/test/validation/crypto/odp_crypto_test_rng.c 
b/test/validation/crypto/odp_crypto_test_rng.c
index 458f908..a9de5b9 100644
--- a/test/validation/crypto/odp_crypto_test_rng.c
+++ b/test/validation/crypto/odp_crypto_test_rng.c
@@ -16,12 +16,10 @@
 static void rng_get_size(void)
 {
int ret;
-   size_t len = TDES_CBC_IV_LEN;
uint8_t buf[TDES_CBC_IV_LEN];
 
-   ret = odp_hw_random_get(buf, len, false);
-   CU_ASSERT(!ret);
-   CU_ASSERT(len == TDES_CBC_IV_LEN);
+   ret = odp_hw_random_get(buf, sizeof(buf), false);
+   CU_ASSERT(ret == TDES_CBC_IV_LEN);
 }
 
 CU_TestInfo test_rng[] = {
-- 
1.9.1


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


Re: [lng-odp] [PATCH] api: odp_timer.h: move definitions to plat/timer_types.h

2015-02-03 Thread Bill Fischofer
We should consider making these strong types to be consistent with the rest
of the ODP types.  In linux-generic to do that you'd just change the
current uint32_t typedefs to:

typedef odp_handle_t odp_timer_t;
typedef odp_handle_t odp_timeout_t;

If there is a need to display odp_timer_t and odp_timeout_t handles then
the odp_timer_to_u64() and odp_timeout_to_u64() conversion functions should
be added.  I would recommend deferring those APIs until ODP v1.1 as it's
not used and the need is not urgent.  Making these strong will probably
require a bit of tweaking in the implementation to make use of
_odp_typeval() as needed.  See the other types as models.

Note that odp_timer_pool_t is already strongly typed with the above
definition and needs no change, but it too should have an
odp_timer_pool_to_u64() converter function for completeness.

Bill

On Mon, Feb 2, 2015 at 12:52 PM, Ola Liljedahl ola.liljed...@linaro.org
wrote:

 Move the platform specific definitions for timer pool, timer and timeout to
 the platform's include/odp/plat/timer_types.h file.

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

  include/odp/api/timer.h| 32 +++
  .../linux-generic/include/odp/plat/timer_types.h   | 48
 ++
  platform/linux-generic/include/odp/timer.h |  1 +
  3 files changed, 64 insertions(+), 17 deletions(-)
  create mode 100644 platform/linux-generic/include/odp/plat/timer_types.h

 diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
 index 1b813da..b5435c3 100644
 --- a/include/odp/api/timer.h
 +++ b/include/odp/api/timer.h
 @@ -22,17 +22,15 @@ extern C {
   *  @{
   */

 -struct odp_timer_pool_s; /** Forward declaration */
 -
  /**
 -* ODP timer pool handle (platform dependent)
 -*/
 -typedef struct odp_timer_pool_s *odp_timer_pool_t;
 + * @typedef odp_timer_pool_t
 + * ODP timer pool handle
 + */

  /**
 - * Invalid timer pool handle (platform dependent).
 + * @def ODP_TIMER_POOL_INVALID
 + * Invalid timer pool handle
   */
 -#define ODP_TIMER_POOL_INVALID NULL

  /**
   * Clock sources for timers in timer pool.
 @@ -46,24 +44,24 @@ typedef enum {
  } odp_timer_clk_src_t;

  /**
 -* ODP timer handle (platform dependent).
 -*/
 -typedef uint32_t odp_timer_t;
 + * @typedef odp_timer_t
 + * ODP timer handle
 + */

  /**
 -* ODP timeout handle (platform dependent).
 -*/
 -typedef void *odp_timeout_t;
 + * @def ODP_TIMER_INVALID
 + * Invalid timer handle
 + */

  /**
 - * Invalid timer handle (platform dependent).
 + * @typedef odp_timeout_t
 + * ODP timeout handle
   */
 -#define ODP_TIMER_INVALID ((uint32_t)~0U)

  /**
 - * Invalid timeout handle (platform dependent).
 + * @def ODP_TIMEOUT_INVALID
 + * Invalid timeout handle
   */
 -#define ODP_TIMEOUT_INVALID NULL

  /**
   * Return values of timer set calls.
 diff --git a/platform/linux-generic/include/odp/plat/timer_types.h
 b/platform/linux-generic/include/odp/plat/timer_types.h
 new file mode 100644
 index 000..c21a667
 --- /dev/null
 +++ b/platform/linux-generic/include/odp/plat/timer_types.h
 @@ -0,0 +1,48 @@
 +/* Copyright (c) 2013, Linaro Limited
 + * All rights reserved.
 + *
 + * SPDX-License-Identifier: BSD-3-Clause
 + */
 +
 +
 +/**
 + * @file
 + *
 + * ODP timer service
 + */
 +
 +#ifndef ODP_TIMER_TYPES_H_
 +#define ODP_TIMER_TYPES_H_
 +
 +#ifdef __cplusplus
 +extern C {
 +#endif
 +
 +/** @addtogroup odp_packet ODP TIMER
 + *  Operations on a timer.
 + *  @{
 + **/
 +
 +struct odp_timer_pool_s; /** Forward declaration */
 +
 +typedef struct odp_timer_pool_s *odp_timer_pool_t;
 +
 +#define ODP_TIMER_POOL_INVALID NULL
 +
 +typedef uint32_t odp_timer_t;
 +
 +#define ODP_TIMER_INVALID ((uint32_t)~0U)
 +
 +typedef void *odp_timeout_t;
 +
 +#define ODP_TIMEOUT_INVALID NULL
 +
 +/**
 + * @}
 + */
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
 +#endif
 diff --git a/platform/linux-generic/include/odp/timer.h
 b/platform/linux-generic/include/odp/timer.h
 index df071f2..eb9a3a2 100644
 --- a/platform/linux-generic/include/odp/timer.h
 +++ b/platform/linux-generic/include/odp/timer.h
 @@ -22,6 +22,7 @@ extern C {
  #include odp/plat/buffer_types.h
  #include odp/plat/pool_types.h
  #include odp/plat/queue_types.h
 +#include odp/plat/timer_types.h

  /** @ingroup odp_timer
   *  @{
 --
 1.9.1


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

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


[lng-odp] [PATCHv4 5/6] validation: odp_timer.c: remove usage of perror/abort

2015-02-03 Thread Ola Liljedahl
Replace usage of perror and abort with CU_FAIL_FATAL in order for fatal
errors not to disturb the overall validation flow.

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

 test/validation/odp_timer.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 5c997ee..5218406 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -11,7 +11,6 @@
 /* For rand_r and nanosleep */
 #define _POSIX_C_SOURCE 200112L
 #include time.h
-#include unistd.h
 #include odp.h
 #include odp_cunit_common.h
 #include test_debug.h
@@ -124,7 +123,7 @@ static void *worker_entrypoint(void *arg)
 
struct test_timer *tt = malloc(sizeof(struct test_timer) * NTIMERS);
if (tt == NULL)
-   perror(malloc), abort();
+   CU_FAIL_FATAL(malloc failed);
 
/* Prepare all timers */
for (i = 0; i  NTIMERS; i++) {
@@ -215,7 +214,7 @@ static void *worker_entrypoint(void *arg)
ts.tv_sec = 0;
ts.tv_nsec = 100; /* 1ms */
if (nanosleep(ts, NULL)  0)
-   perror(nanosleep), abort();
+   CU_FAIL_FATAL(nanosleep failed);
}
 
/* Cancel and free all timers */
@@ -246,7 +245,7 @@ static void *worker_entrypoint(void *arg)
ts.tv_sec = 0;
ts.tv_nsec = 100; /* 1ms */
if (nanosleep(ts, NULL)  0)
-   perror(nanosleep), abort();
+   CU_FAIL_FATAL(nanosleep failed);
while (nstale != 0) {
odp_event_t ev = odp_queue_deq(queue);
if (ev != ODP_EVENT_INVALID) {
-- 
1.9.1


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


[lng-odp] [PATCHv4 2/6] validation: odp_timer.c: avoid dereferencing ptr after NULL check

2015-02-03 Thread Ola Liljedahl
Don't dereference pointer after successful check for NULL as this makes Coverity
complain. (Coverity CID 85397, https://bugs.linaro.org/show_bug.cgi?id=1056)

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

 test/validation/odp_timer.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 0238cf4..6aace14 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -69,23 +69,23 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t 
prev_tick)
if (ttp == NULL)
CU_FAIL(odp_timeout_user_ptr() null user ptr);
 
-   if (ttp-ev2 != ev)
+   if (ttp != NULL  ttp-ev2 != ev)
CU_FAIL(odp_timeout_user_ptr() wrong user ptr);
-   if (ttp-tim != tim)
+   if (ttp != NULL  ttp-tim != tim)
CU_FAIL(odp_timeout_timer() wrong timer);
if (stale) {
if (odp_timeout_fresh(tmo))
CU_FAIL(Wrong status (fresh) for stale timeout);
/* Stale timeout = local timer must have invalid tick */
-   if (ttp-tick != TICK_INVALID)
+   if (ttp != NULL  ttp-tick != TICK_INVALID)
CU_FAIL(Stale timeout for active timer);
} else {
if (!odp_timeout_fresh(tmo))
CU_FAIL(Wrong status (stale) for fresh timeout);
/* Fresh timeout = local timer must have matching tick */
-   if (ttp-tick != tick) {
+   if (ttp != NULL  ttp-tick != tick) {
printf(Wrong tick: expected %PRIu64 actual 
%PRIu64\n,
-  ttp-tick, tick);
+   ttp-tick, tick);
CU_FAIL(odp_timeout_tick() wrong tick);
}
/* Check that timeout was delivered 'timely' */
@@ -99,9 +99,11 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t 
prev_tick)
}
}
 
-   /* Use assert() for correctness check of test program itself */
-   assert(ttp-ev == ODP_EVENT_INVALID);
-   ttp-ev = ev;
+   if (ttp != NULL) {
+   /* Internal error */
+   CU_ASSERT_FATAL(ttp-ev == ODP_EVENT_INVALID);
+   ttp-ev = ev;
+   }
 }
 
 /* @private Worker thread entrypoint which performs timer alloc/set/cancel/free
-- 
1.9.1


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


[lng-odp] [PATCHv4 0/6] validation: odp_timer.c updates

2015-02-03 Thread Ola Liljedahl
Changes since version 3:
Split patch #4 into new patch #6.

Patch #1:
Don't report late timeouts using CU_FAIL as this interferes with the cunit
test framework. Just count and report the number of late timeouts.

Patch #2:
Don't dereference pointer after successful check for NULL as this makes Coverity
complain. (Coverity CID 85397, https://bugs.linaro.org/show_bug.cgi?id=1056)

Patch #3:
Use nanosleep instead of the deprecated usleep. Define POSIX version to be able
to use rand_r. (https://bugs.linaro.org/show_bug.cgi?id=1048)

Patch #4:
Use CU_ASSERT_FATAL instead of plain assert so to work better with the cunit
test framework.
Use LOG_DBG instead of printf. Remove some unnecessary printouts.

Patch #5:
Replace usage of perror and abort with CU_FAIL_FATAL in order for fatal
errors not to disturb the overall validation flow.

Patch #6:
Ensure we run at least one worker thread.

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

Ola Liljedahl (6):
  validation: odp_timer.c: avoid cunit warnings for late timeouts
  validation: odp_timer.c: avoid dereferencing ptr after NULL check
  validation: odp_timer.c: use nanosleep instead of usleep
  validation: odp_timer.c: cunit cleanup
  validation: odp_timer.c: remove usage of perror/abort
  validation: odp_timer.c: run at least one thread

 test/validation/odp_timer.c | 105 +---
 1 file changed, 60 insertions(+), 45 deletions(-)

-- 
1.9.1


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


Re: [lng-odp] [PATCHv4 01/18] api: odp_cpumask.h: odp_cpumask_to_str() return chars written or error

2015-02-03 Thread Ola Liljedahl
On 3 February 2015 at 16:40, Savolainen, Petri (NSN - FI/Espoo)
petri.savolai...@nsn.com wrote:


 -Original Message-
 From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
 boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl
 Sent: Tuesday, February 03, 2015 4:53 PM
 To: lng-odp@lists.linaro.org
 Subject: [lng-odp] [PATCHv4 01/18] api: odp_cpumask.h:
 odp_cpumask_to_str() return chars written or error

 Add define ODP_CPUMASK_BUFSIZE for minimum output buffer size for
 odp_cpumask_to_str().
 odp_cpumask_to_str() takes output buffer size as input and returns number
 of chars written (on success), 0 on failure.
 Updated the implementation.
 Updated all usages in example and test programs.

 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/generator/odp_generator.c  |  4 ++--
  example/ipsec/odp_ipsec.c  |  4 ++--
  example/l2fwd/odp_l2fwd.c  |  4 ++--
  example/packet/odp_pktio.c |  4 ++--
  example/timer/odp_timer_test.c |  4 ++--
  include/odp/api/cpumask.h  | 23 ++---
 --
  .../linux-generic/include/odp/plat/cpumask_types.h |  5 +
  platform/linux-generic/odp_cpumask.c   | 26 +
 -
  test/api_test/odp_common.c |  4 ++--
  test/performance/odp_scheduling.c  |  4 ++--
  10 files changed, 51 insertions(+), 31 deletions(-)

 diff --git a/example/generator/odp_generator.c
 b/example/generator/odp_generator.c
 index 03dab50..2433cb6 100644
 --- a/example/generator/odp_generator.c
 +++ b/example/generator/odp_generator.c
 @@ -545,7 +545,7 @@ int main(int argc, char *argv[])
   int i;
   odp_shm_t shm;
   odp_cpumask_t cpumask;
 - char cpumaskstr[64];
 + char cpumaskstr[ODP_CPUMASK_BUFSIZE];
   odp_pool_param_t params;

   /* Init ODP before calling anything else */
 @@ -596,7 +596,7 @@ int main(int argc, char *argv[])
* Start mapping thread from CPU #1
*/
   num_workers = odph_linux_cpumask_default(cpumask, num_workers);
 - odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 + (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));

   printf(num worker threads: %i\n, num_workers);
   printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
 diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
 index 03f2419..869fd3a 100644
 --- a/example/ipsec/odp_ipsec.c
 +++ b/example/ipsec/odp_ipsec.c
 @@ -1193,7 +1193,7 @@ main(int argc, char *argv[])
   int stream_count;
   odp_shm_t shm;
   odp_cpumask_t cpumask;
 - char cpumaskstr[64];
 + char cpumaskstr[ODP_CPUMASK_BUFSIZE];
   odp_pool_param_t params;

   /* Init ODP before calling anything else */
 @@ -1242,7 +1242,7 @@ main(int argc, char *argv[])
* Start mapping thread from CPU #1
*/
   num_workers = odph_linux_cpumask_default(cpumask, num_workers);
 - odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 + (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));

   printf(num worker threads: %i\n, num_workers);
   printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
 diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
 index 7a520fb..e22ec0c 100644
 --- a/example/l2fwd/odp_l2fwd.c
 +++ b/example/l2fwd/odp_l2fwd.c
 @@ -294,7 +294,7 @@ int main(int argc, char *argv[])
   int num_workers;
   odp_shm_t shm;
   odp_cpumask_t cpumask;
 - char cpumaskstr[64];
 + char cpumaskstr[ODP_CPUMASK_BUFSIZE];
   odp_pool_param_t params;

   /* Init ODP before calling anything else */
 @@ -336,7 +336,7 @@ int main(int argc, char *argv[])
* Start mapping thread from CPU #1
*/
   num_workers = odph_linux_cpumask_default(cpumask, num_workers);
 - odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 + (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));

   printf(num worker threads: %i\n, num_workers);
   printf(first CPU:  %i\n, odp_cpumask_first(cpumask));
 diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
 index 28ed98c..e38029a 100644
 --- a/example/packet/odp_pktio.c
 +++ b/example/packet/odp_pktio.c
 @@ -287,7 +287,7 @@ int main(int argc, char *argv[])
   int i;
   int cpu;
   odp_cpumask_t cpumask;
 - char cpumaskstr[64];
 + char cpumaskstr[ODP_CPUMASK_BUFSIZE];
   odp_pool_param_t params;

   args = calloc(1, sizeof(args_t));
 @@ -324,7 +324,7 @@ int main(int argc, char *argv[])
* Start mapping thread from CPU #1
*/
   num_workers = odph_linux_cpumask_default(cpumask, num_workers);
 - odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr));
 + 

Re: [lng-odp] [PATCH] api: packet_flags: Removed odp_packet_override_l4_chksum

2015-02-03 Thread Bill Fischofer
On Tue, Feb 3, 2015 at 7:13 AM, Petri Savolainen 
petri.savolai...@linaro.org wrote:

 This is currently the only output side packet flag. It's removed
 now and re-defined later with all other output side control flags.

 Signed-off-by: Petri Savolainen petri.savolai...@linaro.org


Reviewed-by: Bill Fischofer bill.fischo...@linaro.org


 ---
  include/odp/api/packet_flags.h| 7 ---
  platform/linux-generic/odp_packet_flags.c | 7 ---
  test/validation/buffer/odp_packet_test.c  | 7 ---
  3 files changed, 21 deletions(-)

 diff --git a/include/odp/api/packet_flags.h
 b/include/odp/api/packet_flags.h
 index df1486b..f864bba 100644
 --- a/include/odp/api/packet_flags.h
 +++ b/include/odp/api/packet_flags.h
 @@ -174,13 +174,6 @@ int odp_packet_has_sctp(odp_packet_t pkt);
  int odp_packet_has_icmp(odp_packet_t pkt);

  /**
 - * Request L4 checksum calculation
 - *
 - * @param pkt Packet handle
 - */
 -void odp_packet_override_l4_chksum(odp_packet_t pkt);
 -
 -/**
   * Set flag for L2 header, e.g. ethernet
   *
   * @param pkt Packet handle
 diff --git a/platform/linux-generic/odp_packet_flags.c
 b/platform/linux-generic/odp_packet_flags.c
 index f2ef61d..ab3d12f 100644
 --- a/platform/linux-generic/odp_packet_flags.c
 +++ b/platform/linux-generic/odp_packet_flags.c
 @@ -100,13 +100,6 @@ int odp_packet_has_icmp(odp_packet_t pkt)
 return odp_packet_hdr(pkt)-input_flags.icmp;
  }

 -/* Set Output Flags */
 -
 -void odp_packet_override_l4_chksum(odp_packet_t pkt)
 -{
 -   odp_packet_hdr(pkt)-output_flags.l4_chksum = 1;
 -}
 -
  /* Set Input Flags */

  void odp_packet_has_l2_set(odp_packet_t pkt, int val)
 diff --git a/test/validation/buffer/odp_packet_test.c
 b/test/validation/buffer/odp_packet_test.c
 index 0a5d32e..b8995f7 100644
 --- a/test/validation/buffer/odp_packet_test.c
 +++ b/test/validation/buffer/odp_packet_test.c
 @@ -443,12 +443,6 @@ static void packet_error_flags(void)
 CU_ASSERT(err == 0 || err == 1);
  }

 -static void packet_out_flags(void)
 -{
 -   odp_packet_override_l4_chksum(test_packet);
 -   CU_PASS(Current API doesn't return any error code\n);
 -}
 -
  struct packet_metadata {
 uint32_t l2_off;
 uint32_t l3_off;
 @@ -659,7 +653,6 @@ CU_TestInfo packet_tests[] = {
 _CU_TEST_INFO(packet_segments),
 _CU_TEST_INFO(packet_segment_last),
 _CU_TEST_INFO(packet_in_flags),
 -   _CU_TEST_INFO(packet_out_flags),
 _CU_TEST_INFO(packet_error_flags),
 _CU_TEST_INFO(packet_add_rem_data),
 _CU_TEST_INFO(packet_copy),
 --
 2.2.2


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

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


[lng-odp] [PATCHv4 4/6] validation: odp_timer.c: cunit cleanup

2015-02-03 Thread Ola Liljedahl
Use CU_ASSERT_FATAL instead of plain assert so to work better with the cunit
test framework.
Use LOG_DBG instead of printf. Remove some unnecessary printouts.

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

 test/validation/odp_timer.c | 42 --
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index d24de2c..5c997ee 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -10,7 +10,6 @@
 
 /* For rand_r and nanosleep */
 #define _POSIX_C_SOURCE 200112L
-#include assert.h
 #include time.h
 #include unistd.h
 #include odp.h
@@ -54,8 +53,7 @@ struct test_timer {
 /* @private Handle a received (timeout) event */
 static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick)
 {
-   /* Use assert() for internal correctness checks of test program */
-   assert(ev != ODP_EVENT_INVALID);
+   CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); /* Internal error */
if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) {
/* Not a timeout event */
CU_FAIL(Unexpected event type received);
@@ -87,7 +85,7 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t 
prev_tick)
CU_FAIL(Wrong status (stale) for fresh timeout);
/* Fresh timeout = local timer must have matching tick */
if (ttp != NULL  ttp-tick != tick) {
-   printf(Wrong tick: expected %PRIu64 actual 
%PRIu64\n,
+   LOG_DBG(Wrong tick: expected %PRIu64 actual 
%PRIu64\n,
ttp-tick, tick);
CU_FAIL(odp_timeout_tick() wrong tick);
}
@@ -233,14 +231,14 @@ static void *worker_entrypoint(void *arg)
CU_FAIL(odp_timer_free);
}
 
-   printf(Thread %u: %u timers set\n, thr, nset);
-   printf(Thread %u: %u timers reset\n, thr, nreset);
-   printf(Thread %u: %u timers cancelled\n, thr, ncancel);
-   printf(Thread %u: %u timers reset/cancelled too late\n,
-  thr, ntoolate);
-   printf(Thread %u: %u timeouts received\n, thr, nrcv);
-   printf(Thread %u: %u stale timeout(s) after odp_timer_free()\n,
-  thr, nstale);
+   LOG_DBG(Thread %u: %u timers set\n, thr, nset);
+   LOG_DBG(Thread %u: %u timers reset\n, thr, nreset);
+   LOG_DBG(Thread %u: %u timers cancelled\n, thr, ncancel);
+   LOG_DBG(Thread %u: %u timers reset/cancelled too late\n,
+   thr, ntoolate);
+   LOG_DBG(Thread %u: %u timeouts received\n, thr, nrcv);
+   LOG_DBG(Thread %u: %u stale timeout(s) after odp_timer_free()\n,
+   thr, nstale);
 
/* Delay some more to ensure timeouts for expired timers can be
 * received */
@@ -264,7 +262,7 @@ static void *worker_entrypoint(void *arg)
if (ev != ODP_EVENT_INVALID)
CU_FAIL(Unexpected event received);
 
-   printf(Thread %u: exiting\n, thr);
+   LOG_DBG(Thread %u: exiting\n, thr);
return NULL;
 }
 
@@ -309,19 +307,11 @@ static void test_odp_timer_all(void)
CU_ASSERT(tpinfo.param.res_ns == RES);
CU_ASSERT(tpinfo.param.min_tmo == MIN);
CU_ASSERT(tpinfo.param.max_tmo == MAX);
-   printf(Timer pool\n);
-   printf(--\n);
-   printf(  name: %s\n, tpinfo.name);
-   printf(  resolution: %PRIu64 ns (%PRIu64 us)\n,
-  tpinfo.param.res_ns, tpinfo.param.res_ns / 1000);
-   printf(  min tmo: %PRIu64 ns\n, tpinfo.param.min_tmo);
-   printf(  max tmo: %PRIu64 ns\n, tpinfo.param.max_tmo);
-   printf(\n);
-
-   printf(#timers..: %u\n, NTIMERS);
-   printf(Tmo range: %u ms (%PRIu64 ticks)\n, RANGE_MS,
-  odp_timer_ns_to_tick(tp, 100ULL * RANGE_MS));
-   printf(\n);
+   CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);
+
+   LOG_DBG(#timers..: %u\n, NTIMERS);
+   LOG_DBG(Tmo range: %u ms (%PRIu64 ticks)\n, RANGE_MS,
+   odp_timer_ns_to_tick(tp, 100ULL * RANGE_MS));
 
uint64_t tick;
for (tick = 0; tick  1ULL; tick += 100ULL) {
-- 
1.9.1


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


Re: [lng-odp] [PATCHv4 00/18] Cleanup return semantics and descriptions

2015-02-03 Thread Bill Fischofer
For this series:

Reviewed-by: Bill Fischofer bill.fischo...@linaro.org

On Tue, Feb 3, 2015 at 8:53 AM, Ola Liljedahl ola.liljed...@linaro.org
wrote:

 Changes since version 3:
 Removed unnecessary braces from odp_cpumask.c in patch #1.

 Changes since version 2:
 Rebased, e.g. due to API restructuring.
 Split two patches, separating documentation updates from API changes.
 Reordered patches, all serious API changes are now contained in patches
 1-4.

 Patches #1-#3:
 odp_cpumask_to_str(), odp_pktio_mac_addr() and odp_hw_random_get() takes
 output buffer size as input and returns number of chars/bytes written (on
 success), a negative value on failure.
 Added defines (ODP_CPUMASK_BUFSIZE, ODP_PKTIO_MACADDRSIZE) for recommended
 output buffer sizes.
 Updated the implementations of these calls.
 Updated all usages of these calls in example and test programs.

 Patch #4:
 Changed the definition of odp_queue_enq_multi() to support partial success
 (e.g. enqueued some but not all of the events specified). Returns the
 number
 of events enqueued (equivalent to odp_queue_deq_multi()). This change is
 necessary to support ODP implementations that use fixed size queues (e.g.
 ODP linux-dpdk).
 Updated the implementation in odp_queue.c to conform to the new semantics.
 Updated the necessary test/validation/performance programs.

 Patches #5-#18:
 Updated doxygen descriptions, particularly the @return/@retval
 descriptions.
 Specifically documented those API calls which are guaranteed to handle
 invalid/stale handles.
 No change of implementation necessary.

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

 Ola Liljedahl (18):
   api: odp_cpumask.h: odp_cpumask_to_str() return chars written or error
   api: odp_pktio.h: odp_pktio_mac_addr() return chars written or error
   api: odp_crypto.h: odp_hw_random_get(): return number of bytes written
   api: odp_queue.h: odp_queue_enq_multi() returns partial success
   api: odp_buffer.h: undefined behavior description
   api: odp_byteorder.h: updated comment
   api: odp_classification.h: updated return descriptions
   api: odp_init.h: updated return descriptions
   api: odp_packet.h: updated return descriptions
   api: odp_packet_flags.h: updated return descriptions
   api: odp_packet_io.h: updated return descriptions
   api: odp_queue.h: updated return descriptions
   api: odp_schedule.h: updated return descriptions
   api: odp_shared_memory.h: updated return descriptions
   api: odp_thread.h: updated return descriptions
   api: odp_timer.h: updated return descriptions
   api: odp_cpumask.h: updated descriptions, added const
   api: odp_crypto.h: updated return descriptions

  example/generator/odp_generator.c  |   4 +-
  example/ipsec/odp_ipsec.c  |   4 +-
  example/ipsec/odp_ipsec_cache.c|   6 +-
  example/l2fwd/odp_l2fwd.c  |   4 +-
  example/packet/odp_pktio.c |   4 +-
  example/timer/odp_timer_test.c |   4 +-
  include/odp/api/buffer.h   |   4 +-
  include/odp/api/byteorder.h|   2 +-
  include/odp/api/classification.h   |  48 
  include/odp/api/cpumask.h  | 123
 +
  include/odp/api/crypto.h   |  23 ++--
  include/odp/api/init.h |  20 ++--
  include/odp/api/packet.h   |  68 ++--
  include/odp/api/packet_flags.h |  51 ++---
  include/odp/api/packet_io.h| 109
 ++
  include/odp/api/queue.h|  38 ---
  include/odp/api/schedule.h |   3 +-
  include/odp/api/shared_memory.h|  17 +--
  include/odp/api/thread.h   |   6 +-
  include/odp/api/timer.h|  52 +++--
  .../linux-generic/include/odp/plat/cpumask_types.h |   5 +
  .../include/odp/plat/packet_io_types.h |   2 +
  platform/linux-generic/odp_cpumask.c   |  38 ---
  platform/linux-generic/odp_crypto.c|   8 +-
  platform/linux-generic/odp_packet_io.c |  15 +--
  platform/linux-generic/odp_queue.c |   4 +-
  test/api_test/odp_common.c |   4 +-
  test/performance/odp_scheduling.c  |  14 ++-
  test/validation/crypto/odp_crypto_test_rng.c   |   6 +-
  test/validation/odp_pktio.c|  24 ++--
  test/validation/odp_queue.c|   3 +-
  31 files changed, 408 insertions(+), 305 deletions(-)

 --
 1.9.1


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

___
lng-odp mailing 

[lng-odp] [PATCHv5 14/18] api: odp_shared_memory.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.
Documented API calls which are guaranteed to handle invalid/stale handles.

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

 include/odp/api/shared_memory.h | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/odp/api/shared_memory.h b/include/odp/api/shared_memory.h
index 5b27b6b..18764ce 100644
--- a/include/odp/api/shared_memory.h
+++ b/include/odp/api/shared_memory.h
@@ -71,7 +71,8 @@ typedef struct odp_shm_info_t {
  * @param[in] flags  Shared memory parameter flags (ODP_SHM_*).
  *   Default value is 0.
  *
- * @return Pointer to the reserved block, or NULL
+ * @return Handle of the reserved block
+ * @retval NULL on failure
  */
 odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
  uint32_t flags);
@@ -84,9 +85,8 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t size, 
uint64_t align,
  *
  * @param[in] shm Block handle
  *
- * @retval 0 if the handle is already free
- * @retval 0 if the handle free succeeds
- * @retval -1 on failure to free the handle
+ * @retval 0 on success
+ * @retval 0 on failure to free the handle
  */
 int odp_shm_free(odp_shm_t shm);
 
@@ -96,7 +96,7 @@ int odp_shm_free(odp_shm_t shm);
  * @param[in] name   Name of the block
  *
  * @return A handle to the block if it is found by name
- * @retval #ODP_SHM_INVALID if the block is not found
+ * @retval ODP_SHM_INVALID on failure
  */
 odp_shm_t odp_shm_lookup(const char *name);
 
@@ -106,18 +106,21 @@ odp_shm_t odp_shm_lookup(const char *name);
  *
  * @param[in] shm   Block handle
  *
- * @return Memory block address, or NULL on error
+ * @return Memory block address
  */
 void *odp_shm_addr(odp_shm_t shm);
 
 
 /**
  * Shared memory block info
+ * @note This is the only shared memory API function which accepts invalid
+ * shm handles (any bit value) without causing undefined behavior.
  *
  * @param[in]  shm   Block handle
  * @param[out] info  Block info pointer for output
  *
- * @return 0 on success, otherwise non-zero
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_shm_info(odp_shm_t shm, odp_shm_info_t *info);
 
-- 
1.9.1


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


[lng-odp] [PATCHv5 13/18] api: odp_schedule.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/schedule.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
index 71264a7..3019b84 100644
--- a/include/odp/api/schedule.h
+++ b/include/odp/api/schedule.h
@@ -65,7 +65,8 @@ uint64_t odp_schedule_wait_time(uint64_t ns);
  *Use odp_schedule_wait_time() to convert time to other wait
  *values.
  *
- * @return Next highest priority event, or ODP_EVENT_INVALID
+ * @return Next highest priority event
+ * @retval ODP_EVENT_INVALID on timeout and no events available
  */
 odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait);
 
-- 
1.9.1


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


[lng-odp] [PATCHv5 07/18] api: odp_classification.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/classification.h | 48 
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index 5c6636f..35e21cb 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -81,8 +81,8 @@ typedef enum odp_cos_hdr_flow_fields {
  *
  * @param[in]  nameString intended for debugging purposes.
  *
- * @return Class of service instance identifier,
- * or ODP_COS_INVALID on error.
+ * @return Class of service instance identifier
+ * @retval ODP_COS_INVALID on failure.
  */
 odp_cos_t odp_cos_create(const char *name);
 
@@ -91,7 +91,8 @@ odp_cos_t odp_cos_create(const char *name);
  *
  * @param[in]  cos_id  class-of-service instance.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_cos_destroy(odp_cos_t cos_id);
 
@@ -104,7 +105,8 @@ int odp_cos_destroy(odp_cos_t cos_id);
  * of this specific class of service
  * will be enqueued.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id);
 
@@ -114,7 +116,8 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t 
queue_id);
  * @param[in]  cos_id  class-of-service instance.
  * @param[in]  drop_policy Desired packet drop policy for this class.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  *
  * @note Optional.
  */
@@ -129,7 +132,8 @@ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e 
drop_policy);
  * @param[in]  qos_table   Values of the Layer-2 QoS header field.
  * @param[in]  cos_table   Class-of-service assigned to each of the
  * allowed Layer-2 QOS levels.
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
 uint8_t num_qos,
@@ -148,7 +152,8 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
  * @param[in]  l3_preference   when true, Layer-3 QoS overrides
  * L2 QoS when present.
  *
- * @return 0 on success, non-zero on error.
+ * @retval 0 on success
+ * @retval 0 on failure
  *
  * @note Optional.
  */
@@ -221,7 +226,8 @@ typedef enum odp_pmr_term {
  * that must match the value size requirement of the
  * specific term.
  *
- * @return Handle of the matching rule or ODP_PMR_INVAL on error
+ * @return Handle of the matching rule
+ * @retval ODP_PMR_INVAL on failure
  */
 odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
   const void *val,
@@ -238,7 +244,8 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
  * that must match the value size requirement of the
  * specific term.
  *
- * @return Handle of the matching rule or ODP_PMR_INVAL on error
+ * @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,
@@ -250,7 +257,8 @@ odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
  *
  * @param[in]  pmr_id  Identifier of the PMR to be destroyed
  *
- * @return 0 on success, non-zero or error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_pmr_destroy(odp_pmr_t pmr_id);
 
@@ -261,7 +269,8 @@ int odp_pmr_destroy(odp_pmr_t pmr_id);
  * @param[in]  src_pktio   pktio to which this PMR is to be applied
  * @param[in]  dst_cos CoS to be assigned by this PMR
  *
- * @return 0 on success, non-zero or error.
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
  odp_pktio_t src_pktio, odp_cos_t dst_cos);
@@ -274,7 +283,8 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
  * @param[in]  dst_cos CoS to be assigned to packets filtered
  * from src_cos that match pmr_id.
  *
- * @return 0 on success, non-zero on error.
+ * 

[lng-odp] [PATCHv5 18/18] api: odp_crypto.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/crypto.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index 1e15775..24b5512 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -265,7 +265,8 @@ typedef struct odp_crypto_op_result {
  * @param session   Created session else ODP_CRYPTO_SESSION_INVALID
  * @param statusFailure code if unsuccessful
  *
- * @return 0 if successful else -1
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int
 odp_crypto_session_create(odp_crypto_session_params_t *params,
@@ -314,7 +315,8 @@ odp_crypto_compl_free(odp_crypto_compl_t completion_event);
  * @param postedPointer to return posted, TRUE for async operation
  * @param resultResults of operation (when posted returns FALSE)
  *
- * @return 0 if successful else -1
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int
 odp_crypto_operation(odp_crypto_op_params_t *params,
-- 
1.9.1


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


[lng-odp] [PATCHv5 06/18] api: odp_byteorder.h: updated comment

2015-02-03 Thread Ola Liljedahl
Rephrased a comment for better language.

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

 include/odp/api/byteorder.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/odp/api/byteorder.h b/include/odp/api/byteorder.h
index 45b1b77..3a36afc 100644
--- a/include/odp/api/byteorder.h
+++ b/include/odp/api/byteorder.h
@@ -19,7 +19,7 @@ extern C {
 #endif
 
 /** @defgroup odp_compiler_optim ODP COMPILER / OPTIMIZATION
- *  Macros that check byte order and byte converting operations.
+ *  Macros that check byte order and operations for byte order conversion.
  *  @{
  */
 
-- 
1.9.1


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


[lng-odp] [PATCHv5 16/18] api: odp_timer.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
Documented API calls which are guaranteed to handle invalid/stale handles.
Removed unnecessary warnings of undefined behavior.
No change of implementation necessary.

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

 include/odp/api/timer.h | 52 -
 1 file changed, 17 insertions(+), 35 deletions(-)

diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h
index 64ccc4b..1b813da 100644
--- a/include/odp/api/timer.h
+++ b/include/odp/api/timer.h
@@ -112,8 +112,8 @@ typedef struct {
  * @param name   Name of the timer pool. The string will be copied.
  * @param params Timer pool parameters. The content will be copied.
  *
- * @return Timer pool handle if successful, otherwise ODP_TIMER_POOL_INVALID
- * and errno set
+ * @return Timer pool handle on success
+ * @retval ODP_TIMER_POOL_INVALID on failure and errno set
  */
 odp_timer_pool_t
 odp_timer_pool_create(const char *name,
@@ -135,14 +135,14 @@ void odp_timer_pool_start(void);
  * Destroy a timer pool, freeing all resources.
  * All timers must have been freed.
  *
- * @param tpid  Timer pool identifier
+ * @param tpid  Timer pool handle
  */
 void odp_timer_pool_destroy(odp_timer_pool_t tpid);
 
 /**
  * Convert timer ticks to nanoseconds
  *
- * @param tpid  Timer pool identifier
+ * @param tpid  Timer pool handle
  * @param ticks Timer ticks
  *
  * @return Nanoseconds
@@ -152,7 +152,7 @@ uint64_t odp_timer_tick_to_ns(odp_timer_pool_t tpid, 
uint64_t ticks);
 /**
  * Convert nanoseconds to timer ticks
  *
- * @param tpid  Timer pool identifier
+ * @param tpid  Timer pool handle
  * @param nsNanoseconds
  *
  * @return Timer ticks
@@ -162,7 +162,7 @@ uint64_t odp_timer_ns_to_tick(odp_timer_pool_t tpid, 
uint64_t ns);
 /**
  * Current tick value
  *
- * @param tpid Timer pool identifier
+ * @param tpid Timer pool handle
  *
  * @return Current time in timer ticks
  */
@@ -181,12 +181,14 @@ typedef struct {
 
 /**
  * Query timer pool configuration and current state
+ * @note This is the only timer API function which accepts invalid handles
+ * (any bit value) without causing undefined behavior.
  *
- * @param tpid Timer pool identifier
+ * @param tpid Timer pool handle
  * @param[out] info Pointer to information buffer
  *
- * @retval 0 Success
- * @retval -1 Failure. Info could not be retrieved.
+ * @retval 0 on success
+ * @retval 0 on failure. Info could not be retrieved.
  */
 int odp_timer_pool_info(odp_timer_pool_t tpid,
odp_timer_pool_info_t *info);
@@ -198,12 +200,12 @@ int odp_timer_pool_info(odp_timer_pool_t tpid,
  * the timer pool. The user_ptr is copied to timeouts and can be retrieved
  * using the odp_timeout_user_ptr() call.
  *
- * @param tpid Timer pool identifier
+ * @param tpid Timer pool handle
  * @param queueDestination queue for timeout notifications
  * @param user_ptr User defined pointer or NULL to be copied to timeouts
  *
- * @return Timer handle if successful, otherwise ODP_TIMER_INVALID and
- *errno set.
+ * @return Timer handle on success
+ * @retval ODP_TIMER_INVALID on failure and errno set.
  */
 odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid,
odp_queue_t queue,
@@ -218,7 +220,8 @@ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid,
  * responsibility of the application to handle this timeout when it is 
received.
  *
  * @param tim  Timer handle
- * @return Event handle of timeout event or ODP_EVENT_INVALID
+ * @return Event handle of timeout event
+ * @retval ODP_EVENT_INVALID on failure
  */
 odp_event_t odp_timer_free(odp_timer_t tim);
 
@@ -228,9 +231,6 @@ odp_event_t odp_timer_free(odp_timer_t tim);
  * Set (arm) the timer to expire at specific time. The timeout
  * event will be enqueued when the timer expires.
  *
- * Note: any invalid parameters will be treated as programming errors and will
- * cause the application to abort.
- *
  * @param tim  Timer
  * @param abs_tck  Expiration time in absolute timer ticks
  * @param[in,out] tmo_ev  Reference to an event variable that points to
@@ -255,9 +255,6 @@ int odp_timer_set_abs(odp_timer_t tim,
  *
  * Set (arm) the timer to expire at a relative future time.
  *
- * Note: any invalid parameters will be treated as programming errors and will
- * cause the application to abort.
- *
  * @param tim  Timer
  * @param rel_tck  Expiration time in timer ticks relative to current time of
  *the timer pool the timer belongs to
@@ -287,22 +284,16 @@ int odp_timer_set_rel(odp_timer_t tim,
  * A timer that has already expired may be impossible to cancel and the timeout
  * will instead be delivered to the destination queue.
  *
- * Note: any invalid parameters will be treated as programming errors and will
- * cause the 

[lng-odp] [PATCHv5 09/18] api: odp_packet.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/packet.h | 68 ++--
 1 file changed, 37 insertions(+), 31 deletions(-)

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 3c1c646..fbf4f04 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -110,8 +110,8 @@ void odp_packet_free(odp_packet_t pkt);
  * @param pkt   Packet handle
  * @param len   Packet data length
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  *
  * @see odp_packet_buf_len()
  */
@@ -304,7 +304,7 @@ void *odp_packet_push_head(odp_packet_t pkt, uint32_t len);
  * @param pkt  Packet handle
  * @param len  Number of bytes to pull the head (0 ... seg_len - 1)
  *
- * @return The new data pointer, or NULL in case of an error.
+ * @return The new data pointer
  * @retval NULL  Requested offset exceeds packet segment length
  *
  * @see odp_packet_seg_len(), odp_packet_push_head()
@@ -416,7 +416,7 @@ odp_pool_t odp_packet_pool(odp_packet_t pkt);
  * @param pkt   Packet handle
  *
  * @return Packet interface handle
- * @retval ODP_PKTIO_INVALID  Packet was not received
+ * @retval ODP_PKTIO_INVALID  Packet was not received on any interface
  */
 odp_pktio_t odp_packet_input(odp_packet_t pkt);
 
@@ -476,8 +476,8 @@ void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t 
ctx);
  * @param[out] len  Number of data bytes remaining in the segment (output).
  *  Ignored when NULL.
  *
- * @return  Layer 2 start pointer, or NULL when packet does not contain a valid
- *  L2 header.
+ * @return  Layer 2 start pointer
+ * @retval  NULL packet does not contain a valid L2 header
  *
  * @see odp_packet_l2_offset(), odp_packet_l2_offset_set(), odp_packet_has_l2()
  */
@@ -494,8 +494,8 @@ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len);
  *
  * @param pkt  Packet handle
  *
- * @return  Layer 2 start offset, or ODP_PACKET_OFFSET_INVALID when packet does
- *  not contain a valid L2 header.
+ * @return  Layer 2 start offset
+ * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L2 header
  *
  * @see odp_packet_l2_offset_set(), odp_packet_has_l2()
  */
@@ -511,8 +511,8 @@ uint32_t odp_packet_l2_offset(odp_packet_t pkt);
  * @param pkt Packet handle
  * @param offset  Layer 2 start offset (0 ... odp_packet_len()-1)
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset);
 
@@ -526,8 +526,8 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t 
offset);
  * @param[out] len  Number of data bytes remaining in the segment (output).
  *  Ignored when NULL.
  *
- * @return  Layer 3 start pointer, or NULL when packet does not contain a valid
- *  L3 header.
+ * @return  Layer 3 start pointer
+ * @retval NULL packet does not contain a valid L3 header
  *
  * @see odp_packet_l3_offset(), odp_packet_l3_offset_set(), odp_packet_has_l3()
  */
@@ -561,8 +561,8 @@ uint32_t odp_packet_l3_offset(odp_packet_t pkt);
  * @param pkt Packet handle
  * @param offset  Layer 3 start offset (0 ... odp_packet_len()-1)
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset);
 
@@ -576,8 +576,8 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t 
offset);
  * @param[out] len  Number of data bytes remaining in the segment (output).
  *  Ignored when NULL.
  *
- * @return  Layer 4 start pointer, or NULL when packet does not contain a valid
- *  L4 header.
+ * @return  Layer 4 start pointer
+ * @retval NULL packet does not contain a valid L4 header
  *
  * @see odp_packet_l4_offset(), odp_packet_l4_offset_set(), odp_packet_has_l4()
  */
@@ -594,8 +594,8 @@ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len);
  *
  * @param pkt  Packet handle
  *
- * @return  Layer 4 start offset, or ODP_PACKET_OFFSET_INVALID when packet does
- *  not contain a valid L4 header.
+ * @return  Layer 4 start offset
+ * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L4 header
  *
  * @see odp_packet_l4_offset_set(), odp_packet_has_l4()
  */
@@ -611,8 +611,8 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
  * @param pkt Packet handle
  * @param offset  Layer 4 start offset (0 ... odp_packet_len()-1)
  *
- * @retval 0 Success
- * @retval Non-zero Failure
+ * @retval 0 on success
+ * @retval 0 on failure
  */
 int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
 
@@ -670,7 +670,8 @@ 

[lng-odp] [PATCHv5 15/18] api: odp_thread.h: updated return descriptions

2015-02-03 Thread Ola Liljedahl
Updated doxygen descriptions, particularly the @return/@retval descriptions.
No change of implementation necessary.

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

 include/odp/api/thread.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
index 469d298..d6016cb 100644
--- a/include/odp/api/thread.h
+++ b/include/odp/api/thread.h
@@ -23,9 +23,9 @@ extern C {
  */
 
 /**
- * Get thread id
+ * Get thread identifier
  *
- * @return Thread id of the current thread
+ * @return Thread identifier of the current thread
  */
 int odp_thread_id(void);
 
@@ -33,7 +33,7 @@ int odp_thread_id(void);
 /**
  * Get CPU number
  *
- * @return CPU ID where the thread is currently running
+ * @return CPU number where the thread is currently running
  */
 int odp_thread_cpu(void);
 
-- 
1.9.1


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


[lng-odp] [PATCHv5 17/18] api: odp_cpumask.h: updated descriptions, added const

2015-02-03 Thread Ola Liljedahl
Updated function, parameter and return descriptions.
Added const to some input parameters passed by reference.

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

 include/odp/api/cpumask.h| 100 +--
 platform/linux-generic/odp_cpumask.c |  12 ++---
 2 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/include/odp/api/cpumask.h b/include/odp/api/cpumask.h
index 409f3b4..6b675c5 100644
--- a/include/odp/api/cpumask.h
+++ b/include/odp/api/cpumask.h
@@ -53,102 +53,118 @@ void odp_cpumask_from_str(odp_cpumask_t *mask, const char 
*str);
 ssize_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, ssize_t size);
 
 /**
- * Clear entire mask
- * @param mask CPU mask to flush with zero value
+ * Clear entire CPU mask
+ * @param mask CPU mask to clear
  */
 void odp_cpumask_zero(odp_cpumask_t *mask);
 
 /**
- * Add cpu to mask
- * @param mask  add cpu number in CPU mask
+ * Add CPU to mask
+ * @param mask  CPU mask to update
  * @param cpu   CPU number
  */
 void odp_cpumask_set(odp_cpumask_t *mask, int cpu);
 
 /**
- * Remove cpu from mask
- * @param mask  clear cpu number from CPU mask
+ * Remove CPU from mask
+ * @param mask  CPU mask to update
  * @param cpu   CPU number
  */
 void odp_cpumask_clr(odp_cpumask_t *mask, int cpu);
 
 /**
- * Test if cpu is a member of mask
- * @param mask  CPU mask to check if cpu num set or not
+ * Test if CPU is a member of mask
+ *
+ * @param mask  CPU mask to test
  * @param cpu   CPU number
- * @return  non-zero if set otherwise 0
+ * @return  non-zero if set
+ * @retval  0 if not set
  */
 int odp_cpumask_isset(const odp_cpumask_t *mask, int cpu);
 
 /**
- * Count number of cpus in mask
+ * Count number of CPU's in mask
+ *
  * @param mask  CPU mask
- * @return cpumask count
+ * @return population count
  */
 int odp_cpumask_count(const odp_cpumask_t *mask);
 
 /**
- * Logical AND over two source masks.
+ * Member-wise AND over two CPU masks
  *
- * @param destDestination mask, can be one of the source masks
- * @param src1Source mask 1
- * @param src2Source mask 2
+ * @param destDestination CPU mask (may be one of the source masks)
+ * @param src1Source CPU mask 1
+ * @param src2Source CPU mask 2
  */
-void odp_cpumask_and(odp_cpumask_t *dest, odp_cpumask_t *src1,
-odp_cpumask_t *src2);
+void odp_cpumask_and(odp_cpumask_t *dest, const odp_cpumask_t *src1,
+const odp_cpumask_t *src2);
 
 /**
- * Logical OR over two source masks.
+ * Member-wise OR over two CPU masks
  *
- * @param destDestination mask, can be one of the source masks
- * @param src1Source mask 1
- * @param src2Source mask 2
+ * @param destDestination CPU mask (may be one of the source masks)
+ * @param src1Source CPU mask 1
+ * @param src2Source CPU mask 2
  */
-void odp_cpumask_or(odp_cpumask_t *dest, odp_cpumask_t *src1,
-   odp_cpumask_t *src2);
+void odp_cpumask_or(odp_cpumask_t *dest, const odp_cpumask_t *src1,
+   const odp_cpumask_t *src2);
 
 /**
- * Logical XOR over two source masks.
+ * Member-wise XOR over two CPU masks
  *
- * @param destDestination mask, can be one of the source masks
- * @param src1Source mask 1
- * @param src2Source mask 2
+ * @param destDestination CPU mask (may be one of the source masks)
+ * @param src1Source CPU mask 1
+ * @param src2Source CPU mask 2
  */
-void odp_cpumask_xor(odp_cpumask_t *dest, odp_cpumask_t *src1,
-odp_cpumask_t *src2);
+void odp_cpumask_xor(odp_cpumask_t *dest, const odp_cpumask_t *src1,
+const odp_cpumask_t *src2);
 
 /**
- * Test if two masks contain the same cpus
+ * Test if two CPU masks contain the same CPU's
+ *
+ * @param mask1CPU mask 1
+ * @param mask2CPU mask 2
+ *
+ * @retval non-zero if CPU masks equal
+ * @retval 0 if CPU masks not equal
  */
 int odp_cpumask_equal(const odp_cpumask_t *mask1,
  const odp_cpumask_t *mask2);
 
 /**
  * Copy a CPU mask
+ *
+ * @param destDestination CPU mask
+ * @param src Source CPU mask
  */
 void odp_cpumask_copy(odp_cpumask_t *dest, const odp_cpumask_t *src);
 
 /**
- * Find first CPU that is set in the mask
+ * Find first set CPU in mask
+ *
+ * @param maskCPU mask
  *
- * @param mask is the mask to be searched
- * @return cpu else -1 if no bits set in cpumask
+ * @return cpu number
+ * @retval 0 if no CPU found
  */
 int odp_cpumask_first(const odp_cpumask_t *mask);
 
 /**
- * Find last CPU that is set in the mask
+ * Find last set CPU in mask
  *
- * @param mask is the mask to be searched
- * @return cpu else -1 if no bits set in cpumask
+ * @param maskCPU mask
+ *
+ * @return cpu number
+ * @retval 0 if no CPU found
  */
 int odp_cpumask_last(const odp_cpumask_t *mask);
 
 /**
- * Find next cpu in 

Re: [lng-odp] [PATCHv4 00/18] Cleanup return semantics and descriptions

2015-02-03 Thread Ola Liljedahl
On 3 February 2015 at 17:26, Bill Fischofer bill.fischo...@linaro.org wrote:
 For this series:

 Reviewed-by: Bill Fischofer bill.fischo...@linaro.org
There is a version 5 now:

Changes since version 4:
Restored parameter names of odp_cpumask_to_str(), odp_pktio_mac_addr()
and odp_hw_random_get().

Changes since version 3:
Removed unnecessary braces from odp_cpumask.c in patch #1.

All very important changes.

-- Ola


 On Tue, Feb 3, 2015 at 8:53 AM, Ola Liljedahl ola.liljed...@linaro.org
 wrote:

 Changes since version 3:
 Removed unnecessary braces from odp_cpumask.c in patch #1.

 Changes since version 2:
 Rebased, e.g. due to API restructuring.
 Split two patches, separating documentation updates from API changes.
 Reordered patches, all serious API changes are now contained in patches
 1-4.

 Patches #1-#3:
 odp_cpumask_to_str(), odp_pktio_mac_addr() and odp_hw_random_get() takes
 output buffer size as input and returns number of chars/bytes written (on
 success), a negative value on failure.
 Added defines (ODP_CPUMASK_BUFSIZE, ODP_PKTIO_MACADDRSIZE) for recommended
 output buffer sizes.
 Updated the implementations of these calls.
 Updated all usages of these calls in example and test programs.

 Patch #4:
 Changed the definition of odp_queue_enq_multi() to support partial success
 (e.g. enqueued some but not all of the events specified). Returns the
 number
 of events enqueued (equivalent to odp_queue_deq_multi()). This change is
 necessary to support ODP implementations that use fixed size queues (e.g.
 ODP linux-dpdk).
 Updated the implementation in odp_queue.c to conform to the new semantics.
 Updated the necessary test/validation/performance programs.

 Patches #5-#18:
 Updated doxygen descriptions, particularly the @return/@retval
 descriptions.
 Specifically documented those API calls which are guaranteed to handle
 invalid/stale handles.
 No change of implementation necessary.

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

 Ola Liljedahl (18):
   api: odp_cpumask.h: odp_cpumask_to_str() return chars written or error
   api: odp_pktio.h: odp_pktio_mac_addr() return chars written or error
   api: odp_crypto.h: odp_hw_random_get(): return number of bytes written
   api: odp_queue.h: odp_queue_enq_multi() returns partial success
   api: odp_buffer.h: undefined behavior description
   api: odp_byteorder.h: updated comment
   api: odp_classification.h: updated return descriptions
   api: odp_init.h: updated return descriptions
   api: odp_packet.h: updated return descriptions
   api: odp_packet_flags.h: updated return descriptions
   api: odp_packet_io.h: updated return descriptions
   api: odp_queue.h: updated return descriptions
   api: odp_schedule.h: updated return descriptions
   api: odp_shared_memory.h: updated return descriptions
   api: odp_thread.h: updated return descriptions
   api: odp_timer.h: updated return descriptions
   api: odp_cpumask.h: updated descriptions, added const
   api: odp_crypto.h: updated return descriptions

  example/generator/odp_generator.c  |   4 +-
  example/ipsec/odp_ipsec.c  |   4 +-
  example/ipsec/odp_ipsec_cache.c|   6 +-
  example/l2fwd/odp_l2fwd.c  |   4 +-
  example/packet/odp_pktio.c |   4 +-
  example/timer/odp_timer_test.c |   4 +-
  include/odp/api/buffer.h   |   4 +-
  include/odp/api/byteorder.h|   2 +-
  include/odp/api/classification.h   |  48 
  include/odp/api/cpumask.h  | 123
 +
  include/odp/api/crypto.h   |  23 ++--
  include/odp/api/init.h |  20 ++--
  include/odp/api/packet.h   |  68 ++--
  include/odp/api/packet_flags.h |  51 ++---
  include/odp/api/packet_io.h| 109
 ++
  include/odp/api/queue.h|  38 ---
  include/odp/api/schedule.h |   3 +-
  include/odp/api/shared_memory.h|  17 +--
  include/odp/api/thread.h   |   6 +-
  include/odp/api/timer.h|  52 +++--
  .../linux-generic/include/odp/plat/cpumask_types.h |   5 +
  .../include/odp/plat/packet_io_types.h |   2 +
  platform/linux-generic/odp_cpumask.c   |  38 ---
  platform/linux-generic/odp_crypto.c|   8 +-
  platform/linux-generic/odp_packet_io.c |  15 +--
  platform/linux-generic/odp_queue.c |   4 +-
  test/api_test/odp_common.c |   4 +-
  test/performance/odp_scheduling.c  |  14 ++-
  test/validation/crypto/odp_crypto_test_rng.c   |   6 +-
  test/validation/odp_pktio.c|  24 

[lng-odp] [PATCHv4 1/6] validation: odp_timer.c: avoid cunit warnings for late timeouts

2015-02-03 Thread Ola Liljedahl
Don't report late timeouts using CU_FAIL as this interferes with the cunit
test framework. Just count and report the number of late timeouts.

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

 test/validation/odp_timer.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index c0b6f67..0238cf4 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -12,6 +12,7 @@
 #include unistd.h
 #include odp.h
 #include odp_cunit_common.h
+#include test_debug.h
 
 /** @private Timeout range in milliseconds (ms) */
 #define RANGE_MS 2000
@@ -28,6 +29,9 @@ static odp_pool_t tbp;
 /** @private Timer pool handle used by all threads */
 static odp_timer_pool_t tp;
 
+/** @private Count of timeouts delivered too late */
+static odp_atomic_u32_t ndelivtoolate;
+
 /** @private min() function */
 static int min(int a, int b)
 {
@@ -88,9 +92,10 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t 
prev_tick)
if (tick  odp_timer_current_tick(tp))
CU_FAIL(Timeout delivered early);
if (tick  prev_tick) {
-   printf(Too late tick: %PRIu64 prev_tick %PRIu64\n,
-  tick, prev_tick);
-   CU_FAIL(Timeout delivered late);
+   LOG_DBG(Too late tick: %PRIu64 prev_tick 
%PRIu64\n,
+   tick, prev_tick);
+   /* We don't report late timeouts using CU_FAIL */
+   odp_atomic_inc_u32(ndelivtoolate);
}
}
 
@@ -317,6 +322,9 @@ static void test_odp_timer_all(void)
/* Initialize barrier used by worker threads for synchronization */
odp_barrier_init(test_barrier, num_workers);
 
+   /* Initialize the shared timeout counter */
+   odp_atomic_init_u32(ndelivtoolate, 0);
+
/* Create and start worker threads */
pthrd_arg thrdarg;
thrdarg.testcase = 0;
@@ -325,6 +333,8 @@ static void test_odp_timer_all(void)
 
/* Wait for worker threads to exit */
odp_cunit_thread_exit(thrdarg);
+   LOG_DBG(Number of timeouts delivered/received too late: %u\n,
+   odp_atomic_load_u32(ndelivtoolate));
 
/* Check some statistics after the test */
if (odp_timer_pool_info(tp, tpinfo) != 0)
-- 
1.9.1


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


[lng-odp] [PATCHv4 6/6] validation: odp_timer.c: run at least one thread

2015-02-03 Thread Ola Liljedahl
Ensure we run at least one worker thread.

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

 test/validation/odp_timer.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 5218406..1f673c0 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -270,9 +270,13 @@ static void test_odp_timer_all(void)
 {
odp_pool_param_t params;
odp_timer_pool_param_t tparam;
-   /* This is a stressfull test - need to reserve some cpu cycles
-* @TODO move to test/performance */
-   int num_workers = min(odp_sys_cpu_count()-1, MAX_WORKERS);
+   /* Reserve at least one core for running other processes so the timer
+* test hopefully can run undisturbed and thus get better timing
+* results. */
+   int num_workers = min(odp_sys_cpu_count() - 1, MAX_WORKERS);
+   /* On a single-CPU machine run at least one thread */
+   if (num_workers  1)
+   num_workers = 1;
 
/* Create timeout pools */
params.tmo.num = (NTIMERS + 1) * num_workers;
-- 
1.9.1


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


Re: [lng-odp] [PATCH] api: fix odp_version_api_str()

2015-02-03 Thread Mike Holmes
On 3 February 2015 at 10:24, Maxim Uvarov maxim.uva...@linaro.org wrote:

 odp_version_api_str() has to be in API header while
 odp_version_impl_str() should be in linux-generic.
 That change fixes:
 https://bugs.linaro.org/show_bug.cgi?id=1194

 Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
 ---
  include/odp/api/version.h| 29
 +++-
  platform/linux-generic/include/odp/version.h | 25 +++-
  2 files changed, 27 insertions(+), 27 deletions(-)

 diff --git a/include/odp/api/version.h b/include/odp/api/version.h
 index 0889d9c..bfeb40b 100644
 --- a/include/odp/api/version.h
 +++ b/include/odp/api/version.h
 @@ -48,24 +48,27 @@ extern C {
   */
  #define ODP_VERSION_API_MINOR 0

 +/** @internal Version string expand */
 +#define ODP_VERSION_STR_EXPAND(x)  #x
 +
 +/** @internal Version to string */
 +#define ODP_VERSION_TO_STR(x)  ODP_VERSION_STR_EXPAND(x)
 +
 +/** @internal API version string */
 +#define ODP_VERSION_API_STR \
 +ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) . \
 +ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) . \
 +ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR)
 +


These are now duplicated
in platform/linux-generic/include/odp/plat/version_types.h I think that
file can be deleted


  /**
   * Returns ODP API version string
   */
 -const char *odp_version_api_str(void);
 -
 +static inline const char *odp_version_api_str(void)
 +{
 +   return ODP_VERSION_API_STR;
 +}

  /**
 - * Returns ODP implementation version string
 - *
 - * Every implementation of ODP may receive bug fixes independent of the
 version
 - * of the API changing, this function returns that indication string.
 - * @note This string is implementation specific.
 - * @sa odp_version_api_str()
 - *
 - * @return null terminated implementation specific version identifier
 string
 -  */
 -const char *odp_version_impl_str(void);
 -/**
   * @}
   */

 diff --git a/platform/linux-generic/include/odp/version.h
 b/platform/linux-generic/include/odp/version.h
 index f29320a..33cc5ba 100644
 --- a/platform/linux-generic/include/odp/version.h
 +++ b/platform/linux-generic/include/odp/version.h
 @@ -17,22 +17,19 @@
  extern C {
  #endif

 -#include odp/plat/version_types.h
 -
 -/** @ingroup odp_ver_abt_log_dbg
 - *  @{
 - */
 -
 -static inline const char *odp_version_api_str(void)
 -{
 -   return ODP_VERSION_API_STR;
 -}
 +#include odp/api/version.h

  /**
 - * @}
 - */
 -
 -#include odp/api/version.h
 + * Returns ODP implementation version string
 + *
 + * Every implementation of ODP may receive bug fixes independent of the
 version
 + * of the API changing, this function returns that indication string.
 + * @note This string is implementation specific.
 + * @sa odp_version_api_str()
 + *
 + * @return null terminated implementation specific version identifier
 string
 +  */
 +const char *odp_version_impl_str(void);

  #ifdef __cplusplus
  }
 --
 1.8.5.1.163.gd7aced9


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




-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCHv2] api: fix odp_version_api_str()

2015-02-03 Thread Maxim Uvarov
odp_version_api_str() has to be in API header while
odp_version_impl_str() should be in linux-generic.
That change fixes:
https://bugs.linaro.org/show_bug.cgi?id=1194

Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
---
 v2: remove version_types.h

 include/odp/api/version.h  | 29 +++--
 platform/linux-generic/Makefile.am |  3 +--
 .../linux-generic/include/odp/plat/version_types.h | 30 --
 platform/linux-generic/include/odp/version.h   | 25 --
 4 files changed, 28 insertions(+), 59 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp/plat/version_types.h

diff --git a/include/odp/api/version.h b/include/odp/api/version.h
index 0889d9c..bfeb40b 100644
--- a/include/odp/api/version.h
+++ b/include/odp/api/version.h
@@ -48,24 +48,27 @@ extern C {
  */
 #define ODP_VERSION_API_MINOR 0
 
+/** @internal Version string expand */
+#define ODP_VERSION_STR_EXPAND(x)  #x
+
+/** @internal Version to string */
+#define ODP_VERSION_TO_STR(x)  ODP_VERSION_STR_EXPAND(x)
+
+/** @internal API version string */
+#define ODP_VERSION_API_STR \
+ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) . \
+ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) . \
+ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR)
+
 /**
  * Returns ODP API version string
  */
-const char *odp_version_api_str(void);
-
+static inline const char *odp_version_api_str(void)
+{
+   return ODP_VERSION_API_STR;
+}
 
 /**
- * Returns ODP implementation version string
- *
- * Every implementation of ODP may receive bug fixes independent of the version
- * of the API changing, this function returns that indication string.
- * @note This string is implementation specific.
- * @sa odp_version_api_str()
- *
- * @return null terminated implementation specific version identifier string
-  */
-const char *odp_version_impl_str(void);
-/**
  * @}
  */
 
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index addb5ec..3624377 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -56,8 +56,7 @@ odpplatinclude_HEADERS = \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/pool_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/queue_types.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/plat/schedule_types.h \
- 
$(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \
- 
$(top_srcdir)/platform/linux-generic/include/odp/plat/version_types.h
+ 
$(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h
 
 odpapiincludedir= $(includedir)/odp/api
 odpapiinclude_HEADERS = \
diff --git a/platform/linux-generic/include/odp/plat/version_types.h 
b/platform/linux-generic/include/odp/plat/version_types.h
deleted file mode 100644
index e3327eb..000
--- a/platform/linux-generic/include/odp/plat/version_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef ODP_VERSION_TYPESH_
-#define ODP_VERSION_TYPESH_
-
-#ifdef __cplusplus
-extern C {
-#endif
-
-/** @internal Version string expand */
-#define ODP_VERSION_STR_EXPAND(x)  #x
-
-/** @internal Version to string */
-#define ODP_VERSION_TO_STR(x)  ODP_VERSION_STR_EXPAND(x)
-
-/** @internal API version string */
-#define ODP_VERSION_API_STR \
-ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) . \
-ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) . \
-ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/include/odp/version.h 
b/platform/linux-generic/include/odp/version.h
index f29320a..33cc5ba 100644
--- a/platform/linux-generic/include/odp/version.h
+++ b/platform/linux-generic/include/odp/version.h
@@ -17,22 +17,19 @@
 extern C {
 #endif
 
-#include odp/plat/version_types.h
-
-/** @ingroup odp_ver_abt_log_dbg
- *  @{
- */
-
-static inline const char *odp_version_api_str(void)
-{
-   return ODP_VERSION_API_STR;
-}
+#include odp/api/version.h
 
 /**
- * @}
- */
-
-#include odp/api/version.h
+ * Returns ODP implementation version string
+ *
+ * Every implementation of ODP may receive bug fixes independent of the version
+ * of the API changing, this function returns that indication string.
+ * @note This string is implementation specific.
+ * @sa odp_version_api_str()
+ *
+ * @return null terminated implementation specific version identifier string
+  */
+const char *odp_version_impl_str(void);
 
 #ifdef __cplusplus
 }
-- 
1.8.5.1.163.gd7aced9


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


Re: [lng-odp] [PATCHv4 00/18] Cleanup return semantics and descriptions

2015-02-03 Thread Bill Fischofer
Ok, I'll take a look at v5.  Thanks.

On Tue, Feb 3, 2015 at 10:49 AM, Ola Liljedahl ola.liljed...@linaro.org
wrote:

 On 3 February 2015 at 17:26, Bill Fischofer bill.fischo...@linaro.org
 wrote:
  For this series:
 
  Reviewed-by: Bill Fischofer bill.fischo...@linaro.org
 There is a version 5 now:

 Changes since version 4:
 Restored parameter names of odp_cpumask_to_str(), odp_pktio_mac_addr()
 and odp_hw_random_get().

 Changes since version 3:
 Removed unnecessary braces from odp_cpumask.c in patch #1.

 All very important changes.

 -- Ola

 
  On Tue, Feb 3, 2015 at 8:53 AM, Ola Liljedahl ola.liljed...@linaro.org
  wrote:
 
  Changes since version 3:
  Removed unnecessary braces from odp_cpumask.c in patch #1.
 
  Changes since version 2:
  Rebased, e.g. due to API restructuring.
  Split two patches, separating documentation updates from API changes.
  Reordered patches, all serious API changes are now contained in patches
  1-4.
 
  Patches #1-#3:
  odp_cpumask_to_str(), odp_pktio_mac_addr() and odp_hw_random_get() takes
  output buffer size as input and returns number of chars/bytes written
 (on
  success), a negative value on failure.
  Added defines (ODP_CPUMASK_BUFSIZE, ODP_PKTIO_MACADDRSIZE) for
 recommended
  output buffer sizes.
  Updated the implementations of these calls.
  Updated all usages of these calls in example and test programs.
 
  Patch #4:
  Changed the definition of odp_queue_enq_multi() to support partial
 success
  (e.g. enqueued some but not all of the events specified). Returns the
  number
  of events enqueued (equivalent to odp_queue_deq_multi()). This change is
  necessary to support ODP implementations that use fixed size queues
 (e.g.
  ODP linux-dpdk).
  Updated the implementation in odp_queue.c to conform to the new
 semantics.
  Updated the necessary test/validation/performance programs.
 
  Patches #5-#18:
  Updated doxygen descriptions, particularly the @return/@retval
  descriptions.
  Specifically documented those API calls which are guaranteed to handle
  invalid/stale handles.
  No change of implementation necessary.
 
  (This document/code contribution attached is provided under the terms of
  agreement LES-LTM-21309)
 
  Ola Liljedahl (18):
api: odp_cpumask.h: odp_cpumask_to_str() return chars written or error
api: odp_pktio.h: odp_pktio_mac_addr() return chars written or error
api: odp_crypto.h: odp_hw_random_get(): return number of bytes written
api: odp_queue.h: odp_queue_enq_multi() returns partial success
api: odp_buffer.h: undefined behavior description
api: odp_byteorder.h: updated comment
api: odp_classification.h: updated return descriptions
api: odp_init.h: updated return descriptions
api: odp_packet.h: updated return descriptions
api: odp_packet_flags.h: updated return descriptions
api: odp_packet_io.h: updated return descriptions
api: odp_queue.h: updated return descriptions
api: odp_schedule.h: updated return descriptions
api: odp_shared_memory.h: updated return descriptions
api: odp_thread.h: updated return descriptions
api: odp_timer.h: updated return descriptions
api: odp_cpumask.h: updated descriptions, added const
api: odp_crypto.h: updated return descriptions
 
   example/generator/odp_generator.c  |   4 +-
   example/ipsec/odp_ipsec.c  |   4 +-
   example/ipsec/odp_ipsec_cache.c|   6 +-
   example/l2fwd/odp_l2fwd.c  |   4 +-
   example/packet/odp_pktio.c |   4 +-
   example/timer/odp_timer_test.c |   4 +-
   include/odp/api/buffer.h   |   4 +-
   include/odp/api/byteorder.h|   2 +-
   include/odp/api/classification.h   |  48 
   include/odp/api/cpumask.h  | 123
  +
   include/odp/api/crypto.h   |  23 ++--
   include/odp/api/init.h |  20 ++--
   include/odp/api/packet.h   |  68 ++--
   include/odp/api/packet_flags.h |  51 ++---
   include/odp/api/packet_io.h| 109
  ++
   include/odp/api/queue.h|  38 ---
   include/odp/api/schedule.h |   3 +-
   include/odp/api/shared_memory.h|  17 +--
   include/odp/api/thread.h   |   6 +-
   include/odp/api/timer.h|  52 +++--
   .../linux-generic/include/odp/plat/cpumask_types.h |   5 +
   .../include/odp/plat/packet_io_types.h |   2 +
   platform/linux-generic/odp_cpumask.c   |  38 ---
   platform/linux-generic/odp_crypto.c|   8 +-
   platform/linux-generic/odp_packet_io.c |  15 +--
   platform/linux-generic/odp_queue.c |   4 +-
   

Re: [lng-odp] [PATCHv2] api: odp_event.h: remove ODP_EVENT_TYPE_INVALID

2015-02-03 Thread Maxim Uvarov

Merged,

Thanks.

On 02/03/2015 02:36 PM, Savolainen, Petri (NSN - FI/Espoo) wrote:

Reviewed-by: Petri Savolainen petri.savolai...@linaro.org


-Original Message-
From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl
Sent: Tuesday, February 03, 2015 1:04 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [PATCHv2] api: odp_event.h: remove
ODP_EVENT_TYPE_INVALID

Remove ODP_EVENT_TYPE_INVALID from odp_event.h.
Update description of odp_event_type(), is does not return
ODP_EVENT_TYPE_INVALID.
Remove ODP_POOL_TYPE_INVALID from odp_pool.h. It was defined to
ODP_EVENT_TYPE_INVALID.

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

Changed description of odp_event_type() after review by Petri S.

  include/odp/api/event.h   | 9 ++---
  include/odp/api/pool.h| 2 --
  platform/linux-generic/include/odp/plat/event_types.h | 1 -
  3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/include/odp/api/event.h b/include/odp/api/event.h
index 50c031a..d0413b9 100644
--- a/include/odp/api/event.h
+++ b/include/odp/api/event.h
@@ -36,11 +36,6 @@ extern C {
   */

  /**
- * @def ODP_EVENT_TYPE_INVALID
- * Invalid event type
- */
-
-/**
   * @def ODP_EVENT_BUFFER
   * Buffer event
   */
@@ -61,11 +56,11 @@ extern C {
   */

  /**
- * Event type
+ * Get event type
   *
   * @param eventEvent handle
   *
- * @return Event type or ODP_EVENT_TYPE_INVALID
+ * @return Event type
   */
  int odp_event_type(odp_event_t event);

diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
index 1582102..d09d92e 100644
--- a/include/odp/api/pool.h
+++ b/include/odp/api/pool.h
@@ -79,8 +79,6 @@ typedef struct odp_pool_param_t {

  } odp_pool_param_t;

-/** Invalid pool type */
-#define ODP_POOL_TYPE_INVALID ODP_EVENT_TYPE_INVALID
  /** Packet pool*/
  #define ODP_POOL_PACKET   ODP_EVENT_PACKET
  /** Buffer pool */
diff --git a/platform/linux-generic/include/odp/plat/event_types.h
b/platform/linux-generic/include/odp/plat/event_types.h
index 4a0756b..c98d416 100644
--- a/platform/linux-generic/include/odp/plat/event_types.h
+++ b/platform/linux-generic/include/odp/plat/event_types.h
@@ -30,7 +30,6 @@ typedef odp_buffer_t odp_event_t;

  #define ODP_EVENT_INVALID ODP_BUFFER_INVALID

-#define ODP_EVENT_TYPE_INVALID (-1)
  #define ODP_EVENT_BUFFER 1
  #define ODP_EVENT_PACKET 2
  #define ODP_EVENT_TIMEOUT3
--
1.9.1


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

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



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


Re: [lng-odp] [PATCH v2 1/3] api: pool: Added packet pool parameters

2015-02-03 Thread Ola Liljedahl
On 3 February 2015 at 13:59, Petri Savolainen
petri.savolai...@linaro.org wrote:
 Completed odp_pool_param_t definition with packet pool parameters.
 Parameter definition is close to what we are using already.

 * seg_len: Defines minimum segment buffer length.
With this parameter user can:
* trade-off between pool memory usage and SW performance (linear 
 memory access)
* avoid segmentation in packet head (e.g. if legacy app cannot 
 handle
  segmentation in the middle of the packet headers)
We already had defined a minimum segment size for conforming ODP
implementations. Isn't that enough?

I can see value in specifying the minimum size of the first segment of
a packet (which would contain all headers the application is going to
process). But this proposal goes much further than that.


* seg_len  ODP_CONFIG_PACKET_SEG_LEN_MIN is rounded up to 
 ODP_CONFIG_PACKET_SEG_LEN_MIN
* seg_len  ODP_CONFIG_PACKET_SEG_LEN_MAX is not valid

 * seg_align: Defines minimum segment buffer alignment. With this parameter,
  user can force buffer alignment to match e.g. aligment 
 requirements
  of data structures stored in or algorithms accessing the packet
Can you give a practical example of when this configuration is useful?
To my knowledge, most data structures have quite small alignment
requirements, e.g. based on alignment requirements of individual
fields. But here I assume that we would specify alignment in multiples
of cache lines here (because the minimum segment alignment would be
the cache line size).

  headroom. When user don't have specific alignment requirement 0
  should be used for default.

 * seg_num: Number of segments. This is also the maximum number of packets.
I think these configurations could be hints but not strict
requirements. They do not change the *functionality* so an application
should not fail if these configurations can not be obeyed (except for
that legacy situation you describe above). The hints enable more
optimal utilization of e.g. packet memory and may decrease SW overhead
during packet processing but do not change the functionality.

To enable different hardware implementations, ODP apps should not
enforce unnecessary (non-functional) requirements on the ODP
implementations and limit the number of targets ODP can be implemented
on. ODP is not DPDK.

Applications should also not have to first check the limits of the
specific ODP implementation (as you suggested yesterday), adapts its
configuration to that and then send back those requirements to the ODP
implementation (which still has to check the parameters to verify that
they are valid). This is too complicated and will likely lead to code
that cheats and thus is not portable. Better for applications just to
specify its requested configuration to ODP and then get back the
results (i.e. actual values that will be used). The application can
then if necessary check that the configuration was honored. This
follows the normal programming flow.


 Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
 ---
  include/odp/api/pool.h | 26 +-
  1 file changed, 21 insertions(+), 5 deletions(-)

 diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
 index d09d92e..a1d7494 100644
 --- a/include/odp/api/pool.h
 +++ b/include/odp/api/pool.h
 @@ -61,13 +61,29 @@ typedef struct odp_pool_param_t {
  of 8. */
 uint32_t num;   /** Number of buffers in the pool */
 } buf;
 -/* Reserved for packet and timeout specific params
 struct {
 -   uint32_t seg_size;
 -   uint32_t seg_align;
 -   uint32_t num;
 +   uint32_t seg_len;   /** Minimum packet segment buffer
 +length in bytes. It includes
 +possible head-/tailroom 
 bytes.
 +The maximum value is defined 
 by
 +
 ODP_CONFIG_PACKET_SEG_LEN_MAX.
 +Use 0 for default length. */
 +   uint32_t seg_align; /** Minimum packet segment buffer
 +alignment in bytes. Valid
 +values are powers of two. The
 +maximum value is defined by
 +
 ODP_CONFIG_PACKET_SEG_ALIGN_MAX
 +. Use 0 for default 
 alignment.
 +Default will always be a
 +multiple of 8.
 +*/
 +

Re: [lng-odp] [PATCH 2/2] api: random: Renamed odp_hw_random_get

2015-02-03 Thread Ola Liljedahl
On 3 February 2015 at 14:44, Petri Savolainen
petri.savolai...@linaro.org wrote:
 Renamed odp_hw_random_get() to odp_random_data(). Random
 number API is now separated from crypto API.
Why is this separation desired?
Cryptographically strong random number generation can be considered a
natural part of the cryptography API.

Applications are supposed to include odp.h and will get all ODP
definitions regardless.

Who benefits?

-- Ola


 Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
 ---
  example/ipsec/odp_ipsec_cache.c  |  2 +-
  include/odp/api/crypto.h | 14 --
  platform/linux-generic/odp_crypto.c  |  3 ++-
  test/validation/crypto/odp_crypto_test_rng.c |  2 +-
  4 files changed, 4 insertions(+), 17 deletions(-)

 diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
 index 904e7b6..5e128c5 100644
 --- a/example/ipsec/odp_ipsec_cache.c
 +++ b/example/ipsec/odp_ipsec_cache.c
 @@ -98,7 +98,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 if (params.iv.length) {
 size_t size = params.iv.length;

 -   odp_hw_random_get(params.iv.data, size, 1);
 +   odp_random_data(params.iv.data, size, 1);
 }

 /* Synchronous session create for now */
 diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
 index 545c1a5..aad6bd9 100644
 --- a/include/odp/api/crypto.h
 +++ b/include/odp/api/crypto.h
 @@ -330,20 +330,6 @@ odp_crypto_compl_result(odp_crypto_compl_t 
 completion_event,
 odp_crypto_op_result_t *result);

  /**
 - * Generate random byte string
 - *
 - * @param buf  Pointer to store result
 - * @param len  Pointer to input length value as well as return value
 - * @param use_entropy  Use entropy
 - *
 - * @todo Define the implication of the use_entropy parameter
 - *
 - * @return 0 if succesful
 - */
 -int
 -odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
 -
 -/**
   * @}
   */

 diff --git a/platform/linux-generic/odp_crypto.c 
 b/platform/linux-generic/odp_crypto.c
 index 46766fa..de60157 100644
 --- a/platform/linux-generic/odp_crypto.c
 +++ b/platform/linux-generic/odp_crypto.c
 @@ -15,6 +15,7 @@
  #include odp_crypto_internal.h
  #include odp_debug_internal.h
  #include odp/hints.h
 +#include odp/random.h
  #include odp_packet_internal.h

  #include string.h
 @@ -447,7 +448,7 @@ odp_crypto_init_global(void)
  }

  int
 -odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy 
 ODP_UNUSED)
 +odp_random_data(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED)
  {
 int rc;
 rc = RAND_bytes(buf, *len);
 diff --git a/test/validation/crypto/odp_crypto_test_rng.c 
 b/test/validation/crypto/odp_crypto_test_rng.c
 index 458f908..b6313f0 100644
 --- a/test/validation/crypto/odp_crypto_test_rng.c
 +++ b/test/validation/crypto/odp_crypto_test_rng.c
 @@ -19,7 +19,7 @@ static void rng_get_size(void)
 size_t len = TDES_CBC_IV_LEN;
 uint8_t buf[TDES_CBC_IV_LEN];

 -   ret = odp_hw_random_get(buf, len, false);
 +   ret = odp_random_data(buf, len, false);
 CU_ASSERT(!ret);
 CU_ASSERT(len == TDES_CBC_IV_LEN);
  }
 --
 2.2.2


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

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


Re: [lng-odp] [PATCH v2] validation: init: split cases into executables

2015-02-03 Thread Maxim Uvarov

On 02/03/2015 04:15 PM, Taras Kondratiuk wrote:

On 02/03/2015 03:12 PM, Maxim Uvarov wrote:

Patch applied with small correction.

You deleted odp_classification from the list which is obvious error, no
need to do that.


Hmm. Where is it removed?


Skip that message please. I think I wrongly interpret merge message.

Maxim.

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


Re: [lng-odp] classification tests scheduled queues

2015-02-03 Thread Ola Liljedahl
Wouldn't it be better to modify the validation program to make sure
scheduling is always performed on a data path thread?
We want to promote usage of the scheduler, HW-accelerated
classification and scheduling are some of the differentiators of ODP.

On 3 February 2015 at 13:53, Radu-Andrei Bulie radu.bu...@freescale.com wrote:
 Hi,



 I have a comment regarding the scheduling approach in the classification
 validation tests (this also can be extended to other tests which use the
 same pattern).

 The schedule function should be called in context of a data path thread that
 is bound to a known core (the same model as in pktio application for
 instance).  Otherwise

 (as in the mentioned test) the main process (in this case the cunit test)
 can be scheduled by Linux on any core – e.g core 0 – that is not in the data
 path. In this situation no dequeue will occur,  because the scheduling does
 not take place on a data path thread (unlike  the case for pktio application
 where there is a  cpu dedicated to control path).

 From the linux-generic perspective,  there is no apparent issue in using the
 schedule function in this context. But as it is given in the reference
 application, the purpose of the scheduling is to function on the data path
 and thus to provide the advantages given by different SoCs acceleration
 implementations. (there will always be a control core and some data path
 cores).

 Thus, being in accordance with the reference applications from odp, I
 suggest replacing the scheduled queues with poll queues or create a separate
 thread which receives the packet, otherwise the test will function only on
 linux generic implementation.



 PS: I could send the patch (using poll queues approach) if we reach a
 consensus.





 Regards,



 Radu


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


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


[lng-odp] [PATCH 2/2] api: random: Renamed odp_hw_random_get

2015-02-03 Thread Petri Savolainen
Renamed odp_hw_random_get() to odp_random_data(). Random
number API is now separated from crypto API.

Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
---
 example/ipsec/odp_ipsec_cache.c  |  2 +-
 include/odp/api/crypto.h | 14 --
 platform/linux-generic/odp_crypto.c  |  3 ++-
 test/validation/crypto/odp_crypto_test_rng.c |  2 +-
 4 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index 904e7b6..5e128c5 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -98,7 +98,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
if (params.iv.length) {
size_t size = params.iv.length;
 
-   odp_hw_random_get(params.iv.data, size, 1);
+   odp_random_data(params.iv.data, size, 1);
}
 
/* Synchronous session create for now */
diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index 545c1a5..aad6bd9 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -330,20 +330,6 @@ odp_crypto_compl_result(odp_crypto_compl_t 
completion_event,
odp_crypto_op_result_t *result);
 
 /**
- * Generate random byte string
- *
- * @param buf  Pointer to store result
- * @param len  Pointer to input length value as well as return value
- * @param use_entropy  Use entropy
- *
- * @todo Define the implication of the use_entropy parameter
- *
- * @return 0 if succesful
- */
-int
-odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
-
-/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 46766fa..de60157 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -15,6 +15,7 @@
 #include odp_crypto_internal.h
 #include odp_debug_internal.h
 #include odp/hints.h
+#include odp/random.h
 #include odp_packet_internal.h
 
 #include string.h
@@ -447,7 +448,7 @@ odp_crypto_init_global(void)
 }
 
 int
-odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED)
+odp_random_data(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED)
 {
int rc;
rc = RAND_bytes(buf, *len);
diff --git a/test/validation/crypto/odp_crypto_test_rng.c 
b/test/validation/crypto/odp_crypto_test_rng.c
index 458f908..b6313f0 100644
--- a/test/validation/crypto/odp_crypto_test_rng.c
+++ b/test/validation/crypto/odp_crypto_test_rng.c
@@ -19,7 +19,7 @@ static void rng_get_size(void)
size_t len = TDES_CBC_IV_LEN;
uint8_t buf[TDES_CBC_IV_LEN];
 
-   ret = odp_hw_random_get(buf, len, false);
+   ret = odp_random_data(buf, len, false);
CU_ASSERT(!ret);
CU_ASSERT(len == TDES_CBC_IV_LEN);
 }
-- 
2.2.2


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


Re: [lng-odp] [PATCH v2] validation: init: split cases into executables

2015-02-03 Thread Maxim Uvarov

Patch applied with small correction.

You deleted odp_classification from the list which is obvious error, no 
need to do that.


Thanks,
Maxim.

On 02/03/2015 01:02 AM, Mike Holmes wrote:

init_global can only be called once per executable, split the
init_global testing into multiple executables.

Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
v2
fix copyright year
remove uneeded defines

  test/validation/Makefile.am|  4 +--
  test/validation/odp_init.c | 39 -
  test/validation/odp_init_log.c | 78 ++
  3 files changed, 80 insertions(+), 41 deletions(-)
  create mode 100644 test/validation/odp_init_log.c

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 2942b85..3ee59c8 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,10 +6,10 @@ AM_LDFLAGS += -static
  TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
  
  if test_vald

-TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run 
odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification
+TESTS = odp_init odp_init_log odp_queue odp_crypto odp_shm odp_schedule 
odp_pktio_run odp_buffer odp_system odp_timer odp_time odp_synchronizers 
odp_classification
  endif
  
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers odp_classification

+bin_PROGRAMS = odp_init odp_init_log odp_queue odp_crypto odp_shm odp_schedule 
odp_pktio odp_buffer odp_system odp_timer odp_time odp_synchronizers 
odp_classification
  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
  odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
  odp_classification_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/classification
diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
index c8e5a11..82f8849 100644
--- a/test/validation/odp_init.c
+++ b/test/validation/odp_init.c
@@ -11,10 +11,6 @@
  #define DEFAULT_MSG_POOL_SIZE (4*1024*1024)
  #define DEFAULT_MSG_SIZE  (8)
  
-int replacement_logging_used;

-
-static int odp_init_log(odp_log_level_e level , const char *fmt, ...);
-
  static void test_odp_init_global(void)
  {
int status;
@@ -25,27 +21,8 @@ static void test_odp_init_global(void)
CU_ASSERT(status == 0);
  }
  
-static void test_odp_init_global_replace_log(void)

-{
-   int status;
-   struct odp_init_t init_data;
-
-   init_data.log_fn = odp_init_log;
-
-   replacement_logging_used = 0;
-
-   status = odp_init_global(init_data, NULL);
-   CU_ASSERT_FATAL(status == 0);
-
-   CU_ASSERT_TRUE(replacement_logging_used);
-
-   status = odp_term_global();
-   CU_ASSERT(status == 0);
-}
-
  CU_TestInfo test_odp_init[] = {
{test_odp_init_global,  test_odp_init_global},
-   {replace log,  test_odp_init_global_replace_log},
CU_TEST_INFO_NULL,
  };
  
@@ -74,19 +51,3 @@ int main(void)
  
  	return ret;

  }
-
-int odp_init_log(odp_log_level_e level __attribute__((unused)),
-const char *fmt, ...)
-{
-   va_list args;
-   int r;
-
-   /* just set a flag to be sure the replacement fn was used */
-   replacement_logging_used = 1;
-
-   va_start(args, fmt);
-   r = vfprintf(stderr, fmt, args);
-   va_end(args);
-
-   return r;
-}
diff --git a/test/validation/odp_init_log.c b/test/validation/odp_init_log.c
new file mode 100644
index 000..372d4f5
--- /dev/null
+++ b/test/validation/odp_init_log.c
@@ -0,0 +1,78 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include stdarg.h
+#include odp.h
+#include CUnit/Basic.h
+
+int replacement_logging_used;
+
+static int odp_init_log(odp_log_level_e level , const char *fmt, ...);
+
+static void test_odp_init_global_replace_log(void)
+{
+   int status;
+   struct odp_init_t init_data;
+
+   init_data.log_fn = odp_init_log;
+
+   replacement_logging_used = 0;
+
+   status = odp_init_global(init_data, NULL);
+   CU_ASSERT_FATAL(status == 0);
+
+   CU_ASSERT_TRUE(replacement_logging_used);
+
+   status = odp_term_global();
+   CU_ASSERT(status == 0);
+}
+
+CU_TestInfo test_odp_init[] = {
+   {replace log,  test_odp_init_global_replace_log},
+   CU_TEST_INFO_NULL,
+};
+
+CU_SuiteInfo odp_testsuites[] = {
+   {Init, NULL, NULL, NULL, NULL, test_odp_init},
+   CU_SUITE_INFO_NULL,
+};
+
+int main(void)
+{
+   int ret;
+
+   printf(\tODP API version: %s\n, odp_version_api_str());
+   printf(\tODP implementation version: %s\n, odp_version_impl_str());
+
+   CU_set_error_action(CUEA_ABORT);
+
+   CU_initialize_registry();
+   CU_register_suites(odp_testsuites);
+   CU_basic_set_mode(CU_BRM_VERBOSE);
+   CU_basic_run_tests();
+
+   ret = CU_get_number_of_failure_records();
+
+   CU_cleanup_registry();
+
+   return ret;
+}
+
+int 

Re: [lng-odp] classification tests scheduled queues

2015-02-03 Thread Jerin Jacob
On Tue, Feb 03, 2015 at 01:07:15PM +, Radu-Andrei Bulie wrote:
 As I said in my comment we could use two approaches.(poll or data path 
 thread).

How about the scheme(#define IPSEC_POLL_QUEUES) followed in existing 
example/ipsec to 
abstract polled vs schedule mode ?

 The one you mentioned reflects the model of the reference applications. 
 Classification test itself, for the present moment,  is a functional test and 
 does not target
 performance. So I don't see a major difference in using poll or a data path 
 thread.
 
 
 Regards,
 
 Radu
 
 
 
 -Original Message-
 From: Ola Liljedahl [mailto:ola.liljed...@linaro.org] 
 Sent: Tuesday, February 03, 2015 2:59 PM
 To: Bulie Radu-Andrei-B37577
 Cc: lng-odp@lists.linaro.org
 Subject: Re: [lng-odp] classification tests scheduled queues
 
 Wouldn't it be better to modify the validation program to make sure 
 scheduling is always performed on a data path thread?
 We want to promote usage of the scheduler, HW-accelerated classification and 
 scheduling are some of the differentiators of ODP.
 
 On 3 February 2015 at 13:53, Radu-Andrei Bulie radu.bu...@freescale.com 
 wrote:
  Hi,
 
 
 
  I have a comment regarding the scheduling approach in the 
  classification validation tests (this also can be extended to other 
  tests which use the same pattern).
 
  The schedule function should be called in context of a data path 
  thread that is bound to a known core (the same model as in pktio 
  application for instance).  Otherwise
 
  (as in the mentioned test) the main process (in this case the cunit 
  test) can be scheduled by Linux on any core – e.g core 0 – that is not 
  in the data path. In this situation no dequeue will occur,  because 
  the scheduling does not take place on a data path thread (unlike  the 
  case for pktio application where there is a  cpu dedicated to control path).
 
  From the linux-generic perspective,  there is no apparent issue in 
  using the schedule function in this context. But as it is given in the 
  reference application, the purpose of the scheduling is to function on 
  the data path and thus to provide the advantages given by different 
  SoCs acceleration implementations. (there will always be a control 
  core and some data path cores).
 
  Thus, being in accordance with the reference applications from odp, I 
  suggest replacing the scheduled queues with poll queues or create a 
  separate thread which receives the packet, otherwise the test will 
  function only on linux generic implementation.
 
 
 
  PS: I could send the patch (using poll queues approach) if we reach a 
  consensus.
 
 
 
 
 
  Regards,
 
 
 
  Radu
 
 
  ___
  lng-odp mailing list
  lng-odp@lists.linaro.org
  http://lists.linaro.org/mailman/listinfo/lng-odp
 
 ___
 lng-odp mailing list
 lng-odp@lists.linaro.org
 http://lists.linaro.org/mailman/listinfo/lng-odp

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


[lng-odp] [PATCH 1/2] api: random: Added random.h

2015-02-03 Thread Petri Savolainen
Added random number API. The only API call is moved and
renamed from crypto.h.

Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
---
 include/odp.h   |  1 +
 include/odp/api/random.h| 48 +
 platform/linux-generic/Makefile.am  |  2 ++
 platform/linux-generic/include/odp/random.h | 34 
 4 files changed, 85 insertions(+)
 create mode 100644 include/odp/api/random.h
 create mode 100644 platform/linux-generic/include/odp/random.h

diff --git a/include/odp.h b/include/odp.h
index 30bed8e..139abdf 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -50,6 +50,7 @@ extern C {
 #include odp/classification.h
 #include odp/rwlock.h
 #include odp/event.h
+#include odp/random.h
 
 #ifdef __cplusplus
 }
diff --git a/include/odp/api/random.h b/include/odp/api/random.h
new file mode 100644
index 000..65acdb3
--- /dev/null
+++ b/include/odp/api/random.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP random number API
+ */
+
+#ifndef ODP_RANDOM_H_
+#define ODP_RANDOM_H_
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+/** @defgroup odp_random ODP RANDOM
+ *  @{
+ */
+
+
+/**
+ * Generate random byte string
+ *
+ * @param buf  Pointer to store result
+ * @param len  Pointer to input length value as well as return value
+ * @param use_entropy  Use entropy
+ *
+ * @todo Define the implication of the use_entropy parameter
+ *
+ * @return 0 if succesful
+ */
+int odp_random_data(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index addb5ec..935dd24 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -29,6 +29,7 @@ odpinclude_HEADERS = \
  $(top_srcdir)/platform/linux-generic/include/odp/packet_io.h \
  $(top_srcdir)/platform/linux-generic/include/odp/pool.h \
  $(top_srcdir)/platform/linux-generic/include/odp/queue.h \
+ $(top_srcdir)/platform/linux-generic/include/odp/random.h \
  $(top_srcdir)/platform/linux-generic/include/odp/rwlock.h \
  $(top_srcdir)/platform/linux-generic/include/odp/schedule.h \
  
$(top_srcdir)/platform/linux-generic/include/odp/shared_memory.h \
@@ -80,6 +81,7 @@ odpapiinclude_HEADERS = \
  $(top_srcdir)/include/odp/api/packet_io.h \
  $(top_srcdir)/include/odp/api/pool.h \
  $(top_srcdir)/include/odp/api/queue.h \
+ $(top_srcdir)/include/odp/api/random.h \
  $(top_srcdir)/include/odp/api/rwlock.h \
  $(top_srcdir)/include/odp/api/schedule.h \
  $(top_srcdir)/include/odp/api/shared_memory.h \
diff --git a/platform/linux-generic/include/odp/random.h 
b/platform/linux-generic/include/odp/random.h
new file mode 100644
index 000..e9b4bd0
--- /dev/null
+++ b/platform/linux-generic/include/odp/random.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP random number API
+ */
+
+#ifndef ODP_PLAT_RANDOM_H_
+#define ODP_PLAT_RANDOM_H_
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+/** @ingroup odp_random ODP RANDOM
+ *  @{
+ */
+
+/**
+ * @}
+ */
+
+#include odp/api/random.h
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.2.2


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


[lng-odp] [PATCH v2 2/3] api: pool: Move from buffer to packet pool parameters

2015-02-03 Thread Petri Savolainen
Change implementation, examples and test to use the new
packet pool parameters with ODP_POOL_PACKET type pools
(instead of using buffer pool parameters).

Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
---
 example/generator/odp_generator.c  |  8 ++---
 example/ipsec/odp_ipsec.c  | 16 +-
 example/l2fwd/odp_l2fwd.c  |  8 ++---
 example/packet/odp_pktio.c |  8 ++---
 platform/linux-generic/odp_buffer_pool.c   | 21 -
 test/validation/buffer/odp_buffer_pool_test.c  | 36 --
 test/validation/buffer/odp_packet_test.c   |  8 ++---
 .../classification/odp_classification_tests.c  |  6 ++--
 test/validation/odp_crypto.c   |  8 ++---
 test/validation/odp_pktio.c| 16 +-
 10 files changed, 78 insertions(+), 57 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 03dab50..de623ab 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -603,10 +603,10 @@ int main(int argc, char *argv[])
printf(cpu mask:   %s\n, cpumaskstr);
 
/* Create packet pool */
-   params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
-   params.buf.align = 0;
-   params.buf.num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
-   params.type  = ODP_POOL_PACKET;
+   params.pkt.seg_len   = SHM_PKT_POOL_BUF_SIZE;
+   params.pkt.seg_align = 0;
+   params.pkt.seg_num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+   params.type  = ODP_POOL_PACKET;
 
pool = odp_pool_create(packet_pool, ODP_SHM_NULL, params);
 
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 03f2419..4211e22 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -399,10 +399,10 @@ void ipsec_init_pre(void)
}
 
/* Create output buffer pool */
-   params.buf.size  = SHM_OUT_POOL_BUF_SIZE;
-   params.buf.align = 0;
-   params.buf.num   = SHM_PKT_POOL_BUF_COUNT;
-   params.type  = ODP_POOL_PACKET;
+   params.pkt.seg_len   = SHM_OUT_POOL_BUF_SIZE;
+   params.pkt.seg_align = 0;
+   params.pkt.seg_num   = SHM_PKT_POOL_BUF_COUNT;
+   params.type  = ODP_POOL_PACKET;
 
out_pool = odp_pool_create(out_pool, ODP_SHM_NULL, params);
 
@@ -1252,10 +1252,10 @@ main(int argc, char *argv[])
odp_barrier_init(sync_barrier, num_workers);
 
/* Create packet buffer pool */
-   params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
-   params.buf.align = 0;
-   params.buf.num   = SHM_PKT_POOL_BUF_COUNT;
-   params.type  = ODP_POOL_PACKET;
+   params.pkt.seg_len   = SHM_PKT_POOL_BUF_SIZE;
+   params.pkt.seg_align = 0;
+   params.pkt.seg_num   = SHM_PKT_POOL_BUF_COUNT;
+   params.type  = ODP_POOL_PACKET;
 
pkt_pool = odp_pool_create(packet_pool, ODP_SHM_NULL,
  params);
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 7a520fb..6e07738 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -354,10 +354,10 @@ int main(int argc, char *argv[])
}
 
/* Create packet pool */
-   params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
-   params.buf.align = 0;
-   params.buf.num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
-   params.type  = ODP_POOL_PACKET;
+   params.pkt.seg_len   = SHM_PKT_POOL_BUF_SIZE;
+   params.pkt.seg_align = 0;
+   params.pkt.seg_num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+   params.type  = ODP_POOL_PACKET;
 
pool = odp_pool_create(packet pool, ODP_SHM_NULL, params);
 
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 28ed98c..b3e6cd7 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -331,10 +331,10 @@ int main(int argc, char *argv[])
printf(cpu mask:   %s\n, cpumaskstr);
 
/* Create packet pool */
-   params.buf.size  = SHM_PKT_POOL_BUF_SIZE;
-   params.buf.align = 0;
-   params.buf.num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
-   params.type  = ODP_POOL_PACKET;
+   params.pkt.seg_len   = SHM_PKT_POOL_BUF_SIZE;
+   params.pkt.seg_align = 0;
+   params.pkt.seg_num   = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+   params.type  = ODP_POOL_PACKET;
 
pool = odp_pool_create(packet_pool, ODP_SHM_NULL, params);
 
diff --git a/platform/linux-generic/odp_buffer_pool.c 
b/platform/linux-generic/odp_buffer_pool.c
index 3e13e6f..6f2f79e 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -126,7 +126,7 @@ odp_pool_t odp_pool_create(const char *name,
return ODP_POOL_INVALID;
 
/* Restriction for v1.0: All non-packet buffers are unsegmented */
-   

[lng-odp] [PATCH v2 3/3] api: config: Renamed ODP_CONFIG_PACKET_BUF_LEN_MIN

2015-02-03 Thread Petri Savolainen
Renamed ODP_CONFIG_PACKET_BUF_LEN_MIN to ODP_CONFIG_PACKET_SEG_LEN_MIN.
The packet pool parameter pkt.seg_len is rounded up into this value.

Added ODP_CONFIG_PACKET_SEG_LEN_MAX to define the maximum segment
length supported by the implementation. This is the maximum valid
value for pkt.seg_len.

If ODP_CONFIG_PACKET_SEG_LEN_MIN equals _SEG_LEN_MAX, the
implementation supports only one segment length value.

Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
---
 include/odp/api/config.h | 20 +++-
 platform/linux-generic/include/odp_buffer_internal.h | 12 ++--
 platform/linux-generic/odp_buffer_pool.c |  4 ++--
 test/validation/buffer/odp_packet_test.c |  2 +-
 4 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 3529fca..339b7b5 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -92,9 +92,9 @@ extern C {
 /**
  * Minimum packet segment length
  *
- * This defines the minimum packet segment length in bytes. The user defined
- * buffer size (in odp_buffer_pool_param_t) in buffer pool creation will be
- * rounded up into this value.
+ * This defines the minimum packet segment buffer length in bytes. The user
+ * defined segment length (seg_len in odp_pool_param_t) will be rounded up into
+ * this value.
  *
  * @internal In linux-generic implementation:
  * - The value MUST be a multiple of 8.
@@ -103,7 +103,17 @@ extern C {
  *   with the default headroom shown above and is a multiple of both 64 and 
128,
  *   which are the most common cache line sizes.
  */
-#define ODP_CONFIG_PACKET_BUF_LEN_MIN (1664)
+#define ODP_CONFIG_PACKET_SEG_LEN_MIN (1664)
+
+/**
+ * Maximum packet segment length
+ *
+ * This defines the maximum packet segment buffer length in bytes. The user
+ * defined segment length (seg_len in odp_pool_param_t) must not be larger than
+ * this.
+ *
+ */
+#define ODP_CONFIG_PACKET_SEG_LEN_MAX ODP_CONFIG_PACKET_SEG_LEN_MIN
 
 /**
  * Maximum packet buffer length
@@ -117,7 +127,7 @@ extern C {
  * - The value MUST be an integral number of segments
  * - The value SHOULD be large enough to accommodate jumbo packets (9K)
  */
-#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_BUF_LEN_MIN*6)
+#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index b3137a7..b38ade6 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -50,18 +50,18 @@ extern C {
((x) = 65536 ? 16 : \
 (0/0)
 
-_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_BUF_LEN_MIN = 256,
- ODP Segment size must be a minimum of 256 bytes);
+_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN = 256,
+  ODP Segment size must be a minimum of 256 bytes);
 
-_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MIN % ODP_CACHE_LINE_SIZE) == 0,
- ODP Segment size must be a multiple of cache line size);
+_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_SEG_LEN_MIN % ODP_CACHE_LINE_SIZE) == 0,
+  ODP Segment size must be a multiple of cache line size);
 
 _ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX %
-  ODP_CONFIG_PACKET_BUF_LEN_MIN) == 0,
+  ODP_CONFIG_PACKET_SEG_LEN_MIN) == 0,
  Packet max size must be a multiple of segment size);
 
 #define ODP_BUFFER_MAX_SEG \
-   (ODP_CONFIG_PACKET_BUF_LEN_MAX / ODP_CONFIG_PACKET_BUF_LEN_MIN)
+   (ODP_CONFIG_PACKET_BUF_LEN_MAX / ODP_CONFIG_PACKET_SEG_LEN_MIN)
 
 /* We can optimize storage of small raw buffers within metadata area */
 #define ODP_MAX_INLINE_BUF ((sizeof(void *)) * (ODP_BUFFER_MAX_SEG - 1))
diff --git a/platform/linux-generic/odp_buffer_pool.c 
b/platform/linux-generic/odp_buffer_pool.c
index 6f2f79e..ffbfb6e 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -182,7 +182,7 @@ odp_pool_t odp_pool_create(const char *name,
else
blk_size = ODP_ALIGN_ROUNDUP(
headroom + params-pkt.seg_len + tailroom,
-   ODP_CONFIG_PACKET_BUF_LEN_MIN);
+   ODP_CONFIG_PACKET_SEG_LEN_MIN);
 
buf_stride = params-type == ODP_POOL_PACKET ?
sizeof(odp_packet_hdr_stride) :
@@ -284,7 +284,7 @@ odp_pool_t odp_pool_create(const char *name,
pool-s.flags.unsegmented = unseg;
pool-s.flags.zeroized = zeroized;
pool-s.seg_size = unseg ?
-   blk_size : ODP_CONFIG_PACKET_BUF_LEN_MIN;
+   blk_size : ODP_CONFIG_PACKET_SEG_LEN_MIN;
 
 
uint8_t *block_base_addr = pool-s.pool_base_addr;
diff 

[lng-odp] [PATCH] api: packet_flags: Removed odp_packet_override_l4_chksum

2015-02-03 Thread Petri Savolainen
This is currently the only output side packet flag. It's removed
now and re-defined later with all other output side control flags.

Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
---
 include/odp/api/packet_flags.h| 7 ---
 platform/linux-generic/odp_packet_flags.c | 7 ---
 test/validation/buffer/odp_packet_test.c  | 7 ---
 3 files changed, 21 deletions(-)

diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h
index df1486b..f864bba 100644
--- a/include/odp/api/packet_flags.h
+++ b/include/odp/api/packet_flags.h
@@ -174,13 +174,6 @@ int odp_packet_has_sctp(odp_packet_t pkt);
 int odp_packet_has_icmp(odp_packet_t pkt);
 
 /**
- * Request L4 checksum calculation
- *
- * @param pkt Packet handle
- */
-void odp_packet_override_l4_chksum(odp_packet_t pkt);
-
-/**
  * Set flag for L2 header, e.g. ethernet
  *
  * @param pkt Packet handle
diff --git a/platform/linux-generic/odp_packet_flags.c 
b/platform/linux-generic/odp_packet_flags.c
index f2ef61d..ab3d12f 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -100,13 +100,6 @@ int odp_packet_has_icmp(odp_packet_t pkt)
return odp_packet_hdr(pkt)-input_flags.icmp;
 }
 
-/* Set Output Flags */
-
-void odp_packet_override_l4_chksum(odp_packet_t pkt)
-{
-   odp_packet_hdr(pkt)-output_flags.l4_chksum = 1;
-}
-
 /* Set Input Flags */
 
 void odp_packet_has_l2_set(odp_packet_t pkt, int val)
diff --git a/test/validation/buffer/odp_packet_test.c 
b/test/validation/buffer/odp_packet_test.c
index 0a5d32e..b8995f7 100644
--- a/test/validation/buffer/odp_packet_test.c
+++ b/test/validation/buffer/odp_packet_test.c
@@ -443,12 +443,6 @@ static void packet_error_flags(void)
CU_ASSERT(err == 0 || err == 1);
 }
 
-static void packet_out_flags(void)
-{
-   odp_packet_override_l4_chksum(test_packet);
-   CU_PASS(Current API doesn't return any error code\n);
-}
-
 struct packet_metadata {
uint32_t l2_off;
uint32_t l3_off;
@@ -659,7 +653,6 @@ CU_TestInfo packet_tests[] = {
_CU_TEST_INFO(packet_segments),
_CU_TEST_INFO(packet_segment_last),
_CU_TEST_INFO(packet_in_flags),
-   _CU_TEST_INFO(packet_out_flags),
_CU_TEST_INFO(packet_error_flags),
_CU_TEST_INFO(packet_add_rem_data),
_CU_TEST_INFO(packet_copy),
-- 
2.2.2


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


Re: [lng-odp] [PATCH v2] validation: init: split cases into executables

2015-02-03 Thread Taras Kondratiuk

On 02/03/2015 03:12 PM, Maxim Uvarov wrote:

Patch applied with small correction.

You deleted odp_classification from the list which is obvious error, no
need to do that.


Hmm. Where is it removed?


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


Re: [lng-odp] [PATCH v2 0/5] Add replaceable odp abort mechanism

2015-02-03 Thread Taras Kondratiuk

On 02/03/2015 01:35 PM, Mike Holmes wrote:

v2 just splits the test out to its own executable, forcing an abort is a problem
but the replace mechanism is tested

Mike Holmes (5):
   api: odp_hints: Add ODP_NORETURN
   api: abort: add weak replacement for abort
   api: abort: use globaly stored abort function
   api: init_global: allow abort fn to be overidden
   validation: init: add test for replace abort


For a whole series:
Reviewed-by: Taras Kondratiuk taras.kondrat...@linaro.org

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


Re: [lng-odp] [PATCH 2/2] api: random: Renamed odp_hw_random_get

2015-02-03 Thread Bill Fischofer
This patch should require Robbie's review since these APIs originated from
the crypto design sprint.  I agree with Ola that it is unnecessary.

The reason hw is specified here is that cryptographically you have two
different types of randoms.  HW randoms are used for seed values which is
why in the original spec we called out two different random number
functions:

odp_hw_random_get() - Gets true randoms for seed values
odp_drbg_random_get() - Deterministic Random Bit Generator needed for NIST
compliance

The latter isn't part of ODP v1.0 but probably should be part of v1.1.


On Tue, Feb 3, 2015 at 8:12 AM, Ola Liljedahl ola.liljed...@linaro.org
wrote:

 On 3 February 2015 at 14:44, Petri Savolainen
 petri.savolai...@linaro.org wrote:
  Renamed odp_hw_random_get() to odp_random_data(). Random
  number API is now separated from crypto API.
 Why is this separation desired?
 Cryptographically strong random number generation can be considered a
 natural part of the cryptography API.

 Applications are supposed to include odp.h and will get all ODP
 definitions regardless.

 Who benefits?

 -- Ola

 
  Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
  ---
   example/ipsec/odp_ipsec_cache.c  |  2 +-
   include/odp/api/crypto.h | 14 --
   platform/linux-generic/odp_crypto.c  |  3 ++-
   test/validation/crypto/odp_crypto_test_rng.c |  2 +-
   4 files changed, 4 insertions(+), 17 deletions(-)
 
  diff --git a/example/ipsec/odp_ipsec_cache.c
 b/example/ipsec/odp_ipsec_cache.c
  index 904e7b6..5e128c5 100644
  --- a/example/ipsec/odp_ipsec_cache.c
  +++ b/example/ipsec/odp_ipsec_cache.c
  @@ -98,7 +98,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
  if (params.iv.length) {
  size_t size = params.iv.length;
 
  -   odp_hw_random_get(params.iv.data, size, 1);
  +   odp_random_data(params.iv.data, size, 1);
  }
 
  /* Synchronous session create for now */
  diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
  index 545c1a5..aad6bd9 100644
  --- a/include/odp/api/crypto.h
  +++ b/include/odp/api/crypto.h
  @@ -330,20 +330,6 @@ odp_crypto_compl_result(odp_crypto_compl_t
 completion_event,
  odp_crypto_op_result_t *result);
 
   /**
  - * Generate random byte string
  - *
  - * @param buf  Pointer to store result
  - * @param len  Pointer to input length value as well as return
 value
  - * @param use_entropy  Use entropy
  - *
  - * @todo Define the implication of the use_entropy parameter
  - *
  - * @return 0 if succesful
  - */
  -int
  -odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
  -
  -/**
* @}
*/
 
  diff --git a/platform/linux-generic/odp_crypto.c
 b/platform/linux-generic/odp_crypto.c
  index 46766fa..de60157 100644
  --- a/platform/linux-generic/odp_crypto.c
  +++ b/platform/linux-generic/odp_crypto.c
  @@ -15,6 +15,7 @@
   #include odp_crypto_internal.h
   #include odp_debug_internal.h
   #include odp/hints.h
  +#include odp/random.h
   #include odp_packet_internal.h
 
   #include string.h
  @@ -447,7 +448,7 @@ odp_crypto_init_global(void)
   }
 
   int
  -odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy
 ODP_UNUSED)
  +odp_random_data(uint8_t *buf, size_t *len, odp_bool_t use_entropy
 ODP_UNUSED)
   {
  int rc;
  rc = RAND_bytes(buf, *len);
  diff --git a/test/validation/crypto/odp_crypto_test_rng.c
 b/test/validation/crypto/odp_crypto_test_rng.c
  index 458f908..b6313f0 100644
  --- a/test/validation/crypto/odp_crypto_test_rng.c
  +++ b/test/validation/crypto/odp_crypto_test_rng.c
  @@ -19,7 +19,7 @@ static void rng_get_size(void)
  size_t len = TDES_CBC_IV_LEN;
  uint8_t buf[TDES_CBC_IV_LEN];
 
  -   ret = odp_hw_random_get(buf, len, false);
  +   ret = odp_random_data(buf, len, false);
  CU_ASSERT(!ret);
  CU_ASSERT(len == TDES_CBC_IV_LEN);
   }
  --
  2.2.2
 
 
  ___
  lng-odp mailing list
  lng-odp@lists.linaro.org
  http://lists.linaro.org/mailman/listinfo/lng-odp

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

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


Re: [lng-odp] [PATCH 1/2] api: random: Added random.h

2015-02-03 Thread Bill Fischofer
See previous comment.  Not relevant to v1.0 and in any event should require
Robbie's review.

On Tue, Feb 3, 2015 at 7:44 AM, Petri Savolainen 
petri.savolai...@linaro.org wrote:

 Added random number API. The only API call is moved and
 renamed from crypto.h.

 Signed-off-by: Petri Savolainen petri.savolai...@linaro.org
 ---
  include/odp.h   |  1 +
  include/odp/api/random.h| 48
 +
  platform/linux-generic/Makefile.am  |  2 ++
  platform/linux-generic/include/odp/random.h | 34 
  4 files changed, 85 insertions(+)
  create mode 100644 include/odp/api/random.h
  create mode 100644 platform/linux-generic/include/odp/random.h

 diff --git a/include/odp.h b/include/odp.h
 index 30bed8e..139abdf 100644
 --- a/include/odp.h
 +++ b/include/odp.h
 @@ -50,6 +50,7 @@ extern C {
  #include odp/classification.h
  #include odp/rwlock.h
  #include odp/event.h
 +#include odp/random.h

  #ifdef __cplusplus
  }
 diff --git a/include/odp/api/random.h b/include/odp/api/random.h
 new file mode 100644
 index 000..65acdb3
 --- /dev/null
 +++ b/include/odp/api/random.h
 @@ -0,0 +1,48 @@
 +/* Copyright (c) 2015, Linaro Limited
 + * All rights reserved.
 + *
 + * SPDX-License-Identifier: BSD-3-Clause
 + */
 +
 +
 +/**
 + * @file
 + *
 + * ODP random number API
 + */
 +
 +#ifndef ODP_RANDOM_H_
 +#define ODP_RANDOM_H_
 +
 +#ifdef __cplusplus
 +extern C {
 +#endif
 +
 +/** @defgroup odp_random ODP RANDOM
 + *  @{
 + */
 +
 +
 +/**
 + * Generate random byte string
 + *
 + * @param buf  Pointer to store result
 + * @param len  Pointer to input length value as well as return
 value
 + * @param use_entropy  Use entropy
 + *
 + * @todo Define the implication of the use_entropy parameter
 + *
 + * @return 0 if succesful
 + */
 +int odp_random_data(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
 +
 +
 +/**
 + * @}
 + */
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
 +#endif
 diff --git a/platform/linux-generic/Makefile.am
 b/platform/linux-generic/Makefile.am
 index addb5ec..935dd24 100644
 --- a/platform/linux-generic/Makefile.am
 +++ b/platform/linux-generic/Makefile.am
 @@ -29,6 +29,7 @@ odpinclude_HEADERS = \

 $(top_srcdir)/platform/linux-generic/include/odp/packet_io.h \
   $(top_srcdir)/platform/linux-generic/include/odp/pool.h \
   $(top_srcdir)/platform/linux-generic/include/odp/queue.h
 \
 +
  $(top_srcdir)/platform/linux-generic/include/odp/random.h \

 $(top_srcdir)/platform/linux-generic/include/odp/rwlock.h \

 $(top_srcdir)/platform/linux-generic/include/odp/schedule.h \

 $(top_srcdir)/platform/linux-generic/include/odp/shared_memory.h \
 @@ -80,6 +81,7 @@ odpapiinclude_HEADERS = \
   $(top_srcdir)/include/odp/api/packet_io.h \
   $(top_srcdir)/include/odp/api/pool.h \
   $(top_srcdir)/include/odp/api/queue.h \
 + $(top_srcdir)/include/odp/api/random.h \
   $(top_srcdir)/include/odp/api/rwlock.h \
   $(top_srcdir)/include/odp/api/schedule.h \
   $(top_srcdir)/include/odp/api/shared_memory.h \
 diff --git a/platform/linux-generic/include/odp/random.h
 b/platform/linux-generic/include/odp/random.h
 new file mode 100644
 index 000..e9b4bd0
 --- /dev/null
 +++ b/platform/linux-generic/include/odp/random.h
 @@ -0,0 +1,34 @@
 +/* Copyright (c) 2015, Linaro Limited
 + * All rights reserved.
 + *
 + * SPDX-License-Identifier: BSD-3-Clause
 + */
 +
 +/**
 + * @file
 + *
 + * ODP random number API
 + */
 +
 +#ifndef ODP_PLAT_RANDOM_H_
 +#define ODP_PLAT_RANDOM_H_
 +
 +#ifdef __cplusplus
 +extern C {
 +#endif
 +
 +/** @ingroup odp_random ODP RANDOM
 + *  @{
 + */
 +
 +/**
 + * @}
 + */
 +
 +#include odp/api/random.h
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
 +#endif
 --
 2.2.2


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

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


Re: [lng-odp] [PATCH odp-ovs 0/5] odp-ovs fixes ODP v0.8

2015-02-03 Thread Zoltan Kiss

Acked and merged: Zoltan Kiss zoltan.k...@linaro.org

On 22/01/15 16:11, Ciprian Barbu wrote:

This patch series contains some fixes and workarounds for some problems found
while testing odp-ovs on keystone2 with ODP v0.8.

First two patches are required because of the changes introduced in upstream
OVS for PMD netdevs. In the general case that is about the DPDK netdev but ODP
is one for odp-ovs in particular.

Patches 3 and 4 are workarounds, proper solutions would involve many more
changes in OVS, maybe even modifying the API.

Ciprian Barbu (5):
   ofpbuf: init the buffer source before any other operations
   netdev-odp: add get_numa_id
   netdev-odp: workaround pmd threads reinitializing
   ovs-numa: workaround missing numa support for pmd netdevs
   utilities: remove dependency on kernel module for ODP netdev

  lib/dpif-netdev.c|  3 +++
  lib/netdev-odp.c | 14 ++
  lib/ofpbuf.c |  4 ++--
  lib/ovs-numa.c   | 24 +++-
  utilities/ovs-ctl.in | 10 ++
  5 files changed, 40 insertions(+), 15 deletions(-)



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


Re: [lng-odp] [PATCH odp-ovs 0/5] odp-ovs fixes ODP v0.8

2015-02-03 Thread Mike Holmes
On 3 February 2015 at 14:18, Zoltan Kiss zoltan.k...@linaro.org wrote:

 Acked and merged: Zoltan Kiss zoltan.k...@linaro.org

 On 22/01/15 16:11, Ciprian Barbu wrote:

 This patch series contains some fixes and workarounds for some problems
 found
 while testing odp-ovs on keystone2 with ODP v0.8.

 First two patches are required because of the changes introduced in
 upstream
 OVS for PMD netdevs. In the general case that is about the DPDK netdev
 but ODP
 is one for odp-ovs in particular.

 Patches 3 and 4 are workarounds, proper solutions would involve many more
 changes in OVS, maybe even modifying the API.



Do you mean workarounds to modifying ODPs APIs to better serve OVS needs ?
Can you capture the problems in that case we should suck in what you have
learnt to the next ODP cycle which is performance and usability in
production environments.




 Ciprian Barbu (5):
ofpbuf: init the buffer source before any other operations
netdev-odp: add get_numa_id
netdev-odp: workaround pmd threads reinitializing
ovs-numa: workaround missing numa support for pmd netdevs
utilities: remove dependency on kernel module for ODP netdev

   lib/dpif-netdev.c|  3 +++
   lib/netdev-odp.c | 14 ++
   lib/ofpbuf.c |  4 ++--
   lib/ovs-numa.c   | 24 +++-
   utilities/ovs-ctl.in | 10 ++
   5 files changed, 40 insertions(+), 15 deletions(-)


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




-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h

2015-02-03 Thread Mike Holmes
On 3 February 2015 at 17:10, Bill Fischofer bill.fischo...@linaro.org
wrote:

 My review simply says I'm happy with it.  Others can NAK it if they choose.

 On Tue, Feb 3, 2015 at 3:54 PM, Anders Roxell anders.rox...@linaro.org
 wrote:

 On 2015-02-03 11:16, Bill Fischofer wrote:
  For this series:
 
  Reviewed-by: Bill Fischofer bill.fischo...@linaro.org
 
  On Tue, Feb 3, 2015 at 5:25 AM, Savolainen, Petri (NSN - FI/Espoo) 
  petri.savolai...@nsn.com wrote:
 
  
  

 [...]

 + *
 + * CPU number where the thread is currently running. CPU
 numbering is
system
 + * specific.
 + *
 + * @return CPU number
 + */
 +int odp_cpu(void);
 Why not call thus function odp_cpu_num()? (or odp_cpu_number)?
 odp_cpu is missing something and does not lead to direct
 understanding of what the function does or returns.
   
I become odp_cpu_id() in the second patch.
Why not to name it like this in the first patch?
  
   I rebased the second commit (should have rebased the first). The
 commit
   history is not perfect, but I think we can live with that.

 Why do we think this is good enough when others have to redo their
 patches?


nack: I don't think it is ok to accept something when we know it is
incorrect.




 Cheers,
 Anders



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




-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv5 11/19] linux-generic: buffers: add strong typing support

2015-02-03 Thread Taras Kondratiuk
On 02/04/2015 12:42 AM, Mike Holmes wrote:
 
 
 On 3 February 2015 at 17:16, Taras Kondratiuk
 taras.kondrat...@linaro.org mailto:taras.kondrat...@linaro.org wrote:
 
 On 02/03/2015 11:50 PM, Bill Fischofer wrote:
  The changes here are to
  platform/linux-generic/include/odp/plat/type_types.h.  This is where
  the strong typing is actually implemented for each ODP type in
  linux-generic.  The converter functions are part of that implementation,
  and are also inlined for performance, which is why they are here.
 
  All other changes within each patch part are the modifications to other
  ODP files needed as a result of switching to strong typing for this
  type.  They are not separable since once strong typing is enabled for
  that type the code won't compile without these changes.
 
  The doxygen stuff is in the APIs which are in include/odp/api/*.h as you
  mention.  The main difference between v4 and v5 was to break out the API
  definition changes separately, which is why this has gone from 10 to 19
  parts.
 
  So it sounds like this is doing exactly what you suggest, no?
 
 As I've commented in the previous message it is OK, because these API
 are kind of exceptional. 
 
 
 I have no issue making an exception, but I don't yet grasp the reason
 why we make it, what do we gain by doing so ?

If some module need to use odp_buffer_t it is going to include
odp/plat/buffer_types.h. This module may need to print odp_buffer_t for
debug
purposes, so odp_buffer_to_u64() should be accessible.

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


Re: [lng-odp] [PATCHv2] api: fix odp_version_api_str()

2015-02-03 Thread Anders Roxell
On 2015-02-03 11:28, Mike Holmes wrote:
 On 3 February 2015 at 11:12, Maxim Uvarov maxim.uva...@linaro.org wrote:
 
  odp_version_api_str() has to be in API header while
  odp_version_impl_str() should be in linux-generic.
  That change fixes:
  https://bugs.linaro.org/show_bug.cgi?id=1194
 
  Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
 
 
 Reviewed-by: Mike Holmes mike.hol...@linaro.org
 
 Clears the new test case patch validation: add version string check
 which should be added as insurance against this bug in the future before
 closing the bug

I think we can drop static inline to the version string function,
because checking for a version string is not time critical right?

If we assume that its not time critical the diff below + Mikes validation
version string patch got it to pass and we hide more stuff from the
public doxygen clean API include/odp/api/*.h files.

Cheers,
Anders

$ git df
diff --git a/platform/linux-generic/include/odp/version.h 
b/platform/linux-generic/include/odp/version.h
index f29320a..2c557cc 100644
--- a/platform/linux-generic/include/odp/version.h
+++ b/platform/linux-generic/include/odp/version.h
@@ -23,11 +23,6 @@ extern C {
  *  @{
  */
 
-static inline const char *odp_version_api_str(void)
-{
-   return ODP_VERSION_API_STR;
-}
-
 /**
  * @}
  */
diff --git a/platform/linux-generic/odp_impl.c 
b/platform/linux-generic/odp_impl.c
index ca3224d..23ab12d 100644
--- a/platform/linux-generic/odp_impl.c
+++ b/platform/linux-generic/odp_impl.c
@@ -28,6 +28,11 @@ const char *odp_version_impl_str(void)
return ODP_VERSION_IMPL_STR;
 }
 
+const char *odp_version_api_str(void)
+{
+   return ODP_VERSION_API_STR;
+}
+
 #ifdef __cplusplus
 }
 #endif

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


Re: [lng-odp] [PATCHv5 11/19] linux-generic: buffers: add strong typing support

2015-02-03 Thread Mike Holmes
On 3 February 2015 at 17:28, Ola Liljedahl ola.liljed...@linaro.org wrote:

 On 3 February 2015 at 23:24, Taras Kondratiuk
 taras.kondrat...@linaro.org wrote:
  On 02/03/2015 11:57 PM, Ola Liljedahl wrote:
  The re-org has make it easier for the implementors of ODP.
  However, its a bit harder to follow the structure now maybe.
 
  static inline functions should go into:
  platform/linux-generic/include/odp/*.h
 
  and typedefs, defines, enums, and structs that are platform specific
  should go into:
  platform/linux-generic/include/odp/plat/*_types.h
  Me thinks there should be a couple more directory levels here. Why not
  repeat plat and platform a couple of times?
 
  'plat' is a header namespace to separate files after they are installed
  and keep destination directory organized.
  If you don't like the name please send a patch to rename it ;)
 Taras if there was a description of the complete ODP directory
 structure somewhere it would probably make sense.


+1 been trying to work it out so that at Connect we add such docs to the
correct place.



 
 

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




-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv5 11/19] linux-generic: buffers: add strong typing support

2015-02-03 Thread Mike Holmes
On 3 February 2015 at 17:16, Taras Kondratiuk taras.kondrat...@linaro.org
wrote:

 On 02/03/2015 11:50 PM, Bill Fischofer wrote:
  The changes here are to
  platform/linux-generic/include/odp/plat/type_types.h.  This is where
  the strong typing is actually implemented for each ODP type in
  linux-generic.  The converter functions are part of that implementation,
  and are also inlined for performance, which is why they are here.
 
  All other changes within each patch part are the modifications to other
  ODP files needed as a result of switching to strong typing for this
  type.  They are not separable since once strong typing is enabled for
  that type the code won't compile without these changes.
 
  The doxygen stuff is in the APIs which are in include/odp/api/*.h as you
  mention.  The main difference between v4 and v5 was to break out the API
  definition changes separately, which is why this has gone from 10 to 19
  parts.
 
  So it sounds like this is doing exactly what you suggest, no?

 As I've commented in the previous message it is OK, because these API
 are kind of exceptional.


I have no issue making an exception, but I don't yet grasp the reason why
we make it, what do we gain by doing so ?




 All other 'static inline' implementations
 should not be in *_types.h. That is not related to your series. Just a
 reminder.

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




-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4 6/6] validation: odp_timer.c: run at least one thread

2015-02-03 Thread Anders Roxell
On 2015-02-03 23:09, Ola Liljedahl wrote:
 On 3 February 2015 at 22:42, Anders Roxell anders.rox...@linaro.org wrote:
  On 2015-02-03 16:44, Ola Liljedahl wrote:
  Ensure we run at least one worker thread.
 
  Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org
 
  Reviewed-by: Anders Roxell anders.rox...@linaro.org
 Fabulous! Have you reviewed the whole patch set now (this was the last one)?
 
 If I had received all the review feedback from the start, I could have
 done one update and made the split into six separate patches then.

1. If everything is in one patch its hard to see everything and do a
   through review.
2. For this patch set I did send additional review comments on some patches a
   couple of versions ago and they didn't get addressed.

Cheers,
Anders

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


  1   2   >