Re: [lng-odp] [PATCH v2] cunit: add shm test
On Tue, Nov 25, 2014 at 03:39:20PM +0800, yan.songm...@linaro.org wrote: I think if we use other environment. We can't even use any API in odp_linux.h which is used in many file of odp. This photo blew show the file which used 'odph_linux_pthread_create'. There are more than ten places to use it . If we do need to consider this. I think we should make the rule and change all the place to use it before. static void test_odp_shm_sunnyday(void) { pthrd_arg thrdarg; There is nothing wrong in existing odph_linux_pthread_create. All I am saying that, Don't allocate the memory from stack to share the data between different execution context. pthrd_arg thrdarg its from stack, you can allocate it from odp shared memeory to share between different cores. thrdarg.testcase = ODP_SHM_TEST; thrdarg.numthrds = odp_sys_core_count(); odp_cunit_thread_create(run_shm_thread, thrdarg); yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-25 15:57 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Tue, Nov 25, 2014 at 03:03:47PM +0800, yan.songm...@linaro.org wrote: Jerin, ODP API's are execution environment agnostic. We have a odp implementation that supports both linux and baremetal. I saw the code of odp_shared_memory is in 'odp/platform/linux-generic', except for 'linux-generic' i don't see any other directory means it support other environment. Cavium's ODP implementation is not yet public. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-24 20:12 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Mon, Nov 24, 2014 at 05:22:28PM +0800, yan.songm...@linaro.org wrote: Hi Jerin, Thanks for reading this patch. I'll change the problem of the use of 'shm'. -IMO, We should avoid using variables allocated from stack to share -the data between different execution context. -It will work in linux threaded run-time environment.But it will -have issues in different run-time environment like bare-metal. -IMO if any memory needs to be shared across different -execution environment should use the memory allocated from odp shared mem. Sorry ,i can't get it . You mean that sometimes we don't use odp in linux ? ODP API's are execution environment agnostic. We have a odp implementation that supports both linux and baremetal. If so , i think we use this only in linux, if not there are a lot of api will not work. This cunit test is for shm, so if i use it to test itself is not a good idea. Other way around to look its, its sunnyday test to check the shared memory accessibly across the different odp execution context. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-24 15:21 To: Yan Songming CC: lng-odp@lists.linaro.org Subject: Re: [lng-odp] [PATCH v2] cunit: add shm test On Thu, Nov 20, 2014 at 10:54:55PM +0800, Yan Songming wrote: Add odp_cunit_common.c for common cunit function and add the cunit test for the api in odp_share_memory.h which include the new api implement odp_shm_free. Signed-off-by: Yan Songming yan.songm...@linaro.org --- v2 fix some problem which maxim and mike found. --- test/validation/Makefile.am| 4 +- test/validation/odp_cunit_common.c | 37 test/validation/odp_cunit_common.h | 41 + test/validation/odp_shm.c | 121 + 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_cunit_common.c create mode 100644 test/validation/odp_cunit_common.h create mode 100644 test/validation/odp_shm.c diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 2e1b991..5992f72 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,12 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I./crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) +odp_shm_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c +dist_odp_shm_SOURCES = odp_shm.c odp_cunit_common.c diff --git a/test/validation/odp_cunit_common.c b/test/validation/odp_cunit_common.c new file mode 100644
Re: [lng-odp] [PATCH v3 8/9] api: odp_atomic.h: struct type, relaxed mm, missing funcs, use __atomic
On Mon, 24 Nov 2014 23:38:49 +0100 Ola Liljedahl ola.liljed...@linaro.org wrote: Use GCC __atomic builtins AFAIK these were introduced in gcc = 4.7 Maybe I'm missing something, but isn't there a portability concern here? Regards, Shmulik ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v3 8/9] api: odp_atomic.h: struct type, relaxed mm, missing funcs, use __atomic
On 25 November 2014 at 09:56, Shmulik Ladkani shmulik.ladk...@gmail.com wrote: On Mon, 24 Nov 2014 23:38:49 +0100 Ola Liljedahl ola.liljed...@linaro.org wrote: Use GCC __atomic builtins AFAIK these were introduced in gcc = 4.7 All usage of non-standard features could cause problems for someone. In my strong opinion, the benefit outweighs the potential problems here. Maybe I'm missing something, but isn't there a portability concern here? Yes my original idea was that we should be using standard C11 atomics directly but this did not get approval. The usage of GCC __atomics are wrapped in header files (odp_atomic.h, odp_atomic_internal.h (coming soon)). So the implementation can be modified or changed without affecting users of these (public and internal) API's. My first patch included assembler implementations for ARM (v7 and v8/64-bit) and MIPS64, this could be used for reference. Or you could use the GCC __sync builtins (which are unnecessarily heavy for all weakly ordered architectures). The person who experiences some actual problem with the current implementation will have to decide what to do. Upgrading to a modern version of GCC should also be an option. -- Ola Regards, Shmulik ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v2] cunit: add shm test
-There is nothing wrong in existing odph_linux_pthread_create. All I am saying that, Don't allocate -the memory from stack to share the data between different execution context. pthrd_arg thrdarg its from stack, -you can allocate it from odp shared memeory to share between different cores. I just have some confuse. Yes, i know you say that the stack will not work in environment other than linux. So , i think other API, such as odph_linux_pthread_create won't work in other environment too,. We have a lot of thing like this. Maybe we need to change them all. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-25 17:14 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Tue, Nov 25, 2014 at 03:39:20PM +0800, yan.songm...@linaro.org wrote: I think if we use other environment. We can't even use any API in odp_linux.h which is used in many file of odp. This photo blew show the file which used 'odph_linux_pthread_create'. There are more than ten places to use it . If we do need to consider this. I think we should make the rule and change all the place to use it before. static void test_odp_shm_sunnyday(void) { pthrd_arg thrdarg; There is nothing wrong in existing odph_linux_pthread_create. All I am saying that, Don't allocate the memory from stack to share the data between different execution context. pthrd_arg thrdarg its from stack, you can allocate it from odp shared memeory to share between different cores. thrdarg.testcase = ODP_SHM_TEST; thrdarg.numthrds = odp_sys_core_count(); odp_cunit_thread_create(run_shm_thread, thrdarg); yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-25 15:57 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Tue, Nov 25, 2014 at 03:03:47PM +0800, yan.songm...@linaro.org wrote: Jerin, ODP API's are execution environment agnostic. We have a odp implementation that supports both linux and baremetal. I saw the code of odp_shared_memory is in 'odp/platform/linux-generic', except for 'linux-generic' i don't see any other directory means it support other environment. Cavium's ODP implementation is not yet public. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-24 20:12 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Mon, Nov 24, 2014 at 05:22:28PM +0800, yan.songm...@linaro.org wrote: Hi Jerin, Thanks for reading this patch. I'll change the problem of the use of 'shm'. -IMO, We should avoid using variables allocated from stack to share -the data between different execution context. -It will work in linux threaded run-time environment.But it will -have issues in different run-time environment like bare-metal. -IMO if any memory needs to be shared across different -execution environment should use the memory allocated from odp shared mem. Sorry ,i can't get it . You mean that sometimes we don't use odp in linux ? ODP API's are execution environment agnostic. We have a odp implementation that supports both linux and baremetal. If so , i think we use this only in linux, if not there are a lot of api will not work. This cunit test is for shm, so if i use it to test itself is not a good idea. Other way around to look its, its sunnyday test to check the shared memory accessibly across the different odp execution context. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-24 15:21 To: Yan Songming CC: lng-odp@lists.linaro.org Subject: Re: [lng-odp] [PATCH v2] cunit: add shm test On Thu, Nov 20, 2014 at 10:54:55PM +0800, Yan Songming wrote: Add odp_cunit_common.c for common cunit function and add the cunit test for the api in odp_share_memory.h which include the new api implement odp_shm_free. Signed-off-by: Yan Songming yan.songm...@linaro.org --- v2 fix some problem which maxim and mike found. --- test/validation/Makefile.am| 4 +- test/validation/odp_cunit_common.c | 37 test/validation/odp_cunit_common.h | 41 + test/validation/odp_shm.c | 121 + 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_cunit_common.c create mode 100644 test/validation/odp_cunit_common.h create mode 100644 test/validation/odp_shm.c diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 2e1b991..5992f72 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,12 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS}
[lng-odp] [PATCH] odp_ipsec: fix odp_crypto_get_operation_compl_status arg order
From: Alexandru Badicioiu alexandru.badici...@linaro.org This fixes https://bugs.linaro.org/show_bug.cgi?id=714. Signed-off-by: Alexandru Badicioiu alexandru.badici...@linaro.org --- example/ipsec/odp_ipsec.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index ec115fc..fb06baf 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1003,7 +1003,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt, /* Check crypto result */ event = odp_packet_to_buffer(pkt); - odp_crypto_get_operation_compl_status(event, cipher_rc, auth_rc); + odp_crypto_get_operation_compl_status(event, auth_rc, cipher_rc); if (!is_crypto_compl_status_ok(cipher_rc)) return PKT_DROP; if (!is_crypto_compl_status_ok(auth_rc)) -- 1.7.3.4 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v2] cunit: add shm test
On Tue, Nov 25, 2014 at 06:13:37PM +0800, yan.songm...@linaro.org wrote: -There is nothing wrong in existing odph_linux_pthread_create. All I am saying that, Don't allocate -the memory from stack to share the data between different execution context. pthrd_arg thrdarg its from stack, -you can allocate it from odp shared memeory to share between different cores. I just have some confuse. Yes, i know you say that the stack will not work in environment other than linux. So , i think other API, such as odph_linux_pthread_create won't work in other environment too,. Expected, Its a helper function and its not part of normative ODP specification. But the contract between ODP normative API and APP should be maintained like use odp shared memory to share the data between different execution context We have a lot of thing like this. Maybe we need to change them all. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-25 17:14 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Tue, Nov 25, 2014 at 03:39:20PM +0800, yan.songm...@linaro.org wrote: I think if we use other environment. We can't even use any API in odp_linux.h which is used in many file of odp. This photo blew show the file which used 'odph_linux_pthread_create'. There are more than ten places to use it . If we do need to consider this. I think we should make the rule and change all the place to use it before. static void test_odp_shm_sunnyday(void) { pthrd_arg thrdarg; There is nothing wrong in existing odph_linux_pthread_create. All I am saying that, Don't allocate the memory from stack to share the data between different execution context. pthrd_arg thrdarg its from stack, you can allocate it from odp shared memeory to share between different cores. thrdarg.testcase = ODP_SHM_TEST; thrdarg.numthrds = odp_sys_core_count(); odp_cunit_thread_create(run_shm_thread, thrdarg); yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-25 15:57 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Tue, Nov 25, 2014 at 03:03:47PM +0800, yan.songm...@linaro.org wrote: Jerin, ODP API's are execution environment agnostic. We have a odp implementation that supports both linux and baremetal. I saw the code of odp_shared_memory is in 'odp/platform/linux-generic', except for 'linux-generic' i don't see any other directory means it support other environment. Cavium's ODP implementation is not yet public. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-24 20:12 To: yan.songm...@linaro.org CC: lng-odp@lists.linaro.org Subject: Re: Re: [lng-odp] [PATCH v2] cunit: add shm test On Mon, Nov 24, 2014 at 05:22:28PM +0800, yan.songm...@linaro.org wrote: Hi Jerin, Thanks for reading this patch. I'll change the problem of the use of 'shm'. -IMO, We should avoid using variables allocated from stack to share -the data between different execution context. -It will work in linux threaded run-time environment.But it will -have issues in different run-time environment like bare-metal. -IMO if any memory needs to be shared across different -execution environment should use the memory allocated from odp shared mem. Sorry ,i can't get it . You mean that sometimes we don't use odp in linux ? ODP API's are execution environment agnostic. We have a odp implementation that supports both linux and baremetal. If so , i think we use this only in linux, if not there are a lot of api will not work. This cunit test is for shm, so if i use it to test itself is not a good idea. Other way around to look its, its sunnyday test to check the shared memory accessibly across the different odp execution context. yan.songm...@linaro.org From: Jerin Jacob Date: 2014-11-24 15:21 To: Yan Songming CC: lng-odp@lists.linaro.org Subject: Re: [lng-odp] [PATCH v2] cunit: add shm test On Thu, Nov 20, 2014 at 10:54:55PM +0800, Yan Songming wrote: Add odp_cunit_common.c for common cunit function and add the cunit test for the api in odp_share_memory.h which include the new api implement odp_shm_free. Signed-off-by: Yan Songming yan.songm...@linaro.org --- v2 fix some problem which maxim and mike found. --- test/validation/Makefile.am| 4 +- test/validation/odp_cunit_common.c | 37 test/validation/odp_cunit_common.h | 41 + test/validation/odp_shm.c | 121 + 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644
Re: [lng-odp] [PATCH v2] test: Display implementation version
On 11/24/2014 10:11 PM, Mike Holmes wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org --- test/validation/odp_crypto.c | 11 +-- test/validation/odp_init.c | 7 --- test/validation/odp_queue.c | 7 +-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c index 985302a..9342aca 100644 --- a/test/validation/odp_crypto.c +++ b/test/validation/odp_crypto.c @@ -16,9 +16,16 @@ #define SHM_COMPL_POOL_SIZE (128*1024) #define SHM_COMPL_POOL_BUF_SIZE 128 +static int init_suite(void) +{ + printf(\tODP API version: %s\n, odp_version_api_str()); + printf(\tODP implementation version: %s\n, odp_version_impl_str()); + return 0; +} + CU_SuiteInfo suites[] = { - { ODP_CRYPTO_SYNC_INP , NULL, NULL, NULL, NULL, test_array_sync }, - { ODP_CRYPTO_ASYNC_INP , NULL, NULL, NULL, NULL, test_array_async }, + {ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL, test_array_sync }, + {ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL, test_array_async }, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c index 88e6235..aa7439d 100644 --- a/test/validation/odp_init.c +++ b/test/validation/odp_init.c @@ -20,9 +20,10 @@ static void test_odp_init_global(void) CU_ASSERT(status == 0); } -static int init(void) +static int init_suite(void) { - printf(\tODP version: %s\n, odp_version_api_str()); + printf(\tODP API version: %s\n, odp_version_api_str()); + printf(\tODP implementation version: %s\n, odp_version_impl_str()); Suite init function should perform necessary actions to prepare system for a suit execution. Printing ODP info has nothing to do with this. Also this information is the same for all test suites, so normally it should be printed directly from main(). ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] .gitignore: add CUnit-Memory-Dump.xml
On 11/25/2014 01:18 AM, Mike Holmes wrote: Does no one else see this ? Files are in the same directory where you run the test. So please remove path from the patch and add others: CUnit-Memory-Dump.xml example/packet/core test/validation/CUnit-Memory-Dump.xml test/validation/crypto/.dirstamp Maxim. Here is my recipe:- git remote update git rebase git clean -xdf ./bootstrap ./configure --with-cunit-path=/home/mike/CUnitHome make check git st On branch generic-version Your branch is up-to-date with 'origin/master'. Untracked files: (use git add file... to include in what will be committed) test/validation/CUnit-Memory-Dump.xml nothing added to commit but untracked files present (use git add to track) On 20 November 2014 13:14, Mike Holmes mike.hol...@linaro.org wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9d45504..54da6c7 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ doxygen-doc test-driver test/validation/*.log test/validation/*.trs +test/validation/CUnit-Memory-Dump.xml -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
I guess any Ethernet interface can be configured to work in loopback mode ( at least with SDK provided tools/functions). Loopback interface applied to HW is confusing - usually loopback is software only; how a HW packet classifier would be tested with a loopback interface? For this purpose a real interface is required, backed up by real HW. On 25 November 2014 at 14:05, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 11/24/2014 08:27 PM, Maxim Uvarov wrote: Hello, Can we go odp_pktio_open() return default interface provided by implementation? For linux-generic we already have environment variables to select between mmap and raw sockets. Also we can add hint what is default interface name. Like: export ODP_PKIO_DEFAULT_DEV=eth0 And if this variable is not exported it might be eth0, eth1, then eth2. Or first device found in list returned by ioctl. Reason is to add to CUNIT tests coverage for functions which need pktio. It makes more sense to have an API to request available pktio interfaces and their characteristics. So application can pick one of them instead of default. But as Bala mentioned for tests you need loopback interface, but not a real one. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] .gitignore: add CUnit-Memory-Dump.xml
On 25 November 2014 at 07:15, Maxim Uvarov maxim.uva...@linaro.org wrote: On 11/25/2014 01:18 AM, Mike Holmes wrote: Does no one else see this ? Files are in the same directory where you run the test. So please remove path from the patch and add others: CUnit-Memory-Dump.xml example/packet/core test/validation/CUnit-Memory-Dump.xml test/validation/crypto/.dirstamp Maxim. no problem, thanks for confirming. Here is my recipe:- git remote update git rebase git clean -xdf ./bootstrap ./configure --with-cunit-path=/home/mike/CUnitHome make check git st On branch generic-version Your branch is up-to-date with 'origin/master'. Untracked files: (use git add file... to include in what will be committed) test/validation/CUnit-Memory-Dump.xml nothing added to commit but untracked files present (use git add to track) On 20 November 2014 13:14, Mike Holmes mike.hol...@linaro.org wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9d45504..54da6c7 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ doxygen-doc test-driver test/validation/*.log test/validation/*.trs +test/validation/CUnit-Memory-Dump.xml -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
On 11/25/2014 02:19 PM, Alexandru Badicioiu wrote: I guess any Ethernet interface can be configured to work in loopback mode ( at least with SDK provided tools/functions). Loopback interface applied to HW is confusing - usually loopback is software only; how a HW packet classifier would be tested with a loopback interface? For this purpose a real interface is required, backed up by real HW. Right, but this is implementation details. If application needs a loopback interface it should not care how it is implemented. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] .gitignore: add CUnit-Memory-Dump.xml
On 11/25/2014 02:43 PM, Mike Holmes wrote: On 25 November 2014 at 07:15, Maxim Uvarov maxim.uva...@linaro.org mailto:maxim.uva...@linaro.org wrote: On 11/25/2014 01:18 AM, Mike Holmes wrote: Does no one else see this ? Files are in the same directory where you run the test. So please remove path from the patch and add others: CUnit-Memory-Dump.xml example/packet/core test/validation/CUnit-Memory-__Dump.xml test/validation/crypto/.__dirstamp Maxim. no problem, thanks for confirming. Git supports hierarchical .gitignore files. Each directory may have its own .gitignore. Instead of adding everything in a root .gitignore it makes sense to create at least two additional: test/validation/.gitignore example/.gitignore ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2] .gitignore: add CUnit-Memory-Dump.xml
Signed-off-by: Mike Holmes mike.hol...@linaro.org --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 9d45504..1572ea5 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ doxygen-doc test-driver test/validation/*.log test/validation/*.trs +CUnit-Memory-Dump.xml +core +.dirstamp -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
Yes. But for testing the basic pktio APIs which I believe is Maxim's requirement it can be done using loopback interface (configuring a HW interface as loop is an implementation detail) so that there is no need for any HW configuration as such while running the validation suite. Packet classifier testing can be done using an example program which will receive packet from a HW interface. Regards, Bala On 25 November 2014 18:16, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 11/25/2014 02:19 PM, Alexandru Badicioiu wrote: I guess any Ethernet interface can be configured to work in loopback mode ( at least with SDK provided tools/functions). Loopback interface applied to HW is confusing - usually loopback is software only; how a HW packet classifier would be tested with a loopback interface? For this purpose a real interface is required, backed up by real HW. Right, but this is implementation details. If application needs a loopback interface it should not care how it is implemented. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v2] .gitignore: add CUnit-Memory-Dump.xml
Please ignore - we can refactor into multiple .gitignore files On 25 November 2014 at 07:56, Mike Holmes mike.hol...@linaro.org wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 9d45504..1572ea5 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ doxygen-doc test-driver test/validation/*.log test/validation/*.trs +CUnit-Memory-Dump.xml +core +.dirstamp -- 2.1.0 -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v0] crypto : cunit test suite for rng
On 11/25/2014 12:21 PM, Alexandru Badicioiu wrote: + +/* + * This test verifies that HW random number generator is able + * to produce an IV for TDES_CBC cipher algorithm. + * */ +#define RNG_GET_SIZE RNG_GET_SIZE +static void rng_get_size(void) +{ + int ret; + size_t len = TDES_CBC_IV_LEN; + uint8_t buf[TDES_CBC_IV_LEN]; + + ret = odp_hw_random_get(buf, len, false); + CU_ASSERT(!ret); + CU_ASSERT(len == TDES_CBC_IV_LEN); +} + +CU_TestInfo test_rng[] = { + { RNG_GET_SIZE, rng_get_size }, + CU_TEST_INFO_NULL, Size of test_rng is defined as a size of one in the header but is size of two elements here. [Alex] CUnit does not use the declared size of the array - I guess this is the purpose of the end marker (CU_TEST_INFO_NULL). Declaring a pointer only it will not compile : odp_crypto.c:23:2: error: initializer element is not constant odp_crypto.c:23:2: error: (near initialization for 'suites[2].pTests') odp_crypto.c:23:2: error: missing initializer [-Werror=missing-field-initializers] odp_crypto.c:23:2: error: (near initialization for 'suites[2].pTests') [-Werror=missing-field-initializers] Trying to declare the array as flexible will not work either (CU_TestInfo test_rng[];): In file included from odp_crypto.c:12:0: ./crypto/odp_crypto_test_rng.h:15:13: error: array 'test_rng' assumed to have one element [-Werror] cc1: all warnings being treated as errors This is the reason I used 1 as the declared size of the array. This should work: extern CU_TestInfo test_rng[]; + +#endif + diff --git a/test/validation/crypto/test_vectors.h b/test/validation/crypto/test_vectors.h index c151952..aaf0103 100644 --- a/test/validation/crypto/test_vectors.h +++ b/test/validation/crypto/test_vectors.h @@ -13,7 +13,7 @@ #define TDES_CBC_IV_LEN8 /* IV length(in bytes) for tdes-cbc */ #define TDES_CBC_MAX_DATA_LEN 16 /* max. plain text length(in bytes) */ -static uint8_t tdes_cbc_reference_key[][TDES_CBC_KEY_LEN] = { +static uint8_t tdes_cbc_reference_key[][TDES_CBC_KEY_LEN] ODP_UNUSED Not sure why this is flagged unused it appears to be used in crypto/odp_crypto_test_async_inp.c and crypto/odp_crypto_test_sync_inp.c [Alex] These are static declaration, as such they are reported unused in test_rng.c file where they are unused. To avoid unused, they should be moved to a .c file and only be declared in test_vectors.h. That's a hacky solution. You can split these structures into a separate .h and not include them in RNG tests. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/2] cunit: pktio: mtu and promisc mode
On Mon, Nov 24, 2014 at 11:53 AM, Maxim Uvarov maxim.uva...@linaro.org wrote: Add basic check for mtu and promisc modes. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- test/validation/Makefile.am | 4 +- test/validation/odp_pktio.c | 164 2 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_pktio.c I don't know if anyone sees a pattern in naming the testcases, I like to think there is a source file for each API header file and the names of the files match. With this argument, I suggest renaming test/validation/odp_pktio.c to test/validation/odp_packet_io.c. On a more general note, I think having duplicate names is a really bad idea (implementation sources and test sources), perhaps we can later rename the test files to something different, odp_packet_io_test.c for instance. That may not work all to well either, Taras for instance has an odp_buffer.c and an odp_buffer_test.c in his buffer cunit, but I just don't like duplicate names. diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0b831d0..91adc7e 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,12 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_pktio odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) +odp_pktio_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c +dist_odp_pktio_SOURCES = odp_pktio.c diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c new file mode 100644 index 000..e26d820 --- /dev/null +++ b/test/validation/odp_pktio.c @@ -0,0 +1,164 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier:BSD-3-Clause + */ + +#include odp.h +#include CUnit/Basic.h + +#define SHM_PKT_POOL_SIZE (512 * 2048 * 2) +#define SHM_PKT_POOL_BUF_SIZE (1024 * 32) + +#define SHM_COMPL_POOL_SIZE(128 * 1024) +#define SHM_COMPL_POOL_BUF_SIZE128 + +static odp_pktio_t pktio; + +static void test_pktio_mtu(void) +{ + int i; + int ret; + int def; + + def = odp_pktio_mtu(pktio); + CU_ASSERT(def 0); + + for (i = 64; i 9000; i *= 2) { + printf( %d , i); + + ret = odp_pktio_set_mtu(pktio, i); + CU_ASSERT(0 == ret); + + ret = odp_pktio_mtu(pktio); + CU_ASSERT(ret == i); + } + + ret = odp_pktio_set_mtu(pktio, def); + CU_ASSERT(0 == ret); + + return; +} + +static void test_pktio_promisc(void) +{ + int ret; + + ret = odp_pktio_promisc_enable(pktio); + CU_ASSERT(ret == 0); + + /* Check */ + ret = odp_pktio_promisc_get_enabled(pktio); + CU_ASSERT(ret == 1); + + ret = odp_pktio_promisc_disable(pktio); + CU_ASSERT(ret == 0); + + /* Check */ + ret = odp_pktio_promisc_get_enabled(pktio); + CU_ASSERT(ret == 0); + + return; +} + +int main(void) +{ + odp_shm_t shm; + void *pool_base; + odp_buffer_pool_t pool; + odp_queue_t out_queue; + CU_pSuite ptr_suite; + CU_pTest ptest; + + if (odp_init_global(NULL, NULL)) { + printf(ODP global init failed.\n); + return -1; + } + odp_init_local(); + + shm = odp_shm_reserve(shm_packet_pool, + SHM_PKT_POOL_SIZE, + ODP_CACHE_LINE_SIZE, 0); + + pool_base = odp_shm_addr(shm); + if (!pool_base) { + fprintf(stderr, Packet pool allocation failed.\n); + return -1; + } + + pool = odp_buffer_pool_create(packet_pool, pool_base, + SHM_PKT_POOL_SIZE, + SHM_PKT_POOL_BUF_SIZE, + ODP_CACHE_LINE_SIZE, + ODP_BUFFER_TYPE_PACKET); + if (ODP_BUFFER_POOL_INVALID == pool) { + fprintf(stderr, Packet pool creation failed.\n); + return -1; + } + out_queue = odp_queue_create(crypto-out, + ODP_QUEUE_TYPE_POLL, NULL); + if (ODP_QUEUE_INVALID == out_queue) { + fprintf(stderr, Crypto outq creation failed.\n); + return -1; + } + shm = odp_shm_reserve(shm_compl_pool, +
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
On 11/25/2014 03:06 PM, Bala Manoharan wrote: Yes. But for testing the basic pktio APIs which I believe is Maxim's requirement it can be done using loopback interface (configuring a HW interface as loop is an implementation detail) so that there is no need for any HW configuration as such while running the validation suite. I'm not sure what you are arguing to, but I agree that loopback should be enough for basic pktio API verification. Packet classifier testing can be done using an example program which will receive packet from a HW interface. Verification tests should be done as self-contained applications. So classification tests should also use a loopback interface. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/2] cunit: pktio: mtu and promisc mode
On 25 November 2014 at 08:16, Ciprian Barbu ciprian.ba...@linaro.org wrote: On Mon, Nov 24, 2014 at 11:53 AM, Maxim Uvarov maxim.uva...@linaro.org wrote: Add basic check for mtu and promisc modes. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- test/validation/Makefile.am | 4 +- test/validation/odp_pktio.c | 164 2 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_pktio.c I don't know if anyone sees a pattern in naming the testcases, I like to think there is a source file for each API header file and the names of the files match. With this argument, I suggest renaming test/validation/odp_pktio.c to test/validation/odp_packet_io.c. The test suite names need to match the API logical groups they cover which may encompass more than one header file, but I agree if it is one to one it appears sensible to show the correlation. On a more general note, I think having duplicate names is a really bad idea (implementation sources and test sources), perhaps we can later rename the test files to something different, We plan to move all the tests into one library post 1.0 so that will have a profound effect on the names and locations of the files I suspect. odp_packet_io_test.c for instance. That may not work all to well either, Taras for instance has an odp_buffer.c and an odp_buffer_test.c in his buffer cunit, but I just don't like duplicate names. I don't like adding _test myself, they are in the test/validation directory already so it should be obvious they are tests. diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0b831d0..91adc7e 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,12 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_pktio odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) +odp_pktio_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c +dist_odp_pktio_SOURCES = odp_pktio.c diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c new file mode 100644 index 000..e26d820 --- /dev/null +++ b/test/validation/odp_pktio.c @@ -0,0 +1,164 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier:BSD-3-Clause + */ + +#include odp.h +#include CUnit/Basic.h + +#define SHM_PKT_POOL_SIZE (512 * 2048 * 2) +#define SHM_PKT_POOL_BUF_SIZE (1024 * 32) + +#define SHM_COMPL_POOL_SIZE(128 * 1024) +#define SHM_COMPL_POOL_BUF_SIZE128 + +static odp_pktio_t pktio; + +static void test_pktio_mtu(void) +{ + int i; + int ret; + int def; + + def = odp_pktio_mtu(pktio); + CU_ASSERT(def 0); + + for (i = 64; i 9000; i *= 2) { + printf( %d , i); + + ret = odp_pktio_set_mtu(pktio, i); + CU_ASSERT(0 == ret); + + ret = odp_pktio_mtu(pktio); + CU_ASSERT(ret == i); + } + + ret = odp_pktio_set_mtu(pktio, def); + CU_ASSERT(0 == ret); + + return; +} + +static void test_pktio_promisc(void) +{ + int ret; + + ret = odp_pktio_promisc_enable(pktio); + CU_ASSERT(ret == 0); + + /* Check */ + ret = odp_pktio_promisc_get_enabled(pktio); + CU_ASSERT(ret == 1); + + ret = odp_pktio_promisc_disable(pktio); + CU_ASSERT(ret == 0); + + /* Check */ + ret = odp_pktio_promisc_get_enabled(pktio); + CU_ASSERT(ret == 0); + + return; +} + +int main(void) +{ + odp_shm_t shm; + void *pool_base; + odp_buffer_pool_t pool; + odp_queue_t out_queue; + CU_pSuite ptr_suite; + CU_pTest ptest; + + if (odp_init_global(NULL, NULL)) { + printf(ODP global init failed.\n); + return -1; + } + odp_init_local(); + + shm = odp_shm_reserve(shm_packet_pool, + SHM_PKT_POOL_SIZE, + ODP_CACHE_LINE_SIZE, 0); + + pool_base = odp_shm_addr(shm); + if (!pool_base) { + fprintf(stderr, Packet pool allocation failed.\n); + return -1; + } + + pool = odp_buffer_pool_create(packet_pool, pool_base,
Re: [lng-odp] [PATCH 2/2] cunit: pktio: mtu and promisc mode
On Tue, Nov 25, 2014 at 3:24 PM, Mike Holmes mike.hol...@linaro.org wrote: On 25 November 2014 at 08:16, Ciprian Barbu ciprian.ba...@linaro.org wrote: On Mon, Nov 24, 2014 at 11:53 AM, Maxim Uvarov maxim.uva...@linaro.org wrote: Add basic check for mtu and promisc modes. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- test/validation/Makefile.am | 4 +- test/validation/odp_pktio.c | 164 2 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 test/validation/odp_pktio.c I don't know if anyone sees a pattern in naming the testcases, I like to think there is a source file for each API header file and the names of the files match. With this argument, I suggest renaming test/validation/odp_pktio.c to test/validation/odp_packet_io.c. The test suite names need to match the API logical groups they cover which may encompass more than one header file, but I agree if it is one to one it appears sensible to show the correlation. On a more general note, I think having duplicate names is a really bad idea (implementation sources and test sources), perhaps we can later rename the test files to something different, We plan to move all the tests into one library post 1.0 so that will have a profound effect on the names and locations of the files I suspect. odp_packet_io_test.c for instance. That may not work all to well either, Taras for instance has an odp_buffer.c and an odp_buffer_test.c in his buffer cunit, but I just don't like duplicate names. I don't like adding _test myself, they are in the test/validation directory already so it should be obvious they are tests. How about naming them odpt_, similar to what the helper files names are. diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0b831d0..91adc7e 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,12 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_pktio odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) +odp_pktio_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -18,3 +19,4 @@ dist_odp_queue_SOURCES = odp_queue.c dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c +dist_odp_pktio_SOURCES = odp_pktio.c diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c new file mode 100644 index 000..e26d820 --- /dev/null +++ b/test/validation/odp_pktio.c @@ -0,0 +1,164 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier:BSD-3-Clause + */ + +#include odp.h +#include CUnit/Basic.h + +#define SHM_PKT_POOL_SIZE (512 * 2048 * 2) +#define SHM_PKT_POOL_BUF_SIZE (1024 * 32) + +#define SHM_COMPL_POOL_SIZE(128 * 1024) +#define SHM_COMPL_POOL_BUF_SIZE128 + +static odp_pktio_t pktio; + +static void test_pktio_mtu(void) +{ + int i; + int ret; + int def; + + def = odp_pktio_mtu(pktio); + CU_ASSERT(def 0); + + for (i = 64; i 9000; i *= 2) { + printf( %d , i); + + ret = odp_pktio_set_mtu(pktio, i); + CU_ASSERT(0 == ret); + + ret = odp_pktio_mtu(pktio); + CU_ASSERT(ret == i); + } + + ret = odp_pktio_set_mtu(pktio, def); + CU_ASSERT(0 == ret); + + return; +} + +static void test_pktio_promisc(void) +{ + int ret; + + ret = odp_pktio_promisc_enable(pktio); + CU_ASSERT(ret == 0); + + /* Check */ + ret = odp_pktio_promisc_get_enabled(pktio); + CU_ASSERT(ret == 1); + + ret = odp_pktio_promisc_disable(pktio); + CU_ASSERT(ret == 0); + + /* Check */ + ret = odp_pktio_promisc_get_enabled(pktio); + CU_ASSERT(ret == 0); + + return; +} + +int main(void) +{ + odp_shm_t shm; + void *pool_base; + odp_buffer_pool_t pool; + odp_queue_t out_queue; + CU_pSuite ptr_suite; + CU_pTest ptest; + + if (odp_init_global(NULL, NULL)) { + printf(ODP global init failed.\n); + return -1; + } + odp_init_local(); + + shm = odp_shm_reserve(shm_packet_pool, + SHM_PKT_POOL_SIZE, + ODP_CACHE_LINE_SIZE, 0); + + pool_base = odp_shm_addr(shm); + if (!pool_base) { +
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
On 25 November 2014 at 08:17, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 11/25/2014 03:06 PM, Bala Manoharan wrote: Yes. But for testing the basic pktio APIs which I believe is Maxim's requirement it can be done using loopback interface (configuring a HW interface as loop is an implementation detail) so that there is no need for any HW configuration as such while running the validation suite. I'm not sure what you are arguing to, but I agree that loopback should be enough for basic pktio API verification. Packet classifier testing can be done using an example program which will receive packet from a HW interface. Verification tests should be done as self-contained applications. So classification tests should also use a loopback interface. Do we need to update the ODP 1.0 deltas doc with an new API to return an implementations loopback interface name ? We need Patri to take a look at the proposal. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
What is a self-contained application? An application which uses only ODP calls? Regarding the classification tests and loopbacks, why there's a need for a special kind of ODP loopback interface? Why the following scenario is not acceptable for a test - open a pktio (ethernet), configure it in loopback mode and transmit the test traffic over the pktio with odp_pktio_send(), for example. Alex On 25 November 2014 at 15:17, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 11/25/2014 03:06 PM, Bala Manoharan wrote: Yes. But for testing the basic pktio APIs which I believe is Maxim's requirement it can be done using loopback interface (configuring a HW interface as loop is an implementation detail) so that there is no need for any HW configuration as such while running the validation suite. I'm not sure what you are arguing to, but I agree that loopback should be enough for basic pktio API verification. Packet classifier testing can be done using an example program which will receive packet from a HW interface. Verification tests should be done as self-contained applications. So classification tests should also use a loopback interface. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v2] test: Display implementation version
On 25 November 2014 at 07:11, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 11/24/2014 10:11 PM, Mike Holmes wrote: Signed-off-by: Mike Holmes mike.hol...@linaro.org --- test/validation/odp_crypto.c | 11 +-- test/validation/odp_init.c | 7 --- test/validation/odp_queue.c | 7 +-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c index 985302a..9342aca 100644 --- a/test/validation/odp_crypto.c +++ b/test/validation/odp_crypto.c @@ -16,9 +16,16 @@ #define SHM_COMPL_POOL_SIZE (128*1024) #define SHM_COMPL_POOL_BUF_SIZE 128 +static int init_suite(void) +{ + printf(\tODP API version: %s\n, odp_version_api_str()); + printf(\tODP implementation version: %s\n, odp_version_impl_str()); + return 0; +} + CU_SuiteInfo suites[] = { - { ODP_CRYPTO_SYNC_INP , NULL, NULL, NULL, NULL, test_array_sync }, - { ODP_CRYPTO_ASYNC_INP , NULL, NULL, NULL, NULL, test_array_async }, + {ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL, test_array_sync }, + {ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL, test_array_async }, CU_SUITE_INFO_NULL, }; diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c index 88e6235..aa7439d 100644 --- a/test/validation/odp_init.c +++ b/test/validation/odp_init.c @@ -20,9 +20,10 @@ static void test_odp_init_global(void) CU_ASSERT(status == 0); } -static int init(void) +static int init_suite(void) { - printf(\tODP version: %s\n, odp_version_api_str()); + printf(\tODP API version: %s\n, odp_version_api_str()); + printf(\tODP implementation version: %s\n, odp_version_impl_str()); Suite init function should perform necessary actions to prepare system for a suit execution. Printing ODP info has nothing to do with this. Also this information is the same for all test suites, so normally it should be printed directly from main(). When we merge this into a library to facilitate the arbitrary execution of suites main will not necessarily be called. A suite might be called from one of the interactive CUnit shells or GUI and main will not be present except for the batch processing case. -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
Lets take it up on the 1.0 API call that is in 1/2 hour On 25 November 2014 at 08:30, Alexandru Badicioiu alexandru.badici...@linaro.org wrote: What is a self-contained application? An application which uses only ODP calls? Regarding the classification tests and loopbacks, why there's a need for a special kind of ODP loopback interface? Why the following scenario is not acceptable for a test - open a pktio (ethernet), configure it in loopback mode and transmit the test traffic over the pktio with odp_pktio_send(), for example. Alex On 25 November 2014 at 15:17, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 11/25/2014 03:06 PM, Bala Manoharan wrote: Yes. But for testing the basic pktio APIs which I believe is Maxim's requirement it can be done using loopback interface (configuring a HW interface as loop is an implementation detail) so that there is no need for any HW configuration as such while running the validation suite. I'm not sure what you are arguing to, but I agree that loopback should be enough for basic pktio API verification. Packet classifier testing can be done using an example program which will receive packet from a HW interface. Verification tests should be done as self-contained applications. So classification tests should also use a loopback interface. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
On 11/25/2014 03:30 PM, Alexandru Badicioiu wrote: What is a self-contained application? An application which uses only ODP calls? I mean an application that doesn't need any external equipment. Regarding the classification tests and loopbacks, why there's a need for a special kind of ODP loopback interface? Why the following scenario is not acceptable for a test - open a pktio (ethernet), configure it in loopback mode and transmit the test traffic over the pktio with odp_pktio_send(), for example. It can work this way also for test, but consider a use-case: application processes IPsec tunneled traffic and after decryption it wants to reclassify a packet. We agreed before that such reclassification will be done via some loopback pktio interface. Should it be a real physical interface in a loopback mode or it can be a special kind of loopback? ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_pktio_open(NULL) return default pktio for platform
That loopback interface which allows reclassification (i.e. sending packets to a HW classifier from the core) would be an appropriate pktio, opened on a special HW device which is designed for this task. If the packets are returned to the core (this is not mandatory also), it looks like a loopback but is not , at least in the original loopback interface meaning. Why not using enqueue instead for reclassification? Alex On 25 November 2014 at 15:48, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 11/25/2014 03:30 PM, Alexandru Badicioiu wrote: What is a self-contained application? An application which uses only ODP calls? I mean an application that doesn't need any external equipment. Regarding the classification tests and loopbacks, why there's a need for a special kind of ODP loopback interface? Why the following scenario is not acceptable for a test - open a pktio (ethernet), configure it in loopback mode and transmit the test traffic over the pktio with odp_pktio_send(), for example. It can work this way also for test, but consider a use-case: application processes IPsec tunneled traffic and after decryption it wants to reclassify a packet. We agreed before that such reclassification will be done via some loopback pktio interface. Should it be a real physical interface in a loopback mode or it can be a special kind of loopback? ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 1/2] pktio: mac addr functions
Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- Implement mac function according to pktio log: https://docs.google.com/document/d/1EHU54p3Kaa-hGUG-W7xquDfQb3aSWF3fEtwmcv5Bts8/edit#heading=h.b8vg8t31zjwt platform/linux-generic/include/api/odp_packet_io.h | 24 platform/linux-generic/odp_packet_io.c | 66 ++ 2 files changed, 90 insertions(+) diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index c9b0889..d6a6067 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -183,6 +183,30 @@ int odp_pktio_promisc_disable(odp_pktio_t id); int odp_pktio_promisc_get_enabled(odp_pktio_t id); /** + * Set the default MAC address of a packet IO interface. + * + * @param[in] id ODP packet IO handle. + * @param[in] mac_addr MAC address to be assigned to the interface. + * @param[in] addr_size Size of the address in bytes. + * + * @return 0 on success, -1 on error. + */ +int odp_pktio_set_mac_addr(odp_pktio_t id, const unsigned char *mac_addr, + size_t addr_size); + +/** + * Get the default MAC address of a packet IO interface. + * + * @param[in] idODP packet IO handle. + * @param[out] mac_addr Storage for MAC address of the packet IO interface. + * @param[out] addr_size Size of the MAC address. + * + * @return 0 on success, -1 on error. + */ +int odp_pktio_get_mac_addr(odp_pktio_t id, unsigned char *mac_addr, + size_t *addr_size); + +/** * @} */ diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 937f7f0..909cd32 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -21,6 +21,7 @@ #include string.h #include sys/ioctl.h +#include linux/if_arp.h typedef struct { pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES]; @@ -650,3 +651,68 @@ int odp_pktio_promisc_get_enabled(odp_pktio_t id) else return 0; } + +int odp_pktio_set_mac_addr(odp_pktio_t id, const unsigned char *mac_addr, + size_t addr_size) +{ + pktio_entry_t *entry; + int sockfd; + struct ifreq ifr; + int ret; + + entry = get_entry(id); + if (entry == NULL) { + ODP_DBG(pktio entry %d does not exist\n, id); + return -1; + } + + if (entry-s.pkt_sock_mmap.sockfd) + sockfd = entry-s.pkt_sock_mmap.sockfd; + else + sockfd = entry-s.pkt_sock.sockfd; + + strncpy(ifr.ifr_name, entry-s.name, IFNAMSIZ); + memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, addr_size); + ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; + + ret = ioctl(sockfd, SIOCSIFHWADDR, ifr); + if (ret 0) { + ODP_DBG(ioctl SIOCSIFHWADDR error\n); + return -1; + } + + return 0; +} + +int odp_pktio_get_mac_addr(odp_pktio_t id, unsigned char *mac_addr, + size_t *addr_size) +{ + pktio_entry_t *entry; + int sockfd; + struct ifreq ifr; + int ret; + + entry = get_entry(id); + if (entry == NULL) { + ODP_DBG(pktio entry %d does not exist\n, id); + return -1; + } + + if (entry-s.pkt_sock_mmap.sockfd) + sockfd = entry-s.pkt_sock_mmap.sockfd; + else + sockfd = entry-s.pkt_sock.sockfd; + + strncpy(ifr.ifr_name, entry-s.name, IFNAMSIZ); + + ret = ioctl(sockfd, SIOCGIFHWADDR, ifr); + if (ret 0) { + ODP_DBG(ioctl SIOCGIFHWADDR error\n); + return -1; + } + + *addr_size = ETH_ALEN; + memcpy(mac_addr, (unsigned char *)ifr.ifr_ifru.ifru_hwaddr.sa_data, + ETH_ALEN); + return 0; +} -- 1.8.5.1.163.gd7aced9 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 2/2] cunit: add mac test
Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- test/validation/odp_pktio.c | 50 + 1 file changed, 50 insertions(+) diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index e26d820..fe22050 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -6,6 +6,7 @@ #include odp.h #include CUnit/Basic.h +#include linux/if_ether.h #define SHM_PKT_POOL_SIZE (512 * 2048 * 2) #define SHM_PKT_POOL_BUF_SIZE (1024 * 32) @@ -15,6 +16,49 @@ static odp_pktio_t pktio; +static void test_pktio_mac(void) +{ + unsigned char mac_addr[ETH_ALEN]; + unsigned char def_mac_addr[ETH_ALEN]; + size_t mac_len; + int ret; + int i; + + ret = odp_pktio_get_mac_addr(pktio, mac_addr, + mac_len); + CU_ASSERT(0 == ret); + CU_ASSERT(ETH_ALEN == mac_len); + + printf( %X:%X:%X:%X:%X:%X , + mac_addr[0], mac_addr[1], mac_addr[2], + mac_addr[3], mac_addr[4], mac_addr[5]); + + /* save original mac addr */ + memcpy(def_mac_addr, mac_addr, ETH_ALEN); + + /* Modify addr */ + for (i = 0; i ETH_ALEN; i++) + mac_addr[i] = i * 2; + + ret = odp_pktio_set_mac_addr(pktio, mac_addr, ETH_ALEN); + CU_ASSERT(0 == ret); + + /* Verify */ + ret = odp_pktio_get_mac_addr(pktio, mac_addr, + mac_len); + CU_ASSERT(0 == ret); + CU_ASSERT(ETH_ALEN == mac_len); + + for (i = 0; i ETH_ALEN; i++) + CU_ASSERT(mac_addr[i] == (i * 2)); + + /* Restore original mac */ + ret = odp_pktio_set_mac_addr(pktio, def_mac_addr, ETH_ALEN); + CU_ASSERT(0 == ret); + + return; +} + static void test_pktio_mtu(void) { int i; @@ -152,6 +196,12 @@ int main(void) return CU_get_error(); } + ptest = CU_ADD_TEST(ptr_suite, test_pktio_mac); + if (NULL == ptest) { + CU_cleanup_registry(); + return CU_get_error(); + } + /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); -- 1.8.5.1.163.gd7aced9 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] API: crypto: Remove unused async API
Reviewed-by: Robert King robk...@cisco.com From: lng-odp-boun...@lists.linaro.org [lng-odp-boun...@lists.linaro.org] on behalf of Mike Holmes [mike.hol...@linaro.org] Sent: Monday, November 24, 2014 12:18 PM To: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH] API: crypto: Remove unused async API For the 1.0 release there are no platforms using the async API. With no way to test these APIs they should be removed until needed. Signed-off-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/include/api/odp_crypto.h | 44 - platform/linux-generic/odp_crypto.c | 32 -- 2 files changed, 76 deletions(-) diff --git a/platform/linux-generic/include/api/odp_crypto.h b/platform/linux-generic/include/api/odp_crypto.h index 4741bcb..337e7cf 100644 --- a/platform/linux-generic/include/api/odp_crypto.h +++ b/platform/linux-generic/include/api/odp_crypto.h @@ -225,50 +225,6 @@ odp_crypto_session_create(odp_crypto_session_params_t *params, odp_crypto_session_t *session, enum odp_crypto_ses_create_err *status); -/** - * Crypto session creation (asynchronous) - * - * Initiate crypto session creation. Results are delivered using - * the completion event via the completion queue. - * - * @param paramsSession parameters - * @param completion_event Event by which the session creation results are - * delivered. - * @param completion_queue Queue by which the completion event will be - * delivered. - * - * @return 0 if successful else -1 - * - */ -int -odp_crypto_session_create_async(odp_crypto_session_params_t *params, - odp_buffer_t completion_event, - odp_queue_t completion_queue); - - -/** - * Crypto session creation completion status - * - * Accessor function for obtaining creation status from the completion event. - * - * @param completion_event Event containing operation results - * @param statusPointer to store creation return code - */ -void -odp_crypto_get_ses_create_compl_status(odp_buffer_t completion_event, - enum odp_crypto_ses_create_err *status); - -/** - * Crypto session creation completion return value - * - * Accessor function for obtaining handle for newly created session. - * - * @param completion_event Event containing operation results - * @param session Pointer to store session handle - */ -void -odp_crypto_get_ses_create_compl_session(odp_buffer_t completion_event, - odp_crypto_session_t *session); /** * Crypto per packet operation diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 9ca2251..d3cdec7 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -334,19 +334,6 @@ odp_crypto_session_create(odp_crypto_session_params_t *params, return 0; } -int -odp_crypto_session_create_async(odp_crypto_session_params_t *params, - odp_buffer_t completion_event, - odp_queue_t completion_queue) -{ - odp_crypto_generic_session_result_t *result; - - result = odp_buffer_addr(completion_event); - if (odp_crypto_session_create(params, result-session, result-rc)) - return -1; - odp_queue_enq(completion_queue, completion_event); - return 0; -} int odp_crypto_operation(odp_crypto_op_params_t *params, @@ -451,25 +438,6 @@ odp_crypto_get_operation_compl_status(odp_buffer_t completion_event, memcpy(cipher, result-cipher, sizeof(*cipher)); } -void -odp_crypto_get_ses_create_compl_status(odp_buffer_t completion_event, - enum odp_crypto_ses_create_err *status) -{ - odp_crypto_generic_session_result_t *result; - - result = odp_buffer_addr(completion_event); - *status = result-rc; -} - -void -odp_crypto_get_ses_create_compl_session(odp_buffer_t completion_event, - odp_crypto_session_t *session) -{ - odp_crypto_generic_session_result_t *result; - - result = odp_buffer_addr(completion_event); - *session = result-session; -} void odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event ODP_UNUSED, -- 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] UberConference Reminder
UberConference Reminder___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] API: crypto: Remove unused async API
Merged, Maxim. On 11/24/2014 08:18 PM, Mike Holmes wrote: For the 1.0 release there are no platforms using the async API. With no way to test these APIs they should be removed until needed. Signed-off-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/include/api/odp_crypto.h | 44 - platform/linux-generic/odp_crypto.c | 32 -- 2 files changed, 76 deletions(-) diff --git a/platform/linux-generic/include/api/odp_crypto.h b/platform/linux-generic/include/api/odp_crypto.h index 4741bcb..337e7cf 100644 --- a/platform/linux-generic/include/api/odp_crypto.h +++ b/platform/linux-generic/include/api/odp_crypto.h @@ -225,50 +225,6 @@ odp_crypto_session_create(odp_crypto_session_params_t *params, odp_crypto_session_t *session, enum odp_crypto_ses_create_err *status); -/** - * Crypto session creation (asynchronous) - * - * Initiate crypto session creation. Results are delivered using - * the completion event via the completion queue. - * - * @param paramsSession parameters - * @param completion_event Event by which the session creation results are - * delivered. - * @param completion_queue Queue by which the completion event will be - * delivered. - * - * @return 0 if successful else -1 - * - */ -int -odp_crypto_session_create_async(odp_crypto_session_params_t *params, - odp_buffer_t completion_event, - odp_queue_t completion_queue); - - -/** - * Crypto session creation completion status - * - * Accessor function for obtaining creation status from the completion event. - * - * @param completion_event Event containing operation results - * @param statusPointer to store creation return code - */ -void -odp_crypto_get_ses_create_compl_status(odp_buffer_t completion_event, - enum odp_crypto_ses_create_err *status); - -/** - * Crypto session creation completion return value - * - * Accessor function for obtaining handle for newly created session. - * - * @param completion_event Event containing operation results - * @param session Pointer to store session handle - */ -void -odp_crypto_get_ses_create_compl_session(odp_buffer_t completion_event, - odp_crypto_session_t *session); /** * Crypto per packet operation diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 9ca2251..d3cdec7 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -334,19 +334,6 @@ odp_crypto_session_create(odp_crypto_session_params_t *params, return 0; } -int -odp_crypto_session_create_async(odp_crypto_session_params_t *params, - odp_buffer_t completion_event, - odp_queue_t completion_queue) -{ - odp_crypto_generic_session_result_t *result; - - result = odp_buffer_addr(completion_event); - if (odp_crypto_session_create(params, result-session, result-rc)) - return -1; - odp_queue_enq(completion_queue, completion_event); - return 0; -} int odp_crypto_operation(odp_crypto_op_params_t *params, @@ -451,25 +438,6 @@ odp_crypto_get_operation_compl_status(odp_buffer_t completion_event, memcpy(cipher, result-cipher, sizeof(*cipher)); } -void -odp_crypto_get_ses_create_compl_status(odp_buffer_t completion_event, - enum odp_crypto_ses_create_err *status) -{ - odp_crypto_generic_session_result_t *result; - - result = odp_buffer_addr(completion_event); - *status = result-rc; -} - -void -odp_crypto_get_ses_create_compl_session(odp_buffer_t completion_event, - odp_crypto_session_t *session) -{ - odp_crypto_generic_session_result_t *result; - - result = odp_buffer_addr(completion_event); - *session = result-session; -} void odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event ODP_UNUSED, ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/2] platform: debug: Simplify ODP_LOG() macro
On 11/24/2014 02:05 PM, Maxim Uvarov wrote: Do weak symbols work also for dynamic linking? It does work for dynamic libraries also. I've found an issue in ODP_UNIMPLEMENTED() macro. Will post v2. ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv2 2/2] platform: debug: Simplify ODP_LOG() macro
Move additional functionality out of ODP_LOG. Move abort() call to odp_override_log(), so application will be able to implement custom abort handling. Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org --- platform/linux-generic/include/api/odp_debug.h | 37 .../linux-generic/include/odp_debug_internal.h |6 ++-- platform/linux-generic/odp_weak.c |5 ++- 3 files changed, 14 insertions(+), 34 deletions(-) diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h index cb5bc83..0fbd6b9 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -99,36 +99,8 @@ extern int odp_override_log(odp_log_level_e level, const char *fmt, ...); * ODP LOG macro. */ #define ODP_LOG(level, fmt, ...) \ -do { \ - switch (level) { \ - case ODP_LOG_ERR: \ - odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_DBG: \ - if (ODP_DEBUG_PRINT == 1) \ - odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_PRINT: \ - odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_ABORT: \ - odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - abort(); \ - break; \ - case ODP_LOG_UNIMPLEMENTED: \ - odp_override_log(level, \ - %s:%d:The function %s() is not implemented\n \ - fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - default: \ - odp_override_log(level, Unknown LOG level); \ - break;\ - } \ -} while (0) + odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ + __LINE__, __func__, ##__VA_ARGS__) /** * Log print message when the application calls one of the ODP APIs @@ -141,7 +113,10 @@ do { \ * Log debug message if DEBUG flag is set. */ #define ODP_DBG(fmt, ...) \ - ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__) + do { \ + if (ODP_DEBUG_PRINT == 1) \ + ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\ + } while (0) /** * Log error message. diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index a87552f..ee3c543 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -25,8 +25,10 @@ extern C { /** * This macro is used to indicate when a given function is not implemented */ -#define ODP_UNIMPLEMENTED(fmt, ...) \ - ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__) +#define ODP_UNIMPLEMENTED() \ + odp_override_log(ODP_LOG_UNIMPLEMENTED, \ + %s:%d:The function %s() is not implemented\n, \ + __FILE__, __LINE__, __func__) #ifdef __cplusplus } diff --git a/platform/linux-generic/odp_weak.c b/platform/linux-generic/odp_weak.c index fccbc3f..3cc3d45 100644 --- a/platform/linux-generic/odp_weak.c +++ b/platform/linux-generic/odp_weak.c @@ -9,7 +9,7 @@ #include odp_debug_internal.h #include odp_hints.h -ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level ODP_UNUSED, +ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level, const char *fmt, ...) { va_list args; @@ -19,5 +19,8 @@ ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level ODP_UNUSED, r = vfprintf(stderr, fmt, args); va_end(args); + if (level == ODP_LOG_ABORT) + abort(); + return r; } -- 1.7.9.5 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv2 1/2] platform: debug: replace fprintf() with odp_override_log()
ODP application may want to override default ODP logging behaviour and use custom logging function. Add a weak odp_override_log() function for this purpose instead of default fprintf(). Signed-off-by: Taras Kondratiuk taras.kondrat...@linaro.org --- platform/linux-generic/Makefile.am |3 +- platform/linux-generic/include/api/odp_debug.h | 41 platform/linux-generic/odp_weak.c | 23 + 3 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 platform/linux-generic/odp_weak.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index e709700..cc78de3 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -75,4 +75,5 @@ __LIB__libodp_la_SOURCES = \ odp_thread.c \ odp_ticketlock.c \ odp_time.c \ - odp_timer.c + odp_timer.c \ + odp_weak.c diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h index 5c3adde..cb5bc83 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -14,6 +14,7 @@ #include stdio.h #include stdlib.h +#include stdarg.h #ifdef __cplusplus extern C { @@ -81,62 +82,76 @@ typedef enum odp_log_level { } odp_log_level_e; /** - * ODP default LOG macro. + * ODP log function + * + * Instead of direct prints to stdout/stderr all logging in ODP implementation + * should be done via this function or its wrappers. + * ODP platform MUST provide a default *weak* implementation of this function. + * Application MAY override the function if needed by providing a strong + * function. + * + * @param level Log level + * @param fmt printf-style message format + */ +extern int odp_override_log(odp_log_level_e level, const char *fmt, ...); + +/** + * ODP LOG macro. */ #define ODP_LOG(level, fmt, ...) \ do { \ switch (level) { \ case ODP_LOG_ERR: \ - fprintf(stderr, %s:%d:%s(): fmt, __FILE__, \ + odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ __LINE__, __func__, ##__VA_ARGS__); \ break; \ case ODP_LOG_DBG: \ if (ODP_DEBUG_PRINT == 1) \ - fprintf(stderr, %s:%d:%s(): fmt, __FILE__, \ + odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ __LINE__, __func__, ##__VA_ARGS__); \ break; \ case ODP_LOG_PRINT: \ - fprintf(stdout, %s:%d:%s(): fmt, __FILE__, \ + odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ __LINE__, __func__, ##__VA_ARGS__); \ break; \ case ODP_LOG_ABORT: \ - fprintf(stderr, %s:%d:%s(): fmt, __FILE__, \ + odp_override_log(level, %s:%d:%s(): fmt, __FILE__, \ __LINE__, __func__, ##__VA_ARGS__); \ abort(); \ break; \ case ODP_LOG_UNIMPLEMENTED: \ - fprintf(stderr, \ + odp_override_log(level, \ %s:%d:The function %s() is not implemented\n \ fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); \ break; \ default: \ - fprintf(stderr, Unknown LOG level); \ + odp_override_log(level, Unknown LOG level); \ break;\ } \ } while (0) /** - * Printing macro, which prints output when the application - * calls one of the ODP APIs specifically for dumping internal data. + * Log print message when the application calls one of the ODP APIs + * specifically for dumping internal data. */ #define ODP_PRINT(fmt, ...) \ ODP_LOG(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) /** - * Debug printing macro, which prints output when DEBUG flag is set. + * Log debug message if DEBUG flag is set. */ #define ODP_DBG(fmt, ...) \ ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__) /** - * Print output to stderr (file, line and function). + * Log error message. */ #define ODP_ERR(fmt, ...) \ ODP_LOG(ODP_LOG_ERR, fmt, ##__VA_ARGS__) /** - * Print output to stderr (file, line and function), - * then abort. + * Log abort message and then stop execution (by default call abort()). + * This function should not return. */ #define ODP_ABORT(fmt, ...) \ ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__) diff --git a/platform/linux-generic/odp_weak.c b/platform/linux-generic/odp_weak.c new file mode 100644 index 000..fccbc3f --- /dev/null +++ b/platform/linux-generic/odp_weak.c @@ -0,0 +1,23 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include odp_internal.h +#include
Re: [lng-odp] [PATCH 2/2] Uplevel odp_packet_flags.h and implementation to ODP v1.0 level
The entire patch set: Reviewed-by: Petri Savolainen petri.savolai...@linaro.org -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Bill Fischofer Sent: Tuesday, November 18, 2014 12:59 AM To: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 2/2] Uplevel odp_packet_flags.h and implementation to ODP v1.0 level This patch implements the specified odp_packet_flags.h API name changes for ODP v1.0. Signed-off-by: Bill Fischofer bill.fischo...@linaro.org --- .../linux-generic/include/api/odp_packet_flags.h | 70 +++-- - platform/linux-generic/odp_packet_flags.c | 70 +++-- - 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index ccaa04f..6e5d394 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -50,7 +50,7 @@ int odp_packet_errflag_frame_len(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid known L2 header, 0 otherwise */ -int odp_packet_inflag_l2(odp_packet_t pkt); +int odp_packet_has_l2(odp_packet_t pkt); /** * Check for L3 header, e.g. IPv4, IPv6 @@ -58,7 +58,7 @@ int odp_packet_inflag_l2(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid known L3 header, 0 otherwise */ -int odp_packet_inflag_l3(odp_packet_t pkt); +int odp_packet_has_l3(odp_packet_t pkt); /** * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP) @@ -66,7 +66,7 @@ int odp_packet_inflag_l3(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid known L4 header, 0 otherwise */ -int odp_packet_inflag_l4(odp_packet_t pkt); +int odp_packet_has_l4(odp_packet_t pkt); /** * Check for Ethernet header @@ -74,7 +74,7 @@ int odp_packet_inflag_l4(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid eth header, 0 otherwise */ -int odp_packet_inflag_eth(odp_packet_t pkt); +int odp_packet_has_eth(odp_packet_t pkt); /** * Check for jumbo frame @@ -82,7 +82,7 @@ int odp_packet_inflag_eth(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains jumbo frame, 0 otherwise */ -int odp_packet_inflag_jumbo(odp_packet_t pkt); +int odp_packet_has_jumbo(odp_packet_t pkt); /** * Check for VLAN @@ -90,7 +90,7 @@ int odp_packet_inflag_jumbo(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a VLAN header, 0 otherwise */ -int odp_packet_inflag_vlan(odp_packet_t pkt); +int odp_packet_has_vlan(odp_packet_t pkt); /** * Check for VLAN QinQ (stacked VLAN) @@ -98,7 +98,7 @@ int odp_packet_inflag_vlan(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a VLAN QinQ header, 0 otherwise */ -int odp_packet_inflag_vlan_qinq(odp_packet_t pkt); +int odp_packet_has_vlan_qinq(odp_packet_t pkt); /** * Check for ARP @@ -106,7 +106,7 @@ int odp_packet_inflag_vlan_qinq(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an ARP header, 0 otherwise */ -int odp_packet_inflag_arp(odp_packet_t pkt); +int odp_packet_has_arp(odp_packet_t pkt); /** * Check for IPv4 @@ -114,7 +114,7 @@ int odp_packet_inflag_arp(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an IPv4 header, 0 otherwise */ -int odp_packet_inflag_ipv4(odp_packet_t pkt); +int odp_packet_has_ipv4(odp_packet_t pkt); /** * Check for IPv6 @@ -122,7 +122,7 @@ int odp_packet_inflag_ipv4(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an IPv6 header, 0 otherwise */ -int odp_packet_inflag_ipv6(odp_packet_t pkt); +int odp_packet_has_ipv6(odp_packet_t pkt); /** * Check for IP fragment @@ -130,7 +130,7 @@ int odp_packet_inflag_ipv6(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet is an IP fragment, 0 otherwise */ -int odp_packet_inflag_ipfrag(odp_packet_t pkt); +int odp_packet_has_ipfrag(odp_packet_t pkt); /** * Check for IP options @@ -138,7 +138,7 @@ int odp_packet_inflag_ipfrag(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains IP options, 0 otherwise */ -int odp_packet_inflag_ipopt(odp_packet_t pkt); +int odp_packet_has_ipopt(odp_packet_t pkt); /** * Check for IPSec @@ -146,7 +146,7 @@ int odp_packet_inflag_ipopt(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet requires IPSec processing, 0 otherwise */ -int odp_packet_inflag_ipsec(odp_packet_t pkt); +int odp_packet_has_ipsec(odp_packet_t pkt); /** * Check for UDP @@ -154,7 +154,7 @@ int odp_packet_inflag_ipsec(odp_packet_t pkt); * @param pkt Packet handle
Re: [lng-odp] ODP Dataplane conference call Agenda
Meeting notes Short meeting with a focus on getting to 1.0 - Plan is for cunit test coverage for 100% API calls ASAP then cut 0.4.0 - Priority - Fix small ODP 1.0 items and cut 0.5.0 - possible additional point releases as the short list of remaining big changes go in. - Discussed cunit problem not returning its status when tests/suites fail - Discussed the need for a pktio interface that all platforms can provide. - Barry has 1st draft unit tests available - Atomic to go in today - Removing unused Crypto functions to go in today - Need to push weak symbols for ODP_LOG and ODP_ABORT and make odp_debug.h internal - Mario from ARM available for a while to help with ODP 1.0 On 24 November 2014 at 12:48, Mike Holmes mike.hol...@linaro.org wrote: http://www.uberconference.com/opendataplane 10.00am ET GMT-05:00 Agenda: 1. The push to complete the unit testing coverage for linux-generic 2. The push to reduce the scope of changes to tip for the 1.0 API 3. Possibility of delaying 1.0 4. API discussions 5. Any other business Mike -- Mike Holmes Linaro Sr Technical Manager LNG - ODP -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v3 0/9] Type-safe and relaxed atomics
Patch set is merged. From now we have requirement to use gcc-4.7 and up. For old ubuntu systems you can install new gcc in that way: http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7 Thanks, Maxim. On 11/25/2014 01:38 AM, Ola Liljedahl wrote: Patch set restructured (thanks git add -p), patches should build if applied incrementially. Some of these changes are in preparation for the appearance of odp_atomic_internal.h but these patch can be merged separately. odp_atomic.h: Use struct for 32- and 64-bit atomic types, this prevents non-atomic access to atomic variables. Emulated 64-bit atomic support for functionally challenged 32-bit architectures (e.g. PPC32). Relaxed memory model for atomic operations, this enhances performance on weakly ordered architectures (e.g. most RISC). Use GCC __atomic builtins (previously __sync builtins). Added missing atomic_add_u32, atomic_sub_u32 and atomic_sub_64 operations. Removed 32- and 64-bit cmpset operations. Made some 64-bit operations (e.g. load, store) atomic on 32-bit architectures. odp_generator.c: updated to use odp_atomic.h functins with atomic types. odp_spin_internal.h: removed odp_mem_barrier() which is a compiler only barrier and basically useless and dangerous on all weakly ordered architectures. odp_barrier.c: updated to use odp_atomic.h types and functions. Made the wrap-around atomic. Restored a missing line that was lost to a later patch. odp_buffer.c: updated to use odp_atomic.h functions (ref_count). odp_ring.c: added missing release barriers. Updated to use GCC __atomic cmpset facility (temporary fix). odp_rwlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). odp_ticketlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). Added missing barrier in ticketlock_lock(). odp_atomic_test.c: update to conform to latest odp_atomic.h syntax. Added usage of odp_barrier_t instead of home grown thread barrier. Updated some descriptions and help texts. Ola Liljedahl (9): linux-generic: odp_ring.c use __atomic linux-generic: odp_rwlock.c use __atomic linux-generic: odp_buffer.c use odp_atomic.h linux-generic: odp_barrier.c use __atomic linux-generic: odp_generator.c use odp_atomic.h linux-generic: odp_ticketlock.c use odp_atomic.h and __atomic test: odp_atomic_test.c: use odp_barrier, fix descriptions api: odp_atomic.h: struct type, relaxed mm, missing funcs, use __atomic linux-generic: odp_spin_internal.h: remove odp_mem_barrier example/generator/odp_generator.c | 24 +- platform/linux-generic/include/api/odp_atomic.h| 271 + platform/linux-generic/include/odp_spin_internal.h | 9 - platform/linux-generic/odp_barrier.c | 17 +- platform/linux-generic/odp_buffer.c| 3 +- platform/linux-generic/odp_ring.c | 28 ++- platform/linux-generic/odp_rwlock.c| 24 +- platform/linux-generic/odp_ticketlock.c| 14 +- test/api_test/odp_atomic_test.c| 48 ++-- 9 files changed, 260 insertions(+), 178 deletions(-) ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v3 0/9] Type-safe and relaxed atomics
Thanks. What's the status on odp_atomic_internal.h? That's what's needed for lockless data structure manipulation. Bill On Tue, Nov 25, 2014 at 9:29 AM, Maxim Uvarov maxim.uva...@linaro.org wrote: Patch set is merged. From now we have requirement to use gcc-4.7 and up. For old ubuntu systems you can install new gcc in that way: http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7 Thanks, Maxim. On 11/25/2014 01:38 AM, Ola Liljedahl wrote: Patch set restructured (thanks git add -p), patches should build if applied incrementially. Some of these changes are in preparation for the appearance of odp_atomic_internal.h but these patch can be merged separately. odp_atomic.h: Use struct for 32- and 64-bit atomic types, this prevents non-atomic access to atomic variables. Emulated 64-bit atomic support for functionally challenged 32-bit architectures (e.g. PPC32). Relaxed memory model for atomic operations, this enhances performance on weakly ordered architectures (e.g. most RISC). Use GCC __atomic builtins (previously __sync builtins). Added missing atomic_add_u32, atomic_sub_u32 and atomic_sub_64 operations. Removed 32- and 64-bit cmpset operations. Made some 64-bit operations (e.g. load, store) atomic on 32-bit architectures. odp_generator.c: updated to use odp_atomic.h functins with atomic types. odp_spin_internal.h: removed odp_mem_barrier() which is a compiler only barrier and basically useless and dangerous on all weakly ordered architectures. odp_barrier.c: updated to use odp_atomic.h types and functions. Made the wrap-around atomic. Restored a missing line that was lost to a later patch. odp_buffer.c: updated to use odp_atomic.h functions (ref_count). odp_ring.c: added missing release barriers. Updated to use GCC __atomic cmpset facility (temporary fix). odp_rwlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). odp_ticketlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). Added missing barrier in ticketlock_lock(). odp_atomic_test.c: update to conform to latest odp_atomic.h syntax. Added usage of odp_barrier_t instead of home grown thread barrier. Updated some descriptions and help texts. Ola Liljedahl (9): linux-generic: odp_ring.c use __atomic linux-generic: odp_rwlock.c use __atomic linux-generic: odp_buffer.c use odp_atomic.h linux-generic: odp_barrier.c use __atomic linux-generic: odp_generator.c use odp_atomic.h linux-generic: odp_ticketlock.c use odp_atomic.h and __atomic test: odp_atomic_test.c: use odp_barrier, fix descriptions api: odp_atomic.h: struct type, relaxed mm, missing funcs, use __atomic linux-generic: odp_spin_internal.h: remove odp_mem_barrier example/generator/odp_generator.c | 24 +- platform/linux-generic/include/api/odp_atomic.h| 271 + platform/linux-generic/include/odp_spin_internal.h | 9 - platform/linux-generic/odp_barrier.c | 17 +- platform/linux-generic/odp_buffer.c| 3 +- platform/linux-generic/odp_ring.c | 28 ++- platform/linux-generic/odp_rwlock.c| 24 +- platform/linux-generic/odp_ticketlock.c| 14 +- test/api_test/odp_atomic_test.c| 48 ++-- 9 files changed, 260 insertions(+), 178 deletions(-) ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v3 0/9] Type-safe and relaxed atomics
On 11/25/2014 06:36 PM, Bill Fischofer wrote: Thanks. What's the status on odp_atomic_internal.h? That's what's needed for lockless data structure manipulation. Bill Do you mean odp_spin_internal.h ? It's gone. Maxim. On Tue, Nov 25, 2014 at 9:29 AM, Maxim Uvarov maxim.uva...@linaro.org mailto:maxim.uva...@linaro.org wrote: Patch set is merged. From now we have requirement to use gcc-4.7 and up. For old ubuntu systems you can install new gcc in that way: http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7 Thanks, Maxim. On 11/25/2014 01:38 AM, Ola Liljedahl wrote: Patch set restructured (thanks git add -p), patches should build if applied incrementially. Some of these changes are in preparation for the appearance of odp_atomic_internal.h but these patch can be merged separately. odp_atomic.h: Use struct for 32- and 64-bit atomic types, this prevents non-atomic access to atomic variables. Emulated 64-bit atomic support for functionally challenged 32-bit architectures (e.g. PPC32). Relaxed memory model for atomic operations, this enhances performance on weakly ordered architectures (e.g. most RISC). Use GCC __atomic builtins (previously __sync builtins). Added missing atomic_add_u32, atomic_sub_u32 and atomic_sub_64 operations. Removed 32- and 64-bit cmpset operations. Made some 64-bit operations (e.g. load, store) atomic on 32-bit architectures. odp_generator.c: updated to use odp_atomic.h functins with atomic types. odp_spin_internal.h: removed odp_mem_barrier() which is a compiler only barrier and basically useless and dangerous on all weakly ordered architectures. odp_barrier.c: updated to use odp_atomic.h types and functions. Made the wrap-around atomic. Restored a missing line that was lost to a later patch. odp_buffer.c: updated to use odp_atomic.h functions (ref_count). odp_ring.c: added missing release barriers. Updated to use GCC __atomic cmpset facility (temporary fix). odp_rwlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). odp_ticketlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). Added missing barrier in ticketlock_lock(). odp_atomic_test.c: update to conform to latest odp_atomic.h syntax. Added usage of odp_barrier_t instead of home grown thread barrier. Updated some descriptions and help texts. Ola Liljedahl (9): linux-generic: odp_ring.c use __atomic linux-generic: odp_rwlock.c use __atomic linux-generic: odp_buffer.c use odp_atomic.h linux-generic: odp_barrier.c use __atomic linux-generic: odp_generator.c use odp_atomic.h linux-generic: odp_ticketlock.c use odp_atomic.h and __atomic test: odp_atomic_test.c: use odp_barrier, fix descriptions api: odp_atomic.h: struct type, relaxed mm, missing funcs, use __atomic linux-generic: odp_spin_internal.h: remove odp_mem_barrier example/generator/odp_generator.c | 24 +- platform/linux-generic/include/api/odp_atomic.h| 271 + platform/linux-generic/include/odp_spin_internal.h | 9 - platform/linux-generic/odp_barrier.c | 17 +- platform/linux-generic/odp_buffer.c | 3 +- platform/linux-generic/odp_ring.c | 28 ++- platform/linux-generic/odp_rwlock.c | 24 +- platform/linux-generic/odp_ticketlock.c | 14 +- test/api_test/odp_atomic_test.c | 48 ++-- 9 files changed, 260 insertions(+), 178 deletions(-) ___ lng-odp mailing list lng-odp@lists.linaro.org mailto:lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v3 0/9] Type-safe and relaxed atomics
Real soon now. Testing the stuff on ARM. Will then create the patch set and send out. If nothing unexpected happens, expect it to be posted tonight CET. -- Ola On 25 November 2014 at 16:36, Bill Fischofer bill.fischo...@linaro.org wrote: Thanks. What's the status on odp_atomic_internal.h? That's what's needed for lockless data structure manipulation. Bill On Tue, Nov 25, 2014 at 9:29 AM, Maxim Uvarov maxim.uva...@linaro.org wrote: Patch set is merged. From now we have requirement to use gcc-4.7 and up. For old ubuntu systems you can install new gcc in that way: http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7 Thanks, Maxim. On 11/25/2014 01:38 AM, Ola Liljedahl wrote: Patch set restructured (thanks git add -p), patches should build if applied incrementially. Some of these changes are in preparation for the appearance of odp_atomic_internal.h but these patch can be merged separately. odp_atomic.h: Use struct for 32- and 64-bit atomic types, this prevents non-atomic access to atomic variables. Emulated 64-bit atomic support for functionally challenged 32-bit architectures (e.g. PPC32). Relaxed memory model for atomic operations, this enhances performance on weakly ordered architectures (e.g. most RISC). Use GCC __atomic builtins (previously __sync builtins). Added missing atomic_add_u32, atomic_sub_u32 and atomic_sub_64 operations. Removed 32- and 64-bit cmpset operations. Made some 64-bit operations (e.g. load, store) atomic on 32-bit architectures. odp_generator.c: updated to use odp_atomic.h functins with atomic types. odp_spin_internal.h: removed odp_mem_barrier() which is a compiler only barrier and basically useless and dangerous on all weakly ordered architectures. odp_barrier.c: updated to use odp_atomic.h types and functions. Made the wrap-around atomic. Restored a missing line that was lost to a later patch. odp_buffer.c: updated to use odp_atomic.h functions (ref_count). odp_ring.c: added missing release barriers. Updated to use GCC __atomic cmpset facility (temporary fix). odp_rwlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). odp_ticketlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). Added missing barrier in ticketlock_lock(). odp_atomic_test.c: update to conform to latest odp_atomic.h syntax. Added usage of odp_barrier_t instead of home grown thread barrier. Updated some descriptions and help texts. Ola Liljedahl (9): linux-generic: odp_ring.c use __atomic linux-generic: odp_rwlock.c use __atomic linux-generic: odp_buffer.c use odp_atomic.h linux-generic: odp_barrier.c use __atomic linux-generic: odp_generator.c use odp_atomic.h linux-generic: odp_ticketlock.c use odp_atomic.h and __atomic test: odp_atomic_test.c: use odp_barrier, fix descriptions api: odp_atomic.h: struct type, relaxed mm, missing funcs, use __atomic linux-generic: odp_spin_internal.h: remove odp_mem_barrier example/generator/odp_generator.c | 24 +- platform/linux-generic/include/api/odp_atomic.h| 271 + platform/linux-generic/include/odp_spin_internal.h | 9 - platform/linux-generic/odp_barrier.c | 17 +- platform/linux-generic/odp_buffer.c| 3 +- platform/linux-generic/odp_ring.c | 28 ++- platform/linux-generic/odp_rwlock.c| 24 +- platform/linux-generic/odp_ticketlock.c| 14 +- test/api_test/odp_atomic_test.c| 48 ++-- 9 files changed, 260 insertions(+), 178 deletions(-) ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/2] Uplevel odp_packet_flags.h and implementation to ODP v1.0 level
That chunk also needs to go together with api change. Maxim. On 11/25/2014 06:22 PM, Savolainen, Petri (NSN - FI/Espoo) wrote: The entire patch set: Reviewed-by: Petri Savolainen petri.savolai...@linaro.org -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Bill Fischofer Sent: Tuesday, November 18, 2014 12:59 AM To: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH 2/2] Uplevel odp_packet_flags.h and implementation to ODP v1.0 level This patch implements the specified odp_packet_flags.h API name changes for ODP v1.0. Signed-off-by: Bill Fischofer bill.fischo...@linaro.org --- .../linux-generic/include/api/odp_packet_flags.h | 70 +++-- - platform/linux-generic/odp_packet_flags.c | 70 +++-- - 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index ccaa04f..6e5d394 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -50,7 +50,7 @@ int odp_packet_errflag_frame_len(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid known L2 header, 0 otherwise */ -int odp_packet_inflag_l2(odp_packet_t pkt); +int odp_packet_has_l2(odp_packet_t pkt); /** * Check for L3 header, e.g. IPv4, IPv6 @@ -58,7 +58,7 @@ int odp_packet_inflag_l2(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid known L3 header, 0 otherwise */ -int odp_packet_inflag_l3(odp_packet_t pkt); +int odp_packet_has_l3(odp_packet_t pkt); /** * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP) @@ -66,7 +66,7 @@ int odp_packet_inflag_l3(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid known L4 header, 0 otherwise */ -int odp_packet_inflag_l4(odp_packet_t pkt); +int odp_packet_has_l4(odp_packet_t pkt); /** * Check for Ethernet header @@ -74,7 +74,7 @@ int odp_packet_inflag_l4(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a valid eth header, 0 otherwise */ -int odp_packet_inflag_eth(odp_packet_t pkt); +int odp_packet_has_eth(odp_packet_t pkt); /** * Check for jumbo frame @@ -82,7 +82,7 @@ int odp_packet_inflag_eth(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains jumbo frame, 0 otherwise */ -int odp_packet_inflag_jumbo(odp_packet_t pkt); +int odp_packet_has_jumbo(odp_packet_t pkt); /** * Check for VLAN @@ -90,7 +90,7 @@ int odp_packet_inflag_jumbo(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a VLAN header, 0 otherwise */ -int odp_packet_inflag_vlan(odp_packet_t pkt); +int odp_packet_has_vlan(odp_packet_t pkt); /** * Check for VLAN QinQ (stacked VLAN) @@ -98,7 +98,7 @@ int odp_packet_inflag_vlan(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains a VLAN QinQ header, 0 otherwise */ -int odp_packet_inflag_vlan_qinq(odp_packet_t pkt); +int odp_packet_has_vlan_qinq(odp_packet_t pkt); /** * Check for ARP @@ -106,7 +106,7 @@ int odp_packet_inflag_vlan_qinq(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an ARP header, 0 otherwise */ -int odp_packet_inflag_arp(odp_packet_t pkt); +int odp_packet_has_arp(odp_packet_t pkt); /** * Check for IPv4 @@ -114,7 +114,7 @@ int odp_packet_inflag_arp(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an IPv4 header, 0 otherwise */ -int odp_packet_inflag_ipv4(odp_packet_t pkt); +int odp_packet_has_ipv4(odp_packet_t pkt); /** * Check for IPv6 @@ -122,7 +122,7 @@ int odp_packet_inflag_ipv4(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains an IPv6 header, 0 otherwise */ -int odp_packet_inflag_ipv6(odp_packet_t pkt); +int odp_packet_has_ipv6(odp_packet_t pkt); /** * Check for IP fragment @@ -130,7 +130,7 @@ int odp_packet_inflag_ipv6(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet is an IP fragment, 0 otherwise */ -int odp_packet_inflag_ipfrag(odp_packet_t pkt); +int odp_packet_has_ipfrag(odp_packet_t pkt); /** * Check for IP options @@ -138,7 +138,7 @@ int odp_packet_inflag_ipfrag(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet contains IP options, 0 otherwise */ -int odp_packet_inflag_ipopt(odp_packet_t pkt); +int odp_packet_has_ipopt(odp_packet_t pkt); /** * Check for IPSec @@ -146,7 +146,7 @@ int odp_packet_inflag_ipopt(odp_packet_t pkt); * @param pkt Packet handle * @return 1 if packet requires IPSec processing, 0 otherwise */ -int odp_packet_inflag_ipsec(odp_packet_t pkt); +int odp_packet_has_ipsec(odp_packet_t pkt); /** * Check for UDP @@ -154,7 +154,7 @@ int
Re: [lng-odp] [PATCH v3 0/9] Type-safe and relaxed atomics
odp_atomic_internal.h is a new internal header file with atomic operations with different memory models as required by lock-less programming and when implementing locks. odp_spin_internal.h is gone? Time for me to rebase! -- Ola On 25 November 2014 at 16:41, Maxim Uvarov maxim.uva...@linaro.org wrote: On 11/25/2014 06:36 PM, Bill Fischofer wrote: Thanks. What's the status on odp_atomic_internal.h? That's what's needed for lockless data structure manipulation. Bill Do you mean odp_spin_internal.h ? It's gone. Maxim. On Tue, Nov 25, 2014 at 9:29 AM, Maxim Uvarov maxim.uva...@linaro.org mailto:maxim.uva...@linaro.org wrote: Patch set is merged. From now we have requirement to use gcc-4.7 and up. For old ubuntu systems you can install new gcc in that way: http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7 Thanks, Maxim. On 11/25/2014 01:38 AM, Ola Liljedahl wrote: Patch set restructured (thanks git add -p), patches should build if applied incrementially. Some of these changes are in preparation for the appearance of odp_atomic_internal.h but these patch can be merged separately. odp_atomic.h: Use struct for 32- and 64-bit atomic types, this prevents non-atomic access to atomic variables. Emulated 64-bit atomic support for functionally challenged 32-bit architectures (e.g. PPC32). Relaxed memory model for atomic operations, this enhances performance on weakly ordered architectures (e.g. most RISC). Use GCC __atomic builtins (previously __sync builtins). Added missing atomic_add_u32, atomic_sub_u32 and atomic_sub_64 operations. Removed 32- and 64-bit cmpset operations. Made some 64-bit operations (e.g. load, store) atomic on 32-bit architectures. odp_generator.c: updated to use odp_atomic.h functins with atomic types. odp_spin_internal.h: removed odp_mem_barrier() which is a compiler only barrier and basically useless and dangerous on all weakly ordered architectures. odp_barrier.c: updated to use odp_atomic.h types and functions. Made the wrap-around atomic. Restored a missing line that was lost to a later patch. odp_buffer.c: updated to use odp_atomic.h functions (ref_count). odp_ring.c: added missing release barriers. Updated to use GCC __atomic cmpset facility (temporary fix). odp_rwlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). odp_ticketlock.c: updated to use odp_atomic.h. Updated to use GCC __atomic facilities (temporary fix). Added missing barrier in ticketlock_lock(). odp_atomic_test.c: update to conform to latest odp_atomic.h syntax. Added usage of odp_barrier_t instead of home grown thread barrier. Updated some descriptions and help texts. Ola Liljedahl (9): linux-generic: odp_ring.c use __atomic linux-generic: odp_rwlock.c use __atomic linux-generic: odp_buffer.c use odp_atomic.h linux-generic: odp_barrier.c use __atomic linux-generic: odp_generator.c use odp_atomic.h linux-generic: odp_ticketlock.c use odp_atomic.h and __atomic test: odp_atomic_test.c: use odp_barrier, fix descriptions api: odp_atomic.h: struct type, relaxed mm, missing funcs, use __atomic linux-generic: odp_spin_internal.h: remove odp_mem_barrier example/generator/odp_generator.c | 24 +- platform/linux-generic/include/api/odp_atomic.h| 271 + platform/linux-generic/include/odp_spin_internal.h | 9 - platform/linux-generic/odp_barrier.c | 17 +- platform/linux-generic/odp_buffer.c | 3 +- platform/linux-generic/odp_ring.c | 28 ++- platform/linux-generic/odp_rwlock.c | 24 +- platform/linux-generic/odp_ticketlock.c | 14 +- test/api_test/odp_atomic_test.c | 48 ++-- 9 files changed, 260 insertions(+), 178 deletions(-) ___ lng-odp mailing list lng-odp@lists.linaro.org mailto: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] netdev-odp: Use VLOG_ERR instead of ODP_ERR
OVS usually ditches stderr and stdout after startup, so logging there won't be effective. Use instead the proper OVS logging facilities. Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org --- lib/netdev-odp.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c index 59de46d..96126a1 100644 --- a/lib/netdev-odp.c +++ b/lib/netdev-odp.c @@ -111,13 +111,13 @@ odp_init(int argc, char *argv[]) result = odp_init_global(NULL, NULL); if (result) { -ODP_ERR(Error: ODP global init failed\n); +VLOG_ERR(Error: ODP global init failed\n); return result; } /* Init this thread */ if (odp_init_local()) { -ODP_ERR(Error: ODP local init failed.\n); +VLOG_ERR(Error: ODP local init failed.\n); exit(EXIT_FAILURE); } @@ -139,7 +139,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -151,7 +151,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_PACKET); if (pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: packet pool create failed.\n); +VLOG_ERR(Error: packet pool create failed.\n); return -1; } odp_buffer_pool_print(pool); @@ -162,7 +162,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -174,7 +174,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_RAW); if (ofpbuf_pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: ofpbuf pool create failed.\n); +VLOG_ERR(Error: ofpbuf pool create failed.\n); return -1; } odp_buffer_pool_print(ofpbuf_pool); @@ -185,7 +185,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -197,7 +197,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_RAW); if (struct_pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: packet pool create failed.\n); +VLOG_ERR(Error: packet pool create failed.\n); return -1; } odp_buffer_pool_print(struct_pool); @@ -241,7 +241,7 @@ netdev_odp_construct(struct netdev *netdev_) netdev-pktio = odp_pktio_open(odp_if, pool); if (netdev-pktio == ODP_PKTIO_INVALID) { -ODP_ERR(Error: odp pktio failed\n); +VLOG_ERR(Error: odp pktio failed\n); err = ENODEV; goto out_err; } @@ -633,7 +633,7 @@ netdev_odp_rxq_recv(struct netdev_rxq *rxq_, struct dpif_packet **packets, if (pkts 0) { pkts_ok = drop_err_pkts(pkt_tbl, pkts); if (odp_unlikely(pkts_ok != pkts)) -ODP_ERR(Dropped frames:%u - err_cnt:%lu\n, +VLOG_ERR(Dropped frames:%u - err_cnt:%lu\n, pkts-pkts_ok, ++err_cnt); if (!pkts_ok) { ret = EAGAIN; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 2/2] linux-generic: odp_pktio_open loop0 support
Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- platform/linux-generic/odp_packet_io.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index c523350..501b2e9 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -156,6 +156,33 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) pktio_entry_t *pktio_entry; int res; int fanout = 1; + char loop0[IFNAMSIZ] = eth0; /* linux-generic loop0 device*/ + char *loop_hint; + + if (strlen(dev) IFNAMSIZ) { + /* ioctl names limitation */ + ODP_ERR(pktio name %s is too big, limit is %d bytes\n, + dev, IFNAMSIZ); + return ODP_PKTIO_INVALID; + } + + loop_hint = getenv(ODP_PKTIO_LOOPDEV); + if (!strncmp(dev, loop0, 5)) { + if (loop_hint (strlen(loop_hint) 0)) { + if (strlen(loop_hint) IFNAMSIZ) { + ODP_ERR(pktio name %s is too big, limit is %d bytes\n, + loop_hint, IFNAMSIZ); + return ODP_PKTIO_INVALID; + } + + memset(loop0, 0, IFNAMSIZ); + memcpy(loop0, loop_hint, strlen(loop_hint)); + ODP_DBG(pktio rename loop0 to %s\n, loop_hint); + } else { + ODP_DBG(pktio rename loop0 to eth0\n); + dev = loop0; + } + } id = alloc_lock_pktio_entry(); if (id == ODP_PKTIO_INVALID) { -- 1.8.5.1.163.gd7aced9 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 1/2] odp_pktio_open loop back interface
Define special name for loop back interface. That interface can be used mostly for testing. Each implementation can interpret that loop0 to any other device. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- platform/linux-generic/include/api/odp_packet_io.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index 667395c..c388c41 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -33,7 +33,8 @@ extern C { * Open an ODP packet IO instance * * @param devPacket IO device - * @param pool Pool to use for packet IO + * loop0 is specially reserved name for loop back interface. +* @param pool Pool to use for packet IO * * @return ODP packet IO handle or ODP_PKTIO_INVALID on error */ -- 1.8.5.1.163.gd7aced9 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] check for null pointer in get_entry() return
Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- platform/linux-generic/odp_packet_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index c523350..5c8146a 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -165,6 +165,8 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) /* if successful, alloc_pktio_entry() returns with the entry locked */ pktio_entry = get_entry(id); + if (!pktio_entry) + return ODP_PKTIO_INVALID; ODP_DBG(ODP_PKTIO_USE_FANOUT: %d\n, fanout); if (getenv(ODP_PKTIO_DISABLE_SOCKET_MMAP) == NULL) { -- 1.8.5.1.163.gd7aced9 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] netdev-odp: Use VLOG_ERR instead of ODP_ERR
Taras is submitting a patch that allows you to replace the output stream for ODP_ERR etc with the applications prefered stream - see https://mail.google.com/mail/u/1/#inbox/149e780e4e57d70c On 25 November 2014 at 11:00, Zoltan Kiss zoltan.k...@linaro.org wrote: OVS usually ditches stderr and stdout after startup, so logging there won't be effective. Use instead the proper OVS logging facilities. Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org --- lib/netdev-odp.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c index 59de46d..96126a1 100644 --- a/lib/netdev-odp.c +++ b/lib/netdev-odp.c @@ -111,13 +111,13 @@ odp_init(int argc, char *argv[]) result = odp_init_global(NULL, NULL); if (result) { -ODP_ERR(Error: ODP global init failed\n); +VLOG_ERR(Error: ODP global init failed\n); return result; } /* Init this thread */ if (odp_init_local()) { -ODP_ERR(Error: ODP local init failed.\n); +VLOG_ERR(Error: ODP local init failed.\n); exit(EXIT_FAILURE); } @@ -139,7 +139,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -151,7 +151,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_PACKET); if (pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: packet pool create failed.\n); +VLOG_ERR(Error: packet pool create failed.\n); return -1; } odp_buffer_pool_print(pool); @@ -162,7 +162,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -174,7 +174,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_RAW); if (ofpbuf_pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: ofpbuf pool create failed.\n); +VLOG_ERR(Error: ofpbuf pool create failed.\n); return -1; } odp_buffer_pool_print(ofpbuf_pool); @@ -185,7 +185,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -197,7 +197,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_RAW); if (struct_pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: packet pool create failed.\n); +VLOG_ERR(Error: packet pool create failed.\n); return -1; } odp_buffer_pool_print(struct_pool); @@ -241,7 +241,7 @@ netdev_odp_construct(struct netdev *netdev_) netdev-pktio = odp_pktio_open(odp_if, pool); if (netdev-pktio == ODP_PKTIO_INVALID) { -ODP_ERR(Error: odp pktio failed\n); +VLOG_ERR(Error: odp pktio failed\n); err = ENODEV; goto out_err; } @@ -633,7 +633,7 @@ netdev_odp_rxq_recv(struct netdev_rxq *rxq_, struct dpif_packet **packets, if (pkts 0) { pkts_ok = drop_err_pkts(pkt_tbl, pkts); if (odp_unlikely(pkts_ok != pkts)) -ODP_ERR(Dropped frames:%u - err_cnt:%lu\n, +VLOG_ERR(Dropped frames:%u - err_cnt:%lu\n, pkts-pkts_ok, ++err_cnt); if (!pkts_ok) { ret = EAGAIN; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] netdev-odp: Use VLOG_ERR instead of ODP_ERR
That link might not work this thread [lng-odp] [PATCHv2 1/2] platform: debug: replace fprintf() with odp_override_log() On 25 November 2014 at 11:54, Mike Holmes mike.hol...@linaro.org wrote: Taras is submitting a patch that allows you to replace the output stream for ODP_ERR etc with the applications prefered stream - see https://mail.google.com/mail/u/1/#inbox/149e780e4e57d70c On 25 November 2014 at 11:00, Zoltan Kiss zoltan.k...@linaro.org wrote: OVS usually ditches stderr and stdout after startup, so logging there won't be effective. Use instead the proper OVS logging facilities. Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org --- lib/netdev-odp.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c index 59de46d..96126a1 100644 --- a/lib/netdev-odp.c +++ b/lib/netdev-odp.c @@ -111,13 +111,13 @@ odp_init(int argc, char *argv[]) result = odp_init_global(NULL, NULL); if (result) { -ODP_ERR(Error: ODP global init failed\n); +VLOG_ERR(Error: ODP global init failed\n); return result; } /* Init this thread */ if (odp_init_local()) { -ODP_ERR(Error: ODP local init failed.\n); +VLOG_ERR(Error: ODP local init failed.\n); exit(EXIT_FAILURE); } @@ -139,7 +139,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -151,7 +151,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_PACKET); if (pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: packet pool create failed.\n); +VLOG_ERR(Error: packet pool create failed.\n); return -1; } odp_buffer_pool_print(pool); @@ -162,7 +162,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -174,7 +174,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_RAW); if (ofpbuf_pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: ofpbuf pool create failed.\n); +VLOG_ERR(Error: ofpbuf pool create failed.\n); return -1; } odp_buffer_pool_print(ofpbuf_pool); @@ -185,7 +185,7 @@ odp_class_init(void) pool_base = odp_shm_addr(shm); if (odp_unlikely(pool_base == NULL)) { -ODP_ERR(Error: ODP packet pool mem alloc failed\n); +VLOG_ERR(Error: ODP packet pool mem alloc failed\n); out_of_memory(); return -1; } @@ -197,7 +197,7 @@ odp_class_init(void) ODP_BUFFER_TYPE_RAW); if (struct_pool == ODP_BUFFER_POOL_INVALID) { -ODP_ERR(Error: packet pool create failed.\n); +VLOG_ERR(Error: packet pool create failed.\n); return -1; } odp_buffer_pool_print(struct_pool); @@ -241,7 +241,7 @@ netdev_odp_construct(struct netdev *netdev_) netdev-pktio = odp_pktio_open(odp_if, pool); if (netdev-pktio == ODP_PKTIO_INVALID) { -ODP_ERR(Error: odp pktio failed\n); +VLOG_ERR(Error: odp pktio failed\n); err = ENODEV; goto out_err; } @@ -633,7 +633,7 @@ netdev_odp_rxq_recv(struct netdev_rxq *rxq_, struct dpif_packet **packets, if (pkts 0) { pkts_ok = drop_err_pkts(pkt_tbl, pkts); if (odp_unlikely(pkts_ok != pkts)) -ODP_ERR(Dropped frames:%u - err_cnt:%lu\n, +VLOG_ERR(Dropped frames:%u - err_cnt:%lu\n, pkts-pkts_ok, ++err_cnt); if (!pkts_ok) { ret = EAGAIN; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] Report #cores on b.L systems
Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org --- On ARM big.LITTLE systems with cluster switching, return the actual number of currently usable CPU's (e.g. 4, not 8). Trying to bind threads to cores 4..7 will just hang those threads. platform/linux-generic/odp_system_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 10665bb..60804cb 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -51,7 +51,7 @@ static int sysconf_core_count(void) { long ret; - ret = sysconf(_SC_NPROCESSORS_CONF); + ret = sysconf(_SC_NPROCESSORS_ONLN); if (ret 0) return 0; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] Remove function name and lines from simple logging function.
Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- platform/linux-generic/include/api/odp_debug.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h index 5c3adde..e853be4 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -96,8 +96,7 @@ do { \ __LINE__, __func__, ##__VA_ARGS__); \ break; \ case ODP_LOG_PRINT: \ - fprintf(stdout, %s:%d:%s(): fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ + fprintf(stdout, fmt, ##__VA_ARGS__); \ break; \ case ODP_LOG_ABORT: \ fprintf(stderr, %s:%d:%s(): fmt, __FILE__, \ -- 1.8.5.1.163.gd7aced9 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] .gitignore: distribute the ignore file to sub dirs
Signed-off-by: Mike Holmes mike.hol...@linaro.org --- .gitignore | 23 ++- example/generator/.gitignore | 1 + example/ipsec/.gitignore | 1 + example/l2fwd/.gitignore | 1 + example/odp_example/.gitignore | 1 + example/packet/.gitignore | 1 + example/timer/.gitignore | 1 + helper/.gitignore | 3 +++ test/api_test/.gitignore | 4 test/validation/.gitignore | 6 ++ 10 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 example/generator/.gitignore create mode 100644 example/ipsec/.gitignore create mode 100644 example/l2fwd/.gitignore create mode 100644 example/odp_example/.gitignore create mode 100644 example/packet/.gitignore create mode 100644 example/timer/.gitignore create mode 100644 helper/.gitignore create mode 100644 test/api_test/.gitignore create mode 100644 test/validation/.gitignore diff --git a/.gitignore b/.gitignore index 9d45504..b6db187 100644 --- a/.gitignore +++ b/.gitignore @@ -21,32 +21,13 @@ m4/*.m4 missing config.log config.status -helper/config.h.in -helper/config.h -helper/stamp-h1 libtool pkgconfig/libodp.pc .deps/ cscope.out tags lib/ -obj/ -build/ -odp_crypto -odp_example -odp_packet -odp_atomic -odp_shm -odp_ring -odp_timer_ping -odp_pktio -odp_timer_test -odp_generator -odp_l2fwd -odp_ipsec -odp_init -odp_queue doxygen-doc test-driver -test/validation/*.log -test/validation/*.trs +core +.dirstamp diff --git a/example/generator/.gitignore b/example/generator/.gitignore new file mode 100644 index 000..85aa1d1 --- /dev/null +++ b/example/generator/.gitignore @@ -0,0 +1 @@ +odp_generator diff --git a/example/ipsec/.gitignore b/example/ipsec/.gitignore new file mode 100644 index 000..5b410d3 --- /dev/null +++ b/example/ipsec/.gitignore @@ -0,0 +1 @@ +odp_ipsec diff --git a/example/l2fwd/.gitignore b/example/l2fwd/.gitignore new file mode 100644 index 000..8563319 --- /dev/null +++ b/example/l2fwd/.gitignore @@ -0,0 +1 @@ +odp_l2fwd diff --git a/example/odp_example/.gitignore b/example/odp_example/.gitignore new file mode 100644 index 000..59ca8c8 --- /dev/null +++ b/example/odp_example/.gitignore @@ -0,0 +1 @@ +odp_example diff --git a/example/packet/.gitignore b/example/packet/.gitignore new file mode 100644 index 000..0a5c1ed --- /dev/null +++ b/example/packet/.gitignore @@ -0,0 +1 @@ +odp_pktio diff --git a/example/timer/.gitignore b/example/timer/.gitignore new file mode 100644 index 000..eb59265 --- /dev/null +++ b/example/timer/.gitignore @@ -0,0 +1 @@ +odp_timer_test diff --git a/helper/.gitignore b/helper/.gitignore new file mode 100644 index 000..f282c15 --- /dev/null +++ b/helper/.gitignore @@ -0,0 +1,3 @@ +config.h.in +config.h +stamp-h1 diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore new file mode 100644 index 000..7ba56c7 --- /dev/null +++ b/test/api_test/.gitignore @@ -0,0 +1,4 @@ +odp_atomic +odp_ring +odp_shm +odp_timer_ping diff --git a/test/validation/.gitignore b/test/validation/.gitignore new file mode 100644 index 000..2917c66 --- /dev/null +++ b/test/validation/.gitignore @@ -0,0 +1,6 @@ +*.log +*.trs +odp_init +odp_queue +odp_crypto +CUnit-Memory-Dump.xml -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] INSTALL.ODP: Add info about Debian packaging
This makes it easier to deploy OVS with ODP support. Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org --- INSTALL.ODP | 28 1 file changed, 28 insertions(+) diff --git a/INSTALL.ODP b/INSTALL.ODP index 9c36dd1..86cec1f 100644 --- a/INSTALL.ODP +++ b/INSTALL.ODP @@ -54,6 +54,34 @@ Refer to INSTALL.userspace for general requirements of building userspace OVS. Alternatively go to https://wiki.linaro.org/LNG/Engineering/OVSDPDKOnUbuntu which explains how to run OVS with DPDK. Similar steps should work with ODP. +OVS Debian package: += +You can pass the configure options via DATAPATH_CONFIGURE_OPTS: + +DATAPATH_CONFIGURE_OPTS=--with-odp=ODP_DIR --with-odp-platform=platform \ +fakeroot debian/rules binary + +If you cross-compile, you need to specify host for configure, +DEB_HOST_GNU_TYPE for dh_strip, and probably a cross-compiled OpenSSL. The +latter needs to be told to configure, and dh_shlibdeps needs to find the +libraries. E.g.: + +LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/arm-linux-gnueabihf/lib:OpenSSL-DIR' \ +DEB_HOST_GNU_TYPE=arm-linux-gnueabihf \ +DATAPATH_CONFIGURE_OPTS=--with-odp=ODP_DIR --with-odp-platform=platform \ +--host=arm-linux-gnueabihf --with-openssl=OpenSSL-DIR fakeroot debian/rules \ +binary + +If you compile OpenSSL from upstream, probably you won't have the shlibs file, +you can create one in OpenSSL-DIR/DEBIAN/shlibs: + +libcrypto 1.0.0 libcrypto1.0.0 (= 1.0.1d) +libssl 1.0.0 libssl1.0.0 (= 1.0.1d) + +Another useful option is to set parallel compiling, and you can skip unit tests +as well if you are just experimenting with compile. See INSTALL.Debian for more: +DEB_BUILD_OPTIONS='parallel=8 nocheck' + Using ODP with ovs-vswitchd: -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] Remove function name and lines from simple logging function.
On 25 November 2014 at 12:10, Maxim Uvarov maxim.uva...@linaro.org wrote: Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org Reviewed-and-tested-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/include/api/odp_debug.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h index 5c3adde..e853be4 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -96,8 +96,7 @@ do { \ __LINE__, __func__, ##__VA_ARGS__); \ break; \ case ODP_LOG_PRINT: \ - fprintf(stdout, %s:%d:%s(): fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ + fprintf(stdout, fmt, ##__VA_ARGS__); \ break; \ case ODP_LOG_ABORT: \ fprintf(stderr, %s:%d:%s(): fmt, __FILE__, \ -- 1.8.5.1.163.gd7aced9 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2] example/ipsec/odp_ipsec.c: Fix initialization of odph_linux_pthread_t instances
Per-worker 'thread_tbl[i]' instance should be initialized by 'odph_linux_pthread_create()'. However, 'thread_tbl' (the array itself) was accidentally passed to 'odph_linux_pthread_create', re-initializing 'thread_tbl[0]' on each iteration. Furthermore, the iteration is not needed as all threads are initialized identically (with a NULL start_routine), as pointed out by Maxim Uvarov. Fix by calling 'odph_linux_pthread_create' and specifying 'num_workers' as the number of threads to initialize. Signed-off-by: Shmulik Ladkani shmulik.ladk...@gmail.com --- v2: Removed unnecessary iteration initializing one thread at a time example/ipsec/odp_ipsec.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index ec115fc39e..17c6a76894 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1303,20 +1303,8 @@ main(int argc, char *argv[]) /* * Create and init worker threads */ - memset(thread_tbl, 0, sizeof(thread_tbl)); - for (i = 0; i num_workers; ++i) { - int core; - - core = (first_core + i) % core_count; - - /* -* Create threads one-by-one instead of all-at-once, -* because each thread might get different arguments. -* Calls odp_thread_create(cpu) for each thread -*/ - odph_linux_pthread_create(thread_tbl, 1, core, pktio_thread, - NULL); - } + odph_linux_pthread_create(thread_tbl, num_workers, first_core, + pktio_thread, NULL); /* * If there are streams attempt to verify them else -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] Report #cores on b.L systems
On 25 November 2014 at 12:03, Ola Liljedahl ola.liljed...@linaro.org wrote: Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org Works on x86 - reported the correct number of cores available http://www.gnu.org/software/libc/manual/html_node/Processor-Resources.html So I assume it fixes the big.LITTLE hang, however the API is called sysconf_core_count and the meager docs say it is Core count. We might want to name this sysconf_avalable_core_count if the difference is going to matter in the future. I think this patch should improve the docs to clarify that it is the currently available core count even if we don't rename or add a new API. --- On ARM big.LITTLE systems with cluster switching, return the actual number of currently usable CPU's (e.g. 4, not 8). Trying to bind threads to cores 4..7 will just hang those threads. platform/linux-generic/odp_system_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 10665bb..60804cb 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -51,7 +51,7 @@ static int sysconf_core_count(void) { long ret; - ret = sysconf(_SC_NPROCESSORS_CONF); + ret = sysconf(_SC_NPROCESSORS_ONLN); if (ret 0) return 0; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] api: odp_atomic.h: doxygen fix
Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org --- platform/linux-generic/include/api/odp_atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/include/api/odp_atomic.h b/platform/linux-generic/include/api/odp_atomic.h index de9d91c..9eebb86 100644 --- a/platform/linux-generic/include/api/odp_atomic.h +++ b/platform/linux-generic/include/api/odp_atomic.h @@ -36,7 +36,7 @@ typedef struct { #if __GCC_ATOMIC_LLONG_LOCK_FREE 2 /* Some architectures do not support lock-free operations on 64-bit * data types. We use a spin lock to ensure atomicity. */ - char lock; + char lock; /** Spin lock used to ensure atomic access */ #endif } odp_atomic_u64_t ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */ -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] api: odp_atomic.h: doxygen fix
On 25 November 2014 at 15:38, Ola Liljedahl ola.liljed...@linaro.org wrote: Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org Reviewed-and-tested-by: Mike Holmes mike.hol...@linaro.org --- platform/linux-generic/include/api/odp_atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/include/api/odp_atomic.h b/platform/linux-generic/include/api/odp_atomic.h index de9d91c..9eebb86 100644 --- a/platform/linux-generic/include/api/odp_atomic.h +++ b/platform/linux-generic/include/api/odp_atomic.h @@ -36,7 +36,7 @@ typedef struct { #if __GCC_ATOMIC_LLONG_LOCK_FREE 2 /* Some architectures do not support lock-free operations on 64-bit * data types. We use a spin lock to ensure atomicity. */ - char lock; + char lock; /** Spin lock used to ensure atomic access */ #endif } odp_atomic_u64_t ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */ -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] Report #cores on b.L systems
On 25 November 2014 at 21:07, Mike Holmes mike.hol...@linaro.org wrote: On 25 November 2014 at 12:03, Ola Liljedahl ola.liljed...@linaro.org wrote: Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org Works on x86 - reported the correct number of cores available http://www.gnu.org/software/libc/manual/html_node/Processor-Resources.html So I assume it fixes the big.LITTLE hang, however the API is called sysconf_core_count and the meager docs say it is Core count. We might want to name this sysconf_avalable_core_count if the difference is going to matter in the future. I think in this case, the kernel for the ChromeBook2 is somehow configured for 8 cores. That's why _CONF returns 8. But only 4 are ever online at the same time (and they are numbered 0..3). Since binding a thread to one of those cores that are not online doesn't automatically activate the selected core, I don't think the configured number of cores matters. Only the cores that are already online can be used from ODP (unless ODP should start bringing offline cores online but I don't think this is ODP's responsibility). I think this patch should improve the docs to clarify that it is the currently available core count even if we don't rename or add a new API. Eventually the value pops out here: odp_system_info.h: /** * Core count * * @return Core count */ int odp_sys_core_count(void); The documentation is not specific at all for what cores that count. -- Ola --- On ARM big.LITTLE systems with cluster switching, return the actual number of currently usable CPU's (e.g. 4, not 8). Trying to bind threads to cores 4..7 will just hang those threads. platform/linux-generic/odp_system_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 10665bb..60804cb 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -51,7 +51,7 @@ static int sysconf_core_count(void) { long ret; - ret = sysconf(_SC_NPROCESSORS_CONF); + ret = sysconf(_SC_NPROCESSORS_ONLN); if (ret 0) return 0; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp -- Mike Holmes Linaro Sr Technical Manager LNG - ODP ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH] DEPENDENCIES: Update CUnit instructions
Signed-off-by: Mike Holmes mike.hol...@linaro.org --- DEPENDENCIES | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index f70a1d4..11452ff 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -78,23 +78,33 @@ Prerequisites for building the OpenDataPlane (ODP) API 4.0 Packages needed to build API tests - Cunit test framework + Cunit test framework version 2.1-3 is required Cunit prvodes a framework to run the API test suite that proves conformance to the ODP API. The home page http://cunit.sourceforge.net/doc/introduction.html 4.1 Native Cunit install - # Debian/Ubuntu + # Debian/Ubuntu check it is 2.1-3 $ apt-get install libcunit1-dev -4.2 Cross compile of Cunit +4.2 Built from src + + export CUNIT_VERSION=2.1-3 + curl -sSOL http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}. ar.bz2 + tar -jxf *.bz2 + cd CUnit* + ./bootstrap + make install + #In Step 4.4 use --with-cunit-path=/home/your name/CUnitHome + +4.3 Cross compile of Cunit $ git svn clone http://svn.code.sf.net/p/cunit/code/trunk cunit-code $ cd cunit-code $ ./bootstrap $ ./configure --host=arm-linux-gnueabihf --prefix=/home/user/src/install-cunit -4.3 Using Cunit with ODP +4.4 Using Cunit with ODP $ Add the configuration option to the regular configuration options ./configure --enable-cunit #if cunit is in the PATH ./configure --with-cunit-path=DIR #only if you need a path to Cunit libs and headers -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2] DEPENDENCIES: Update CUnit instructions
Signed-off-by: Mike Holmes mike.hol...@linaro.org --- Add t to ar.bz2 DEPENDENCIES | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index f70a1d4..bc39889 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -78,23 +78,33 @@ Prerequisites for building the OpenDataPlane (ODP) API 4.0 Packages needed to build API tests - Cunit test framework + Cunit test framework version 2.1-3 is required Cunit prvodes a framework to run the API test suite that proves conformance to the ODP API. The home page http://cunit.sourceforge.net/doc/introduction.html 4.1 Native Cunit install - # Debian/Ubuntu + # Debian/Ubuntu check it is 2.1-3 $ apt-get install libcunit1-dev -4.2 Cross compile of Cunit +4.2 Built from src + + export CUNIT_VERSION=2.1-3 + curl -sSOL http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2 + tar -jxf *.bz2 + cd CUnit* + ./bootstrap + make install + #In Step 4.4 use --with-cunit-path=/home/your name/CUnitHome + +4.3 Cross compile of Cunit $ git svn clone http://svn.code.sf.net/p/cunit/code/trunk cunit-code $ cd cunit-code $ ./bootstrap $ ./configure --host=arm-linux-gnueabihf --prefix=/home/user/src/install-cunit -4.3 Using Cunit with ODP +4.4 Using Cunit with ODP $ Add the configuration option to the regular configuration options ./configure --enable-cunit #if cunit is in the PATH ./configure --with-cunit-path=DIR #only if you need a path to Cunit libs and headers -- 2.1.0 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 1/4] linux-generic: odp_atomic_internal.h: C11-style 32/64-bit/pointer/flag atomics
Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org --- Operations (including exchange and compare-and-exchange) with specified C11-based memory models on odp_atomic_u32_t and odp_atomic_u64_t. odp_atomic_ptr_t definition and operations (init, load, store, exchange). odp_atomic_flag_t definitions and operations (init, load, tas, clear). .../linux-generic/include/odp_atomic_internal.h| 603 + 1 file changed, 603 insertions(+) create mode 100644 platform/linux-generic/include/odp_atomic_internal.h diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h new file mode 100644 index 000..b330e8f --- /dev/null +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -0,0 +1,603 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP atomic types and operations, semantically a subset of C11 atomics. + * Reuse the 32-bit and 64-bit type definitions from odp_atomic.h. Introduces + * new atomic pointer and flag types. + * Atomic functions must be used to operate on atomic variables! + */ + +#ifndef ODP_ATOMIC_INTERNAL_H_ +#define ODP_ATOMIC_INTERNAL_H_ + +#include stdint.h +#include stdbool.h +#include odp_align.h +#include odp_hints.h +#include odp_atomic.h + +#ifdef __cplusplus +extern C { +#endif + +/** @addtogroup odp_synchronizers + * Atomic operations. + * @{ + */ + +/** + * Pointer atomic type + */ +typedef struct { + void *v; /** Actual storage for the atomic variable */ +} odp_atomic_ptr_t +ODP_ALIGNED(sizeof(void *)); /* Enforce alignement! */ + +/** + * Atomic flag (boolean) type + */ +typedef char odp_atomic_flag_t; + +/** + * Memory consistency models supported by ODP. + */ +typedef enum { +/** Relaxed memory ordering, no ordering of other accesses enforced. + * Atomic operations with relaxed memory model cannot be used for + * synchronization */ + ODP_MEMMODEL_RLX = __ATOMIC_RELAXED, +/** Acquire memory ordering, synchronize with release stores from another + * thread (later accesses cannot move before acquire operation). + * Use acquire and release memory models for Release Consistency */ + ODP_MEMMODEL_ACQ = __ATOMIC_ACQUIRE, +/** Release memory ordering, synchronize with acquire loads from another + * thread (earlier accesses cannot move after release operation). + * Use acquire and release memory models for Release Consistency */ + ODP_MEMMODEL_RLS = __ATOMIC_RELEASE, +/** Acquirerelease memory ordering, synchronize with acquire loads and release + * stores in another (one other) thread */ + ODP_MEMMODEL_ACQ_RLS = __ATOMIC_ACQ_REL, +/** Sequential consistent memory ordering, synchronize with acquire loads and + * release stores in all threads */ + ODP_MEMMODEL_SC = __ATOMIC_SEQ_CST +} odp_memmodel_t; + +/** + * Insert a full memory barrier (fence) in the compiler and instruction + * sequence. + */ +#define ODP_FULL_BARRIER() __atomic_thread_fence(__ATOMIC_SEQ_CST) + +/* + * Operations on 32-bit atomics + * odp_atomic_u32_load_mm - return current value + * odp_atomic_u32_store_mm - no return value + * odp_atomic_u32_xchg_mm - return old value + * odp_atomic_u32_cmp_xchg_strong_mm - return bool + * odp_atomic_u32_fetch_add_mm - return old value + * odp_atomic_u32_add_mm - no return value + * odp_atomic_u32_fetch_sub_mm - return old value + * odp_atomic_u32_sub_mm - no return value + */ + +/** + * Atomic load of 32-bit atomic variable + * + * @param ptr Pointer to a 32-bit atomic variable + * @param mmodel Memory model associated with the load operation + * + * @return Value of the variable + */ +static inline uint32_t odp_atomic_u32_load_mm(const odp_atomic_u32_t *ptr, + odp_memmodel_t mmodel) +{ + return __atomic_load_n(ptr-v, mmodel); +} + +/** + * Atomic store to 32-bit atomic variable + * + * @param ptrPointer to a 32-bit atomic variable + * @param valValue to store in the atomic variable + * @param mmodel Memory model associated with the store operation + */ +static inline void odp_atomic_u32_store_mm(odp_atomic_u32_t *ptr, + uint32_t val, + odp_memmodel_t mmodel) +{ + __atomic_store_n(ptr-v, val, mmodel); +} + +/** + * Atomic exchange (swap) of 32-bit atomic variable + * + * @param ptrPointer to a 32-bit atomic variable + * @param valNew value to store in the atomic variable + * @param mmodel Memory model associated with the exchange operation + * + * @return Old value of the variable + */ +static inline uint32_t odp_atomic_u32_xchg_mm(odp_atomic_u32_t *ptr, + uint32_t val, + odp_memmodel_t mmodel) + +{ + return __atomic_exchange_n(ptr-v, val, mmodel); +} + +/** + * Atomic compare and exchange (swap) of
[lng-odp] [PATCH 2/4] linux-generic: odp_barrier.h: use odp_atomic_internal.h
Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org --- Use definitions from odp_atomic_internal.h. platform/linux-generic/odp_barrier.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/odp_barrier.c b/platform/linux-generic/odp_barrier.c index 3a511b2..2fef386 100644 --- a/platform/linux-generic/odp_barrier.c +++ b/platform/linux-generic/odp_barrier.c @@ -7,6 +7,7 @@ #include odp_barrier.h #include odp_sync.h #include odp_spin_internal.h +#include odp_atomic_internal.h void odp_barrier_init(odp_barrier_t *barrier, int count) { @@ -32,7 +33,7 @@ void odp_barrier_wait(odp_barrier_t *barrier) uint32_t count; int wasless; - __atomic_thread_fence(__ATOMIC_SEQ_CST); + ODP_FULL_BARRIER(); count = odp_atomic_fetch_inc_u32(barrier-bar); wasless = count barrier-count; @@ -45,5 +46,5 @@ void odp_barrier_wait(odp_barrier_t *barrier) odp_spin(); } - __atomic_thread_fence(__ATOMIC_SEQ_CST); + ODP_FULL_BARRIER(); } -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 4/4] linux-generic: odp_spinlock[ch]: use odp_atomic_internal.h
Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org --- Use definitions from odp_atomic_internal.h. platform/linux-generic/include/api/odp_spinlock.h | 2 +- platform/linux-generic/odp_spinlock.c | 17 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/platform/linux-generic/include/api/odp_spinlock.h b/platform/linux-generic/include/api/odp_spinlock.h index 462ff97..7c299c8 100644 --- a/platform/linux-generic/include/api/odp_spinlock.h +++ b/platform/linux-generic/include/api/odp_spinlock.h @@ -30,7 +30,7 @@ extern C { * ODP spinlock */ typedef struct odp_spinlock_t { - volatile int lock; /** @private Lock */ + char lock; /** @private Lock */ } odp_spinlock_t; diff --git a/platform/linux-generic/odp_spinlock.c b/platform/linux-generic/odp_spinlock.c index 4eba015..5c7ef39 100644 --- a/platform/linux-generic/odp_spinlock.c +++ b/platform/linux-generic/odp_spinlock.c @@ -5,36 +5,41 @@ */ #include odp_spinlock.h +#include odp_atomic_internal.h #include odp_spin_internal.h void odp_spinlock_init(odp_spinlock_t *spinlock) { - __sync_lock_release(spinlock-lock); + odp_atomic_flag_init(spinlock-lock, 0); } void odp_spinlock_lock(odp_spinlock_t *spinlock) { - while (__sync_lock_test_and_set(spinlock-lock, 1)) - while (spinlock-lock) + /* While the lock is already taken... */ + while (odp_atomic_flag_tas(spinlock-lock)) + /* ...spin reading the flag (relaxed MM), +* the loop will exit when the lock becomes available +* and we will retry the TAS operation above */ + while (odp_atomic_flag_load(spinlock-lock)) odp_spin(); } int odp_spinlock_trylock(odp_spinlock_t *spinlock) { - return (__sync_lock_test_and_set(spinlock-lock, 1) == 0); + return (odp_atomic_flag_tas(spinlock-lock) == 0); } void odp_spinlock_unlock(odp_spinlock_t *spinlock) { - __sync_lock_release(spinlock-lock); + odp_atomic_flag_clear(spinlock-lock); } int odp_spinlock_is_locked(odp_spinlock_t *spinlock) { - return spinlock-lock != 0; + return odp_atomic_flag_load(spinlock-lock) != 0; } -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 3/4] linux-generic: odp_rwlock[ch]: use odp_atomic_internal.h
Signed-off-by: Ola Liljedahl ola.liljed...@linaro.org --- Use definitions from odp_atomic_internal.h. platform/linux-generic/include/api/odp_rwlock.h | 4 ++- platform/linux-generic/odp_rwlock.c | 35 - 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/platform/linux-generic/include/api/odp_rwlock.h b/platform/linux-generic/include/api/odp_rwlock.h index a880f92..59cf9cc 100644 --- a/platform/linux-generic/include/api/odp_rwlock.h +++ b/platform/linux-generic/include/api/odp_rwlock.h @@ -13,6 +13,8 @@ * ODP RW Locks */ +#include odp_atomic.h + #ifdef __cplusplus extern C { #endif @@ -28,7 +30,7 @@ extern C { * read lock count 0 */ typedef struct { - volatile int32_t cnt; /** -1 Write lock, + odp_atomic_u32_t cnt; /** -1 Write lock, 0 for Read lock. */ } odp_rwlock_t; diff --git a/platform/linux-generic/odp_rwlock.c b/platform/linux-generic/odp_rwlock.c index 2f6a255..fc78b20 100644 --- a/platform/linux-generic/odp_rwlock.c +++ b/platform/linux-generic/odp_rwlock.c @@ -6,64 +6,63 @@ #include stdbool.h #include odp_atomic.h +#include odp_atomic_internal.h #include odp_rwlock.h #include odp_spin_internal.h void odp_rwlock_init(odp_rwlock_t *rwlock) { - rwlock-cnt = 0; + odp_atomic_init_u32(rwlock-cnt, 0); } void odp_rwlock_read_lock(odp_rwlock_t *rwlock) { - int32_t cnt; + uint32_t cnt; int is_locked = 0; while (is_locked == 0) { - cnt = rwlock-cnt; + cnt = odp_atomic_u32_load_mm(rwlock-cnt, ODP_MEMMODEL_RLX); /* waiting for read lock */ - if (cnt 0) { + if ((int32_t)cnt 0) { odp_spin(); continue; } - is_locked = __atomic_compare_exchange_n(rwlock-cnt, + is_locked = odp_atomic_u32_cmp_xchg_strong_mm(rwlock-cnt, cnt, cnt + 1, - false/*strong*/, - __ATOMIC_ACQUIRE, - __ATOMIC_RELAXED); + ODP_MEMMODEL_ACQ, + ODP_MEMMODEL_RLX); } } void odp_rwlock_read_unlock(odp_rwlock_t *rwlock) { - (void)__atomic_sub_fetch(rwlock-cnt, 1, __ATOMIC_RELEASE); + odp_atomic_u32_sub_mm(rwlock-cnt, 1, ODP_MEMMODEL_RLS); } void odp_rwlock_write_lock(odp_rwlock_t *rwlock) { - int32_t cnt; + uint32_t cnt; int is_locked = 0; while (is_locked == 0) { - int32_t zero = 0; - cnt = rwlock-cnt; + uint32_t zero = 0; + cnt = odp_atomic_u32_load_mm(rwlock-cnt, ODP_MEMMODEL_RLX); /* lock aquired, wait */ if (cnt != 0) { odp_spin(); continue; } - is_locked = __atomic_compare_exchange_n(rwlock-cnt, + is_locked = odp_atomic_u32_cmp_xchg_strong_mm(rwlock-cnt, zero, - -1, - false/*strong*/, - __ATOMIC_ACQUIRE, - __ATOMIC_RELAXED); + (uint32_t)-1, + ODP_MEMMODEL_ACQ, + ODP_MEMMODEL_RLX); } } void odp_rwlock_write_unlock(odp_rwlock_t *rwlock) { - (void)__atomic_add_fetch(rwlock-cnt, 1, __ATOMIC_RELEASE); + odp_atomic_u32_store_mm(rwlock-cnt, 0, ODP_MEMMODEL_RLS); } -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v3] cunit: add shm test
Add odp_cunit_common.c for common cunit function and add the cunit test for the api in odp_share_memory.h which include the new api implement odp_shm_free. Signed-off-by: Yan Songming yan.songm...@linaro.org --- v3 change common file to test/common and fix the problem Jerin found. v2 fix some problem which maxim and mike found. --- test/validation/Makefile.am | 7 +- test/validation/common/.dirstamp | 0 test/validation/common/odp_cunit_common.c | 37 ++ test/validation/common/odp_cunit_common.h | 35 + test/validation/odp_shm.c | 119 ++ 5 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 test/validation/common/.dirstamp create mode 100644 test/validation/common/odp_cunit_common.c create mode 100644 test/validation/common/odp_cunit_common.h create mode 100644 test/validation/odp_shm.c diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am index 0b831d0..86200d4 100644 --- a/test/validation/Makefile.am +++ b/test/validation/Makefile.am @@ -6,11 +6,13 @@ AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit if ODP_CUNIT_ENABLED TESTS = ${bin_PROGRAMS} check_PROGRAMS = ${bin_PROGRAMS} -bin_PROGRAMS = odp_init odp_queue odp_crypto +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_init_LDFLAGS = $(AM_LDFLAGS) odp_queue_LDFLAGS = $(AM_LDFLAGS) -odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto +odp_crypto_CFLAGS = $(AM_CFLAGS) -I./crypto odp_crypto_LDFLAGS = $(AM_LDFLAGS) +odp_shm_CFLAGS = $(AM_CFLAGS) -I./common +odp_shm_LDFLAGS = $(AM_LDFLAGS) endif dist_odp_init_SOURCES = odp_init.c @@ -18,3 +20,4 @@ dist_odp_queue_SOURCES = odp_queue.c dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \ crypto/odp_crypto_test_sync_inp.c \ odp_crypto.c +dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c diff --git a/test/validation/common/.dirstamp b/test/validation/common/.dirstamp new file mode 100644 index 000..e69de29 diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c new file mode 100644 index 000..885b981 --- /dev/null +++ b/test/validation/common/odp_cunit_common.c @@ -0,0 +1,37 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP test application common + */ + +#include string.h +#include odp.h +#include odp_cunit_common.h +#include odph_linux.h +/* Globals */ +static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; + +/** create test thread */ +int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg) +{ + /* Create and init additional threads */ + odph_linux_pthread_create(thread_tbl, arg-numthrds, 0, func_ptr, + (void *)arg); + + return 0; +} + +/** exit from test thread */ +int odp_cunit_thread_exit(pthrd_arg *arg) +{ + /* Wait for other threads to exit */ + odph_linux_pthread_join(thread_tbl, arg-numthrds); + + return 0; +} diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h new file mode 100644 index 000..5eec376 --- /dev/null +++ b/test/validation/common/odp_cunit_common.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP test application common headers + */ + +#ifndef ODP_CUNICT_COMMON_H +#define ODP_CUNICT_COMMON_H + +#define MAX_WORKERS 32 /** Maximum number of work threads */ + +typedef struct { + uint32_t foo; + uint32_t bar; +} test_shared_data_t; + +/** + * Thread argument + */ +typedef struct { + int testcase; /** specifies which set of API's to exercise */ + int numthrds; /** no of pthreads to create */ +} pthrd_arg; + +/** create thread fro start_routine function */ +extern int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg); +extern int odp_cunit_thread_exit(pthrd_arg *); + +#endif /* ODP_COMMON_H */ diff --git a/test/validation/odp_shm.c b/test/validation/odp_shm.c new file mode 100644 index 000..27d260a --- /dev/null +++ b/test/validation/odp_shm.c @@ -0,0 +1,119 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include odp.h +#include CUnit/Basic.h +#include odp_cunit_common.h + +#define ALIGE_SIZE (128) +#define TESTNAME cunit_test_shared_data +#define TEST_SHARE_FOO (0xf0f0f0f0) +#define TEST_SHARE_BAR (0xf0f0f0f) + +static void *run_shm_thread(void *arg) +{ + odp_shm_info_t info; + odp_shm_t shm; + test_shared_data_t *test_shared_data; + int thr; + + thr = odp_thread_id(); + printf(Thread %i starts\n, thr); + + shm = odp_shm_lookup(TESTNAME); + CU_ASSERT(ODP_SHM_INVALID != shm); + test_shared_data =
Re: [lng-odp] [PATCH v1 5/5] Classification: APIs deferred from ODP v1.0
Hi Mike, As you know these classification patches was submitted as being interdependent on each other. But sure I can redo this specific patch to be independently compilable unit. Also it would be great if I could get review comments on classification implementation patches so that I can fix any changes in the next revision. Regards, Bala On 26 November 2014 01:51, Mike Holmes mike.hol...@linaro.org wrote: Bala Can this patch be posted with just the clean up to the implementation so that it builds ? It gets us closer to the 1.0 API then. Currently odp_classification.c:30:5: error: no previous prototype for 'odp_cos_set_queue_group' [-Werror=missing-prototypes] int odp_cos_set_queue_group(odp_cos_t cos_id, odp_queue_group_t queue_group_id) ^ odp_classification.c:38:5: error: no previous prototype for 'odp_cos_set_pool' [-Werror=missing-prototypes] int odp_cos_set_pool(odp_cos_t cos_id, odp_buffer_pool_t pool_id) ^ odp_classification.c:85:5: error: no previous prototype for 'odp_cos_set_headroom' [-Werror=missing-prototypes] int odp_cos_set_headroom(odp_cos_t cos_id, size_t req_room) ^ odp_classification.c:122:1: error: no previous prototype for 'odp_cos_class_flow_signature' [-Werror=missing-prototypes] odp_cos_class_flow_signature(odp_cos_t cos_id, ^ odp_classification.c:131:1: error: no previous prototype for 'odp_cos_port_flow_signature' [-Werror=missing-prototypes] odp_cos_port_flow_signature(odp_pktio_t pktio_in, ^ Mike On 25 November 2014 at 03:11, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: Reviewed-by: Petri Savolainen petri.savolai...@linaro.org -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Balasubramanian Manoharan Sent: Friday, November 21, 2014 10:54 AM To: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH v1 5/5] Classification: APIs deferred from ODP v1.0 This patch removes Classification APIs which have been deferred from ODP v1.0 The following is the list of the deferred APIs * odp_cos_set_queue_group * odp_cos_set_pool * odp_cos_set_headroom * odp_cos_flow_set * odp_cos_flow_is_set * odp_cos_class_flow_signature * odp_cos_port_flow_signature Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org --- .../linux-generic/include/api/odp_classification.h | 96 - - 1 file changed, 96 deletions(-) diff --git a/platform/linux-generic/include/api/odp_classification.h b/platform/linux-generic/include/api/odp_classification.h index 091b10d..64ad73f 100644 --- a/platform/linux-generic/include/api/odp_classification.h +++ b/platform/linux-generic/include/api/odp_classification.h @@ -113,33 +113,6 @@ int odp_cos_destroy(odp_cos_t cos_id); int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id); /** - * Assign a homogenous queue-group to a class-of-service. - * - * @param[in]cos_id class-of-service instance - * @param[in]queue_group_id Identifier of the queue group to receive packets - * associated with this class of service. - * - * @return 0 on success, -1 on error. - */ -int odp_cos_set_queue_group(odp_cos_t cos_id, - odp_queue_group_t queue_group_id); - -/** - * Assign packet buffer pool for specific class-of-service - * - * @param[in]cos_id class-of-service instance. - * @param[in]pool_id Buffer pool identifier where all packet buffers - * will be sourced to store packet that - * belong to this class of service. - * - * @return 0 on success, -1 on error. - * - * @note Optional. - */ -int odp_cos_set_pool(odp_cos_t cos_id, odp_buffer_pool_t pool_id); - - -/** * Assign packet drop policy for specific class-of-service * * @param[in]cos_id class-of-service instance. @@ -206,21 +179,6 @@ int odp_pktio_set_skip(odp_pktio_t pktio_in, size_t offset); int odp_pktio_set_headroom(odp_pktio_t pktio_in, size_t headroom); /** - * Specify per-cos buffer headroom - * - * @param[in]cos_id Class-of-service instance - * @param[in]headroomNumber of bytes of space preceding packet - * data to reserve for use as headroom. - * Must not exceed the implementation - * defined ODP_PACKET_MAX_HEADROOM. - * - * @return 0 on success, -1 on error. - * - * @note Optional. - */ -int odp_cos_set_headroom(odp_cos_t cos_id, size_t headroom); - -/** * Request to override per-port class of service * based on Layer-2 priority field if present. * @@ -266,60 +224,6 @@ int odp_cos_with_l3_qos(odp_pktio_t
Re: [lng-odp] [PATCH v1 3/5] Linux-generic: Pktio changes for Classification
Hi, Pls let me know if there are any additional comments for this patch. If otherwise please provide reviewed-by Regards, Bala On 25 November 2014 03:24, Anders Roxell anders.rox...@linaro.org wrote: On 24 November 2014 at 22:45, Bill Fischofer bill.fischo...@linaro.org wrote: Again, this points out that we need to start merging patches. Otherwise we're going to be spending all our time reworking and rebasing them rather than moving onto the next patch. There's just no clean way to avoid this with API changes since they tend to get very interdependent as applications and tests start using them. Bill, We are merging patches, and there is always going to be a looser... There will be merge conflicts, that the submitter has to resolve if git am --3way don't do the trick. Cheers, Anders On Mon, Nov 24, 2014 at 3:37 PM, Maxim Uvarov maxim.uva...@linaro.org wrote: On 11/25/2014 12:34 AM, Mike Holmes wrote: This no longer applies, can you rebase it ? git am -3 helps? On 21 November 2014 08:30, Bala Manoharan bala.manoha...@linaro.org wrote: Hi Maxim, As discussed, as per the current API a pktio can exist without initializing the classifier and in that case the packets are sent to the default queue for that pktio. We can test the classifier using the classifier example which I am currently working in parallel. Regards, Bala On 21 November 2014 18:18, Maxim Uvarov maxim.uva...@linaro.org wrote: On 11/21/2014 03:32 PM, Bala Manoharan wrote: Hi Maxim, Can we have those as separate patches. I would like to keep this patch as specific for linking pktio with classification. I have created this patch from the current odp tip. Regards, Bala My ideas was if we link now then we have workable example/packet with classifier. And we can check that basic functionality works and you don't forget init lock or something like that. Maxim. On 21 November 2014 17:37, Maxim Uvarov maxim.uva...@linaro.org mailto:maxim.uva...@linaro.org wrote: On 11/21/2014 11:53 AM, Balasubramanian Manoharan wrote: @@ -163,7 +169,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) Bala, I sent you patch to change API to odp_pktio_open( *dev, cost_t). It should be also included to that patch set. Thanks, Maxim. ___ lng-odp mailing list lng-odp@lists.linaro.org mailto: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 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