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

2015-04-22 Thread Taras Kondratiuk

On 04/20/2015 02:04 PM, Taras Kondratiuk wrote:

On 04/17/2015 11:55 PM, Rosenboim, Leonid wrote:


Guys,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Thanks, Leo.
This exactly matches my understanding.

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



Hi guys,

Is there any additional comments/objections on this patch?
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2015-04-22 Thread Taras Kondratiuk

On 04/22/2015 04:39 PM, Radu-Andrei Bulie wrote:

Hi,

One question. The operation of linking a pmr to a port is performed by pmr 
creation function
by providing as src_cos the default port cos?


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


Re: [lng-odp] [PATCH] validation: odp_pool: add double destroy

2015-04-22 Thread Taras Kondratiuk

On 04/21/2015 10:14 PM, Mike Holmes wrote:

Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
  test/validation/odp_pool.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/test/validation/odp_pool.c b/test/validation/odp_pool.c
index 1a518a0..c2f9a1b 100644
--- a/test/validation/odp_pool.c
+++ b/test/validation/odp_pool.c
@@ -11,6 +11,30 @@ static int pool_name_number = 1;
  static const int default_buffer_size = 1500;
  static const int default_buffer_num = 1000;

+static void pool_double_destroy(void)
+{
+   odp_pool_param_t params = {
+   .buf = {
+   .size  = default_buffer_size,
+   .align = ODP_CACHE_LINE_SIZE,
+   .num   = default_buffer_num,
+   },
+   .type = ODP_POOL_BUFFER,
+   };
+   odp_pool_t pool;
+   char pool_name[ODP_POOL_NAME_LEN];
+
+   snprintf(pool_name, sizeof(pool_name),
+test_pool-%d, pool_name_number++);
+
+   pool = odp_pool_create(pool_name, ODP_SHM_INVALID, params);
+   CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
+   CU_ASSERT(odp_pool_to_u64(pool) !=
+ odp_pool_to_u64(ODP_POOL_INVALID));
+   CU_ASSERT(odp_pool_destroy(pool) == 0);
+   CU_ASSERT(odp_pool_destroy(pool)  0);


Is this an expected behavior? Do we have it documented somewhere?
I assume behavior should be undefined in this case. After pool is
destroyed its handle can't be used anymore.

This test is single-threaded, but assume that there is another thread
which created a pool with the same odp_pool_t handle just between
two odp_pool_destroy(pool) calls. A second odp_pool_destroy() will
destroy a new pool and return 0.
If you demand this behavior, then you effectively force implementation
to use generation-tagged handles.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2015-04-22 Thread Taras Kondratiuk

On 04/22/2015 12:39 AM, Mike Holmes wrote:

Code rules IMHO - the compiler will ensure we follow the rules.

Can we add test cases to prove the behavior across all platforms,
linux-generic being one of them, and thus the code is correct no matter
what is written anywhere else. Presumably the api documentation matches
the code but it should be updated and clarified to match the behavior
proven by the test cases.


We can't check ambiguous rules by compiler or tests.
IMO better to copy part of design document into classification.h to
clarify the behavior.



I do not think referencing the classification design document has any
value any more it is no longer a maintained document, however I
do recall as Bill says that we decided it was the applications
responsibility be unambiguous.


I agree it should be application responsibility. Implementation may 
assist here and throw an error in case it detects an ambiguous combination.

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


Re: [lng-odp] [PATCH] validation: odp_pool: add double destroy

2015-04-22 Thread Taras Kondratiuk

On 04/22/2015 02:29 PM, Mike Holmes wrote:



On 22 April 2015 at 07:26, Bill Fischofer bill.fischo...@linaro.org
mailto:bill.fischo...@linaro.org wrote:

Good points.  I agree it's better to leave this behavior undefined.


If that is consensus I will send a patch for the docs to add.

Deleting an already deleted pool results in unspecified behavior.


odp_pktio_t, odp_shm_t, etc also cannot be destroyed twice. I think it 
valid for any ODP handle.


I think it should be more generic.
Using an already destroyed ODP handle results in undefined behavior.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

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

Thanks, Leo.
This exactly matches my understanding.

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

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


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

2015-04-16 Thread Taras Kondratiuk

On 04/10/2015 06:52 PM, Bill Fischofer wrote:

Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
---
  include/odp/api/packet.h | 20 
  1 file changed, 20 insertions(+)

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index a31c54d..840e152 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -467,6 +467,26 @@ uint64_t odp_packet_user_u64(odp_packet_t pkt);
  void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx);

  /**
+ * Get address of user metadata associated with a packet
+ *
+ * @param pkt Packet handle
+ *
+ * @retval addr   Address of the user metadata associated with pkt
+ * @retval NULL   The packet has no user metadata.
+ */
+void *odp_packet_user_data(odp_packet_t pkt);
+
+/**
+ * Get size of user metadata associated with a packet
+ *
+ * @param pkt Packet handle
+ *
+ * @returnNumber of bytes of user metadata associated
+ *with pkt.
+ */
+uint32_t odp_packet_user_data_size(odp_packet_t pkt);
+
+/**
   * Layer 2 start pointer
   *
   * Returns pointer to the start of the layer 2 header. Optionally, outputs



I assume usage of user_data, user_ptr and user_u64 are all mutually
exclusive. I mean the same memory location can be used to store all of
them. It should be noted somewhere.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2015-04-16 Thread Taras Kondratiuk

On 04/10/2015 06:52 PM, Bill Fischofer wrote:

Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
---
  include/odp/api/pool.h | 4 
  1 file changed, 4 insertions(+)

diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
index 241b98a..0092132 100644
--- a/include/odp/api/pool.h
+++ b/include/odp/api/pool.h
@@ -76,6 +76,10 @@ typedef struct odp_pool_param_t {
 The maximum value is defined by
 ODP_CONFIG_PACKET_SEG_LEN_MAX.
 Use 0 for default. */
+   uint32_t udata_size; /** User metadata size in
+   bytes. Specify as 0 if no
+   user metadata is to be
+   associated with the pkt */


Should it be a minimum size of metadata? Implementation may round it up.


} pkt;
struct {
uint32_t num;/** Number of timeouts in the pool */



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


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

2015-04-16 Thread Taras Kondratiuk

On 04/16/2015 11:35 AM, Savolainen, Petri (Nokia - FI/Espoo) wrote:

If it stays I want it tested or it will rot like odp_shm has in this
very directory. To test it that probably means that helpers are
independently tested from the API so we need to find the correct
location for the test - maybe helpers need to be an independent library
to start with ?

You could create tests for helpers under “helper/test”.

Helpers are independent from ODP API (helpers may use ODP API, but ODP
API must not use helpers), but ODP tests suite and examples use those.
The purpose of helpers is to enable easy test applications creation and
maintenance (e.g. reuse the Ethernet header definition over all test
apps). Since test apps are under ODP repo, so should be helpers. Real
applications may or may not use helpers, but those should not expect
helpers to be HW accelerated or otherwise optimized.



Currently both ODP examples/tests and linux-generic platform uses
helpers. This prevents clear separation of helpers from implementation.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] checkpatch: allow strings split across lines

2015-04-16 Thread Taras Kondratiuk

On 04/16/2015 04:29 PM, Mike Holmes wrote:

We have an 80 char limit that is frequently an issue for strings and we
just accept that we ignore the warning.

Allow split strings so that there is a valid alternative
Thus the following example becomes a legal alternative to the  80 chars
warning.

printf(\nThread %u (id=%d core=%d) had %u sync_failures
 in %u iterations\n, thread_num,
.



The reason to have an exception for printed strings length is to have
them in one line to be searchable in a codebase.

In this example grep'ing for 'sync_failures in' won't find this string.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] checkpatch: allow strings split across lines

2015-04-16 Thread Taras Kondratiuk

On 04/16/2015 04:50 PM, Mike Holmes wrote:



On 16 April 2015 at 09:41, Taras Kondratiuk taras.kondrat...@linaro.org
mailto:taras.kondrat...@linaro.org wrote:

On 04/16/2015 04:29 PM, Mike Holmes wrote:

We have an 80 char limit that is frequently an issue for strings
and we
just accept that we ignore the warning.

Allow split strings so that there is a valid alternative
Thus the following example becomes a legal alternative to the 
80 chars
warning.

printf(\nThread %u (id=%d core=%d) had %u sync_failures
  in %u iterations\n, thread_num,
 .


The reason to have an exception for printed strings length is to have
them in one line to be searchable in a codebase.

In this example grep'ing for 'sync_failures in' won't find this string.


As with Google you just take a portion of the string if you really have
an issue.

I rarely include syntactic elements in a search, in the same way that if
you search for this string verbatim with he specific thread id, core and
number of failures set in the actual string seen on stdout you would not
find the code either.


I can't agree.
- As with Google the longer string you can specify the more precise
  results you will get.
- It is usually valid to assume that all numeric information in error
  message is not a part of format string, so you start search with
  substring which contains only words or you can wildcard numbers.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2015-04-15 Thread Taras Kondratiuk

On 04/15/2015 05:29 AM, Mike Holmes wrote:



On 14 April 2015 at 16:21, Maxim Uvarov maxim.uva...@linaro.org
mailto:maxim.uva...@linaro.org wrote:

On 04/14/15 22:59, Mike Holmes wrote:

The shm test is obsolte, remove it

Why is it obsolete?


A few reasons

It is never called and hence it is not maintained and it core dumps, I
dont know how many releases that has been true but it is now, but
fundamentally it is nowhere near as comprehensive a test as we have in
validation and so it is no longer necessary.

Additionally we need to move or delete everything in api_test becasue
that whole directory is obsolete. The only thing I plan to save is the
ring test which needs to migrate to validation and or the performance
test unless we transition the ring code inside Linux-generic as
suggested today.


Our validation tests should validate only ODP API.
Rings don't belong to API.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [RFC] api: classification: Create PMR handle on its application

2015-04-09 Thread Taras Kondratiuk



From: Taras Kondratiuk taras.kondrat...@linaro.org
Sent: Wednesday, April 8, 2015 3:47 AM
To: Rosenboim, Leonid; bala.manoha...@linaro.org
Cc: bill.fischo...@linaro.org; Taras Kondratiuk
Subject: [RFC] api: classification: Create PMR handle on its application

Current odp_pmr_t usage model has several issues:
1. The same PMR can be applied into different places in a classification
tree, but there is no way to modify each of its applications
separately. One can only destroy a rule completely which should
destroy all of its instances in a classification tree.
2. Initial intention behind odp_pmr_t was to abstarct a handle to some HW
resource which imlements a PMR. But on platforms I'm aware of a separate
HW resource should be allocated for each PRM application. So there is
no 1:1 mapping between odp_pmr_t and HW resource.
If odp_pmr_t doesn't map to HW resource directly, then it just
represent a PRM description. It is an entry in some PRM descriptions
'database' which impelemntation have to maintain for no good reason.

Creating odp_pmr_t handle as a result of a rule application (to pktio
or CoS) solves these issues.

Same is valid for odp_pmr_set_t. I still think that a separate
abstration for PMR sets is not needed, but it is preserved in the patch
to keep discussion focused.

Function order should be changed to be more logical, but I've kept an
initial order to minimize a size of diff for RFC.
---
  include/odp/api/classification.h | 137 +++
  1 file changed, 52 insertions(+), 85 deletions(-)

diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index 7db3645..04f9e60 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -184,8 +184,7 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in,

  /**
   * @typedef odp_pmr_t
- * PMR - Packet Matching Rule
- * Up to 32 bit of ternary matching of one of the available header fields
+ * Applied Packet Matching Rule (PMR) handle
   */

  /**
@@ -221,45 +220,6 @@ typedef enum odp_pmr_term {
  } odp_pmr_term_e;

  /**
- * Create a packet match rule with mask and value
- *
- * @param[in]  termOne of the enumerated values supported
- * @param[in]  val Value to match against the packet header
- * in native byte order.
- * @param[in]  maskMask to indicate which bits of the header
- * should be matched ('1') and
- * which should be ignored ('0')
- * @param[in]  val_sz  Size of the val and mask arguments,
- * that must match the value size requirement of the
- * specific term.
- *
- * @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,
-  const void *mask,
-  uint32_t val_sz);
-
-/**
- * Create a packet match rule with value range
- *
- * @param[in]  termOne of the enumerated values supported
- * @param[in]  val1Lower bound of the header field range.
- * @param[in]  val2Upper bound of the header field range.
- * @param[in]  val_sz  Size of the val1 and val2 arguments,
- * that must match the value size requirement of the
- * specific term.
- *
- * @return Handle of the matching rule
- * @retval ODP_PMR_INVAL on failure
- * @note: Range is inclusive [val1..val2].
- */
-odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
-  const void *val1,
-  const void *val2,
-  uint32_t val_sz);
-/**
   * Invalidate a packet match rule and vacate its resources
   *
   * @param[in]  pmr_id  Identifier of the PMR to be destroyed
@@ -272,28 +232,29 @@ int odp_pmr_destroy(odp_pmr_t pmr_id);
  /**
   * Apply a PMR to a pktio to assign a CoS.
   *
- * @param[in]  pmr_id  PMR to be activated
+ * @param[in]  match   Pointer to PMR description structure
   * @param[in]  src_pktio   pktio to which this PMR is to be applied
   * @param[in]  dst_cos CoS to be assigned by this PMR
   *
- * @retval 0 on success
- * @retval 0 on failure
+ * @return Handle of an applied PMR
+ * @retval ODP_PMR_INVALID on failure
   */
-int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
- odp_pktio_t src_pktio, odp_cos_t dst_cos);
+odp_pmr_t odp_pktio_pmr_cos(odp_pmr_match_t *match,
+   odp_pktio_t src_pktio, odp_cos_t dst_cos);

  /**
   * Cascade a PMR to refine packets from one CoS to another.
   *
- * @param[in]  pmr_id  PMR to be activated
+ * @param[in]  match   Pointer to PMR description structure
   * @param[in]  src_cos CoS to be filtered
   * @param[in]  dst_cos CoS

Re: [lng-odp] NO ODP API for Packet classification and Packet Shaping

2015-04-07 Thread Taras Kondratiuk

On 04/06/2015 07:41 PM, Bill Fischofer wrote:

I would call these pool groups for symmetry with queue groups and so
the API would be odp_pool_create_group(), odp_pool_destroy_group(), etc.


If it is called pool group, then it sounds like a separate
abstraction. Which in turn needs a separate type and new API functions
to destroy or attach to somewhere (pktio, CoS, etc.).
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [RFC 2/2] api: classification: remove odp_pmr_set_t

2015-04-02 Thread Taras Kondratiuk
);
+int odp_pmr_set_create(int num_terms, odp_pmr_match_t *terms,
+odp_pmr_t *pmr_set);



While I have confidence that several platforms should be capable supporting the 
single-PMR
abstraction that I originally proposed, I have doubts that many platforms will 
be able to implement
the PMR-set abstraction, and for this reason I prefer to keep them separate.
Of course if there is a platform that can support PMR-set, then it should be 
able to implement the single-PMR
as well.


An opposite statement is also true: if platform supports single PMRs
and their chaining, then it should be able to support PMR-sets.
Because each PMR-set can be represented as cascaded single PMRs with
intermediate CoS queues pointing to 'drop' queue (from your example).

If platform has some limitations then you can hit them either by
cascading single PMRs or creating PMR-sets. So I don't see how a
separate abstraction for PMR-set helps here.

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


[lng-odp] [PATCH 2/2] validation: crypto: combine sync and async tests

2015-03-18 Thread Taras Kondratiuk
Sync and Async crypto tests are almost identical and have a lot
duplicated code.
Move unique configuration into testsuite's init function and reuse Async
test code for both Sync and Async.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/Makefile.am|   3 +-
 ...ypto_test_async_inp.c = odp_crypto_test_inp.c} |  49 +++-
 ...ypto_test_async_inp.h = odp_crypto_test_inp.h} |   8 +-
 test/validation/crypto/odp_crypto_test_sync_inp.c  | 271 -
 test/validation/crypto/odp_crypto_test_sync_inp.h  |  17 --
 test/validation/odp_crypto.c   |   9 +-
 6 files changed, 50 insertions(+), 307 deletions(-)
 rename test/validation/crypto/{odp_crypto_test_async_inp.c = 
odp_crypto_test_inp.c} (90%)
 rename test/validation/crypto/{odp_crypto_test_async_inp.h = 
odp_crypto_test_inp.h} (62%)
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.c
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.h

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 0833181..9862c6b 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -42,8 +42,7 @@ dist_odp_classification_SOURCES = 
classification/odp_classification_tests.c \
classification/odp_classification_basic.c \
odp_classification.c $(ODP_CU_COMMON)
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
-dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
- crypto/odp_crypto_test_sync_inp.c \
+dist_odp_crypto_SOURCES = crypto/odp_crypto_test_inp.c \
  odp_crypto.c $(ODP_CU_COMMON)
 dist_odp_init_SOURCES  = odp_init.c
 dist_odp_init_abort_SOURCES = odp_init_abort.c
diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c 
b/test/validation/crypto/odp_crypto_test_inp.c
similarity index 90%
rename from test/validation/crypto/odp_crypto_test_async_inp.c
rename to test/validation/crypto/odp_crypto_test_inp.c
index 527e98a..5f688d6 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_inp.c
@@ -6,8 +6,16 @@
 
 #include odp.h
 #include CUnit/Basic.h
-#include CUnit/TestDB.h
 #include test_vectors.h
+#include odp_crypto_test_inp.h
+
+struct suite_context_s {
+   enum odp_crypto_op_mode pref_mode;
+   odp_pool_t pool;
+   odp_queue_t queue;
+};
+
+static struct suite_context_s suite_context;
 
 /* Basic algorithm run function for async inplace mode.
  * Creates a session from input parameters and runs one operation
@@ -38,21 +46,16 @@ static void alg_test(enum odp_crypto_op op,
odp_crypto_compl_t compl_event;
odp_crypto_op_result_t result;
 
-   odp_queue_t compl_queue = odp_queue_lookup(crypto-out);
-   CU_ASSERT(compl_queue != ODP_QUEUE_INVALID);
-   odp_pool_t pool = odp_pool_lookup(packet_pool);
-   CU_ASSERT(pool != ODP_POOL_INVALID);
-
/* Create a crypto session */
odp_crypto_session_params_t ses_params;
memset(ses_params, 0, sizeof(ses_params));
ses_params.op = op;
ses_params.auth_cipher_text = false;
-   ses_params.pref_mode = ODP_CRYPTO_ASYNC;
+   ses_params.pref_mode = suite_context.pref_mode;
ses_params.cipher_alg = cipher_alg;
ses_params.auth_alg = auth_alg;
-   ses_params.compl_queue = compl_queue;
-   ses_params.output_pool = pool;
+   ses_params.compl_queue = suite_context.queue;
+   ses_params.output_pool = suite_context.pool;
ses_params.cipher_key = cipher_key;
ses_params.iv = ses_iv;
ses_params.auth_key = auth_key;
@@ -64,7 +67,7 @@ static void alg_test(enum odp_crypto_op op,
  odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID));
 
/* Prepare input data */
-   odp_packet_t pkt = odp_packet_alloc(pool, input_vec_len);
+   odp_packet_t pkt = odp_packet_alloc(suite_context.pool, input_vec_len);
CU_ASSERT(pkt != ODP_PACKET_INVALID);
uint8_t *data_addr = odp_packet_data(pkt);
memcpy(data_addr, input_vec, input_vec_len);
@@ -295,7 +298,31 @@ static void alg_hmac_md5(void)
}
 }
 
-CU_TestInfo test_array_async[] = {
+int suite_sync_inp_init(void)
+{
+   suite_context.pool = odp_pool_lookup(packet_pool);
+   if (suite_context.pool == ODP_POOL_INVALID)
+   return -1;
+
+   suite_context.queue = ODP_QUEUE_INVALID;
+   suite_context.pref_mode = ODP_CRYPTO_SYNC;
+   return 0;
+}
+
+int suite_async_inp_init(void)
+{
+   suite_context.pool = odp_pool_lookup(packet_pool);
+   if (suite_context.pool == ODP_POOL_INVALID)
+   return -1;
+   suite_context.queue = odp_queue_lookup(crypto-out);
+   if (suite_context.queue == ODP_QUEUE_INVALID)
+   return -1;
+
+   suite_context.pref_mode = ODP_CRYPTO_ASYNC;
+   return 0;
+}
+
+CU_TestInfo test_array_inp

[lng-odp] [PATCH 0/2] validation: crypto: remove code duplication

2015-03-18 Thread Taras Kondratiuk
Current crypto tests have a few issues:
- Asynchronous tests assume that operation is always executed asynchronously,
  but specification does not demand it. So tests have to handle synchronous
  operations as well. 
- If the first issue is solved, then Sync test is a subset of Async -
  they can be merged.

The same approach should allow to easily add tests for 'out of place'
operations.

Taras Kondratiuk (2):
  validation: crypto: handle synchronous operations in async test
  validation: crypto: combine sync and async tests

 test/validation/Makefile.am|   3 +-
 ...ypto_test_async_inp.c = odp_crypto_test_inp.c} |  74 --
 ...ypto_test_async_inp.h = odp_crypto_test_inp.h} |   8 +-
 test/validation/crypto/odp_crypto_test_sync_inp.c  | 271 -
 test/validation/crypto/odp_crypto_test_sync_inp.h  |  17 --
 test/validation/odp_crypto.c   |   9 +-
 6 files changed, 63 insertions(+), 319 deletions(-)
 rename test/validation/crypto/{odp_crypto_test_async_inp.c = 
odp_crypto_test_inp.c} (85%)
 rename test/validation/crypto/{odp_crypto_test_async_inp.h = 
odp_crypto_test_inp.h} (62%)
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.c
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.h

-- 
1.9.1


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


[lng-odp] [PATCH 1/2] validation: crypto: handle synchronous operations in async test

2015-03-18 Thread Taras Kondratiuk
Current API can't force crypto operation to be strictly sync or async.
Hence test should handle synchronous operation even if 'pref_mode' is
set to ODP_CRYPTO_ASYNC.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/crypto/odp_crypto_test_async_inp.c | 27 +++---
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c 
b/test/validation/crypto/odp_crypto_test_async_inp.c
index feefd49..527e98a 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_async_inp.c
@@ -92,23 +92,24 @@ static void alg_test(enum odp_crypto_op op,
CU_FAIL(%s : not implemented for combined alg mode\n);
}
 
-   rc = odp_crypto_operation(op_params, posted, NULL);
+   rc = odp_crypto_operation(op_params, posted, result);
if (rc  0) {
CU_FAIL(Failed odp_crypto_operation());
goto cleanup;
}
-   CU_ASSERT(posted);
-
-   /* Poll completion queue for results */
-   do {
-   event = odp_queue_deq(compl_queue);
-   } while (event == ODP_EVENT_INVALID);
-
-   compl_event = odp_crypto_compl_from_event(event);
-   CU_ASSERT(odp_crypto_compl_to_u64(compl_event) ==
- odp_crypto_compl_to_u64(odp_crypto_compl_from_event(event)));
-   odp_crypto_compl_result(compl_event, result);
-   odp_crypto_compl_free(compl_event);
+
+   if (posted) {
+   /* Poll completion queue for results */
+   do {
+   event = odp_queue_deq(suite_context.queue);
+   } while (event == ODP_EVENT_INVALID);
+
+   compl_event = odp_crypto_compl_from_event(event);
+   CU_ASSERT(odp_crypto_compl_to_u64(compl_event) ==
+ 
odp_crypto_compl_to_u64(odp_crypto_compl_from_event(event)));
+   odp_crypto_compl_result(compl_event, result);
+   odp_crypto_compl_free(compl_event);
+   }
 
CU_ASSERT(result.ok);
CU_ASSERT(result.pkt == pkt);
-- 
1.9.1


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


Re: [lng-odp] odp_cpu_count() vs odp_cpumask size

2015-03-12 Thread Taras Kondratiuk

On 03/12/2015 12:03 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: ext Taras Kondratiuk [mailto:taras.kondrat...@linaro.org]
Sent: Wednesday, March 11, 2015 5:18 PM
To: Savolainen, Petri (Nokia - FI/Espoo); ext Christophe Milard; lng-
o...@lists.linaro.org
Subject: Re: [lng-odp] odp_cpu_count() vs odp_cpumask size

On 03/11/2015 04:46 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Continuation of cpumask discussion on the call... For creating arbitrary
masks (e.g. fill in a mask with CPU ids of another ODP program in the
system, or testing all possible mask bits), we may need two more calls:

/**

* @return Maximum number of CPUs a mask can hold

*/

int odp_cpumask_max_cpus(void)

/**

   * Set all CPUs in the mask

   *

   * After the call, the mask has odp_cpumask_max_cpus() CPUs set.

* @note CPU numbering may not be contiguous.

*/

void odp_cpumask_setall(odp_cpumask_t *mask)

-Petri

*From:*lng-odp-boun...@lists.linaro.org
[mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of *ext Savolainen,
Petri (Nokia - FI/Espoo)
*Sent:* Wednesday, March 11, 2015 2:09 PM
*To:* ext Christophe Milard; lng-odp@lists.linaro.org
*Subject:* Re: [lng-odp] odp_cpu_count() vs odp_cpumask size

Actually, this is equal to odp_cpu_max():

odp_cpumask_t mask;

odp_cpu_mask(mask)

odp_cpumask_last(mask)

So maybe odp_cpu_mask() is only new thing we need.


Hi Petri

It is not clear to me why do we need odp_cpu_* and odp_cpumask_* API.

They are used now to create threads and set CPU affinity. But this is
done by ODP helpers, because it is out of ODP scope. Shouldn't 'cpu' and
'cpumask' be a part of helpers too?


The original idea was to use cpumask in definition of odp_schedule_group_t 
(still on todo list). I need go through that use case and see if e.g. a thread 
mask would work instead.


Currently cpumask is used for 'real' CPUs, but IMO scheduler group
should operate on thread IDs instead.



E.g. odp_cpu_id() is good for debugging (e.g. that thread pinning is working).



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


Re: [lng-odp] odp_cpu_count() vs odp_cpumask size

2015-03-11 Thread Taras Kondratiuk

On 03/11/2015 04:46 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Continuation of cpumask discussion on the call… For creating arbitrary
masks (e.g. fill in a mask with CPU ids of another ODP program in the
system, or testing all possible mask bits), we may need two more calls:

/**

* @return Maximum number of CPUs a mask can hold

*/

int odp_cpumask_max_cpus(void)

/**

  * Set all CPUs in the mask

  *

  * After the call, the mask has odp_cpumask_max_cpus() CPUs set.

   * @note CPU numbering may not be contiguous.

*/

void odp_cpumask_setall(odp_cpumask_t *mask)

-Petri

*From:*lng-odp-boun...@lists.linaro.org
[mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of *ext Savolainen,
Petri (Nokia - FI/Espoo)
*Sent:* Wednesday, March 11, 2015 2:09 PM
*To:* ext Christophe Milard; lng-odp@lists.linaro.org
*Subject:* Re: [lng-odp] odp_cpu_count() vs odp_cpumask size

Actually, this is equal to odp_cpu_max():

odp_cpumask_t mask;

odp_cpu_mask(mask)

odp_cpumask_last(mask)

So maybe odp_cpu_mask() is only new thing we need.


Hi Petri

It is not clear to me why do we need odp_cpu_* and odp_cpumask_* API.

They are used now to create threads and set CPU affinity. But this is
done by ODP helpers, because it is out of ODP scope. Shouldn't 'cpu' and
'cpumask' be a part of helpers too?

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


Re: [lng-odp] proto flags set functions

2015-03-11 Thread Taras Kondratiuk

On 03/11/2015 10:37 AM, Radu-Andrei Bulie wrote:

Hi,

Regarding the functions that set the proto flags (e.g
*odp_packet_has_xx_set*) isn’t more

suitable not to pass an int value as second parameter,  in fact not to
have any parameter at all because

howsoever inside the function we have some bit fields, and setting
protos would mean just shifting

value 1 on different positions (depending on implementation)?

The input param value may not translate

to a correct value so inside,  the implementation will make assumption
that anyway there is a value of 1 or 0.

What I mean to say is that the value of the second param is not relevant
for the user (only the result – that will set a specific proto);

He does not need to know a proper value that should be passed to enable
a specific proto


Second parameter should be of type odp_bool_t to make it clear.

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


[lng-odp] [KEYSTONE2 PATCH 13/15] linux-ks2: Add shared resources handling

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |   2 +
 .../include/odp/plat/shared_resource.h | 150 +
 platform/linux-keystone2/odp_shr.c | 179 +
 3 files changed, 331 insertions(+)
 create mode 100644 platform/linux-keystone2/include/odp/plat/shared_resource.h
 create mode 100644 platform/linux-keystone2/odp_shr.c

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index 282f406..f3d8471 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -67,6 +67,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/packet_types.h \
  $(srcdir)/include/odp/plat/pool_types.h \
  $(srcdir)/include/odp/plat/queue_types.h \
+ $(srcdir)/include/odp/plat/shared_resource.h \
  $(srcdir)/include/odp/plat/state.h \
  $(srcdir)/include/odp/plat/ti_mcsdk.h \
  $(linux_generic_srcdir)/include/odp/plat/atomic_types.h \
@@ -140,6 +141,7 @@ __LIB__libodp_la_SOURCES = \
   mcsdk/mcsdk_navig.c \
   mcsdk/mcsdk_rmclient.c \
   mcsdk/sockutils.c \
+  odp_shr.c \
   ../linux-generic/odp_barrier.c \
   ../linux-generic/odp_cpumask.c \
   ../linux-generic/odp_errno.c \
diff --git a/platform/linux-keystone2/include/odp/plat/shared_resource.h 
b/platform/linux-keystone2/include/odp/plat/shared_resource.h
new file mode 100644
index 000..12893be
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/plat/shared_resource.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2015, Linaro Limited
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_SHM_TABLE_H_
+#define ODP_PLAT_SHM_TABLE_H_
+
+#include odp/spinlock.h
+#include odp_debug_internal.h
+
+typedef struct entry_head {
+   struct entry_head *next;
+   uint16_t id;
+   odp_spinlock_t lock;
+   bool allocated;
+} odp_shr_head_t;
+
+typedef struct odp_shr_table_s {
+   struct entry_head *top_free;
+   odp_spinlock_t lock;
+   struct entry_head *base;
+   uint32_t entry_size;
+   uint32_t entry_num;
+} *odp_shr_table_t;
+
+/* Define typeof for C99 compatibility */
+#define typeof __typeof__
+
+#define ODP_SHR_TABLE_INVALID  ((odp_shr_table_t)NULL)
+
+odp_shr_table_t _odp_shr_table_create(const char *name,
+  uint32_t entry_size,
+  uint32_t entry_num,
+  uint32_t entry_align,
+  uint16_t head_offset);
+void odp_shr_table_destroy(odp_shr_table_t table);
+
+void odp_shr_table_lock(odp_shr_table_t table);
+void odp_shr_table_unlock(odp_shr_table_t table);
+odp_shr_head_t *_odp_shr_alloc_nolock(odp_shr_table_t table);
+odp_shr_head_t *_odp_shr_alloc(odp_shr_table_t table);
+void _odp_shr_free(odp_shr_table_t table, odp_shr_head_t *head);
+odp_shr_head_t *_odp_shr_next(odp_shr_table_t table, odp_shr_head_t *head);
+odp_shr_head_t *_odp_shr_first_allocated(odp_shr_table_t table);
+odp_shr_head_t *_odp_shr_next_allocated(odp_shr_table_t table,
+   odp_shr_head_t *head);
+
+static inline
+uint16_t _odp_shr_id(odp_shr_head_t *entry)
+{
+   ODP_ASSERT(entry, Bad entry);
+   return entry-id;
+}
+
+static inline
+uint32_t _odp_shr_table_num_entries(odp_shr_table_t table)
+{
+   ODP_ASSERT(table, Bad table);
+   return table-entry_num;
+}
+
+static inline
+uint32_t _odp_shr_size(odp_shr_table_t table)
+{
+   ODP_ASSERT(table, Bad table);
+   return table-entry_size;
+}
+
+static inline
+odp_shr_head_t *_odp_shr_from_id(odp_shr_table_t table, uint16_t id)
+{
+   ODP_ASSERT(table, Bad table);
+   ODP_ASSERT(id  table-entry_num, Wrong entry ID);
+   return (odp_shr_head_t *)((uintptr_t)table-base +
+ id * table-entry_size);
+}
+
+static inline
+bool _odp_shr_is_allocated(odp_shr_head_t *entry)
+{
+   ODP_ASSERT(entry, Bad entry);
+   return entry-allocated;
+}
+
+static inline
+void _odp_shr_lock(odp_shr_head_t *head)
+{
+   odp_spinlock_lock(head-lock);
+}
+
+static inline
+void _odp_shr_unlock(odp_shr_head_t *head)
+{
+   odp_spinlock_unlock(head-lock);
+}
+
+#define odp_shr(head, type) \
+   ({ typeof(head) __head = (head); \
+  (__head ? ODP_CONTAINEROF(__head, type, entry_head) : NULL);\
+   })
+
+#define odp_shr_from_id(table, id, type)\
+   odp_shr(_odp_shr_from_id(table, id), \
+   type)
+
+#define odp_shr_next(entry

[lng-odp] [KEYSTONE2 PATCH 09/15] linux-ks2: event: add headers

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |  4 +-
 platform/linux-keystone2/include/odp/event.h   | 67 ++
 .../linux-keystone2/include/odp/plat/event_types.h | 44 ++
 3 files changed, 113 insertions(+), 2 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp/event.h
 create mode 100644 platform/linux-keystone2/include/odp/plat/event_types.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index 296062b..69dd247 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -25,6 +25,7 @@ odpinclude_HEADERS = \
  $(srcdir)/include/odp/buffer.h \
  $(srcdir)/include/odp/buffer_pool.h \
  $(srcdir)/include/odp/crypto.h \
+ $(srcdir)/include/odp/event.h \
  $(srcdir)/include/odp/packet_io.h \
  $(srcdir)/include/odp/packet.h \
  $(linux_generic_srcdir)/include/odp/align.h \
@@ -37,7 +38,6 @@ odpinclude_HEADERS = \
  $(linux_generic_srcdir)/include/odp/cpumask.h \
  $(linux_generic_srcdir)/include/odp/debug.h \
  $(linux_generic_srcdir)/include/odp/errno.h \
- $(linux_generic_srcdir)/include/odp/event.h \
  $(linux_generic_srcdir)/include/odp/hints.h \
  $(linux_generic_srcdir)/include/odp/init.h \
  $(linux_generic_srcdir)/include/odp/random.h \
@@ -60,6 +60,7 @@ odpplatincludedir = $(includedir)/odp/plat
 odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/align.h \
  $(srcdir)/include/odp/plat/debug.h \
+ $(srcdir)/include/odp/plat/event_types.h \
  $(srcdir)/include/odp/plat/mcsdk_tune.h \
  $(srcdir)/include/odp/plat/osal.h \
  $(srcdir)/include/odp/plat/state.h \
@@ -70,7 +71,6 @@ odpplatinclude_HEADERS = \
  
$(linux_generic_srcdir)/include/odp/plat/classification_types.h \
  $(linux_generic_srcdir)/include/odp/plat/cpumask_types.h \
  $(linux_generic_srcdir)/include/odp/plat/crypto_types.h \
- $(linux_generic_srcdir)/include/odp/plat/event_types.h \
  $(linux_generic_srcdir)/include/odp/plat/packet_types.h \
  $(linux_generic_srcdir)/include/odp/plat/packet_io_types.h \
  $(linux_generic_srcdir)/include/odp/plat/pool_types.h \
diff --git a/platform/linux-keystone2/include/odp/event.h 
b/platform/linux-keystone2/include/odp/event.h
new file mode 100644
index 000..1233e92
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/event.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP event
+ */
+
+#ifndef ODP_EVENT_H_
+#define ODP_EVENT_H_
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include odp/plat/event_types.h
+#include odp/plat/osal.h
+
+/**
+ * @internal Convert ODP event to CPPI descriptor
+ *
+ * @param ev   Event handle
+ *
+ * @return CPPI descriptor
+ */
+static inline Cppi_HostDesc *_odp_ev_to_cppi_desc(odp_event_t ev)
+{
+   return (Cppi_HostDesc *)(uintptr_t)ev;
+}
+
+/**
+ * @internal Convert CPPI descriptor to ODP event
+ *
+ * @param desc  CPPI descriptor pointer
+ *
+ * @return ODP event handle
+ */
+static inline odp_event_t _cppi_desc_to_odp_ev(Cppi_HostDesc *desc)
+{
+   return (odp_event_t)desc;
+}
+
+/** @ingroup odp_event
+ *  @{
+ */
+
+static inline int odp_event_type(odp_event_t ev)
+{
+   Cppi_HostDesc *desc = _odp_ev_to_cppi_desc(ev);
+   return _cppi_desc_pkt_type(desc);
+}
+
+/**
+ * @}
+ */
+
+#include odp/api/event.h
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-keystone2/include/odp/plat/event_types.h 
b/platform/linux-keystone2/include/odp/plat/event_types.h
new file mode 100644
index 000..b14456a
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/plat/event_types.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP event types
+ */
+
+#ifndef ODP_PLAT_EVENT_TYPES_H_
+#define ODP_PLAT_EVENT_TYPES_H_
+
+#include odp/std_types.h
+#include odp/plat/strong_types.h
+
+/** @defgroup odp_event ODP EVENT
+ *  Operations on an event.
+ *  @{
+ */
+
+typedef odp_handle_t odp_event_t;
+
+#define ODP_EVENT_INVALID ((odp_event_t)0)
+
+#define ODP_EVENT_BUFFER 1
+#define ODP_EVENT_PACKET 2
+#define ODP_EVENT_TIMEOUT3
+#define ODP_EVENT_CRYPTO_COMPL   4
+
+/** Get printable format of odp_event_t */
+static inline uint64_t odp_event_to_u64(odp_event_t hdl)
+{
+   return _odp_pri(hdl

[lng-odp] [KEYSTONE2 PATCH 11/15] linux-ks2: packet: update module

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |   5 +-
 platform/linux-keystone2/include/odp.h |   2 +
 platform/linux-keystone2/include/odp/packet.h  | 524 +++-
 .../linux-keystone2/include/odp/packet_flags.h |  75 ++
 .../include/odp/plat/packet_types.h|  38 +
 .../linux-keystone2/include/odp_packet_internal.h  | 144 +---
 platform/linux-keystone2/odp_packet.c  | 914 -
 platform/linux-keystone2/odp_pool.c|  34 +-
 8 files changed, 1193 insertions(+), 543 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp/packet_flags.h
 create mode 100644 platform/linux-keystone2/include/odp/plat/packet_types.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index a156c00..c482142 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -25,6 +25,7 @@ odpinclude_HEADERS = \
  $(srcdir)/include/odp/buffer.h \
  $(srcdir)/include/odp/crypto.h \
  $(srcdir)/include/odp/event.h \
+ $(srcdir)/include/odp/packet_flags.h \
  $(srcdir)/include/odp/packet_io.h \
  $(srcdir)/include/odp/packet.h \
  $(srcdir)/include/odp/pool.h \
@@ -41,7 +42,6 @@ odpinclude_HEADERS = \
  $(linux_generic_srcdir)/include/odp/hints.h \
  $(linux_generic_srcdir)/include/odp/init.h \
  $(linux_generic_srcdir)/include/odp/random.h \
- $(linux_generic_srcdir)/include/odp/packet_flags.h \
  $(linux_generic_srcdir)/include/odp/queue.h \
  $(linux_generic_srcdir)/include/odp/rwlock.h \
  $(linux_generic_srcdir)/include/odp/schedule.h \
@@ -64,6 +64,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/event_types.h \
  $(srcdir)/include/odp/plat/mcsdk_tune.h \
  $(srcdir)/include/odp/plat/osal.h \
+ $(srcdir)/include/odp/plat/packet_types.h \
  $(srcdir)/include/odp/plat/pool_types.h \
  $(srcdir)/include/odp/plat/state.h \
  $(srcdir)/include/odp/plat/ti_mcsdk.h \
@@ -72,7 +73,6 @@ odpplatinclude_HEADERS = \
  
$(linux_generic_srcdir)/include/odp/plat/classification_types.h \
  $(linux_generic_srcdir)/include/odp/plat/cpumask_types.h \
  $(linux_generic_srcdir)/include/odp/plat/crypto_types.h \
- $(linux_generic_srcdir)/include/odp/plat/packet_types.h \
  $(linux_generic_srcdir)/include/odp/plat/packet_io_types.h \
  $(linux_generic_srcdir)/include/odp/plat/queue_types.h \
  $(linux_generic_srcdir)/include/odp/plat/schedule_types.h \
@@ -134,6 +134,7 @@ __LIB__libodp_la_SOURCES = \
   odp_init.c \
   odp_pool.c \
   odp_buffer.c \
+  odp_packet.c \
   mcsdk/mcsdk_init.c \
   mcsdk/mcsdk_navig.c \
   mcsdk/mcsdk_rmclient.c \
diff --git a/platform/linux-keystone2/include/odp.h 
b/platform/linux-keystone2/include/odp.h
index cf52c25..8737b9f 100644
--- a/platform/linux-keystone2/include/odp.h
+++ b/platform/linux-keystone2/include/odp.h
@@ -38,6 +38,8 @@ extern C {
 #include odp/shared_memory.h
 #include odp/buffer.h
 #include odp/pool.h
+#include odp/packet.h
+#include odp/packet_flags.h
 #include odp/ticketlock.h
 #include odp/time.h
 #include odp/sync.h
diff --git a/platform/linux-keystone2/include/odp/packet.h 
b/platform/linux-keystone2/include/odp/packet.h
index 9cfe41d..1104006 100644
--- a/platform/linux-keystone2/include/odp/packet.h
+++ b/platform/linux-keystone2/include/odp/packet.h
@@ -19,233 +19,387 @@
 extern C {
 #endif
 
-#include odp_buffer.h
+#include odp/plat/packet_types.h
+#include odp/plat/packet_io_types.h
+#include odp/plat/debug.h
+#include odp/plat/align.h
+#include odp/align.h
+#include odp/debug.h
+#include odp/pool.h
+#include odp/hints.h
+#include odp/event.h
 
 /**
- * ODP packet descriptor
+ * Packet input  protocol flags
+ */
+typedef union {
+   /* All input flags */
+   uint32_t all;
+
+   struct {
+   /* Bitfield flags for each protocol */
+   uint32_t l2:1;/** known L2 protocol present */
+   uint32_t l3:1;/** known L3 protocol present */
+   uint32_t l4:1;/** known L4 protocol present */
+
+   uint32_t eth:1;   /** Ethernet */
+   uint32_t jumbo:1; /** Jumbo frame */
+   uint32_t vlan:1;  /** VLAN hdr found */
+   uint32_t vlan_qinq:1; /** Stacked VLAN found, QinQ

[lng-odp] [KEYSTONE2 PATCH 14/15] linux-ks2: packet_io: update module

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |   3 +-
 platform/linux-keystone2/include/odp/packet_io.h   | 111 +---
 .../include/odp/plat/packet_io_types.h |  42 ++
 platform/linux-keystone2/include/odp/queue.h   |   3 +
 .../include/odp_packet_io_internal.h   |  29 +-
 .../linux-keystone2/include/odp_packet_io_queue.h  |   8 +-
 .../linux-keystone2/include/odp_queue_internal.h   |   1 +
 platform/linux-keystone2/odp_init.c|   4 +-
 platform/linux-keystone2/odp_packet_io.c   | 681 +
 platform/linux-keystone2/odp_queue.c   |   2 -
 10 files changed, 500 insertions(+), 384 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp/plat/packet_io_types.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index f3d8471..38be9b6 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -64,6 +64,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/event_types.h \
  $(srcdir)/include/odp/plat/mcsdk_tune.h \
  $(srcdir)/include/odp/plat/osal.h \
+ $(srcdir)/include/odp/plat/packet_io_types.h \
  $(srcdir)/include/odp/plat/packet_types.h \
  $(srcdir)/include/odp/plat/pool_types.h \
  $(srcdir)/include/odp/plat/queue_types.h \
@@ -75,7 +76,6 @@ odpplatinclude_HEADERS = \
  
$(linux_generic_srcdir)/include/odp/plat/classification_types.h \
  $(linux_generic_srcdir)/include/odp/plat/cpumask_types.h \
  $(linux_generic_srcdir)/include/odp/plat/crypto_types.h \
- $(linux_generic_srcdir)/include/odp/plat/packet_io_types.h \
  $(linux_generic_srcdir)/include/odp/plat/schedule_types.h \
  
$(linux_generic_srcdir)/include/odp/plat/shared_memory_types.h \
  $(linux_generic_srcdir)/include/odp/plat/strong_types.h \
@@ -137,6 +137,7 @@ __LIB__libodp_la_SOURCES = \
   odp_buffer.c \
   odp_packet.c \
   odp_queue.c \
+  odp_packet_io.c \
   mcsdk/mcsdk_init.c \
   mcsdk/mcsdk_navig.c \
   mcsdk/mcsdk_rmclient.c \
diff --git a/platform/linux-keystone2/include/odp/packet_io.h 
b/platform/linux-keystone2/include/odp/packet_io.h
index 3faace9..a085781 100644
--- a/platform/linux-keystone2/include/odp/packet_io.h
+++ b/platform/linux-keystone2/include/odp/packet_io.h
@@ -19,112 +19,13 @@
 extern C {
 #endif
 
-#include odp_std_types.h
-#include odp_buffer_pool.h
-#include odp_packet.h
-#include odp_queue.h
+#include odp/plat/pool_types.h
+#include odp/plat/packet_types.h
+#include odp/plat/queue_types.h
+#include odp/plat/classification_types.h
+#include odp/plat/packet_io_types.h
 
-/** ODP packet IO handle */
-typedef uint32_t odp_pktio_t;
-
-/** Invalid packet IO handle */
-#define ODP_PKTIO_INVALID ((odp_pktio_t)-1)
-
-/**
- * Open an ODP packet IO instance
- *
- * @param devPacket IO device
- * @param pool   Pool to use for packet IO
- *
- * @return ODP packet IO handle or ODP_PKTIO_INVALID on error
- */
-odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool);
-
-/**
- * Close an ODP packet IO instance
- *
- * @param id  ODP packet IO handle
- *
- * @return 0 on success or -1 on error
- */
-int odp_pktio_close(odp_pktio_t id);
-
-/**
- * Receive packets
- *
- * @param id  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
- */
-int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len);
-
-/**
- * Send packets
- *
- * @param id   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
- */
-int odp_pktio_send(odp_pktio_t id, 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 queue default input queue set
- * @return  0 on success or -1 on error
- */
-int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue);
-
-/**
- * Get default input queue associated with a pktio handle
- *
- * @param id  ODP packet IO handle
- *
- * @return Default input queue set or ODP_QUEUE_INVALID on error
- */
-odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id);
-
-/**
- * Remove default input queue (if set)
- *
- * @param id  ODP packet IO handle
- *
- * @return 0 on success or -1 on error
- */
-int

[lng-odp] [KEYSTONE2 PATCH 10/15] linux-ks2: buffer: update module

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |   8 +-
 platform/linux-keystone2/include/odp.h |   2 +
 platform/linux-keystone2/include/odp/buffer.h  | 164 +++
 platform/linux-keystone2/include/odp/buffer_pool.h | 101 
 platform/linux-keystone2/include/odp/event.h   |   9 +
 .../include/odp/plat/buffer_types.h|  29 ++
 .../linux-keystone2/include/odp/plat/pool_types.h  |  43 ++
 platform/linux-keystone2/include/odp/pool.h| 108 +
 .../linux-keystone2/include/odp_buffer_internal.h  |  32 +-
 .../include/odp_buffer_pool_internal.h |  31 --
 platform/linux-keystone2/include/odp_internal.h|   2 +-
 .../linux-keystone2/include/odp_pool_internal.h|  24 +
 platform/linux-keystone2/odp_buffer.c  |  73 ++-
 platform/linux-keystone2/odp_buffer_pool.c | 132 --
 platform/linux-keystone2/odp_init.c|   4 +-
 platform/linux-keystone2/odp_pool.c| 513 +
 16 files changed, 877 insertions(+), 398 deletions(-)
 delete mode 100644 platform/linux-keystone2/include/odp/buffer_pool.h
 create mode 100644 platform/linux-keystone2/include/odp/plat/buffer_types.h
 create mode 100644 platform/linux-keystone2/include/odp/plat/pool_types.h
 create mode 100644 platform/linux-keystone2/include/odp/pool.h
 delete mode 100644 platform/linux-keystone2/include/odp_buffer_pool_internal.h
 create mode 100644 platform/linux-keystone2/include/odp_pool_internal.h
 delete mode 100644 platform/linux-keystone2/odp_buffer_pool.c
 create mode 100644 platform/linux-keystone2/odp_pool.c

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index 69dd247..a156c00 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -23,11 +23,11 @@ include_HEADERS = \
 odpincludedir= $(includedir)/odp
 odpinclude_HEADERS = \
  $(srcdir)/include/odp/buffer.h \
- $(srcdir)/include/odp/buffer_pool.h \
  $(srcdir)/include/odp/crypto.h \
  $(srcdir)/include/odp/event.h \
  $(srcdir)/include/odp/packet_io.h \
  $(srcdir)/include/odp/packet.h \
+ $(srcdir)/include/odp/pool.h \
  $(linux_generic_srcdir)/include/odp/align.h \
  $(linux_generic_srcdir)/include/odp/atomic.h \
  $(linux_generic_srcdir)/include/odp/barrier.h \
@@ -59,21 +59,21 @@ odpinclude_HEADERS = \
 odpplatincludedir = $(includedir)/odp/plat
 odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/align.h \
+ $(srcdir)/include/odp/plat/buffer_types.h \
  $(srcdir)/include/odp/plat/debug.h \
  $(srcdir)/include/odp/plat/event_types.h \
  $(srcdir)/include/odp/plat/mcsdk_tune.h \
  $(srcdir)/include/odp/plat/osal.h \
+ $(srcdir)/include/odp/plat/pool_types.h \
  $(srcdir)/include/odp/plat/state.h \
  $(srcdir)/include/odp/plat/ti_mcsdk.h \
  $(linux_generic_srcdir)/include/odp/plat/atomic_types.h \
- $(linux_generic_srcdir)/include/odp/plat/buffer_types.h \
  $(linux_generic_srcdir)/include/odp/plat/byteorder_types.h \
  
$(linux_generic_srcdir)/include/odp/plat/classification_types.h \
  $(linux_generic_srcdir)/include/odp/plat/cpumask_types.h \
  $(linux_generic_srcdir)/include/odp/plat/crypto_types.h \
  $(linux_generic_srcdir)/include/odp/plat/packet_types.h \
  $(linux_generic_srcdir)/include/odp/plat/packet_io_types.h \
- $(linux_generic_srcdir)/include/odp/plat/pool_types.h \
  $(linux_generic_srcdir)/include/odp/plat/queue_types.h \
  $(linux_generic_srcdir)/include/odp/plat/schedule_types.h \
  
$(linux_generic_srcdir)/include/odp/plat/shared_memory_types.h \
@@ -132,6 +132,8 @@ subdirheaders_HEADERS = \
 
 __LIB__libodp_la_SOURCES = \
   odp_init.c \
+  odp_pool.c \
+  odp_buffer.c \
   mcsdk/mcsdk_init.c \
   mcsdk/mcsdk_navig.c \
   mcsdk/mcsdk_rmclient.c \
diff --git a/platform/linux-keystone2/include/odp.h 
b/platform/linux-keystone2/include/odp.h
index 7526d93..cf52c25 100644
--- a/platform/linux-keystone2/include/odp.h
+++ b/platform/linux-keystone2/include/odp.h
@@ -36,6 +36,8 @@ extern C {
 #include odp/system_info.h
 #include odp/thread.h
 #include odp/shared_memory.h
+#include odp/buffer.h
+#include odp/pool.h
 #include odp/ticketlock.h
 #include odp/time.h
 #include odp/sync.h
diff --git a/platform/linux-keystone2/include/odp

[lng-odp] [KEYSTONE2 PATCH 12/15] linux-ks2: queue: update module

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |   6 +-
 platform/linux-keystone2/include/odp.h |   2 +
 .../linux-keystone2/include/odp/plat/queue_types.h |  95 +
 platform/linux-keystone2/include/odp/queue.h   | 153 
 .../linux-keystone2/include/odp_queue_internal.h   |  98 +-
 platform/linux-keystone2/odp_init.c|   3 +-
 platform/linux-keystone2/odp_queue.c   | 384 +
 7 files changed, 429 insertions(+), 312 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp/plat/queue_types.h
 create mode 100644 platform/linux-keystone2/include/odp/queue.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index c482142..282f406 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -29,6 +29,7 @@ odpinclude_HEADERS = \
  $(srcdir)/include/odp/packet_io.h \
  $(srcdir)/include/odp/packet.h \
  $(srcdir)/include/odp/pool.h \
+ $(srcdir)/include/odp/queue.h \
  $(linux_generic_srcdir)/include/odp/align.h \
  $(linux_generic_srcdir)/include/odp/atomic.h \
  $(linux_generic_srcdir)/include/odp/barrier.h \
@@ -42,7 +43,6 @@ odpinclude_HEADERS = \
  $(linux_generic_srcdir)/include/odp/hints.h \
  $(linux_generic_srcdir)/include/odp/init.h \
  $(linux_generic_srcdir)/include/odp/random.h \
- $(linux_generic_srcdir)/include/odp/queue.h \
  $(linux_generic_srcdir)/include/odp/rwlock.h \
  $(linux_generic_srcdir)/include/odp/schedule.h \
  $(linux_generic_srcdir)/include/odp/shared_memory.h \
@@ -66,6 +66,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/osal.h \
  $(srcdir)/include/odp/plat/packet_types.h \
  $(srcdir)/include/odp/plat/pool_types.h \
+ $(srcdir)/include/odp/plat/queue_types.h \
  $(srcdir)/include/odp/plat/state.h \
  $(srcdir)/include/odp/plat/ti_mcsdk.h \
  $(linux_generic_srcdir)/include/odp/plat/atomic_types.h \
@@ -74,7 +75,6 @@ odpplatinclude_HEADERS = \
  $(linux_generic_srcdir)/include/odp/plat/cpumask_types.h \
  $(linux_generic_srcdir)/include/odp/plat/crypto_types.h \
  $(linux_generic_srcdir)/include/odp/plat/packet_io_types.h \
- $(linux_generic_srcdir)/include/odp/plat/queue_types.h \
  $(linux_generic_srcdir)/include/odp/plat/schedule_types.h \
  
$(linux_generic_srcdir)/include/odp/plat/shared_memory_types.h \
  $(linux_generic_srcdir)/include/odp/plat/strong_types.h \
@@ -135,6 +135,7 @@ __LIB__libodp_la_SOURCES = \
   odp_pool.c \
   odp_buffer.c \
   odp_packet.c \
+  odp_queue.c \
   mcsdk/mcsdk_init.c \
   mcsdk/mcsdk_navig.c \
   mcsdk/mcsdk_rmclient.c \
@@ -147,6 +148,7 @@ __LIB__libodp_la_SOURCES = \
   ../linux-generic/odp_ring.c \
   ../linux-generic/odp_rwlock.c \
   ../linux-generic/odp_shared_memory.c \
+  ../linux-generic/odp_schedule.c \
   ../linux-generic/odp_spinlock.c \
   ../linux-generic/odp_system_info.c \
   ../linux-generic/odp_thread.c \
diff --git a/platform/linux-keystone2/include/odp.h 
b/platform/linux-keystone2/include/odp.h
index 8737b9f..57fb5bc 100644
--- a/platform/linux-keystone2/include/odp.h
+++ b/platform/linux-keystone2/include/odp.h
@@ -39,6 +39,8 @@ extern C {
 #include odp/buffer.h
 #include odp/pool.h
 #include odp/packet.h
+#include odp/queue.h
+#include odp/schedule.h
 #include odp/packet_flags.h
 #include odp/ticketlock.h
 #include odp/time.h
diff --git a/platform/linux-keystone2/include/odp/plat/queue_types.h 
b/platform/linux-keystone2/include/odp/plat/queue_types.h
new file mode 100644
index 000..8bf97b6
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/plat/queue_types.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, Linaro Limited
+ * Copyright (c) 2014, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP queue types
+ */
+
+#ifndef ODP_PLAT_QUEUE_TYPES_H_
+#define ODP_PLAT_QUEUE_TYPES_H_
+
+#include odp/std_types.h
+#include odp/plat/strong_types.h
+
+/**
+ * ODP queue
+ */
+typedef odp_handle_t odp_queue_t;
+
+/**
+ * Queue group instance type
+ */
+typedef odp_handle_t

[lng-odp] [KEYSTONE2 PATCH 15/15] linux-ks2: crypto: update module

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |   3 +-
 platform/linux-keystone2/include/odp.h |   2 +
 platform/linux-keystone2/include/odp/crypto.h  | 366 ++---
 platform/linux-keystone2/include/odp/packet.h  |   2 +-
 .../include/odp/plat/crypto_types.h|  90 +
 .../linux-keystone2/include/odp_crypto_internal.h  |  84 -
 platform/linux-keystone2/odp_crypto.c  | 331 ---
 platform/linux-keystone2/odp_init.c|   4 +-
 8 files changed, 267 insertions(+), 615 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp/plat/crypto_types.h
 delete mode 100644 platform/linux-keystone2/include/odp_crypto_internal.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index 38be9b6..806be89 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -60,6 +60,7 @@ odpplatincludedir = $(includedir)/odp/plat
 odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/align.h \
  $(srcdir)/include/odp/plat/buffer_types.h \
+ $(srcdir)/include/odp/plat/crypto_types.h \
  $(srcdir)/include/odp/plat/debug.h \
  $(srcdir)/include/odp/plat/event_types.h \
  $(srcdir)/include/odp/plat/mcsdk_tune.h \
@@ -75,7 +76,6 @@ odpplatinclude_HEADERS = \
  $(linux_generic_srcdir)/include/odp/plat/byteorder_types.h \
  
$(linux_generic_srcdir)/include/odp/plat/classification_types.h \
  $(linux_generic_srcdir)/include/odp/plat/cpumask_types.h \
- $(linux_generic_srcdir)/include/odp/plat/crypto_types.h \
  $(linux_generic_srcdir)/include/odp/plat/schedule_types.h \
  
$(linux_generic_srcdir)/include/odp/plat/shared_memory_types.h \
  $(linux_generic_srcdir)/include/odp/plat/strong_types.h \
@@ -138,6 +138,7 @@ __LIB__libodp_la_SOURCES = \
   odp_packet.c \
   odp_queue.c \
   odp_packet_io.c \
+  odp_crypto.c \
   mcsdk/mcsdk_init.c \
   mcsdk/mcsdk_navig.c \
   mcsdk/mcsdk_rmclient.c \
diff --git a/platform/linux-keystone2/include/odp.h 
b/platform/linux-keystone2/include/odp.h
index 57fb5bc..7704eda 100644
--- a/platform/linux-keystone2/include/odp.h
+++ b/platform/linux-keystone2/include/odp.h
@@ -41,6 +41,8 @@ extern C {
 #include odp/packet.h
 #include odp/queue.h
 #include odp/schedule.h
+#include odp/crypto.h
+#include odp/random.h
 #include odp/packet_flags.h
 #include odp/ticketlock.h
 #include odp/time.h
diff --git a/platform/linux-keystone2/include/odp/crypto.h 
b/platform/linux-keystone2/include/odp/crypto.h
index c61795e..b28c820 100644
--- a/platform/linux-keystone2/include/odp/crypto.h
+++ b/platform/linux-keystone2/include/odp/crypto.h
@@ -19,351 +19,33 @@
 extern C {
 #endif
 
-#include odp_std_types.h
-#include odp_buffer.h
-#include odp_buffer_pool.h
-#include odp_queue.h
-#include odp_packet.h
-#include ti/drv/nwal/nwal.h
-
-/** Invalid session handle */
-#define ODP_CRYPTO_SESSION_INVALID NULL
-
-/**
- * Crypto API opaque session handle
- */
-typedef struct odp_crypto_session_s *odp_crypto_session_t;
-
-/**
- * Crypto API operation mode
- */
-enum odp_crypto_op_mode {
-   ODP_CRYPTO_SYNC,/** Synchronous, return results immediately */
-   ODP_CRYPTO_ASYNC,   /** Aynchronous, return results via posted event */
-};
-
-/**
- * Crypto API operation type
- */
-enum odp_crypto_op {
-   ODP_CRYPTO_OP_ENCODE, /** Encrypt and/or compute authentication ICV */
-   ODP_CRYPTO_OP_DECODE  /** Decrypt and/or verify authentication ICV */
-};
-
-/**
- * Crypto API cipher algorithm
- */
-enum  odp_cipher_alg {
-   ODP_CIPHER_ALG_NULL = NWAL_SA_EALG_NULL, /** No cipher */
-   ODP_CIPHER_ALG_DES = NWAL_SA_EALG_DES_CBC,   /** DES cipher block 
chaining */
-   ODP_CIPHER_ALG_3DES_CBC = NWAL_SA_EALG_3DES_CBC, /** Triple DES cipher 
block chaining */
-   ODP_CIPHER_ALG_AES_CBC = NWAL_SA_EALG_AES_CBC,   /** AES cipher block 
chaining */
-   ODP_CIPHER_ALG_AES_CTR = NWAL_SA_EALG_AES_CTR,   /** AES counter */
-   ODP_CIPHER_ALG_AES_CCM = NWAL_SA_EALG_AES_CCM,   /** AES counter with 
CBC-MAC */
-   ODP_CIPHER_ALG_AES_GCM = NWAL_SA_EALG_AES_GCM,   /** AES galois 
counter */
-};
-
-/**
- * Crypto API authentication algorithm
- */
-enum odp_auth_alg {
-   ODP_AUTH_ALG_NULL = NWAL_SA_AALG_NULL,   /** No authentication 
*/
-   ODP_AUTH_ALG_MD5_96 = NWAL_SA_AALG_HMAC_MD5, /** HMAC-MD5 with 96 
bit key */
-   ODP_AUTH_ALG_SHA1 = NWAL_SA_AALG_HMAC_SHA1,  /** HMAC-SHA1 */
-};
-
-/**
- * Crypto API key

[lng-odp] [KEYSTONE2 PATCH 06/15] linux-ks2: init: fix a minimal library build

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am |  6 +-
 platform/linux-keystone2/include/odp.h   |  1 +
 platform/linux-keystone2/include/odp/plat/state.h|  3 +++
 platform/linux-keystone2/include/odp/plat/ti_mcsdk.h |  3 +++
 platform/linux-keystone2/include/odp_internal.h  |  8 +++-
 platform/linux-keystone2/mcsdk/mcsdk_init.c  | 10 +-
 platform/linux-keystone2/mcsdk/mcsdk_navig.c |  6 +++---
 platform/linux-keystone2/mcsdk/mcsdk_rmclient.c  |  4 ++--
 platform/linux-keystone2/mcsdk/sockutils.c   |  2 +-
 platform/linux-keystone2/odp_init.c  | 13 -
 10 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index e302414..a6ee070 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -137,6 +137,8 @@ __LIB__libodp_la_SOURCES = \
   mcsdk/sockutils.c \
   ../linux-generic/odp_barrier.c \
   ../linux-generic/odp_cpumask.c \
+  ../linux-generic/odp_errno.c \
+  ../linux-generic/odp_impl.c \
   ../linux-generic/odp_linux.c \
   ../linux-generic/odp_ring.c \
   ../linux-generic/odp_rwlock.c \
@@ -145,4 +147,6 @@ __LIB__libodp_la_SOURCES = \
   ../linux-generic/odp_system_info.c \
   ../linux-generic/odp_thread.c \
   ../linux-generic/odp_ticketlock.c \
-  ../linux-generic/odp_time.c
+  ../linux-generic/odp_time.c \
+  ../linux-generic/odp_version.c \
+  ../linux-generic/odp_weak.c
diff --git a/platform/linux-keystone2/include/odp.h 
b/platform/linux-keystone2/include/odp.h
index 6ab30a9..7526d93 100644
--- a/platform/linux-keystone2/include/odp.h
+++ b/platform/linux-keystone2/include/odp.h
@@ -40,6 +40,7 @@ extern C {
 #include odp/time.h
 #include odp/sync.h
 #include odp/rwlock.h
+#include odp/errno.h
 
 #ifdef __cplusplus
 }
diff --git a/platform/linux-keystone2/include/odp/plat/state.h 
b/platform/linux-keystone2/include/odp/plat/state.h
index 0b4b07f..63428cb 100644
--- a/platform/linux-keystone2/include/odp/plat/state.h
+++ b/platform/linux-keystone2/include/odp/plat/state.h
@@ -14,6 +14,7 @@ extern C {
 #endif
 
 #include odp/plat/ti_mcsdk.h
+#include odp/init.h
 
 /**
  * @internal Global ODP state
@@ -37,6 +38,8 @@ struct odp_proc_s {
} nwal; /** Per process NWAL state */
Rm_ServiceHandle *rm_service;   /** Resource Manager service handle */
void *descriptor_mem_base;
+   odp_log_func_t log_fn;
+   odp_abort_func_t abort_fn;
 };
 
 /** @internal Per thread ODP state */
diff --git a/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h 
b/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
index 5ccc9e0..b8e002a 100644
--- a/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
+++ b/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
@@ -13,6 +13,9 @@
 extern C {
 #endif
 
+/* Define asm for C99 compatibility */
+#define asm __asm
+
 #include ti/csl/cslr_device.h
 #include ti/runtime/hplib/hplib.h
 #include ti/runtime/pktlib/pktlib.h
diff --git a/platform/linux-keystone2/include/odp_internal.h 
b/platform/linux-keystone2/include/odp_internal.h
index 7ebf567..816e74f 100644
--- a/platform/linux-keystone2/include/odp_internal.h
+++ b/platform/linux-keystone2/include/odp_internal.h
@@ -19,15 +19,19 @@
 extern C {
 #endif
 
-#include odp/plat/state.h
 #include odp/thread.h
 
+extern __thread int __odp_errno;
+
 int odp_system_info_init(void);
 
 int odp_thread_init_global(void);
 int odp_thread_init_local(void);
+int odp_thread_term_local(void);
+int odp_thread_term_global(void);
 
 int odp_shm_init_global(void);
+int odp_shm_term_global(void);
 int odp_shm_init_local(void);
 
 int odp_buffer_pool_init_global(void);
@@ -39,7 +43,9 @@ int odp_queue_init_global(void);
 int odp_crypto_init_global(void);
 
 int odp_schedule_init_global(void);
+int odp_schedule_term_global(void);
 int odp_schedule_init_local(void);
+int odp_schedule_term_local(void);
 
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
diff --git a/platform/linux-keystone2/mcsdk/mcsdk_init.c 
b/platform/linux-keystone2/mcsdk/mcsdk_init.c
index fbc9bb5..2c1407a 100644
--- a/platform/linux-keystone2/mcsdk/mcsdk_init.c
+++ b/platform/linux-keystone2/mcsdk/mcsdk_init.c
@@ -7,11 +7,11 @@
  */
 
 #include stdio.h
-#include odp_align.h
-#include odp_thread.h
+#include odp/align.h
+#include odp/thread.h
 #include odp_internal.h
-#include odp_ti_mcsdk.h
-#include odp_debug_internal.h
+#include odp

[lng-odp] [KEYSTONE2 PATCH 05/15] linux-ks2: build only init part

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   | 15 ++-
 platform/linux-keystone2/include/odp.h | 47 ++
 platform/linux-keystone2/include/odp/plat/state.h  |  2 +-
 .../linux-keystone2/include/odp/plat/ti_mcsdk.h|  2 +-
 platform/linux-keystone2/include/odp_internal.h|  4 +-
 platform/linux-keystone2/odp_init.c| 14 +++
 6 files changed, 61 insertions(+), 23 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index 505cb97..e302414 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -18,7 +18,7 @@ LIBS += $(KS2_LIBS)
 linux_generic_srcdir = $(top_srcdir)/platform/linux-generic
 
 include_HEADERS = \
- $(top_srcdir)/include/odp.h
+ $(srcdir)/include/odp.h
 
 odpincludedir= $(includedir)/odp
 odpinclude_HEADERS = \
@@ -130,28 +130,19 @@ subdirheaders_HEADERS = \
$(top_srcdir)/helper/include/odp/helper/udp.h
 
 __LIB__libodp_la_SOURCES = \
-  odp_buffer.c \
-  odp_buffer_pool.c \
-  odp_crypto.c \
   odp_init.c \
-  odp_packet.c \
-  odp_packet_io.c \
-  odp_queue.c \
   mcsdk/mcsdk_init.c \
   mcsdk/mcsdk_navig.c \
   mcsdk/mcsdk_rmclient.c \
   mcsdk/sockutils.c \
   ../linux-generic/odp_barrier.c \
-  ../linux-generic/odp_coremask.c \
+  ../linux-generic/odp_cpumask.c \
   ../linux-generic/odp_linux.c \
-  ../linux-generic/odp_packet_flags.c \
   ../linux-generic/odp_ring.c \
   ../linux-generic/odp_rwlock.c \
-  ../linux-generic/odp_schedule.c \
   ../linux-generic/odp_shared_memory.c \
   ../linux-generic/odp_spinlock.c \
   ../linux-generic/odp_system_info.c \
   ../linux-generic/odp_thread.c \
   ../linux-generic/odp_ticketlock.c \
-  ../linux-generic/odp_time.c \
-  ../linux-generic/odp_timer.c
+  ../linux-generic/odp_time.c
diff --git a/platform/linux-keystone2/include/odp.h 
b/platform/linux-keystone2/include/odp.h
new file mode 100644
index 000..6ab30a9
--- /dev/null
+++ b/platform/linux-keystone2/include/odp.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2013, Linaro Limited
+ * All rights reserved
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * The OpenDataPlane API
+ *
+ */
+
+#ifndef ODP_H_
+#define ODP_H_
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include odp/config.h
+
+#include odp/version.h
+#include odp/std_types.h
+#include odp/compiler.h
+#include odp/align.h
+#include odp/hints.h
+#include odp/debug.h
+#include odp/byteorder.h
+#include odp/cpumask.h
+#include odp/cpu.h
+#include odp/barrier.h
+#include odp/spinlock.h
+#include odp/atomic.h
+#include odp/init.h
+#include odp/system_info.h
+#include odp/thread.h
+#include odp/shared_memory.h
+#include odp/ticketlock.h
+#include odp/time.h
+#include odp/sync.h
+#include odp/rwlock.h
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/platform/linux-keystone2/include/odp/plat/state.h 
b/platform/linux-keystone2/include/odp/plat/state.h
index 2406245..0b4b07f 100644
--- a/platform/linux-keystone2/include/odp/plat/state.h
+++ b/platform/linux-keystone2/include/odp/plat/state.h
@@ -13,7 +13,7 @@
 extern C {
 #endif
 
-#include odp_ti_mcsdk.h
+#include odp/plat/ti_mcsdk.h
 
 /**
  * @internal Global ODP state
diff --git a/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h 
b/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
index aa7e64f..5ccc9e0 100644
--- a/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
+++ b/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
@@ -19,7 +19,7 @@ extern C {
 #include ti/drv/nwal/nwal.h
 #include ti/drv/nwal/nwal_util.h
 #include ti/drv/nwal/nwal_osal.h
-#include mcsdk_tune.h
+#include odp/plat/mcsdk_tune.h
 
 /** @internal McSDK initialization configuration */
 struct mcsdk_cfg_s {
diff --git a/platform/linux-keystone2/include/odp_internal.h 
b/platform/linux-keystone2/include/odp_internal.h
index 6cce2b5..7ebf567 100644
--- a/platform/linux-keystone2/include/odp_internal.h
+++ b/platform/linux-keystone2/include/odp_internal.h
@@ -19,8 +19,8 @@
 extern C {
 #endif
 
-#include odp_state.h
-#include odp_thread.h
+#include odp/plat/state.h
+#include odp

[lng-odp] [KEYSTONE2 PATCH 00/15] Update to v1.0 API

2015-03-10 Thread Taras Kondratiuk
This updates linux-keystone2 implementation to ODP v1.0 API.

Current limitations:
- Scheduler API is still SW based. Need to solve scheduler termination issues.
- Classification API is not implemented yet.
- Timer implementation in linux-generic is changed and can't be easily reused
  from linux-keystone2. So timer API is not available for now.

Taras Kondratiuk (15):
  linux-ks2: update include structure
  linux-ks2: debug: sort out after merge
  linux-ks2: align: move internal macros to a public place
  linux-ks2: align: add ODP_ALIGNOF() macro
  linux-ks2: build only init part
  linux-ks2: init: fix a minimal library build
  linux-ks2: init: implement McSDK termination
  linux-ks2: plat: add abstraction layer for CPPI
  linux-ks2: event: add headers
  linux-ks2: buffer: update module
  linux-ks2: packet: update module
  linux-ks2: queue: update module
  linux-ks2: Add shared resources handling
  linux-ks2: packet_io: update module
  linux-ks2: crypto: update module

 platform/linux-keystone2/Makefile.am   | 175 ++--
 platform/linux-keystone2/include/api/odp_buffer.h  | 174 
 .../linux-keystone2/include/api/odp_buffer_pool.h  | 101 ---
 platform/linux-keystone2/include/api/odp_crypto.h  | 372 -
 platform/linux-keystone2/include/api/odp_packet.h  | 253 --
 .../linux-keystone2/include/api/odp_packet_io.h| 133 ---
 platform/linux-keystone2/include/odp.h |  56 ++
 platform/linux-keystone2/include/odp/buffer.h  | 160 
 platform/linux-keystone2/include/odp/crypto.h  |  54 ++
 platform/linux-keystone2/include/odp/event.h   |  76 ++
 platform/linux-keystone2/include/odp/packet.h  | 407 +
 .../linux-keystone2/include/odp/packet_flags.h |  75 ++
 platform/linux-keystone2/include/odp/packet_io.h   |  34 +
 platform/linux-keystone2/include/odp/plat/align.h  | 113 +++
 .../include/odp/plat/buffer_types.h|  29 +
 .../include/odp/plat/crypto_types.h|  90 ++
 platform/linux-keystone2/include/odp/plat/debug.h  |  88 ++
 .../linux-keystone2/include/odp/plat/event_types.h |  44 +
 .../include/{api = odp/plat}/mcsdk_tune.h |   0
 platform/linux-keystone2/include/odp/plat/osal.h   | 310 +++
 .../include/odp/plat/packet_io_types.h |  42 +
 .../include/odp/plat/packet_types.h|  38 +
 .../linux-keystone2/include/odp/plat/pool_types.h  |  43 +
 .../linux-keystone2/include/odp/plat/queue_types.h |  95 +++
 .../include/odp/plat/shared_resource.h | 150 
 .../include/{api/odp_state.h = odp/plat/state.h}  |   7 +-
 .../{api/odp_ti_mcsdk.h = odp/plat/ti_mcsdk.h}|  12 +-
 platform/linux-keystone2/include/odp/pool.h| 108 +++
 platform/linux-keystone2/include/odp/queue.h   | 156 
 .../linux-keystone2/include/odp_buffer_internal.h  |  32 +-
 .../include/odp_buffer_pool_internal.h |  31 -
 .../linux-keystone2/include/odp_crypto_internal.h  |  84 --
 .../linux-keystone2/include/odp_debug_internal.h   |  78 +-
 platform/linux-keystone2/include/odp_internal.h|  12 +-
 .../linux-keystone2/include/odp_packet_internal.h  | 144 +---
 .../include/odp_packet_io_internal.h   |  29 +-
 .../linux-keystone2/include/odp_packet_io_queue.h  |   8 +-
 .../linux-keystone2/include/odp_pool_internal.h|  24 +
 .../linux-keystone2/include/odp_queue_internal.h   |  99 +--
 platform/linux-keystone2/mcsdk/mcsdk_init.c| 150 ++--
 platform/linux-keystone2/mcsdk/mcsdk_navig.c   |  41 +-
 platform/linux-keystone2/mcsdk/mcsdk_rmclient.c|   4 +-
 platform/linux-keystone2/mcsdk/sockutils.c |   2 +-
 platform/linux-keystone2/odp_buffer.c  |  73 +-
 platform/linux-keystone2/odp_buffer_pool.c | 132 ---
 platform/linux-keystone2/odp_crypto.c  | 331 
 platform/linux-keystone2/odp_init.c|  37 +-
 platform/linux-keystone2/odp_packet.c  | 914 -
 platform/linux-keystone2/odp_packet_io.c   | 681 +--
 platform/linux-keystone2/odp_pool.c| 545 
 platform/linux-keystone2/odp_queue.c   | 382 -
 platform/linux-keystone2/odp_shr.c | 179 
 52 files changed, 4767 insertions(+), 2640 deletions(-)
 delete mode 100644 platform/linux-keystone2/include/api/odp_buffer.h
 delete mode 100644 platform/linux-keystone2/include/api/odp_buffer_pool.h
 delete mode 100644 platform/linux-keystone2/include/api/odp_crypto.h
 delete mode 100644 platform/linux-keystone2/include/api/odp_packet.h
 delete mode 100644 platform/linux-keystone2/include/api/odp_packet_io.h
 create mode 100644 platform/linux-keystone2/include/odp.h
 create mode 100644 platform/linux-keystone2/include/odp/buffer.h
 create mode 100644 platform/linux-keystone2/include/odp/crypto.h
 create mode 100644 platform/linux-keystone2/include/odp/event.h
 create mode 100644 platform/linux-keystone2/include/odp/packet.h
 create mode

[lng-odp] [KEYSTONE2 PATCH 02/15] linux-ks2: debug: sort out after merge

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   |  1 +
 platform/linux-keystone2/include/odp/plat/debug.h  | 88 ++
 .../linux-keystone2/include/odp_debug_internal.h   | 78 +++
 3 files changed, 98 insertions(+), 69 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp/plat/debug.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index 638b903..d17ea45 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -58,6 +58,7 @@ odpinclude_HEADERS = \
 
 odpplatincludedir = $(includedir)/odp/plat
 odpplatinclude_HEADERS = \
+ $(srcdir)/include/odp/plat/debug.h \
  $(srcdir)/include/odp/plat/mcsdk_tune.h \
  $(srcdir)/include/odp/plat/state.h \
  $(srcdir)/include/odp/plat/ti_mcsdk.h \
diff --git a/platform/linux-keystone2/include/odp/plat/debug.h 
b/platform/linux-keystone2/include/odp/plat/debug.h
new file mode 100644
index 000..2a40404
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/plat/debug.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, Linaro Limited
+ * Copyright (c) 2014, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_DEBUG_INTERNAL_H_
+#define ODP_DEBUG_INTERNAL_H_
+
+#include stdio.h
+#include odp/plat/state.h
+
+/**
+ * Runtime assertion-macro - aborts if 'cond' is false.
+ */
+#define ODP_ASSERT(cond, fmt, ...) \
+   do { if ((ODP_DEBUG == 1)  (!(cond))) \
+   ODP_ABORT(fmt \n, ##__VA_ARGS__); \
+   } while (0)
+
+/**
+ * This macro is used to indicate when a given function is not implemented
+ */
+#define ODP_UNIMPLEMENTED() \
+   odp_proc.log_fn(ODP_LOG_UNIMPLEMENTED, \
+   %s:%d:The function %s() is not implemented\n, \
+   __FILE__, __LINE__, __func__)
+/**
+ * Log debug message if ODP_DEBUG_PRINT flag is set.
+ */
+#define ODP_DBG(fmt, ...) \
+   do { \
+   if (ODP_DEBUG_PRINT == 1) \
+   ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\
+   } while (0)
+
+/**
+ * Log error message.
+ */
+#define ODP_ERR(fmt, ...) \
+   ODP_LOG(ODP_LOG_ERR, fmt, ##__VA_ARGS__)
+
+/**
+ * Log abort message and then stop execution (by default call abort()).
+ * This function should not return.
+ */
+#define ODP_ABORT(fmt, ...) \
+   do { \
+   ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \
+   odp_proc.abort_fn(); \
+   } while (0)
+
+/**
+ * ODP LOG macro.
+ */
+#define ODP_LOG(level, fmt, ...) \
+   odp_proc.log_fn(level, %s:%d:%s(): fmt, __FILE__, \
+   __LINE__, __func__, ##__VA_ARGS__)
+
+/**
+ * Log print message when the application calls one of the ODP APIs
+ * specifically for dumping internal data.
+ */
+#define ODP_PRINT(fmt, ...) \
+   odp_proc.log_fn(ODP_LOG_PRINT,   fmt, ##__VA_ARGS__)
+
+#define odp_pr_err  ODP_ERR
+#define odp_pr_warn ODP_ERR
+#define odp_pr_info ODP_PRINT
+#define odp_pr_dbg  ODP_DBG
+#if 0
+#define odp_pr_vdbg ODP_DBG
+#else
+#define odp_pr_vdbg(...)
+#endif
+
+void odp_print_mem(void *addr, size_t size, const char *desc);
+
+#define odp_pr_err_mem(...)  odp_print_mem
+#ifdef ODP_DEBUG_PRINT
+#define odp_pr_dbg_mem odp_print_mem
+#else
+#define odp_pr_dbg_mem
+#endif
+
+#endif
diff --git a/platform/linux-keystone2/include/odp_debug_internal.h 
b/platform/linux-keystone2/include/odp_debug_internal.h
index a93e282..839d66f 100644
--- a/platform/linux-keystone2/include/odp_debug_internal.h
+++ b/platform/linux-keystone2/include/odp_debug_internal.h
@@ -1,76 +1,16 @@
-/*
- * Copyright (c) 2014, Linaro Limited
- * Copyright (c) 2014, Texas Instruments Incorporated
+/* Copyright (c) 2014, Linaro Limited
  * All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
-
-#ifndef ODP_DEBUG_INTERNAL_H_
-#define ODP_DEBUG_INTERNAL_H_
-
-#include stdio.h
-#include odp_debug.h
-
-#ifdef __cplusplus
-extern C {
-#endif
-
-#define ODP_PRINT_LEVEL_DISABLED 0
-#define ODP_PRINT_LEVEL_CRIT 1
-#define ODP_PRINT_LEVEL_ERR  2
-#define ODP_PRINT_LEVEL_WARN 3
-#define ODP_PRINT_LEVEL_INFO 4
-#define ODP_PRINT_LEVEL_DBG  5
-#define ODP_PRINT_LEVEL_VDBG 6
-#define ODP_PRINT_LEVEL_MAX  7
-
-#define ODP_PRINT_LEVEL ODP_PRINT_LEVEL_DBG
-
-/**
- * Internal debug printing macro
- */
-#ifndef ODP_NO_PRINT
-#define odp_print(level, fmt, ...)\
-   do { if (level = ODP_PRINT_LEVEL)\
-   fprintf(stderr, %s():%d:  fmt,  \
-   __func__, __LINE__, ##__VA_ARGS__);   \
-   } while (0)
-#else
-#define odp_print(level, fmt, ...)
-#endif
-
-#define odp_pr_err(fmt

[lng-odp] [KEYSTONE2 PATCH 08/15] linux-ks2: plat: add abstraction layer for CPPI

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am |   1 +
 platform/linux-keystone2/include/odp/plat/osal.h | 310 +++
 2 files changed, 311 insertions(+)
 create mode 100644 platform/linux-keystone2/include/odp/plat/osal.h

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index a6ee070..296062b 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -61,6 +61,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/align.h \
  $(srcdir)/include/odp/plat/debug.h \
  $(srcdir)/include/odp/plat/mcsdk_tune.h \
+ $(srcdir)/include/odp/plat/osal.h \
  $(srcdir)/include/odp/plat/state.h \
  $(srcdir)/include/odp/plat/ti_mcsdk.h \
  $(linux_generic_srcdir)/include/odp/plat/atomic_types.h \
diff --git a/platform/linux-keystone2/include/odp/plat/osal.h 
b/platform/linux-keystone2/include/odp/plat/osal.h
new file mode 100644
index 000..05704e9
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/plat/osal.h
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2014, Linaro Limited
+ * Copyright (c) 2014, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_OSAL_H_
+#define ODP_PLAT_OSAL_H_
+
+#include odp/plat/ti_mcsdk.h
+#include odp/plat/debug.h
+
+typedef uintptr_t odp_pa_t;
+
+static inline odp_pa_t _odp_mem_virt_to_phys(void *virt)
+{
+   odp_pa_t phys = (odp_pa_t)hplib_mVMVirtToPhy(virt);
+   ODP_ASSERT(virt ? !!phys : !phys, Failed virt to phys conversion);
+   return phys;
+}
+
+static inline void *_odp_mem_phys_to_virt(odp_pa_t phys)
+{
+   void *virt = hplib_mVMPhyToVirt((void *)phys);
+   ODP_ASSERT(phys ? !!virt : !virt, Failed phys to virt conversion);
+   return hplib_mVMPhyToVirt((void *)phys);
+}
+
+#ifdef ODP_DEBUG
+static inline void _odp_mem_verify_phys(odp_pa_t phys)
+{
+   void *virt = hplib_mVMPhyToVirt((void *)phys);
+   ODP_ASSERT(phys ? !!virt : !virt, Wrong physical address);
+}
+
+static inline void _odp_mem_verify_virt(void *virt)
+{
+   odp_pa_t phys = (odp_pa_t)hplib_mVMVirtToPhy(virt);
+   ODP_ASSERT(virt ? !!phys : !phys, Wrong virtual address);
+}
+#else
+static inline void _odp_mem_verify_phys(odp_pa_t phys) {};
+static inline void _odp_mem_verify_virt(void *virt) {};
+#endif
+
+/*
+ * Original buffer info
+ */
+static inline void _cppi_desc_orig_info(Cppi_HostDesc *desc,
+   odp_pa_t *buf_addr,
+   uint32_t *buf_len)
+{
+   Cppi_getOriginalBufInfo(Cppi_DescType_HOST,
+   (Cppi_Desc *)desc,
+   (uint8_t **)buf_addr,
+   buf_len);
+}
+
+static inline void _cppi_desc_orig_info_set(Cppi_HostDesc *desc,
+   odp_pa_t buf_addr,
+   uint32_t buf_len)
+{
+   Cppi_setOriginalBufInfo(Cppi_DescType_HOST,
+   (Cppi_Desc *)desc,
+   (void *)buf_addr,
+   buf_len);
+}
+
+/** Read original buffer pointer. Assume physical address is read. */
+static inline odp_pa_t _cppi_desc_orig_ptr(Cppi_HostDesc *desc)
+{
+   odp_pa_t buf_addr = desc-origBuffPtr;
+   _odp_mem_verify_phys(buf_addr);
+   return buf_addr;
+}
+
+/** Set original buffer pointer. Assume physical address is stored. */
+static inline void _cppi_desc_orig_ptr_set(Cppi_HostDesc *desc,
+  odp_pa_t buf_addr)
+{
+   _odp_mem_verify_phys(buf_addr);
+   desc-origBuffPtr = (uint32_t)buf_addr;
+}
+
+/** Read buffer pointer. Assume virtual address is read. */
+static inline uint8_t *_cppi_desc_orig_vptr(Cppi_HostDesc *desc)
+{
+   uint8_t *buf_addr = (uint8_t *)desc-origBuffPtr;
+   _odp_mem_verify_virt(buf_addr);
+   return buf_addr;
+}
+
+/** Set buffer pointer. Assume virtual address is stored. */
+static inline void _cppi_desc_orig_vptr_set(Cppi_HostDesc *desc,
+   void *buf_addr)
+{
+   _odp_mem_verify_virt(buf_addr);
+   desc-origBuffPtr = (uint32_t)buf_addr;
+}
+
+static inline uint32_t _cppi_desc_orig_len(Cppi_HostDesc *desc)
+{
+   return CSL_FEXTR(desc-origBufferLen, 21, 0);
+}
+
+static inline void _cppi_desc_orig_len_set(Cppi_HostDesc *desc,
+  uint32_t buf_len)
+{
+   CSL_FINSR(desc-origBufferLen, 21, 0, buf_len);
+}
+
+
+/*
+ * Current buffer info
+ */
+static inline void _cppi_desc_buf_info_set(Cppi_HostDesc *desc,
+  odp_pa_t buf_addr

[lng-odp] [KEYSTONE2 PATCH 01/15] linux-ks2: update include structure

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/Makefile.am   | 152 +++--
 .../include/{api/odp_buffer.h = odp/buffer.h} |   0
 .../{api/odp_buffer_pool.h = odp/buffer_pool.h}   |   0
 .../include/{api/odp_crypto.h = odp/crypto.h} |   0
 .../include/{api/odp_packet.h = odp/packet.h} |   0
 .../{api/odp_packet_io.h = odp/packet_io.h}   |   0
 .../include/{api = odp/plat}/mcsdk_tune.h |   0
 .../include/{api/odp_state.h = odp/plat/state.h}  |   0
 .../{api/odp_ti_mcsdk.h = odp/plat/ti_mcsdk.h}|   1 +
 9 files changed, 110 insertions(+), 43 deletions(-)
 rename platform/linux-keystone2/include/{api/odp_buffer.h = odp/buffer.h} 
(100%)
 rename platform/linux-keystone2/include/{api/odp_buffer_pool.h = 
odp/buffer_pool.h} (100%)
 rename platform/linux-keystone2/include/{api/odp_crypto.h = odp/crypto.h} 
(100%)
 rename platform/linux-keystone2/include/{api/odp_packet.h = odp/packet.h} 
(100%)
 rename platform/linux-keystone2/include/{api/odp_packet_io.h = 
odp/packet_io.h} (100%)
 rename platform/linux-keystone2/include/{api = odp/plat}/mcsdk_tune.h (100%)
 rename platform/linux-keystone2/include/{api/odp_state.h = odp/plat/state.h} 
(100%)
 rename platform/linux-keystone2/include/{api/odp_ti_mcsdk.h = 
odp/plat/ti_mcsdk.h} (98%)

diff --git a/platform/linux-keystone2/Makefile.am 
b/platform/linux-keystone2/Makefile.am
index f72b350..638b903 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -9,57 +9,123 @@ include $(top_srcdir)/platform/Makefile.inc
 include Makefile.inc
 
 AM_CFLAGS +=  -I$(srcdir)/include
-AM_CFLAGS +=  -I$(srcdir)/include/api
+AM_CFLAGS +=  -I$(top_srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/platform/linux-generic/include
-AM_CFLAGS +=  -I$(top_srcdir)/platform/linux-generic/include/api
 AM_CFLAGS +=  -I$(top_srcdir)/helper/include
+
 KS2_LIBS = -lnwalsa_$(KS2_DEVICE) -lpktlib -lpa -lsa -lcppi_$(KS2_DEVICE) 
-lqmss_$(KS2_DEVICE) -lrm -lhplib_$(KS2_DEVICE)
 LIBS += $(KS2_LIBS)
+linux_generic_srcdir = $(top_srcdir)/platform/linux-generic
 
 include_HEADERS = \
- $(srcdir)/include/api/odp_buffer.h \
- $(srcdir)/include/api/odp_buffer_pool.h \
- $(srcdir)/include/api/odp_crypto.h \
- $(srcdir)/include/api/odp_packet.h \
- $(srcdir)/include/api/odp_packet_io.h \
- $(srcdir)/include/api/odp_state.h \
- $(srcdir)/include/api/odp_ti_mcsdk.h \
- $(srcdir)/include/api/mcsdk_tune.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_align.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_atomic.h 
\
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_barrier.h \
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_byteorder.h \
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_compiler.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_config.h 
\
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_coremask.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_debug.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_hints.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_init.h \
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_packet_flags.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_queue.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_rwlock.h 
\
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_schedule.h \
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_shared_memory.h \
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_spinlock.h \
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_std_types.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_sync.h \
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_system_info.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_thread.h 
\
- 
$(top_srcdir)/platform/linux-generic/include/api/odp_ticketlock.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_time.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_timer.h \
- $(top_srcdir)/platform/linux-generic/include/api/odp_version.h
+ $(top_srcdir)/include/odp.h
+
+odpincludedir= $(includedir)/odp
+odpinclude_HEADERS = \
+ $(srcdir)/include/odp/buffer.h \
+ $(srcdir)/include/odp/buffer_pool.h \
+ $(srcdir)/include/odp/crypto.h

[lng-odp] [KEYSTONE2 PATCH 04/15] linux-ks2: align: add ODP_ALIGNOF() macro

2015-03-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
Signed-off-by: Taras Kondratiuk ta...@ti.com
---
 platform/linux-keystone2/include/odp/plat/align.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/platform/linux-keystone2/include/odp/plat/align.h 
b/platform/linux-keystone2/include/odp/plat/align.h
index 55271a5..d56e085 100644
--- a/platform/linux-keystone2/include/odp/plat/align.h
+++ b/platform/linux-keystone2/include/odp/plat/align.h
@@ -21,6 +21,10 @@ extern C {
  *  @{
  */
 
+
+/** Returns type alignment */
+#define ODP_ALIGNOF(type) __alignof__(type)
+
 /*
  * Round up
  */
-- 
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: pool: move platform includes to linux-generic

2015-03-10 Thread Taras Kondratiuk

On 03/09/2015 01:05 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote:

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



/** Packet pool*/
#define ODP_POOL_PACKET   ODP_EVENT_PACKET
/** Buffer pool */
#define ODP_POOL_BUFFER   ODP_EVENT_BUFFER
/** Timeout pool */
#define ODP_POOL_TIMEOUT  ODP_EVENT_TIMEOUT

In continuation, these define still linux-generic specific values and should be 
changed to spec only like this,

/**
  * @def ODP_POOL_PACKET
  * Packet pool
  */


We may have similar definitions in other APIs also. Would you have time to 
check and send a patch for those.


I'll do it for event.h first. Later will check for other headers also.


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


[lng-odp] [PATCH] linux-generic: linux: remove explicit buffer cache flush

2015-03-06 Thread Taras Kondratiuk
_odp_flush_caches() is called from odp_term_local() now.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/odp_linux.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/platform/linux-generic/odp_linux.c 
b/platform/linux-generic/odp_linux.c
index 2f95131..f44f050 100644
--- a/platform/linux-generic/odp_linux.c
+++ b/platform/linux-generic/odp_linux.c
@@ -74,7 +74,6 @@ static void *odp_run_start_routine(void *arg)
}
 
void *ret_ptr = start_args-start_routine(start_args-arg);
-   _odp_flush_caches();
int ret = odp_term_local();
if (ret  0)
ODP_ERR(Local term failed\n);
-- 
1.9.1


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


Re: [lng-odp] [PATCH] linux-generic: weak: move stdarg.h include from odp_debug_internal.h

2015-03-06 Thread Taras Kondratiuk

ping

On 02/25/2015 11:30 AM, Taras Kondratiuk wrote:

stdarg.h is not needed in odp_debug_internal.h, but instead should be
included in odp_weak.c.

The change is needed to be able to reuse odp_weak.c from other
platforms.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
  platform/linux-generic/include/odp_debug_internal.h | 1 -
  platform/linux-generic/odp_weak.c   | 2 ++
  2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index ff43ffc..d9ac812 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -18,7 +18,6 @@

  #include stdio.h
  #include stdlib.h
-#include stdarg.h
  #include odp/debug.h
  #include odp_internal.h
  #ifdef __cplusplus
diff --git a/platform/linux-generic/odp_weak.c 
b/platform/linux-generic/odp_weak.c
index 9dc3a4a..9641f45 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -9,6 +9,8 @@
  #include odp_debug_internal.h
  #include odp/hints.h

+#include stdarg.h
+
  ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level ODP_UNUSED,
 const char *fmt, ...)
  {




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


Re: [lng-odp] [PATCHv2] linux-generic: only print errors to stderr

2015-03-05 Thread Taras Kondratiuk

On 03/05/2015 02:20 PM, Stuart Haslam wrote:

The default logger prints all log levels to stderr. To make things
easier when debugging failures change it to print only errors to stderr
and everything else to stdout.

Signed-off-by: Stuart Haslam stuart.has...@linaro.org
---
v2: Fixed indentation (forgot to checkpatch v1)

  platform/linux-generic/odp_weak.c | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_weak.c 
b/platform/linux-generic/odp_weak.c
index 7fa5955..145d0b8 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -14,9 +14,20 @@ int odp_override_log(odp_log_level_e level ODP_UNUSED, const 
char *fmt, ...)


Remove ODP_UNUSED. Otherwise
Reviewed-by: Taras Kondratiuk taras.kondrat...@linaro.org


  {
va_list args;
int r;
+   FILE *logfd;
+
+   switch (level) {
+   case ODP_LOG_ERR:
+   case ODP_LOG_UNIMPLEMENTED:
+   case ODP_LOG_ABORT:
+   logfd = stderr;
+   break;
+   default:
+   logfd = stdout;
+   }

va_start(args, fmt);
-   r = vfprintf(stderr, fmt, args);
+   r = vfprintf(logfd, fmt, args);
va_end(args);

return r;




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


Re: [lng-odp] [RFC 0/2] validation: crypto: remove code duplication

2015-03-03 Thread Taras Kondratiuk

On 02/27/2015 01:19 AM, Taras Kondratiuk wrote:

Current crypto tests have a few issues:
- Asynchronous tests assume that operation is always executed asynchronously,
   but specification does not demand it (I hope I read it correctly). So tests
   have to handle synchronous operations also.
- If the first issue is solved, then Sync test is a subset of Async -
   they can't be merged.

The same approach should allow to easily add tests for 'out of place'
operations.

Taras Kondratiuk (2):
   validation: crypto: handle synchronous operations in async test
   validation: crypto: combine sync and async tests

  test/validation/Makefile.am|   3 +-
  ...ypto_test_async_inp.c = odp_crypto_test_inp.c} |  68 --
  ...ypto_test_async_inp.h = odp_crypto_test_inp.h} |   8 +-
  test/validation/crypto/odp_crypto_test_sync_inp.c  | 271 -
  test/validation/crypto/odp_crypto_test_sync_inp.h  |  17 --
  test/validation/odp_crypto.c   |   9 +-
  6 files changed, 60 insertions(+), 316 deletions(-)
  rename test/validation/crypto/{odp_crypto_test_async_inp.c = 
odp_crypto_test_inp.c} (86%)
  rename test/validation/crypto/{odp_crypto_test_async_inp.h = 
odp_crypto_test_inp.h} (62%)
  delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.c
  delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.h



Robbie, have you had a chance to look on this?

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


Re: [lng-odp] [PATCH] validation: crypto: split crypto and random tests

2015-03-02 Thread Taras Kondratiuk

On 02/26/2015 05:45 PM, Mike Holmes wrote:

We need to throttle change in 1.0 to only ODP API only now.
This should go in 1.0.1


Can this be merged now?

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


Re: [lng-odp] [PATCH] validation: crypto: split crypto and random tests

2015-02-27 Thread Taras Kondratiuk
On 02/26/2015 08:31 PM, Robbie King (robking) wrote:
 The only nit that I have, and not sure we have any way around it 
 today, is the size of the test buffer being hard coded to 32.
 Seems eventually that should be a #define for a given implementation's
 capabilities, or perhaps a minimum guaranteed on all ODP platforms.

I can't find it in ML, but I've raised this issue some time ago.
If platform's RNG don't have enough random bytes to fill
odp_random_data() request, then we have at least two options:
1. odp_random_data() returns whatever number of bytes are available.
   It can be even 0 bytes until new random bytes are generated.
   Application have to repeat odp_random_data() in a loop to fill a
   whole buffer.
2. odp_random_data() can block for some time, while implementation
   polls RNG to fill a whole requested buffer.

At that time we agreed that #2 is better.

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


[lng-odp] [PATCH] validation: crypto: destroy session in case of failure

2015-02-26 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/crypto/odp_crypto_test_async_inp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c 
b/test/validation/crypto/odp_crypto_test_async_inp.c
index aff93da..9e4e9f1 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_async_inp.c
@@ -92,8 +92,8 @@ static void alg_test(enum odp_crypto_op op,
 
rc = odp_crypto_operation(op_params, posted, NULL);
if (rc  0) {
-   odp_packet_free(pkt);
-   CU_FAIL_FATAL(Failed odp_crypto_operation());
+   CU_FAIL(Failed odp_crypto_operation());
+   goto cleanup;
}
CU_ASSERT(posted);
 
@@ -112,7 +112,7 @@ static void alg_test(enum odp_crypto_op op,
CU_ASSERT(!memcmp(data_addr, output_vec, output_vec_len));
 
CU_ASSERT(result.ctx == (void *)0xdeadbeef);
-
+cleanup:
rc = odp_crypto_session_destroy(session);
CU_ASSERT(!rc);
 
-- 
1.9.1


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


Re: [lng-odp] [PATCH] validation: crypto: split crypto and random tests

2015-02-26 Thread Taras Kondratiuk
On 02/26/2015 05:45 PM, Mike Holmes wrote:
 We need to throttle change in 1.0 to only ODP API only now.
 This should go in 1.0.1 

That's fine.
But it can be reviewed anyway :)

-- 
Taras Kondratiuk

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


Re: [lng-odp] One clang error left for linux-generic 1.0

2015-02-26 Thread Taras Kondratiuk
On 02/26/2015 03:36 PM, Mike Holmes wrote:
 Making all in linux-generic
 make[2]: Entering directory '/home/mike/git/odp/platform/linux-generic'
   CC   odp_crypto.lo
 odp_crypto.c:164:10: error: implicit conversion from enumeration type
 'enum odp_crypto_ses_create_err' to different enumeration type
   'enum crypto_alg_err' [-Werror,-Wenum-conversion]
 return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
 ~~ ^~~~
 odp_crypto.c:202:10: error: implicit conversion from enumeration type
 'enum odp_crypto_ses_create_err' to different enumeration type
   'enum crypto_alg_err' [-Werror,-Wenum-conversion]
 return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
 ~~ ^~~~
 

Fix is reviewed already
http://lists.linaro.org/pipermail/lng-odp/2015-February/009284.html

-- 
Taras Kondratiuk

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


Re: [lng-odp] git diff patience

2015-02-26 Thread Taras Kondratiuk
On 02/26/2015 03:58 AM, Zoltan Kiss wrote:
 Hi,
 
 We had a chat about this on Connect, a regular problem is that diff
 sometimes generates patch files which are hardly readable, because e.g.
 the new and old lines are mixed together into an incoherent mass. That's
 because it tries to do the smallest patch. You can change that behaviour:
 
 git diff --patience
 git config --global diff.algorithm patience
 
 It works especially when you replace large blocks of lines.

Thanks, great hint!

-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH] linux-generic: move compiler hints to a proper place

2015-02-26 Thread Taras Kondratiuk
On 02/05/2015 11:13 AM, Taras Kondratiuk wrote:
 Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
 ---
  include/odp/api/hints.h | 12 
  platform/linux-generic/include/odp_debug_internal.h | 19 ---
  2 files changed, 12 insertions(+), 19 deletions(-)

A there any objections for this patch?

-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH] linux-generic: move compiler hints to a proper place

2015-02-26 Thread Taras Kondratiuk
On 02/26/2015 01:47 PM, Taras Kondratiuk wrote:
 On 02/05/2015 11:13 AM, Taras Kondratiuk wrote:
 Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
 ---
  include/odp/api/hints.h | 12 
  platform/linux-generic/include/odp_debug_internal.h | 19 ---
  2 files changed, 12 insertions(+), 19 deletions(-)
 
 A there any objections for this patch?
 
Sorry, that supposed to be:
Are there any objections to this patch?

-- 
Taras Kondratiuk

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


[lng-odp] [RFC 2/2] validation: crypto: combine sync and async tests

2015-02-26 Thread Taras Kondratiuk
Sync and Async crypto tests are almost identical and have a lot
duplicated code.
Move unique configuration into testsuite's init function and reuse Async
test code for both Sync and Async.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/Makefile.am|   3 +-
 ...ypto_test_async_inp.c = odp_crypto_test_inp.c} |  49 +++-
 ...ypto_test_async_inp.h = odp_crypto_test_inp.h} |   8 +-
 test/validation/crypto/odp_crypto_test_sync_inp.c  | 271 -
 test/validation/crypto/odp_crypto_test_sync_inp.h  |  17 --
 test/validation/odp_crypto.c   |   9 +-
 6 files changed, 50 insertions(+), 307 deletions(-)
 rename test/validation/crypto/{odp_crypto_test_async_inp.c = 
odp_crypto_test_inp.c} (90%)
 rename test/validation/crypto/{odp_crypto_test_async_inp.h = 
odp_crypto_test_inp.h} (62%)
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.c
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.h

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 0639205..a9e1a43 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -41,8 +41,7 @@ dist_odp_classification_SOURCES = 
classification/odp_classification_tests.c \
classification/odp_classification_basic.c \
odp_classification.c $(ODP_CU_COMMON)
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
-dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
- crypto/odp_crypto_test_sync_inp.c \
+dist_odp_crypto_SOURCES = crypto/odp_crypto_test_inp.c \
  odp_crypto.c $(ODP_CU_COMMON)
 dist_odp_init_SOURCES  = odp_init.c
 dist_odp_init_abort_SOURCES = odp_init_abort.c
diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c 
b/test/validation/crypto/odp_crypto_test_inp.c
similarity index 90%
rename from test/validation/crypto/odp_crypto_test_async_inp.c
rename to test/validation/crypto/odp_crypto_test_inp.c
index 494a68e..38e84e0 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_inp.c
@@ -6,8 +6,16 @@
 
 #include odp.h
 #include CUnit/Basic.h
-#include CUnit/TestDB.h
 #include test_vectors.h
+#include odp_crypto_test_inp.h
+
+struct suite_context_s {
+   enum odp_crypto_op_mode pref_mode;
+   odp_pool_t pool;
+   odp_queue_t queue;
+};
+
+static struct suite_context_s suite_context;
 
 /* Basic algorithm run function for async inplace mode.
  * Creates a session from input parameters and runs one operation
@@ -38,21 +46,16 @@ static void alg_test(enum odp_crypto_op op,
odp_crypto_compl_t compl_event;
odp_crypto_op_result_t result;
 
-   odp_queue_t compl_queue = odp_queue_lookup(crypto-out);
-   CU_ASSERT(compl_queue != ODP_QUEUE_INVALID);
-   odp_pool_t pool = odp_pool_lookup(packet_pool);
-   CU_ASSERT(pool != ODP_POOL_INVALID);
-
/* Create a crypto session */
odp_crypto_session_params_t ses_params;
memset(ses_params, 0, sizeof(ses_params));
ses_params.op = op;
ses_params.auth_cipher_text = false;
-   ses_params.pref_mode = ODP_CRYPTO_ASYNC;
+   ses_params.pref_mode = suite_context.pref_mode;
ses_params.cipher_alg = cipher_alg;
ses_params.auth_alg = auth_alg;
-   ses_params.compl_queue = compl_queue;
-   ses_params.output_pool = pool;
+   ses_params.compl_queue = suite_context.queue;
+   ses_params.output_pool = suite_context.pool;
ses_params.cipher_key = cipher_key;
ses_params.iv = ses_iv;
ses_params.auth_key = auth_key;
@@ -62,7 +65,7 @@ static void alg_test(enum odp_crypto_op op,
CU_ASSERT(status == ODP_CRYPTO_SES_CREATE_ERR_NONE);
 
/* Prepare input data */
-   odp_packet_t pkt = odp_packet_alloc(pool, input_vec_len);
+   odp_packet_t pkt = odp_packet_alloc(suite_context.pool, input_vec_len);
CU_ASSERT(pkt != ODP_PACKET_INVALID);
uint8_t *data_addr = odp_packet_data(pkt);
memcpy(data_addr, input_vec, input_vec_len);
@@ -291,7 +294,31 @@ static void alg_hmac_md5(void)
}
 }
 
-CU_TestInfo test_array_async[] = {
+int suite_sync_inp_init(void)
+{
+   suite_context.pool = odp_pool_lookup(packet_pool);
+   if (suite_context.pool == ODP_POOL_INVALID)
+   return -1;
+
+   suite_context.queue = ODP_QUEUE_INVALID;
+   suite_context.pref_mode = ODP_CRYPTO_SYNC;
+   return 0;
+}
+
+int suite_async_inp_init(void)
+{
+   suite_context.pool = odp_pool_lookup(packet_pool);
+   if (suite_context.pool == ODP_POOL_INVALID)
+   return -1;
+   suite_context.queue = odp_queue_lookup(crypto-out);
+   if (suite_context.queue == ODP_QUEUE_INVALID)
+   return -1;
+
+   suite_context.pref_mode = ODP_CRYPTO_ASYNC;
+   return 0;
+}
+
+CU_TestInfo test_array_inp

[lng-odp] [RFC 1/2] validation: crypto: handle synchronous operations in async test

2015-02-26 Thread Taras Kondratiuk
Current API can't force crypto operation to be strictly sync or async.
Hence test should handle synchronous operation even if 'pref_mode' is
set to ODP_CRYPTO_ASYNC.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/crypto/odp_crypto_test_async_inp.c | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c 
b/test/validation/crypto/odp_crypto_test_async_inp.c
index 9e4e9f1..494a68e 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_async_inp.c
@@ -90,21 +90,22 @@ static void alg_test(enum odp_crypto_op op,
CU_FAIL(%s : not implemented for combined alg mode\n);
}
 
-   rc = odp_crypto_operation(op_params, posted, NULL);
+   rc = odp_crypto_operation(op_params, posted, result);
if (rc  0) {
CU_FAIL(Failed odp_crypto_operation());
goto cleanup;
}
-   CU_ASSERT(posted);
 
-   /* Poll completion queue for results */
-   do {
-   event = odp_queue_deq(compl_queue);
-   } while (event == ODP_EVENT_INVALID);
+   if (posted) {
+   /* Poll completion queue for results */
+   do {
+   event = odp_queue_deq(suite_context.queue);
+   } while (event == ODP_EVENT_INVALID);
 
-   compl_event = odp_crypto_compl_from_event(event);
-   odp_crypto_compl_result(compl_event, result);
-   odp_crypto_compl_free(compl_event);
+   compl_event = odp_crypto_compl_from_event(event);
+   odp_crypto_compl_result(compl_event, result);
+   odp_crypto_compl_free(compl_event);
+   }
 
CU_ASSERT(result.ok);
CU_ASSERT(result.pkt == pkt);
-- 
1.9.1


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


[lng-odp] [RFC 0/2] validation: crypto: remove code duplication

2015-02-26 Thread Taras Kondratiuk
Current crypto tests have a few issues:
- Asynchronous tests assume that operation is always executed asynchronously,
  but specification does not demand it (I hope I read it correctly). So tests
  have to handle synchronous operations also. 
- If the first issue is solved, then Sync test is a subset of Async -
  they can't be merged.

The same approach should allow to easily add tests for 'out of place'
operations.

Taras Kondratiuk (2):
  validation: crypto: handle synchronous operations in async test
  validation: crypto: combine sync and async tests

 test/validation/Makefile.am|   3 +-
 ...ypto_test_async_inp.c = odp_crypto_test_inp.c} |  68 --
 ...ypto_test_async_inp.h = odp_crypto_test_inp.h} |   8 +-
 test/validation/crypto/odp_crypto_test_sync_inp.c  | 271 -
 test/validation/crypto/odp_crypto_test_sync_inp.h  |  17 --
 test/validation/odp_crypto.c   |   9 +-
 6 files changed, 60 insertions(+), 316 deletions(-)
 rename test/validation/crypto/{odp_crypto_test_async_inp.c = 
odp_crypto_test_inp.c} (86%)
 rename test/validation/crypto/{odp_crypto_test_async_inp.h = 
odp_crypto_test_inp.h} (62%)
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.c
 delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.h

-- 
1.9.1


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


[lng-odp] [PATCH] linux-generic: crypto: check 'result' pointer

2015-02-26 Thread Taras Kondratiuk
Check 'result' pointer before dereferencing it in case of synchronous
operation.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/odp_crypto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 2f13e2f..f7e6e02 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -435,6 +435,8 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
*posted = 1;
} else {
/* Synchronous, simply return results */
+   if (!result)
+   return -1;
*result = local_result;
 
/* Indicate to caller operation was sync */
-- 
1.9.1


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


Re: [lng-odp] [PATCH] validation: queue: destroy created ODP resources

2015-02-25 Thread Taras Kondratiuk
On 02/25/2015 03:31 PM, Maxim Uvarov wrote:
 Taras, I think it's no need to make pool global var. There is pool 
 lookup and
 Bill already did patch for that:
 [PATCH] validation: queue: clean up test toenable clean termination

Hmm. I've missed that patch, but anyway it is not correct. Test should
not destroy resource created by testsuite init function, because it can
be used by other tests.

What are you concern regarding global variable for a pool? Why to do a
lookup if you can just save a handle?

-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCHv1 1/4] linux-generic: odp_crypto: change session allocation to free list

2015-02-25 Thread Taras Kondratiuk
On 02/25/2015 09:30 PM, Robbie King wrote:
 Signed-off-by: Robbie King robk...@cisco.com
 ---
  .../linux-generic/include/odp_crypto_internal.h|  2 +-
  platform/linux-generic/odp_crypto.c| 33 
 +-
  2 files changed, 21 insertions(+), 14 deletions(-)

Reviewed-by: Taras Kondratiuk taras.kondrat...@linaro.org

-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCHv1 0/4] linux-generic: crypto: implement session destroy function

2015-02-25 Thread Taras Kondratiuk
On 02/25/2015 09:30 PM, Robbie King wrote:
 v1: Change session allocation to use free list, add check to
 term_global to verify all sessions have been destroyed,
 add session_destory implementation and add destroy call
 to sync and async validation tests.
 
 Robbie King (4):
   linux-generic: odp_crypto: change session allocation to free list
   linux-generic: odp_crypto: add all sessions free term check
   linux-generic: odp_crypto: add session_destory implementation
   validation: crypto: verify session_destroy
 
  .../linux-generic/include/odp_crypto_internal.h|  2 +-
  platform/linux-generic/odp_crypto.c| 70 
 +-
  test/validation/crypto/odp_crypto_test_async_inp.c |  3 +
  test/validation/crypto/odp_crypto_test_sync_inp.c  |  3 +
  4 files changed, 61 insertions(+), 17 deletions(-)
 

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

-- 
Taras Kondratiuk

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


[lng-odp] [PATCH] validation: pktio: don't use __odp_errno directly

2015-02-25 Thread Taras Kondratiuk
__odp_errno is a private variable.
odp_errno() function should be used instead.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/odp_pktio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 3f9de3c..96a143d 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -522,7 +522,7 @@ static void test_odp_pktio_lookup(void)
CU_ASSERT(odp_pktio_lookup(iface_name[0]) == pktio);
 
pktio_inval = odp_pktio_open(iface_name[0], default_pkt_pool);
-   CU_ASSERT(__odp_errno == EEXIST);
+   CU_ASSERT(odp_errno() == EEXIST);
CU_ASSERT(pktio_inval == ODP_PKTIO_INVALID);
 
CU_ASSERT(odp_pktio_close(pktio) == 0);
-- 
1.9.1


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


[lng-odp] [PATCH] validation: queue: destroy created ODP resources

2015-02-25 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/odp_queue.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
index 91a32dc..5d47399 100644
--- a/test/validation/odp_queue.c
+++ b/test/validation/odp_queue.c
@@ -12,10 +12,10 @@
 #define CONFIG_MAX_ITERATION(100)
 
 static int queue_contest = 0xff;
+static odp_pool_t pool;
 
 static int init_queue_suite(void)
 {
-   odp_pool_t pool;
odp_pool_param_t params;
 
params.buf.size  = 0;
@@ -32,6 +32,11 @@ static int init_queue_suite(void)
return 0;
 }
 
+static int init_queue_finalize(void)
+{
+   return odp_pool_destroy(pool);
+}
+
 static void test_odp_queue_sunnyday(void)
 {
odp_queue_t queue_creat_id, queue_id;
@@ -103,6 +108,7 @@ static void test_odp_queue_sunnyday(void)
odp_buffer_free(enbuf);
}
 
+   CU_ASSERT(odp_queue_destroy(queue_id) == 0);
return;
 }
 
@@ -112,6 +118,7 @@ CU_TestInfo test_odp_queue[] = {
 };
 
 CU_SuiteInfo odp_testsuites[] = {
-   {Queue, init_queue_suite, NULL, NULL, NULL, test_odp_queue},
+   {Queue, init_queue_suite, init_queue_finalize,
+   NULL, NULL, test_odp_queue},
CU_SUITE_INFO_NULL,
 };
-- 
1.9.1


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


[lng-odp] [PATCH] api: crypto: add session destroy function

2015-02-25 Thread Taras Kondratiuk
Number of crypto sessions may be limited by HW. Application should be
able to destroy unused sessions.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 include/odp/api/crypto.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index da035cb..bc6b27e 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -279,6 +279,19 @@ odp_crypto_session_create(odp_crypto_session_params_t 
*params,
  enum odp_crypto_ses_create_err *status);
 
 /**
+ * Crypto session destroy
+ *
+ * Destroy an unused session. Result is undefined if session is being used
+ * (i.e. asynchronous operation is in progress).
+ *
+ * @param session   Session handle
+ *
+ * @retval 0 on success
+ * @retval 0 on failure
+ */
+int odp_crypto_session_destroy(odp_crypto_session_t session);
+
+/**
  * Return crypto completion handle that is associated with event
  *
  * Note: any invalid parameters will cause undefined behavior and may cause
-- 
1.9.1


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


Re: [lng-odp] [PATCH] linux-generic: timer: fix allocation from an empty pool

2015-02-25 Thread Taras Kondratiuk
On 02/24/2015 02:33 PM, Taras Kondratiuk wrote:
 Allocation timeout from an empty pool causes segmentation fault
 because an invalid event it passed to odp_timeout_from_event() which

Maxim, will you be able to fix a typo during merge?
s/event it passed/event is passed/

 eventually calls _odp_buffer_type() with ODP_BUFFER_INVALID.
 
 Check allocated buffer before passing it further.
 
 Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
 ---
  platform/linux-generic/odp_timer.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/platform/linux-generic/odp_timer.c 
 b/platform/linux-generic/odp_timer.c
 index 7b5fe15..61a02b6 100644
 --- a/platform/linux-generic/odp_timer.c
 +++ b/platform/linux-generic/odp_timer.c
 @@ -845,6 +845,8 @@ void *odp_timeout_user_ptr(odp_timeout_t tmo)
  odp_timeout_t odp_timeout_alloc(odp_pool_t pool)
  {
   odp_buffer_t buf = odp_buffer_alloc(pool);
 + if (odp_unlikely(buf == ODP_BUFFER_INVALID))
 + return ODP_TIMEOUT_INVALID;
   return odp_timeout_from_event(odp_buffer_to_event(buf));
  }
  
 


-- 
Taras Kondratiuk

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


[lng-odp] [PATCH] linux-generic: weak: move stdarg.h include from odp_debug_internal.h

2015-02-25 Thread Taras Kondratiuk
stdarg.h is not needed in odp_debug_internal.h, but instead should be
included in odp_weak.c.

The change is needed to be able to reuse odp_weak.c from other
platforms.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/include/odp_debug_internal.h | 1 -
 platform/linux-generic/odp_weak.c   | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index ff43ffc..d9ac812 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -18,7 +18,6 @@
 
 #include stdio.h
 #include stdlib.h
-#include stdarg.h
 #include odp/debug.h
 #include odp_internal.h
 #ifdef __cplusplus
diff --git a/platform/linux-generic/odp_weak.c 
b/platform/linux-generic/odp_weak.c
index 9dc3a4a..9641f45 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -9,6 +9,8 @@
 #include odp_debug_internal.h
 #include odp/hints.h
 
+#include stdarg.h
+
 ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level ODP_UNUSED,
 const char *fmt, ...)
 {
-- 
1.9.1


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


[lng-odp] [PATCH 2/3] validation: crypto: verify odp_crypto_operation() return code

2015-02-25 Thread Taras Kondratiuk
It doesn't make sense to process crypto operation results if operation
have failed.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/crypto/odp_crypto_test_async_inp.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c 
b/test/validation/crypto/odp_crypto_test_async_inp.c
index 53bb8d9..9f449e4 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_async_inp.c
@@ -91,6 +91,10 @@ static void alg_test(enum odp_crypto_op op,
}
 
rc = odp_crypto_operation(op_params, posted, NULL);
+   if (rc  0) {
+   odp_packet_free(pkt);
+   CU_FAIL_FATAL(Failed odp_crypto_operation());
+   }
CU_ASSERT(posted);
 
/* Poll completion queue for results */
-- 
1.9.1


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


[lng-odp] [PATCH 0/3] validation: crypto: few fixes

2015-02-25 Thread Taras Kondratiuk
Patches are independent and can be applied separately.

Taras Kondratiuk (3):
  validation: crypto: don't create completion pool
  validation: crypto: verify odp_crypto_operation() return code
  validation: crypto: don't check detailed operation status

 test/validation/crypto/odp_crypto_test_async_inp.c |  9 -
 test/validation/odp_crypto.c   | 12 
 2 files changed, 4 insertions(+), 17 deletions(-)

-- 
1.9.1


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


[lng-odp] [PATCH 3/3] validation: crypto: don't check detailed operation status

2015-02-25 Thread Taras Kondratiuk
Detailed status have to be filled only in case of failed operation.
So don't verify it in case of success.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/crypto/odp_crypto_test_async_inp.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c 
b/test/validation/crypto/odp_crypto_test_async_inp.c
index 9f449e4..5675fd7 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_async_inp.c
@@ -107,11 +107,6 @@ static void alg_test(enum odp_crypto_op op,
odp_crypto_compl_free(compl_event);
 
CU_ASSERT(result.ok);
-   CU_ASSERT(result.auth_status.alg_err == ODP_CRYPTO_ALG_ERR_NONE);
-   CU_ASSERT(result.auth_status.hw_err == ODP_CRYPTO_HW_ERR_NONE);
-   CU_ASSERT(result.cipher_status.alg_err == ODP_CRYPTO_ALG_ERR_NONE);
-   CU_ASSERT(result.cipher_status.hw_err == ODP_CRYPTO_HW_ERR_NONE);
-
CU_ASSERT(result.pkt == pkt);
 
CU_ASSERT(!memcmp(data_addr, output_vec, output_vec_len));
-- 
1.9.1


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


[lng-odp] [PATCHv2 3/3] validation: odp_init_log: fix clang format string error

2015-02-24 Thread Taras Kondratiuk
From: Mike Holmes mike.hol...@linaro.org

odp_init_log.c:75:23: error: format string is not a string literal
  [-Werror,-Wformat-nonliteral]
r = vfprintf(stderr, fmt, args);

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

Signed-off-by: Mike Holmes mike.hol...@linaro.org
Reviewed-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/odp_init_log.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/validation/odp_init_log.c b/test/validation/odp_init_log.c
index c072147..275d343 100644
--- a/test/validation/odp_init_log.c
+++ b/test/validation/odp_init_log.c
@@ -10,6 +10,7 @@
 
 int replacement_logging_used;
 
+ODP_PRINTF_FORMAT(2, 3)
 static int odp_init_log(odp_log_level_e level , const char *fmt, ...);
 
 static void test_odp_init_global_replace_log(void)
-- 
1.9.1


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


[lng-odp] [PATCHv2 2/3] linux-generic: weak: fix -Wformat-nonliteral warning

2015-02-24 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/odp_weak.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_weak.c 
b/platform/linux-generic/odp_weak.c
index 9dc3a4a..7fa5955 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -9,8 +9,8 @@
 #include odp_debug_internal.h
 #include odp/hints.h
 
-ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level ODP_UNUSED,
-const char *fmt, ...)
+ODP_WEAK_SYMBOL ODP_PRINTF_FORMAT(2, 3)
+int odp_override_log(odp_log_level_e level ODP_UNUSED, const char *fmt, ...)
 {
va_list args;
int r;
-- 
1.9.1


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


[lng-odp] [PATCHv2 0/3] fix clang build -Wformat-nonliteral error

2015-02-24 Thread Taras Kondratiuk
v2: No code change. Updated commit messages and grouped dependent
patches together.

Mike Holmes (1):
  validation: odp_init_log: fix clang format string error

Taras Kondratiuk (2):
  api: hints: add printf format attribute
  linux-generic: weak: fix -Wformat-nonliteral warning

 include/odp/api/hints.h   | 5 +
 platform/linux-generic/odp_weak.c | 4 ++--
 test/validation/odp_init_log.c| 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

-- 
1.9.1


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


[lng-odp] [PATCHv2 1/3] api: hints: add printf format attribute

2015-02-24 Thread Taras Kondratiuk
The patch triggers checkpatch warning, but the warning is Linux kernel
specific and should be ignored.

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

diff --git a/include/odp/api/hints.h b/include/odp/api/hints.h
index b7b0609..4211994 100644
--- a/include/odp/api/hints.h
+++ b/include/odp/api/hints.h
@@ -46,6 +46,11 @@ extern C {
 #define ODP_COLD_CODE   __attribute__((__cold__))
 
 /**
+ * Printf format attribute
+ */
+#define ODP_PRINTF_FORMAT(x, y) __attribute__((format(printf, (x), (y
+
+/**
  * Branch likely taken
  */
 #define odp_likely(x)   __builtin_expect((x), 1)
-- 
1.9.1


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


Re: [lng-odp] [PATCH] validation: odp_init_log: fix clang format string error

2015-02-24 Thread Taras Kondratiuk
On 02/20/2015 07:27 PM, Mike Holmes wrote:
 odp_init_log.c:75:23: error: format string is not a string literal
   [-Werror,-Wformat-nonliteral]
 r = vfprintf(stderr, fmt, args);
 
 Fixes https://bugs.linaro.org/show_bug.cgi?id=1248
 
 Signed-off-by: Mike Holmes mike.hol...@linaro.org

Reviewed-by: Taras Kondratiuk taras.kondrat...@linaro.org

I'll repost this patch with its dependency in one series.

-- 
Taras Kondratiuk

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


[lng-odp] [PATCHv2 1/2] api: crypto: add error code for invalid IV

2015-02-24 Thread Taras Kondratiuk
Add an error code for a case when a session is created without
specifying an IV value, and then crypto operation is invoked without
a valid override_iv_ptr.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 include/odp/api/crypto.h   | 3 +++
 platform/linux-generic/include/odp/plat/crypto_types.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index a71753c..506f765 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -223,6 +223,9 @@ typedef struct odp_crypto_op_params {
  *
  * @enum crypto_alg_err:ODP_CRYPTO_ALG_ERR_ICV_CHECK
  * Computed ICV value mismatch
+ *
+ * @enum crypto_alg_err:ODP_CRYPTO_ALG_ERR_IV_INVALID
+ * IV value not specified
  */
 
 /**
diff --git a/platform/linux-generic/include/odp/plat/crypto_types.h 
b/platform/linux-generic/include/odp/plat/crypto_types.h
index 3c26aa1..1b10a5d 100644
--- a/platform/linux-generic/include/odp/plat/crypto_types.h
+++ b/platform/linux-generic/include/odp/plat/crypto_types.h
@@ -60,6 +60,7 @@ enum crypto_alg_err {
ODP_CRYPTO_ALG_ERR_DATA_SIZE,
ODP_CRYPTO_ALG_ERR_KEY_SIZE,
ODP_CRYPTO_ALG_ERR_ICV_CHECK,
+   ODP_CRYPTO_ALG_ERR_IV_INVALID,
 };
 
 enum crypto_hw_err {
-- 
1.9.1


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


[lng-odp] [PATCHv2 0/2] fix crypto operation return code for invalid IV

2015-02-24 Thread Taras Kondratiuk
v2: added a separate return code for this case

Taras Kondratiuk (2):
  api: crypto: add error code for invalid IV
  linux-generic: crypto: fix crypto operation return code for invalid IV

 include/odp/api/crypto.h   | 3 +++
 platform/linux-generic/include/odp/plat/crypto_types.h | 1 +
 platform/linux-generic/odp_crypto.c| 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

-- 
1.9.1


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


[lng-odp] [PATCHv2 2/2] linux-generic: crypto: fix crypto operation return code for invalid IV

2015-02-24 Thread Taras Kondratiuk
Current code returns an incompatible enum value as an error code in
case of not specified IV. Use a proper return code instead.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/odp_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index bc0f961..9635453 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -161,7 +161,7 @@ enum crypto_alg_err des_encrypt(odp_crypto_op_params_t 
*params,
else if (session-cipher.iv.data)
iv_ptr = session-cipher.iv.data;
else
-   return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+   return ODP_CRYPTO_ALG_ERR_IV_INVALID;
 
/*
 * Create a copy of the IV.  The DES library modifies IV
@@ -199,7 +199,7 @@ enum crypto_alg_err des_decrypt(odp_crypto_op_params_t 
*params,
else if (session-cipher.iv.data)
iv_ptr = session-cipher.iv.data;
else
-   return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+   return ODP_CRYPTO_ALG_ERR_IV_INVALID;
 
/*
 * Create a copy of the IV.  The DES library modifies IV
-- 
1.9.1


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


Re: [lng-odp] [PATCH] validation: init: include stdlib.h for abort()

2015-02-24 Thread Taras Kondratiuk
On 02/08/2015 11:20 PM, Maxim Uvarov wrote:
 Taras, do you see compilation error without stdlib.h?

Sorry I've missed your reply.

Yes I see it in linux-keystone implementation.
You don't see it in linux-generic just because stdlib.h is included via
some ODP header. Tests should not rely on this.

-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH] validation: buffer: split pool, buffer and packet tests

2015-02-19 Thread Taras Kondratiuk

On 02/13/2015 05:13 AM, Bill Fischofer wrote:



On Fri, Feb 13, 2015 at 10:59 AM, Taras Kondratiuk
taras.kondrat...@linaro.org mailto:taras.kondrat...@linaro.org wrote:

Split pools, buffers, packets tests into separate executables to make
them independent.

Alloc and free API functions are now part of corresponding event types:
buffers, packets, timeouts, etc. Hence remove them from pool tests.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
mailto:taras.kondrat...@linaro.org


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



Maxim, could you please merge this patch?

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


Re: [lng-odp] [PATCH] validation: buffer: split pool, buffer and packet tests

2015-02-19 Thread Taras Kondratiuk

On 02/19/2015 01:23 PM, Maxim Uvarov wrote:

On 02/19/2015 01:43 PM, Taras Kondratiuk wrote:

On 02/13/2015 05:13 AM, Bill Fischofer wrote:



On Fri, Feb 13, 2015 at 10:59 AM, Taras Kondratiuk
taras.kondrat...@linaro.org mailto:taras.kondrat...@linaro.org
wrote:

Split pools, buffers, packets tests into separate executables to
make
them independent.

Alloc and free API functions are now part of corresponding event
types:
buffers, packets, timeouts, etc. Hence remove them from pool tests.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
mailto:taras.kondrat...@linaro.org


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



Maxim, could you please merge this patch?


Taras I see that odp_timer test which called from make check begin to
crash after that change.
#0  0x0040f1f7 in _odp_buffer_type (buf=0x) at
odp_buffer.c:47
#1  0x00405cc8 in odp_event_type (event=0x) at
odp_event.c:18
#2  0x0040ecfb in odp_timeout_from_event (ev=0x) at
odp_timer.c:802
#3  0x0040ee87 in odp_timeout_alloc (pool=0x1) at odp_timer.c:848
#4  0x0040212e in test_timeout_pool_free () at odp_timer.c:115

odp_timeout_t odp_timeout_alloc(odp_pool_t pool)
{
 odp_buffer_t buf = odp_buffer_alloc(pool); - returned invalid buf
here
 return odp_timeout_from_event(odp_buffer_to_event(buf));
}


Looks like a bug in linux-generic odp_buffer_alloc().

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


Re: [lng-odp] [PATCH] linux-generic: remove forward declarations of cos_t and pmr_t

2015-02-18 Thread Taras Kondratiuk

On 02/17/2015 11:35 PM, Maxim Uvarov wrote:

On 02/17/2015 11:28 PM, Bala wrote:

Reviewed-by: Bala Manoharan  bala.manoha...@linaro.org
mailto:bala.manoha...@linaro.org
P.S: A similar patch was proposed earlier by Taras also.


Yes, somehow everybody skipped review of Tarases patch set.


Yes, please review that series if we still need Clang support.


In current patch there is small difference, Taras left:

+union cos_u;
+union pmr_u;

And I don't. That is not needed.


I used to explicitly forward define structures or unions if they are 
used before definition, but in this case it seems to be redundant.


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


Re: [lng-odp] [PATCH v2 00/10] add global and local termination

2015-02-18 Thread Taras Kondratiuk

On 02/18/2015 05:53 PM, Robbie King (robking) wrote:

Hey Mike (and everyone else),

I noticed this code is replicated throughout the patch:

cos_shm = odp_shm_lookup(shm_odp_cos_tbl);
if (cos_shm == ODP_SHM_INVALID)
return -1;
ret = odp_shm_free(cos_shm);

As I was looking to make the changes we discussed (continue
on versus returning -1) it seemed instead of replicating
even more code it would be better to have some cleaner way
of doing this.

One possibility is to simply nest the calls (shm_free just
returns -1 if passed SHM_INVALID).

   ret = odp_shm_free(odp_shm_lookup(shm_odp_cos_tbl));

Another option is to create a helper function, something like:

   ret = odp_shm_free_by_name(shm_odp_cos_tbl);

If the helper is the way to go, then it could either be internal
or published API.  Any thoughts on the correct solution?

1) nested calls
2) internal API
3) published API


I prefer a forth option :)
Save allocated odp_shm_t handle and don't lookup it.

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


Re: [lng-odp] [PATCH v2 00/10] add global and local termination

2015-02-17 Thread Taras Kondratiuk

On 02/17/2015 05:49 PM, Maxim Uvarov wrote:

On 02/17/2015 06:35 PM, Taras Kondratiuk wrote:

On 02/17/2015 05:26 PM, Maxim Uvarov wrote:

On 02/17/2015 06:09 PM, Taras Kondratiuk wrote:

On 02/17/2015 05:04 PM, Maxim Uvarov wrote:

On 02/17/2015 05:50 PM, Taras Kondratiuk wrote:

On 02/17/2015 04:42 PM, Maxim Uvarov wrote:

d)
loop of term and init functions as test for memory / resource leaks.


Current agreement is to have only one global init call per
process, so
we can't run them in cycle.


So we can not call global_term / global_init in the loop?


We can't.

If we can not call that in the loop then having global_term is really
strange. How can we know that it works or not?
As I thought before global_term is needed to shutdown everything
correctly so it should be possible to do another init.


Right. To do another init in a *new* process.
So you need it to be able to restart application several times.

If it's new process why do we then free all pools and buffers for
linux-generic? We can just terminate application and everything will be
cleaned.


Linux-generic doesn't free pools in global_term. It just checks whether
all pools are closed to make sure that application did clean-up
correctly. Buffers are flushed from local cache, but that is in
local_term.

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


Re: [lng-odp] [PATCH] linus-generic: debug: Allow formatted ODP_ASSERT

2015-02-17 Thread Taras Kondratiuk

On 02/12/2015 02:31 AM, Mike Holmes wrote:

looks good to me, did you force an abort call to check it works?
I see about 23 locations in the current implementation that call abort,
but I don't know if any can be triggered by API calls in the unit tests
to prove this works.


Please ignore it. I'll post v2.

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


Re: [lng-odp] [PATCH v2 00/10] add global and local termination

2015-02-17 Thread Taras Kondratiuk

On 02/17/2015 05:26 PM, Maxim Uvarov wrote:

On 02/17/2015 06:09 PM, Taras Kondratiuk wrote:

On 02/17/2015 05:04 PM, Maxim Uvarov wrote:

On 02/17/2015 05:50 PM, Taras Kondratiuk wrote:

On 02/17/2015 04:42 PM, Maxim Uvarov wrote:

On 02/17/2015 04:11 PM, Mike Holmes wrote:



On 17 February 2015 at 07:57, Maxim Uvarov maxim.uva...@linaro.org
mailto:maxim.uva...@linaro.org wrote:

I think that this patches need to go with tests together.


No problem, which tests are needed ?
The terminate functions are already called by all the unit tests in
the sunny day case so I could not think of anything to add.


I think just to test different scenarios, like

a)
global init
layer term
global  term

b)
global init
layer term
layer term
layer init
global term

c)
global init
global term
layer term


What are 'layer init' and 'layer term'?


like classification_init / classification_term, crypto_init, crypto_term
and etc.
It will be great to have a check that all these platform functions do
not have resources leaks.


These are internal functions. You can't call them from API validation
tests.


it has to be some platform validation to prove that platform acquires /
frees all needed resources correctly.


Platform can have some internal tests. Or not. That's a choice of a
specific platform.









d)
loop of term and init functions as test for memory / resource leaks.


Current agreement is to have only one global init call per process, so
we can't run them in cycle.


So we can not call global_term / global_init in the loop?


We can't.

If we can not call that in the loop then having global_term is really
strange. How can we know that it works or not?
As I thought before global_term is needed to shutdown everything
correctly so it should be possible to do another init.


Right. To do another init in a *new* process.
So you need it to be able to restart application several times.

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


Re: [lng-odp] [PATCH v2 00/10] add global and local termination

2015-02-17 Thread Taras Kondratiuk

On 02/17/2015 05:04 PM, Maxim Uvarov wrote:

On 02/17/2015 05:50 PM, Taras Kondratiuk wrote:

On 02/17/2015 04:42 PM, Maxim Uvarov wrote:

On 02/17/2015 04:11 PM, Mike Holmes wrote:



On 17 February 2015 at 07:57, Maxim Uvarov maxim.uva...@linaro.org
mailto:maxim.uva...@linaro.org wrote:

I think that this patches need to go with tests together.


No problem, which tests are needed ?
The terminate functions are already called by all the unit tests in
the sunny day case so I could not think of anything to add.


I think just to test different scenarios, like

a)
global init
layer term
global  term

b)
global init
layer term
layer term
layer init
global term

c)
global init
global term
layer term


What are 'layer init' and 'layer term'?


like classification_init / classification_term, crypto_init, crypto_term
and etc.
It will be great to have a check that all these platform functions do
not have resources leaks.


These are internal functions. You can't call them from API validation
tests.







d)
loop of term and init functions as test for memory / resource leaks.


Current agreement is to have only one global init call per process, so
we can't run them in cycle.


So we can not call global_term / global_init in the loop?


We can't.

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


Re: [lng-odp] [PATCHv4 1/2] linux-generic: move api version to c file

2015-02-17 Thread Taras Kondratiuk

On 02/17/2015 02:08 PM, Maxim Uvarov wrote:

odp_version_api_str() in odp api defined as non static function and
there should be implementation in c file. Include required headers
so that str macro unrolls to correct version string.
https://bugs.linaro.org/show_bug.cgi?id=1194

Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
---
  platform/linux-generic/Makefile.am   |  1 +
  platform/linux-generic/include/odp/version.h | 14 --
  platform/linux-generic/odp_version.c | 17 +
  3 files changed, 18 insertions(+), 14 deletions(-)
  create mode 100644 platform/linux-generic/odp_version.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index c24d59d..16adccc 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -161,4 +161,5 @@ __LIB__libodp_la_SOURCES = \
   odp_ticketlock.c \
   odp_time.c \
   odp_timer.c \
+  odp_version.c \
   odp_weak.c
diff --git a/platform/linux-generic/include/odp/version.h 
b/platform/linux-generic/include/odp/version.h
index f29320a..c98cb30 100644
--- a/platform/linux-generic/include/odp/version.h
+++ b/platform/linux-generic/include/odp/version.h
@@ -18,20 +18,6 @@ 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

  #ifdef __cplusplus
diff --git a/platform/linux-generic/odp_version.c 
b/platform/linux-generic/odp_version.c
new file mode 100644
index 000..0a57b5e
--- /dev/null
+++ b/platform/linux-generic/odp_version.c
@@ -0,0 +1,17 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif


_GNU_SOURCE is not need here.
At least I don't see any issues without it.


+
+#include odp/api/version.h
+#include odp/plat/version_types.h


#include odp/version.h
will include them both.
Also you won't have to touch these lines in patch #2.


+
+const char *odp_version_api_str(void)
+{
+   return ODP_VERSION_API_STR;
+}



If above comment are addressed, then
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 0/6] correction for odp_imp/api/verions

2015-02-16 Thread Taras Kondratiuk
On 02/16/2015 02:07 PM, Maxim Uvarov wrote:
 On 02/16/2015 02:58 PM, Taras Kondratiuk wrote:
 On 02/11/2015 09:09 AM, Maxim Uvarov wrote:
 Patch 1 and 2 have to go before current tag. Others can go latter.


 Maxim Uvarov (6):
linux-generic: imp.c: remove header defines from c file
linux-generic: move api version to c file
linux-generic: kill version_types.h
linux-generic: remove header file garbage
linux-generic: kill odp_impl.c
linux-generic: move imp API number def to header file
 This series is confusing.
 It is not clear from cover letter why is it needed.
 Commit names or descriptions also doesn't help to understand this.

 The series is split into too many patches which are logically
 dependent. To understand what this series is doing one have to merge
 patches in mind or apply them locally. Some patches seems to be
 redundant. This looks like one logical change which can be one patch of
 digestible size.

 Taras, I sent before:
 [PATCHv4] api: fix odp_version_api_str()
 
 After that Anders said that he would like to see all changed sliced to 
 separate patches. So that I did that.

Hmm. I don't see Anders' reply on that patch.

-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH 1/6] linux-generic: imp.c: remove header defines from c file

2015-02-16 Thread Taras Kondratiuk
On 02/11/2015 09:10 AM, Maxim Uvarov wrote:
 Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
 ---
  platform/linux-generic/odp_impl.c | 5 -
  1 file changed, 5 deletions(-)
 
 diff --git a/platform/linux-generic/odp_impl.c 
 b/platform/linux-generic/odp_impl.c
 index ca3224d..f0a582e 100644
 --- a/platform/linux-generic/odp_impl.c
 +++ b/platform/linux-generic/odp_impl.c
 @@ -11,9 +11,6 @@
   * ODP Implementation information
   */
  
 -#ifndef ODP_IMPL_H_
 -#define ODP_IMPL_H_
 -
  #ifdef __cplusplus
  extern C {
  #endif

extern C should be also removed.

 @@ -31,5 +28,3 @@ const char *odp_version_impl_str(void)
  #ifdef __cplusplus
  }
  #endif
 -
 -#endif
 


-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH 4/6] linux-generic: remove header file garbage

2015-02-16 Thread Taras Kondratiuk
On 02/11/2015 09:10 AM, Maxim Uvarov wrote:
 Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
 ---
  platform/linux-generic/odp_impl.c | 14 --
  1 file changed, 14 deletions(-)
 
 diff --git a/platform/linux-generic/odp_impl.c 
 b/platform/linux-generic/odp_impl.c
 index f0a582e..3ad7e53 100644
 --- a/platform/linux-generic/odp_impl.c
 +++ b/platform/linux-generic/odp_impl.c
 @@ -5,16 +5,6 @@
   */
  
  
 -/**
 - * @file
 - *
 - * ODP Implementation information
 - */
 -
 -#ifdef __cplusplus
 -extern C {
 -#endif
 -

Why this isn't a part of a first patch?

  #include odp/version.h
  
  #define  ODP_VERSION_IMPL 0
 @@ -24,7 +14,3 @@ const char *odp_version_impl_str(void)
  {
   return ODP_VERSION_IMPL_STR;
  }
 -
 -#ifdef __cplusplus
 -}
 -#endif
 


-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH 5/6] linux-generic: kill odp_impl.c

2015-02-16 Thread Taras Kondratiuk
On 02/11/2015 09:10 AM, Maxim Uvarov wrote:
 Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
 ---
  platform/linux-generic/Makefile.am   |  1 -
  platform/linux-generic/odp_impl.c| 16 
  platform/linux-generic/odp_version.c |  8 
  3 files changed, 8 insertions(+), 17 deletions(-)
  delete mode 100644 platform/linux-generic/odp_impl.c

If odp_impl.c is removed, then why clean-up patches #1 and #4 are
needed?

-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH 6/6] linux-generic: move imp API number def to header file

2015-02-16 Thread Taras Kondratiuk
On 02/11/2015 09:10 AM, Maxim Uvarov wrote:
 Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org
 ---
  platform/linux-generic/include/odp/version.h | 3 +++
  platform/linux-generic/odp_version.c | 3 ---
  2 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/platform/linux-generic/include/odp/version.h 
 b/platform/linux-generic/include/odp/version.h
 index b5071e5..8a95221 100644
 --- a/platform/linux-generic/include/odp/version.h
 +++ b/platform/linux-generic/include/odp/version.h
 @@ -31,6 +31,9 @@ ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR)
  
  #include odp/api/version.h
  
 +#define  ODP_VERSION_IMPL 0
 +#define  ODP_VERSION_IMPL_STR ODP_VERSION_TO_STR(ODP_VERSION_IMPL)
 +

These macros are not part of an ODP API. Why they are moved here?

  #ifdef __cplusplus
  }
  #endif
 diff --git a/platform/linux-generic/odp_version.c 
 b/platform/linux-generic/odp_version.c
 index d54580c..776f4da 100644
 --- a/platform/linux-generic/odp_version.c
 +++ b/platform/linux-generic/odp_version.c
 @@ -16,9 +16,6 @@ const char *odp_version_api_str(void)
   return ODP_VERSION_API_STR;
  }
  
 -#define  ODP_VERSION_IMPL 0
 -#define  ODP_VERSION_IMPL_STR ODP_VERSION_TO_STR(ODP_VERSION_IMPL)
 -
  const char *odp_version_impl_str(void)
  {
   return ODP_VERSION_IMPL_STR;
 


-- 
Taras Kondratiuk

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


Re: [lng-odp] [PATCH 0/6] correction for odp_imp/api/verions

2015-02-16 Thread Taras Kondratiuk
On 02/11/2015 09:09 AM, Maxim Uvarov wrote:
 Patch 1 and 2 have to go before current tag. Others can go latter.
 
 
 Maxim Uvarov (6):
   linux-generic: imp.c: remove header defines from c file
   linux-generic: move api version to c file
   linux-generic: kill version_types.h
   linux-generic: remove header file garbage
   linux-generic: kill odp_impl.c
   linux-generic: move imp API number def to header file

This series is confusing.
It is not clear from cover letter why is it needed.
Commit names or descriptions also doesn't help to understand this.

The series is split into too many patches which are logically
dependent. To understand what this series is doing one have to merge
patches in mind or apply them locally. Some patches seems to be
redundant. This looks like one logical change which can be one patch of
digestible size.

-- 
Taras Kondratiuk

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


[lng-odp] [PATCH] validation: buffer: split pool, buffer and packet tests

2015-02-12 Thread Taras Kondratiuk
Split pools, buffers, packets tests into separate executables to make
them independent.

Alloc and free API functions are now part of corresponding event types:
buffers, packets, timeouts, etc. Hence remove them from pool tests.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 test/validation/Makefile.am   |  12 +-
 test/validation/buffer/odp_buffer_pool_test.c | 253 --
 test/validation/buffer/odp_buffer_test.c  |  56 ---
 test/validation/buffer/odp_buffer_tests.h |  28 --
 test/validation/buffer/odp_packet_test.c  | 662 -
 test/validation/odp_buffer.c  | 149 +-
 test/validation/odp_packet.c  | 688 ++
 test/validation/odp_pool.c| 134 +
 test/validation/odp_timer.c   |  77 +++
 9 files changed, 1044 insertions(+), 1015 deletions(-)
 delete mode 100644 test/validation/buffer/odp_buffer_pool_test.c
 delete mode 100644 test/validation/buffer/odp_buffer_test.c
 delete mode 100644 test/validation/buffer/odp_buffer_tests.h
 delete mode 100644 test/validation/buffer/odp_packet_test.c
 create mode 100644 test/validation/odp_packet.c
 create mode 100644 test/validation/odp_pool.c

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index f9d7d7a..a0823b6 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,30 +6,28 @@ AM_LDFLAGS += -static
 TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
 
 if test_vald
-TESTS = odp_init odp_init_abort 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
+TESTS = odp_init odp_init_abort odp_init_log odp_queue odp_crypto odp_shm 
odp_schedule odp_pktio_run odp_pool odp_buffer odp_packet odp_system odp_timer 
odp_time odp_synchronizers odp_classification
 endif
 
 dist_bin_SCRIPTS = $(srcdir)/odp_pktio_run
 
-bin_PROGRAMS = odp_init odp_init_abort 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
+bin_PROGRAMS = odp_init odp_init_abort odp_init_log odp_queue odp_crypto 
odp_shm odp_schedule odp_pktio odp_pool odp_buffer odp_packet 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_pool_SOURCES = odp_pool.c common/odp_cunit_common.c
 dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
  crypto/odp_crypto_test_sync_inp.c \
  crypto/odp_crypto_test_rng.c \
  odp_crypto.c common/odp_cunit_common.c
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
 dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
-dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c \
- buffer/odp_buffer_test.c \
- buffer/odp_packet_test.c \
- odp_buffer.c common/odp_cunit_common.c
+dist_odp_buffer_SOURCES = odp_buffer.c common/odp_cunit_common.c
+dist_odp_packet_SOURCES = odp_packet.c common/odp_cunit_common.c
 dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
 dist_odp_timer_SOURCES = odp_timer.c common/odp_cunit_common.c
 dist_odp_time_SOURCES = odp_time.c common/odp_cunit_common.c
diff --git a/test/validation/buffer/odp_buffer_pool_test.c 
b/test/validation/buffer/odp_buffer_pool_test.c
deleted file mode 100644
index c018b59..000
--- a/test/validation/buffer/odp_buffer_pool_test.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:BSD-3-Clause
- */
-
-#include odp_buffer_tests.h
-
-static int pool_name_number = 1;
-static const int default_buffer_size = 1500;
-static const int default_buffer_num = 1000;
-
-odp_pool_t pool_create(int buf_num, int buf_size, int buf_type)
-{
-   odp_pool_t pool;
-   char pool_name[ODP_POOL_NAME_LEN];
-   odp_pool_param_t params = {
-   .buf = {
-   .size  = buf_size,
-   .align = ODP_CACHE_LINE_SIZE,
-   .num   = buf_num,
-   },
-   .type = buf_type,
-   };
-
-   snprintf(pool_name, sizeof(pool_name),
-test_buffer_pool-%d, pool_name_number++);
-
-   pool = odp_pool_create(pool_name, ODP_SHM_INVALID, params);
-   CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
-
-   return pool;
-}
-
-static void

[lng-odp] [PATCH] linux-generic: strong_types: simplify casting

2015-02-10 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/include/odp/plat/strong_types.h | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/platform/linux-generic/include/odp/plat/strong_types.h 
b/platform/linux-generic/include/odp/plat/strong_types.h
index a49c9d6..eacabba 100644
--- a/platform/linux-generic/include/odp/plat/strong_types.h
+++ b/platform/linux-generic/include/odp/plat/strong_types.h
@@ -20,21 +20,13 @@
 /** Use strong typing for ODP types */
 #define odp_handle_t struct {} *
 
-/** Internal typedefs for ODP strong type manipulation */
-typedef odp_handle_t _odp_handle_t;
-
-typedef union {
-   _odp_handle_t hdl;
-   uint32_t val;
-} _odp_handle_u;
-
 /** Internal macro to get value of an ODP handle */
-#define _odp_typeval(handle) (((_odp_handle_u)(_odp_handle_t)handle).val)
+#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
 
 /** Internal macro to get printable value of an ODP handle */
 #define _odp_pri(handle) ((uint64_t)_odp_typeval(handle))
 
 /** Internal macro to convert a scalar to a typed handle */
-#define _odp_cast_scalar(type, val) ((type)(size_t)(val))
+#define _odp_cast_scalar(type, val) ((type)(uintptr_t)(val))
 
 #endif
-- 
1.9.1


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


[lng-odp] [PATCH] linus-generic: debug: Allow formatted ODP_ASSERT

2015-02-05 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/include/odp_debug_internal.h | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index dec5c15..265d9be 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -32,10 +32,9 @@ extern C {
 /**
  * Runtime assertion-macro - aborts if 'cond' is false.
  */
-#define ODP_ASSERT(cond, msg) \
-   do { if ((ODP_DEBUG == 1)  (!(cond))) { \
-   ODP_ERR(%s\n, msg); \
-   odp_global_data.abort_fn(); } \
+#define ODP_ASSERT(cond, fmt, ...) \
+   do { if ((ODP_DEBUG == 1)  (!(cond))) \
+   ODP_ABORT(%s\n, fmt, ##__VA_ARGS__); \
} while (0)
 
 /**
-- 
1.9.1


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


[lng-odp] [PATCHv2] api: pool: move buffer allocation to buffer.h

2015-02-05 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 include/odp/api/buffer.h  | 19 +++
 include/odp/api/pool.h| 20 
 platform/linux-generic/include/odp/pool.h |  1 +
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/include/odp/api/buffer.h b/include/odp/api/buffer.h
index 09bddf2..4bbac1e 100644
--- a/include/odp/api/buffer.h
+++ b/include/odp/api/buffer.h
@@ -105,6 +105,25 @@ int odp_buffer_is_valid(odp_buffer_t buf);
 odp_pool_t odp_buffer_pool(odp_buffer_t buf);
 
 /**
+ * Buffer alloc
+ *
+ * The validity of a buffer can be cheked at any time with 
odp_buffer_is_valid()
+ * @param pool  Pool handle
+ *
+ * @return Handle of allocated buffer
+ * @retval ODP_BUFFER_INVALID  Buffer could not be allocated
+ */
+odp_buffer_t odp_buffer_alloc(odp_pool_t pool);
+
+/**
+ * Buffer free
+ *
+ * @param buf   Buffer handle
+ *
+ */
+void odp_buffer_free(odp_buffer_t buf);
+
+/**
  * Print buffer metadata to STDOUT
  *
  * @param buf  Buffer handle
diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
index 14d18fb..f5dda10 100644
--- a/include/odp/api/pool.h
+++ b/include/odp/api/pool.h
@@ -22,7 +22,6 @@ extern C {
 
 #include odp/std_types.h
 #include odp/plat/shared_memory_types.h
-#include odp/buffer.h
 #include odp/event.h
 
 /** @addtogroup odp_buffer
@@ -195,25 +194,6 @@ void odp_pool_print(odp_pool_t pool);
 uint64_t odp_pool_to_u64(odp_pool_t hdl);
 
 /**
- * Buffer alloc
- *
- * The validity of a buffer can be cheked at any time with 
odp_buffer_is_valid()
- * @param pool  Pool handle
- *
- * @return Handle of allocated buffer
- * @retval ODP_BUFFER_INVALID  Buffer could not be allocated
- */
-odp_buffer_t odp_buffer_alloc(odp_pool_t pool);
-
-/**
- * Buffer free
- *
- * @param buf   Buffer handle
- *
- */
-void odp_buffer_free(odp_buffer_t buf);
-
-/**
  * @}
  */
 
diff --git a/platform/linux-generic/include/odp/pool.h 
b/platform/linux-generic/include/odp/pool.h
index 0591fcf..e68b11e 100644
--- a/platform/linux-generic/include/odp/pool.h
+++ b/platform/linux-generic/include/odp/pool.h
@@ -25,6 +25,7 @@ extern C {
  * @}
  */
 
+#include odp/plat/pool_types.h
 #include odp/api/pool.h
 
 #ifdef __cplusplus
-- 
1.9.1


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


[lng-odp] [PATCH] api: reflect file path in header guards

2015-02-05 Thread Taras Kondratiuk
Start header guards with ODP_API_ prefix to avoid confusion with other
files with the same name.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 include/odp/api/align.h  | 4 ++--
 include/odp/api/atomic.h | 4 ++--
 include/odp/api/barrier.h| 4 ++--
 include/odp/api/buffer.h | 4 ++--
 include/odp/api/byteorder.h  | 4 ++--
 include/odp/api/classification.h | 4 ++--
 include/odp/api/compiler.h   | 4 ++--
 include/odp/api/config.h | 4 ++--
 include/odp/api/cpumask.h| 4 ++--
 include/odp/api/crypto.h | 4 ++--
 include/odp/api/debug.h  | 4 ++--
 include/odp/api/event.h  | 4 ++--
 include/odp/api/hints.h  | 4 ++--
 include/odp/api/init.h   | 4 ++--
 include/odp/api/packet.h | 4 ++--
 include/odp/api/packet_flags.h   | 4 ++--
 include/odp/api/packet_io.h  | 4 ++--
 include/odp/api/pool.h   | 4 ++--
 include/odp/api/queue.h  | 4 ++--
 include/odp/api/random.h | 4 ++--
 include/odp/api/rwlock.h | 4 ++--
 include/odp/api/schedule.h   | 4 ++--
 include/odp/api/shared_memory.h  | 4 ++--
 include/odp/api/spinlock.h   | 4 ++--
 include/odp/api/std_types.h  | 4 ++--
 include/odp/api/sync.h   | 4 ++--
 include/odp/api/system_info.h| 4 ++--
 include/odp/api/thread.h | 4 ++--
 include/odp/api/time.h   | 4 ++--
 include/odp/api/timer.h  | 4 ++--
 include/odp/api/version.h| 4 ++--
 31 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/include/odp/api/align.h b/include/odp/api/align.h
index b97ee57..97cedc3 100644
--- a/include/odp/api/align.h
+++ b/include/odp/api/align.h
@@ -11,8 +11,8 @@
  * ODP alignments
  */
 
-#ifndef ODP_ALIGN_H_
-#define ODP_ALIGN_H_
+#ifndef ODP_API_ALIGN_H_
+#define ODP_API_ALIGN_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
index 9e759fb..ba5c354 100644
--- a/include/odp/api/atomic.h
+++ b/include/odp/api/atomic.h
@@ -11,8 +11,8 @@
  * ODP atomic operations
  */
 
-#ifndef ODP_ATOMIC_H_
-#define ODP_ATOMIC_H_
+#ifndef ODP_API_ATOMIC_H_
+#define ODP_API_ATOMIC_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
index 2066210..35f0981 100644
--- a/include/odp/api/barrier.h
+++ b/include/odp/api/barrier.h
@@ -11,8 +11,8 @@
  * ODP execution barriers
  */
 
-#ifndef ODP_BARRIER_H_
-#define ODP_BARRIER_H_
+#ifndef ODP_API_BARRIER_H_
+#define ODP_API_BARRIER_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/buffer.h b/include/odp/api/buffer.h
index 4bbac1e..9ad08ea 100644
--- a/include/odp/api/buffer.h
+++ b/include/odp/api/buffer.h
@@ -11,8 +11,8 @@
  * ODP buffer descriptor
  */
 
-#ifndef ODP_BUFFER_H_
-#define ODP_BUFFER_H_
+#ifndef ODP_API_BUFFER_H_
+#define ODP_API_BUFFER_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/byteorder.h b/include/odp/api/byteorder.h
index 3a36afc..a7b3647 100644
--- a/include/odp/api/byteorder.h
+++ b/include/odp/api/byteorder.h
@@ -11,8 +11,8 @@
  * ODP byteorder
  */
 
-#ifndef ODP_BYTEORDER_H_
-#define ODP_BYTEORDER_H_
+#ifndef ODP_API_BYTEORDER_H_
+#define ODP_API_BYTEORDER_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index 5a61bd8..8758fb5 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -11,8 +11,8 @@
  * ODP classification descriptor
  */
 
-#ifndef ODP_CLASSIFY_H_
-#define ODP_CLASSIFY_H_
+#ifndef ODP_API_CLASSIFY_H_
+#define ODP_API_CLASSIFY_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/compiler.h b/include/odp/api/compiler.h
index 71a4431..5a24bfb 100644
--- a/include/odp/api/compiler.h
+++ b/include/odp/api/compiler.h
@@ -11,8 +11,8 @@
  * Compiler related
  */
 
-#ifndef ODP_COMPILER_H_
-#define ODP_COMPILER_H_
+#ifndef ODP_API_COMPILER_H_
+#define ODP_API_COMPILER_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 3529fca..bd69b98 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -11,8 +11,8 @@
  * ODP configuration
  */
 
-#ifndef ODP_CONFIG_H_
-#define ODP_CONFIG_H_
+#ifndef ODP_API_CONFIG_H_
+#define ODP_API_CONFIG_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/cpumask.h b/include/odp/api/cpumask.h
index a78d83c..831f745 100644
--- a/include/odp/api/cpumask.h
+++ b/include/odp/api/cpumask.h
@@ -11,8 +11,8 @@
  * ODP CPU masks and enumeration
  */
 
-#ifndef ODP_CPUMASK_H_
-#define ODP_CPUMASK_H_
+#ifndef ODP_API_CPUMASK_H_
+#define ODP_API_CPUMASK_H_
 
 #ifdef __cplusplus
 extern C {
diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index dbdc5b9..a71753c 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -11,8 +11,8 @@
  * ODP crypto
  */
 
-#ifndef ODP_CRYPTO_H_
-#define ODP_CRYPTO_H_
+#ifndef ODP_API_CRYPTO_H_
+#define

[lng-odp] [PATCH] example/test: Makefile.inc: add linux-generic include path back

2015-02-05 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 example/Makefile.inc | 1 +
 test/Makefile.inc| 1 +
 2 files changed, 2 insertions(+)

diff --git a/example/Makefile.inc b/example/Makefile.inc
index 91f8f49..b3a9706 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -6,6 +6,7 @@ AM_CFLAGS += \
-I$(srcdir) \
-I$(top_srcdir)/example \
-I$(top_srcdir)/platform/@with_platform@/include \
+   -I$(top_srcdir)/platform/linux-generic/include \
-I$(top_srcdir)/include/ \
-I$(top_srcdir)/helper/include
 
diff --git a/test/Makefile.inc b/test/Makefile.inc
index bc8a936..ebee80a 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -6,6 +6,7 @@ AM_CFLAGS += \
-I$(srcdir) \
-I$(top_srcdir)/test \
-I$(top_srcdir)/platform/@with_platform@/include \
+   -I$(top_srcdir)/platform/linux-generic/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/helper/include
 
-- 
1.9.1


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


[lng-odp] [PATCH] linux-generic: move compiler hints to a proper place

2015-02-05 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 include/odp/api/hints.h | 12 
 platform/linux-generic/include/odp_debug_internal.h | 19 ---
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/include/odp/api/hints.h b/include/odp/api/hints.h
index a7aa90e..ebf83fc 100644
--- a/include/odp/api/hints.h
+++ b/include/odp/api/hints.h
@@ -46,6 +46,16 @@ extern C {
 #define ODP_COLD_CODE   __attribute__((__cold__))
 
 /**
+ * Indicate deprecated variables, functions or types
+ */
+#define ODP_DEPRECATED __attribute__((__deprecated__))
+
+/**
+ * Intentionally unused variables ot functions
+ */
+#define ODP_UNUSED __attribute__((__unused__))
+
+/**
  * Branch likely taken
  */
 #define odp_likely(x)   __builtin_expect((x), 1)
@@ -80,6 +90,8 @@ extern C {
 #define ODP_WEAK_SYMBOL
 #define ODP_HOT_CODE
 #define ODP_COLD_CODE
+#define ODP_DEPRECATED
+#define ODP_UNUSED
 #define odp_likely(x)
 #define odp_unlikely(x)
 #define odp_prefetch(x)
diff --git a/platform/linux-generic/include/odp_debug_internal.h 
b/platform/linux-generic/include/odp_debug_internal.h
index 2b643eb..dec5c15 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -29,25 +29,6 @@ extern C {
  *  @{
  */
 
-#ifdef __GNUC__
-
-/**
- * Indicate deprecated variables, functions or types
- */
-#define ODP_DEPRECATED __attribute__((__deprecated__))
-
-/**
- * Intentionally unused variables ot functions
- */
-#define ODP_UNUSED __attribute__((__unused__))
-
-#else
-
-#define ODP_DEPRECATED
-#define ODP_UNUSED
-
-#endif
-
 /**
  * Runtime assertion-macro - aborts if 'cond' is false.
  */
-- 
1.9.1


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


[lng-odp] [PATCH] linux-generic: init: fix odp_global_data definition

2015-02-05 Thread Taras Kondratiuk
odp_global_data should be defined once in a C file.

Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/include/odp_internal.h | 6 --
 platform/linux-generic/odp_init.c | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 9a6e29d..1d611e8 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -20,10 +20,12 @@ extern C {
 
 #include odp/init.h
 
-struct odp_global_data {
+struct odp_global_data_s {
odp_log_func_t log_fn;
odp_abort_func_t abort_fn;
-} odp_global_data;
+};
+
+extern struct odp_global_data_s 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 74c893f..cd8dc46 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -9,6 +9,7 @@
 #include odp/debug.h
 #include odp_debug_internal.h
 
+struct odp_global_data_s odp_global_data;
 
 int odp_init_global(odp_init_t *params  ODP_UNUSED,
odp_platform_init_t *platform_params ODP_UNUSED)
-- 
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: reflect file path in header guards

2015-02-05 Thread Taras Kondratiuk
On 02/05/2015 07:40 PM, Bill Fischofer wrote:
 This looks like a reasonable precaution.

Changes to ticketlock.h were not saved in editor, so it is missed.
I'll post v2.

___
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-04 Thread Taras Kondratiuk
On 02/04/2015 12:28 AM, Ola Liljedahl 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.

Yeah that's a missing piece. Should a part Implementer's guide.
Current structure:

/usr/share/include/
├── odp.h   - The only header included by applications (for 
now).
└── odp - Structure of this directory is up to 
implementation.
│ This is a linux-generic's structure which can be 
used as a reference.
├── odp_module.h  - One header per module. That is not mandatory, but 
recommended (in case we drop odp.h at some point).
│ Each header will normally include corresponding 
header from 'api' directory plus 'static inline' APIs.
├── api - A copy of odp_src/include/odp/api directory. 
Contains clean API headers.
│   └── odp_module.h
└── plat- Contains types definitions and other platform 
specific stuff.
├── odp_module_types.h
└── some_sdk.h




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


[lng-odp] [PATCH 3/5] linux-generic: crypto: fix crypto_alg_err enum return values

2015-02-04 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/odp_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 46766fa..fa7d51f 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -160,7 +160,7 @@ enum crypto_alg_err des_encrypt(odp_crypto_op_params_t 
*params,
else if (session-cipher.iv.data)
iv_ptr = session-cipher.iv.data;
else
-   return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+   return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
 
/*
 * Create a copy of the IV.  The DES library modifies IV
@@ -198,7 +198,7 @@ enum crypto_alg_err des_decrypt(odp_crypto_op_params_t 
*params,
else if (session-cipher.iv.data)
iv_ptr = session-cipher.iv.data;
else
-   return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+   return ODP_CRYPTO_ALG_ERR_KEY_SIZE;
 
/*
 * Create a copy of the IV.  The DES library modifies IV
-- 
1.9.1


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


[lng-odp] [PATCH 5/5] linux-generic: weak: fix -Wformat-nonliteral warning

2015-02-04 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org
---
 platform/linux-generic/odp_weak.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_weak.c 
b/platform/linux-generic/odp_weak.c
index 9dc3a4a..7fa5955 100644
--- a/platform/linux-generic/odp_weak.c
+++ b/platform/linux-generic/odp_weak.c
@@ -9,8 +9,8 @@
 #include odp_debug_internal.h
 #include odp/hints.h
 
-ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level ODP_UNUSED,
-const char *fmt, ...)
+ODP_WEAK_SYMBOL ODP_PRINTF_FORMAT(2, 3)
+int odp_override_log(odp_log_level_e level ODP_UNUSED, const char *fmt, ...)
 {
va_list args;
int r;
-- 
1.9.1


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


[lng-odp] [PATCH 0/5] Fix errors reported by Clang

2015-02-04 Thread Taras Kondratiuk
Fix all reported errors.

Taras Kondratiuk (5):
  api: debug: fix static assert macro
  linux-generic: classification: Remove typedef forward declarations
  linux-generic: crypto: fix crypto_alg_err enum return values
  api: hints: add printf format attribute
  linux-generic: weak: fix -Wformat-nonliteral warning

 include/odp/api/debug.h   |  4 ++--
 include/odp/api/hints.h   |  5 +
 platform/linux-generic/include/odp_classification_datamodel.h | 10 +-
 platform/linux-generic/odp_crypto.c   |  4 ++--
 platform/linux-generic/odp_weak.c |  4 ++--
 5 files changed, 16 insertions(+), 11 deletions(-)

-- 
1.9.1


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


  1   2   3   4   >