[lng-odp] [API-NEXT PATCH v4 09/10] linux-generic: cpumask: add API odp_cpumask_available()
From: Hongbo Zhang hongbo.zh...@linaro.org In some cases, odp_cpu_count() isn't enough to show all the available CPUs, so a new API odp_cpumask_available() is introduced, which returns all the worker and control CPUs. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- include/odp/api/cpumask.h| 10 ++ platform/linux-generic/odp_cpumask.c | 11 +++ 2 files changed, 21 insertions(+) diff --git a/include/odp/api/cpumask.h b/include/odp/api/cpumask.h index 2ad7fea..eef6404 100644 --- a/include/odp/api/cpumask.h +++ b/include/odp/api/cpumask.h @@ -218,6 +218,16 @@ int odp_cpumask_def_worker(odp_cpumask_t *mask, int num); int odp_cpumask_def_control(odp_cpumask_t *mask, int num); /** + * Report all the available CPUs + * + * All the available CPUs include both worker CPUs and control CPUs + * + * @param[out] maskCPU mask to hold all available CPUs + * @return cpu number of all available CPUs + */ +int odp_cpumask_available(odp_cpumask_t *mask); + +/** * @} */ diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index c28153b..bb37cb8 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -243,3 +243,14 @@ int odp_cpumask_def_control(odp_cpumask_t *mask, int num ODP_UNUSED) odp_cpumask_set(mask, 0); return 1; } + +int odp_cpumask_available(odp_cpumask_t *mask) +{ + odp_cpumask_t mask_work, mask_ctrl; + + odp_cpumask_def_worker(mask_work, 0); + odp_cpumask_def_control(mask_ctrl, 0); + odp_cpumask_or(mask, mask_work, mask_ctrl); + + return odp_cpumask_count(mask); +} -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] example: timer: use PRIx32 to print timer timeout
I think the exception in checkpatch only allows unsegmented strings to overflow 80 cols. Because the string is split with the PRIx macro, the exception is not valid anymore. I still wasn't sure which way you prefered this :) On 08/11/2015 11:50 AM, Maxim Uvarov wrote: Hello Nicolas, that should be the same as print few lines above. I.e. in one line. EXAMPLE_ERROR is added to checkpatch.pl exception but for some reason exception does not work and there is still that warning. It will be good if we can find some way to fix it. Thanks, Maxim. On 08/10/15 15:14, Nicolas Morey-Chaisemartin wrote: Signed-off-by: Nicolas Morey-Chaisemartin nmo...@kalray.eu --- example/timer/odp_timer_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 933dc3b..0173099 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -173,7 +173,8 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) uint32_t rx_num = odp_atomic_fetch_dec_u32(gbls-remain); if (!rx_num) -EXAMPLE_ABORT(Unexpected timeout received (timer %x, tick %PRIu64)\n, +EXAMPLE_ABORT(Unexpected timeout received (timer % + PRIx32 , tick % PRIu64 )\n, ttp-tim, tick); else if (rx_num num_workers) continue; ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH v4 08/10] linux-generic: sysinfo: add API to get current CPU frequency
From: Hongbo Zhang hongbo.zh...@linaro.org Previous CPU frequency API is adapted to return max frequency, now new APIs are added for getting the current CPU frequency. odp_cpu_id_hz(int id) returns frequency of the CPU specified by parameter id, while odp_cpu_hz() returns frequency of the CPU on which the thread is running. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- include/odp/api/cpu.h| 20 ++ platform/linux-generic/odp_system_info.c | 63 2 files changed, 83 insertions(+) diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 36bc47f..02b3420 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -62,6 +62,26 @@ uint64_t odp_cpu_hz_max(void); uint64_t odp_cpu_id_hz_max(int id); /** + * Current CPU frequency in Hz + * + * Returns current frequency of this CPU + * + * @return CPU frequency in Hz + */ +uint64_t odp_cpu_hz(void); + +/** + * Current CPU frequency of a CPU (in Hz) + * + * Returns current frequency of the specified CPU + * + * @param idCPU ID + * + * @return CPU frequency in Hz + */ +uint64_t odp_cpu_id_hz(int id); + +/** * CPU model name * * @return Pointer to CPU model name string diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 55516d0..cb5e224 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -146,6 +146,42 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) return 0; } +static uint64_t arch_cpu_hz_current(int id) +{ + char str[1024]; + FILE *file; + int cpu; + char *pos; + double mhz = 0.0; + + file = fopen(/proc/cpuinfo, rt); + + /* find the correct processor instance */ + while (fgets(str, sizeof(str), file) != NULL) { + pos = strstr(str, processor); + if (pos) { + sscanf(pos, processor : %d, cpu); + if (cpu == id) + break; + } + } + + /* extract the cpu current speed */ + while (fgets(str, sizeof(str), file) != NULL) { + pos = strstr(str, cpu MHz); + if (pos) { + sscanf(pos, cpu MHz : %lf, mhz); + break; + } + } + + fclose(file); + if (mhz) + return (uint64_t)(mhz * 100.0); + + return -1; +} + #elif defined __arm__ || defined __aarch64__ static int cpuinfo_arm(FILE *file ODP_UNUSED, @@ -154,6 +190,11 @@ odp_system_info_t *sysinfo ODP_UNUSED) return 0; } +static uint64_t arch_cpu_hz_current(int id) +{ + return -1; +} + #elif defined __OCTEON__ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) @@ -196,6 +237,11 @@ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) return 0; } +static uint64_t arch_cpu_hz_current(int id) +{ + return -1; +} + #elif defined __powerpc__ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) { @@ -237,6 +283,11 @@ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) return 0; } +static uint64_t arch_cpu_hz_current(int id) +{ + return -1; +} + #else #error GCC target not found #endif @@ -380,6 +431,18 @@ uint64_t odp_cpu_id_hz_max(int id) return -1; } +uint64_t odp_cpu_hz(void) +{ + int id = sched_getcpu(); + + return arch_cpu_hz_current(id); +} + +uint64_t odp_cpu_id_hz(int id) +{ + return arch_cpu_hz_current(id); +} + uint64_t odp_sys_huge_page_size(void) { return odp_global_data.system_info.huge_page_size; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] example: timer: use PRIx32 to print timer timeout
Hello Nicolas, that should be the same as print few lines above. I.e. in one line. EXAMPLE_ERROR is added to checkpatch.pl exception but for some reason exception does not work and there is still that warning. It will be good if we can find some way to fix it. Thanks, Maxim. On 08/10/15 15:14, Nicolas Morey-Chaisemartin wrote: Signed-off-by: Nicolas Morey-Chaisemartin nmo...@kalray.eu --- example/timer/odp_timer_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 933dc3b..0173099 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -173,7 +173,8 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) uint32_t rx_num = odp_atomic_fetch_dec_u32(gbls-remain); if (!rx_num) - EXAMPLE_ABORT(Unexpected timeout received (timer %x, tick %PRIu64)\n, + EXAMPLE_ABORT(Unexpected timeout received (timer % + PRIx32 , tick % PRIu64 )\n, ttp-tim, tick); else if (rx_num num_workers) continue; ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] helper: fix installation path for includes
On 2015-08-03 15:54, Nicolas Morey-Chaisemartin wrote: Install path was broken when helper installation moved out of the platform side as they were install in the top includedir and not $(includedir)/odp/helper Signed-off-by: Nicolas Morey-Chaisemartin nmo...@kalray.eu Reviewed-by: Anders Roxell anders.rox...@linaro.org --- helper/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/Makefile.am b/helper/Makefile.am index 44bcc3d..1a74e8e 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -7,7 +7,8 @@ AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include AM_CFLAGS += -I$(top_srcdir)/include -include_HEADERS = \ +helperincludedir = $(includedir)/odp/helper/ +helperinclude_HEADERS = \ $(srcdir)/include/odp/helper/ring.h \ $(srcdir)/include/odp/helper/linux.h \ $(srcdir)/include/odp/helper/chksum.h\ ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] example: timer: use PRIx32 to print timer timeout
On 08/11/15 12:52, Nicolas Morey-Chaisemartin wrote: I think the exception in checkpatch only allows unsegmented strings to overflow 80 cols. Because the string is split with the PRIx macro, the exception is not valid anymore. I still wasn't sure which way you prefered this :) I removed PRIx and quotes, left only long string with ODP_EXAMPLE and still see that warning. Maxim. On 08/11/2015 11:50 AM, Maxim Uvarov wrote: Hello Nicolas, that should be the same as print few lines above. I.e. in one line. EXAMPLE_ERROR is added to checkpatch.pl exception but for some reason exception does not work and there is still that warning. It will be good if we can find some way to fix it. Thanks, Maxim. On 08/10/15 15:14, Nicolas Morey-Chaisemartin wrote: Signed-off-by: Nicolas Morey-Chaisemartin nmo...@kalray.eu --- example/timer/odp_timer_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 933dc3b..0173099 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -173,7 +173,8 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) uint32_t rx_num = odp_atomic_fetch_dec_u32(gbls-remain); if (!rx_num) -EXAMPLE_ABORT(Unexpected timeout received (timer %x, tick %PRIu64)\n, +EXAMPLE_ABORT(Unexpected timeout received (timer % + PRIx32 , tick % PRIu64 )\n, ttp-tim, tick); else if (rx_num num_workers) continue; ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH v4 05/10] linux-generic: sysinfo: clarify the API for max CPU frequency
From: Hongbo Zhang hongbo.zh...@linaro.org Currently the API to get CPU frequency is vague, it needs to be clarified whether max or current frequency is returned, and now most use cases want to get max capacity of CPU in fact, so this patch makes it clear that the cpu_hz stand for max CPU frequency. (there is no need to store current instant frequency) Accordingly the API odp_cpu_hz() is renamed to odp_cpu_hz_max(). While there may still be some use case of acquiring the current CPU frequency, so the previous odp_cpu_hz() will be re-implemented for this purpose in the next patch. As to platforms other than x86, if their cpu_hz's don't stand for max CPU frequency, they should be changed following up this patch, and then max or current frequency of CPU should be clear. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c| 2 +- example/ipsec/odp_ipsec.c| 2 +- example/packet/odp_pktio.c | 2 +- example/timer/odp_timer_test.c | 4 ++-- include/odp/api/cpu.h| 2 +- platform/linux-generic/arch/linux/odp_time.c | 2 +- platform/linux-generic/odp_system_info.c | 22 +++--- platform/linux-generic/odp_time.c| 4 ++-- test/api_test/odp_common.c | 2 +- test/performance/odp_atomic.c| 2 +- test/performance/odp_l2fwd.c | 2 +- test/performance/odp_scheduling.c| 2 +- test/validation/system/system.c | 6 +++--- test/validation/system/system.h | 2 +- 15 files changed, 25 insertions(+), 33 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 8b68ce0..16e567d 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -733,7 +733,7 @@ static void print_info(char *progname, appl_args_t *appl_args) CPU count: %i\n \n, odp_version_api_str(), odp_cpu_model_str(), - odp_cpu_hz(), odp_sys_cache_line_size(), + odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2ed4ea2..7982801 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -988,7 +988,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 32a91e4..b2bc501 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1516,7 +1516,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 75de6b8..f0bc528 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -628,7 +628,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index b7d3dcd..68345b7 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -350,7 +350,7 @@ int main(int argc, char *argv[]) printf(---\n); printf(ODP API version: %s\n,odp_version_api_str()); printf(CPU model: %s\n,odp_cpu_model_str()); - printf(CPU freq (hz): %PRIu64\n, odp_cpu_hz()); + printf(CPU freq (hz): %PRIu64\n, odp_cpu_hz_max()); printf(Cache line size: %i\n,odp_sys_cache_line_size()); printf(Max CPU count: %i\n,odp_cpu_count()); @@ -445,7 +445,7 @@ int main(int argc, char *argv[]) return -1; } - printf(CPU freq %PRIu64 Hz\n, odp_cpu_hz()); +
[lng-odp] [API-NEXT PATCH v4 03/10] linux-generic: sysinfo: move CPU HZ API to cpu.h
From: Hongbo Zhang hongbo.zh...@linaro.org This patch moves odp_sys_cpu_hz() to cpu.h and accordingly rename it to odp_cpu_hz(). All the calling functions are also updated. New CPU HZ APIs for AMP system will be added into this cpu.h too. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c| 2 +- example/ipsec/odp_ipsec.c| 2 +- example/packet/odp_pktio.c | 2 +- example/timer/odp_timer_test.c | 4 ++-- include/odp/api/cpu.h| 7 +++ include/odp/api/system_info.h| 7 --- platform/linux-generic/arch/linux/odp_time.c | 3 ++- platform/linux-generic/odp_system_info.c | 2 +- platform/linux-generic/odp_time.c| 5 +++-- test/api_test/odp_common.c | 2 +- test/performance/odp_atomic.c| 2 +- test/performance/odp_l2fwd.c | 2 +- test/performance/odp_scheduling.c| 2 +- test/validation/system/system.c | 6 +++--- test/validation/system/system.h | 2 +- 16 files changed, 27 insertions(+), 25 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index b55a6f9..267b6a5 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -733,7 +733,7 @@ static void print_info(char *progname, appl_args_t *appl_args) CPU count: %i\n \n, odp_version_api_str(), odp_sys_cpu_model_str(), - odp_sys_cpu_hz(), odp_sys_cache_line_size(), + odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index bdee222..ffe462d 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -988,7 +988,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), + odp_version_api_str(), odp_sys_cpu_model_str(), odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 91c7fad..54e3c98 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1516,7 +1516,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), + odp_version_api_str(), odp_sys_cpu_model_str(), odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 0db5a60..a583302 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -628,7 +628,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), + odp_version_api_str(), odp_sys_cpu_model_str(), odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 933dc3b..1528715 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -350,7 +350,7 @@ int main(int argc, char *argv[]) printf(---\n); printf(ODP API version: %s\n,odp_version_api_str()); printf(CPU model: %s\n,odp_sys_cpu_model_str()); - printf(CPU freq (hz): %PRIu64\n, odp_sys_cpu_hz()); + printf(CPU freq (hz): %PRIu64\n, odp_cpu_hz()); printf(Cache line size: %i\n,odp_sys_cache_line_size()); printf(Max CPU count: %i\n,odp_cpu_count()); @@ -445,7 +445,7 @@ int main(int argc, char *argv[]) return -1; } - printf(CPU freq %PRIu64 Hz\n, odp_sys_cpu_hz()); + printf(CPU freq %PRIu64 Hz\n, odp_cpu_hz()); printf(Cycles vs nanoseconds:\n); ns = 0; cycles = odp_time_ns_to_cycles(ns); diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index c389093..8ba9c26 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -44,6 +44,13 @@ int odp_cpu_id(void); int odp_cpu_count(void); /** + * CPU frequency in Hz + * + * @return CPU frequency in Hz + */ +uint64_t odp_cpu_hz(void); + +/** *
Re: [lng-odp] RFC - Application counters helpers
Hi, this is the reviewed version of the proposal, based on the received comments. Thanks, Alex typedef enum odph_counter_size { ODPH_COUNTER_SIZE_32BIT, ODPH_COUNTER_SIZE_64BIT, } odph_counter_size_t; typedef int32_t odph_counter_t; #define ODPH_COUNTER_INVALID(-1) /** * Creates a 32bit thread local counter * * Returns the counter handle * * @return Counter handle */ odph_counter_t odph_counter32_create_local(void); /** * Creates a 64bit thread local counter * * Returns the counter handle * * @return Counter handle */ odph_counter_t odph_counter64_create_local(void); /** * Get counter size * * Return the size of a counter * * @param Counter handle * @return Counter size * */ odph_counter_size_t odph_counter_size(odph_counter_t counter); /** * Set a 32bit counter to a given value * * @param Counter handle * @param Set value * */ void odph_counter32_set(odph_counter_t counter, uint32_t val); /** * Set a 64bit thread local counter to a given value * * @param Counter handle * @param Set value * */ void odph_counter64_set(odph_counter_t counter, uint64_t val); /** * Add a value to a 32bit thread local counter * * @param Counter handle * @param Value to add * */ void odph_counter32_add(odph_counter_t counter, unsigned int val); /** * Add a value to a 64bit thread local counter * * @param Counter handle * @param Value to add * */ void odph_counter64_add(odph_counter_t counter, unsigned int val); /** * Substract a value from a 32bit thread local counter * * @param Counter handle * @param Value to substract * */ void odph_counter32_sub(odph_counter_t counter, unsigned int val); /** * Substract a value from a 64bit thread local counter * * @param Counter handle * @param Value to substract * */ void odph_counter64_sub(odph_counter_t counter, unsigned int val); /** * Return the value of a 32bit thread local counter * * @param Counter handle * @return Counter value * */ uint32_t odph_counter32_read_local(odph_counter_t counter); /** * Return the value of a 64bit thread local counter * * @param Counter handle * @return Counter value * */ uint64_t odph_counter64_read_local(odph_counter_t counter); /** * Return global value of a counter by summing thread local values * Caller has to make sure that all threads created the local * counter prior calling this function. * * @param Thread array * @param Number of threads in the array * @param Counter handle * * @return Counter value * */ uint64_t odph_counter_read_global(odph_linux_pthread_t *thread_tbl, int num, odph_counter_t counter); On 30 July 2015 at 16:36, Bala Manoharan bala.manoha...@linaro.org wrote: Hi, Yes. The above use-case makes sense. Also we need to document explicit limitation that these variables should be created before starting the worker threads and that dynamic creation of variables should be avoided. Regards, Bala On 30 July 2015 at 13:29, Alexandru Badicioiu alexandru.badici...@linaro.org wrote: Bala, I agree that functions to subtract from a counter or reset it to 0 or other value might be required for the completeness. I don't see these functions as APIs (since the implementation is the same for all HW) but only as an application helper and only in case the application uses threads as workers. Implementation defined counters is something that we may address in the future. These helpers can be used the following way: Each application defines its own counters, for example in case of odp_ipsec one counter can be number of packets/bytes per SA. Based on command line switches (e.g. -d packets:sa -d bytes:sa) the main application thread builds a global list of counter creation requests before creating worker threads. When each worker thread starts, it walks the list, creates each requested counter and attaches the counter handle to the object it refers to, e.g: typedef struct sa_db_entry_s { struct sa_db_entry_s *next; /** Next entry on list */ .. odph_counter_tpackets; /** Counter for SA packets */ } sa_db_entry-packets = odph_counter_create_local(ODPH_COUNTER_SIZE_32BIT); The assumption here (for simplicity) is that each counter creation call returns the same handle in each thread - maybe this should change into something like : cnt = odph_counter_create_local(ODPH_COUNTER_SIZE_32BIT); odph_counter_attach(cnt, sa_db_entry-packets_cnt_list); where packets member of sa_db_entry changes into an array of odph_counter_t . Each time an SA has processed a packet, the processing thread increments (or adds too) the counter: odph_counter_add(entry-cipher_sa-packets, 1); odph_counter_add(entry-auth_sa-packets, 1); The main thread has the job to display the global counter value and what it does is : foreach_sa_db_entry(display_sa_counters, arg); static int display_sa_counters(sa_db_entry_t *sa_db_entry, void *arg) {
[lng-odp] [PATCHv6] example:generator:option to supply core mask
Signed-off-by: Balakrishna.Garapati balakrishna.garap...@linaro.org --- boundry check for cpu count vs cpumask_last to limit mask example/generator/odp_generator.c | 65 +++ 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index bdee222..a2d8c66 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -43,6 +43,7 @@ */ typedef struct { int cpu_count; /** system CPU count */ + const char *mask; /** s/core mask/CPU mask */ int if_count; /** Number of interfaces to be used */ char **if_names;/** Array of pointers to interface names */ char *if_str; /** Storage for interface names */ @@ -645,18 +646,31 @@ int main(int argc, char *argv[]) if (args-appl.cpu_count) num_workers = args-appl.cpu_count; - /* ping mode need two worker */ - if (args-appl.mode == APPL_MODE_PING) - num_workers = 2; + if (args-appl.mask) { + odp_cpumask_from_str(cpumask, args-appl.mask); + num_workers = odp_cpumask_count(cpumask); + if (odp_cpu_count() (odp_cpumask_last(cpumask) + 1)) { + num_workers = odp_cpumask_def_worker(cpumask, +num_workers); + } + } else { + num_workers = odp_cpumask_def_worker(cpumask, num_workers); + } - /* Get default worker cpumask */ - num_workers = odp_cpumask_def_worker(cpumask, num_workers); (void)odp_cpumask_to_str(cpumask, cpumaskstr, sizeof(cpumaskstr)); printf(num worker threads: %i\n, num_workers); printf(first CPU: %i\n, odp_cpumask_first(cpumask)); printf(cpu mask: %s\n, cpumaskstr); + /* ping mode need two workers */ + if (args-appl.mode == APPL_MODE_PING) { + if (num_workers 2) { + EXAMPLE_ERR(Need at least two worker threads\n); + exit(EXIT_FAILURE); + } + } + /* Create packet pool */ memset(params, 0, sizeof(params)); params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE; @@ -704,12 +718,13 @@ int main(int argc, char *argv[]) memset(thread_tbl, 0, sizeof(thread_tbl)); if (args-appl.mode == APPL_MODE_PING) { - odp_cpumask_t cpu0_mask; + odp_cpumask_t cpu_mask; odp_queue_t tq; + int cpu_first, cpu_next; - /* Previous code forced both threads to CPU 0 */ - odp_cpumask_zero(cpu0_mask); - odp_cpumask_set(cpu0_mask, 0); + odp_cpumask_zero(cpu_mask); + cpu_first = odp_cpumask_first(cpumask); + odp_cpumask_set(cpu_mask, cpu_first); tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -725,7 +740,7 @@ int main(int argc, char *argv[]) if (args-thread[1].tmo_ev == ODP_TIMEOUT_INVALID) abort(); args-thread[1].mode = args-appl.mode; - odph_linux_pthread_create(thread_tbl[1], cpu0_mask, + odph_linux_pthread_create(thread_tbl[1], cpu_mask, gen_recv_thread, args-thread[1]); tq = odp_queue_create(, ODP_QUEUE_TYPE_POLL, NULL); @@ -742,7 +757,10 @@ int main(int argc, char *argv[]) if (args-thread[0].tmo_ev == ODP_TIMEOUT_INVALID) abort(); args-thread[0].mode = args-appl.mode; - odph_linux_pthread_create(thread_tbl[0], cpu0_mask, + cpu_next = odp_cpumask_next(cpumask, cpu_first); + odp_cpumask_zero(cpu_mask); + odp_cpumask_set(cpu_mask, cpu_next); + odph_linux_pthread_create(thread_tbl[0], cpu_mask, gen_send_thread, args-thread[0]); /* only wait send thread to join */ @@ -824,11 +842,12 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static struct option longopts[] = { {interface, required_argument, NULL, 'I'}, {workers, required_argument, NULL, 'w'}, + {cpumask, required_argument, NULL, 'c'}, {srcmac, required_argument, NULL, 'a'}, {dstmac, required_argument, NULL, 'b'}, - {srcip, required_argument, NULL, 'c'}, + {srcip, required_argument, NULL, 's'}, {dstip, required_argument, NULL, 'd'}, - {packetsize, required_argument, NULL, 's'}, + {packetsize, required_argument, NULL, 'p'}, {mode, required_argument, NULL, 'm'}, {count,
[lng-odp] [API-NEXT PATCH v4 01/10] linux-generic: sysinfo: make the model_str per-CPU data
From: Hongbo Zhang hongbo.zh...@linaro.org For AMP system such as ARM big.LITTLE, cores are heterogeneous, and the model_str for each core may be different too, so this patch changes the model_str to data array model_str[] to contain data for each different core, while for the common SMP system, we can simply use the model_str[0] to contain data for all cores because they are all same, but if like, we can fill each item in the data array too. The new API to get each model_str for AMP system will be added later. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- platform/linux-generic/include/odp_internal.h | 4 +++- platform/linux-generic/odp_system_info.c | 28 +-- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 6f0050f..eac642c 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -23,13 +23,15 @@ extern C { extern __thread int __odp_errno; +#define MAX_CPU_NUMBER 128 + typedef struct { uint64_t cpu_hz; uint64_t huge_page_size; uint64_t page_size; int cache_line_size; int cpu_count; - char model_str[128]; + char model_str[MAX_CPU_NUMBER][128]; } odp_system_info_t; struct odp_global_data_s { diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 31df29e..cf6d5a7 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -139,10 +139,10 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) if (pos) { int len; pos = strchr(str, ':'); - strncpy(sysinfo-model_str, pos+2, - sizeof(sysinfo-model_str)); - len = strlen(sysinfo-model_str); - sysinfo-model_str[len - 1] = 0; + strncpy(sysinfo-model_str[0], pos + 2, + sizeof(sysinfo-model_str[0])); + len = strlen(sysinfo-model_str[0]); + sysinfo-model_str[0][len - 1] = 0; model = 1; count--; } @@ -188,10 +188,10 @@ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) if (pos) { int len; pos = strchr(str, ':'); - strncpy(sysinfo-model_str, pos+2, - sizeof(sysinfo-model_str)); - len = strlen(sysinfo-model_str); - sysinfo-model_str[len - 1] = 0; + strncpy(sysinfo-model_str[0], pos + 2, + sizeof(sysinfo-model_str[0])); + len = strlen(sysinfo-model_str[0]); + sysinfo-model_str[0][len - 1] = 0; model = 1; count--; } @@ -228,10 +228,10 @@ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) if (pos) { int len; pos = strchr(str, ':'); - strncpy(sysinfo-model_str, pos+2, - sizeof(sysinfo-model_str)); - len = strlen(sysinfo-model_str); - sysinfo-model_str[len - 1] = 0; + strncpy(sysinfo-model_str[0], pos + 2, + sizeof(sysinfo-model_str[0])); + len = strlen(sysinfo-model_str[0]); + sysinfo-model_str[0][len - 1] = 0; model = 1; count--; } @@ -333,7 +333,7 @@ static int systemcpu(odp_system_info_t *sysinfo) sysinfo-cpu_hz = 14; sysinfo-cache_line_size = 64; - strncpy(sysinfo-model_str, UNKNOWN, sizeof(sysinfo-model_str)); + strncpy(sysinfo-model_str[0], UNKNOWN, sizeof(sysinfo-model_str)); return 0; } @@ -391,7 +391,7 @@ uint64_t odp_sys_page_size(void) const char *odp_sys_cpu_model_str(void) { - return odp_global_data.system_info.model_str; + return odp_global_data.system_info.model_str[0]; } int odp_sys_cache_line_size(void) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH v4 00/10] linux-generic: sysinfo: CPU frequency API clean up
From: Hongbo Zhang hongbo.zh...@linaro.org v3 - v4 changes: - rebase to latest odp version - add odp_cpumask_available() to iterate each cpu v2 - v3 changes: - move all CPU related API declaration into cpu.h - refine tests for per-CPU APIs - revise API for getting current frequency v1 - v2 changes: - separate original 1/3 patch to two - add validation patch to test new APIs - other minor updates upon review comments v1 notes: The current API of getting CPU frequency is really ambiguous. CPU has its max frequency, and if enabled, the current frequency may be scaled from time to time, what's more, on some AMP platforms, cores are heterogenous, they have different max and current frequencies. This patch set cleans up these above issues. Patch 1/3 makes cpu_hz and model_str to be per-CPU data, then on AMP system, it is possible to acquire data for each different CPU. Patch 2/3 makes it clear that the cpu_hz stands for max CPU frequency Patch 3/3 adds new API to get the current CPU frequency if needed. Due to lack of test platform, only x86 platform is implemented right now, the others should follow up if this patch set is accepted. Hongbo Zhang (10): linux-generic: sysinfo: make the model_str per-CPU data linux-generic: sysinfo: make the cpu_hz per-CPU data linux-generic: sysinfo: move CPU HZ API to cpu.h linux-generic: sysinfo: move CPU model API to cpu.h linux-generic: sysinfo: clarify the API for max CPU frequency linux-generic: sysinfo: add new API to get model string for each CPU linux-generic: sysinfo: add new API to get max frequency for each CPU linux-generic: sysinfo: add API to get current CPU frequency linux-generic: cpumask: add API odp_cpumask_available() validation: add test for new per_CPU system APIs example/classifier/odp_classifier.c | 4 +- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c| 2 +- example/timer/odp_timer_test.c| 6 +- include/odp/api/cpu.h | 56 +++ include/odp/api/cpumask.h | 10 ++ include/odp/api/system_info.h | 14 --- platform/linux-generic/arch/linux/odp_time.c | 3 +- platform/linux-generic/include/odp_internal.h | 6 +- platform/linux-generic/odp_cpumask.c | 11 +++ platform/linux-generic/odp_system_info.c | 136 -- platform/linux-generic/odp_time.c | 5 +- test/api_test/odp_common.c| 4 +- test/performance/odp_atomic.c | 4 +- test/performance/odp_l2fwd.c | 2 +- test/performance/odp_scheduling.c | 4 +- test/validation/system/system.c | 74 -- test/validation/system/system.h | 8 +- 19 files changed, 279 insertions(+), 74 deletions(-) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH v4 02/10] linux-generic: sysinfo: make the cpu_hz per-CPU data
From: Hongbo Zhang hongbo.zh...@linaro.org For AMP system such as ARM big.LITTLE, cores are heterogeneous, and cpu_hz for each core may be different too, so this patch changes the cpu_hz to data array cpu_hz[] to contain data for each different core, while for the common SMP system, we can simply use the cpu_hz[0] to contain data for all cores because they are all same, but if like, we can fill each item in the data array too. The new API to get cpu_hz for each core on AMP system will be added later. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- platform/linux-generic/include/odp_internal.h | 2 +- platform/linux-generic/odp_system_info.c | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index eac642c..8a1a219 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -26,7 +26,7 @@ extern __thread int __odp_errno; #define MAX_CPU_NUMBER 128 typedef struct { - uint64_t cpu_hz; + uint64_t cpu_hz[MAX_CPU_NUMBER]; uint64_t huge_page_size; uint64_t page_size; int cache_line_size; diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index cf6d5a7..83226f8 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -149,7 +149,7 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) } } - sysinfo-cpu_hz = (uint64_t) (mhz * 100.0); + sysinfo-cpu_hz[0] = (uint64_t)(mhz * 100.0); return 0; } @@ -199,7 +199,7 @@ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) } /* bogomips seems to be 2x freq */ - sysinfo-cpu_hz = (uint64_t) (mhz * 100.0 / 2.0); + sysinfo-cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0); return 0; } @@ -237,7 +237,7 @@ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) } } - sysinfo-cpu_hz = (uint64_t) (mhz * 100.0); + sysinfo-cpu_hz[0] = (uint64_t)(mhz * 100.0); } @@ -330,7 +330,7 @@ static int systemcpu(odp_system_info_t *sysinfo) sysinfo-huge_page_size = huge_page_size(); /* Dummy values */ - sysinfo-cpu_hz = 14; + sysinfo-cpu_hz[0] = 14; sysinfo-cache_line_size = 64; strncpy(sysinfo-model_str[0], UNKNOWN, sizeof(sysinfo-model_str)); @@ -376,7 +376,7 @@ int odp_system_info_init(void) */ uint64_t odp_sys_cpu_hz(void) { - return odp_global_data.system_info.cpu_hz; + return odp_global_data.system_info.cpu_hz[0]; } uint64_t odp_sys_huge_page_size(void) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv2 0/3] move linux-generic specific things inside platform directory
ping. review needed. Maxim. On 08/07/15 14:00, Maxim Uvarov wrote: v2: - remove patch to change git_hash.sh, Anders works on that issue; - correct chunks between patches. Next plan might be to use AC_CONFIG_MACRO_DIRS macro to use all macro from specific directory. But it will require conversation of existence macro to macro similar to ax_. Best regards, Maxim. Maxim Uvarov (3): linux-generic: remove linux-generic makefile generation from common configure.ac linux-generic: move pthread checks inside linux-generic linux-generic: move openssl checks inside linux-generic configure.ac | 37 platform/linux-generic/m4/configure.m4 | 7 +- platform/linux-generic/m4/odp_openssl.m4 | 32 +++ platform/linux-generic/m4/odp_pthread.m4 | 13 +++ 4 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 platform/linux-generic/m4/odp_openssl.m4 create mode 100644 platform/linux-generic/m4/odp_pthread.m4 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH v4 07/10] linux-generic: sysinfo: add new API to get max frequency for each CPU
From: Hongbo Zhang hongbo.zh...@linaro.org Previous patch makes varible cpu_hz to array cpu_hz[] to contain data for each CPU on AMP platforms, and then this patch adds new API to get the corresponding max frequency for each CPU indexed by CPU ID. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- include/odp/api/cpu.h| 11 +++ platform/linux-generic/odp_system_info.c | 10 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 8f4d11b..36bc47f 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -51,6 +51,17 @@ int odp_cpu_count(void); uint64_t odp_cpu_hz_max(void); /** + * Maximum CPU frequency of a CPU (in Hz) + * + * Returns maximum frequency of the specified CPU + * + * @param idCPU ID + * + * @return CPU frequency in Hz + */ +uint64_t odp_cpu_id_hz_max(int id); + +/** * CPU model name * * @return Pointer to CPU model name string diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index a279061..55516d0 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -369,7 +369,15 @@ int odp_system_info_init(void) */ uint64_t odp_cpu_hz_max(void) { - return odp_global_data.system_info.cpu_hz[0]; + return odp_cpu_id_hz_max(0); +} + +uint64_t odp_cpu_id_hz_max(int id) +{ + if (id = 0 id MAX_CPU_NUMBER) + return odp_global_data.system_info.cpu_hz[id]; + else + return -1; } uint64_t odp_sys_huge_page_size(void) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH v4 06/10] linux-generic: sysinfo: add new API to get model string for each CPU
From: Hongbo Zhang hongbo.zh...@linaro.org Previous patch makes varible model_str to array model_str[] to contain data for each CPU on AMP platforms, and then this patch adds new API to get the corresponding model string for each CPU indexed by CPU ID. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- include/odp/api/cpu.h| 11 +++ platform/linux-generic/odp_system_info.c | 11 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 9d0aaf5..8f4d11b 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -58,6 +58,17 @@ uint64_t odp_cpu_hz_max(void); const char *odp_cpu_model_str(void); /** + * CPU model name of a CPU + * + * Return CPU model name of the specified CPU. + * + * @param idCPU ID + * + * @return Pointer to CPU model name string + */ +const char *odp_cpu_id_model_str(int id); + +/** * @} */ diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index d78fd3e..a279061 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -195,6 +195,7 @@ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) return 0; } + #elif defined __powerpc__ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) { @@ -383,7 +384,15 @@ uint64_t odp_sys_page_size(void) const char *odp_cpu_model_str(void) { - return odp_global_data.system_info.model_str[0]; + return odp_cpu_id_model_str(0); +} + +const char *odp_cpu_id_model_str(int id) +{ + if (id = 0 id MAX_CPU_NUMBER) + return odp_global_data.system_info.model_str[id]; + else + return NULL; } int odp_sys_cache_line_size(void) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH v4 04/10] linux-generic: sysinfo: move CPU model API to cpu.h
From: Hongbo Zhang hongbo.zh...@linaro.org This patch moves odp_sys_cpu_model_str() to cpu.h and accordingly rename it to odp_cpu_model_str(). All the calling functions are also updated. New CPU model APIs for AMP system will be added into this cpu.h too. Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c| 2 +- example/ipsec/odp_ipsec.c| 2 +- example/packet/odp_pktio.c | 2 +- example/timer/odp_timer_test.c | 2 +- include/odp/api/cpu.h| 7 +++ include/odp/api/system_info.h| 7 --- platform/linux-generic/odp_system_info.c | 2 +- test/api_test/odp_common.c | 2 +- test/performance/odp_atomic.c| 2 +- test/performance/odp_l2fwd.c | 2 +- test/performance/odp_scheduling.c| 2 +- test/validation/system/system.c | 6 +++--- test/validation/system/system.h | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 267b6a5..8b68ce0 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -732,7 +732,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_sys_cpu_model_str(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index ffe462d..2ed4ea2 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -988,7 +988,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_sys_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 54e3c98..32a91e4 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1516,7 +1516,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_sys_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index a583302..75de6b8 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -628,7 +628,7 @@ static void print_info(char *progname, appl_args_t *appl_args) Cache line size: %i\n CPU count: %i\n \n, - odp_version_api_str(), odp_sys_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), odp_sys_cache_line_size(), odp_cpu_count()); printf(Running ODP appl: \%s\\n diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 1528715..b7d3dcd 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -349,7 +349,7 @@ int main(int argc, char *argv[]) printf(ODP system info\n); printf(---\n); printf(ODP API version: %s\n,odp_version_api_str()); - printf(CPU model: %s\n,odp_sys_cpu_model_str()); + printf(CPU model: %s\n,odp_cpu_model_str()); printf(CPU freq (hz): %PRIu64\n, odp_cpu_hz()); printf(Cache line size: %i\n,odp_sys_cache_line_size()); printf(Max CPU count: %i\n,odp_cpu_count()); diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 8ba9c26..7b548ce 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -51,6 +51,13 @@ int odp_cpu_count(void); uint64_t odp_cpu_hz(void); /** + * CPU model name + * + * @return Pointer to CPU model name string + */ +const char *odp_cpu_model_str(void); + +/** * @} */ diff --git a/include/odp/api/system_info.h b/include/odp/api/system_info.h index f188b54..bde3a60 100644 --- a/include/odp/api/system_info.h +++ b/include/odp/api/system_info.h @@ -38,13 +38,6 @@ uint64_t odp_sys_huge_page_size(void); uint64_t odp_sys_page_size(void); /** - * CPU model name - * - * @return Pointer to CPU model name string - */ -const char *odp_sys_cpu_model_str(void); - -/** *
[lng-odp] [API-NEXT PATCH v4 10/10] validation: add test for new per_CPU system APIs
From: Hongbo Zhang hongbo.zh...@linaro.org This patch adds test for the newly introduced per-CPU system APIs: new per-CPU APIs: odp_cpu_id_hz_max(), odp_cpu_id_model_str() abd new crurrent frequency APIs: odp_cpu_hz(), odp_cpu_id_hz() Signed-off-by: Hongbo Zhang hongbo.zh...@linaro.org --- test/validation/system/system.c | 62 + test/validation/system/system.h | 4 +++ 2 files changed, 66 insertions(+) diff --git a/test/validation/system/system.c b/test/validation/system/system.c index 9134161..5348469 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -6,6 +6,7 @@ #include ctype.h #include odp.h +#include odp/cpumask.h #include odp_cunit_common.h #include test_debug.h #include system.h @@ -58,6 +59,23 @@ void system_test_odp_cpu_model_str(void) CU_ASSERT(strlen(model) 127); } +void system_test_odp_cpu_id_model_str(void) +{ + char model[128]; + odp_cpumask_t mask; + int i, num, cpu; + + num = odp_cpumask_available(mask); + cpu = odp_cpumask_first(mask); + + for (i = 0; i num; i++) { + snprintf(model, 128, %s, odp_cpu_id_model_str(cpu)); + CU_ASSERT(strlen(model) 0); + CU_ASSERT(strlen(model) 127); + cpu = odp_cpumask_next(mask, cpu); + } +} + void system_test_odp_sys_page_size(void) { uint64_t page; @@ -83,14 +101,58 @@ void system_test_odp_cpu_hz_max(void) CU_ASSERT(0 hz); } +void system_test_odp_cpu_id_hz_max(void) +{ + uint64_t hz; + odp_cpumask_t mask; + int i, num, cpu; + + num = odp_cpumask_available(mask); + cpu = odp_cpumask_first(mask); + + for (i = 0; i num; i++) { + hz = odp_cpu_id_hz_max(cpu); + CU_ASSERT(0 hz); + cpu = odp_cpumask_next(mask, cpu); + } +} + +void system_test_odp_cpu_hz(void) +{ + uint64_t hz; + + hz = odp_cpu_hz(); + CU_ASSERT(0 hz); +} + +void system_test_odp_cpu_id_hz(void) +{ + uint64_t hz; + odp_cpumask_t mask; + int i, num, cpu; + + num = odp_cpumask_available(mask); + cpu = odp_cpumask_first(mask); + + for (i = 0; i num; i++) { + hz = odp_cpu_id_hz(cpu); + CU_ASSERT(0 hz); + cpu = odp_cpumask_next(mask, cpu); + } +} + CU_TestInfo system_suite[] = { {odp version, system_test_odp_version_numbers}, {odp_cpu_count, system_test_odp_cpu_count}, {odp_sys_cache_line_size, system_test_odp_sys_cache_line_size}, {odp_cpu_model_str, system_test_odp_cpu_model_str}, + {odp_cpu_id_model_str, system_test_odp_cpu_id_model_str}, {odp_sys_page_size, system_test_odp_sys_page_size}, {odp_sys_huge_page_size, system_test_odp_sys_huge_page_size}, {odp_cpu_hz_max, system_test_odp_cpu_hz_max}, + {odp_cpu_id_hz_max, system_test_odp_cpu_id_hz_max}, + {odp_cpu_hz, system_test_odp_cpu_hz}, + {odp_cpu_id_hz, system_test_odp_cpu_id_hz}, CU_TEST_INFO_NULL, }; diff --git a/test/validation/system/system.h b/test/validation/system/system.h index 67ddb7a..1bcc164 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -14,9 +14,13 @@ void system_test_odp_version_numbers(void); void system_test_odp_cpu_count(void); void system_test_odp_sys_cache_line_size(void); void system_test_odp_cpu_model_str(void); +void system_test_odp_cpu_id_model_str(void); void system_test_odp_sys_page_size(void); void system_test_odp_sys_huge_page_size(void); void system_test_odp_cpu_hz_max(void); +void system_test_odp_cpu_id_hz_max(void); +void system_test_odp_cpu_hz(void); +void system_test_odp_cpu_id_hz(void); /* test arrays: */ extern CU_TestInfo system_suite[]; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [Bug 1745] cpumask function names odp_cpumask_def_*
https://bugs.linaro.org/show_bug.cgi?id=1745 Maxim Uvarov maxim.uva...@linaro.org changed: What|Removed |Added CC||maxim.uva...@linaro.org --- Comment #2 from Maxim Uvarov maxim.uva...@linaro.org --- actually both functions returns maximim available workers and control thread on the system by default. How about: odp_cpumask_max_workers() odp_cpumask_max_controls() -- You are receiving this mail because: You are the assignee for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv2] linux-generic: move default cpumask functions to separate file
Keep functions which iterates with bit mask and more likely will not be accelerated by hw in odp_cpumask.c. And put functions for default cpu mask to odp_cpumask_task.c, which is more platform specific. That patch should simplify portability to other platforms when odp_cpumask.c will be inherit from linux generic. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org --- v2: - copyright 2015 - odp_cpumask_def.c - odp_cpumask_task.c platform/linux-generic/Makefile.am| 1 + platform/linux-generic/odp_cpumask.c | 38 -- platform/linux-generic/odp_cpumask_task.c | 52 +++ 3 files changed, 53 insertions(+), 38 deletions(-) create mode 100644 platform/linux-generic/odp_cpumask_task.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index ed4add5..fb145e7 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -134,6 +134,7 @@ __LIB__libodp_la_SOURCES = \ odp_buffer.c \ odp_classification.c \ odp_cpumask.c \ + odp_cpumask_task.c \ odp_crypto.c \ odp_errno.c \ odp_event.c \ diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index c28153b..b31e1ca 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -205,41 +205,3 @@ int odp_cpumask_next(const odp_cpumask_t *mask, int cpu) return cpu; return -1; } - -int odp_cpumask_def_worker(odp_cpumask_t *mask, int num) -{ - int ret, cpu, i; - cpu_set_t cpuset; - - ret = pthread_getaffinity_np(pthread_self(), -sizeof(cpu_set_t), cpuset); - if (ret != 0) - ODP_ABORT(failed to read CPU affinity value\n); - - odp_cpumask_zero(mask); - - /* -* If no user supplied number or it's too large, then attempt -* to use all CPUs -*/ - if (0 == num || CPU_SETSIZE num) - num = CPU_COUNT(cpuset); - - /* build the mask, allocating down from highest numbered CPU */ - for (cpu = 0, i = CPU_SETSIZE - 1; i = 0 cpu num; --i) { - if (CPU_ISSET(i, cpuset)) { - odp_cpumask_set(mask, i); - cpu++; - } - } - - return cpu; -} - -int odp_cpumask_def_control(odp_cpumask_t *mask, int num ODP_UNUSED) -{ - odp_cpumask_zero(mask); - /* By default all control threads on CPU 0 */ - odp_cpumask_set(mask, 0); - return 1; -} diff --git a/platform/linux-generic/odp_cpumask_task.c b/platform/linux-generic/odp_cpumask_task.c new file mode 100644 index 000..665e82a --- /dev/null +++ b/platform/linux-generic/odp_cpumask_task.c @@ -0,0 +1,52 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include sched.h +#include pthread.h + +#include odp/cpumask.h +#include odp_debug_internal.h + +int odp_cpumask_def_worker(odp_cpumask_t *mask, int num) +{ + int ret, cpu, i; + cpu_set_t cpuset; + + ret = pthread_getaffinity_np(pthread_self(), +sizeof(cpu_set_t), cpuset); + if (ret != 0) + ODP_ABORT(failed to read CPU affinity value\n); + + odp_cpumask_zero(mask); + + /* +* If no user supplied number or it's too large, then attempt +* to use all CPUs +*/ + if (0 == num || CPU_SETSIZE num) + num = CPU_COUNT(cpuset); + + /* build the mask, allocating down from highest numbered CPU */ + for (cpu = 0, i = CPU_SETSIZE - 1; i = 0 cpu num; --i) { + if (CPU_ISSET(i, cpuset)) { + odp_cpumask_set(mask, i); + cpu++; + } + } + + return cpu; +} + +int odp_cpumask_def_control(odp_cpumask_t *mask, int num ODP_UNUSED) +{ + odp_cpumask_zero(mask); + /* By default all control threads on CPU 0 */ + odp_cpumask_set(mask, 0); + return 1; +} -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv2 0/3] move linux-generic specific things inside platform directory
On 2015-08-07 14:00, Maxim Uvarov wrote: v2: - remove patch to change git_hash.sh, Anders works on that issue; - correct chunks between patches. Next plan might be to use AC_CONFIG_MACRO_DIRS macro to use all macro from specific directory. But it will require conversation of existence macro to macro similar to ax_. Best regards, Maxim. Maxim Uvarov (3): linux-generic: remove linux-generic makefile generation from common configure.ac linux-generic: move pthread checks inside linux-generic linux-generic: move openssl checks inside linux-generic configure.ac | 37 platform/linux-generic/m4/configure.m4 | 7 +- platform/linux-generic/m4/odp_openssl.m4 | 32 +++ platform/linux-generic/m4/odp_pthread.m4 | 13 +++ 4 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 platform/linux-generic/m4/odp_openssl.m4 create mode 100644 platform/linux-generic/m4/odp_pthread.m4 -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp For this serie: Reviewed-by: Anders Roxell anders.rox...@linaro.org Cheers, Anders ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] helper: fix installation path for includes
Merged, Maxim. On 08/11/15 13:00, Anders Roxell wrote: On 2015-08-03 15:54, Nicolas Morey-Chaisemartin wrote: Install path was broken when helper installation moved out of the platform side as they were install in the top includedir and not $(includedir)/odp/helper Signed-off-by: Nicolas Morey-Chaisemartin nmo...@kalray.eu Reviewed-by: Anders Roxell anders.rox...@linaro.org --- helper/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/Makefile.am b/helper/Makefile.am index 44bcc3d..1a74e8e 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -7,7 +7,8 @@ AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include AM_CFLAGS += -I$(top_srcdir)/include -include_HEADERS = \ +helperincludedir = $(includedir)/odp/helper/ +helperinclude_HEADERS = \ $(srcdir)/include/odp/helper/ring.h \ $(srcdir)/include/odp/helper/linux.h \ $(srcdir)/include/odp/helper/chksum.h\ ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv2 4/4] validation: classification: queue and drop policy API name change
validation support for API name change from odp_cos_set_drop() to odp_cos_drop_set() and odp_cos_set_queue() to odp_cos_queue_set() Fixes: https://bugs.linaro.org/show_bug.cgi?id=1711 Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org --- test/validation/classification/odp_classification_basic.c | 6 +++--- test/validation/classification/odp_classification_tests.c | 14 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c index 99202ee..36c5286 100644 --- a/test/validation/classification/odp_classification_basic.c +++ b/test/validation/classification/odp_classification_basic.c @@ -81,7 +81,7 @@ static void classification_test_cos_set_queue(void) queue_cos = odp_queue_create(queuename, ODP_QUEUE_TYPE_SCHED, qparam); - retval = odp_cos_set_queue(cos_queue, queue_cos); + retval = odp_cos_queue_set(cos_queue, queue_cos); CU_ASSERT(retval == 0); odp_cos_destroy(cos_queue); odp_queue_destroy(queue_cos); @@ -96,9 +96,9 @@ static void classification_test_cos_set_drop(void) cos_drop = odp_cos_create(cosname); CU_ASSERT_FATAL(cos_drop != ODP_COS_INVALID); - retval = odp_cos_set_drop(cos_drop, ODP_COS_DROP_POOL); + retval = odp_cos_drop_set(cos_drop, ODP_COS_DROP_POOL); CU_ASSERT(retval == 0); - retval = odp_cos_set_drop(cos_drop, ODP_COS_DROP_NEVER); + retval = odp_cos_drop_set(cos_drop, ODP_COS_DROP_NEVER); CU_ASSERT(retval == 0); odp_cos_destroy(cos_drop); } diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index ecf9db0..2760401 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -390,7 +390,7 @@ void configure_cls_pmr_chain(void) qparam); CU_ASSERT_FATAL(queue_list[CLS_PMR_CHAIN_SRC] != ODP_QUEUE_INVALID); - retval = odp_cos_set_queue(cos_list[CLS_PMR_CHAIN_SRC], + retval = odp_cos_queue_set(cos_list[CLS_PMR_CHAIN_SRC], queue_list[CLS_PMR_CHAIN_SRC]); CU_ASSERT(retval == 0); @@ -408,7 +408,7 @@ void configure_cls_pmr_chain(void) qparam); CU_ASSERT_FATAL(queue_list[CLS_PMR_CHAIN_DST] != ODP_QUEUE_INVALID); - retval = odp_cos_set_queue(cos_list[CLS_PMR_CHAIN_DST], + retval = odp_cos_queue_set(cos_list[CLS_PMR_CHAIN_DST], queue_list[CLS_PMR_CHAIN_DST]); parse_ipv4_string(CLS_PMR_CHAIN_SADDR, addr, mask); @@ -494,7 +494,7 @@ void configure_pktio_default_cos(void) ODP_QUEUE_TYPE_SCHED, qparam); CU_ASSERT_FATAL(queue_list[CLS_DEFAULT] != ODP_QUEUE_INVALID); - retval = odp_cos_set_queue(cos_list[CLS_DEFAULT], + retval = odp_cos_queue_set(cos_list[CLS_DEFAULT], queue_list[CLS_DEFAULT]); CU_ASSERT(retval == 0); @@ -541,7 +541,7 @@ void configure_pktio_error_cos(void) cos_list[CLS_ERROR] = odp_cos_create(cosname); CU_ASSERT_FATAL(cos_list[CLS_ERROR] != ODP_COS_INVALID); - retval = odp_cos_set_queue(cos_list[CLS_ERROR], queue_list[CLS_ERROR]); + retval = odp_cos_queue_set(cos_list[CLS_ERROR], queue_list[CLS_ERROR]); CU_ASSERT(retval == 0); retval = odp_pktio_error_cos_set(pktio_loop, cos_list[CLS_ERROR]); @@ -628,7 +628,7 @@ void configure_cos_with_l2_priority(void) qparam); CU_ASSERT_FATAL(queue_tbl[i] != ODP_QUEUE_INVALID); queue_list[CLS_L2_QOS_0 + i] = queue_tbl[i]; - retval = odp_cos_set_queue(cos_tbl[i], queue_tbl[i]); + retval = odp_cos_queue_set(cos_tbl[i], queue_tbl[i]); CU_ASSERT(retval == 0); qos_tbl[i] = i; } @@ -690,7 +690,7 @@ void configure_pmr_cos(void) qparam); CU_ASSERT_FATAL(queue_list[CLS_PMR] != ODP_QUEUE_INVALID); - retval = odp_cos_set_queue(cos_list[CLS_PMR], + retval = odp_cos_queue_set(cos_list[CLS_PMR], queue_list[CLS_PMR]); CU_ASSERT(retval == 0); @@ -761,7 +761,7 @@ void configure_pktio_pmr_match_set_cos(void) qparam); CU_ASSERT_FATAL(queue_list[CLS_PMR_SET] != ODP_QUEUE_INVALID); - retval = odp_cos_set_queue(cos_list[CLS_PMR_SET], + retval = odp_cos_queue_set(cos_list[CLS_PMR_SET], queue_list[CLS_PMR_SET]); CU_ASSERT(retval == 0); -- 1.9.1
[lng-odp] [API-NEXT PATCHv2 2/4] example: classifier: queue and drop policy API name change
API name change from odp_cos_set_queue() to odp_cos_queue_set() Fixes: https://bugs.linaro.org/show_bug.cgi?id=1711 Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org --- example/classifier/odp_classifier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 3a16279..c7c650b 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -329,7 +329,7 @@ static void configure_default_queue(odp_pktio_t pktio, appl_args_t *args) queue_default = odp_queue_create(queue_name, ODP_QUEUE_TYPE_SCHED, qparam); - odp_cos_set_queue(cos_default, queue_default); + odp_cos_queue_set(cos_default, queue_default); odp_pktio_default_cos_set(pktio, cos_default); stats[args-policy_count].cos = cos_default; /* add default queue to global stats */ @@ -364,7 +364,7 @@ static void configure_cos_queue(odp_pktio_t pktio, appl_args_t *args) stats-queue = odp_queue_create(queue_name, ODP_QUEUE_TYPE_SCHED, qparam); - odp_cos_set_queue(stats-cos, stats-queue); + odp_cos_queue_set(stats-cos, stats-queue); odp_pktio_pmr_cos(stats-pmr, pktio, stats-cos); odp_atomic_init_u64(stats-packet_count, 0); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv2 3/4] linux-generic: classification: queue and drop policy API name change
linux-generic implementation support for API name change from odp_cos_set_queue() to odp_cos_queue_set() and odp_cos_set_drop() to odp_cos_drop_set(). Adds queue handle to cos internal structure to support odp_cos_queue() and odp_cos_drop() getter function. Fixes: https://bugs.linaro.org/show_bug.cgi?id=1711 Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org --- .../include/odp_classification_datamodel.h | 1 + platform/linux-generic/odp_classification.c| 33 -- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h index 9da54c7..cb970f1 100644 --- a/platform/linux-generic/include/odp_classification_datamodel.h +++ b/platform/linux-generic/include/odp_classification_datamodel.h @@ -70,6 +70,7 @@ struct cos_s { uint32_t valid; /* validity Flag */ odp_drop_e drop_policy; /* Associated Drop Policy */ odp_queue_group_t queue_group; /* Associated Queue Group */ + odp_queue_t queue_id; /* Associated Queue handle */ odp_cos_flow_set_t flow_set;/* Assigned Flow Set */ char name[ODP_COS_NAME_LEN];/* name */ size_t headroom;/* Headroom for this CoS */ diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index fdb544d..17c123a 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -265,7 +265,7 @@ int odp_cos_destroy(odp_cos_t cos_id) return 0; } -int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id) +int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id) { cos_t *cos = get_cos_entry(cos_id); if (cos == NULL) { @@ -275,13 +275,27 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id) /* Locking is not required as intermittent stale data during CoS modification is acceptable*/ cos-s.queue = queue_to_qentry(queue_id); + cos-s.queue_id = queue_id; return 0; } -int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy) +odp_queue_t odp_cos_queue(odp_cos_t cos_id) { cos_t *cos = get_cos_entry(cos_id); - if (cos == NULL) { + + if (!cos) { + ODP_ERR(Invalid odp_cos_t handle); + return ODP_QUEUE_INVALID; + } + + return cos-s.queue_id; +} + +int odp_cos_drop_set(odp_cos_t cos_id, odp_drop_e drop_policy) +{ + cos_t *cos = get_cos_entry(cos_id); + + if (!cos) { ODP_ERR(Invalid odp_cos_t handle); return -1; } @@ -291,10 +305,23 @@ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy) return 0; } +odp_drop_e odp_cos_drop(odp_cos_t cos_id) +{ + cos_t *cos = get_cos_entry(cos_id); + + if (!cos) { + ODP_ERR(Invalid odp_cos_t handle); + return -1; + } + + return cos-s.drop_policy; +} + int odp_pktio_default_cos_set(odp_pktio_t pktio_in, odp_cos_t default_cos) { pktio_entry_t *entry; cos_t *cos; + entry = get_pktio_entry(pktio_in); if (entry == NULL) { ODP_ERR(Invalid odp_pktio_t handle); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv2 1/4] api: classification: queue and drop policy API name change
changes the name of classification APIs for ODP consistency odp_cos_set_queue() is changed to odp_cos_queue_set() odp_cos_set_drop() is changed to odp_cos_drop_set() Adds the following getter functions odp_cos_queue() odp_cos_drop() Fixes: https://bugs.linaro.org/show_bug.cgi?id=1711 Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org --- include/odp/api/classification.h | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index f597b26..2fdb767 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -120,7 +120,19 @@ int odp_cos_destroy(odp_cos_t cos_id); * @retval 0 on success * @retval 0 on failure */ -int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id); +int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id); + +/** +* Get the queue associated with the specific class-of-service +* +* @param[in] cos_id class-of-service instance. +* +* @retval queue_handleQueue handle associated with the +* given class-of-service +* +* @retval ODP_QUEUE_INVALID on failure +*/ +odp_queue_t odp_cos_queue(odp_cos_t cos_id); /** * Assign packet drop policy for specific class-of-service @@ -133,7 +145,17 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id); * * @note Optional. */ -int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy); +int odp_cos_drop_set(odp_cos_t cos_id, odp_drop_e drop_policy); + +/** +* Get the drop policy configured for a specific class-of-service instance. +* +* @param[in] cos_id class-of-service instance. +* +* @retval Drop policy configured with the given +* class-of-service +*/ +odp_drop_e odp_cos_drop(odp_cos_t cos_id); /** * Request to override per-port class of service -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv2 0/3] move linux-generic specific things inside platform directory
Merged! On 08/11/15 14:47, Nicolas Morey-Chaisemartin wrote: Shouldn't OpenSSL/Pthread m4 files go into the top m4/ folder and the platform/plat/m4 use them? The check in themselves are platform generic. The fact that we use/include them is platform specific. That need to think about possible props and cons about having that in top level directory. Merging it as we have now and probably separate patch will be to move to top level. So it will be easy to revert it if any issue. Maxim. Otherwise: Reviewed-by: Nicolas Morey-Chaisemartin mo...@kalray.eu On 08/07/2015 01:00 PM, Maxim Uvarov wrote: v2: - remove patch to change git_hash.sh, Anders works on that issue; - correct chunks between patches. Next plan might be to use AC_CONFIG_MACRO_DIRS macro to use all macro from specific directory. But it will require conversation of existence macro to macro similar to ax_. Best regards, Maxim. Maxim Uvarov (3): linux-generic: remove linux-generic makefile generation from common configure.ac linux-generic: move pthread checks inside linux-generic linux-generic: move openssl checks inside linux-generic configure.ac | 37 platform/linux-generic/m4/configure.m4 | 7 +- platform/linux-generic/m4/odp_openssl.m4 | 32 +++ platform/linux-generic/m4/odp_pthread.m4 | 13 +++ 4 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 platform/linux-generic/m4/odp_openssl.m4 create mode 100644 platform/linux-generic/m4/odp_pthread.m4 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv2 0/3] move linux-generic specific things inside platform directory
Shouldn't OpenSSL/Pthread m4 files go into the top m4/ folder and the platform/plat/m4 use them? The check in themselves are platform generic. The fact that we use/include them is platform specific. Otherwise: Reviewed-by: Nicolas Morey-Chaisemartin mo...@kalray.eu On 08/07/2015 01:00 PM, Maxim Uvarov wrote: v2: - remove patch to change git_hash.sh, Anders works on that issue; - correct chunks between patches. Next plan might be to use AC_CONFIG_MACRO_DIRS macro to use all macro from specific directory. But it will require conversation of existence macro to macro similar to ax_. Best regards, Maxim. Maxim Uvarov (3): linux-generic: remove linux-generic makefile generation from common configure.ac linux-generic: move pthread checks inside linux-generic linux-generic: move openssl checks inside linux-generic configure.ac | 37 platform/linux-generic/m4/configure.m4 | 7 +- platform/linux-generic/m4/odp_openssl.m4 | 32 +++ platform/linux-generic/m4/odp_pthread.m4 | 13 +++ 4 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 platform/linux-generic/m4/odp_openssl.m4 create mode 100644 platform/linux-generic/m4/odp_pthread.m4 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv1 1/4] api: classification: queue and drop policy API name change
changes the name of classification APIs for ODP consistency odp_cos_set_queue() is changed to odp_cos_queue_set() odp_cos_set_drop() is changed to odp_cos_drop_set() Adds the following getter functions odp_cos_queue() odp_cos_drop() Fixes: https://bugs.linaro.org/show_bug.cgi?id=1711 Signed-off-by: Balasubramanian Manoharan bala.manoha...@linaro.org --- include/odp/api/classification.h | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index f597b26..2fdb767 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -120,7 +120,19 @@ int odp_cos_destroy(odp_cos_t cos_id); * @retval 0 on success * @retval 0 on failure */ -int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id); +int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id); + +/** +* Get the queue associated with the specific class-of-service +* +* @param[in] cos_id class-of-service instance. +* +* @retval queue_handleQueue handle associated with the +* given class-of-service +* +* @retval ODP_QUEUE_INVALID on failure +*/ +odp_queue_t odp_cos_queue(odp_cos_t cos_id); /** * Assign packet drop policy for specific class-of-service @@ -133,7 +145,17 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id); * * @note Optional. */ -int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy); +int odp_cos_drop_set(odp_cos_t cos_id, odp_drop_e drop_policy); + +/** +* Get the drop policy configured for a specific class-of-service instance. +* +* @param[in] cos_id class-of-service instance. +* +* @retval Drop policy configured with the given +* class-of-service +*/ +odp_drop_e odp_cos_drop(odp_cos_t cos_id); /** * Request to override per-port class of service -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv1 0/4] classification API name change
Changes in v2: Adds bug link in the patch description 1. This patch series renames the classification APIs for ODP consistency odp_cos_set_queue() is changed to odp_cos_queue_set() odp_cos_set_drop() is changed to odp_cos_drop_set() 2. Adds the following getter functions for classification odp_cos_queue() odp_cos_drop() Fixes https://bugs.linaro.org/show_bug.cgi?id=1711 Balasubramanian Manoharan (4): api: classification: queue and drop policy API name change example: classifier: queue and drop policy API name change linux-generic: classification: queue and drop policy API name change validation: classification: queue and drop policy API name change example/classifier/odp_classifier.c| 4 +-- include/odp/api/classification.h | 26 +++-- .../include/odp_classification_datamodel.h | 1 + platform/linux-generic/odp_classification.c| 33 -- .../classification/odp_classification_basic.c | 6 ++-- .../classification/odp_classification_tests.c | 14 - 6 files changed, 67 insertions(+), 17 deletions(-) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [Bug 1746] New: checkpatch.pl generates warning on ODP long function
https://bugs.linaro.org/show_bug.cgi?id=1746 Bug ID: 1746 Summary: checkpatch.pl generates warning on ODP long function Product: OpenDataPlane Version: unspecified Hardware: Other OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: --- Component: General ODP Assignee: lng-odp@lists.linaro.org Reporter: maxim.uva...@linaro.org Example: ODP_EXAMPLE_ERR(long message more then 80 chars\n); generates warning. But ODP_EXAMPLE_ERR was added as exception to checkpatch.pl to not generate such warning. Task needs knowledge of perl regular expressions. -- You are receiving this mail because: You are the assignee for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv6] example:generator:option to supply core mask
Hello Balakrishna, after some more thinking I think we not exactly right here. In parse: + case 'c': + appl_args-mask = optarg; + break; we have to check that mask is valid. I.e. compare results: odp_cpumask_from_str(cpumask_args, args-appl.mask); num_workers_args = odp_cpumask_count(cpumask); and num_workers = odp_cpumask_def_worker(cpumask, 0); Following should match: 1. num_workers_args = num_workers 2. cpumask_args should be inside cpumask. (that check covers 1, so first is optional). 3. num_workers = args.appl.cpu_count. If user requested core mask for workers which system can not provide, you should quit from program with readable message. Then on calculation workers you code will be very simple. Instead of: On 08/11/15 10:20, Balakrishna.Garapati wrote: + if (args-appl.mask) { + odp_cpumask_from_str(cpumask, args-appl.mask); + num_workers = odp_cpumask_count(cpumask); + if (odp_cpu_count() (odp_cpumask_last(cpumask) + 1)) { + num_workers = odp_cpumask_def_worker(cpumask, +num_workers); + } + } else { + num_workers = odp_cpumask_def_worker(cpumask, num_workers); + } it will be: + num_workers = odp_cpumask_def_worker(cpumask, num_workers); + if (args-appl.mask) { + odp_cpumask_from_str(cpumask, args-appl.mask); + num_workers = odp_cpumask_count(cpumask); } In that case you will not ovverrige cpu mask when you call odp_cpumask_def_worker() after calculation number cpus from command line. (code in that patch). Maxim. ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv6] example:generator:option to supply core mask
I will look at the suggestions and make the necessary changes. Thank you for the comments. On 11 August 2015 at 16:01, Maxim Uvarov maxim.uva...@linaro.org wrote: Hello Balakrishna, after some more thinking I think we not exactly right here. In parse: + case 'c': + appl_args-mask = optarg; + break; we have to check that mask is valid. I.e. compare results: odp_cpumask_from_str(cpumask_args, args-appl.mask); num_workers_args = odp_cpumask_count(cpumask); and num_workers = odp_cpumask_def_worker(cpumask, 0); Following should match: 1. num_workers_args = num_workers 2. cpumask_args should be inside cpumask. (that check covers 1, so first is optional). 3. num_workers = args.appl.cpu_count. If user requested core mask for workers which system can not provide, you should quit from program with readable message. Then on calculation workers you code will be very simple. Instead of: On 08/11/15 10:20, Balakrishna.Garapati wrote: + if (args-appl.mask) { + odp_cpumask_from_str(cpumask, args-appl.mask); + num_workers = odp_cpumask_count(cpumask); + if (odp_cpu_count() (odp_cpumask_last(cpumask) + 1)) { + num_workers = odp_cpumask_def_worker(cpumask, +num_workers); + } + } else { + num_workers = odp_cpumask_def_worker(cpumask, num_workers); + } it will be: + num_workers = odp_cpumask_def_worker(cpumask, num_workers); + if (args-appl.mask) { + odp_cpumask_from_str(cpumask, args-appl.mask); + num_workers = odp_cpumask_count(cpumask); } In that case you will not ovverrige cpu mask when you call odp_cpumask_def_worker() after calculation number cpus from command line. (code in that patch). Maxim. ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv] validation: kill odp_generator
Merged, changed topic from validation: to test: due to it's not validation test. Maxim. On 08/10/15 14:50, Mike Holmes wrote: Yes, happy for my reviewed-by from before, Stuarts suggestion just makes it better On 10 August 2015 at 05:13, Maxim Uvarov maxim.uva...@linaro.org mailto:maxim.uva...@linaro.org wrote: Mike, Stuart, ok? Maxim. On 08/06/15 15:17, Maxim Uvarov wrote: Usually odp_generator exists when veth is destroyed, but not always. Because cpu load impacts on other performance tests we have to be sure that odp_generator is not running in background. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org mailto:maxim.uva...@linaro.org --- v2: kill by pid instead of killall test/performance/odp_l2fwd_run | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/performance/odp_l2fwd_run b/test/performance/odp_l2fwd_run index e89bec8..c20a3e1 100755 --- a/test/performance/odp_l2fwd_run +++ b/test/performance/odp_l2fwd_run @@ -59,10 +59,13 @@ run_l2fwd() (odp_generator${EXEEXT} -I $IF0 \ --srcip 192.168.0.1 --dstip 192.168.0.2 -m u 21 /dev/null) \ 21 /dev/null + GEN_PID=$! echo Run odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2 odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2 + kill ${GEN_PID} + cleanup_pktio_env if [ $? -ne 0 ]; then echo cleanup_pktio_env error $? ___ lng-odp mailing list lng-odp@lists.linaro.org mailto:lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp -- Mike Holmes Technical Manager - Linaro Networking Group Linaro.org http://www.linaro.org/***│ *Open source software for ARM SoCs ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv2] linux-generic: move default cpumask functions to separate file
On 11 August 2015 at 08:47, Maxim Uvarov maxim.uva...@linaro.org wrote: Keep functions which iterates with bit mask and more likely will not be accelerated by hw in odp_cpumask.c. And put functions for default cpu mask to odp_cpumask_task.c, which is more platform specific. That patch should simplify portability to other platforms when odp_cpumask.c will be inherit from linux generic. Signed-off-by: Maxim Uvarov maxim.uva...@linaro.org Reviewed-by: Mike Holmes mike.hol...@linaro.org --- v2: - copyright 2015 - odp_cpumask_def.c - odp_cpumask_task.c platform/linux-generic/Makefile.am| 1 + platform/linux-generic/odp_cpumask.c | 38 -- platform/linux-generic/odp_cpumask_task.c | 52 +++ 3 files changed, 53 insertions(+), 38 deletions(-) create mode 100644 platform/linux-generic/odp_cpumask_task.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index ed4add5..fb145e7 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -134,6 +134,7 @@ __LIB__libodp_la_SOURCES = \ odp_buffer.c \ odp_classification.c \ odp_cpumask.c \ + odp_cpumask_task.c \ odp_crypto.c \ odp_errno.c \ odp_event.c \ diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index c28153b..b31e1ca 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -205,41 +205,3 @@ int odp_cpumask_next(const odp_cpumask_t *mask, int cpu) return cpu; return -1; } - -int odp_cpumask_def_worker(odp_cpumask_t *mask, int num) -{ - int ret, cpu, i; - cpu_set_t cpuset; - - ret = pthread_getaffinity_np(pthread_self(), -sizeof(cpu_set_t), cpuset); - if (ret != 0) - ODP_ABORT(failed to read CPU affinity value\n); - - odp_cpumask_zero(mask); - - /* -* If no user supplied number or it's too large, then attempt -* to use all CPUs -*/ - if (0 == num || CPU_SETSIZE num) - num = CPU_COUNT(cpuset); - - /* build the mask, allocating down from highest numbered CPU */ - for (cpu = 0, i = CPU_SETSIZE - 1; i = 0 cpu num; --i) { - if (CPU_ISSET(i, cpuset)) { - odp_cpumask_set(mask, i); - cpu++; - } - } - - return cpu; -} - -int odp_cpumask_def_control(odp_cpumask_t *mask, int num ODP_UNUSED) -{ - odp_cpumask_zero(mask); - /* By default all control threads on CPU 0 */ - odp_cpumask_set(mask, 0); - return 1; -} diff --git a/platform/linux-generic/odp_cpumask_task.c b/platform/linux-generic/odp_cpumask_task.c new file mode 100644 index 000..665e82a --- /dev/null +++ b/platform/linux-generic/odp_cpumask_task.c @@ -0,0 +1,52 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include sched.h +#include pthread.h + +#include odp/cpumask.h +#include odp_debug_internal.h + +int odp_cpumask_def_worker(odp_cpumask_t *mask, int num) +{ + int ret, cpu, i; + cpu_set_t cpuset; + + ret = pthread_getaffinity_np(pthread_self(), +sizeof(cpu_set_t), cpuset); + if (ret != 0) + ODP_ABORT(failed to read CPU affinity value\n); + + odp_cpumask_zero(mask); + + /* +* If no user supplied number or it's too large, then attempt +* to use all CPUs +*/ + if (0 == num || CPU_SETSIZE num) + num = CPU_COUNT(cpuset); + + /* build the mask, allocating down from highest numbered CPU */ + for (cpu = 0, i = CPU_SETSIZE - 1; i = 0 cpu num; --i) { + if (CPU_ISSET(i, cpuset)) { + odp_cpumask_set(mask, i); + cpu++; + } + } + + return cpu; +} + +int odp_cpumask_def_control(odp_cpumask_t *mask, int num ODP_UNUSED) +{ + odp_cpumask_zero(mask); + /* By default all control threads on CPU 0 */ + odp_cpumask_set(mask, 0); + return 1; +} -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp -- Mike Holmes Technical Manager - Linaro Networking Group Linaro.org │ Open source software for ARM SoCs ___ lng-odp mailing list lng-odp@lists.linaro.org
Re: [lng-odp] make check runs tests twice
On 10/08/15 15:51, Zoltan Kiss wrote: Hi, I've noticed that in ODP-DPDK make check runs the tests twice. I think it's because of the Makefile.am we get from linux-generic: #@with_platform@ works alone in subdir but not as part of a path??? SUBDIRS = @platform_with_platform@ \ helper \ test \ @platform_with_platform_test@ \ helper/test \ doc \ example \ scripts So make check will run in @platform_with_platform@ and @platform_with_platform_test@, and the former will also go into test to run the tests. I think it's not necessary, can we do anything to avoid this double run? this bit will sort it out: diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index 71470fb..345c874 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -18,7 +18,6 @@ AM_CFLAGS += -I$(top_srcdir)/helper/include DPDK_LIBS=-ldpdk -ldl -lm -lpcap LIBS += $(DPDK_LIBS) -SUBDIRS = test include_HEADERS = \ $(top_srcdir)/include/odp.h I've just ran make check on latest odp.git, and it doesn't seem to run the testcases at all, am I the only one seeing that problem? This last bit was my issue, I forgot to configure them. Regards, Zoltan ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH] api: pool: add buffer constructor for pool creation parameters
Applications can preset certain parts of the buffer or user area, so when that memory will be allocated it starts from a known state. If the platform allocates the memory during pool creation, it's enough to run the constructor after that. If it's allocating memory on demand, it should call the constructor each time. Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org --- include/odp/api/pool.h | 20 1 file changed, 20 insertions(+) diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h index 2e79a55..1bd19bf 100644 --- a/include/odp/api/pool.h +++ b/include/odp/api/pool.h @@ -41,6 +41,20 @@ extern C { #define ODP_POOL_NAME_LEN 32 /** + * Buffer constructor callback function for pools. + * + * @param pool Handle of the pool which owns the buffer + * @param buf_ctor_arg Opaque pointer defined in odp_pool_param_t + * @param buf Pointer to the buffer + * + * @note If the application specifies this pointer, it expects that every buffer + * is initialized with it when the underlying memory is allocated. + */ +typedef void (odp_pool_buf_ctor_t)(odp_pool_t pool, + void *buf_ctor_arg, + void *buf); + +/** * Pool parameters * Used to communicate pool creation options. */ @@ -88,6 +102,12 @@ typedef struct odp_pool_param_t { uint32_t num; } tmo; }; + + /** Buffer constructor to initialize every buffer. Use NULL if no + initialization needed. */ + odp_pool_buf_ctor_t *buf_ctor; + /** Opaque pointer passed to buffer constructor */ + void *buf_ctor_arg; } odp_pool_param_t; /** Packet pool*/ -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCH] api: packet: allow access to packet hash values
Applications can access the computed hash (if any) through these functions, and query the length the platform supports to store. Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org --- include/odp/api/packet.h| 16 include/odp/api/packet_io.h | 14 ++ 2 files changed, 30 insertions(+) diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index 3a454b5..66fa2a9 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -615,6 +615,22 @@ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); int odp_packet_is_segmented(odp_packet_t pkt); /** + * Hash pointer + * + * Returns pointer to the hash of the packet. Optionally returns the length of + * the hash as well. + * + * @param pkt Packet handle + * @param[out] len Length of hash area (output). + * Ignored when NULL. + * + * @return Hash pointer + * + * @see odp_pktio_hash_len() + */ +void *odp_packet_hash_ptr(odp_packet_t pkt, uint32_t *len); + +/** * Number of segments * * Returns number of segments in the packet. A packet has always at least one diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index e00d011..a065567 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -321,6 +321,20 @@ int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t offset); int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom); /** + * Hash length + * + * Returns length of hash space for this packet IO. + * + * @param pkt Packet handle + * Ignored when NULL. + * + * @return Hash length + * + * @see odp_packet_hash_ptr() + */ +uint32_t odp_pktio_hash_len(odp_pktio_t pktio); + +/** * Get printable value for an odp_pktio_t * * @param pktio odp_pktio_t handle to be printed -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp