Re: [lng-odp] [PATCHv2 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler
On 03/17/15 12:53, Ciprian Barbu wrote: ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be removed from the pri_queues of the linux-generic scheduler Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- v2: - removed #if 1 and trailing whitespaces platform/linux-generic/odp_schedule.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index dd65168..18513da 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -153,6 +153,28 @@ int odp_schedule_term_global(void) for (i = 0; i ODP_CONFIG_SCHED_PRIOS; i++) { for (j = 0; j QUEUES_PER_PRIO; j++) { + odp_queue_t pri_q = sched-pri_queue[i][j]; + + for (;;) { + odp_event_t ev = odp_queue_deq(pri_q); + odp_buffer_t desc_buf; + queue_desc_t *desc; + odp_queue_t queue; + + desc_buf = odp_buffer_from_event(ev); + if (desc_buf == ODP_BUFFER_INVALID) + break; It looks like we did not check return of odp_buffer_from_event() anywhere. But we check that event is not ODP_EVENT_INVALID. That is not performance critical function so I think it's ok to use odp_queue_deq(), not odp_queue_deq_multi(). + + desc = odp_buffer_addr(desc_buf); + queue = desc-queue; + /* Let deq_multi_destroy do the job */ + if (queue_is_destroyed(queue)) { + odp_queue_deq_multi(queue, + sched_local.ev, + MAX_DEQ); + } + } + if (odp_queue_destroy(sched-pri_queue[i][j])) { if you set above it to pri_q var, please use pri_q here also. Maxim. ODP_ERR(Sched term: Queue destroy fail.\n); rc = -1; ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv2 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler
On Wed, Mar 18, 2015 at 11:17 AM, Maxim Uvarov maxim.uva...@linaro.org wrote: On 03/17/15 12:53, Ciprian Barbu wrote: ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be removed from the pri_queues of the linux-generic scheduler Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- v2: - removed #if 1 and trailing whitespaces platform/linux-generic/odp_schedule.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index dd65168..18513da 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -153,6 +153,28 @@ int odp_schedule_term_global(void) for (i = 0; i ODP_CONFIG_SCHED_PRIOS; i++) { for (j = 0; j QUEUES_PER_PRIO; j++) { + odp_queue_t pri_q = sched-pri_queue[i][j]; + + for (;;) { + odp_event_t ev = odp_queue_deq(pri_q); + odp_buffer_t desc_buf; + queue_desc_t *desc; + odp_queue_t queue; + + desc_buf = odp_buffer_from_event(ev); + if (desc_buf == ODP_BUFFER_INVALID) + break; It looks like we did not check return of odp_buffer_from_event() anywhere. But we check that event is not ODP_EVENT_INVALID. That is not performance critical function so I think it's ok to use odp_queue_deq(), not odp_queue_deq_multi(). It's actually not. The problem here is that odp_queu_destroy does not actually destroy SCHED queues. For a queue to be destroyed it's status must be set to QUEUE_STATUS_FREE. For ODP_QUEUE_TYPE_SCHED queues, odp_queue_destroy sets the status to QUEUE_STATUS_DESTROYED, which is not enough for odp_queue_term_global to finish the job, the status must be QUEUE_STATUS_FREE. This sounds like crazy at first, but it is necessary so that the internal priority queues are drained, there are some desc_bufs for each scheduled queues, simply marking the scheduled queue as free is not enough, the desc_buf must be freed too. For that the scheduler code relies on schedule() to process the priority queues, and that code uses queue_deq_multi: https://git.linaro.org/lng/odp.git/blob/df9cacd8cd46629ae74173461f4af7187cfbb670:/platform/linux-generic/odp_schedule.c#l330 + + desc = odp_buffer_addr(desc_buf); + queue = desc-queue; + /* Let deq_multi_destroy do the job */ + if (queue_is_destroyed(queue)) { + odp_queue_deq_multi(queue, + sched_local.ev, + MAX_DEQ); + } + } + if (odp_queue_destroy(sched-pri_queue[i][j])) { if you set above it to pri_q var, please use pri_q here also. Ok, I didn't notice this. Maxim. ODP_ERR(Sched term: Queue destroy fail.\n); rc = -1; ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 1/3] validation: schedule: free queues and pool
With the implementation of termination APIs it is now necessarry to cleanup all allocated resources, queues and pool in this case. Fixes https://bugs.linaro.org/show_bug.cgi?id=1284 Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- test/validation/odp_schedule.c | 56 -- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index a9369c5..b86f997 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -624,7 +624,58 @@ static int schd_suite_init(void) return 0; } -struct CU_TestInfo test_odp_schedule[] = { +static int destroy_queue(const char *name) +{ + odp_queue_t q; + + q = odp_queue_lookup(name); + + if (q == ODP_QUEUE_INVALID) + return -1; + + return odp_queue_destroy(q); +} + +static int destroy_queues(void) +{ + int i, j, prios; + + prios = odp_schedule_num_prio(); + + for (i = 0; i prios; i++) { + for (j = 0; j QUEUES_PER_PRIO; j++) { + char name[32]; + + snprintf(name, sizeof(name), sched_%d_%d_n, i, j); + if (destroy_queue(name)) + return -1; + + snprintf(name, sizeof(name), sched_%d_%d_a, i, j); + if (destroy_queue(name)) + return -1; + + snprintf(name, sizeof(name), sched_%d_%d_o, i, j); + if (destroy_queue(name)) + return -1; + } + } + + return 0; +} + +static int schd_suite_term(void) +{ + odp_pool_t pool; + + destroy_queues(); + pool = odp_pool_lookup(MSG_POOL_NAME); + if (odp_pool_destroy(pool) != 0) + fprintf(stderr, error: failed to destroy pool\n); + + return 0; +} + +struct CU_TestInfo schd_tests[] = { {schedule_wait_time, test_schedule_wait_time}, {schedule_num_prio, test_schedule_num_prio}, {schedule_1q_1t_n,test_schedule_1q_1t_n}, @@ -658,6 +709,7 @@ struct CU_TestInfo test_odp_schedule[] = { }; CU_SuiteInfo odp_testsuites[] = { - {Scheduler, schd_suite_init, NULL, NULL, NULL, test_odp_schedule}, + {Scheduler, + schd_suite_init, schd_suite_term, NULL, NULL, schd_tests}, CU_SUITE_INFO_NULL, }; -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 0/3] Fixes for https://bugs.linaro.org/show_bug.cgi?id=1284
v3: - fixed some review comments from Maxim v2: - fixed patch 3 Like in the previous RFC, the first patch is the fix. The second and third patch represent a proposed fix for freeing the ODP_QUEUE_TYPE_SCHED queues that were not removed from the internal priority queues because the scheduler did not know they were empty. Ciprian Barbu (3): validation: schedule: free queues and pool linux-generic: queue: add queue_is_destroyed internal call linux-generic: schedule: make sure SCHED queues get freed by the scheduler .../linux-generic/include/odp_queue_internal.h | 9 platform/linux-generic/odp_schedule.c | 25 + test/validation/odp_schedule.c | 61 +- 3 files changed, 93 insertions(+), 2 deletions(-) -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler
ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be removed from the pri_queues of the linux-generic scheduler Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- v3: - check ev is valid - use already set pri_q like Maxim suggested v2: - removed #if 1 and trailing whitespaces platform/linux-generic/odp_schedule.c | 30 +- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index dd65168..ea60639 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -153,7 +153,35 @@ int odp_schedule_term_global(void) for (i = 0; i ODP_CONFIG_SCHED_PRIOS; i++) { for (j = 0; j QUEUES_PER_PRIO; j++) { - if (odp_queue_destroy(sched-pri_queue[i][j])) { + odp_queue_t pri_q = sched-pri_queue[i][j]; + + for (;;) { + odp_event_t ev = odp_queue_deq(pri_q); + odp_buffer_t desc_buf; + queue_desc_t *desc; + odp_queue_t queue; + + if (ev == ODP_EVENT_INVALID) + break; + + desc_buf = odp_buffer_from_event(ev); + if (desc_buf == ODP_BUFFER_INVALID) { + ODP_ERR(Sched term: Invalid event.\n); + rc = -1; + break; + } + + desc = odp_buffer_addr(desc_buf); + queue = desc-queue; + /* Let deq_multi_destroy do the job */ + if (queue_is_destroyed(queue)) { + odp_queue_deq_multi(queue, + sched_local.ev, + MAX_DEQ); + } + } + + if (odp_queue_destroy(pri_q)) { ODP_ERR(Sched term: Queue destroy fail.\n); rc = -1; } -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 2/3] linux-generic: queue: add queue_is_destroyed internal call
Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- platform/linux-generic/include/odp_queue_internal.h | 9 + 1 file changed, 9 insertions(+) diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 65aae14..9a0e94f 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -139,6 +139,15 @@ static inline int queue_is_sched(odp_queue_t handle) return ((queue-s.status == QUEUE_STATUS_SCHED) (queue-s.pktin != ODP_PKTIO_INVALID)); } + +static inline int queue_is_destroyed(odp_queue_t handle) +{ + queue_entry_t *queue; + + queue = queue_to_qentry(handle); + + return (queue-s.status == QUEUE_STATUS_DESTROYED); +} #ifdef __cplusplus } #endif -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv4 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler
ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be removed from the pri_queues of the linux-generic scheduler Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- v3: - check ev is valid - use already set pri_q like Maxim suggested v2: - removed #if 1 and trailing whitespaces platform/linux-generic/odp_schedule.c | 30 +- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index dd65168..ea60639 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -153,7 +153,35 @@ int odp_schedule_term_global(void) for (i = 0; i ODP_CONFIG_SCHED_PRIOS; i++) { for (j = 0; j QUEUES_PER_PRIO; j++) { - if (odp_queue_destroy(sched-pri_queue[i][j])) { + odp_queue_t pri_q = sched-pri_queue[i][j]; + + for (;;) { + odp_event_t ev = odp_queue_deq(pri_q); + odp_buffer_t desc_buf; + queue_desc_t *desc; + odp_queue_t queue; + + if (ev == ODP_EVENT_INVALID) + break; + + desc_buf = odp_buffer_from_event(ev); + if (desc_buf == ODP_BUFFER_INVALID) { + ODP_ERR(Sched term: Invalid event.\n); + rc = -1; + break; + } + + desc = odp_buffer_addr(desc_buf); + queue = desc-queue; + /* Let deq_multi_destroy do the job */ + if (queue_is_destroyed(queue)) { + odp_queue_deq_multi(queue, + sched_local.ev, + MAX_DEQ); + } + } + + if (odp_queue_destroy(pri_q)) { ODP_ERR(Sched term: Queue destroy fail.\n); rc = -1; } -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 0/3] Fixes for https://bugs.linaro.org/show_bug.cgi?id=1284
v4: - fixed coverity complaining about return codes v3: - fixed some review comments from Maxim v2: - fixed patch 3 Like in the previous RFC, the first patch is the fix. The second and third patch represent a proposed fix for freeing the ODP_QUEUE_TYPE_SCHED queues that were not removed from the internal priority queues because the scheduler did not know they were empty. Ciprian Barbu (3): validation: schedule: free queues and pool linux-generic: queue: add queue_is_destroyed internal call linux-generic: schedule: make sure SCHED queues get freed by the scheduler .../linux-generic/include/odp_queue_internal.h | 9 platform/linux-generic/odp_schedule.c | 25 + test/validation/odp_schedule.c | 61 +- 3 files changed, 93 insertions(+), 2 deletions(-) -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] performance: odp_atomic: move atomic test from api_test to performance
All the changes are only to enable the move to work, I am open suggestions, I will catch you on a HO and to gather your ideas On 17 March 2015 at 18:07, Bill Fischofer bill.fischo...@linaro.org wrote: These changes do not seem to be a simple move as logic is being changed. A better commit message needed to say what's really happening perhaps? On Tue, Mar 17, 2015 at 3:59 PM, Mike Holmes mike.hol...@linaro.org wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org --- test/api_test/.gitignore | 1 - test/api_test/Makefile.am | 6 +- test/api_test/odp_atomic_test.h| 51 test/api_test/odp_common.c | 2 +- test/performance/.gitignore| 1 + test/performance/Makefile.am | 6 +- .../odp_atomic_test.c = performance/odp_atomic.c} | 136 - 7 files changed, 139 insertions(+), 64 deletions(-) delete mode 100644 test/api_test/odp_atomic_test.h rename test/{api_test/odp_atomic_test.c = performance/odp_atomic.c} (63%) diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore index 84159e1..950f443 100644 --- a/test/api_test/.gitignore +++ b/test/api_test/.gitignore @@ -1,3 +1,2 @@ -odp_atomic odp_ring odp_shm diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am index 86e1bc2..f231fee 100644 --- a/test/api_test/Makefile.am +++ b/test/api_test/Makefile.am @@ -1,21 +1,17 @@ include $(top_srcdir)/test/Makefile.inc -bin_PROGRAMS = odp_atomic odp_shm odp_ring +bin_PROGRAMS = odp_shm odp_ring -odp_atomic_CFLAGS = $(AM_CFLAGS) odp_shm_CFLAGS = $(AM_CFLAGS) odp_ring_CFLAGS = $(AM_CFLAGS) -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static odp_shm_LDFLAGS = $(AM_LDFLAGS) -static odp_ring_LDFLAGS = $(AM_LDFLAGS) -static noinst_HEADERS = \ - $(top_srcdir)/test/api_test/odp_atomic_test.h \ $(top_srcdir)/test/api_test/odp_common.h \ $(top_srcdir)/test/api_test/odp_shm_test.h \ $(top_srcdir)/test/test_debug.h -dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h deleted file mode 100644 index 89e7748..000 --- a/test/api_test/odp_atomic_test.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_ATOMIC_TEST_H_ -#define ODP_ATOMIC_TEST_H_ - -#include odp.h -#include odp/helper/linux.h - -/** - * add_sub_cnt could be any valid value - * so to excercise explicit atomic_add/sub - * ops. For now using 5.. - */ -#define ADD_SUB_CNT5 - -#defineCNT 50 -#defineU32_INIT_VAL(1UL 10) -#defineU64_INIT_VAL(1ULL 33) - -typedef enum { - TEST_MIX = 1, /* Must be first test case num */ - TEST_INC_DEC_U32, - TEST_ADD_SUB_U32, - TEST_INC_DEC_64, - TEST_ADD_SUB_64, - TEST_MAX, -} odp_test_atomic_t; - - -void test_atomic_inc_dec_u32(void); -void test_atomic_add_sub_u32(void); -void test_atomic_inc_dec_64(void); -void test_atomic_add_sub_64(void); -void test_atomic_inc_u32(void); -void test_atomic_dec_u32(void); -void test_atomic_add_u32(void); -void test_atomic_sub_u32(void); -void test_atomic_inc_64(void); -void test_atomic_dec_64(void); -void test_atomic_add_64(void); -void test_atomic_sub_64(void); -void test_atomic_init(void); -void test_atomic_basic(void); -void test_atomic_store(void); -int test_atomic_validate(void); - -#endif /* ODP_ATOMIC_TEST_H_ */ diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 5158d87..18b365e 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -14,10 +14,10 @@ #include odp.h #include odp/helper/linux.h #include odp_common.h -#include odp_atomic_test.h #include odp_shm_test.h #include test_debug.h +#define MAX_WORKERS 32/** Max worker threads */ /* Globals */ static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /** worker threads table*/ diff --git a/test/performance/.gitignore b/test/performance/.gitignore index 9ccb102..1bdb90d 100644 --- a/test/performance/.gitignore +++ b/test/performance/.gitignore @@ -1,3 +1,4 @@ *.log *.trs odp_scheduling +odp_atomic diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am index 3be3721..63e4e23 100644 --- a/test/performance/Makefile.am +++ b/test/performance/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/test/Makefile.inc -EXECUTABLES = +EXECUTABLES = odp_atomic COMPILE_ONLY = odp_scheduling @@ -15,7 +15,11 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY) odp_scheduling_LDFLAGS =
[lng-odp] [PATCHv4 1/3] validation: schedule: free queues and pool
With the implementation of termination APIs it is now necessarry to cleanup all allocated resources, queues and pool in this case. Fixes https://bugs.linaro.org/show_bug.cgi?id=1284 Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- v4: - check return code of destroy_queues test/validation/odp_schedule.c | 58 -- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index a9369c5..a9b6283 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -624,7 +624,60 @@ static int schd_suite_init(void) return 0; } -struct CU_TestInfo test_odp_schedule[] = { +static int destroy_queue(const char *name) +{ + odp_queue_t q; + + q = odp_queue_lookup(name); + + if (q == ODP_QUEUE_INVALID) + return -1; + + return odp_queue_destroy(q); +} + +static int destroy_queues(void) +{ + int i, j, prios; + + prios = odp_schedule_num_prio(); + + for (i = 0; i prios; i++) { + for (j = 0; j QUEUES_PER_PRIO; j++) { + char name[32]; + + snprintf(name, sizeof(name), sched_%d_%d_n, i, j); + if (destroy_queue(name)) + return -1; + + snprintf(name, sizeof(name), sched_%d_%d_a, i, j); + if (destroy_queue(name)) + return -1; + + snprintf(name, sizeof(name), sched_%d_%d_o, i, j); + if (destroy_queue(name)) + return -1; + } + } + + return 0; +} + +static int schd_suite_term(void) +{ + odp_pool_t pool; + + if (destroy_queues() != 0) + fprintf(stderr, error: failed to destroy queues\n); + + pool = odp_pool_lookup(MSG_POOL_NAME); + if (odp_pool_destroy(pool) != 0) + fprintf(stderr, error: failed to destroy pool\n); + + return 0; +} + +struct CU_TestInfo schd_tests[] = { {schedule_wait_time, test_schedule_wait_time}, {schedule_num_prio, test_schedule_num_prio}, {schedule_1q_1t_n,test_schedule_1q_1t_n}, @@ -658,6 +711,7 @@ struct CU_TestInfo test_odp_schedule[] = { }; CU_SuiteInfo odp_testsuites[] = { - {Scheduler, schd_suite_init, NULL, NULL, NULL, test_odp_schedule}, + {Scheduler, + schd_suite_init, schd_suite_term, NULL, NULL, schd_tests}, CU_SUITE_INFO_NULL, }; -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv4 2/3] linux-generic: queue: add queue_is_destroyed internal call
Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- platform/linux-generic/include/odp_queue_internal.h | 9 + 1 file changed, 9 insertions(+) diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 65aae14..9a0e94f 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -139,6 +139,15 @@ static inline int queue_is_sched(odp_queue_t handle) return ((queue-s.status == QUEUE_STATUS_SCHED) (queue-s.pktin != ODP_PKTIO_INVALID)); } + +static inline int queue_is_destroyed(odp_queue_t handle) +{ + queue_entry_t *queue; + + queue = queue_to_qentry(handle); + + return (queue-s.status == QUEUE_STATUS_DESTROYED); +} #ifdef __cplusplus } #endif -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [Bug 1375] New: Packet IO tests pass ODP_PKTIO_INVALID to packet IO API
https://bugs.linaro.org/show_bug.cgi?id=1375 Bug ID: 1375 Summary: Packet IO tests pass ODP_PKTIO_INVALID to packet IO API Product: OpenDataPlane Version: unspecified Hardware: Other OS: Linux Status: UNCONFIRMED Severity: major Priority: --- Component: Validation Assignee: lng-odp@lists.linaro.org Reporter: taras.kondrat...@linaro.org Packet IO tests pass ODP_PKTIO_INVALID to packet IO API, but this triggers an undefined behavior. static void test_odp_pktio_outq(void) { odp_queue_t testq; testq = odp_pktio_outq_getdef(ODP_PKTIO_INVALID); CU_ASSERT(testq == ODP_QUEUE_INVALID); } static void test_odp_pktio_close(void) { int res; res = odp_pktio_close(ODP_PKTIO_INVALID); CU_ASSERT_EQUAL(res, -1); } -- You are receiving this mail because: You are the assignee for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [RFC v3 4/4] barrier: allow platform to override odp_barrier_t
Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com --- include/odp/api/barrier.h | 7 +--- platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/barrier.h | 1 + .../linux-generic/include/odp/plat/barrier_types.h | 47 ++ 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h index 35f0981..28310ba 100644 --- a/include/odp/api/barrier.h +++ b/include/odp/api/barrier.h @@ -18,20 +18,15 @@ extern C { #endif - /** @addtogroup odp_synchronizers * Synchronize threads. * @{ */ /** + * @typedef odp_barrier_t * ODP thread synchronization barrier */ -typedef struct odp_barrier_t { - uint32_t count; /** @private Thread count */ - odp_atomic_u32_t bar;/** @private Barrier counter */ -} odp_barrier_t; - /** * Initialize barrier with thread count. diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index cef7ecc..e5558ac 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -48,6 +48,7 @@ odpinclude_HEADERS = \ odpplatincludedir= $(includedir)/odp/plat odpplatinclude_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/odp/plat/atomic_types.h \ + $(top_srcdir)/platform/linux-generic/include/odp/plat/barrier_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/buffer_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/byteorder_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/classification_types.h \ diff --git a/platform/linux-generic/include/odp/barrier.h b/platform/linux-generic/include/odp/barrier.h index d63c219..7ea5a6b 100644 --- a/platform/linux-generic/include/odp/barrier.h +++ b/platform/linux-generic/include/odp/barrier.h @@ -19,6 +19,7 @@ extern C { #include odp/atomic.h #include odp/plat/shared_memory_types.h +#include odp/plat/barrier_types.h /** @ingroup odp_synchronizers * @{ diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h b/platform/linux-generic/include/odp/plat/barrier_types.h new file mode 100644 index 000..c8c978d --- /dev/null +++ b/platform/linux-generic/include/odp/plat/barrier_types.h @@ -0,0 +1,47 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP barrier + */ + +#ifndef ODP_BARRIER_TYPES_H_ +#define ODP_BARRIER_TYPES_H_ + +#ifdef __cplusplus +extern C { +#endif + +#include odp/std_types.h +#include odp/atomic.h + +/** + * @internal + * ODP thread synchronization barrier + */ +struct odp_barrier_s { + uint32_t count; /** Thread count */ + odp_atomic_u32_t bar;/** Barrier counter */ +}; + +/** @addtogroup odp_synchronizers + * @{ + */ + +typedef struct odp_barrier_s odp_barrier_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [RFC v3 1/4] spinlock: allow platform to override odp_spinlock_t
Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com --- include/odp/api/spinlock.h | 10 + platform/linux-generic/Makefile.am | 1 + .../include/odp/plat/spinlock_types.h | 46 ++ platform/linux-generic/include/odp/spinlock.h | 2 + 4 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h index 5cde123..9a5a929 100644 --- a/include/odp/api/spinlock.h +++ b/include/odp/api/spinlock.h @@ -18,21 +18,15 @@ extern C { #endif - -#include odp/std_types.h - /** @addtogroup odp_synchronizers * Operations on spin locks. * @{ */ /** - * ODP spinlock type + * @typedef odp_spinlock_t + * ODP spinlock */ -typedef struct odp_spinlock_t { - char lock; /** @private lock flag, should match odp_atomic_flag_t */ -} odp_spinlock_t; - /** * Initialize spin lock. diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 9aed113..9749df6 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -60,6 +60,7 @@ odpplatinclude_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/odp/plat/queue_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/schedule_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \ + $(top_srcdir)/platform/linux-generic/include/odp/plat/spinlock_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/strong_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/timer_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/version_types.h diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h b/platform/linux-generic/include/odp/plat/spinlock_types.h new file mode 100644 index 000..83d306b --- /dev/null +++ b/platform/linux-generic/include/odp/plat/spinlock_types.h @@ -0,0 +1,46 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP spinlock + */ + +#ifndef ODP_SPINLOCK_TYPES_H_ +#define ODP_SPINLOCK_TYPES_H_ + +#ifdef __cplusplus +extern C { +#endif + +#include odp/std_types.h + +/** + * @internal + * ODP spinlock + */ +struct odp_spinlock_s { + char lock; /** lock flag, should match odp_atomic_flag_t */ +}; + + +/** @addtogroup odp_synchronizers + * @{ + */ + +typedef struct odp_spinlock_s odp_spinlock_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/spinlock.h b/platform/linux-generic/include/odp/spinlock.h index e02df49..7dbb1c4 100644 --- a/platform/linux-generic/include/odp/spinlock.h +++ b/platform/linux-generic/include/odp/spinlock.h @@ -17,6 +17,8 @@ extern C { #endif +#include odp/plat/spinlock_types.h + /** @ingroup odp_synchronizers * @{ */ -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [RFC v3 3/4] ticketlock: allow platform to override odp_ticketlock_t
Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com --- include/odp/api/ticketlock.h | 12 +- platform/linux-generic/Makefile.am | 1 + .../include/odp/plat/ticketlock_types.h| 46 ++ platform/linux-generic/include/odp/ticketlock.h| 2 + 4 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h diff --git a/include/odp/api/ticketlock.h b/include/odp/api/ticketlock.h index e088e8b..e395ac4 100644 --- a/include/odp/api/ticketlock.h +++ b/include/odp/api/ticketlock.h @@ -18,10 +18,6 @@ extern C { #endif - -#include odp/std_types.h -#include odp/atomic.h - /** @addtogroup odp_synchronizers * Operations on ticket locks. * Acquiring a ticket lock happens in two phases. First the threads takes a @@ -32,13 +28,9 @@ extern C { */ /** - * ODP ticket lock + * @typedef odp_ticketlock_t + * ODP ticketlock */ -typedef struct odp_ticketlock_t { - odp_atomic_u32_t next_ticket; /** @private Next ticket */ - odp_atomic_u32_t cur_ticket; /** @private Current ticket */ -} odp_ticketlock_t; - /** * Initialize ticket lock. diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 200523c..cef7ecc 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -63,6 +63,7 @@ odpplatinclude_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/spinlock_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/strong_types.h \ + $(top_srcdir)/platform/linux-generic/include/odp/plat/ticketlock_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/timer_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/version_types.h diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h b/platform/linux-generic/include/odp/plat/ticketlock_types.h new file mode 100644 index 000..be93085 --- /dev/null +++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h @@ -0,0 +1,46 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP ticketlock + */ + +#ifndef ODP_TICKETLOCK_TYPES_H_ +#define ODP_TICKETLOCK_TYPES_H_ + +#ifdef __cplusplus +extern C { +#endif + +#include odp/atomic.h + +/** + * @internal + * ODP ticketlock + */ +struct odp_ticketlock_s { + odp_atomic_u32_t next_ticket; /** Next ticket */ + odp_atomic_u32_t cur_ticket; /** Current ticket */ +}; + +/** @addtogroup odp_synchronizers + * @{ + */ + +typedef struct odp_ticketlock_s odp_ticketlock_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/ticketlock.h b/platform/linux-generic/include/odp/ticketlock.h index fc7f438..658e27f 100644 --- a/platform/linux-generic/include/odp/ticketlock.h +++ b/platform/linux-generic/include/odp/ticketlock.h @@ -17,6 +17,8 @@ extern C { #endif +#include odp/plat/ticketlock_types.h + /** @ingroup odp_synchronizers * Operations on ticket locks. * @{ -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [RFC v3 0/4] Move the definition of odp syncronizers abstract types to platform
Move the definition of odp syncronizers abstract types to platform from public headerfile. This will allow the platform to define odp syncronizers abstract type. Useful when native SDK has definition of the odp syncronizers and ODP implementation decides to reuses them. v1..v2 Corrected the Doxygen documentation issues identified by Petri v2..v3 Fixed compilation issues in 'make distcheck' identified by Bill Jerin Jacob (4): spinlock: allow platform to override odp_spinlock_t rwlock: allow platform to override odp_rwlock_t ticketlock: allow platform to override odp_ticketlock_t barrier: allow platform to override odp_barrier_t include/odp/api/barrier.h | 7 +--- include/odp/api/rwlock.h | 11 + include/odp/api/spinlock.h | 10 + include/odp/api/ticketlock.h | 12 +- platform/linux-generic/Makefile.am | 4 ++ platform/linux-generic/include/odp/barrier.h | 1 + .../linux-generic/include/odp/plat/barrier_types.h | 47 + .../linux-generic/include/odp/plat/rwlock_types.h | 48 ++ .../include/odp/plat/spinlock_types.h | 46 + .../include/odp/plat/ticketlock_types.h| 46 + platform/linux-generic/include/odp/rwlock.h| 2 + platform/linux-generic/include/odp/spinlock.h | 2 + platform/linux-generic/include/odp/ticketlock.h| 2 + 13 files changed, 205 insertions(+), 33 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [RFC v3 2/4] rwlock: allow platform to override odp_rwlock_t
Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com --- include/odp/api/rwlock.h | 11 + platform/linux-generic/Makefile.am | 1 + .../linux-generic/include/odp/plat/rwlock_types.h | 48 ++ platform/linux-generic/include/odp/rwlock.h| 2 + 4 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h index 950b83a..d730a70 100644 --- a/include/odp/api/rwlock.h +++ b/include/odp/api/rwlock.h @@ -13,8 +13,6 @@ * ODP RW Locks */ -#include odp/atomic.h - #ifdef __cplusplus extern C { #endif @@ -29,14 +27,9 @@ extern C { */ /** - * The odp_rwlock_t type. + * @typedef odp_rwlock_t + * ODP rwlock */ -typedef struct { - odp_atomic_u32_t cnt; /** @private lock count - 0 lock not taken - -1 write lock taken - 0 read lock(s) taken */ -} odp_rwlock_t; /** diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 9749df6..200523c 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -58,6 +58,7 @@ odpplatinclude_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/odp/plat/packet_io_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/pool_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/queue_types.h \ + $(top_srcdir)/platform/linux-generic/include/odp/plat/rwlock_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/schedule_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/spinlock_types.h \ diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h b/platform/linux-generic/include/odp/plat/rwlock_types.h new file mode 100644 index 000..bd46e57 --- /dev/null +++ b/platform/linux-generic/include/odp/plat/rwlock_types.h @@ -0,0 +1,48 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP rwlock + */ + +#ifndef ODP_RWLOCK_TYPES_H_ +#define ODP_RWLOCK_TYPES_H_ + +#ifdef __cplusplus +extern C { +#endif + +#include odp/atomic.h + +/** + * @internal + * ODP rwlock + */ +struct odp_rwlock_s { + odp_atomic_u32_t cnt; /** lock count + 0 lock not taken + -1 write lock taken + 0 read lock(s) taken */ +}; + +/** @addtogroup odp_synchronizers + * @{ + */ + +typedef struct odp_rwlock_s odp_rwlock_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/rwlock.h b/platform/linux-generic/include/odp/rwlock.h index 06320f6..ca88ff7 100644 --- a/platform/linux-generic/include/odp/rwlock.h +++ b/platform/linux-generic/include/odp/rwlock.h @@ -17,6 +17,8 @@ extern C { #endif +#include odp/plat/rwlock_types.h + /** @ingroup odp_synchronizers * @{ */ -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [RFC v3 0/4] Move the definition of odp syncronizers abstract types to platform
This version looks good. For this series: Reviewed-and-tested-by: Bill Fischofer bill.fischo...@linaro.org On Wed, Mar 18, 2015 at 9:11 AM, Jerin Jacob jerin.ja...@caviumnetworks.com wrote: Move the definition of odp syncronizers abstract types to platform from public headerfile. This will allow the platform to define odp syncronizers abstract type. Useful when native SDK has definition of the odp syncronizers and ODP implementation decides to reuses them. v1..v2 Corrected the Doxygen documentation issues identified by Petri v2..v3 Fixed compilation issues in 'make distcheck' identified by Bill Jerin Jacob (4): spinlock: allow platform to override odp_spinlock_t rwlock: allow platform to override odp_rwlock_t ticketlock: allow platform to override odp_ticketlock_t barrier: allow platform to override odp_barrier_t include/odp/api/barrier.h | 7 +--- include/odp/api/rwlock.h | 11 + include/odp/api/spinlock.h | 10 + include/odp/api/ticketlock.h | 12 +- platform/linux-generic/Makefile.am | 4 ++ platform/linux-generic/include/odp/barrier.h | 1 + .../linux-generic/include/odp/plat/barrier_types.h | 47 + .../linux-generic/include/odp/plat/rwlock_types.h | 48 ++ .../include/odp/plat/spinlock_types.h | 46 + .../include/odp/plat/ticketlock_types.h| 46 + platform/linux-generic/include/odp/rwlock.h| 2 + platform/linux-generic/include/odp/spinlock.h | 2 + platform/linux-generic/include/odp/ticketlock.h| 2 + 13 files changed, 205 insertions(+), 33 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 2/2] validation: crypto: combine sync and async tests
Sync and Async crypto tests are almost identical and have a lot duplicated code. Move unique configuration into testsuite's init function and reuse Async test code for both Sync and Async. Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org --- test/validation/Makefile.am| 3 +- ...ypto_test_async_inp.c = odp_crypto_test_inp.c} | 49 +++- ...ypto_test_async_inp.h = odp_crypto_test_inp.h} | 8 +- test/validation/crypto/odp_crypto_test_sync_inp.c | 271 - test/validation/crypto/odp_crypto_test_sync_inp.h | 17 -- test/validation/odp_crypto.c | 9 +- 6 files changed, 50 insertions(+), 307 deletions(-) rename test/validation/crypto/{odp_crypto_test_async_inp.c = odp_crypto_test_inp.c} (90%) rename test/validation/crypto/{odp_crypto_test_async_inp.h = odp_crypto_test_inp.h} (62%) delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.c delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.h diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0833181..9862c6b 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -42,8 +42,7 @@ dist_odp_classification_SOURCES = classification/odp_classification_tests.c \ classification/odp_classification_basic.c \ odp_classification.c $(ODP_CU_COMMON) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto -dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ - crypto/odp_crypto_test_sync_inp.c \ +dist_odp_crypto_SOURCES = crypto/odp_crypto_test_inp.c \ odp_crypto.c $(ODP_CU_COMMON) dist_odp_init_SOURCES = odp_init.c dist_odp_init_abort_SOURCES = odp_init_abort.c diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c b/test/validation/crypto/odp_crypto_test_inp.c similarity index 90% rename from test/validation/crypto/odp_crypto_test_async_inp.c rename to test/validation/crypto/odp_crypto_test_inp.c index 527e98a..5f688d6 100644 --- a/test/validation/crypto/odp_crypto_test_async_inp.c +++ b/test/validation/crypto/odp_crypto_test_inp.c @@ -6,8 +6,16 @@ #include odp.h #include CUnit/Basic.h -#include CUnit/TestDB.h #include test_vectors.h +#include odp_crypto_test_inp.h + +struct suite_context_s { + enum odp_crypto_op_mode pref_mode; + odp_pool_t pool; + odp_queue_t queue; +}; + +static struct suite_context_s suite_context; /* Basic algorithm run function for async inplace mode. * Creates a session from input parameters and runs one operation @@ -38,21 +46,16 @@ static void alg_test(enum odp_crypto_op op, odp_crypto_compl_t compl_event; odp_crypto_op_result_t result; - odp_queue_t compl_queue = odp_queue_lookup(crypto-out); - CU_ASSERT(compl_queue != ODP_QUEUE_INVALID); - odp_pool_t pool = odp_pool_lookup(packet_pool); - CU_ASSERT(pool != ODP_POOL_INVALID); - /* Create a crypto session */ odp_crypto_session_params_t ses_params; memset(ses_params, 0, sizeof(ses_params)); ses_params.op = op; ses_params.auth_cipher_text = false; - ses_params.pref_mode = ODP_CRYPTO_ASYNC; + ses_params.pref_mode = suite_context.pref_mode; ses_params.cipher_alg = cipher_alg; ses_params.auth_alg = auth_alg; - ses_params.compl_queue = compl_queue; - ses_params.output_pool = pool; + ses_params.compl_queue = suite_context.queue; + ses_params.output_pool = suite_context.pool; ses_params.cipher_key = cipher_key; ses_params.iv = ses_iv; ses_params.auth_key = auth_key; @@ -64,7 +67,7 @@ static void alg_test(enum odp_crypto_op op, odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID)); /* Prepare input data */ - odp_packet_t pkt = odp_packet_alloc(pool, input_vec_len); + odp_packet_t pkt = odp_packet_alloc(suite_context.pool, input_vec_len); CU_ASSERT(pkt != ODP_PACKET_INVALID); uint8_t *data_addr = odp_packet_data(pkt); memcpy(data_addr, input_vec, input_vec_len); @@ -295,7 +298,31 @@ static void alg_hmac_md5(void) } } -CU_TestInfo test_array_async[] = { +int suite_sync_inp_init(void) +{ + suite_context.pool = odp_pool_lookup(packet_pool); + if (suite_context.pool == ODP_POOL_INVALID) + return -1; + + suite_context.queue = ODP_QUEUE_INVALID; + suite_context.pref_mode = ODP_CRYPTO_SYNC; + return 0; +} + +int suite_async_inp_init(void) +{ + suite_context.pool = odp_pool_lookup(packet_pool); + if (suite_context.pool == ODP_POOL_INVALID) + return -1; + suite_context.queue = odp_queue_lookup(crypto-out); + if (suite_context.queue == ODP_QUEUE_INVALID) + return -1; + + suite_context.pref_mode = ODP_CRYPTO_ASYNC; + return 0; +} + +CU_TestInfo test_array_inp[]
[lng-odp] [PATCH 0/2] validation: crypto: remove code duplication
Current crypto tests have a few issues: - Asynchronous tests assume that operation is always executed asynchronously, but specification does not demand it. So tests have to handle synchronous operations as well. - If the first issue is solved, then Sync test is a subset of Async - they can be merged. The same approach should allow to easily add tests for 'out of place' operations. Taras Kondratiuk (2): validation: crypto: handle synchronous operations in async test validation: crypto: combine sync and async tests test/validation/Makefile.am| 3 +- ...ypto_test_async_inp.c = odp_crypto_test_inp.c} | 74 -- ...ypto_test_async_inp.h = odp_crypto_test_inp.h} | 8 +- test/validation/crypto/odp_crypto_test_sync_inp.c | 271 - test/validation/crypto/odp_crypto_test_sync_inp.h | 17 -- test/validation/odp_crypto.c | 9 +- 6 files changed, 63 insertions(+), 319 deletions(-) rename test/validation/crypto/{odp_crypto_test_async_inp.c = odp_crypto_test_inp.c} (85%) rename test/validation/crypto/{odp_crypto_test_async_inp.h = odp_crypto_test_inp.h} (62%) delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.c delete mode 100644 test/validation/crypto/odp_crypto_test_sync_inp.h -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 1/2] validation: crypto: handle synchronous operations in async test
Current API can't force crypto operation to be strictly sync or async. Hence test should handle synchronous operation even if 'pref_mode' is set to ODP_CRYPTO_ASYNC. Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org --- test/validation/crypto/odp_crypto_test_async_inp.c | 27 +++--- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c b/test/validation/crypto/odp_crypto_test_async_inp.c index feefd49..527e98a 100644 --- a/test/validation/crypto/odp_crypto_test_async_inp.c +++ b/test/validation/crypto/odp_crypto_test_async_inp.c @@ -92,23 +92,24 @@ static void alg_test(enum odp_crypto_op op, CU_FAIL(%s : not implemented for combined alg mode\n); } - rc = odp_crypto_operation(op_params, posted, NULL); + rc = odp_crypto_operation(op_params, posted, result); if (rc 0) { CU_FAIL(Failed odp_crypto_operation()); goto cleanup; } - CU_ASSERT(posted); - - /* Poll completion queue for results */ - do { - event = odp_queue_deq(compl_queue); - } while (event == ODP_EVENT_INVALID); - - compl_event = odp_crypto_compl_from_event(event); - CU_ASSERT(odp_crypto_compl_to_u64(compl_event) == - odp_crypto_compl_to_u64(odp_crypto_compl_from_event(event))); - odp_crypto_compl_result(compl_event, result); - odp_crypto_compl_free(compl_event); + + if (posted) { + /* Poll completion queue for results */ + do { + event = odp_queue_deq(suite_context.queue); + } while (event == ODP_EVENT_INVALID); + + compl_event = odp_crypto_compl_from_event(event); + CU_ASSERT(odp_crypto_compl_to_u64(compl_event) == + odp_crypto_compl_to_u64(odp_crypto_compl_from_event(event))); + odp_crypto_compl_result(compl_event, result); + odp_crypto_compl_free(compl_event); + } CU_ASSERT(result.ok); CU_ASSERT(result.pkt == pkt); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv3 2/3] linux-generic: queue: add queue_is_destroyed internal call
On 18 March 2015 at 11:16, Ciprian Barbu ciprian.ba...@linaro.org wrote: Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- platform/linux-generic/include/odp_queue_internal.h | 9 + 1 file changed, 9 insertions(+) diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 65aae14..9a0e94f 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -139,6 +139,15 @@ static inline int queue_is_sched(odp_queue_t handle) return ((queue-s.status == QUEUE_STATUS_SCHED) (queue-s.pktin != ODP_PKTIO_INVALID)); } + +static inline int queue_is_destroyed(odp_queue_t handle) +{ + queue_entry_t *queue; + + queue = queue_to_qentry(handle); What is returned if handle does not specify any current or prior existing queue? Null? + + return (queue-s.status == QUEUE_STATUS_DESTROYED); Potential null pointer dereference? Possibly this code is OK due to the internal implementation and behavior of queues in linux-generic. But just looking at this patch in isolation it seems questionable. +} #ifdef __cplusplus } #endif -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv3] example: l2fwd print packets per second
On Tue, Mar 17, 2015 at 5:24 PM, Maxim Uvarov maxim.uva...@linaro.org wrote: Current print in l2fwd is not useful with slow links and also it's hard to say how fast does it work. Print pps and packets drops. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- v3: alloc memory for counter in worker threads to avoid cache misses. This patch is independent of 'make check' script. Sending it separately now. example/l2fwd/odp_l2fwd.c | 111 +- 1 file changed, 81 insertions(+), 30 deletions(-) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index d062a72..f533088 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -65,6 +65,14 @@ /** Get rid of path in filename - only for unix-type paths using '/' */ #define NO_PATH(file_name) (strrchr((file_name), '/') ? \ strrchr((file_name), '/') + 1 : (file_name)) + + +/* speed and stats */ +typedef struct { + uint64_t packets; + uint64_t drops; +} stats_t; Why not embed this structure in thr_args? + /** * Parsed command line application arguments */ @@ -73,13 +81,18 @@ typedef struct { int if_count; /** Number of interfaces to be used */ char **if_names;/** Array of pointers to interface names */ int mode; /** Packet IO mode */ + int time; /** Time in seconds to run. */ + int accuracy; /** Number of seconds to get and print statistics */ } appl_args_t; +static int exit_threads; + /** * Thread specific arguments */ typedef struct { int src_idx;/** Source interface identifier */ + stats_t **stats;/** Per thread packet stats */ } thread_args_t; /** @@ -115,24 +128,24 @@ static void *pktio_queue_thread(void *arg) odp_queue_t outq_def; odp_packet_t pkt; odp_event_t ev; - unsigned long pkt_cnt = 0; - unsigned long err_cnt = 0; + thread_args_t *thr_args = arg; - (void)arg; + stats_t *stats = calloc(1, sizeof(stats_t)); + *thr_args-stats = stats; thr = odp_thread_id(); printf([%02i] QUEUE mode\n, thr); /* Loop packets */ - for (;;) { + while (!exit_threads) { /* Use schedule to get buf from any input queue */ ev = odp_schedule(NULL, ODP_SCHED_WAIT); pkt = odp_packet_from_event(ev); /* Drop packets with errors */ if (odp_unlikely(drop_err_pkts(pkt, 1) == 0)) { - EXAMPLE_ERR(Drop frame - err_cnt:%lu\n, ++err_cnt); + stats-drops += 1; continue; } @@ -141,14 +154,10 @@ static void *pktio_queue_thread(void *arg) /* Enqueue the packet for output */ odp_queue_enq(outq_def, ev); - /* Print packet counts every once in a while */ - if (odp_unlikely(pkt_cnt++ % 10 == 0)) { - printf( [%02i] pkt_cnt:%lu\n, thr, pkt_cnt); - fflush(NULL); - } + stats-packets += 1; } -/* unreachable */ + free(stats); return NULL; } @@ -186,15 +195,15 @@ static void *pktio_ifburst_thread(void *arg) thread_args_t *thr_args; int pkts, pkts_ok; odp_packet_t pkt_tbl[MAX_PKT_BURST]; - unsigned long pkt_cnt = 0; - unsigned long err_cnt = 0; - unsigned long tmp = 0; int src_idx, dst_idx; odp_pktio_t pktio_src, pktio_dst; thr = odp_thread_id(); thr_args = arg; + stats_t *stats = calloc(1, sizeof(stats_t)); + *thr_args-stats = stats; + src_idx = thr_args-src_idx; dst_idx = (src_idx % 2 == 0) ? src_idx+1 : src_idx-1; pktio_src = gbl_args-pktios[src_idx]; @@ -208,7 +217,7 @@ static void *pktio_ifburst_thread(void *arg) odp_pktio_to_u64(pktio_src), odp_pktio_to_u64(pktio_dst)); /* Loop packets */ - for (;;) { + while (!exit_threads) { pkts = odp_pktio_recv(pktio_src, pkt_tbl, MAX_PKT_BURST); if (pkts = 0) continue; @@ -218,26 +227,16 @@ static void *pktio_ifburst_thread(void *arg) if (pkts_ok 0) odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok); - if (odp_unlikely(pkts_ok != pkts)) { - err_cnt += pkts-pkts_ok; - EXAMPLE_ERR(Dropped frames:%u - err_cnt:%lu\n, - pkts-pkts_ok, err_cnt); - } + if (odp_unlikely(pkts_ok != pkts)) + stats-drops += pkts - pkts_ok; if (pkts_ok == 0) continue; -
Re: [lng-odp] [PATCH] performance: odp_atomic: move atomic test from api_test to performance
I will send V2 On 18 March 2015 at 07:48, Mike Holmes mike.hol...@linaro.org wrote: All the changes are only to enable the move to work, I am open suggestions, I will catch you on a HO and to gather your ideas On 17 March 2015 at 18:07, Bill Fischofer bill.fischo...@linaro.org wrote: These changes do not seem to be a simple move as logic is being changed. A better commit message needed to say what's really happening perhaps? On Tue, Mar 17, 2015 at 3:59 PM, Mike Holmes mike.hol...@linaro.org wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org --- test/api_test/.gitignore | 1 - test/api_test/Makefile.am | 6 +- test/api_test/odp_atomic_test.h| 51 test/api_test/odp_common.c | 2 +- test/performance/.gitignore| 1 + test/performance/Makefile.am | 6 +- .../odp_atomic_test.c = performance/odp_atomic.c} | 136 - 7 files changed, 139 insertions(+), 64 deletions(-) delete mode 100644 test/api_test/odp_atomic_test.h rename test/{api_test/odp_atomic_test.c = performance/odp_atomic.c} (63%) diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore index 84159e1..950f443 100644 --- a/test/api_test/.gitignore +++ b/test/api_test/.gitignore @@ -1,3 +1,2 @@ -odp_atomic odp_ring odp_shm diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am index 86e1bc2..f231fee 100644 --- a/test/api_test/Makefile.am +++ b/test/api_test/Makefile.am @@ -1,21 +1,17 @@ include $(top_srcdir)/test/Makefile.inc -bin_PROGRAMS = odp_atomic odp_shm odp_ring +bin_PROGRAMS = odp_shm odp_ring -odp_atomic_CFLAGS = $(AM_CFLAGS) odp_shm_CFLAGS = $(AM_CFLAGS) odp_ring_CFLAGS = $(AM_CFLAGS) -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static odp_shm_LDFLAGS = $(AM_LDFLAGS) -static odp_ring_LDFLAGS = $(AM_LDFLAGS) -static noinst_HEADERS = \ - $(top_srcdir)/test/api_test/odp_atomic_test.h \ $(top_srcdir)/test/api_test/odp_common.h \ $(top_srcdir)/test/api_test/odp_shm_test.h \ $(top_srcdir)/test/test_debug.h -dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h deleted file mode 100644 index 89e7748..000 --- a/test/api_test/odp_atomic_test.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_ATOMIC_TEST_H_ -#define ODP_ATOMIC_TEST_H_ - -#include odp.h -#include odp/helper/linux.h - -/** - * add_sub_cnt could be any valid value - * so to excercise explicit atomic_add/sub - * ops. For now using 5.. - */ -#define ADD_SUB_CNT5 - -#defineCNT 50 -#defineU32_INIT_VAL(1UL 10) -#defineU64_INIT_VAL(1ULL 33) - -typedef enum { - TEST_MIX = 1, /* Must be first test case num */ - TEST_INC_DEC_U32, - TEST_ADD_SUB_U32, - TEST_INC_DEC_64, - TEST_ADD_SUB_64, - TEST_MAX, -} odp_test_atomic_t; - - -void test_atomic_inc_dec_u32(void); -void test_atomic_add_sub_u32(void); -void test_atomic_inc_dec_64(void); -void test_atomic_add_sub_64(void); -void test_atomic_inc_u32(void); -void test_atomic_dec_u32(void); -void test_atomic_add_u32(void); -void test_atomic_sub_u32(void); -void test_atomic_inc_64(void); -void test_atomic_dec_64(void); -void test_atomic_add_64(void); -void test_atomic_sub_64(void); -void test_atomic_init(void); -void test_atomic_basic(void); -void test_atomic_store(void); -int test_atomic_validate(void); - -#endif /* ODP_ATOMIC_TEST_H_ */ diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 5158d87..18b365e 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -14,10 +14,10 @@ #include odp.h #include odp/helper/linux.h #include odp_common.h -#include odp_atomic_test.h #include odp_shm_test.h #include test_debug.h +#define MAX_WORKERS 32/** Max worker threads */ /* Globals */ static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /** worker threads table*/ diff --git a/test/performance/.gitignore b/test/performance/.gitignore index 9ccb102..1bdb90d 100644 --- a/test/performance/.gitignore +++ b/test/performance/.gitignore @@ -1,3 +1,4 @@ *.log *.trs odp_scheduling +odp_atomic diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am index 3be3721..63e4e23 100644 --- a/test/performance/Makefile.am +++ b/test/performance/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/test/Makefile.inc -EXECUTABLES = +EXECUTABLES = odp_atomic COMPILE_ONLY = odp_scheduling @@
Re: [lng-odp] [PATCHv2 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler
On 18 March 2015 at 11:07, Ciprian Barbu ciprian.ba...@linaro.org wrote: On Wed, Mar 18, 2015 at 11:17 AM, Maxim Uvarov maxim.uva...@linaro.org wrote: On 03/17/15 12:53, Ciprian Barbu wrote: ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be removed from the pri_queues of the linux-generic scheduler Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- v2: - removed #if 1 and trailing whitespaces platform/linux-generic/odp_schedule.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index dd65168..18513da 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -153,6 +153,28 @@ int odp_schedule_term_global(void) for (i = 0; i ODP_CONFIG_SCHED_PRIOS; i++) { for (j = 0; j QUEUES_PER_PRIO; j++) { + odp_queue_t pri_q = sched-pri_queue[i][j]; + + for (;;) { + odp_event_t ev = odp_queue_deq(pri_q); + odp_buffer_t desc_buf; + queue_desc_t *desc; + odp_queue_t queue; + + desc_buf = odp_buffer_from_event(ev); + if (desc_buf == ODP_BUFFER_INVALID) + break; It looks like we did not check return of odp_buffer_from_event() anywhere. But we check that event is not ODP_EVENT_INVALID. That is not performance critical function so I think it's ok to use odp_queue_deq(), not odp_queue_deq_multi(). It's actually not. The problem here is that odp_queu_destroy does not actually destroy SCHED queues. For a queue to be destroyed it's status must be set to QUEUE_STATUS_FREE. For ODP_QUEUE_TYPE_SCHED queues, odp_queue_destroy sets the status to QUEUE_STATUS_DESTROYED, which is not enough for odp_queue_term_global to finish the job, the status must be QUEUE_STATUS_FREE. This sounds like crazy at first, but it is necessary so that the internal priority queues are drained, there are some desc_bufs for each scheduled queues, simply marking the scheduled queue as free is not enough, the desc_buf must be freed too. For that the scheduler code relies on schedule() to process the priority queues, and that code uses queue_deq_multi: https://git.linaro.org/lng/odp.git/blob/df9cacd8cd46629ae74173461f4af7187cfbb670:/platform/linux-generic/odp_schedule.c#l330 Good description. Why isn't it in the code? Who will read this email in one month/year/decade's time? + + desc = odp_buffer_addr(desc_buf); + queue = desc-queue; + /* Let deq_multi_destroy do the job */ + if (queue_is_destroyed(queue)) { + odp_queue_deq_multi(queue, + sched_local.ev, + MAX_DEQ); + } + } + if (odp_queue_destroy(sched-pri_queue[i][j])) { if you set above it to pri_q var, please use pri_q here also. Ok, I didn't notice this. Maxim. ODP_ERR(Sched term: Queue destroy fail.\n); rc = -1; ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] validation: timer: free malloced memory
clean up after calling malloc Signed-off-by: Mike Holmes mike.hol...@linaro.org --- test/validation/odp_timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 1582c63..fd8065d 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -427,6 +427,8 @@ static void *worker_entrypoint(void *arg) if (tt[i].ev != ODP_EVENT_INVALID) odp_timeout_free(odp_timeout_from_event(tt[i].ev)); } + + free(tt); LOG_DBG(Thread %u: exiting\n, thr); return NULL; } -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] linux-generic: linux: destroy used pthread attr
Signed-off-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/odp_linux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c index 67ad05c..a471dd6 100644 --- a/platform/linux-generic/odp_linux.c +++ b/platform/linux-generic/odp_linux.c @@ -140,6 +140,7 @@ void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) for (i = 0; i num; i++) { /* Wait thread to exit */ pthread_join(thread_tbl[i].thread, NULL); + pthread_attr_destroy(thread_tbl[i].attr); free(thread_tbl[i].start_args); } -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] scripts: odp_check: remove astyle
ODP has not adopted a style that can be universally applied with a tool such as astyle. Remove astyle leaving only the cleanup for whitespace and checkpatch elements for checking src files before a patch is created. Signed-off-by: Mike Holmes mike.hol...@linaro.org --- scripts/odp_check | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/scripts/odp_check b/scripts/odp_check index 09c859b..33809dc 100755 --- a/scripts/odp_check +++ b/scripts/odp_check @@ -1,8 +1,6 @@ #!/bin/bash # -# This script is an indenter, white space remover, -# formatter, and beautifier and general source file -# clean up for the ODP project. +# This script is a clean up for the ODP project src files. # # Usage # ./scripts/opd_check path/filename @@ -10,11 +8,5 @@ set -e DIR=$( cd $( dirname ${BASH_SOURCE[0]} ) pwd ) -if ! type astyle /dev/null /dev/null; then - echo Please install astyle from http://astyle.sourceforge.net/; - exit -1 -fi - -astyle --style=linux --indent=force-tab=8 --align-pointer=name $1 $DIR/cleanfile $1 $DIR/checkpatch.pl -f $1 -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 2/3] linux-generic: linux: remove unused include assert.h
Signed-off-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/odp_linux.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c index 67ad05c..5c1e4c7 100644 --- a/platform/linux-generic/odp_linux.c +++ b/platform/linux-generic/odp_linux.c @@ -15,8 +15,6 @@ #include stdlib.h #include string.h #include stdio.h -#include assert.h - #include odp/helper/linux.h #include odp_internal.h -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 1/3] linux-generic: timer: convert assert to ODP_ASSERT
ODP implementations should not call assert directly. Signed-off-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/odp_timer.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index b7cb04f..39d7064 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -23,9 +23,7 @@ /* For snprint, POSIX timers and sigevent */ #define _POSIX_C_SOURCE 200112L -#include assert.h #include errno.h -#include string.h #include stdlib.h #include time.h #include signal.h @@ -123,8 +121,9 @@ static void timer_init(odp_timer *tim, /* Teardown when timer is freed */ static void timer_fini(odp_timer *tim, tick_buf_t *tb) { - assert(tb-exp_tck.v == TMO_UNUSED); - assert(tb-tmo_buf == ODP_BUFFER_INVALID); + ODP_ASSERT(tb-exp_tck.v == TMO_UNUSED, tb-exp_tck.v == TMO_UNUSED); + ODP_ASSERT(tb-tmo_buf == ODP_BUFFER_INVALID, + tb-tmo_buf == ODP_BUFFER_INVALID); tim-queue = ODP_QUEUE_INVALID; tim-user_ptr = NULL; } @@ -137,7 +136,8 @@ static inline uint32_t get_next_free(odp_timer *tim) static inline void set_next_free(odp_timer *tim, uint32_t nf) { - assert(tim-queue == ODP_QUEUE_INVALID); + ODP_ASSERT(tim-queue == ODP_QUEUE_INVALID, + tim-queue == ODP_QUEUE_INVALID); /* Reusing 'queue' for next free index */ tim-queue = _odp_cast_scalar(odp_queue_t, nf); } @@ -195,7 +195,7 @@ static inline uint32_t handle_to_idx(odp_timer_t hdl, static inline odp_timer_t tp_idx_to_handle(struct odp_timer_pool_s *tp, uint32_t idx) { - assert(idx (1U INDEX_BITS)); + ODP_ASSERT(idx (1U INDEX_BITS), idx (1U INDEX_BITS)); return (tp-tp_idx INDEX_BITS) | idx; } @@ -281,7 +281,8 @@ static inline odp_timer_t timer_alloc(odp_timer_pool *tp, if (odp_likely(tp-num_alloc tp-param.num_timers)) { tp-num_alloc++; /* Remove first unused timer from free list */ - assert(tp-first_free != tp-param.num_timers); + ODP_ASSERT(tp-first_free != tp-param.num_timers, + tp-first_free != tp-param.num_timers); uint32_t idx = tp-first_free; odp_timer *tim = tp-timers[idx]; tp-first_free = get_next_free(tim); @@ -322,7 +323,7 @@ static inline odp_buffer_t timer_free(odp_timer_pool *tp, uint32_t idx) odp_spinlock_lock(tp-lock); set_next_free(tim, tp-first_free); tp-first_free = idx; - assert(tp-num_alloc != 0); + ODP_ASSERT(tp-num_alloc != 0, tp-num_alloc != 0); tp-num_alloc--; odp_spinlock_unlock(tp-lock); @@ -597,7 +598,8 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t tpid, uint64_t tick) unsigned nexp = 0; uint32_t i; - assert(high_wm = tpid-param.num_timers); + ODP_ASSERT(high_wm = tpid-param.num_timers, + high_wm = tpid-param.num_timers); for (i = 0; i high_wm;) { #ifdef __ARM_ARCH /* As a rare occurence, we can outsmart the HW prefetcher -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 3/3] linux-generic: packet_socket: remove unused include assert.h
Signed-off-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/odp_packet_socket.c | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index f8116f1..2802c43 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -26,7 +26,6 @@ #include arpa/inet.h #include stdint.h #include string.h -#include assert.h #include net/if.h #include inttypes.h #include poll.h -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 3/3] linux-generic: packet_socket: remove unused include assert.h
On Wed, Mar 18, 2015 at 5:17 PM, Mike Holmes mike.hol...@linaro.org wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org Reviewed-by: Bill Fischofer bill.fischo...@linaro.org --- platform/linux-generic/odp_packet_socket.c | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index f8116f1..2802c43 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -26,7 +26,6 @@ #include arpa/inet.h #include stdint.h #include string.h -#include assert.h #include net/if.h #include inttypes.h #include poll.h -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp