Re: [lng-odp] [API-NEXT PATCH v2] helper: add cuckoo hash implementation

2015-12-01 Thread HePeng

> 在 2015年11月30日,下午11:04,Maxim Uvarov  写道:
> 
> On 11/30/2015 11:18, HePeng wrote:
>> Hi, Maxim,
>> How is everything going, about the ring?
> 
> 
> Hello Peng,
> 
> We need to take a look it it's possible to rewrite your hash implementation 
> to odp queues api instead of odp ring.
> That will allow to use hw queues accelerators for hash.
> 
> Maxim.

Hi Maxim,

The ring structure in cuckoo hash is just a buffer storing the “key” 
address. 

The hash table stores all the keys. In this implementation,  it is the 
hash table itself which maintains the memory of all the keys. 
When add a new key, the hash table will firstly allocate an“index” of the key 
using the ring, and when delete a key, the 
hash table will recycle the “index” of the key into the ring. All in all, this 
ring is like a free slots buffer storing all the free indexes. 

In my opinion, (while I did not do this in hardware), the ring is not a 
critical data structure in the scenario of hash table matching, 
because only when table update happens,  the hash table will need to use the 
ring. Unless you use the hash table in a write-heavy 
scenario, and this hardware queue can help you to ease the lock contention in 
multi-core. 

So my opinion is that, 1) yes, we can use the queue to replace the 
ring, as long as the queue can be large enough to hold 
all the hash entries. 2) But I do not think it is a critical optimization. 



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


[lng-odp] ODP v1.5.0.0 was released

2015-12-01 Thread Maxim Uvarov

Greetings,

just tagged new v1.5.0.0 point release. New API for buffer, cpu, crypto, 
packet, queue and time. Also
from now we can build rpm packages. Project change log now will be 
maintained in root directory CHANGELOG

file instead of previously used debian specific.

There are bunch of features almost ready so I think next 1.6 release 
will be very soon.


Thanks everybody for contribution!

Please see detailed log bellow.

Best regards,
Maxim.

+opendataplane (1.5.0.0)
+   * API:
+   - api: buffer: add functions to alloc/free multiple buffers at once
+   - api: cpu: change order of arguments for diff function
+   - api: crypto: add AES128-CBC encrypt/decrypt methods
+   - api: crypto: add HMAC-SHA-256-128 support
+   - api: crypto: move enums from platform types to odp and rename 
to fit the API format

+   - api: packet: add functions to alloc/free multiple packets at once
+   - api: queue: add odp_queue_info() function to retrieve queue 
information

+   - api: time: change order of arguments for diff function
+   - api: time: unbind CPU cycles from time API
+   * ODP docs:
+   - userguide: add baseline overview to document
+   - images: add additional user guide images
+   - implementers-guide: convert to ODP standard layout
+   - implementers-guide: fix broken doxygen build from tarball
+   - users-guide: move EXTRA_DIST down to its makefile
+   - Makefile: add docs to the tarball
+   - improve asciidoc presentation
+   - users-guide convert to asciidoc
+   - images: add resource_management.msc for users-guide
+   - images: add svg for user-guide
+   * Validation
+   - performance: odp_pktio_perf: fix potential overflow in wait loop
+   - test/example: avoid "cycle" word usage
+   - ability to specify test install directory
+   - buffer: add tests for buffer alloc/free multi functions
+   - crypto: add test for AES128 CBC
+   - crypto: add test for HMAC-SHA-256-128
+   - crypto: limit packet size to maximum supported by platform
+   - packet: add tests for packet alloc/free multi functions
+   - queue: api validation tests for odp_queue_info()
+   - remove strict dependency on CUnit 2.1-3
+   - scheduler: add missing ticketlock unlock
+   * General:
+   - rpm packaging support
+   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
+   - linux-generic: cpumask: warn that CPU0 is used by control and 
worker thread
+   - linux-generic: packet: add implementation for packet 
alloc/free multi

+   - linux-generic: pool: add buffer_alloc_multi function
+   - linux-generic: pool: add implementation for buffer alloc/free 
multi

+   - linux-generic: queue: add odp_queue_info() function
+   - linux-generic: validation: add run-test script for post 
install testing
+   - platform: move list of API files to Makefile.inc so it is 
common to all platforms


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


[lng-odp] [PATCHv3] update version number from v1.4.1.0 to v1.5.0.0

2015-12-01 Thread Maxim Uvarov
From: Mike Holmes 

Signed-off-by: Mike Holmes 
Reviewed-by: Anders Roxell 
Signed-off-by: Maxim Uvarov 
---
 -added docs changes

Maxim.


 CHANGELOG | 45 +
 include/odp/api/version.h |  4 ++--
 pkg/debian/changelog  |  5 +
 pkg/rpm/odp.spec  |  2 ++
 4 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index cd8c387..4e9db28 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,48 @@
+opendataplane (1.5.0.0)
+   * API:
+   - api: buffer: add functions to alloc/free multiple buffers at once
+   - api: cpu: change order of arguments for diff function
+   - api: crypto: add AES128-CBC encrypt/decrypt methods
+   - api: crypto: add HMAC-SHA-256-128 support
+   - api: crypto: move enums from platform types to odp and rename to fit 
the API format
+   - api: packet: add functions to alloc/free multiple packets at once
+   - api: queue: add odp_queue_info() function to retrieve queue 
information
+   - api: time: change order of arguments for diff function
+   - api: time: unbind CPU cycles from time API
+   * ODP docs:
+   - userguide: add baseline overview to document
+   - images: add additional user guide images
+   - implementers-guide: convert to ODP standard layout
+   - implementers-guide: fix broken doxygen build from tarball
+   - users-guide: move EXTRA_DIST down to its makefile
+   - Makefile: add docs to the tarball
+   - improve asciidoc presentation
+   - users-guide convert to asciidoc
+   - images: add resource_management.msc for users-guide
+   - images: add svg for user-guide
+   * Validation
+   - performance: odp_pktio_perf: fix potential overflow in wait loop
+   - test/example: avoid "cycle" word usage
+   - ability to specify test install directory
+   - buffer: add tests for buffer alloc/free multi functions
+   - crypto: add test for AES128 CBC
+   - crypto: add test for HMAC-SHA-256-128
+   - crypto: limit packet size to maximum supported by platform
+   - packet: add tests for packet alloc/free multi functions
+   - queue: api validation tests for odp_queue_info()
+   - remove strict dependency on CUnit 2.1-3
+   - scheduler: add missing ticketlock unlock
+   * General:
+   - rpm packaging support
+   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
+   - linux-generic: cpumask: warn that CPU0 is used by control and worker 
thread
+   - linux-generic: packet: add implementation for packet alloc/free multi
+   - linux-generic: pool: add buffer_alloc_multi function
+   - linux-generic: pool: add implementation for buffer alloc/free multi
+   - linux-generic: queue: add odp_queue_info() function
+   - linux-generic: validation: add run-test script for post install 
testing
+   - platform: move list of API files to Makefile.inc so it is common to 
all platforms
+
 opendataplane (1.4.1.0)
* Validation
- pktio: test transmit error recovery
diff --git a/include/odp/api/version.h b/include/odp/api/version.h
index 8912177..58bb7ec 100644
--- a/include/odp/api/version.h
+++ b/include/odp/api/version.h
@@ -37,7 +37,7 @@ extern "C" {
  * Introduction of major new features or changes. APIs with different major
  * versions are likely not backward compatible.
  */
-#define ODP_VERSION_API_MAJOR 4
+#define ODP_VERSION_API_MAJOR 5
 
 /**
  * ODP API minor version
@@ -46,7 +46,7 @@ extern "C" {
  * to the API. For an API with common generation and major version, but with
  * different minor numbers the two versions are backward compatible.
  */
-#define ODP_VERSION_API_MINOR 1
+#define ODP_VERSION_API_MINOR 0
 
 /**
  * Returns ODP API version string
diff --git a/pkg/debian/changelog b/pkg/debian/changelog
index 1983a9a..7680cf1 100644
--- a/pkg/debian/changelog
+++ b/pkg/debian/changelog
@@ -1,3 +1,8 @@
+opendataplane (1.5.0.0-1) unstable; urgency=low
+   * ODP release v1.5
+
+ -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43 +0300
+
 opendataplane (1.4.1.0-1) unstable; urgency=low
* Validation
- pktio: test transmit error recovery
diff --git a/pkg/rpm/odp.spec b/pkg/rpm/odp.spec
index aa57476..e76fe58 100644
--- a/pkg/rpm/odp.spec
+++ b/pkg/rpm/odp.spec
@@ -68,5 +68,7 @@ and guides in HTMLformats.
 %post -p /sbin/ldconfig
 %postun -p /sbin/ldconfig
 %changelog
+* Mon Nov 30 2015 - mike.holmes (at) linaro.org
+- ODP release v1.5
 * Tue Nov 10 2015 - anders.roxell (at) linaro.org
 - Initial rpm release, ODP release v1.4
-- 
1.9.1

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


[lng-odp] [PATCH v2 2/3] CHANGELOG: initial revision

2015-12-01 Thread Mike Holmes
With the addition of an RPM package to the existing debian package we
need to have a single change log for the ODP API and the linux-generic
implementation.
The debian and RPM change logs then just list packaging changes.

Create an initial copy of the old debian log.

Signed-off-by: Mike Holmes 
Reviewed-by: Anders Roxell 
---
 CHANGELOG   | 520 
 Makefile.am |   2 +-
 2 files changed, 521 insertions(+), 1 deletion(-)
 create mode 100644 CHANGELOG

diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 000..cd8c387
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,520 @@
+opendataplane (1.4.1.0)
+   * Validation
+   - pktio: test transmit error recovery
+   - schedule: add chaos test
+   - check return code from odp_queue_lock_count()
+   - scheduler: test ordered queue reorder processing
+   - pktio: initialize queue parameters correctly
+   - pktio: test for transmit error handling
+   - pktio: add support for direct receive
+   - pktio: pass interface index rather than name
+   - pktio: fix start_stop test
+   - test: l2fwd: separate rx and tx drop counters
+   - test: l2fwd: increase burst size
+   - test: l2fwd: optimize statistics usage
+   - test: l2fwd: optimize queue mode
+   - test: l2fwd: start pktios after worker thread create
+   - test: l2fwd: added option to disable error check
+   - example/ipsec: Increase ip_data_len for Tunnel mode
+   - example: ipsec: check push_tail return code
+   * General:
+   - linux-generic: pktio: handle transmit errors correctly
+   - pktio socket_mmap: recover from transmit errors but 1890
+   - pktio: increase MTU of loop interface
+   - ordered queues: fix race condition during order release
+ and out of order.
+   - configure: move HAVE_PCAP AM_CONDITIONAL to configure.ac
+   * ODP helper:
+   - linux: checkpatch cleaning for helper/linux.c
+   - linux: examine the cause for child process termination
+   - linux: request SIGTERM if parent process dies
+
+opendataplane (1.4.0.0)
+   * API:
+   - ** Classification **
+   - odp_cos_set_queue() renamed to odp_cos_queue_set()
+   - int odp_cos_set_drop renamed to odp_cos_drop_set()
+   - new: odp_queue_t odp_cos_queue(odp_cos_t cos_id)
+   - new: odp_drop_e odp_cos_drop(odp_cos_t cos_id)
+   - ODP_PMR_CUSTOM_FRAME support in classification
+   - odp_pmr_create() arguments passing change to use struct
+   - odp_pmr_match_set_create() added id argument
+   - ** Config **
+   - new: odp_config_...() API introduced instead of ODP_CONFIG_ defines
+   - ** Cpu, Threads and Scheduler **
+   - new: uint64_t odp_cpu_cycles(void)
+   - new: uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2);
+   - new: uint64_t odp_cpu_cycles_max(void);
+   - new: uint64_t odp_cpu_cycles_resolution(void);
+   - odp_cpumask_def_worker() renamed to odp_cpumask_default_worker()
+   - odp_cpumask_def_control() renamed to odp_cpumask_default_control()
+   - odp init extended with num worker and control threads
+   - new: int odp_queue_lock_count(odp_queue_t queue);
+   - refine api doc for scheduler and schedule orderd locks
+   - argument of odp_schedule_order_lock() and odp_schedule_order_unlock 
changed to unsigned
+   - new: int odp_thread_count_max(void)
+   - ** Packet **
+   - new: uint32_t odp_packet_flow_hash(odp_packet_t pkt)
+   - new: void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t 
flow_hash)
+   - new: int odp_packet_has_flow_hash(odp_packet_t pkt);
+   - new: void odp_packet_has_flow_hash_clr(odp_packet_t pkt);
+   - ** Pktio **
+   - pktio can be configuread as receive or transmit only
+   - pktio: refined api doc for start() and stop()
+   - new: void odp_pktio_param_init(odp_pktio_param_t *param)
+   * ODP docs:
+   - implementers-guide: update names of test module libraries
+   - implementers-guide: update section on skipping tests
+   * Test framework
+   - update README files
+   - renaming module libs
+   - add odp_cunit_update() to modify registered tests
+   - add ability to mark tests inactive
+   * Validation
+   - ** Classification **
+   - Add fix for classification tests
+   - remove redundant pool lookup function
+   - remove redundant sequence number check
+   - use tcp data offset field to calculate data offset
+   - move destroy_inq() to common file
+   - add odp_pktio_param_init() API
+   - added additional suite to test individual PMRs
+   - use a structure instead of many args for odp_pmr_create
+   - Add init calls for queue parameters
+   - syntax correction for CU_ASSERT
+   - Add init calls for pool parameters
+   - queue and drop policy API name change
+   - Queue parameter init calls
+   - ** Cpu, Threads and Scheduler

[lng-odp] [PATCH v2 3/3] update version number from v1.4.1.0 to v1.5.0.0

2015-12-01 Thread Mike Holmes
Signed-off-by: Mike Holmes 
Reviewed-by: Anders Roxell 
---
 CHANGELOG | 34 ++
 include/odp/api/version.h |  4 ++--
 pkg/debian/changelog  |  5 +
 pkg/rpm/odp.spec  |  2 ++
 4 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index cd8c387..89966a9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,37 @@
+opendataplane (1.5.0.0)
+   * API:
+   - api: buffer: add functions to alloc/free multiple buffers at once
+   - api: cpu: change order of arguments for diff function
+   - api: crypto: add AES128-CBC encrypt/decrypt methods
+   - api: crypto: add HMAC-SHA-256-128 support
+   - api: crypto: move enums from platform types to odp and rename to fit 
the API format
+   - api: packet: add functions to alloc/free multiple packets at once
+   - api: queue: add odp_queue_info() function to retrieve queue 
information
+   - api: time: change order of arguments for diff function
+   - api: time: unbind CPU cycles from time API
+   * Validation
+   - performance: odp_pktio_perf: fix potential overflow in wait loop
+   - test/example: avoid "cycle" word usage
+   - ability to specify test install directory
+   - buffer: add tests for buffer alloc/free multi functions
+   - crypto: add test for AES128 CBC
+   - crypto: add test for HMAC-SHA-256-128
+   - crypto: limit packet size to maximum supported by platform
+   - packet: add tests for packet alloc/free multi functions
+   - queue: api validation tests for odp_queue_info()
+   - remove strict dependency on CUnit 2.1-3
+   - scheduler: add missing ticketlock unlock
+   * General:
+   - rpm packaging support
+   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
+   - linux-generic: cpumask: warn that CPU0 is used by control and worker 
thread
+   - linux-generic: packet: add implementation for packet alloc/free multi
+   - linux-generic: pool: add buffer_alloc_multi function
+   - linux-generic: pool: add implementation for buffer alloc/free multi
+   - linux-generic: queue: add odp_queue_info() function
+   - linux-generic: validation: add run-test script for post install 
testing
+   - platform: move list of API files to Makefile.inc so it is common to 
all platforms
+
 opendataplane (1.4.1.0)
* Validation
- pktio: test transmit error recovery
diff --git a/include/odp/api/version.h b/include/odp/api/version.h
index 8912177..58bb7ec 100644
--- a/include/odp/api/version.h
+++ b/include/odp/api/version.h
@@ -37,7 +37,7 @@ extern "C" {
  * Introduction of major new features or changes. APIs with different major
  * versions are likely not backward compatible.
  */
-#define ODP_VERSION_API_MAJOR 4
+#define ODP_VERSION_API_MAJOR 5
 
 /**
  * ODP API minor version
@@ -46,7 +46,7 @@ extern "C" {
  * to the API. For an API with common generation and major version, but with
  * different minor numbers the two versions are backward compatible.
  */
-#define ODP_VERSION_API_MINOR 1
+#define ODP_VERSION_API_MINOR 0
 
 /**
  * Returns ODP API version string
diff --git a/pkg/debian/changelog b/pkg/debian/changelog
index 1983a9a..7680cf1 100644
--- a/pkg/debian/changelog
+++ b/pkg/debian/changelog
@@ -1,3 +1,8 @@
+opendataplane (1.5.0.0-1) unstable; urgency=low
+   * ODP release v1.5
+
+ -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43 +0300
+
 opendataplane (1.4.1.0-1) unstable; urgency=low
* Validation
- pktio: test transmit error recovery
diff --git a/pkg/rpm/odp.spec b/pkg/rpm/odp.spec
index aa57476..e76fe58 100644
--- a/pkg/rpm/odp.spec
+++ b/pkg/rpm/odp.spec
@@ -68,5 +68,7 @@ and guides in HTMLformats.
 %post -p /sbin/ldconfig
 %postun -p /sbin/ldconfig
 %changelog
+* Mon Nov 30 2015 - mike.holmes (at) linaro.org
+- ODP release v1.5
 * Tue Nov 10 2015 - anders.roxell (at) linaro.org
 - Initial rpm release, ODP release v1.4
-- 
2.5.0

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


[lng-odp] [PATCH v2 1/3] Revert "update version number from v1.4.1.0 to v1.5.0.0"

2015-12-01 Thread Mike Holmes
This reverts commit 8cb80afde4a9e00cfea4bed5ecf721d6577793c4.

Adding the RPM packaging requires a change to the way change logs are
recorded for a release.

Signed-off-by: Mike Holmes 
Reviewed-by: Anders Roxell 
---
 include/odp/api/version.h |  4 ++--
 pkg/debian/changelog  | 36 
 2 files changed, 2 insertions(+), 38 deletions(-)

diff --git a/include/odp/api/version.h b/include/odp/api/version.h
index 58bb7ec..8912177 100644
--- a/include/odp/api/version.h
+++ b/include/odp/api/version.h
@@ -37,7 +37,7 @@ extern "C" {
  * Introduction of major new features or changes. APIs with different major
  * versions are likely not backward compatible.
  */
-#define ODP_VERSION_API_MAJOR 5
+#define ODP_VERSION_API_MAJOR 4
 
 /**
  * ODP API minor version
@@ -46,7 +46,7 @@ extern "C" {
  * to the API. For an API with common generation and major version, but with
  * different minor numbers the two versions are backward compatible.
  */
-#define ODP_VERSION_API_MINOR 0
+#define ODP_VERSION_API_MINOR 1
 
 /**
  * Returns ODP API version string
diff --git a/pkg/debian/changelog b/pkg/debian/changelog
index 088cc77..1983a9a 100644
--- a/pkg/debian/changelog
+++ b/pkg/debian/changelog
@@ -1,39 +1,3 @@
-opendataplane (1.5.0.0-1) unstable; urgency=low
-   * API:
-   - api: buffer: add functions to alloc/free multiple buffers at once
-   - api: cpu: change order of arguments for diff function
-   - api: crypto: add AES128-CBC encrypt/decrypt methods
-   - api: crypto: add HMAC-SHA-256-128 support
-   - api: crypto: move enums from platform types to odp and rename to fit 
the API format
-   - api: packet: add functions to alloc/free multiple packets at once
-   - api: queue: add odp_queue_info() function to retrieve queue 
information
-   - api: time: change order of arguments for diff function
-   - api: time: unbind CPU cycles from time API
-   * Validation
-   - performance: odp_pktio_perf: fix potential overflow in wait loop
-   - test/example: avoid "cycle" word usage
-   - ability to specify test install directory
-   - buffer: add tests for buffer alloc/free multi functions
-   - crypto: add test for AES128 CBC
-   - crypto: add test for HMAC-SHA-256-128
-   - crypto: limit packet size to maximum supported by platform
-   - packet: add tests for packet alloc/free multi functions
-   - queue: api validation tests for odp_queue_info()
-   - remove strict dependency on CUnit 2.1-3
-   - scheduler: add missing ticketlock unlock
-   * General:
-   - rpm packaging support
-   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
-   - linux-generic: cpumask: warn that CPU0 is used by control and worker 
thread
-   - linux-generic: packet: add implementation for packet alloc/free multi
-   - linux-generic: pool: add buffer_alloc_multi function
-   - linux-generic: pool: add implementation for buffer alloc/free multi
-   - linux-generic: queue: add odp_queue_info() function
-   - linux-generic: validation: add run-test script for post install 
testing
-   - platform: move list of API files to Makefile.inc so it is common to 
all platforms
-
- -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43 +0300
-
 opendataplane (1.4.1.0-1) unstable; urgency=low
* Validation
- pktio: test transmit error recovery
-- 
2.5.0

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


Re: [lng-odp] [PATCH 0/2] helper: strong types support

2015-12-01 Thread Ivan Khoronzhuk

Tested-by: Ivan Khoronzhuk 

On 01.12.15 15:27, Maxim Uvarov wrote:

For helpers it's also reasonable to have strong types support. Using
basing linux-generic implementation for it.

Maxim Uvarov (2):
   helper: strong types support
   helper: unbind hash from platform strong types

  helper/Makefile.am   |  1 +
  helper/include/odp/helper/strong_types.h | 36 
  helper/include/odp/helper/table.h|  5 -
  helper/odph_hashtable.h  |  3 +--
  helper/odph_lineartable.h|  1 -
  5 files changed, 42 insertions(+), 4 deletions(-)
  create mode 100644 helper/include/odp/helper/strong_types.h



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


Re: [lng-odp] [API-NEXT PATCH] api: pool: redefine packet user area init

2015-12-01 Thread Zoltan Kiss



On 01/12/15 08:29, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Zoltan Kiss [mailto:zoltan.k...@linaro.org]
Sent: Monday, November 30, 2015 8:13 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [API-NEXT PATCH] api: pool: redefine packet user
area init



On 30/11/15 13:31, Savolainen, Petri (Nokia - FI/Espoo) wrote:



diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
index 01f770f..7b258c3 100644
--- a/include/odp/api/pool.h
+++ b/include/odp/api/pool.h
@@ -42,21 +42,25 @@ extern "C" {
#define ODP_POOL_NAME_LEN  32

/**
- * Packet user area initializer callback function for pools.
+ * Packet user area initialize callback function
 *
- * @param pkt   Handle of the packet
- * @param uarea_init_argOpaque pointer defined in

odp_pool_param_t

+ * Packet pool uses this callback function to initialize user area in

each

+ * packet. The function is called once (per packet) in pool creation

phase for

+ * both persistent (user_area.persistent is set) and non-persistent

user areas.

+ * Additionally, it is called to re-initialize non-persistent user

area, when

+ * ODP has overwritten the area content.
 *
- * @note If the application specifies this pointer, it expects that

every buffer

- * is initialized exactly once with it when the underlying memory is

allocated.

- * It is not called from odp_packet_alloc(), unless the platform

chooses to

- * allocate the memory at that point. Applications can only assume

that

this

- * callback is called once before the packet is first used. Any

subsequent

- * change to the user area might be preserved after odp_packet_free()

is called,

- * so applications should take care of (re)initialization if they

change data

- * preset by this function.
+ * @param pool   Packet pool handle
+ * @param init_arg   User defined 'user_area.init_arg' pointer in
+ *   odp_pool_param_t
+ * @param user_area  Pointer to packet user area to initialize
+ * @param size   User area size in bytes
+ * @param pkt_index  Index of the packet. The range is from 0 to

number

of

+ *   packet in the pool (packet pool param 'num')

minus

one.

Why would an application need this? It's not visible to the app. Also,


It's helpful for e.g. allocating per packet context memory at this

point. This is just unique, opaque index from 0 to num - 1.


my_packet_ctx_t my_packet_ctx[MAX_PACKETS];

user_area_init(odp_pool_t pool, void *init_arg, void *user_area,

uint32_t size, uint32_t pkt_index) {


my_packet_user_area = user_area;
my_packet_user_area->pkt_ctx = &my_packet_ctx[pkt_index];

}


And why couldn't you use the packet handle for that? This just seems to
me an another unique id for the packet.
This example seems to me like using the user area to store a pointer for
an application allocated piece of memory related for that particular
buffer. That would be a duplication of the functionality of
odp_packet_user_ptr()


Handle is not an index. From user point of view, it's a random number.

We could add index as metadata if needed.

User pointer is not (currently) specified to be persistent (implementation can 
overwrite that).









ODP-DPDK for example allocates some extra number of rte_mbuf's because
the per-thread caching can sit on packets, which in extreme cases makes
impossible to allocate 'num' packets. See this for details:

https://git.linaro.org/lng/odp-
dpdk.git/commitdiff/e1ac6c797539a62ee6b93554a1f0a7f5ba433a36

So, what would be pkt_index for these extra buffers? (NB. 'num' is only
the number we MUST provide, nothing says we can't have more than that)



'num' is: "The number of packets that the pool must provide that are

packet length 'len' bytes or smaller" and "The number of packets may be
less than 'num' when packets are larger than 'len'"


So, it's actually the maximum number of packets that can be allocated

from the pool.

There could be less than 'num' packets if packets are bigger, yes, but
the description doesn't restrict us that we can't have more.
If you get the bill in the restaurant, you "must provide" that amount of
money, but nothing prevents you to pay more.


The number == not less, not more. We can refine the wording, but that's the 
intention: no more, no less.


We definitely has to change the wording, because "the number of 
something you must provide" means just a minimum requirement.






Any per thread caching causes variation to actual number in-flight, but

any time there should not be more than 'num' packets.

If you have a per-thread object cache for packets (sounds sensible to
avoid locking during allocation), after a short time you'll have an
arbitrary number of packets in those caches, waiting to be used. If the
app requests 'num' while all packets are free, you can't always fulfill
that request because some of the packets will be in other thread's
cach

[lng-odp] [Bug 1921] sched_local.pool not set

2015-12-01 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1921

Bill Fischofer  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |IN_PROGRESS

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


[lng-odp] [API-NEXT PATCH v5 5/9] performance: sched: use ODP time API instead of clock_gettime

2015-12-01 Thread Ivan Khoronzhuk
The time API can be used instead of Posix clock_gettime as more
accurate and OS independent.

Signed-off-by: Ivan Khoronzhuk 
---
 test/performance/odp_scheduling.c | 37 +
 1 file changed, 9 insertions(+), 28 deletions(-)

diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index 5d17c47..2c5262f 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -702,7 +702,7 @@ static void *run_thread(void *arg)
  */
 static void test_cpu_freq(void)
 {
-   struct timespec tp1, tp2;
+   odp_time_t cur_time, test_time, start_time, end_time;
uint64_t c1, c2, cycles;
uint64_t nsec;
double diff_max_hz, max_cycles;
@@ -710,40 +710,21 @@ static void test_cpu_freq(void)
printf("\nCPU cycle count frequency test (runs about %i sec)\n",
   TEST_SEC);
 
-   if (clock_gettime(CLOCK_MONOTONIC, &tp2)) {
-   LOG_ERR("clock_gettime failed.\n");
-   return;
-   }
-
-   /* Wait until clock moves to the next second. It enables easy comparison
-* during the measurement. */
-   do {
-   if (clock_gettime(CLOCK_MONOTONIC, &tp1)) {
-   LOG_ERR("clock_gettime failed.\n");
-   return;
-   }
-
-   } while (tp1.tv_sec == tp2.tv_sec);
+   test_time = odp_time_local_from_ns(TEST_SEC * ODP_TIME_SEC_IN_NS);
+   start_time = odp_time_local();
+   end_time = odp_time_sum(start_time, test_time);
 
/* Start the measurement */
c1 = odp_cpu_cycles();
 
do {
-   if (clock_gettime(CLOCK_MONOTONIC, &tp2)) {
-   LOG_ERR("clock_gettime failed.\n");
-   return;
-   }
-
-   } while ((tp2.tv_sec - tp1.tv_sec) < TEST_SEC);
+   cur_time = odp_time_local();
+   } while (odp_time_cmp(end_time, cur_time) > 0);
 
c2 = odp_cpu_cycles();
 
-   nsec = (tp2.tv_sec - tp1.tv_sec) * 10;
-
-   if (tp2.tv_nsec > tp1.tv_nsec)
-   nsec += tp2.tv_nsec - tp1.tv_nsec;
-   else
-   nsec -= tp1.tv_nsec - tp2.tv_nsec;
+   test_time = odp_time_diff(cur_time, start_time);
+   nsec = odp_time_to_ns(test_time);
 
cycles = odp_cpu_cycles_diff(c2, c1);
max_cycles = (nsec * odp_cpu_hz_max()) / 10.0;
@@ -751,7 +732,7 @@ static void test_cpu_freq(void)
/* Compare measured CPU cycles to maximum theoretical CPU cycle count */
diff_max_hz = ((double)(cycles) - max_cycles) / max_cycles;
 
-   printf("clock_gettime  %" PRIu64 " ns\n", nsec);
+   printf("odp_time   %" PRIu64 " ns\n", nsec);
printf("odp_cpu_cycles %" PRIu64 " CPU cycles\n", cycles);
printf("odp_sys_cpu_hz %" PRIu64 " hz\n", odp_cpu_hz_max());
printf("Diff from max CPU freq %f%%\n", diff_max_hz * 100.0);
-- 
1.9.1

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


Re: [lng-odp] [API-NEXT PATCH v3 0/7] api: time: update local time to be monotonic

2015-12-01 Thread Ivan Khoronzhuk

Petri, please review v5.

On 23.11.15 23:20, Ivan Khoronzhuk wrote:

This series is intended to modify time API to be used as monotonic wall
time in order to simplify time API usage and create prerequisites for
adding global time API.

Since v2:
- removed patch changing type of ODP_TIME_*
- added new patch:
   test: performance: pktio: don't use direct arithmetic operations with
 odp_time_t
- added new patch:
   performance: sched: use ODP time API instead of clock_gettime
- combined monotonic and wall time patches
- removed odp_time_local_val() and odp_time_val_to_ns()
- replaced terms monotonic and wall in API desc

Since v1:
- corrected name of the series to be api-next
- use thread local for holding start time

Ivan Khoronzhuk (7):
   validation: time: don't assign int directly to odp_time_t
   test: performance: pktio: don't use direct arithmetic operations with
 odp_time_t
   linux-generic: schedule: use schedule time in ns
   linux-generic: odp_time: don't use cpu cycle API to get time
   performance: sched: use ODP time API instead of clock_gettime
   api: time: make odp_local_time to be monotonic wall time
   validation: time: align tests with current time API

  example/generator/odp_generator.c  |  10 +-
  include/odp/api/time.h |   3 +-
  platform/linux-generic/Makefile.am |   1 -
  .../linux-generic/include/odp/plat/time_types.h|   6 +-
  platform/linux-generic/include/odp_cpu_internal.h  |  29 ---
  platform/linux-generic/include/odp_internal.h  |   2 +
  platform/linux-generic/odp_cpu.c   |   6 +-
  platform/linux-generic/odp_schedule.c  |  18 +-
  platform/linux-generic/odp_time.c  | 112 +++
  test/performance/odp_pktio_perf.c  |  24 +--
  test/performance/odp_scheduling.c  |  37 +---
  test/validation/pktio/pktio.c  |  21 +-
  test/validation/time/time.c| 224 +++--
  test/validation/time/time.h|   7 +-
  14 files changed, 339 insertions(+), 161 deletions(-)
  delete mode 100644 platform/linux-generic/include/odp_cpu_internal.h



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


[lng-odp] [API-NEXT PATCH v5 9/9] validation: time: align tests with current time API

2015-12-01 Thread Ivan Khoronzhuk
Add test for odp_time_sum, odp_time_cmp, odp_time_to_u64 APIs.
Sophisticate a little tests for odp_time_diff, odp_time_local_from_ns,
odp_time_local_to_ns APIs. Check time on monotony.

Signed-off-by: Ivan Khoronzhuk 
---
 test/validation/time/time.c | 228 +++-
 test/validation/time/time.h |   7 +-
 2 files changed, 210 insertions(+), 25 deletions(-)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index 3d05a6f..0303eb3 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -9,7 +9,107 @@
 #include "time.h"
 
 #define TOLERANCE 1
-#define BUSY_LOOP_CNT 100
+#define BUSY_LOOP_CNT  3000/* used for t > min resolution */
+#define BUSY_LOOP_CNT_LONG 120 /* used for t > 4 sec */
+
+
+/* check that related conversions come back to the same value */
+void time_test_odp_conversion(void)
+{
+   uint64_t ns1, ns2;
+   odp_time_t time;
+   uint64_t upper_limit, lower_limit;
+
+   ns1 = 100;
+   time = odp_time_local_from_ns(ns1);
+
+   ns2 = odp_time_to_ns(time);
+
+   /* need to check within arithmetic tolerance that the same
+* value in ns is returned after conversions */
+   upper_limit = ns1 + TOLERANCE;
+   lower_limit = ns1 - TOLERANCE;
+   CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
+
+   ns1 = 60 * 11 * ODP_TIME_SEC_IN_NS;
+   time = odp_time_local_from_ns(ns1);
+
+   ns2 = odp_time_to_ns(time);
+
+   /* need to check within arithmetic tolerance that the same
+* value in ns is returned after conversions */
+   upper_limit = ns1 + TOLERANCE;
+   lower_limit = ns1 - TOLERANCE;
+   CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
+}
+
+void time_test_monotony(void)
+{
+   volatile unsigned long count = 0;
+   odp_time_t t1, t2, t3;
+   uint64_t ns1, ns2, ns3;
+
+   t1 = odp_time_local();
+
+   while (count < BUSY_LOOP_CNT) {
+   count++;
+   };
+
+   t2 = odp_time_local();
+
+   while (count < BUSY_LOOP_CNT_LONG) {
+   count++;
+   };
+
+   t3 = odp_time_local();
+
+   ns1 = odp_time_to_ns(t1);
+   ns2 = odp_time_to_ns(t2);
+   ns3 = odp_time_to_ns(t3);
+
+   CU_ASSERT(ns2 > ns1);
+   CU_ASSERT(ns3 > ns2);
+}
+
+void time_test_odp_cmp(void)
+{
+   /* volatile to stop optimization of busy loop */
+   volatile int count = 0;
+   odp_time_t t1, t2, t3;
+
+   t1 = odp_time_local();
+
+   while (count < BUSY_LOOP_CNT) {
+   count++;
+   };
+
+   t2 = odp_time_local();
+
+   while (count < BUSY_LOOP_CNT * 2) {
+   count++;
+   };
+
+   t3 = odp_time_local();
+
+   CU_ASSERT(odp_time_cmp(t2, t1) > 0);
+   CU_ASSERT(odp_time_cmp(t3, t2) > 0);
+   CU_ASSERT(odp_time_cmp(t3, t1) > 0);
+   CU_ASSERT(odp_time_cmp(t1, t2) < 0);
+   CU_ASSERT(odp_time_cmp(t2, t3) < 0);
+   CU_ASSERT(odp_time_cmp(t1, t3) < 0);
+   CU_ASSERT(odp_time_cmp(t1, t1) == 0);
+   CU_ASSERT(odp_time_cmp(t2, t2) == 0);
+   CU_ASSERT(odp_time_cmp(t3, t3) == 0);
+
+   t2 = odp_time_local_from_ns(60 * 10 * ODP_TIME_SEC_IN_NS);
+   t1 = odp_time_local_from_ns(3);
+
+   CU_ASSERT(odp_time_cmp(t2, t1) > 0);
+   CU_ASSERT(odp_time_cmp(t1, t2) < 0);
+
+   t1 = odp_time_local_from_ns(0);
+   CU_ASSERT(odp_time_cmp(t1, ODP_TIME_NULL) == 0);
+}
 
 /* check that a time difference gives a reasonable result */
 void time_test_odp_diff(void)
@@ -17,7 +117,10 @@ void time_test_odp_diff(void)
/* volatile to stop optimization of busy loop */
volatile int count = 0;
odp_time_t diff, t1, t2;
+   uint64_t nsdiff, ns1, ns2, ns;
+   uint64_t upper_limit, lower_limit;
 
+   /* test timestamp diff */
t1 = odp_time_local();
 
while (count < BUSY_LOOP_CNT) {
@@ -29,43 +132,122 @@ void time_test_odp_diff(void)
 
diff = odp_time_diff(t2, t1);
CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
-}
 
-/* check that a negative time difference gives a reasonable result */
-void time_test_odp_negative_diff(void)
-{
-   odp_time_t diff, t1, t2;
+   ns1 = odp_time_to_ns(t1);
+   ns2 = odp_time_to_ns(t2);
+   ns = ns2 - ns1;
+   nsdiff = odp_time_to_ns(diff);
 
-   t1 = odp_time_local_from_ns(10);
-   t2 = odp_time_local_from_ns(5);
+   upper_limit = ns + TOLERANCE;
+   lower_limit = ns - TOLERANCE;
+   CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit));
+
+   /* test timestamp and interval diff */
+   ns1 = 54;
+   t1 = odp_time_local_from_ns(ns1);
+   ns = ns2 - ns1;
+
+   diff = odp_time_diff(t2, t1);
+   CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
+   nsdiff = odp_time_to_ns(diff);
+
+   upper_limit = ns + TOLERANCE;
+   lower_limit = ns - TOLERANCE;
+   CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower

[lng-odp] [API-NEXT PATCH v5 8/9] test/example: use local time API as wall time

2015-12-01 Thread Ivan Khoronzhuk
The local time API is supposed to behave like wall time now,
so correct it in examples and tests.

Signed-off-by: Ivan Khoronzhuk 
---
 example/generator/odp_generator.c | 10 +-
 test/performance/odp_pktio_perf.c | 26 --
 test/validation/pktio/pktio.c | 21 -
 3 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 9d79f89..2de530d 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -586,7 +586,7 @@ static void *gen_recv_thread(void *arg)
  */
 static void print_global_stats(int num_workers)
 {
-   odp_time_t start, wait, diff;
+   odp_time_t cur, wait, next;
uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0;
int verbose_interval = 20;
odp_thrmask_t thrd_mask;
@@ -595,7 +595,7 @@ static void print_global_stats(int num_workers)
continue;
 
wait = odp_time_local_from_ns(verbose_interval * ODP_TIME_SEC_IN_NS);
-   start = odp_time_local();
+   next = odp_time_sum(odp_time_local(), wait);
 
while (odp_thrmask_worker(&thrd_mask) == num_workers) {
if (args->appl.number != -1 &&
@@ -604,11 +604,11 @@ static void print_global_stats(int num_workers)
break;
}
 
-   diff = odp_time_diff(odp_time_local(), start);
-   if (odp_time_cmp(wait, diff) > 0)
+   cur = odp_time_local();
+   if (odp_time_cmp(next, cur) > 0)
continue;
 
-   start = odp_time_local();
+   next = odp_time_sum(cur, wait);
 
if (args->appl.mode == APPL_MODE_RCV) {
pkts = odp_atomic_load_u64(&counters.udp);
diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index 2e49f50..8737bc8 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -305,8 +305,8 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
-   odp_time_t start_time, cur_time, send_duration;
-   odp_time_t burst_start_time, burst_gap;
+   odp_time_t cur_time, send_time_end, send_duration;
+   odp_time_t burst_gap_end, burst_gap;
uint32_t batch_len;
int unsent_pkts = 0;
odp_event_t  tx_event[BATCH_LEN_MAX];
@@ -336,21 +336,19 @@ static void *run_thread_tx(void *arg)
odp_barrier_wait(&globals->tx_barrier);
 
cur_time = odp_time_local();
-   start_time   = cur_time;
-   burst_start_time = odp_time_diff(cur_time, burst_gap);
-   while (odp_time_cmp(odp_time_diff(cur_time, start_time),
-   send_duration) > 1) {
+   send_time_end = odp_time_sum(cur_time, send_duration);
+   burst_gap_end = cur_time;
+   while (odp_time_cmp(send_time_end, cur_time) > 0) {
unsigned alloc_cnt = 0, tx_cnt;
 
-   if (odp_time_cmp(odp_time_diff(cur_time, burst_start_time),
-burst_gap) > 1) {
+   if (odp_time_cmp(burst_gap_end, cur_time) > 0) {
cur_time = odp_time_local();
if (!odp_time_cmp(idle_start, ODP_TIME_NULL))
idle_start = cur_time;
continue;
}
 
-   if (odp_time_cmp(idle_start, ODP_TIME_NULL)) {
+   if (odp_time_cmp(idle_start, ODP_TIME_NULL) > 0) {
odp_time_t diff = odp_time_diff(cur_time, idle_start);
 
stats->s.idle_ticks =
@@ -359,7 +357,7 @@ static void *run_thread_tx(void *arg)
idle_start = ODP_TIME_NULL;
}
 
-   burst_start_time = odp_time_sum(burst_start_time, burst_gap);
+   burst_gap_end = odp_time_sum(burst_gap_end, burst_gap);
 
alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts);
if (alloc_cnt != batch_len)
@@ -597,13 +595,13 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
  */
 static void busy_loop_ns(uint64_t wait_ns)
 {
-   odp_time_t diff;
-   odp_time_t start_time = odp_time_local();
odp_time_t wait = odp_time_local_from_ns(wait_ns);
+   odp_time_t cur = odp_time_local();
+   odp_time_t end_time = odp_time_sum(cur, wait);
 
do {
-   diff = odp_time_diff(odp_time_local(), start_time);
-   } while (odp_time_cmp(wait, diff) > 0);
+   cur = odp_time_local();
+   } while (odp_time_cmp(end_time, cur) > 0);
 }
 
 /*
diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 0a6592c..002c26b 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -336,18 +336,16 @@ static int destroy_inq(odp_pktio_t pktio)
 
 static odp_event_t queue_deq_wait_time(

[lng-odp] [API-NEXT PATCH v5 7/9] linux-generic: align with new wall time API

2015-12-01 Thread Ivan Khoronzhuk
The local time API supposes the time source is wall time.
So correct linux-generic implementation.

Signed-off-by: Ivan Khoronzhuk 
---
 platform/linux-generic/include/odp_internal.h |  2 +
 platform/linux-generic/odp_schedule.c |  9 ++--
 platform/linux-generic/odp_time.c | 61 +++
 3 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 74e48a9..50bf6c8 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -79,6 +79,8 @@ int odp_schedule_term_local(void);
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
 
+int odp_time_local_init(void);
+
 int odp_tm_init_global(void);
 
 void _odp_flush_caches(void);
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 96b3ac5..3017876 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -586,7 +586,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 odp_event_t out_ev[],
 unsigned int max_num, unsigned int max_deq)
 {
-   odp_time_t start_time, time, diff, wtime;
+   odp_time_t next, wtime;
int first = 1;
int ret;
 
@@ -604,15 +604,12 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 
if (first) {
wtime = odp_time_local_from_ns(wait);
-   start_time = odp_time_local();
+   next = odp_time_sum(odp_time_local(), wtime);
first = 0;
continue;
}
 
-   time = odp_time_local();
-   diff = odp_time_diff(time, start_time);
-
-   if (odp_time_cmp(wtime, diff) < 0)
+   if (odp_time_cmp(next, odp_time_local()) < 0)
break;
}
 
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index b725086..1aae88c 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,19 +11,21 @@
 #include 
 #include 
 
-odp_time_t odp_time_local(void)
+static __thread struct timespec start_local;
+
+static inline
+uint64_t _odp_time_to_ns(odp_time_t val)
 {
-   int ret;
-   struct timespec time;
+   uint64_t ns;
 
-   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
-   if (odp_unlikely(ret != 0))
-   ODP_ABORT("clock_gettime failed\n");
+   ns = val.tv_sec * ODP_TIME_SEC_IN_NS;
+   ns += val.tv_nsec;
 
-   return time;
+   return ns;
 }
 
-odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
+static inline
+odp_time_t _odp_time_diff(odp_time_t t2, odp_time_t t1)
 {
struct timespec time;
 
@@ -38,24 +40,36 @@ odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
return time;
 }
 
-uint64_t odp_time_to_ns(odp_time_t time)
+odp_time_t odp_time_local(void)
 {
-   uint64_t ns;
+   int ret;
+   struct timespec time;
+
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   if (odp_unlikely(ret != 0))
+   ODP_ABORT("clock_gettime failed\n");
 
-   ns = time.tv_sec * ODP_TIME_SEC_IN_NS;
-   ns += time.tv_nsec;
+   return _odp_time_diff(time, start_local);
+}
 
-   return ns;
+odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
+{
+   return _odp_time_diff(t2, t1);
+}
+
+uint64_t odp_time_to_ns(odp_time_t time)
+{
+   return _odp_time_to_ns(time);
 }
 
 odp_time_t odp_time_local_from_ns(uint64_t ns)
 {
-   struct timespec time;
+   struct timespec val;
 
-   time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
-   time.tv_nsec = ns % ODP_TIME_SEC_IN_NS;
+   val.tv_sec = ns / ODP_TIME_SEC_IN_NS;
+   val.tv_nsec = ns % ODP_TIME_SEC_IN_NS;
 
-   return time;
+   return val;
 }
 
 int odp_time_cmp(odp_time_t t2, odp_time_t t1)
@@ -96,10 +110,21 @@ uint64_t odp_time_to_u64(odp_time_t time)
 
resolution = (uint64_t)tres.tv_nsec;
 
-   return odp_time_to_ns(time) / resolution;
+   return _odp_time_to_ns(time) / resolution;
 }
 
 odp_time_t odp_time_null(void)
 {
return (struct timespec) {0, 0};
 }
+
+int odp_time_local_init(void)
+{
+   int ret;
+   struct timespec time;
+
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   start_local = ret ? odp_time_null() : time;
+
+   return ret;
+}
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v5 6/9] api: time: make odp_local_time to be monotonic wall time

2015-12-01 Thread Ivan Khoronzhuk
It's more convenient the local time to be a monotonic wall time.
That means time starts from 0 and not wraps. It allows to use local
time in similar manner as it's supposed to be used with global time
and the 64-bit timer is enough to guarantee it.

Signed-off-by: Ivan Khoronzhuk 
---
 include/odp/api/time.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/time.h b/include/odp/api/time.h
index 50a0bf5..9865d81 100644
--- a/include/odp/api/time.h
+++ b/include/odp/api/time.h
@@ -45,7 +45,8 @@ extern "C" {
  * Current local time
  *
  * Returns current local time stamp value. The local time source provides high
- * resolution time.
+ * resolution time, it is initialized to zero during ODP startup and will not
+ * wrap around in at least 10 years.
  *
  * @return Local time stamp.
  */
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v5 3/9] linux-generic: schedule: use schedule time in ns

2015-12-01 Thread Ivan Khoronzhuk
In the schedule_loop the wait time is passed in units of scheduler
time. At this moment there is no difference between wait time and
odp_time, but in case if odp_time is smth different from uint64_t,
it cannot be directly passed as uint64_t. So better to pass scheduler
time as ns and convert them before entering a loop.

Signed-off-by: Ivan Khoronzhuk 
---
 platform/linux-generic/odp_schedule.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 884ae60..96b3ac5 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -586,11 +586,10 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 odp_event_t out_ev[],
 unsigned int max_num, unsigned int max_deq)
 {
-   odp_time_t start_time, time, diff;
+   odp_time_t start_time, time, diff, wtime;
+   int first = 1;
int ret;
 
-   start_time = ODP_TIME_NULL;
-
while (1) {
ret = schedule(out_queue, out_ev, max_num, max_deq);
 
@@ -603,15 +602,17 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
if (wait == ODP_SCHED_NO_WAIT)
break;
 
-   if (!odp_time_cmp(ODP_TIME_NULL, start_time)) {
+   if (first) {
+   wtime = odp_time_local_from_ns(wait);
start_time = odp_time_local();
+   first = 0;
continue;
}
 
time = odp_time_local();
diff = odp_time_diff(time, start_time);
 
-   if (odp_time_cmp(wait, diff) < 0)
+   if (odp_time_cmp(wtime, diff) < 0)
break;
}
 
@@ -652,7 +653,7 @@ void odp_schedule_resume(void)
 
 uint64_t odp_schedule_wait_time(uint64_t ns)
 {
-   return odp_time_to_u64(odp_time_local_from_ns(ns));
+   return ns;
 }
 
 
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v5 4/9] linux-generic: odp_time: don't use cpu cycle API to get time

2015-12-01 Thread Ivan Khoronzhuk
The linux-generic time API implementation shouldn't depend on cpu
cycle API wich is not stable enough to measure time period due to
dynamic frequency scaling.

Signed-off-by: Ivan Khoronzhuk 
---
 platform/linux-generic/Makefile.am |  1 -
 .../linux-generic/include/odp/plat/time_types.h|  6 +-
 platform/linux-generic/include/odp_cpu_internal.h  | 29 ---
 platform/linux-generic/odp_cpu.c   |  6 +-
 platform/linux-generic/odp_time.c  | 99 +-
 5 files changed, 67 insertions(+), 74 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp_cpu_internal.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 102f11e..ba220c0 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -110,7 +110,6 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_timer_internal.h \
  ${srcdir}/include/odp_timer_wheel_internal.h \
  ${srcdir}/include/odp_traffic_mngr_internal.h \
- ${srcdir}/include/odp_cpu_internal.h \
  ${srcdir}/Makefile.inc
 
 __LIB__libodp_la_SOURCES = \
diff --git a/platform/linux-generic/include/odp/plat/time_types.h 
b/platform/linux-generic/include/odp/plat/time_types.h
index 9ba1508..e5765ec 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,9 +21,11 @@ extern "C" {
  *  @{
  **/
 
-typedef uint64_t odp_time_t;
+typedef struct timespec odp_time_t;
 
-#define ODP_TIME_NULL ((odp_time_t)0)
+odp_time_t odp_time_null(void);
+
+#define ODP_TIME_NULL  odp_time_null()
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp_cpu_internal.h 
b/platform/linux-generic/include/odp_cpu_internal.h
deleted file mode 100644
index 664e2df..000
--- a/platform/linux-generic/include/odp_cpu_internal.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef ODP_CPU_INTERNAL_H_
-#define ODP_CPU_INTERNAL_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include 
-
-static inline
-uint64_t _odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
-{
-   if (odp_likely(c2 >= c1))
-   return c2 - c1;
-
-   return c2 + (odp_cpu_cycles_max() - c1) + 1;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-generic/odp_cpu.c
index 636f811..4bd6a9a 100644
--- a/platform/linux-generic/odp_cpu.c
+++ b/platform/linux-generic/odp_cpu.c
@@ -6,9 +6,11 @@
 
 #include 
 #include 
-#include 
 
 uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
 {
-   return _odp_cpu_cycles_diff(c2, c1);
+   if (odp_likely(c2 >= c1))
+   return c2 - c1;
+
+   return c2 + (odp_cpu_cycles_max() - c1) + 1;
 }
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index a2e4046..b725086 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -6,81 +6,100 @@
 
 #define _POSIX_C_SOURCE 200809L
 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
 
-#define GIGA 10
-
-static inline
-uint64_t time_to_tick(odp_time_t time)
+odp_time_t odp_time_local(void)
 {
-   return (uint64_t)time;
-}
+   int ret;
+   struct timespec time;
 
-static inline
-odp_time_t tick_to_time(uint64_t tick)
-{
-   return (odp_time_t)tick;
-}
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   if (odp_unlikely(ret != 0))
+   ODP_ABORT("clock_gettime failed\n");
 
-odp_time_t odp_time_local(void)
-{
-   return tick_to_time(odp_cpu_cycles());
+   return time;
 }
 
 odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
 {
-   return tick_to_time(_odp_cpu_cycles_diff(t2, t1));
+   struct timespec time;
+
+   time.tv_sec = t2.tv_sec - t1.tv_sec;
+   time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
+
+   if (time.tv_nsec < 0) {
+   time.tv_nsec += ODP_TIME_SEC_IN_NS;
+   --time.tv_sec;
+   }
+
+   return time;
 }
 
 uint64_t odp_time_to_ns(odp_time_t time)
 {
-   uint64_t hz = odp_cpu_hz_max();
-   uint64_t tick = time_to_tick(time);
+   uint64_t ns;
 
-   if (tick > (UINT64_MAX / GIGA))
-   return (tick / hz) * GIGA;
+   ns = time.tv_sec * ODP_TIME_SEC_IN_NS;
+   ns += time.tv_nsec;
 
-   return (tick * GIGA) / hz;
+   return ns;
 }
 
-
 odp_time_t odp_time_local_from_ns(uint64_t ns)
 {
-   uint64_t hz = odp_cpu_hz_max();
+   struct timespec time;
 
-   if (ns > (UINT64_MAX / hz))
-   return tick_to_time((ns / GIGA) * hz);
+   time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
+   time.tv_nsec = ns % ODP_TIME_SEC_IN_NS;
 
-   return tick_to_time((ns * hz) / GIGA);
+   return time;
 }
 
 int odp_time_cmp(odp_time_t t2, odp_time_t t1

[lng-odp] [API-NEXT PATCH v5 2/9] test: performance: pktio: don't use direct arithmetic operations with odp_time_t

2015-12-01 Thread Ivan Khoronzhuk
It was missed while unbinding cycles from time API names.
Correct is as it prevents for adding structure under odp_time_t.

Signed-off-by: Ivan Khoronzhuk 
---
 test/performance/odp_pktio_perf.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index ffe9844..2e49f50 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -338,10 +338,12 @@ static void *run_thread_tx(void *arg)
cur_time = odp_time_local();
start_time   = cur_time;
burst_start_time = odp_time_diff(cur_time, burst_gap);
-   while (odp_time_diff(cur_time, start_time) < send_duration) {
+   while (odp_time_cmp(odp_time_diff(cur_time, start_time),
+   send_duration) > 1) {
unsigned alloc_cnt = 0, tx_cnt;
 
-   if (odp_time_diff(cur_time, burst_start_time) < burst_gap) {
+   if (odp_time_cmp(odp_time_diff(cur_time, burst_start_time),
+burst_gap) > 1) {
cur_time = odp_time_local();
if (!odp_time_cmp(idle_start, ODP_TIME_NULL))
idle_start = cur_time;
@@ -357,7 +359,7 @@ static void *run_thread_tx(void *arg)
idle_start = ODP_TIME_NULL;
}
 
-   burst_start_time += burst_gap;
+   burst_start_time = odp_time_sum(burst_start_time, burst_gap);
 
alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts);
if (alloc_cnt != batch_len)
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v5 1/9] validation: time: don't assign int directly to odp_time_t

2015-12-01 Thread Ivan Khoronzhuk
Under opaque type can be structure that cannot be used with direct
values, So, use conversion functions to get time_t to avoid build
issues.

Signed-off-by: Ivan Khoronzhuk 
---
 test/validation/time/time.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index f70c776..3d05a6f 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -36,8 +36,8 @@ void time_test_odp_negative_diff(void)
 {
odp_time_t diff, t1, t2;
 
-   t1 = 10;
-   t2 = 5;
+   t1 = odp_time_local_from_ns(10);
+   t2 = odp_time_local_from_ns(5);
diff = odp_time_diff(t2, t1);
CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
 }
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v5 0/9] api: time: update local time to be monotonic

2015-12-01 Thread Ivan Khoronzhuk
This series is intended to modify time API to be used as monotonic wall
time in order to simplify time API usage and create prerequisites for
adding global time API.

Since v3:
- "api: time: make odp_local_time to be monotonic wall time"
  splitted on;
  "linux-generic: align with new wall time API"
  "test/example: use local time API as wall time"
- increased BUSY_LOOP_CNT to fit in resolution and 4+ sec

Since v2:
- removed patch changing type of ODP_TIME_*
- added new patch:
  test: performance: pktio: don't use direct arithmetic operations with
odp_time_t
- added new patch:
  performance: sched: use ODP time API instead of clock_gettime
- combined monotonic and wall time patches
- removed odp_time_local_val() and odp_time_val_to_ns()
- replaced terms monotonic and wall in API desc

Since v1:
- corrected name of the series to be api-next
- use thread local for holding start time

Ivan Khoronzhuk (9):
  validation: time: don't assign int directly to odp_time_t
  test: performance: pktio: don't use direct arithmetic operations with
odp_time_t
  linux-generic: schedule: use schedule time in ns
  linux-generic: odp_time: don't use cpu cycle API to get time
  performance: sched: use ODP time API instead of clock_gettime
  api: time: make odp_local_time to be monotonic wall time
  linux-generic: align with new wall time API
  test/example: use local time API as wall time
  validation: time: align tests with current time API

 example/generator/odp_generator.c  |  10 +-
 include/odp/api/time.h |   3 +-
 platform/linux-generic/Makefile.am |   1 -
 .../linux-generic/include/odp/plat/time_types.h|   6 +-
 platform/linux-generic/include/odp_cpu_internal.h  |  29 ---
 platform/linux-generic/include/odp_internal.h  |   2 +
 platform/linux-generic/odp_cpu.c   |   6 +-
 platform/linux-generic/odp_schedule.c  |  18 +-
 platform/linux-generic/odp_time.c  | 112 +++---
 test/performance/odp_pktio_perf.c  |  24 +--
 test/performance/odp_scheduling.c  |  37 +---
 test/validation/pktio/pktio.c  |  21 +-
 test/validation/time/time.c| 228 ++---
 test/validation/time/time.h|   7 +-
 14 files changed, 342 insertions(+), 162 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp_cpu_internal.h

-- 
1.9.1

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


Re: [lng-odp] [API-NEXT PATCH v4 3/9] linux-generic: schedule: use schedule time in ns

2015-12-01 Thread Ivan Khoronzhuk

ignore, see v6

On 01.12.15 17:01, Ivan Khoronzhuk wrote:

In the schedule_loop the wait time is passed in units of scheduler
time. At this moment there is no difference between wait time and
odp_time, but in case if odp_time is smth different from uint64_t,
it cannot be directly passed as uint64_t. So better to pass scheduler
time as ns and convert them before entering a loop.

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/odp_schedule.c | 13 +++--
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 884ae60..96b3ac5 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -586,11 +586,10 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 odp_event_t out_ev[],
 unsigned int max_num, unsigned int max_deq)
  {
-   odp_time_t start_time, time, diff;
+   odp_time_t start_time, time, diff, wtime;
+   int first = 1;
int ret;

-   start_time = ODP_TIME_NULL;
-
while (1) {
ret = schedule(out_queue, out_ev, max_num, max_deq);

@@ -603,15 +602,17 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
if (wait == ODP_SCHED_NO_WAIT)
break;

-   if (!odp_time_cmp(ODP_TIME_NULL, start_time)) {
+   if (first) {
+   wtime = odp_time_local_from_ns(wait);
start_time = odp_time_local();
+   first = 0;
continue;
}

time = odp_time_local();
diff = odp_time_diff(time, start_time);

-   if (odp_time_cmp(wait, diff) < 0)
+   if (odp_time_cmp(wtime, diff) < 0)
break;
}

@@ -652,7 +653,7 @@ void odp_schedule_resume(void)

  uint64_t odp_schedule_wait_time(uint64_t ns)
  {
-   return odp_time_to_u64(odp_time_local_from_ns(ns));
+   return ns;
  }





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


Re: [lng-odp] [API-NEXT PATCH v4 0/9] api: time: update local time to be monotonic

2015-12-01 Thread Ivan Khoronzhuk

ignore, see v6

On 01.12.15 16:58, Ivan Khoronzhuk wrote:

This series is intended to modify time API to be used as monotonic wall
time in order to simplify time API usage and create prerequisites for
adding global time API.

Since v3:
- "api: time: make odp_local_time to be monotonic wall time"
   splitted on;
   "linux-generic: align with new wall time API"
   "test/example: use local time API as wall time"
- increased BUSY_LOOP_CNT to fit in resolution and 4+ sec

Since v2:
- removed patch changing type of ODP_TIME_*
- added new patch:
   test: performance: pktio: don't use direct arithmetic operations with
 odp_time_t
- added new patch:
   performance: sched: use ODP time API instead of clock_gettime
- combined monotonic and wall time patches
- removed odp_time_local_val() and odp_time_val_to_ns()
- replaced terms monotonic and wall in API desc

Since v1:
- corrected name of the series to be api-next
- use thread local for holding start time

Ivan Khoronzhuk (9):
   validation: time: don't assign int directly to odp_time_t
   test: performance: pktio: don't use direct arithmetic operations with
 odp_time_t
   linux-generic: schedule: use schedule time in ns
   linux-generic: odp_time: don't use cpu cycle API to get time
   performance: sched: use ODP time API instead of clock_gettime
   api: time: make odp_local_time to be monotonic wall time
   linux-generic: align with new wall time API
   test/example: use local time API as wall time
   validation: time: align tests with current time API

  example/generator/odp_generator.c  |  10 +-
  include/odp/api/time.h |   3 +-
  platform/linux-generic/Makefile.am |   1 -
  .../linux-generic/include/odp/plat/time_types.h|   6 +-
  platform/linux-generic/include/odp_cpu_internal.h  |  29 ---
  platform/linux-generic/include/odp_internal.h  |   2 +
  platform/linux-generic/odp_cpu.c   |   6 +-
  platform/linux-generic/odp_schedule.c  |  18 +-
  platform/linux-generic/odp_time.c  | 112 +++---
  test/performance/odp_pktio_perf.c  |  24 +--
  test/performance/odp_scheduling.c  |  37 +---
  test/validation/pktio/pktio.c  |  21 +-
  test/validation/time/time.c| 228 ++---
  test/validation/time/time.h|   7 +-
  14 files changed, 342 insertions(+), 162 deletions(-)
  delete mode 100644 platform/linux-generic/include/odp_cpu_internal.h



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


Re: [lng-odp] [PATCH 3/3] update version number from v1.4.1.0 to v1.5.0.0

2015-12-01 Thread Mike Holmes
On 1 December 2015 at 09:48, Bill Fischofer 
wrote:

> Shouldn't the update log also mention the improved documentation as well?
>

Absolutely, part of this restructure is to allow a place for a human
generated change log.

During 1.6 I expect merged API-NEXT changes to also add an entry to the
CHANGELOG as they merge to next, they will be generated from the excellent
git description for the patch in API-NEXT (please review the description
with this in mind) or a a patch to CHANGELOG directly

In the same vein we can do this for other important work directly applied
to master.
I suspect  that it may be best to make a call on a case by case basis for a
patch to CHANGELOG to be added to  a series so that the change and its
change log items are  reviewed together.


But for 1.5 we were not doing either of those so it is again just a git log.


>
> On Tue, Dec 1, 2015 at 7:58 AM, Mike Holmes 
> wrote:
>
>>
>>
>> On 1 December 2015 at 08:45, Maxim Uvarov 
>> wrote:
>>
>>> On 11/30/2015 23:43, Mike Holmes wrote:
>>>
 Signed-off-by: Mike Holmes 
 ---
   CHANGELOG | 34 ++
   include/odp/api/version.h |  4 ++--
   pkg/debian/changelog  |  5 +
   pkg/rpm/odp.spec  |  2 ++
   4 files changed, 43 insertions(+), 2 deletions(-)

 diff --git a/CHANGELOG b/CHANGELOG
 index cd8c387..89966a9 100644
 --- a/CHANGELOG
 +++ b/CHANGELOG
 @@ -1,3 +1,37 @@
 +opendataplane (1.5.0.0)
 +   * API:
 +   - api: buffer: add functions to alloc/free multiple buffers at
 once
 +   - api: cpu: change order of arguments for diff function
 +   - api: crypto: add AES128-CBC encrypt/decrypt methods
 +   - api: crypto: add HMAC-SHA-256-128 support
 +   - api: crypto: move enums from platform types to odp and rename
 to fit the API format
 +   - api: packet: add functions to alloc/free multiple packets at
 once
 +   - api: queue: add odp_queue_info() function to retrieve queue
 information
 +   - api: time: change order of arguments for diff function
 +   - api: time: unbind CPU cycles from time API
 +   * Validation
 +   - performance: odp_pktio_perf: fix potential overflow in wait
 loop
 +   - test/example: avoid "cycle" word usage
 +   - ability to specify test install directory
 +   - buffer: add tests for buffer alloc/free multi functions
 +   - crypto: add test for AES128 CBC
 +   - crypto: add test for HMAC-SHA-256-128
 +   - crypto: limit packet size to maximum supported by platform
 +   - packet: add tests for packet alloc/free multi functions
 +   - queue: api validation tests for odp_queue_info()
 +   - remove strict dependency on CUnit 2.1-3
 +   - scheduler: add missing ticketlock unlock
 +   * General:
 +   - rpm packaging support
 +   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
 +   - linux-generic: cpumask: warn that CPU0 is used by control and
 worker thread
 +   - linux-generic: packet: add implementation for packet
 alloc/free multi
 +   - linux-generic: pool: add buffer_alloc_multi function
 +   - linux-generic: pool: add implementation for buffer alloc/free
 multi
 +   - linux-generic: queue: add odp_queue_info() function
 +   - linux-generic: validation: add run-test script for post
 install testing
 +   - platform: move list of API files to Makefile.inc so it is
 common to all platforms
 +
   opendataplane (1.4.1.0)
  * Validation
  - pktio: test transmit error recovery
 diff --git a/include/odp/api/version.h b/include/odp/api/version.h
 index 8912177..58bb7ec 100644
 --- a/include/odp/api/version.h
 +++ b/include/odp/api/version.h
 @@ -37,7 +37,7 @@ extern "C" {
* Introduction of major new features or changes. APIs with different
 major
* versions are likely not backward compatible.
*/
 -#define ODP_VERSION_API_MAJOR 4
 +#define ODP_VERSION_API_MAJOR 5
 /**
* ODP API minor version
 @@ -46,7 +46,7 @@ extern "C" {
* to the API. For an API with common generation and major version,
 but with
* different minor numbers the two versions are backward compatible.
*/
 -#define ODP_VERSION_API_MINOR 1
 +#define ODP_VERSION_API_MINOR 0
 /**
* Returns ODP API version string
 diff --git a/pkg/debian/changelog b/pkg/debian/changelog
 index 1983a9a..7680cf1 100644
 --- a/pkg/debian/changelog
 +++ b/pkg/debian/changelog
 @@ -1,3 +1,8 @@
 +opendataplane (1.5.0.0-1) unstable; urgency=low
 +   * ODP release v1.5
 +
 + -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43
 +0300
 +
   opendataplane (1.4.1.0-1) unstable; urgency=low
   

Re: [lng-odp] [PATCH 3/3] update version number from v1.4.1.0 to v1.5.0.0

2015-12-01 Thread Fathi Boudra
On 1 December 2015 at 15:58, Mike Holmes  wrote:
>
>
> On 1 December 2015 at 08:45, Maxim Uvarov  wrote:
>>
>> On 11/30/2015 23:43, Mike Holmes wrote:
>>>
>>> Signed-off-by: Mike Holmes 
>>> ---
>>>   CHANGELOG | 34 ++
>>>   include/odp/api/version.h |  4 ++--
>>>   pkg/debian/changelog  |  5 +
>>>   pkg/rpm/odp.spec  |  2 ++
>>>   4 files changed, 43 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/CHANGELOG b/CHANGELOG
>>> index cd8c387..89966a9 100644
>>> --- a/CHANGELOG
>>> +++ b/CHANGELOG
>>> @@ -1,3 +1,37 @@
>>> +opendataplane (1.5.0.0)
>>> +   * API:
>>> +   - api: buffer: add functions to alloc/free multiple buffers at
>>> once
>>> +   - api: cpu: change order of arguments for diff function
>>> +   - api: crypto: add AES128-CBC encrypt/decrypt methods
>>> +   - api: crypto: add HMAC-SHA-256-128 support
>>> +   - api: crypto: move enums from platform types to odp and rename
>>> to fit the API format
>>> +   - api: packet: add functions to alloc/free multiple packets at
>>> once
>>> +   - api: queue: add odp_queue_info() function to retrieve queue
>>> information
>>> +   - api: time: change order of arguments for diff function
>>> +   - api: time: unbind CPU cycles from time API
>>> +   * Validation
>>> +   - performance: odp_pktio_perf: fix potential overflow in wait
>>> loop
>>> +   - test/example: avoid "cycle" word usage
>>> +   - ability to specify test install directory
>>> +   - buffer: add tests for buffer alloc/free multi functions
>>> +   - crypto: add test for AES128 CBC
>>> +   - crypto: add test for HMAC-SHA-256-128
>>> +   - crypto: limit packet size to maximum supported by platform
>>> +   - packet: add tests for packet alloc/free multi functions
>>> +   - queue: api validation tests for odp_queue_info()
>>> +   - remove strict dependency on CUnit 2.1-3
>>> +   - scheduler: add missing ticketlock unlock
>>> +   * General:
>>> +   - rpm packaging support
>>> +   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
>>> +   - linux-generic: cpumask: warn that CPU0 is used by control and
>>> worker thread
>>> +   - linux-generic: packet: add implementation for packet alloc/free
>>> multi
>>> +   - linux-generic: pool: add buffer_alloc_multi function
>>> +   - linux-generic: pool: add implementation for buffer alloc/free
>>> multi
>>> +   - linux-generic: queue: add odp_queue_info() function
>>> +   - linux-generic: validation: add run-test script for post install
>>> testing
>>> +   - platform: move list of API files to Makefile.inc so it is
>>> common to all platforms
>>> +
>>>   opendataplane (1.4.1.0)
>>>  * Validation
>>>  - pktio: test transmit error recovery
>>> diff --git a/include/odp/api/version.h b/include/odp/api/version.h
>>> index 8912177..58bb7ec 100644
>>> --- a/include/odp/api/version.h
>>> +++ b/include/odp/api/version.h
>>> @@ -37,7 +37,7 @@ extern "C" {
>>>* Introduction of major new features or changes. APIs with different
>>> major
>>>* versions are likely not backward compatible.
>>>*/
>>> -#define ODP_VERSION_API_MAJOR 4
>>> +#define ODP_VERSION_API_MAJOR 5
>>> /**
>>>* ODP API minor version
>>> @@ -46,7 +46,7 @@ extern "C" {
>>>* to the API. For an API with common generation and major version, but
>>> with
>>>* different minor numbers the two versions are backward compatible.
>>>*/
>>> -#define ODP_VERSION_API_MINOR 1
>>> +#define ODP_VERSION_API_MINOR 0
>>> /**
>>>* Returns ODP API version string
>>> diff --git a/pkg/debian/changelog b/pkg/debian/changelog
>>> index 1983a9a..7680cf1 100644
>>> --- a/pkg/debian/changelog
>>> +++ b/pkg/debian/changelog
>>> @@ -1,3 +1,8 @@
>>> +opendataplane (1.5.0.0-1) unstable; urgency=low
>>> +   * ODP release v1.5
>>> +
>>> + -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43
>>> +0300
>>> +
>>>   opendataplane (1.4.1.0-1) unstable; urgency=low
>>>  * Validation
>>>  - pktio: test transmit error recovery
>>> diff --git a/pkg/rpm/odp.spec b/pkg/rpm/odp.spec
>>> index aa57476..e76fe58 100644
>>> --- a/pkg/rpm/odp.spec
>>> +++ b/pkg/rpm/odp.spec
>>> @@ -68,5 +68,7 @@ and guides in HTMLformats.
>>>   %post -p /sbin/ldconfig
>>>   %postun -p /sbin/ldconfig
>>>   %changelog
>>> +* Mon Nov 30 2015 - mike.holmes (at) linaro.org
>>> +- ODP release v1.5
>>>   * Tue Nov 10 2015 - anders.roxell (at) linaro.org
>>>   - Initial rpm release, ODP release v1.4
>>
>> In RPM that lines also needed to be updated:
>> Version: 1.4
>> Release: 1
>
>
> Yes, that is a mistake, please update it when you make the actual release
>
>>
>>
>> Moving change log to some common place is good thing. But if that packages
>> needs directly go to distributive (debian or redhat),
>> than packages also have to have readable logs.
>
>
> I have CC'ed Fathi as I believe the new approach is the correct one driven
> by his guidanc

[lng-odp] [API-NEXT PATCH v4 7/9] linux-generic: align with new wall time API

2015-12-01 Thread Ivan Khoronzhuk
The local time API supposes the time source is wall time.
So correct linux-generic implementation.

Signed-off-by: Ivan Khoronzhuk 
---
 platform/linux-generic/include/odp_internal.h |  2 +
 platform/linux-generic/odp_schedule.c |  9 ++--
 platform/linux-generic/odp_time.c | 61 +++
 3 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 74e48a9..50bf6c8 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -79,6 +79,8 @@ int odp_schedule_term_local(void);
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
 
+int odp_time_local_init(void);
+
 int odp_tm_init_global(void);
 
 void _odp_flush_caches(void);
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 96b3ac5..3017876 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -586,7 +586,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 odp_event_t out_ev[],
 unsigned int max_num, unsigned int max_deq)
 {
-   odp_time_t start_time, time, diff, wtime;
+   odp_time_t next, wtime;
int first = 1;
int ret;
 
@@ -604,15 +604,12 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 
if (first) {
wtime = odp_time_local_from_ns(wait);
-   start_time = odp_time_local();
+   next = odp_time_sum(odp_time_local(), wtime);
first = 0;
continue;
}
 
-   time = odp_time_local();
-   diff = odp_time_diff(time, start_time);
-
-   if (odp_time_cmp(wtime, diff) < 0)
+   if (odp_time_cmp(next, odp_time_local()) < 0)
break;
}
 
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index b725086..1aae88c 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,19 +11,21 @@
 #include 
 #include 
 
-odp_time_t odp_time_local(void)
+static __thread struct timespec start_local;
+
+static inline
+uint64_t _odp_time_to_ns(odp_time_t val)
 {
-   int ret;
-   struct timespec time;
+   uint64_t ns;
 
-   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
-   if (odp_unlikely(ret != 0))
-   ODP_ABORT("clock_gettime failed\n");
+   ns = val.tv_sec * ODP_TIME_SEC_IN_NS;
+   ns += val.tv_nsec;
 
-   return time;
+   return ns;
 }
 
-odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
+static inline
+odp_time_t _odp_time_diff(odp_time_t t2, odp_time_t t1)
 {
struct timespec time;
 
@@ -38,24 +40,36 @@ odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
return time;
 }
 
-uint64_t odp_time_to_ns(odp_time_t time)
+odp_time_t odp_time_local(void)
 {
-   uint64_t ns;
+   int ret;
+   struct timespec time;
+
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   if (odp_unlikely(ret != 0))
+   ODP_ABORT("clock_gettime failed\n");
 
-   ns = time.tv_sec * ODP_TIME_SEC_IN_NS;
-   ns += time.tv_nsec;
+   return _odp_time_diff(time, start_local);
+}
 
-   return ns;
+odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
+{
+   return _odp_time_diff(t2, t1);
+}
+
+uint64_t odp_time_to_ns(odp_time_t time)
+{
+   return _odp_time_to_ns(time);
 }
 
 odp_time_t odp_time_local_from_ns(uint64_t ns)
 {
-   struct timespec time;
+   struct timespec val;
 
-   time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
-   time.tv_nsec = ns % ODP_TIME_SEC_IN_NS;
+   val.tv_sec = ns / ODP_TIME_SEC_IN_NS;
+   val.tv_nsec = ns % ODP_TIME_SEC_IN_NS;
 
-   return time;
+   return val;
 }
 
 int odp_time_cmp(odp_time_t t2, odp_time_t t1)
@@ -96,10 +110,21 @@ uint64_t odp_time_to_u64(odp_time_t time)
 
resolution = (uint64_t)tres.tv_nsec;
 
-   return odp_time_to_ns(time) / resolution;
+   return _odp_time_to_ns(time) / resolution;
 }
 
 odp_time_t odp_time_null(void)
 {
return (struct timespec) {0, 0};
 }
+
+int odp_time_local_init(void)
+{
+   int ret;
+   struct timespec time;
+
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   start_local = ret ? odp_time_null() : time;
+
+   return ret;
+}
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v4 6/9] api: time: make odp_local_time to be monotonic wall time

2015-12-01 Thread Ivan Khoronzhuk
It's more convenient the local time to be a monotonic wall time.
That means time starts from 0 and not wraps. It allows to use local
time in similar manner as it's supposed to be used with global time
and the 64-bit timer is enough to guarantee it.

Signed-off-by: Ivan Khoronzhuk 
---
 include/odp/api/time.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/time.h b/include/odp/api/time.h
index 50a0bf5..9865d81 100644
--- a/include/odp/api/time.h
+++ b/include/odp/api/time.h
@@ -45,7 +45,8 @@ extern "C" {
  * Current local time
  *
  * Returns current local time stamp value. The local time source provides high
- * resolution time.
+ * resolution time, it is initialized to zero during ODP startup and will not
+ * wrap around in at least 10 years.
  *
  * @return Local time stamp.
  */
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v4 5/9] performance: sched: use ODP time API instead of clock_gettime

2015-12-01 Thread Ivan Khoronzhuk
The time API can be used instead of Posix clock_gettime as more
accurate and OS independent.

Signed-off-by: Ivan Khoronzhuk 
---
 test/performance/odp_scheduling.c | 37 +
 1 file changed, 9 insertions(+), 28 deletions(-)

diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index 5d17c47..2c5262f 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -702,7 +702,7 @@ static void *run_thread(void *arg)
  */
 static void test_cpu_freq(void)
 {
-   struct timespec tp1, tp2;
+   odp_time_t cur_time, test_time, start_time, end_time;
uint64_t c1, c2, cycles;
uint64_t nsec;
double diff_max_hz, max_cycles;
@@ -710,40 +710,21 @@ static void test_cpu_freq(void)
printf("\nCPU cycle count frequency test (runs about %i sec)\n",
   TEST_SEC);
 
-   if (clock_gettime(CLOCK_MONOTONIC, &tp2)) {
-   LOG_ERR("clock_gettime failed.\n");
-   return;
-   }
-
-   /* Wait until clock moves to the next second. It enables easy comparison
-* during the measurement. */
-   do {
-   if (clock_gettime(CLOCK_MONOTONIC, &tp1)) {
-   LOG_ERR("clock_gettime failed.\n");
-   return;
-   }
-
-   } while (tp1.tv_sec == tp2.tv_sec);
+   test_time = odp_time_local_from_ns(TEST_SEC * ODP_TIME_SEC_IN_NS);
+   start_time = odp_time_local();
+   end_time = odp_time_sum(start_time, test_time);
 
/* Start the measurement */
c1 = odp_cpu_cycles();
 
do {
-   if (clock_gettime(CLOCK_MONOTONIC, &tp2)) {
-   LOG_ERR("clock_gettime failed.\n");
-   return;
-   }
-
-   } while ((tp2.tv_sec - tp1.tv_sec) < TEST_SEC);
+   cur_time = odp_time_local();
+   } while (odp_time_cmp(end_time, cur_time) > 0);
 
c2 = odp_cpu_cycles();
 
-   nsec = (tp2.tv_sec - tp1.tv_sec) * 10;
-
-   if (tp2.tv_nsec > tp1.tv_nsec)
-   nsec += tp2.tv_nsec - tp1.tv_nsec;
-   else
-   nsec -= tp1.tv_nsec - tp2.tv_nsec;
+   test_time = odp_time_diff(cur_time, start_time);
+   nsec = odp_time_to_ns(test_time);
 
cycles = odp_cpu_cycles_diff(c2, c1);
max_cycles = (nsec * odp_cpu_hz_max()) / 10.0;
@@ -751,7 +732,7 @@ static void test_cpu_freq(void)
/* Compare measured CPU cycles to maximum theoretical CPU cycle count */
diff_max_hz = ((double)(cycles) - max_cycles) / max_cycles;
 
-   printf("clock_gettime  %" PRIu64 " ns\n", nsec);
+   printf("odp_time   %" PRIu64 " ns\n", nsec);
printf("odp_cpu_cycles %" PRIu64 " CPU cycles\n", cycles);
printf("odp_sys_cpu_hz %" PRIu64 " hz\n", odp_cpu_hz_max());
printf("Diff from max CPU freq %f%%\n", diff_max_hz * 100.0);
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v4 8/9] test/example: use local time API as wall time

2015-12-01 Thread Ivan Khoronzhuk
The local time API is supposed to behave like wall time now,
so correct it in examples and tests.

Signed-off-by: Ivan Khoronzhuk 
---
 example/generator/odp_generator.c | 10 +-
 test/performance/odp_pktio_perf.c | 26 --
 test/validation/pktio/pktio.c | 21 -
 3 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 9d79f89..2de530d 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -586,7 +586,7 @@ static void *gen_recv_thread(void *arg)
  */
 static void print_global_stats(int num_workers)
 {
-   odp_time_t start, wait, diff;
+   odp_time_t cur, wait, next;
uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0;
int verbose_interval = 20;
odp_thrmask_t thrd_mask;
@@ -595,7 +595,7 @@ static void print_global_stats(int num_workers)
continue;
 
wait = odp_time_local_from_ns(verbose_interval * ODP_TIME_SEC_IN_NS);
-   start = odp_time_local();
+   next = odp_time_sum(odp_time_local(), wait);
 
while (odp_thrmask_worker(&thrd_mask) == num_workers) {
if (args->appl.number != -1 &&
@@ -604,11 +604,11 @@ static void print_global_stats(int num_workers)
break;
}
 
-   diff = odp_time_diff(odp_time_local(), start);
-   if (odp_time_cmp(wait, diff) > 0)
+   cur = odp_time_local();
+   if (odp_time_cmp(next, cur) > 0)
continue;
 
-   start = odp_time_local();
+   next = odp_time_sum(cur, wait);
 
if (args->appl.mode == APPL_MODE_RCV) {
pkts = odp_atomic_load_u64(&counters.udp);
diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index 2e49f50..8737bc8 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -305,8 +305,8 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
-   odp_time_t start_time, cur_time, send_duration;
-   odp_time_t burst_start_time, burst_gap;
+   odp_time_t cur_time, send_time_end, send_duration;
+   odp_time_t burst_gap_end, burst_gap;
uint32_t batch_len;
int unsent_pkts = 0;
odp_event_t  tx_event[BATCH_LEN_MAX];
@@ -336,21 +336,19 @@ static void *run_thread_tx(void *arg)
odp_barrier_wait(&globals->tx_barrier);
 
cur_time = odp_time_local();
-   start_time   = cur_time;
-   burst_start_time = odp_time_diff(cur_time, burst_gap);
-   while (odp_time_cmp(odp_time_diff(cur_time, start_time),
-   send_duration) > 1) {
+   send_time_end = odp_time_sum(cur_time, send_duration);
+   burst_gap_end = cur_time;
+   while (odp_time_cmp(send_time_end, cur_time) > 0) {
unsigned alloc_cnt = 0, tx_cnt;
 
-   if (odp_time_cmp(odp_time_diff(cur_time, burst_start_time),
-burst_gap) > 1) {
+   if (odp_time_cmp(burst_gap_end, cur_time) > 0) {
cur_time = odp_time_local();
if (!odp_time_cmp(idle_start, ODP_TIME_NULL))
idle_start = cur_time;
continue;
}
 
-   if (odp_time_cmp(idle_start, ODP_TIME_NULL)) {
+   if (odp_time_cmp(idle_start, ODP_TIME_NULL) > 0) {
odp_time_t diff = odp_time_diff(cur_time, idle_start);
 
stats->s.idle_ticks =
@@ -359,7 +357,7 @@ static void *run_thread_tx(void *arg)
idle_start = ODP_TIME_NULL;
}
 
-   burst_start_time = odp_time_sum(burst_start_time, burst_gap);
+   burst_gap_end = odp_time_sum(burst_gap_end, burst_gap);
 
alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts);
if (alloc_cnt != batch_len)
@@ -597,13 +595,13 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
  */
 static void busy_loop_ns(uint64_t wait_ns)
 {
-   odp_time_t diff;
-   odp_time_t start_time = odp_time_local();
odp_time_t wait = odp_time_local_from_ns(wait_ns);
+   odp_time_t cur = odp_time_local();
+   odp_time_t end_time = odp_time_sum(cur, wait);
 
do {
-   diff = odp_time_diff(odp_time_local(), start_time);
-   } while (odp_time_cmp(wait, diff) > 0);
+   cur = odp_time_local();
+   } while (odp_time_cmp(end_time, cur) > 0);
 }
 
 /*
diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 0a6592c..002c26b 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -336,18 +336,16 @@ static int destroy_inq(odp_pktio_t pktio)
 
 static odp_event_t queue_deq_wait_time(

[lng-odp] [API-NEXT PATCH v4 3/9] linux-generic: schedule: use schedule time in ns

2015-12-01 Thread Ivan Khoronzhuk
In the schedule_loop the wait time is passed in units of scheduler
time. At this moment there is no difference between wait time and
odp_time, but in case if odp_time is smth different from uint64_t,
it cannot be directly passed as uint64_t. So better to pass scheduler
time as ns and convert them before entering a loop.

Signed-off-by: Ivan Khoronzhuk 
---
 platform/linux-generic/odp_schedule.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 884ae60..96b3ac5 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -586,11 +586,10 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
 odp_event_t out_ev[],
 unsigned int max_num, unsigned int max_deq)
 {
-   odp_time_t start_time, time, diff;
+   odp_time_t start_time, time, diff, wtime;
+   int first = 1;
int ret;
 
-   start_time = ODP_TIME_NULL;
-
while (1) {
ret = schedule(out_queue, out_ev, max_num, max_deq);
 
@@ -603,15 +602,17 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
if (wait == ODP_SCHED_NO_WAIT)
break;
 
-   if (!odp_time_cmp(ODP_TIME_NULL, start_time)) {
+   if (first) {
+   wtime = odp_time_local_from_ns(wait);
start_time = odp_time_local();
+   first = 0;
continue;
}
 
time = odp_time_local();
diff = odp_time_diff(time, start_time);
 
-   if (odp_time_cmp(wait, diff) < 0)
+   if (odp_time_cmp(wtime, diff) < 0)
break;
}
 
@@ -652,7 +653,7 @@ void odp_schedule_resume(void)
 
 uint64_t odp_schedule_wait_time(uint64_t ns)
 {
-   return odp_time_to_u64(odp_time_local_from_ns(ns));
+   return ns;
 }
 
 
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v4 4/9] linux-generic: odp_time: don't use cpu cycle API to get time

2015-12-01 Thread Ivan Khoronzhuk
The linux-generic time API implementation shouldn't depend on cpu
cycle API wich is not stable enough to measure time period due to
dynamic frequency scaling.

Signed-off-by: Ivan Khoronzhuk 
---
 platform/linux-generic/Makefile.am |  1 -
 .../linux-generic/include/odp/plat/time_types.h|  6 +-
 platform/linux-generic/include/odp_cpu_internal.h  | 29 ---
 platform/linux-generic/odp_cpu.c   |  6 +-
 platform/linux-generic/odp_time.c  | 99 +-
 5 files changed, 67 insertions(+), 74 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp_cpu_internal.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 102f11e..ba220c0 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -110,7 +110,6 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_timer_internal.h \
  ${srcdir}/include/odp_timer_wheel_internal.h \
  ${srcdir}/include/odp_traffic_mngr_internal.h \
- ${srcdir}/include/odp_cpu_internal.h \
  ${srcdir}/Makefile.inc
 
 __LIB__libodp_la_SOURCES = \
diff --git a/platform/linux-generic/include/odp/plat/time_types.h 
b/platform/linux-generic/include/odp/plat/time_types.h
index 9ba1508..e5765ec 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,9 +21,11 @@ extern "C" {
  *  @{
  **/
 
-typedef uint64_t odp_time_t;
+typedef struct timespec odp_time_t;
 
-#define ODP_TIME_NULL ((odp_time_t)0)
+odp_time_t odp_time_null(void);
+
+#define ODP_TIME_NULL  odp_time_null()
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp_cpu_internal.h 
b/platform/linux-generic/include/odp_cpu_internal.h
deleted file mode 100644
index 664e2df..000
--- a/platform/linux-generic/include/odp_cpu_internal.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef ODP_CPU_INTERNAL_H_
-#define ODP_CPU_INTERNAL_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include 
-
-static inline
-uint64_t _odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
-{
-   if (odp_likely(c2 >= c1))
-   return c2 - c1;
-
-   return c2 + (odp_cpu_cycles_max() - c1) + 1;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-generic/odp_cpu.c
index 636f811..4bd6a9a 100644
--- a/platform/linux-generic/odp_cpu.c
+++ b/platform/linux-generic/odp_cpu.c
@@ -6,9 +6,11 @@
 
 #include 
 #include 
-#include 
 
 uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
 {
-   return _odp_cpu_cycles_diff(c2, c1);
+   if (odp_likely(c2 >= c1))
+   return c2 - c1;
+
+   return c2 + (odp_cpu_cycles_max() - c1) + 1;
 }
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index a2e4046..b725086 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -6,81 +6,100 @@
 
 #define _POSIX_C_SOURCE 200809L
 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
 
-#define GIGA 10
-
-static inline
-uint64_t time_to_tick(odp_time_t time)
+odp_time_t odp_time_local(void)
 {
-   return (uint64_t)time;
-}
+   int ret;
+   struct timespec time;
 
-static inline
-odp_time_t tick_to_time(uint64_t tick)
-{
-   return (odp_time_t)tick;
-}
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   if (odp_unlikely(ret != 0))
+   ODP_ABORT("clock_gettime failed\n");
 
-odp_time_t odp_time_local(void)
-{
-   return tick_to_time(odp_cpu_cycles());
+   return time;
 }
 
 odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
 {
-   return tick_to_time(_odp_cpu_cycles_diff(t2, t1));
+   struct timespec time;
+
+   time.tv_sec = t2.tv_sec - t1.tv_sec;
+   time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
+
+   if (time.tv_nsec < 0) {
+   time.tv_nsec += ODP_TIME_SEC_IN_NS;
+   --time.tv_sec;
+   }
+
+   return time;
 }
 
 uint64_t odp_time_to_ns(odp_time_t time)
 {
-   uint64_t hz = odp_cpu_hz_max();
-   uint64_t tick = time_to_tick(time);
+   uint64_t ns;
 
-   if (tick > (UINT64_MAX / GIGA))
-   return (tick / hz) * GIGA;
+   ns = time.tv_sec * ODP_TIME_SEC_IN_NS;
+   ns += time.tv_nsec;
 
-   return (tick * GIGA) / hz;
+   return ns;
 }
 
-
 odp_time_t odp_time_local_from_ns(uint64_t ns)
 {
-   uint64_t hz = odp_cpu_hz_max();
+   struct timespec time;
 
-   if (ns > (UINT64_MAX / hz))
-   return tick_to_time((ns / GIGA) * hz);
+   time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
+   time.tv_nsec = ns % ODP_TIME_SEC_IN_NS;
 
-   return tick_to_time((ns * hz) / GIGA);
+   return time;
 }
 
 int odp_time_cmp(odp_time_t t2, odp_time_t t1

[lng-odp] [API-NEXT PATCH v4 2/9] test: performance: pktio: don't use direct arithmetic operations with odp_time_t

2015-12-01 Thread Ivan Khoronzhuk
It was missed while unbinding cycles from time API names.
Correct is as it prevents for adding structure under odp_time_t.

Signed-off-by: Ivan Khoronzhuk 
---
 test/performance/odp_pktio_perf.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index ffe9844..2e49f50 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -338,10 +338,12 @@ static void *run_thread_tx(void *arg)
cur_time = odp_time_local();
start_time   = cur_time;
burst_start_time = odp_time_diff(cur_time, burst_gap);
-   while (odp_time_diff(cur_time, start_time) < send_duration) {
+   while (odp_time_cmp(odp_time_diff(cur_time, start_time),
+   send_duration) > 1) {
unsigned alloc_cnt = 0, tx_cnt;
 
-   if (odp_time_diff(cur_time, burst_start_time) < burst_gap) {
+   if (odp_time_cmp(odp_time_diff(cur_time, burst_start_time),
+burst_gap) > 1) {
cur_time = odp_time_local();
if (!odp_time_cmp(idle_start, ODP_TIME_NULL))
idle_start = cur_time;
@@ -357,7 +359,7 @@ static void *run_thread_tx(void *arg)
idle_start = ODP_TIME_NULL;
}
 
-   burst_start_time += burst_gap;
+   burst_start_time = odp_time_sum(burst_start_time, burst_gap);
 
alloc_cnt = alloc_packets(tx_event, batch_len - unsent_pkts);
if (alloc_cnt != batch_len)
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v4 1/9] validation: time: don't assign int directly to odp_time_t

2015-12-01 Thread Ivan Khoronzhuk
Under opaque type can be structure that cannot be used with direct
values, So, use conversion functions to get time_t to avoid build
issues.

Signed-off-by: Ivan Khoronzhuk 
---
 test/validation/time/time.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index f70c776..3d05a6f 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -36,8 +36,8 @@ void time_test_odp_negative_diff(void)
 {
odp_time_t diff, t1, t2;
 
-   t1 = 10;
-   t2 = 5;
+   t1 = odp_time_local_from_ns(10);
+   t2 = odp_time_local_from_ns(5);
diff = odp_time_diff(t2, t1);
CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
 }
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH v4 0/9] api: time: update local time to be monotonic

2015-12-01 Thread Ivan Khoronzhuk
This series is intended to modify time API to be used as monotonic wall
time in order to simplify time API usage and create prerequisites for
adding global time API.

Since v3:
- "api: time: make odp_local_time to be monotonic wall time"
  splitted on;
  "linux-generic: align with new wall time API"
  "test/example: use local time API as wall time"
- increased BUSY_LOOP_CNT to fit in resolution and 4+ sec

Since v2:
- removed patch changing type of ODP_TIME_*
- added new patch:
  test: performance: pktio: don't use direct arithmetic operations with
odp_time_t
- added new patch:
  performance: sched: use ODP time API instead of clock_gettime
- combined monotonic and wall time patches
- removed odp_time_local_val() and odp_time_val_to_ns()
- replaced terms monotonic and wall in API desc

Since v1:
- corrected name of the series to be api-next
- use thread local for holding start time

Ivan Khoronzhuk (9):
  validation: time: don't assign int directly to odp_time_t
  test: performance: pktio: don't use direct arithmetic operations with
odp_time_t
  linux-generic: schedule: use schedule time in ns
  linux-generic: odp_time: don't use cpu cycle API to get time
  performance: sched: use ODP time API instead of clock_gettime
  api: time: make odp_local_time to be monotonic wall time
  linux-generic: align with new wall time API
  test/example: use local time API as wall time
  validation: time: align tests with current time API

 example/generator/odp_generator.c  |  10 +-
 include/odp/api/time.h |   3 +-
 platform/linux-generic/Makefile.am |   1 -
 .../linux-generic/include/odp/plat/time_types.h|   6 +-
 platform/linux-generic/include/odp_cpu_internal.h  |  29 ---
 platform/linux-generic/include/odp_internal.h  |   2 +
 platform/linux-generic/odp_cpu.c   |   6 +-
 platform/linux-generic/odp_schedule.c  |  18 +-
 platform/linux-generic/odp_time.c  | 112 +++---
 test/performance/odp_pktio_perf.c  |  24 +--
 test/performance/odp_scheduling.c  |  37 +---
 test/validation/pktio/pktio.c  |  21 +-
 test/validation/time/time.c| 228 ++---
 test/validation/time/time.h|   7 +-
 14 files changed, 342 insertions(+), 162 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp_cpu_internal.h

-- 
1.9.1

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


Re: [lng-odp] [API-NEXT PATCH] linux-generic: tm: use intermediate casts to avoid strict warnings

2015-12-01 Thread Maxim Uvarov

Merged,
Maxim.

On 12/01/2015 00:41, Bill Fischofer wrote:
Macros would probably be a good idea, however I wanted to get this fix 
in now and let Alex and/or Barry recommend further code restructure 
based on their more thorough analysis.


This isn't the first time M32_ON_64 issues have been flagged.  I've 
added testing with this to my own checklist and it should probably be 
added to the CONTRIBUTING file and/or the Implementer's Guide.


On Mon, Nov 30, 2015 at 1:47 PM, Maxim Uvarov > wrote:


On 11/30/2015 21:45, Bill Fischofer wrote:

Signed-off-by: Bill Fischofer mailto:bill.fischo...@linaro.org>>
---
  .../include/odp_traffic_mngr_internal.h| 15 +++---
  platform/linux-generic/odp_name_table.c| 58
--
  platform/linux-generic/odp_pkt_queue.c | 12 ++---
  platform/linux-generic/odp_sorted_list.c   | 16 +++---
  platform/linux-generic/odp_timer_wheel.c   | 18 +++
  platform/linux-generic/odp_traffic_mngr.c |  4 +-
  6 files changed, 67 insertions(+), 56 deletions(-)

diff --git
a/platform/linux-generic/include/odp_traffic_mngr_internal.h
b/platform/linux-generic/include/odp_traffic_mngr_internal.h
index c2d5cf4..e48e213 100644
--- a/platform/linux-generic/include/odp_traffic_mngr_internal.h
+++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h
@@ -48,8 +48,8 @@ typedef struct stat  file_stat_t;
/* Macros to convert handles to internal pointers and vice
versa. */
  -#define MAKE_ODP_TM_HANDLE(tm_system) ((odp_tm_t)tm_system)
-#define GET_TM_SYSTEM(odp_tm)  ((tm_system_t *)odp_tm)
+#define MAKE_ODP_TM_HANDLE(tm_system)
((odp_tm_t)(uintptr_t)tm_system)
+#define GET_TM_SYSTEM(odp_tm)  ((tm_system_t
*)(uintptr_t)odp_tm)
#define MAKE_PROFILE_HANDLE(profile_kind, tbl_idx) \
(((profile_kind & 0xF) << 28) | ((tbl_idx + 1) &
0xFFF))
@@ -59,11 +59,14 @@ typedef struct stat  file_stat_t;
#define GET_TBL_IDX(profile_handle) ((profile_handle &
0xFFF) - 1)
  -#define MAKE_ODP_TM_NODE(tm_node_obj)
((odp_tm_node_t)(tm_node_obj))
-#define GET_TM_NODE_OBJ(odp_tm_node)  ((tm_node_obj_t
*)(odp_tm_node))
+#define MAKE_ODP_TM_NODE(tm_node_obj)
((odp_tm_node_t)(uintptr_t)(tm_node_obj))
+#define GET_TM_NODE_OBJ(odp_tm_node) \
+   ((tm_node_obj_t *)(uintptr_t)(odp_tm_node))
  -#define MAKE_ODP_TM_QUEUE(tm_queue_obj)
((odp_tm_queue_t)(tm_queue_obj))
-#define GET_TM_QUEUE_OBJ(odp_tm_queue)  ((tm_queue_obj_t
*)(odp_tm_queue))
+#define MAKE_ODP_TM_QUEUE(tm_queue_obj) \
+   ((odp_tm_queue_t)(uintptr_t)(tm_queue_obj))
+#define GET_TM_QUEUE_OBJ(odp_tm_queue) \
+   ((tm_queue_obj_t *)(uintptr_t)(odp_tm_queue))
typedef uint64_t tm_handle_t;
  diff --git a/platform/linux-generic/odp_name_table.c
b/platform/linux-generic/odp_name_table.c
index 10ce099..10a760e 100644
--- a/platform/linux-generic/odp_name_table.c
+++ b/platform/linux-generic/odp_name_table.c
@@ -567,7 +567,7 @@ static hash_tbl_entry_t
make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry,
uint32_t new_entry_cnt;
new_entry_cnt   = MIN(entry_cnt + 1, 0x3F);
-   hash_tbl_entry  = (hash_tbl_entry_t)name_tbl_entry;
+   hash_tbl_entry  =
(hash_tbl_entry_t)(uintptr_t)name_tbl_entry;
hash_tbl_entry &= ~0x3F;
hash_tbl_entry |= new_entry_cnt;
return hash_tbl_entry;
@@ -584,18 +584,18 @@ static name_tbl_entry_t
*name_hash_tbl_lookup(uint32_t hash_value)
if (hash_tbl_entry == 0)
return NULL;
else if ((hash_tbl_entry & 0x3F) != 0)
-   return (name_tbl_entry_t *)(hash_tbl_entry &
~0x3F);
+   return (name_tbl_entry_t
*)(uintptr_t)(hash_tbl_entry & ~0x3F);
   /* This hash_tbl_entry references a secondary hash
table, so get
* some more hash_value bits and index that table.
*/
hash_idx   = (hash_value >> 16) &
(SECONDARY_HASH_TBL_SIZE - 1);
-   secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry;
+   secondary_hash = (secondary_hash_tbl_t
*)(uintptr_t)hash_tbl_entry;
hash_tbl_entry = secondary_hash->hash_entries[hash_idx];
if (hash_tbl_entry == 0)
return NULL;
else if ((hash_tbl_entry & 0x3F) != 0)
-   return (name_tbl_entry_t 

Re: [lng-odp] [API-NEXT PATCH 1/2] validation: synchronizers: add missing rwlock read lock functional test

2015-12-01 Thread Maxim Uvarov

Merged both.

Maxim.

On 10/29/2015 21:34, Bill Fischofer wrote:

rwlock functional tests test for write locks, however they should also
test for read locks.

Signed-off-by: Bill Fischofer 
---
  test/validation/synchronizers/synchronizers.c | 13 +
  1 file changed, 13 insertions(+)

diff --git a/test/validation/synchronizers/synchronizers.c 
b/test/validation/synchronizers/synchronizers.c
index 2406c77..6a8d79f 100644
--- a/test/validation/synchronizers/synchronizers.c
+++ b/test/validation/synchronizers/synchronizers.c
@@ -652,6 +652,19 @@ static void *rwlock_functional_test(void *arg UNUSED)
lock_owner_delay = BASE_DELAY;
  
  	for (cnt = 1; cnt <= iterations; cnt++) {

+   /* Verify that we can obtain a read lock */
+   odp_rwlock_read_lock(&global_mem->global_rwlock);
+
+   /* Verify lock is unowned (no writer holds it) */
+   thread_delay(per_thread_mem, lock_owner_delay);
+   if (global_mem->global_lock_owner != 0) {
+   current_errs++;
+   sync_failures++;
+   }
+
+   /* Release the read lock */
+   odp_rwlock_read_unlock(&global_mem->global_rwlock);
+
/* Acquire the shared global lock */
odp_rwlock_write_lock(&global_mem->global_rwlock);
  


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


Re: [lng-odp] [PATCH 3/3] update version number from v1.4.1.0 to v1.5.0.0

2015-12-01 Thread Bill Fischofer
Shouldn't the update log also mention the improved documentation as well?

On Tue, Dec 1, 2015 at 7:58 AM, Mike Holmes  wrote:

>
>
> On 1 December 2015 at 08:45, Maxim Uvarov  wrote:
>
>> On 11/30/2015 23:43, Mike Holmes wrote:
>>
>>> Signed-off-by: Mike Holmes 
>>> ---
>>>   CHANGELOG | 34 ++
>>>   include/odp/api/version.h |  4 ++--
>>>   pkg/debian/changelog  |  5 +
>>>   pkg/rpm/odp.spec  |  2 ++
>>>   4 files changed, 43 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/CHANGELOG b/CHANGELOG
>>> index cd8c387..89966a9 100644
>>> --- a/CHANGELOG
>>> +++ b/CHANGELOG
>>> @@ -1,3 +1,37 @@
>>> +opendataplane (1.5.0.0)
>>> +   * API:
>>> +   - api: buffer: add functions to alloc/free multiple buffers at
>>> once
>>> +   - api: cpu: change order of arguments for diff function
>>> +   - api: crypto: add AES128-CBC encrypt/decrypt methods
>>> +   - api: crypto: add HMAC-SHA-256-128 support
>>> +   - api: crypto: move enums from platform types to odp and rename
>>> to fit the API format
>>> +   - api: packet: add functions to alloc/free multiple packets at
>>> once
>>> +   - api: queue: add odp_queue_info() function to retrieve queue
>>> information
>>> +   - api: time: change order of arguments for diff function
>>> +   - api: time: unbind CPU cycles from time API
>>> +   * Validation
>>> +   - performance: odp_pktio_perf: fix potential overflow in wait
>>> loop
>>> +   - test/example: avoid "cycle" word usage
>>> +   - ability to specify test install directory
>>> +   - buffer: add tests for buffer alloc/free multi functions
>>> +   - crypto: add test for AES128 CBC
>>> +   - crypto: add test for HMAC-SHA-256-128
>>> +   - crypto: limit packet size to maximum supported by platform
>>> +   - packet: add tests for packet alloc/free multi functions
>>> +   - queue: api validation tests for odp_queue_info()
>>> +   - remove strict dependency on CUnit 2.1-3
>>> +   - scheduler: add missing ticketlock unlock
>>> +   * General:
>>> +   - rpm packaging support
>>> +   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
>>> +   - linux-generic: cpumask: warn that CPU0 is used by control and
>>> worker thread
>>> +   - linux-generic: packet: add implementation for packet
>>> alloc/free multi
>>> +   - linux-generic: pool: add buffer_alloc_multi function
>>> +   - linux-generic: pool: add implementation for buffer alloc/free
>>> multi
>>> +   - linux-generic: queue: add odp_queue_info() function
>>> +   - linux-generic: validation: add run-test script for post
>>> install testing
>>> +   - platform: move list of API files to Makefile.inc so it is
>>> common to all platforms
>>> +
>>>   opendataplane (1.4.1.0)
>>>  * Validation
>>>  - pktio: test transmit error recovery
>>> diff --git a/include/odp/api/version.h b/include/odp/api/version.h
>>> index 8912177..58bb7ec 100644
>>> --- a/include/odp/api/version.h
>>> +++ b/include/odp/api/version.h
>>> @@ -37,7 +37,7 @@ extern "C" {
>>>* Introduction of major new features or changes. APIs with different
>>> major
>>>* versions are likely not backward compatible.
>>>*/
>>> -#define ODP_VERSION_API_MAJOR 4
>>> +#define ODP_VERSION_API_MAJOR 5
>>> /**
>>>* ODP API minor version
>>> @@ -46,7 +46,7 @@ extern "C" {
>>>* to the API. For an API with common generation and major version,
>>> but with
>>>* different minor numbers the two versions are backward compatible.
>>>*/
>>> -#define ODP_VERSION_API_MINOR 1
>>> +#define ODP_VERSION_API_MINOR 0
>>> /**
>>>* Returns ODP API version string
>>> diff --git a/pkg/debian/changelog b/pkg/debian/changelog
>>> index 1983a9a..7680cf1 100644
>>> --- a/pkg/debian/changelog
>>> +++ b/pkg/debian/changelog
>>> @@ -1,3 +1,8 @@
>>> +opendataplane (1.5.0.0-1) unstable; urgency=low
>>> +   * ODP release v1.5
>>> +
>>> + -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43
>>> +0300
>>> +
>>>   opendataplane (1.4.1.0-1) unstable; urgency=low
>>>  * Validation
>>>  - pktio: test transmit error recovery
>>> diff --git a/pkg/rpm/odp.spec b/pkg/rpm/odp.spec
>>> index aa57476..e76fe58 100644
>>> --- a/pkg/rpm/odp.spec
>>> +++ b/pkg/rpm/odp.spec
>>> @@ -68,5 +68,7 @@ and guides in HTMLformats.
>>>   %post -p /sbin/ldconfig
>>>   %postun -p /sbin/ldconfig
>>>   %changelog
>>> +* Mon Nov 30 2015 - mike.holmes (at) linaro.org
>>> +- ODP release v1.5
>>>   * Tue Nov 10 2015 - anders.roxell (at) linaro.org
>>>   - Initial rpm release, ODP release v1.4
>>>
>> In RPM that lines also needed to be updated:
>> Version: 1.4
>> Release: 1
>>
>
> Yes, that is a mistake, please update it when you make the actual release
>
>
>>
>> Moving change log to some common place is good thing. But if that
>> packages needs directly go to distributive (debian or redhat),
>> than packages also have to have readable logs.
>
>
> I have CC'ed 

Re: [lng-odp] [PATCH] linux-generic: schedule: set sched_local.pool correctly

2015-12-01 Thread Bill Fischofer
At least in the linux-generic implementation, we force max_deq to be 1
since we want consecutive events from an ordered queue to be dispatched to
separate threads.  There's no advantage to batching things as is done in
parallel queues since if Thread A has events 1, 2,3, 4 while Thread B has
events 5, etc., then Thread B's processing of event 5 would just have to
wait until Thread A worked its way though it's backlog of cached events.

So this isn't an issue here.

On Tue, Dec 1, 2015 at 7:39 AM, Nicolas Morey-Chaisemartin  wrote:

> I don't think there is any guarantee that all buffer returned by
> queue_deq_multi come from the same pool.
> So this should probably be updated when we copy an event out of the local
> cache at the beginning of schedule()
>
> Nicolas
>
> On 12/01/2015 02:14 PM, Bill Fischofer wrote:
> > This corrects bug https://bugs.linaro.org/show_bug.cgi?id=1921
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> >  platform/linux-generic/odp_schedule.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/platform/linux-generic/odp_schedule.c
> b/platform/linux-generic/odp_schedule.c
> > index 884ae60..9b7cd57 100644
> > --- a/platform/linux-generic/odp_schedule.c
> > +++ b/platform/linux-generic/odp_schedule.c
> > @@ -553,6 +553,8 @@ static int schedule(odp_queue_t *out_queue,
> odp_event_t out_ev[],
> >   sched_local.origin_qe = qe;
> >   sched_local.order =
> >   sched_local.buf_hdr[0]->order;
> > + sched_local.pool =
> > + sched_local.buf_hdr[0]->pool_hdl;
> >   for (k = 0;
> >k < qe->s.param.sched.lock_count;
> >k++) {
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 3/3] update version number from v1.4.1.0 to v1.5.0.0

2015-12-01 Thread Mike Holmes
On 1 December 2015 at 08:45, Maxim Uvarov  wrote:

> On 11/30/2015 23:43, Mike Holmes wrote:
>
>> Signed-off-by: Mike Holmes 
>> ---
>>   CHANGELOG | 34 ++
>>   include/odp/api/version.h |  4 ++--
>>   pkg/debian/changelog  |  5 +
>>   pkg/rpm/odp.spec  |  2 ++
>>   4 files changed, 43 insertions(+), 2 deletions(-)
>>
>> diff --git a/CHANGELOG b/CHANGELOG
>> index cd8c387..89966a9 100644
>> --- a/CHANGELOG
>> +++ b/CHANGELOG
>> @@ -1,3 +1,37 @@
>> +opendataplane (1.5.0.0)
>> +   * API:
>> +   - api: buffer: add functions to alloc/free multiple buffers at
>> once
>> +   - api: cpu: change order of arguments for diff function
>> +   - api: crypto: add AES128-CBC encrypt/decrypt methods
>> +   - api: crypto: add HMAC-SHA-256-128 support
>> +   - api: crypto: move enums from platform types to odp and rename
>> to fit the API format
>> +   - api: packet: add functions to alloc/free multiple packets at
>> once
>> +   - api: queue: add odp_queue_info() function to retrieve queue
>> information
>> +   - api: time: change order of arguments for diff function
>> +   - api: time: unbind CPU cycles from time API
>> +   * Validation
>> +   - performance: odp_pktio_perf: fix potential overflow in wait loop
>> +   - test/example: avoid "cycle" word usage
>> +   - ability to specify test install directory
>> +   - buffer: add tests for buffer alloc/free multi functions
>> +   - crypto: add test for AES128 CBC
>> +   - crypto: add test for HMAC-SHA-256-128
>> +   - crypto: limit packet size to maximum supported by platform
>> +   - packet: add tests for packet alloc/free multi functions
>> +   - queue: api validation tests for odp_queue_info()
>> +   - remove strict dependency on CUnit 2.1-3
>> +   - scheduler: add missing ticketlock unlock
>> +   * General:
>> +   - rpm packaging support
>> +   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
>> +   - linux-generic: cpumask: warn that CPU0 is used by control and
>> worker thread
>> +   - linux-generic: packet: add implementation for packet alloc/free
>> multi
>> +   - linux-generic: pool: add buffer_alloc_multi function
>> +   - linux-generic: pool: add implementation for buffer alloc/free
>> multi
>> +   - linux-generic: queue: add odp_queue_info() function
>> +   - linux-generic: validation: add run-test script for post install
>> testing
>> +   - platform: move list of API files to Makefile.inc so it is
>> common to all platforms
>> +
>>   opendataplane (1.4.1.0)
>>  * Validation
>>  - pktio: test transmit error recovery
>> diff --git a/include/odp/api/version.h b/include/odp/api/version.h
>> index 8912177..58bb7ec 100644
>> --- a/include/odp/api/version.h
>> +++ b/include/odp/api/version.h
>> @@ -37,7 +37,7 @@ extern "C" {
>>* Introduction of major new features or changes. APIs with different
>> major
>>* versions are likely not backward compatible.
>>*/
>> -#define ODP_VERSION_API_MAJOR 4
>> +#define ODP_VERSION_API_MAJOR 5
>> /**
>>* ODP API minor version
>> @@ -46,7 +46,7 @@ extern "C" {
>>* to the API. For an API with common generation and major version, but
>> with
>>* different minor numbers the two versions are backward compatible.
>>*/
>> -#define ODP_VERSION_API_MINOR 1
>> +#define ODP_VERSION_API_MINOR 0
>> /**
>>* Returns ODP API version string
>> diff --git a/pkg/debian/changelog b/pkg/debian/changelog
>> index 1983a9a..7680cf1 100644
>> --- a/pkg/debian/changelog
>> +++ b/pkg/debian/changelog
>> @@ -1,3 +1,8 @@
>> +opendataplane (1.5.0.0-1) unstable; urgency=low
>> +   * ODP release v1.5
>> +
>> + -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43
>> +0300
>> +
>>   opendataplane (1.4.1.0-1) unstable; urgency=low
>>  * Validation
>>  - pktio: test transmit error recovery
>> diff --git a/pkg/rpm/odp.spec b/pkg/rpm/odp.spec
>> index aa57476..e76fe58 100644
>> --- a/pkg/rpm/odp.spec
>> +++ b/pkg/rpm/odp.spec
>> @@ -68,5 +68,7 @@ and guides in HTMLformats.
>>   %post -p /sbin/ldconfig
>>   %postun -p /sbin/ldconfig
>>   %changelog
>> +* Mon Nov 30 2015 - mike.holmes (at) linaro.org
>> +- ODP release v1.5
>>   * Tue Nov 10 2015 - anders.roxell (at) linaro.org
>>   - Initial rpm release, ODP release v1.4
>>
> In RPM that lines also needed to be updated:
> Version: 1.4
> Release: 1
>

Yes, that is a mistake, please update it when you make the actual release


>
> Moving change log to some common place is good thing. But if that packages
> needs directly go to distributive (debian or redhat),
> than packages also have to have readable logs.


I have CC'ed Fathi as I believe the new approach is the correct one driven
by his guidance. The package logs  have the change to the package listed
and the API changes etc are in their own log.


> If we provide it only as template and distributives will add their own
> changelo

Re: [lng-odp] [PATCH 3/3] update version number from v1.4.1.0 to v1.5.0.0

2015-12-01 Thread Maxim Uvarov

On 11/30/2015 23:43, Mike Holmes wrote:

Signed-off-by: Mike Holmes 
---
  CHANGELOG | 34 ++
  include/odp/api/version.h |  4 ++--
  pkg/debian/changelog  |  5 +
  pkg/rpm/odp.spec  |  2 ++
  4 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index cd8c387..89966a9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,37 @@
+opendataplane (1.5.0.0)
+   * API:
+   - api: buffer: add functions to alloc/free multiple buffers at once
+   - api: cpu: change order of arguments for diff function
+   - api: crypto: add AES128-CBC encrypt/decrypt methods
+   - api: crypto: add HMAC-SHA-256-128 support
+   - api: crypto: move enums from platform types to odp and rename to fit 
the API format
+   - api: packet: add functions to alloc/free multiple packets at once
+   - api: queue: add odp_queue_info() function to retrieve queue 
information
+   - api: time: change order of arguments for diff function
+   - api: time: unbind CPU cycles from time API
+   * Validation
+   - performance: odp_pktio_perf: fix potential overflow in wait loop
+   - test/example: avoid "cycle" word usage
+   - ability to specify test install directory
+   - buffer: add tests for buffer alloc/free multi functions
+   - crypto: add test for AES128 CBC
+   - crypto: add test for HMAC-SHA-256-128
+   - crypto: limit packet size to maximum supported by platform
+   - packet: add tests for packet alloc/free multi functions
+   - queue: api validation tests for odp_queue_info()
+   - remove strict dependency on CUnit 2.1-3
+   - scheduler: add missing ticketlock unlock
+   * General:
+   - rpm packaging support
+   - linux-generic: config: increase ODP_CONFIG_SCHED_GRPS to 256
+   - linux-generic: cpumask: warn that CPU0 is used by control and worker 
thread
+   - linux-generic: packet: add implementation for packet alloc/free multi
+   - linux-generic: pool: add buffer_alloc_multi function
+   - linux-generic: pool: add implementation for buffer alloc/free multi
+   - linux-generic: queue: add odp_queue_info() function
+   - linux-generic: validation: add run-test script for post install 
testing
+   - platform: move list of API files to Makefile.inc so it is common to 
all platforms
+
  opendataplane (1.4.1.0)
 * Validation
 - pktio: test transmit error recovery
diff --git a/include/odp/api/version.h b/include/odp/api/version.h
index 8912177..58bb7ec 100644
--- a/include/odp/api/version.h
+++ b/include/odp/api/version.h
@@ -37,7 +37,7 @@ extern "C" {
   * Introduction of major new features or changes. APIs with different major
   * versions are likely not backward compatible.
   */
-#define ODP_VERSION_API_MAJOR 4
+#define ODP_VERSION_API_MAJOR 5
  
  /**

   * ODP API minor version
@@ -46,7 +46,7 @@ extern "C" {
   * to the API. For an API with common generation and major version, but with
   * different minor numbers the two versions are backward compatible.
   */
-#define ODP_VERSION_API_MINOR 1
+#define ODP_VERSION_API_MINOR 0
  
  /**

   * Returns ODP API version string
diff --git a/pkg/debian/changelog b/pkg/debian/changelog
index 1983a9a..7680cf1 100644
--- a/pkg/debian/changelog
+++ b/pkg/debian/changelog
@@ -1,3 +1,8 @@
+opendataplane (1.5.0.0-1) unstable; urgency=low
+   * ODP release v1.5
+
+ -- Maxim Uvarov   Mon, 30 Nov 2015 13:08:43 +0300
+
  opendataplane (1.4.1.0-1) unstable; urgency=low
 * Validation
 - pktio: test transmit error recovery
diff --git a/pkg/rpm/odp.spec b/pkg/rpm/odp.spec
index aa57476..e76fe58 100644
--- a/pkg/rpm/odp.spec
+++ b/pkg/rpm/odp.spec
@@ -68,5 +68,7 @@ and guides in HTMLformats.
  %post -p /sbin/ldconfig
  %postun -p /sbin/ldconfig
  %changelog
+* Mon Nov 30 2015 - mike.holmes (at) linaro.org
+- ODP release v1.5
  * Tue Nov 10 2015 - anders.roxell (at) linaro.org
  - Initial rpm release, ODP release v1.4

In RPM that lines also needed to be updated:
Version: 1.4
Release: 1

Moving change log to some common place is good thing. But if that 
packages needs directly go to distributive (debian or redhat),
than packages also have to have readable logs. If we provide it only as 
template and distributives will add their own changelogs
for packages (which is likely), than we can skip logs in .rpm and .deb 
and just update version on ./bootstrap stage.


Also CHANGELOG file has to be packaged, i.e. it has to be added to 
Makefile.am.


Maxim.





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


Re: [lng-odp] [PATCH] linux-generic: schedule: set sched_local.pool correctly

2015-12-01 Thread Nicolas Morey-Chaisemartin
I don't think there is any guarantee that all buffer returned by 
queue_deq_multi come from the same pool.
So this should probably be updated when we copy an event out of the local cache 
at the beginning of schedule()

Nicolas

On 12/01/2015 02:14 PM, Bill Fischofer wrote:
> This corrects bug https://bugs.linaro.org/show_bug.cgi?id=1921
>
> Signed-off-by: Bill Fischofer 
> ---
>  platform/linux-generic/odp_schedule.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/platform/linux-generic/odp_schedule.c 
> b/platform/linux-generic/odp_schedule.c
> index 884ae60..9b7cd57 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -553,6 +553,8 @@ static int schedule(odp_queue_t *out_queue, odp_event_t 
> out_ev[],
>   sched_local.origin_qe = qe;
>   sched_local.order =
>   sched_local.buf_hdr[0]->order;
> + sched_local.pool =
> + sched_local.buf_hdr[0]->pool_hdl;
>   for (k = 0;
>k < qe->s.param.sched.lock_count;
>k++) {

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


[lng-odp] [PATCH 2/2] helper: unbind hash from platform strong types

2015-12-01 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 helper/include/odp/helper/table.h | 5 -
 helper/odph_hashtable.h   | 2 --
 helper/odph_lineartable.h | 1 -
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/helper/include/odp/helper/table.h 
b/helper/include/odp/helper/table.h
index 50a6a84..d788010 100644
--- a/helper/include/odp/helper/table.h
+++ b/helper/include/odp/helper/table.h
@@ -80,14 +80,17 @@
 extern "C" {
 #endif
 
+#include 
+
 /**
  * @def ODPH_TABLE_NAME_LEN
  * Max length of table name
  */
 #define ODPH_TABLE_NAME_LEN  32
 
+#include 
 /** ODP table handle */
-typedef ODP_HANDLE_T(odph_table_t);
+typedef ODPH_HANDLE_T(odph_table_t);
 
 /**
 * create a table
diff --git a/helper/odph_hashtable.h b/helper/odph_hashtable.h
index 7c20370..bb75cb9 100644
--- a/helper/odph_hashtable.h
+++ b/helper/odph_hashtable.h
@@ -13,8 +13,6 @@
 #ifndef ODPH_HASH_TABLE_H_
 #define ODPH_HASH_TABLE_H_
 
-#include 
-#include 
 #include 
 
 #ifdef __cplusplus
diff --git a/helper/odph_lineartable.h b/helper/odph_lineartable.h
index a53c68b..0b56b7f 100644
--- a/helper/odph_lineartable.h
+++ b/helper/odph_lineartable.h
@@ -14,7 +14,6 @@
 #define ODPH_LINEAR_TABLE_H_
 
 #include 
-#include 
 #include 
 
 #ifdef __cplusplus
-- 
1.9.1

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


[lng-odp] [PATCH 1/2] helper: strong types support

2015-12-01 Thread Maxim Uvarov
Add strong types support for helpers the same as we have for
linux-generic. That should be useful for complex algorithms
where type check is needed.

Signed-off-by: Maxim Uvarov 
---
 helper/Makefile.am   |  1 +
 helper/include/odp/helper/strong_types.h | 35 
 2 files changed, 36 insertions(+)
 create mode 100644 helper/include/odp/helper/strong_types.h

diff --git a/helper/Makefile.am b/helper/Makefile.am
index bed8683..1906ae2 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -15,6 +15,7 @@ helperinclude_HEADERS = \
  $(srcdir)/include/odp/helper/icmp.h\
  $(srcdir)/include/odp/helper/ip.h\
  $(srcdir)/include/odp/helper/ipsec.h\
+ $(srcdir)/include/odp/helper/strong_types.h\
  $(srcdir)/include/odp/helper/tcp.h\
  $(srcdir)/include/odp/helper/table.h\
  $(srcdir)/include/odp/helper/udp.h
diff --git a/helper/include/odp/helper/strong_types.h 
b/helper/include/odp/helper/strong_types.h
new file mode 100644
index 000..777e24d
--- /dev/null
+++ b/helper/include/odp/helper/strong_types.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Strong Types. Common macros for implementing strong typing
+ * for ODP abstract data types
+ */
+
+#ifndef ODPH_STRONG_TYPES_H_
+#define ODPH_STRONG_TYPES_H_
+
+/** Use strong typing for ODP types */
+#ifdef __cplusplus
+#define ODPH_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type
+#else
+#define odph_handle_t struct { uint8_t unused_dummy_var; } *
+/** C/C++ helper macro for strong typing */
+#define ODPH_HANDLE_T(type) odph_handle_t type
+#endif
+
+/** Internal macro to get value of an ODP handle */
+#define _odph_typeval(handle) ((uint32_t)(uintptr_t)(handle))
+
+/** Internal macro to get printable value of an ODP handle */
+#define _odph_pri(handle) ((uint64_t)_odph_typeval(handle))
+
+/** Internal macro to convert a scalar to a typed handle */
+#define _odph_cast_scalar(type, val) ((type)(uintptr_t)(val))
+
+#endif
-- 
1.9.1

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


[lng-odp] [PATCH 0/2] helper: strong types support

2015-12-01 Thread Maxim Uvarov
For helpers it's also reasonable to have strong types support. Using
basing linux-generic implementation for it.

Maxim Uvarov (2):
  helper: strong types support
  helper: unbind hash from platform strong types

 helper/Makefile.am   |  1 +
 helper/include/odp/helper/strong_types.h | 36 
 helper/include/odp/helper/table.h|  5 -
 helper/odph_hashtable.h  |  3 +--
 helper/odph_lineartable.h|  1 -
 5 files changed, 42 insertions(+), 4 deletions(-)
 create mode 100644 helper/include/odp/helper/strong_types.h

-- 
1.9.1

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


[lng-odp] [Bug 1921] sched_local.pool not set

2015-12-01 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1921

--- Comment #1 from Bill Fischofer  ---
Patch http://patches.opendataplane.org/patch/3980/ submitted to correct this
bug.

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


[lng-odp] [PATCH] linux-generic: schedule: set sched_local.pool correctly

2015-12-01 Thread Bill Fischofer
This corrects bug https://bugs.linaro.org/show_bug.cgi?id=1921

Signed-off-by: Bill Fischofer 
---
 platform/linux-generic/odp_schedule.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 884ae60..9b7cd57 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -553,6 +553,8 @@ static int schedule(odp_queue_t *out_queue, odp_event_t 
out_ev[],
sched_local.origin_qe = qe;
sched_local.order =
sched_local.buf_hdr[0]->order;
+   sched_local.pool =
+   sched_local.buf_hdr[0]->pool_hdl;
for (k = 0;
 k < qe->s.param.sched.lock_count;
 k++) {
-- 
2.1.4

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


[lng-odp] [Bug 1921] New: sched_local.pool not set

2015-12-01 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1921

Bug ID: 1921
   Summary: sched_local.pool not set
   Product: OpenDataPlane - linux- generic reference
   Version: api-next
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: Scheduler
  Assignee: bill.fischo...@linaro.org
  Reporter: bill.fischo...@linaro.org
CC: lng-odp@lists.linaro.org

odp_schedule() is not setting sched_local.pool when selecting an event from an
ordered queue for scheduling. This means that placeholder buffers will be
allocated from random pools when odp_schedule_release_ordered() is called,
which is not correct.

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


Re: [lng-odp] [PATCHv4 3/5] helper: table: add impl of lineartable

2015-12-01 Thread Ivan Khoronzhuk



On 01.12.15 14:41, Maxim Uvarov wrote:

On 12/01/2015 15:25, Ivan Khoronzhuk wrote:

--- /dev/null
+++ b/helper/odph_lineartable.h
@@ -0,0 +1,41 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Linear Table
+ */
+
+#ifndef ODPH_LINEAR_TABLE_H_
+#define ODPH_LINEAR_TABLE_H_
+
+#include 
+#include 


platform dependent inclusion.
Maxim, it's already in master branch and should be fixed.


oh, thanks, somehow that was missed.

Maxim.


+ huanggaoya...@huawei.com

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


Re: [lng-odp] [PATCHv4 3/5] helper: table: add impl of lineartable

2015-12-01 Thread Maxim Uvarov

On 12/01/2015 15:25, Ivan Khoronzhuk wrote:

--- /dev/null
+++ b/helper/odph_lineartable.h
@@ -0,0 +1,41 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Linear Table
+ */
+
+#ifndef ODPH_LINEAR_TABLE_H_
+#define ODPH_LINEAR_TABLE_H_
+
+#include 
+#include 


platform dependent inclusion.
Maxim, it's already in master branch and should be fixed. 


oh, thanks, somehow that was missed.

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


Re: [lng-odp] [PATCHv4 3/5] helper: table: add impl of lineartable

2015-12-01 Thread Ivan Khoronzhuk



On 05.11.15 13:20, huanggaoyang wrote:

Signed-off-by: huanggaoyang 
---
  helper/lineartable.c  | 210 ++
  helper/odph_lineartable.h |  41 +
  2 files changed, 251 insertions(+)
  create mode 100644 helper/lineartable.c
  create mode 100644 helper/odph_lineartable.h

diff --git a/helper/lineartable.c b/helper/lineartable.c
new file mode 100644
index 000..7809a52
--- /dev/null
+++ b/helper/lineartable.c
@@ -0,0 +1,210 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+#include 
+#include 
+#include 
+
+#include "odph_lineartable.h"
+#include "odph_debug.h"
+#include 
+
+#define ODPH_SUCCESS   0
+#define ODPH_FAIL  -1
+
+/** @magic word, write to the first byte of the memory block
+ *  to indicate this block is used by a linear table structure
+ */
+#define ODPH_LINEAR_TABLE_MAGIC_WORD   0xEFEFFEFE
+
+/** @internal table struct
+ *   For linear table, value is orgnized as a big array,
+ *   and key is the index of this array, so we just need to record the
+ *   content of value, and make sure the key won't overflow
+ */
+typedef struct {
+   uint32_t magicword; /**< for check */
+   uint32_t init_cap; /**< input param of capacity */
+   /** given the capacity, caculate out the max supported nodes number */
+   uint32_t node_sum;
+   /** size of a lineartable element,including the rwlock in the head */
+   uint32_t value_size;
+   void *value_array; /**< value pool in array format */
+   char name[ODPH_TABLE_NAME_LEN]; /**< name of the table */
+} odph_linear_table_imp;
+
+/** Note: for linear table, key must be an number, its size is fixed 4.
+ *  So, we ignore the input key_size here
+ */
+
+odph_table_t odph_linear_table_create(const char *name, uint32_t capacity,
+ uint32_t ODP_IGNORED, uint32_t value_size)
+{
+   int idx;
+   uint32_t node_num;
+   odp_shm_t shmem;
+   odph_linear_table_imp *tbl;
+
+   if (strlen(name) >= ODPH_TABLE_NAME_LEN || capacity < 1 ||
+   capacity >= 0x1000 || value_size == 0) {
+   printf("create para input error or less than !");
+   return NULL;
+   }
+   /* check name confict in shm*/
+   tbl = (odph_linear_table_imp *)odp_shm_addr(odp_shm_lookup(name));
+   if (tbl != NULL) {
+   ODPH_DBG("name already exist\n");
+   return NULL;
+   }
+
+   /* alloc memory from shm */
+   shmem = odp_shm_reserve(name, capacity << 20, 64, ODP_SHM_SW_ONLY);
+   if (shmem == ODP_SHM_INVALID) {
+   ODPH_DBG("shm reserve fail\n");
+   return NULL;
+   }
+   tbl = (odph_linear_table_imp *)odp_shm_addr(shmem);
+
+   /* clean this block of memory */
+   memset(tbl, 0, capacity << 20);
+
+   tbl->init_cap = capacity < 20;
+
+   strncpy(tbl->name, name, ODPH_TABLE_NAME_LEN);
+
+   /* for linear table, the key is just the index, without confict
+* so we just need to record the value content
+* there is a rwlock in the head of every node
+*/
+
+   tbl->value_size = value_size + sizeof(odp_rwlock_t);
+
+   node_num = tbl->init_cap / tbl->value_size;
+   tbl->node_sum = node_num;
+
+   tbl->value_array = (void *)((char *)tbl
+   + sizeof(odph_linear_table_imp));
+
+   /* initialize rwlock*/
+   for (idx = 0; idx < tbl->node_sum; idx++) {
+   odp_rwlock_t *lock = (odp_rwlock_t *)((char *)tbl->value_array
+   + idx * tbl->value_size);
+   odp_rwlock_init(lock);
+   }
+
+   tbl->magicword = ODPH_LINEAR_TABLE_MAGIC_WORD;
+
+   return (odph_table_t)(tbl);
+}
+
+int odph_linear_table_destroy(odph_table_t table)
+{
+   int ret;
+   odph_linear_table_imp *linear_tbl = NULL;
+
+   if (table != NULL) {
+   linear_tbl = (odph_linear_table_imp *)table;
+
+   /* check magicword, make sure the memory is used by a table */
+   if (linear_tbl->magicword != ODPH_LINEAR_TABLE_MAGIC_WORD)
+   return ODPH_FAIL;
+
+   ret = odp_shm_free(odp_shm_lookup(linear_tbl->name));
+   if (ret != 0) {
+   ODPH_DBG("free fail\n");
+   return ret;
+   }
+
+   return ODPH_SUCCESS;
+   }
+   return ODPH_FAIL;
+}
+
+odph_table_t odph_linear_table_lookup(const char *name)
+{
+   int idx;
+   odph_linear_table_imp *tbl;
+
+   if (name == NULL || strlen(name) >= ODPH_TABLE_NAME_LEN)
+   return NULL;
+
+   tbl = (odph_linear_table_imp *)odp_shm_addr(odp_shm_lookup(name));
+
+   /* check magicword to make sure the memory block is used by a table */
+   if (tbl != NULL &&
+   tbl->magicword == ODPH_LINEAR_TABLE_MAGIC_WORD &&
+

Re: [lng-odp] [PATCHv4 2/5] helper: table: add impl of hashtable

2015-12-01 Thread Ivan Khoronzhuk


On 05.11.15 13:20, huanggaoyang wrote:

Signed-off-by: huanggaoyang 
---
  helper/hashtable.c  | 346 
  helper/odph_hashtable.h |  42 ++
  helper/odph_list_internal.h |  85 +++
  3 files changed, 473 insertions(+)
  create mode 100644 helper/hashtable.c
  create mode 100644 helper/odph_hashtable.h
  create mode 100644 helper/odph_list_internal.h

diff --git a/helper/hashtable.c b/helper/hashtable.c
new file mode 100644
index 000..0b29814
--- /dev/null
+++ b/helper/hashtable.c
@@ -0,0 +1,346 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:   BSD-3-Clause
+ */
+#include 
+#include 
+#include 
+
+#include "odph_hashtable.h"
+#include "odph_list_internal.h"
+#include "odph_debug.h"
+#include 
+
+#defineODPH_SUCCESS0
+#defineODPH_FAIL   -1
+
+/** @magic word, write to the first byte of the memory block
+ * to indicate this block is used by a hash table structure
+ */
+#defineODPH_HASH_TABLE_MAGIC_WORD  0xABABBABA
+
+/** @support 64k buckets. Bucket is a list that composed of
+ * elements with the same HASH-value but different keys
+ */
+#defineODPH_MAX_BUCKET_NUM 0x1
+
+/** @inner element structure of hash table
+ * To resolve the hash confict:
+ * we put the elements with different keys but a same HASH-value
+ * into a list
+ */
+typedef struct odph_hash_node {
+   /** list structure,for list opt */
+   odph_list_object list_node;
+   /** Flexible Array,memory will be alloced when table has been created
+* Its length is key_size + value_size,
+* suppose key_size = m; value_size = n;
+* its structure is like:
+* k_byte1 k_byte2...k_byten v_byte1...v_bytem
+*/
+   char content[0];
+} odph_hash_node;
+
+typedef struct {
+   uint32_t magicword; /**< for check */
+   uint32_t key_size; /**< input param when create,in Bytes */
+   uint32_t value_size; /**< input param when create,in Bytes */
+   uint32_t init_cap; /**< input param when create,in Bytes */
+   /** multi-process support,every list has one rw lock */
+   odp_rwlock_t *lock_pool;
+   /** table bucket pool,every hash value has one list head */
+   odph_list_head *list_head_pool;
+   /** number of the list head in list_head_pool */
+   uint32_t head_num;
+   /** table element pool */
+   odph_hash_node *hash_node_pool;
+   /** number of element in the hash_node_pool */
+   uint32_t hash_node_num;
+   char rsv[7]; /**< Reserved,for alignment */
+   char name[ODPH_TABLE_NAME_LEN]; /**< table name */
+} odph_hash_table_imp;
+
+odph_table_t odph_hash_table_create(const char *name, uint32_t capacity,
+   uint32_t key_size,
+   uint32_t value_size)
+{
+   int idx, i;
+   uint32_t node_num;
+   odph_hash_table_imp *tbl;
+   odp_shm_t shmem;
+   uint32_t node_mem;
+
+   if (strlen(name) >= ODPH_TABLE_NAME_LEN || capacity < 1 ||
+   capacity >= 0x1000 || key_size == 0 || value_size == 0) {
+   ODPH_DBG("create para input error!\n");
+   return NULL;
+   }
+   tbl = (odph_hash_table_imp *)odp_shm_addr(odp_shm_lookup(name));
+   if (tbl != NULL) {
+   ODPH_DBG("name already exist\n");
+   return NULL;
+   }
+   shmem = odp_shm_reserve(name, capacity << 20, 64, ODP_SHM_SW_ONLY);
+   if (shmem == ODP_SHM_INVALID) {
+   ODPH_DBG("shm reserve fail\n");
+   return NULL;
+   }
+   tbl = (odph_hash_table_imp *)odp_shm_addr(shmem);
+
+   /* clean this block of memory */
+   memset(tbl, 0, capacity << 20);
+
+   tbl->init_cap = capacity << 20;
+   strncpy(tbl->name, name, ODPH_TABLE_NAME_LEN);
+   tbl->key_size = key_size;
+   tbl->value_size = value_size;
+
+   /* header of this mem block is the table control struct,
+* then the lock pool, then the list header pool
+* the last part is the element node pool
+*/
+
+   tbl->lock_pool = (odp_rwlock_t *)((char *)tbl
+   + sizeof(odph_hash_table_imp));
+   tbl->list_head_pool = (odph_list_head *)((char *)tbl->lock_pool
+   + ODPH_MAX_BUCKET_NUM * sizeof(odp_rwlock_t));
+
+   node_mem = tbl->init_cap - sizeof(odph_hash_table_imp)
+   - ODPH_MAX_BUCKET_NUM * sizeof(odph_list_head)
+   - ODPH_MAX_BUCKET_NUM * sizeof(odp_rwlock_t);
+
+   node_num = node_mem / (sizeof(odph_hash_node) + key_size + value_size);
+   tbl->hash_node_num = node_num;
+   tbl->hash_node_pool = (odph_hash_node *)((char *)tbl->list_head_pool
+   + ODPH_MAX_BUCKET_NUM * sizeof(odph_list_head));
+
+   /* init every list head and rw lock */
+   for (i = 0; i < ODPH_MAX_BUCKET_NUM; i++) {
+   ODPH_

Re: [lng-odp] [API-NEXT PATCH] api: init: allow implementation to use private ways for its own configuration

2015-12-01 Thread Zoltan Kiss



On 01/12/15 08:38, Savolainen, Petri (Nokia - FI/Espoo) wrote:


// Fill defaults (from config file)
// max_cpu = 64, max_mhz = 1000 (on this SoC)
plat_xyz_config_init_params(&plat_config);


Again, I strongly oppose this way. It doesn't make any sense. Any decent
applications should get the platform parameters through it's own config
from the user, and not try to hardcode these things.


How of those application parameters would need to be updated?
By the user, when configuring through the app's configuration interface. 
Not our concern how that happens.



Every time any of its target platforms change or add a parameter? Platforms may 
have many tuning parameters, which the application is *not interested* - 
default is fine, now and in the future.
Yes, e.g. DPDK has a lot of parameters, but it only mandates -n and -c 
(number of memory channels and cpu mask), and the latter is actually 
calculated by ODP-DPDK, so our apps need to specify -n only.




Now when application wants to change only one param trough plat_params, how it 
sets all other (100) parameters in the struct?


It really depends on platforms (that's why it's platform dependent), but 
struct is definitely not the best solution for that. Passing a string, 
or a linked list of struct, if you want something more elegant. That's 
really not our concern again, but generic application/API interfacing 
questions.
I think you're concerns are mostly rooted on the thought that 
platform_params should be a struct. It's not.




-Petri





plat_config.max_cpu = 32;
plat_config.max_mhz = 500; // 500MHz was max on the old SoC, could be

overridden with some plat specific way

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


Re: [lng-odp] [RFC] api: queue: remove ODP_QUEUE_TYPE_PKTIN

2015-12-01 Thread Savolainen, Petri (Nokia - FI/Espoo)
Otherwise reasonable change, but I was thinking to keep normal queue 
functionality with these queues, also when connected to packet input. So, I 
would not change function pointer on the fly, but mark the (default) packet 
input queue so that the dequeue operation calls pktio recv when the queue is 
empty.

Any source can enqueue into these (normal odp) queues. Empty queue goes to 
packet input for more packets. Multi-queue API adds odp_pktin_queue_t which is 
direct HW (NIC) input queue and does not accept events. Normal odp queues (== 
application input queues) would always accept events.

-Petri



> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Nicolas Morey-Chaisemartin
> Sent: Tuesday, November 24, 2015 6:04 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [RFC] api: queue: remove ODP_QUEUE_TYPE_PKTIN
> 
> Type to use is now ODP_QUEUE_TYPE_POLL or ODP_QUEUE_TYPE_SCHED
>   depending on the pktio it will be associated to.
> These queues behave as normal queues until they are associated to a pktio
> using odp_pktio_inq_setdef and will behave as standard queues after
> a call to odp_pktio_inq_remdef
> 
> Signed-off-by: Nicolas Morey-Chaisemartin 
> ---
> 
> Following the discussion in the call, this is a very quickly made patch
> that removes ODP_QUEUE_TYPE_PKTIN.
> Unless I am missing something, there are no deep issues with this change
> that prevent it from doing it now
> (apart from probable conflicts with TM and or multiple defq series)
> 
>  example/classifier/odp_classifier.c|  2 +-
>  example/generator/odp_generator.c  |  2 +-
>  example/ipsec/odp_ipsec.c  |  7 ++-
>  example/packet/odp_pktio.c |  4 +-
>  include/odp/api/queue.h|  5 ---
>  .../linux-generic/include/odp/plat/queue_types.h   |  3 +-
>  platform/linux-generic/odp_packet_io.c | 50
> +-
>  platform/linux-generic/odp_queue.c | 12 +-
>  test/performance/odp_l2fwd.c   |  5 ++-
>  test/performance/odp_pktio_perf.c  |  3 +-
>  .../classification/odp_classification_test_pmr.c   |  3 +-
>  .../classification/odp_classification_tests.c  |  2 +-
>  test/validation/pktio/pktio.c  |  3 +-
>  13 files changed, 63 insertions(+), 38 deletions(-)
> 
> diff --git a/example/classifier/odp_classifier.c
> b/example/classifier/odp_classifier.c
> index 365c748..a1681f4 100644
> --- a/example/classifier/odp_classifier.c
> +++ b/example/classifier/odp_classifier.c
> @@ -248,7 +248,7 @@ static odp_pktio_t create_pktio(const char *dev,
> odp_pool_t pool)
>odp_pktio_to_u64(pktio));
>   inq_name[ODP_QUEUE_NAME_LEN - 1] = '\0';
> 
> - inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
> + inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_SCHED, &qparam);
>   if (inq_def == ODP_QUEUE_INVALID) {
>   EXAMPLE_ERR("pktio inq create failed for %s\n", dev);
>   exit(EXIT_FAILURE);
> diff --git a/example/generator/odp_generator.c
> b/example/generator/odp_generator.c
> index 9d79f89..dcc3fc8 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -352,7 +352,7 @@ static odp_pktio_t create_pktio(const char *dev,
> odp_pool_t pool)
>odp_pktio_to_u64(pktio));
>   inq_name[ODP_QUEUE_NAME_LEN - 1] = '\0';
> 
> - inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
> + inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_SCHED, &qparam);
>   if (inq_def == ODP_QUEUE_INVALID)
>   EXAMPLE_ABORT("Error: pktio inq create failed for %s\n", dev);
> 
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index d784c31..960ad1d 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -249,7 +249,7 @@ odp_queue_t polled_odp_queue_create(const char *name,
> 
>   my_queue = odp_queue_create(name, my_type, NULL);
> 
> - if ((ODP_QUEUE_TYPE_SCHED == type) || (ODP_QUEUE_TYPE_PKTIN ==
> type)) {
> + if (ODP_QUEUE_TYPE_SCHED == type) {
>   poll_queues[num_polled_queues++] = my_queue;
>   printf("%s: adding %"PRIu64"\n", __func__,
>  odp_queue_to_u64(my_queue));
> @@ -525,7 +525,10 @@ void initialize_intf(char *intf)
>odp_pktio_to_u64(pktio));
>   inq_name[ODP_QUEUE_NAME_LEN - 1] = '\0';
> 
> - inq_def = queue_create(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
> + inq_def = queue_create(inq_name,
> +pktio_param.in_mode == ODP_PKTIN_MODE_POLL ?
> +ODP_QUEUE_TYPE_POLL : ODP_QUEUE_TYPE_SCHED,
> +&qparam);
>   if (ODP_QUEUE_INVALID == inq_def) {
>   EXAMPLE_ERR("Error: pktio queue creation failed for %s\n",
>

Re: [lng-odp] [API-NEXT PATCH] api: init: allow implementation to use private ways for its own configuration

2015-12-01 Thread Savolainen, Petri (Nokia - FI/Espoo)
> >
> > // Fill defaults (from config file)
> > // max_cpu = 64, max_mhz = 1000 (on this SoC)
> > plat_xyz_config_init_params(&plat_config);
> 
> Again, I strongly oppose this way. It doesn't make any sense. Any decent
> applications should get the platform parameters through it's own config
> from the user, and not try to hardcode these things.

How of those application parameters would need to be updated? Every time any of 
its target platforms change or add a parameter? Platforms may have many tuning 
parameters, which the application is *not interested* - default is fine, now 
and in the future.

Now when application wants to change only one param trough plat_params, how it 
sets all other (100) parameters in the struct?

-Petri


> 
> > plat_config.max_cpu = 32;
> > plat_config.max_mhz = 500; // 500MHz was max on the old SoC, could be
> overridden with some plat specific way
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] api: pool: redefine packet user area init

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


> -Original Message-
> From: EXT Zoltan Kiss [mailto:zoltan.k...@linaro.org]
> Sent: Monday, November 30, 2015 8:13 PM
> To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [API-NEXT PATCH] api: pool: redefine packet user
> area init
> 
> 
> 
> On 30/11/15 13:31, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >
> >>> diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
> >>> index 01f770f..7b258c3 100644
> >>> --- a/include/odp/api/pool.h
> >>> +++ b/include/odp/api/pool.h
> >>> @@ -42,21 +42,25 @@ extern "C" {
> >>>#define ODP_POOL_NAME_LEN  32
> >>>
> >>>/**
> >>> - * Packet user area initializer callback function for pools.
> >>> + * Packet user area initialize callback function
> >>> *
> >>> - * @param pkt   Handle of the packet
> >>> - * @param uarea_init_argOpaque pointer defined in
> >> odp_pool_param_t
> >>> + * Packet pool uses this callback function to initialize user area in
> >> each
> >>> + * packet. The function is called once (per packet) in pool creation
> >> phase for
> >>> + * both persistent (user_area.persistent is set) and non-persistent
> >> user areas.
> >>> + * Additionally, it is called to re-initialize non-persistent user
> >> area, when
> >>> + * ODP has overwritten the area content.
> >>> *
> >>> - * @note If the application specifies this pointer, it expects that
> >> every buffer
> >>> - * is initialized exactly once with it when the underlying memory is
> >> allocated.
> >>> - * It is not called from odp_packet_alloc(), unless the platform
> >> chooses to
> >>> - * allocate the memory at that point. Applications can only assume
> that
> >> this
> >>> - * callback is called once before the packet is first used. Any
> >> subsequent
> >>> - * change to the user area might be preserved after odp_packet_free()
> >> is called,
> >>> - * so applications should take care of (re)initialization if they
> >> change data
> >>> - * preset by this function.
> >>> + * @param pool   Packet pool handle
> >>> + * @param init_arg   User defined 'user_area.init_arg' pointer in
> >>> + *   odp_pool_param_t
> >>> + * @param user_area  Pointer to packet user area to initialize
> >>> + * @param size   User area size in bytes
> >>> + * @param pkt_index  Index of the packet. The range is from 0 to
> number
> >> of
> >>> + *   packet in the pool (packet pool param 'num')
> minus
> >> one.
> >>
> >> Why would an application need this? It's not visible to the app. Also,
> >
> > It's helpful for e.g. allocating per packet context memory at this
> point. This is just unique, opaque index from 0 to num - 1.
> >
> > my_packet_ctx_t my_packet_ctx[MAX_PACKETS];
> >
> > user_area_init(odp_pool_t pool, void *init_arg, void *user_area,
> uint32_t size, uint32_t pkt_index) {
> >
> > my_packet_user_area = user_area;
> > my_packet_user_area->pkt_ctx = &my_packet_ctx[pkt_index];
> >
> > }
> 
> And why couldn't you use the packet handle for that? This just seems to
> me an another unique id for the packet.
> This example seems to me like using the user area to store a pointer for
> an application allocated piece of memory related for that particular
> buffer. That would be a duplication of the functionality of
> odp_packet_user_ptr()

Handle is not an index. From user point of view, it's a random number.

We could add index as metadata if needed.

User pointer is not (currently) specified to be persistent (implementation can 
overwrite that).



> 
> >
> >
> >> ODP-DPDK for example allocates some extra number of rte_mbuf's because
> >> the per-thread caching can sit on packets, which in extreme cases makes
> >> impossible to allocate 'num' packets. See this for details:
> >>
> >> https://git.linaro.org/lng/odp-
> >> dpdk.git/commitdiff/e1ac6c797539a62ee6b93554a1f0a7f5ba433a36
> >>
> >> So, what would be pkt_index for these extra buffers? (NB. 'num' is only
> >> the number we MUST provide, nothing says we can't have more than that)
> >
> >
> > 'num' is: "The number of packets that the pool must provide that are
> packet length 'len' bytes or smaller" and "The number of packets may be
> less than 'num' when packets are larger than 'len'"
> >
> > So, it's actually the maximum number of packets that can be allocated
> from the pool.
> 
> There could be less than 'num' packets if packets are bigger, yes, but
> the description doesn't restrict us that we can't have more.
> If you get the bill in the restaurant, you "must provide" that amount of
> money, but nothing prevents you to pay more.

The number == not less, not more. We can refine the wording, but that's the 
intention: no more, no less.


> 
> > Any per thread caching causes variation to actual number in-flight, but
> any time there should not be more than 'num' packets.
> 
> If you have a per-thread object cache for packets (sounds sensible to
> avoid locking during allocation), after a short time you'll have an
> arbitra

Re: [lng-odp] [API-NEXT PATCH v3 7/7] validation: time: align tests with current time API

2015-12-01 Thread Ivan Khoronzhuk



On 01.12.15 09:56, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Monday, November 30, 2015 4:47 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [API-NEXT PATCH v3 7/7] validation: time: align
tests with current time API



On 30.11.15 16:17, Savolainen, Petri (Nokia - FI/Espoo) wrote:




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

EXT

Ivan Khoronzhuk
Sent: Monday, November 23, 2015 11:21 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [API-NEXT PATCH v3 7/7] validation: time: align

tests

with current time API

Add test for odp_time_sum, odp_time_cmp, odp_time_to_u64 APIs.
Sophisticate a little tests for odp_time_diff, odp_time_local_from_ns,
odp_time_local_to_ns APIs. Check time on monotony.

Signed-off-by: Ivan Khoronzhuk 
---
   test/validation/time/time.c | 224
+++-
   test/validation/time/time.h |   7 +-
   2 files changed, 207 insertions(+), 24 deletions(-)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index 3d05a6f..8f5dfe6 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -11,13 +11,114 @@
   #define TOLERANCE 1
   #define BUSY_LOOP_CNT 100

+/* check that related conversions come back to the same value */
+void time_test_odp_conversion(void)
+{
+   uint64_t ns1, ns2;
+   odp_time_t time;
+   uint64_t upper_limit, lower_limit;
+
+   ns1 = 100;
+   time = odp_time_local_from_ns(ns1);
+
+   ns2 = odp_time_to_ns(time);
+
+   /* need to check within arithmetic tolerance that the same
+* value in ns is returned after conversions */
+   upper_limit = ns1 + TOLERANCE;
+   lower_limit = ns1 - TOLERANCE;
+   CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
+
+   ns1 = 60 * 11 * ODP_TIME_SEC_IN_NS;
+   time = odp_time_local_from_ns(ns1);
+
+   ns2 = odp_time_to_ns(time);
+
+   /* need to check within arithmetic tolerance that the same
+* value in ns is returned after conversions */
+   upper_limit = ns1 + TOLERANCE;
+   lower_limit = ns1 - TOLERANCE;
+   CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
+}
+
+void time_test_monotony(void)
+{
+   volatile int count = 0;
+   odp_time_t t1, t2, t3;
+   uint64_t ns1, ns2, ns3;
+
+   t1 = odp_time_local();
+
+   while (count < BUSY_LOOP_CNT) {
+   count++;
+   };
+
+   t2 = odp_time_local();
+
+   while (count < BUSY_LOOP_CNT * 5) {
+   count++;
+   };
+
+   t3 = odp_time_local();



These loops are short in execution time. So, the test will very likely

to pass also when local time would wrap e.g. every 4 sec.
I can increase BUSY_LOOP_CNT, replace 100 number that is based on some
freq like 3GHz and minimum resolution.
The resolution API I'm going to add after this series is applied, so for
now lets suppose that this is 10ms.

then BYSY_LOOP_CNT for testing minimum time is = 0.01 * 3GHz = 3000.
For some boards it can take in 3 times longer.




At least one test should run at least e.g. 4sec to verify wrap around.

I don't suppose here that 32-bit counter is used for time API, so check is
redundancy. But,
for long time intervals I've used conversion functions, it's checked in
time_test_conversion test.
It's done in order to not increase time for validating time API.
If you OK to increase validation test for time API at least on 5sec I have
no objection.

Currently ODP doesn't have correct way to read frequency for all arches.
So lets count 4seconds based on some freq = 3GHz, then iteration_num =
4sec * 3000 = 12 000 000 000.
It's bigger than 4seconds as iteration takes more than one simple cycle.
Then:
BUSY_LOOP_CNT = 1000, and test for time more that 4 sec => BUSY_LOOP_CNT =
1000 * 12.

But pay attention, that it can take more than 4sec * 3 * 2cycles = 24
seconds on boards with 3 time less frequency.
So test can be longer on half of minute!.



You don't need to busy loop >4sec on every step. It's enough that the entire time API 
validation test duration is >4sec, which is reasonable when we are testing time 
accuracy. Even a duration of >1sec would be good to test, since all those 
timespec.sec + timespec.nsec calculations may have bugs that are visible only when .sec 
is incremented.

-Petri


Ok. It be 30 000 000 minimum and 12 000 000 000 for 4+ sec.






I propose to leave test as is here, and hope that time_test_odp_conversion
caught issues.
What do you say?



-Petri



--
Regards,
Ivan Khoronzhuk


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


Re: [lng-odp] [API-NEXT PATCH v3 6/7] api: time: make odp_local_time to be monotonic wall time

2015-12-01 Thread Ivan Khoronzhuk



On 01.12.15 09:38, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Why not just have one patch for API ...

include/odp/api/time.h|  3 +-


... and move everything else in another patch(es). The old implementation and 
usage of the API is still functionally correct after API change. It may not be 
optimal (does not exploit the knowledge that local time cannot wrap), but it's 
functionally correct. Or do you expect that CLOCK_MONOTONIC_RAW wraps?


-Petri

Ok.





-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Monday, November 30, 2015 4:19 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [API-NEXT PATCH v3 6/7] api: time: make
odp_local_time to be monotonic wall time



On 30.11.15 16:07, Savolainen, Petri (Nokia - FI/Espoo) wrote:




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

EXT

Ivan Khoronzhuk
Sent: Monday, November 23, 2015 11:21 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [API-NEXT PATCH v3 6/7] api: time: make

odp_local_time

to be monotonic wall time

It's more convenient the local time to be a monotonic wall time.
That means time starts from 0 and not wraps. It allows to use local
time in similar manner as it's supposed to be used with global time
and the 64-bit timer is enough to guarantee it.

Signed-off-by: Ivan Khoronzhuk 






diff --git a/include/odp/api/time.h b/include/odp/api/time.h
index 50a0bf5..9865d81 100644
--- a/include/odp/api/time.h
+++ b/include/odp/api/time.h
@@ -45,7 +45,8 @@ extern "C" {
* Current local time
*
* Returns current local time stamp value. The local time source

provides

high
- * resolution time.
+ * resolution time, it is initialized to zero during ODP startup and

will

not
+ * wrap around in at least 10 years.
*
* @return Local time stamp.
*/



I think it's better to separate this the API spec into its own patch.

All other changes here may or may not depend on it, but those can follow
in the next patch. It's significant spec change and an implementer may
miss it now.

Ok. I will split it on linux-generic + api and examples/testes patches.
But I think this simplification is not very eficient as api change patch
will contain:
   include/odp/api/time.h|  3 +-
   platform/linux-generic/include/odp_internal.h |  2 +
   platform/linux-generic/odp_schedule.c |  9 ++--
   platform/linux-generic/odp_time.c | 61 +++--
--

and example/test patch:
   example/generator/odp_generator.c | 10 ++---
   test/performance/odp_pktio_perf.c | 26 ++--
   test/validation/pktio/pktio.c | 21 -



-Petri








--
Regards,
Ivan Khoronzhuk


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