Re: [lng-odp] odp_cpumask.h
-Original Message- From: ext Ola Liljedahl [mailto:ola.liljed...@linaro.org] Sent: Wednesday, January 28, 2015 1:29 PM To: Savolainen, Petri (NSN - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] odp_cpumask.h On 28 January 2015 at 12:21, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl Sent: Wednesday, January 28, 2015 12:48 PM To: LNG ODP Mailman List Subject: [lng-odp] odp_cpumask.h * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola It's an object size, so it can be changed to size_t (similar to e.g. snprintf()). Packet data len/offsets, buffer sizes, packet/bytes counts etc, should be uintxx_t - but object sizes should be size_t. Answer to: What happens if len output length? Maybe we copy the snprintf definition (except output also ending zero). Return number chars written (incl. str ending zero), otherwise return number of chars that would have been outputted (return len and clip output). This is more complicated to check for and goes against the convention of returning 0 for errors. I would prefer my suggestion with returning -(minimum required buffer size), there's a clear separation between success and error. And that we add a define with a suggested buffer size which will be usable when the CPU mask is full (all bits set), this seems to be 128 when using Linux cpu_set_t for the implementation. Of course ODP could use a smaller max size as well. About error from functions that return len. I'd have input param and return type the same, so that compiler don't complain when comparing those (maybe your audio was breaking on call yesterday on that part). e.g. size_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, size_t len); size_t len, out; char str[SIZE]; len = sizeof(str); out = odp_cpumask_to_str(mask, str, len); if (out len) { printf(output needs %z chars, out); ABORT(); } -Petri ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] example: l2fwd: fix a cpumask bug and compilation error
short subject says that you fixed compilation error, what is compilation error was there? Please change description to something more clear and put reference to bug to long log. Maxim. On 01/27/2015 03:31 PM, Ciprian Barbu wrote: Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- Fix for https://bugs.linaro.org/show_bug.cgi?id=1146 example/l2fwd/odp_l2fwd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 10d5d32..74eaf84 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -146,6 +146,7 @@ static void *pktio_queue_thread(void *arg) } /* unreachable */ + return NULL; } /** @@ -393,7 +394,7 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(thread_tbl[i], thd_mask, thr_run_func, gbl_args-thread[i]); - cpu = odp_cpumask_next(thd_mask, cpu); + cpu = odp_cpumask_next(cpumask, cpu); } /* Master thread waits for other threads to exit */ ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 3/4] example: ipsec: move L2/3/4 offset set
Packet offset set routines now verify that offset is not beyond packet length. IPSec example was attempting to set offsets before setting length to total packet length, causing a seg fault when code later tries to use L3 offset. Signed-off-by: Robbie King robk...@cisco.com --- example/ipsec/odp_ipsec_stream.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index 916acdb..7368a53 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -195,7 +195,6 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, /* Ethernet */ odp_packet_has_eth_set(pkt, 1); - odp_packet_l2_offset_set(pkt, data - base); eth = (odph_ethhdr_t *)data; data += sizeof(*eth); @@ -205,10 +204,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, /* IPv4 */ odp_packet_has_ipv4_set(pkt, 1); - odp_packet_l3_offset_set(pkt, data - base); ip = (odph_ipv4hdr_t *)data; data += sizeof(*ip); - odp_packet_l4_offset_set(pkt, data - base); /* Wait until almost finished to fill in mutable fields */ memset((char *)ip, 0, sizeof(*ip)); @@ -302,7 +299,6 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, /* Since ESP can pad we can now fix IP length */ ip-tot_len = odp_cpu_to_be_16(data - (uint8_t *)ip); - odp_packet_push_tail(pkt, data - base); /* Close AH if specified */ if (ah) { @@ -323,6 +319,12 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, memcpy(ah-icv, hash, 12); } + /* Correct set packet length offsets */ + odp_packet_push_tail(pkt, data - base); + odp_packet_l2_offset_set(pkt, (uint8_t *)eth - base); + odp_packet_l3_offset_set(pkt, (uint8_t *)ip - base); + odp_packet_l4_offset_set(pkt, ((uint8_t *)ip - base) + sizeof(*ip)); + /* Now fill in final IP header fields */ ip-ttl = 64; ip-tos = 0; -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 2/4] api: packet: add API to copy metadata
Add internal API to allow implementation to copy packet metatdata when replicating a packet. Add the call to crypto to fix test failure. Signed-off-by: Robbie King robk...@cisco.com --- platform/linux-generic/include/odp_packet_internal.h | 2 ++ platform/linux-generic/odp_crypto.c | 1 + platform/linux-generic/odp_packet.c | 14 ++ 3 files changed, 17 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 0ebc14b..16698cc 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -253,6 +253,8 @@ int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset, odp_packet_t dstpkt, uint32_t dstoffset, uint32_t len); +void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt); + odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl); int _odp_packet_parse(odp_packet_t pkt); diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 0cb87c8..71bee6c 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -368,6 +368,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params, ODP_ABORT(); _odp_packet_copy_to_packet(params-pkt, 0, params-out_pkt, 0, odp_packet_len(params-pkt)); + _odp_packet_copy_md_to_packet(params-pkt, params-out_pkt); odp_packet_free(params-pkt); params-pkt = ODP_PACKET_INVALID; } diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index bb049d1..a980239 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -591,6 +591,20 @@ int odp_packet_is_valid(odp_packet_t pkt) * */ +void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt) +{ + odp_packet_hdr_t *srchdr = odp_packet_hdr(srcpkt); + odp_packet_hdr_t *dsthdr = odp_packet_hdr(dstpkt); + + dsthdr-input = srchdr-input; + dsthdr-buf_hdr.buf_u64 = srchdr-buf_hdr.buf_u64; + odp_atomic_store_u32( + dsthdr-buf_hdr.ref_count, + odp_atomic_load_u32( + srchdr-buf_hdr.ref_count)); + copy_packet_parser_metadata(srchdr, dsthdr); +} + int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset, odp_packet_t dstpkt, uint32_t dstoffset, uint32_t len) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v7 2/3] linux-generic: Implement 32bit version of _odp_atomic_tptr_t
On 2015-01-27 21:41, Bill Fischofer wrote: On Tue, Jan 27, 2015 at 4:44 PM, Geoffrey Blake geoffrey.bl...@arm.com wrote: From: Geoffrey Blake geoffrey.bl...@arm.com Signed-off-by: Geoffrey Blake geoffrey.bl...@arm.com Reviewed-and-tested-by: Bill Fischofer bill.fischo...@linaro.org I wasn't able to build: make distcheck... I think we can add something like this (see below)... We need to figure out a better name than config.h and a better name than I used as well... =) Maybe this file should be placed in the platform/linux-generic/include/ directory with some sensible name Or should we place this file in the ROOT_DIR/include/ directory after the reorganisation? Do we want to expose this file to the users? If we agree on doing this, I think this should go in as a separate prior too this patch. Cheers, Anders diff --git a/configure.ac b/configure.ac index 7f689de..37f2e2e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ AC_PREREQ([2.5]) AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), [lng-odp@lists.linaro.org]) AM_INIT_AUTOMAKE([subdir-objects]) -AC_CONFIG_SRCDIR([helper/config.h.in]) -AM_CONFIG_HEADER([helper/config.h]) +AC_CONFIG_SRCDIR([platform/linux-generic/include/odp_gen_config.h.in]) +AM_CONFIG_HEADER([platform/linux-generic/include/odp_gen_config.h]) AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE diff --git a/helper/.gitignore b/helper/.gitignore deleted file mode 100644 index f282c15..000 --- a/helper/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -config.h.in -config.h -stamp-h1 diff --git a/platform/linux-generic/.gitignore b/platform/linux-generic/.gitignore new file mode 100644 index 000..5e8e32f --- /dev/null +++ b/platform/linux-generic/.gitignore @@ -0,0 +1,3 @@ +odp_gen_config.h.in +odp_gen_config.h +stamp-h1 diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 4c226a8..fae586a 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/platform/Makefile.inc AM_CFLAGS += -I$(srcdir)/include AM_CFLAGS += -I$(srcdir)/include/api -AM_CFLAGS += -I$(top_srcdir)/helper/include -I$(top_srcdir)/helper +AM_CFLAGS += -I$(top_srcdir)/helper/include include_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/api/odp.h \ @@ -49,6 +49,7 @@ noinst_HEADERS = \ ${top_srcdir}/platform/linux-generic/include/odp_classification_datamodel.h \ ${top_srcdir}/platform/linux-generic/include/odp_classification_inlines.h \ ${top_srcdir}/platform/linux-generic/include/odp_classification_internal.h \ + $(top_srcdir)/platform/linux-generic/include/odp_gen_config.h \ ${top_srcdir}/platform/linux-generic/include/odp_crypto_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_debug_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_internal.h \ diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index 90a515a..611f6d4 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -16,7 +16,7 @@ #ifndef ODP_ATOMIC_INTERNAL_H_ #define ODP_ATOMIC_INTERNAL_H_ -#include config.h +#include odp_gen_config.h #include odp_std_types.h #include odp_align.h #include odp_hints.h ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 0/4] api: crypto: ODP 1.0 API update
v1 - Move completion event allocation into implementation, allow synchronous implementation to return status immediately (i.e. no completion event involved). Fix two crypto related issues found during debug. v2 - Merged with odp_event_t changes. v3 - Changed bool to odp_bool_t throughout crypto API, examples and tests. Robbie King (4): api: crypto: new completion event scheme api: packet: add API to copy metadata example: ipsec: move L2/3/4 offset set api: crypto: change bool to odp_bool_t example/ipsec/odp_ipsec.c | 92 ++- example/ipsec/odp_ipsec_cache.c| 2 +- example/ipsec/odp_ipsec_cache.h| 4 +- example/ipsec/odp_ipsec_misc.h | 4 +- example/ipsec/odp_ipsec_sa_db.c| 4 +- example/ipsec/odp_ipsec_sa_db.h| 4 +- example/ipsec/odp_ipsec_sp_db.h| 6 +- example/ipsec/odp_ipsec_stream.c | 20 +++-- example/ipsec/odp_ipsec_stream.h | 6 +- platform/linux-generic/include/api/odp_crypto.h| 82 +++-- .../linux-generic/include/odp_crypto_internal.h| 8 +- .../linux-generic/include/odp_packet_internal.h| 2 + platform/linux-generic/odp_crypto.c| 100 + platform/linux-generic/odp_packet.c| 14 +++ test/validation/crypto/odp_crypto_test_async_inp.c | 89 +++--- test/validation/crypto/odp_crypto_test_sync_inp.c | 16 +++- 16 files changed, 193 insertions(+), 260 deletions(-) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3 4/4] api: crypto: change bool to odp_bool_t
Signed-off-by: Robbie King robk...@cisco.com --- example/ipsec/odp_ipsec.c| 12 ++-- example/ipsec/odp_ipsec_cache.c | 2 +- example/ipsec/odp_ipsec_cache.h | 4 ++-- example/ipsec/odp_ipsec_misc.h | 4 ++-- example/ipsec/odp_ipsec_sa_db.c | 4 ++-- example/ipsec/odp_ipsec_sa_db.h | 4 ++-- example/ipsec/odp_ipsec_sp_db.h | 6 +++--- example/ipsec/odp_ipsec_stream.c | 10 +- example/ipsec/odp_ipsec_stream.h | 6 +++--- platform/linux-generic/include/api/odp_crypto.h | 6 +++--- platform/linux-generic/include/odp_crypto_internal.h | 2 +- platform/linux-generic/odp_crypto.c | 4 ++-- test/validation/crypto/odp_crypto_test_async_inp.c | 2 +- test/validation/crypto/odp_crypto_test_sync_inp.c| 2 +- 14 files changed, 34 insertions(+), 34 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 814b915..fd0e111 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -674,7 +674,7 @@ pkt_disposition_e do_route_fwd_db(odp_packet_t pkt, pkt_ctx_t *ctx) static pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt, pkt_ctx_t *ctx, - bool *skip, + odp_bool_t *skip, odp_crypto_op_result_t *result) { uint8_t *buf = odp_packet_data(pkt); @@ -684,7 +684,7 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt, odph_esphdr_t *esp = NULL; ipsec_cache_entry_t *entry; odp_crypto_op_params_t params; - bool posted = 0; + odp_bool_t posted = 0; /* Default to skip IPsec */ *skip = TRUE; @@ -834,7 +834,7 @@ pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt, static pkt_disposition_e do_ipsec_out_classify(odp_packet_t pkt, pkt_ctx_t *ctx, - bool *skip) + odp_bool_t *skip) { uint8_t *buf = odp_packet_data(pkt); odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); @@ -957,7 +957,7 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t pkt, odp_crypto_op_result_t *result) { uint8_t *buf = odp_packet_data(pkt); - bool posted = 0; + odp_bool_t posted = 0; /* We were dispatched from atomic queue, assign sequence numbers */ if (ctx-ipsec.ah_offset) { @@ -1084,7 +1084,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) * o PKT_POSTED - packet/event has been queued for later */ do { - bool skip = FALSE; + odp_bool_t skip = FALSE; switch (ctx-state) { case PKT_STATE_INPUT_VERIFY: @@ -1303,7 +1303,7 @@ main(int argc, char *argv[]) * wait indefinitely */ if (stream_count) { - bool done; + odp_bool_t done; do { done = verify_stream_db_outputs(); sleep(1); diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c index 15180f2..5973dfe 100644 --- a/example/ipsec/odp_ipsec_cache.c +++ b/example/ipsec/odp_ipsec_cache.c @@ -39,7 +39,7 @@ void init_ipsec_cache(void) int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, sa_db_entry_t *auth_sa, crypto_api_mode_e api_mode, -bool in, +odp_bool_t in, odp_queue_t completionq, odp_pool_t out_pool) { diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h index b436bd6..98624bc 100644 --- a/example/ipsec/odp_ipsec_cache.h +++ b/example/ipsec/odp_ipsec_cache.h @@ -31,7 +31,7 @@ typedef enum { */ typedef struct ipsec_cache_entry_s { struct ipsec_cache_entry_s *next;/** Next entry on list */ - bool in_place;/** Crypto API mode */ + odp_bool_t in_place;/** Crypto API mode */ uint32_t src_ip; /** Source v4 address */ uint32_t dst_ip; /** Destination v4 address */ struct { @@ -88,7 +88,7 @@ void init_ipsec_cache(void); int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, sa_db_entry_t *auth_sa, crypto_api_mode_e api_mode, -bool in, +odp_bool_t in, odp_queue_t completionq,
Re: [lng-odp] [PATCH] api: packet: odp_packet_flags spec changes
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: Wednesday, January 28, 2015 12:37 AM To: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH] api: packet: odp_packet_flags spec changes Change odp_packet_error() to odp_packet_has_error() and delete odp_packet_errflag_frame_len() per v1.0 delta doc. Signed-off-by: Bill Fischofer bill.fischo...@linaro.org --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd/odp_l2fwd.c | 2 +- example/packet/odp_pktio.c| 2 +- platform/linux-generic/include/api/odp_packet_flags.h | 13 +++-- platform/linux-generic/odp_packet_flags.c | 9 + test/validation/buffer/odp_packet_test.c | 5 + test/validation/odp_pktio.c | 2 +- 8 files changed, 10 insertions(+), 27 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 492664e..ad62e08 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_event(ev); /* Drop packets with errors */ - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); continue; } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2d2fc7..22fddb2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -616,7 +616,7 @@ static pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx EXAMPLE_UNUSED) { - if (odp_unlikely(odp_packet_error(pkt))) + if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; if (!odp_packet_has_eth(pkt)) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 18403da..305d9ae 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index c4c720b..1972dfa 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index 24c4065..c239a28 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -32,17 +32,10 @@ extern C { * Checks all error flags at once. * * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise + * @retval 1 packet has errors + * @retval 0 packet has no errors */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); +int odp_packet_has_error(odp_packet_t pkt); /** * Check for L2 header, e.g. ethernet diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux- generic/odp_packet_flags.c index 3f0ea9f..e678f66 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -8,18 +8,11 @@ #include odp_packet_internal.h -int odp_packet_error(odp_packet_t pkt) +int odp_packet_has_error(odp_packet_t pkt) { return (odp_packet_hdr(pkt)-error_flags.all != 0); } -/* Get Error Flags */ - -int odp_packet_errflag_frame_len(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)-error_flags.frame_len; -} - /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index c1b28ab..022f9a3 100644 ---
Re: [lng-odp] [PATCH v7 1/3] linux-generic: Implement _odp_atomic_tptr_t opaque type
On 2015-01-27 16:44, Geoffrey Blake wrote: From: Geoffrey Blake geoffrey.bl...@arm.com Create an opaque tagged pointer type for 32 and 64bit architectures with large tags to avoid the ABA problem with the lockless stack used in the buffer allocation code. Compiles cleanly under x86_64 and i386 and passes tests that stress allocator. Signed-off-by: Geoffrey Blake geoffrey.bl...@arm.com --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) configure.ac | 13 ++ .../linux-generic/include/odp_atomic_internal.h| 242 - 2 files changed, 253 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e5c1c56..3ba0a8c 100644 --- a/configure.ac +++ b/configure.ac @@ -184,6 +184,7 @@ AC_HELP_STRING([--with-openssl-path=DIR path to openssl libs and headers], ## OLD_LDFLAGS=$LDFLAGS OLD_CPPFLAGS=$CPPFLAGS +OLD_CFLAGS=$CFLAGS LDFLAGS=$AM_LDFLAGS $LDFLAGS CPPFLAGS=$AM_CPPFLAGS $CPPFLAGS Add: CFLAGS=$AM_CFLAGS $CFLAGS @@ -211,10 +212,22 @@ AC_CHECK_HEADERS([openssl/des.h openssl/rand.h openssl/hmac.h openssl/evp.h], [] [AC_MSG_ERROR([OpenSSL headers required])]) ## +# Check if compiler supports cmpxchng16 +## +CFLAGS=-mcx16 Change to: CFLAGS=$CFLAGS -mcx16 Cheers, Anders ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t
On 2015-01-27 21:42, Bill Fischofer wrote: On Tue, Jan 27, 2015 at 4:44 PM, Geoffrey Blake geoffrey.bl...@arm.com wrote: From: Geoffrey Blake geoffrey.bl...@arm.com Signed-off-by: Geoffrey Blake geoffrey.bl...@arm.com Reviewed-and-tested-by: Bill Fischofer bill.fischo...@linaro.org With this patch applied I wasn't able to run the odp_scheduling... make[3]: Entering directory '/home/anders/src/odp/test/performance' make[4]: Entering directory '/home/anders/src/odp/test/performance' ../../test-driver: line 107: 26602 Segmentation fault $@ $log_file 21 FAIL: odp_scheduling make[5]: Entering directory '/home/anders/src/odp/test/performance' make[5]: Nothing to be done for 'all'. make[5]: Leaving directory '/home/anders/src/odp/test/performance' Testsuite summary for OpenDataPlane 0.9.0 # TOTAL: 1 # PASS: 0 # SKIP: 0 # XFAIL: 0 # FAIL: 1 # XPASS: 0 # ERROR: 0 See test/performance/test-suite.log Please report to lng-odp@lists.linaro.org Makefile:749: recipe for target 'test-suite.log' failed make[4]: *** [test-suite.log] Error 1 make[4]: Leaving directory '/home/anders/src/odp/test/performance' Makefile:855: recipe for target 'check-TESTS' failed make[3]: *** [check-TESTS] Error 2 make[3]: Leaving directory '/home/anders/src/odp/test/performance' Makefile:928: recipe for target 'check-am' failed make[2]: *** [check-am] Error 2 make[2]: Leaving directory '/home/anders/src/odp/test/performance' Makefile:373: recipe for target 'check-recursive' failed make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory '/home/anders/src/odp/test' Makefile:457: recipe for target 'check-recursive' failed make: *** [check-recursive] Error 1 Cheers, Anders ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_cpumask.h
On 28 January 2015 at 11:48, Ola Liljedahl ola.liljed...@linaro.org wrote: * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? And what happens if the buffer is too small to fit the string generated from the CPU mask? There is no way to indicate failure. And I cannot find any recommended buffer size that would be safe to use. It is easy to imagine that code written for a machine with low CPU count might use a small buffer size and succeed but when run on a machine with high CPU count the output string will be longer than expected and the operation will fail. (I haven't looked at the implementation of odp_cpumask_to_str(), it might generate a constant sized output for all values of the cpumask). Do we want to return both a failure indication and what buffer size needs to be specified for successful operation? snprintf() does this in the following way: The functions snprintf() and vsnprintf() do not write more than size bytes (including the terminating null byte ('\0')). If the output was truncated due to this limit then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated. Or we return = 0 on success, the return value is the number of characters written (including/excluding the terminating null character) and 0 on failure and the returned value is the minimum size of the output buffer required for successful operation. -- Ola ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v7 1/3] linux-generic: Implement _odp_atomic_tptr_t opaque type
On 01/28/2015 01:44 AM, Geoffrey Blake wrote: From: Geoffrey Blake geoffrey.bl...@arm.com Create an opaque tagged pointer type for 32 and 64bit architectures with large tags to avoid the ABA problem with the lockless stack used in the buffer allocation code. Compiles cleanly under x86_64 and i386 and passes tests that stress allocator. Signed-off-by: Geoffrey Blake geoffrey.bl...@arm.com --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) configure.ac | 13 ++ .../linux-generic/include/odp_atomic_internal.h| 242 - 2 files changed, 253 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e5c1c56..3ba0a8c 100644 --- a/configure.ac +++ b/configure.ac @@ -184,6 +184,7 @@ AC_HELP_STRING([--with-openssl-path=DIR path to openssl libs and headers], ## OLD_LDFLAGS=$LDFLAGS OLD_CPPFLAGS=$CPPFLAGS +OLD_CFLAGS=$CFLAGS LDFLAGS=$AM_LDFLAGS $LDFLAGS CPPFLAGS=$AM_CPPFLAGS $CPPFLAGS @@ -211,10 +212,22 @@ AC_CHECK_HEADERS([openssl/des.h openssl/rand.h openssl/hmac.h openssl/evp.h], [] [AC_MSG_ERROR([OpenSSL headers required])]) ## +# Check if compiler supports cmpxchng16 +## +CFLAGS=-mcx16 +AC_MSG_CHECKING([whether CC supports -mcx16]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])] + [ODP_CFLAGS=$ODP_CFLAGS -mcx16], + [AC_MSG_RESULT([no])] +) It might be reasonable to put this check here: ./platform/linux-generic/m4/configure.m4 If it's linux-generic specific and other platfroms may not use it and it will be more easy to them to pull changes from linux-generic git tree. Maxim. + +## # Restore old saved variables ## LDFLAGS=$OLD_LDFLAGS CPPFLAGS=$OLD_CPPFLAGS +CFLAGS=$OLD_CFLAGS ## # Default warning setup diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index a02ecc5..3ac9720 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -36,7 +36,33 @@ extern C { typedef struct { void *v; /** Actual storage for the atomic variable */ } _odp_atomic_ptr_t -ODP_ALIGNED(sizeof(void *)); /* Enforce alignement! */ +ODP_ALIGNED(sizeof(void *)); /* Enforce alignment! */ + +/** + * Opaque tagged pointer atomic type + */ +#if defined __SIZEOF_INT128 defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +#define ODP_64BIT_HAVE_CMPX16 +/* Our system is 64bit and has cmpx16 support */ +typedef union { + __uint128_t v; + struct { + uint64_t tag; + void *ptr; + } tptr; +} _odp_atomic_tptr_t +ODP_ALIGNED(sizeof(__int128)); +#else +/* Fallback path for all other archs */ +typedef struct { + char lock; + struct { + uint64_t tag; + void *ptr; + } tptr; +} _odp_atomic_tptr_t +ODP_ALIGNED(16); +#endif /** * Atomic flag (boolean) type @@ -471,7 +497,7 @@ static inline void _odp_atomic_ptr_init(_odp_atomic_ptr_t *atom, void *val) * * @return Value of the variable */ -static inline void *_odp_atomic_ptr_load(const _odp_atomic_ptr_t *atom, +static inline void *_odp_atomic_ptr_load(_odp_atomic_ptr_t *atom, _odp_memmodel_t mmodel) { return __atomic_load_n(atom-v, mmodel); @@ -534,6 +560,218 @@ static inline int _odp_atomic_ptr_cmp_xchg_strong( } /* + * Operations on tagged pointer atomics + * _odp_atomic_tptr_init - no return value + * _odp_atomic_tptr_load - return current value + * _odp_atomic_tptr_store - no return value + * _odp_atomic_tptr_xchg - return old value + * _odp_atomic_tptr_gettag - return tag value + * _odp_atomic_tptr_settag - no return value + * _odp_atomic_tptr_getptr - return pointer value + * _odp_atomic_tptr_setptr - no return value + */ +#if !defined ODP_64BIT_HAVE_CMPX16 +/** + * @internal + * Helper macro for lock-based atomic operations on 128-bit tagged pointers + * @param[in,out] atom Pointer to the atomic tagged pointer variable + * @param expr Expression used update the variable. + * @param mm Memory order to use. + * @return The old value of the variable. + */ +#define ATOMIC_TPTR_OP_MM(atom, expr, mm) \ +({ \ +_odp_atomic_tptr_t old_val; \ +/* Loop while lock is already taken, stop when lock becomes clear
Re: [lng-odp] odp_cpumask.h
-Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl Sent: Wednesday, January 28, 2015 12:48 PM To: LNG ODP Mailman List Subject: [lng-odp] odp_cpumask.h * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola It's an object size, so it can be changed to size_t (similar to e.g. snprintf()). Packet data len/offsets, buffer sizes, packet/bytes counts etc, should be uintxx_t - but object sizes should be size_t. Answer to: What happens if len output length? Maybe we copy the snprintf definition (except output also ending zero). Return number chars written (incl. str ending zero), otherwise return number of chars that would have been outputted (return len and clip output). -Petri ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] api: packet: odp_packet_flags spec changes
On 2015-01-27 16:36, Bill Fischofer wrote: Change odp_packet_error() to odp_packet_has_error() and delete odp_packet_errflag_frame_len() per v1.0 delta doc. I miss the rational for this... add it in here instead of pointing to a delta doc... that isn't linked here... Cheers, Anders Signed-off-by: Bill Fischofer bill.fischo...@linaro.org --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd/odp_l2fwd.c | 2 +- example/packet/odp_pktio.c| 2 +- platform/linux-generic/include/api/odp_packet_flags.h | 13 +++-- platform/linux-generic/odp_packet_flags.c | 9 + test/validation/buffer/odp_packet_test.c | 5 + test/validation/odp_pktio.c | 2 +- 8 files changed, 10 insertions(+), 27 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 492664e..ad62e08 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_event(ev); /* Drop packets with errors */ - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); continue; } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2d2fc7..22fddb2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -616,7 +616,7 @@ static pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx EXAMPLE_UNUSED) { - if (odp_unlikely(odp_packet_error(pkt))) + if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; if (!odp_packet_has_eth(pkt)) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 18403da..305d9ae 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index c4c720b..1972dfa 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index 24c4065..c239a28 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -32,17 +32,10 @@ extern C { * Checks all error flags at once. * * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise + * @retval 1 packet has errors + * @retval 0 packet has no errors */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); +int odp_packet_has_error(odp_packet_t pkt); /** * Check for L2 header, e.g. ethernet diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 3f0ea9f..e678f66 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -8,18 +8,11 @@ #include odp_packet_internal.h -int odp_packet_error(odp_packet_t pkt) +int odp_packet_has_error(odp_packet_t pkt) { return (odp_packet_hdr(pkt)-error_flags.all != 0); } -/* Get Error Flags */ - -int odp_packet_errflag_frame_len(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)-error_flags.frame_len; -} - /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index c1b28ab..022f9a3 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -435,10 +435,7 @@ static void packet_error_flags(void) *
Re: [lng-odp] [PULL REQUEST] reorganisation of API header files
On 2015-01-28 14:12, Maxim Uvarov wrote: Directory: platform/linux-generic/include/api/odp and: include/odp/api have the same files. Did you do copy instead of move? I did a git move... but git didn't figure out that when I added new files at the old location... =( Cheers, Anders Maxim. On 01/28/2015 01:50 PM, Maxim Uvarov wrote: Done anybody else work on testing/reviewing this? Maxim. On 01/28/2015 02:55 AM, Anders Roxell wrote: The following changes since commit 30b60c59ccf88fc04401c772862ca4770cd6d900: test: makefile: remove check_PROGRAMS (2015-01-27 20:17:29 +0300) are available in the git repository at: git://git.linaro.org/people/anders.roxell/odp.git master for you to fetch changes up to a0c6937ce76dc7d42fd7c70b62c121e93f94c722: api: version: move defines (2015-01-28 00:49:40 +0100) Anders Roxell (21): api: move generic API into the odp namespace api: atomic: move typedefs and inline functions api: byteorder: move typedefs defines, and inline functions api: cpumask: move typedefs and defines api: align: move internal macros internal api: align: move platform defines out of public API api: pool: move typedef and define api: buffer: move typedefs and defines api: packet: move typedefs and defines api: packet_io: move typedef and defines api: shared_memory: move typedef and defines api: classification: move typedefs and defines api: std_types: move typedef api: plat: move platform type headers into plat directory helper: move headers into namespace the odp/helper api: remove platform includes api: queue: move types and defines api: crypto: move type, define and enums api: schedule: move defines api: event: move types and defines api: version: move defines Taras Kondratiuk (5): api: move ODP headers to a directory doc: cfg: disable TYPEDEF_HIDES_STRUCT doc: cfg: fix structure attributes parsing api: atomic: move types documentation out of linux-generic api: byteorder: move types documentation out of linux-generic doc/doxygen.cfg| 17 +- example/Makefile.inc | 2 +- example/generator/odp_generator.c | 10 +- example/ipsec/odp_ipsec.c | 10 +- example/ipsec/odp_ipsec_cache.c| 2 +- example/ipsec/odp_ipsec_cache.h| 2 +- example/ipsec/odp_ipsec_fwd_db.h | 2 +- example/ipsec/odp_ipsec_loop_db.h | 2 +- example/ipsec/odp_ipsec_misc.h | 6 +- example/ipsec/odp_ipsec_stream.c | 6 +- example/l2fwd/odp_l2fwd.c | 6 +- example/packet/odp_pktio.c | 6 +- example/timer/odp_timer_test.c | 2 +- .../include/{odph_chksum.h = odp/helper/chksum.h} | 2 +- helper/include/{odph_eth.h = odp/helper/eth.h}| 8 +- helper/include/{odph_icmp.h = odp/helper/icmp.h} | 6 +- helper/include/{odph_ip.h = odp/helper/ip.h} | 8 +- .../include/{odph_ipsec.h = odp/helper/ipsec.h} | 8 +- .../include/{odph_linux.h = odp/helper/linux.h} | 0 helper/include/{odph_ring.h = odp/helper/ring.h} | 6 +- helper/include/{odph_tcp.h = odp/helper/tcp.h}| 6 +- helper/include/{odph_udp.h = odp/helper/udp.h}| 6 +- include/odp.h | 57 include/odp/api/align.h| 77 ++ .../api/odp_atomic.h = include/odp/api/atomic.h | 210 ++- .../api/odp_barrier.h = include/odp/api/barrier.h | 5 +- .../api/odp_buffer.h = include/odp/api/buffer.h | 26 +- include/odp/api/byteorder.h| 180 + .../odp/api/classification.h | 34 +-- .../odp_compiler.h = include/odp/api/compiler.h | 2 +- .../api/odp_config.h = include/odp/api/config.h | 2 +- .../api/odp_cpumask.h = include/odp/api/cpumask.h | 18 +- .../api/odp_crypto.h = include/odp/api/crypto.h | 117 + .../api/odp_debug.h = include/odp/api/debug.h | 6 +- .../api/odp_event.h = include/odp/api/event.h | 43 ++- .../api/odp_hints.h = include/odp/api/hints.h | 2 +- .../api/odp_init.h = include/odp/api/init.h | 4 +- .../api/odp_packet.h = include/odp/api/packet.h | 30 ++- .../odp/api/packet_flags.h | 6 +- .../odp_packet_io.h = include/odp/api/packet_io.h | 22 +- .../api/odp_pool.h = include/odp/api/pool.h | 18 +- .../api/odp_queue.h = include/odp/api/queue.h | 112 +--- .../api/odp_rwlock.h = include/odp/api/rwlock.h
Re: [lng-odp] odp_cpumask.h
-Original Message- From: ext Ola Liljedahl [mailto:ola.liljed...@linaro.org] Sent: Wednesday, January 28, 2015 2:03 PM To: Savolainen, Petri (NSN - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] odp_cpumask.h On 28 January 2015 at 12:55, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: ext Ola Liljedahl [mailto:ola.liljed...@linaro.org] Sent: Wednesday, January 28, 2015 1:29 PM To: Savolainen, Petri (NSN - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] odp_cpumask.h On 28 January 2015 at 12:21, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl Sent: Wednesday, January 28, 2015 12:48 PM To: LNG ODP Mailman List Subject: [lng-odp] odp_cpumask.h * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola It's an object size, so it can be changed to size_t (similar to e.g. snprintf()). Packet data len/offsets, buffer sizes, packet/bytes counts etc, should be uintxx_t - but object sizes should be size_t. Answer to: What happens if len output length? Maybe we copy the snprintf definition (except output also ending zero). Return number chars written (incl. str ending zero), otherwise return number of chars that would have been outputted (return len and clip output). This is more complicated to check for and goes against the convention of returning 0 for errors. I would prefer my suggestion with returning -(minimum required buffer size), there's a clear separation between success and error. And that we add a define with a suggested buffer size which will be usable when the CPU mask is full (all bits set), this seems to be 128 when using Linux cpu_set_t for the implementation. Of course ODP could use a smaller max size as well. About error from functions that return len. I'd have input param and return type the same, so that compiler don't complain when comparing those (maybe your audio was breaking on call yesterday on that part). No I didn't hear, my wifi router stopped working and had to be reset... e.g. size_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, size_t len); Better to use ssize_t then? The point is that the same type is used for len and return value. Explicitly signed type for len would not be intuitive. size_t len, out; char str[SIZE]; len = sizeof(str); out = odp_cpumask_to_str(mask, str, len); if (out len) { Simple yes. But we just defined the convention that we use negative values to indicate failures. Why not follow that here? To use positive values to indicate both success and error conditions seems confusing to me. snprintf is not a good example here. The same, unsigned type - so that compiler does not complain when comparing those two. size_t a; ssize_t b; if (a b) gcc -W -Wall ... main.c:17:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (a b) -Petri ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_cpumask.h
On 28 January 2015 at 12:55, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: ext Ola Liljedahl [mailto:ola.liljed...@linaro.org] Sent: Wednesday, January 28, 2015 1:29 PM To: Savolainen, Petri (NSN - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] odp_cpumask.h On 28 January 2015 at 12:21, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl Sent: Wednesday, January 28, 2015 12:48 PM To: LNG ODP Mailman List Subject: [lng-odp] odp_cpumask.h * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola It's an object size, so it can be changed to size_t (similar to e.g. snprintf()). Packet data len/offsets, buffer sizes, packet/bytes counts etc, should be uintxx_t - but object sizes should be size_t. Answer to: What happens if len output length? Maybe we copy the snprintf definition (except output also ending zero). Return number chars written (incl. str ending zero), otherwise return number of chars that would have been outputted (return len and clip output). This is more complicated to check for and goes against the convention of returning 0 for errors. I would prefer my suggestion with returning -(minimum required buffer size), there's a clear separation between success and error. And that we add a define with a suggested buffer size which will be usable when the CPU mask is full (all bits set), this seems to be 128 when using Linux cpu_set_t for the implementation. Of course ODP could use a smaller max size as well. About error from functions that return len. I'd have input param and return type the same, so that compiler don't complain when comparing those (maybe your audio was breaking on call yesterday on that part). I have tested mixing size_t and ssize_t and neither gcc nor clang complained. I was using -Wall -ansi -pedantic. Thus we can specify the buffer size is size_t and the return type ssize_t and when comparing the return value with a size_t variable or value there won't be any warning. size_t len = 10;//Start with a small value so that a retry will be forced char *str: for (;;) { str = malloc(len); if (str == NULL) perror(malloc), exit(EXIT_FAILURE); ssize_t out = odp_cpumask_to_str(mask, str, len); if (out 0) //success break; //failure, try with the recommended buffer size free(str); len = -out; } //do something with str free(str); e.g. size_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, size_t len); size_t len, out; char str[SIZE]; len = sizeof(str); out = odp_cpumask_to_str(mask, str, len); if (out len) { printf(output needs %z chars, out); ABORT(); } -Petri ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] api: packet: odp_packet_flags spec changes
The delta doc is the rationale. We're executing to that plan. On Wed, Jan 28, 2015 at 6:11 AM, Anders Roxell anders.rox...@linaro.org wrote: On 2015-01-27 16:36, Bill Fischofer wrote: Change odp_packet_error() to odp_packet_has_error() and delete odp_packet_errflag_frame_len() per v1.0 delta doc. I miss the rational for this... add it in here instead of pointing to a delta doc... that isn't linked here... Cheers, Anders Signed-off-by: Bill Fischofer bill.fischo...@linaro.org --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd/odp_l2fwd.c | 2 +- example/packet/odp_pktio.c| 2 +- platform/linux-generic/include/api/odp_packet_flags.h | 13 +++-- platform/linux-generic/odp_packet_flags.c | 9 + test/validation/buffer/odp_packet_test.c | 5 + test/validation/odp_pktio.c | 2 +- 8 files changed, 10 insertions(+), 27 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 492664e..ad62e08 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_event(ev); /* Drop packets with errors */ - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); continue; } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2d2fc7..22fddb2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -616,7 +616,7 @@ static pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx EXAMPLE_UNUSED) { - if (odp_unlikely(odp_packet_error(pkt))) + if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; if (!odp_packet_has_eth(pkt)) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 18403da..305d9ae 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index c4c720b..1972dfa 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index 24c4065..c239a28 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -32,17 +32,10 @@ extern C { * Checks all error flags at once. * * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise + * @retval 1 packet has errors + * @retval 0 packet has no errors */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); +int odp_packet_has_error(odp_packet_t pkt); /** * Check for L2 header, e.g. ethernet diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 3f0ea9f..e678f66 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -8,18 +8,11 @@ #include odp_packet_internal.h -int odp_packet_error(odp_packet_t pkt) +int odp_packet_has_error(odp_packet_t pkt) { return (odp_packet_hdr(pkt)-error_flags.all != 0); } -/* Get Error Flags */ - -int odp_packet_errflag_frame_len(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)-error_flags.frame_len; -} - /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) diff --git a/test/validation/buffer/odp_packet_test.c
Re: [lng-odp] [PATCHv2 0/4] api: cpumask: doxygen: cleanups and updates
Merged! Maxim. On 01/23/2015 11:30 PM, Anders Roxell wrote: cleanup and update doxygen comments Anders Roxell (4): api: cpumask: doxygen: cpumask_first: use app language api: cpumask: doxygen: add param to odp_cpumask_first api: cpumask: doxygen: cpumask_last: use app language api: cpumask: doxygen: add param to odp_cpumask_last platform/linux-generic/include/api/odp_cpumask.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_cpumask.h
On 28 January 2015 at 12:21, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl Sent: Wednesday, January 28, 2015 12:48 PM To: LNG ODP Mailman List Subject: [lng-odp] odp_cpumask.h * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola It's an object size, so it can be changed to size_t (similar to e.g. snprintf()). Packet data len/offsets, buffer sizes, packet/bytes counts etc, should be uintxx_t - but object sizes should be size_t. Answer to: What happens if len output length? Maybe we copy the snprintf definition (except output also ending zero). Return number chars written (incl. str ending zero), otherwise return number of chars that would have been outputted (return len and clip output). This is more complicated to check for and goes against the convention of returning 0 for errors. I would prefer my suggestion with returning -(minimum required buffer size), there's a clear separation between success and error. And that we add a define with a suggested buffer size which will be usable when the CPU mask is full (all bits set), this seems to be 128 when using Linux cpu_set_t for the implementation. Of course ODP could use a smaller max size as well. -Petri ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_cpumask.h
The following code compiles without warnings or errors: #include assert.h #include stddef.h #include stdio.h #include stdlib.h #include sys/types.h #include odp_cpumask.h void test(odp_cpumask_t mask) { /* Start with a small value so that a retry will be forced */ size_t len = 1; char *str; for (;;) { ssize_t out; str = malloc(len); if (str == NULL) perror(malloc), exit(EXIT_FAILURE); out = odp_cpumask_to_str(mask, str, len); if (out 0) /* success */ break; /* failure, try with the recommended buffer size */ free(str); len = -out; } /* do something with str */ free(str); } void test2(odp_cpumask_t mask) { char *str; size_t len; ssize_t out; /* Call with zero-length buffer, this will fail and return required * buffer size */ len = -odp_cpumask_to_str(mask, NULL, 0); str = malloc(len); if (str == NULL) perror(malloc), exit(EXIT_FAILURE); out = odp_cpumask_to_str(mask, str, len); assert(out 0); /* do something with str */ free(str); } ssize_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *buf, ssize_t bufsz); gcc -c -std=c99 -W -Wall -ansi -pedantic test.c -I platform/linux-generic/include/api/ Am I missing any important compiler flags this time? On 28 January 2015 at 13:32, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: (maybe your audio was breaking on call yesterday on that part). I have tested mixing size_t and ssize_t and neither gcc nor clang complained. I was using -Wall -ansi -pedantic. Missing -W from there ? -Wall is not enough... ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PULL REQUEST] reorganisation of API header files
Done anybody else work on testing/reviewing this? Maxim. On 01/28/2015 02:55 AM, Anders Roxell wrote: The following changes since commit 30b60c59ccf88fc04401c772862ca4770cd6d900: test: makefile: remove check_PROGRAMS (2015-01-27 20:17:29 +0300) are available in the git repository at: git://git.linaro.org/people/anders.roxell/odp.git master for you to fetch changes up to a0c6937ce76dc7d42fd7c70b62c121e93f94c722: api: version: move defines (2015-01-28 00:49:40 +0100) Anders Roxell (21): api: move generic API into the odp namespace api: atomic: move typedefs and inline functions api: byteorder: move typedefs defines, and inline functions api: cpumask: move typedefs and defines api: align: move internal macros internal api: align: move platform defines out of public API api: pool: move typedef and define api: buffer: move typedefs and defines api: packet: move typedefs and defines api: packet_io: move typedef and defines api: shared_memory: move typedef and defines api: classification: move typedefs and defines api: std_types: move typedef api: plat: move platform type headers into plat directory helper: move headers into namespace the odp/helper api: remove platform includes api: queue: move types and defines api: crypto: move type, define and enums api: schedule: move defines api: event: move types and defines api: version: move defines Taras Kondratiuk (5): api: move ODP headers to a directory doc: cfg: disable TYPEDEF_HIDES_STRUCT doc: cfg: fix structure attributes parsing api: atomic: move types documentation out of linux-generic api: byteorder: move types documentation out of linux-generic doc/doxygen.cfg| 17 +- example/Makefile.inc | 2 +- example/generator/odp_generator.c | 10 +- example/ipsec/odp_ipsec.c | 10 +- example/ipsec/odp_ipsec_cache.c| 2 +- example/ipsec/odp_ipsec_cache.h| 2 +- example/ipsec/odp_ipsec_fwd_db.h | 2 +- example/ipsec/odp_ipsec_loop_db.h | 2 +- example/ipsec/odp_ipsec_misc.h | 6 +- example/ipsec/odp_ipsec_stream.c | 6 +- example/l2fwd/odp_l2fwd.c | 6 +- example/packet/odp_pktio.c | 6 +- example/timer/odp_timer_test.c | 2 +- .../include/{odph_chksum.h = odp/helper/chksum.h} | 2 +- helper/include/{odph_eth.h = odp/helper/eth.h}| 8 +- helper/include/{odph_icmp.h = odp/helper/icmp.h} | 6 +- helper/include/{odph_ip.h = odp/helper/ip.h} | 8 +- .../include/{odph_ipsec.h = odp/helper/ipsec.h} | 8 +- .../include/{odph_linux.h = odp/helper/linux.h} | 0 helper/include/{odph_ring.h = odp/helper/ring.h} | 6 +- helper/include/{odph_tcp.h = odp/helper/tcp.h}| 6 +- helper/include/{odph_udp.h = odp/helper/udp.h}| 6 +- include/odp.h | 57 include/odp/api/align.h| 77 ++ .../api/odp_atomic.h = include/odp/api/atomic.h | 210 ++- .../api/odp_barrier.h = include/odp/api/barrier.h | 5 +- .../api/odp_buffer.h = include/odp/api/buffer.h | 26 +- include/odp/api/byteorder.h| 180 + .../odp/api/classification.h | 34 +-- .../odp_compiler.h = include/odp/api/compiler.h | 2 +- .../api/odp_config.h = include/odp/api/config.h | 2 +- .../api/odp_cpumask.h = include/odp/api/cpumask.h | 18 +- .../api/odp_crypto.h = include/odp/api/crypto.h | 117 + .../api/odp_debug.h = include/odp/api/debug.h | 6 +- .../api/odp_event.h = include/odp/api/event.h | 43 ++- .../api/odp_hints.h = include/odp/api/hints.h | 2 +- .../api/odp_init.h = include/odp/api/init.h | 4 +- .../api/odp_packet.h = include/odp/api/packet.h | 30 ++- .../odp/api/packet_flags.h | 6 +- .../odp_packet_io.h = include/odp/api/packet_io.h | 22 +- .../api/odp_pool.h = include/odp/api/pool.h | 18 +- .../api/odp_queue.h = include/odp/api/queue.h | 112 +--- .../api/odp_rwlock.h = include/odp/api/rwlock.h | 4 +- .../odp_schedule.h = include/odp/api/schedule.h | 18 +- .../odp/api/shared_memory.h| 20 +- .../odp_spinlock.h = include/odp/api/spinlock.h | 4 +- include/odp/api/std_types.h| 42 +++ .../api/odp_sync.h = include/odp/api/sync.h | 2 +- .../odp/api/system_info.h | 4 +- .../api/odp_thread.h = include/odp/api/thread.h | 2
[lng-odp] odp_cpumask.h
* @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_cpumask.h
On 28 January 2015 at 13:28, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: ext Ola Liljedahl [mailto:ola.liljed...@linaro.org] Sent: Wednesday, January 28, 2015 2:03 PM To: Savolainen, Petri (NSN - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] odp_cpumask.h On 28 January 2015 at 12:55, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: ext Ola Liljedahl [mailto:ola.liljed...@linaro.org] Sent: Wednesday, January 28, 2015 1:29 PM To: Savolainen, Petri (NSN - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] odp_cpumask.h On 28 January 2015 at 12:21, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl Sent: Wednesday, January 28, 2015 12:48 PM To: LNG ODP Mailman List Subject: [lng-odp] odp_cpumask.h * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola It's an object size, so it can be changed to size_t (similar to e.g. snprintf()). Packet data len/offsets, buffer sizes, packet/bytes counts etc, should be uintxx_t - but object sizes should be size_t. Answer to: What happens if len output length? Maybe we copy the snprintf definition (except output also ending zero). Return number chars written (incl. str ending zero), otherwise return number of chars that would have been outputted (return len and clip output). This is more complicated to check for and goes against the convention of returning 0 for errors. I would prefer my suggestion with returning -(minimum required buffer size), there's a clear separation between success and error. And that we add a define with a suggested buffer size which will be usable when the CPU mask is full (all bits set), this seems to be 128 when using Linux cpu_set_t for the implementation. Of course ODP could use a smaller max size as well. About error from functions that return len. I'd have input param and return type the same, so that compiler don't complain when comparing those (maybe your audio was breaking on call yesterday on that part). No I didn't hear, my wifi router stopped working and had to be reset... e.g. size_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, size_t len); Better to use ssize_t then? The point is that the same type is used for len and return value. Explicitly signed type for len would not be intuitive. size_t len, out; char str[SIZE]; len = sizeof(str); out = odp_cpumask_to_str(mask, str, len); if (out len) { Simple yes. But we just defined the convention that we use negative values to indicate failures. Why not follow that here? To use positive values to indicate both success and error conditions seems confusing to me. snprintf is not a good example here. The same, unsigned type - so that compiler does not complain when comparing those two. size_t a; ssize_t b; if (a b) gcc -W -Wall ... main.c:17:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] OK seems this warning is not included in -Wall but is included in -W. I need to take this into consideration. if (a b) -Petri ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] odp_cpumask.h
(maybe your audio was breaking on call yesterday on that part). I have tested mixing size_t and ssize_t and neither gcc nor clang complained. I was using -Wall -ansi -pedantic. Missing -W from there ? -Wall is not enough... ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PULL REQUEST] reorganisation of API header files
Directory: platform/linux-generic/include/api/odp and: include/odp/api have the same files. Did you do copy instead of move? Maxim. On 01/28/2015 01:50 PM, Maxim Uvarov wrote: Done anybody else work on testing/reviewing this? Maxim. On 01/28/2015 02:55 AM, Anders Roxell wrote: The following changes since commit 30b60c59ccf88fc04401c772862ca4770cd6d900: test: makefile: remove check_PROGRAMS (2015-01-27 20:17:29 +0300) are available in the git repository at: git://git.linaro.org/people/anders.roxell/odp.git master for you to fetch changes up to a0c6937ce76dc7d42fd7c70b62c121e93f94c722: api: version: move defines (2015-01-28 00:49:40 +0100) Anders Roxell (21): api: move generic API into the odp namespace api: atomic: move typedefs and inline functions api: byteorder: move typedefs defines, and inline functions api: cpumask: move typedefs and defines api: align: move internal macros internal api: align: move platform defines out of public API api: pool: move typedef and define api: buffer: move typedefs and defines api: packet: move typedefs and defines api: packet_io: move typedef and defines api: shared_memory: move typedef and defines api: classification: move typedefs and defines api: std_types: move typedef api: plat: move platform type headers into plat directory helper: move headers into namespace the odp/helper api: remove platform includes api: queue: move types and defines api: crypto: move type, define and enums api: schedule: move defines api: event: move types and defines api: version: move defines Taras Kondratiuk (5): api: move ODP headers to a directory doc: cfg: disable TYPEDEF_HIDES_STRUCT doc: cfg: fix structure attributes parsing api: atomic: move types documentation out of linux-generic api: byteorder: move types documentation out of linux-generic doc/doxygen.cfg| 17 +- example/Makefile.inc | 2 +- example/generator/odp_generator.c | 10 +- example/ipsec/odp_ipsec.c | 10 +- example/ipsec/odp_ipsec_cache.c| 2 +- example/ipsec/odp_ipsec_cache.h| 2 +- example/ipsec/odp_ipsec_fwd_db.h | 2 +- example/ipsec/odp_ipsec_loop_db.h | 2 +- example/ipsec/odp_ipsec_misc.h | 6 +- example/ipsec/odp_ipsec_stream.c | 6 +- example/l2fwd/odp_l2fwd.c | 6 +- example/packet/odp_pktio.c | 6 +- example/timer/odp_timer_test.c | 2 +- .../include/{odph_chksum.h = odp/helper/chksum.h} | 2 +- helper/include/{odph_eth.h = odp/helper/eth.h}| 8 +- helper/include/{odph_icmp.h = odp/helper/icmp.h} | 6 +- helper/include/{odph_ip.h = odp/helper/ip.h} | 8 +- .../include/{odph_ipsec.h = odp/helper/ipsec.h} | 8 +- .../include/{odph_linux.h = odp/helper/linux.h} | 0 helper/include/{odph_ring.h = odp/helper/ring.h} | 6 +- helper/include/{odph_tcp.h = odp/helper/tcp.h}| 6 +- helper/include/{odph_udp.h = odp/helper/udp.h}| 6 +- include/odp.h | 57 include/odp/api/align.h| 77 ++ .../api/odp_atomic.h = include/odp/api/atomic.h | 210 ++- .../api/odp_barrier.h = include/odp/api/barrier.h | 5 +- .../api/odp_buffer.h = include/odp/api/buffer.h | 26 +- include/odp/api/byteorder.h| 180 + .../odp/api/classification.h | 34 +-- .../odp_compiler.h = include/odp/api/compiler.h | 2 +- .../api/odp_config.h = include/odp/api/config.h | 2 +- .../api/odp_cpumask.h = include/odp/api/cpumask.h | 18 +- .../api/odp_crypto.h = include/odp/api/crypto.h | 117 + .../api/odp_debug.h = include/odp/api/debug.h | 6 +- .../api/odp_event.h = include/odp/api/event.h | 43 ++- .../api/odp_hints.h = include/odp/api/hints.h | 2 +- .../api/odp_init.h = include/odp/api/init.h | 4 +- .../api/odp_packet.h = include/odp/api/packet.h | 30 ++- .../odp/api/packet_flags.h | 6 +- .../odp_packet_io.h = include/odp/api/packet_io.h | 22 +- .../api/odp_pool.h = include/odp/api/pool.h | 18 +- .../api/odp_queue.h = include/odp/api/queue.h | 112 +--- .../api/odp_rwlock.h = include/odp/api/rwlock.h | 4 +- .../odp_schedule.h = include/odp/api/schedule.h | 18 +- .../odp/api/shared_memory.h| 20 +- .../odp_spinlock.h = include/odp/api/spinlock.h | 4 +- include/odp/api/std_types.h| 42
Re: [lng-odp] [PULL REQUEST] reorganisation of API header files
I only ran it so far, there is a lot to look at :) I think Taras is actually basing his work on these changes as they make managing a platform easier, his comment will be valuable. On 28 January 2015 at 06:52, Anders Roxell anders.rox...@linaro.org wrote: On 2015-01-28 14:12, Maxim Uvarov wrote: Directory: platform/linux-generic/include/api/odp and: include/odp/api have the same files. Did you do copy instead of move? I did a git move... but git didn't figure out that when I added new files at the old location... =( Cheers, Anders Maxim. On 01/28/2015 01:50 PM, Maxim Uvarov wrote: Done anybody else work on testing/reviewing this? Maxim. On 01/28/2015 02:55 AM, Anders Roxell wrote: The following changes since commit 30b60c59ccf88fc04401c772862ca4770cd6d900: test: makefile: remove check_PROGRAMS (2015-01-27 20:17:29 +0300) are available in the git repository at: git://git.linaro.org/people/anders.roxell/odp.git master for you to fetch changes up to a0c6937ce76dc7d42fd7c70b62c121e93f94c722: api: version: move defines (2015-01-28 00:49:40 +0100) Anders Roxell (21): api: move generic API into the odp namespace api: atomic: move typedefs and inline functions api: byteorder: move typedefs defines, and inline functions api: cpumask: move typedefs and defines api: align: move internal macros internal api: align: move platform defines out of public API api: pool: move typedef and define api: buffer: move typedefs and defines api: packet: move typedefs and defines api: packet_io: move typedef and defines api: shared_memory: move typedef and defines api: classification: move typedefs and defines api: std_types: move typedef api: plat: move platform type headers into plat directory helper: move headers into namespace the odp/helper api: remove platform includes api: queue: move types and defines api: crypto: move type, define and enums api: schedule: move defines api: event: move types and defines api: version: move defines Taras Kondratiuk (5): api: move ODP headers to a directory doc: cfg: disable TYPEDEF_HIDES_STRUCT doc: cfg: fix structure attributes parsing api: atomic: move types documentation out of linux-generic api: byteorder: move types documentation out of linux-generic doc/doxygen.cfg| 17 +- example/Makefile.inc | 2 +- example/generator/odp_generator.c | 10 +- example/ipsec/odp_ipsec.c | 10 +- example/ipsec/odp_ipsec_cache.c| 2 +- example/ipsec/odp_ipsec_cache.h| 2 +- example/ipsec/odp_ipsec_fwd_db.h | 2 +- example/ipsec/odp_ipsec_loop_db.h | 2 +- example/ipsec/odp_ipsec_misc.h | 6 +- example/ipsec/odp_ipsec_stream.c | 6 +- example/l2fwd/odp_l2fwd.c | 6 +- example/packet/odp_pktio.c | 6 +- example/timer/odp_timer_test.c | 2 +- .../include/{odph_chksum.h = odp/helper/chksum.h} | 2 +- helper/include/{odph_eth.h = odp/helper/eth.h}| 8 +- helper/include/{odph_icmp.h = odp/helper/icmp.h} | 6 +- helper/include/{odph_ip.h = odp/helper/ip.h} | 8 +- .../include/{odph_ipsec.h = odp/helper/ipsec.h} | 8 +- .../include/{odph_linux.h = odp/helper/linux.h} | 0 helper/include/{odph_ring.h = odp/helper/ring.h} | 6 +- helper/include/{odph_tcp.h = odp/helper/tcp.h}| 6 +- helper/include/{odph_udp.h = odp/helper/udp.h}| 6 +- include/odp.h | 57 include/odp/api/align.h| 77 ++ .../api/odp_atomic.h = include/odp/api/atomic.h | 210 ++- .../api/odp_barrier.h = include/odp/api/barrier.h | 5 +- .../api/odp_buffer.h = include/odp/api/buffer.h | 26 +- include/odp/api/byteorder.h| 180 + .../odp/api/classification.h | 34 +-- .../odp_compiler.h = include/odp/api/compiler.h | 2 +- .../api/odp_config.h = include/odp/api/config.h | 2 +- .../api/odp_cpumask.h = include/odp/api/cpumask.h | 18 +- .../api/odp_crypto.h = include/odp/api/crypto.h | 117 + .../api/odp_debug.h = include/odp/api/debug.h | 6 +- .../api/odp_event.h = include/odp/api/event.h | 43 ++- .../api/odp_hints.h = include/odp/api/hints.h | 2 +- .../api/odp_init.h = include/odp/api/init.h | 4 +-
Re: [lng-odp] odp_cpumask.h
On 28 January 2015 at 12:55, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: ext Ola Liljedahl [mailto:ola.liljed...@linaro.org] Sent: Wednesday, January 28, 2015 1:29 PM To: Savolainen, Petri (NSN - FI/Espoo) Cc: LNG ODP Mailman List Subject: Re: [lng-odp] odp_cpumask.h On 28 January 2015 at 12:21, Savolainen, Petri (NSN - FI/Espoo) petri.savolai...@nsn.com wrote: -Original Message- From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp- boun...@lists.linaro.org] On Behalf Of ext Ola Liljedahl Sent: Wednesday, January 28, 2015 12:48 PM To: LNG ODP Mailman List Subject: [lng-odp] odp_cpumask.h * @param strOutput buffer * @param lenSize of string length (incl. ending zero) */ void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len); Why don't we use size_t for thelen parameter? -- Ola It's an object size, so it can be changed to size_t (similar to e.g. snprintf()). Packet data len/offsets, buffer sizes, packet/bytes counts etc, should be uintxx_t - but object sizes should be size_t. Answer to: What happens if len output length? Maybe we copy the snprintf definition (except output also ending zero). Return number chars written (incl. str ending zero), otherwise return number of chars that would have been outputted (return len and clip output). This is more complicated to check for and goes against the convention of returning 0 for errors. I would prefer my suggestion with returning -(minimum required buffer size), there's a clear separation between success and error. And that we add a define with a suggested buffer size which will be usable when the CPU mask is full (all bits set), this seems to be 128 when using Linux cpu_set_t for the implementation. Of course ODP could use a smaller max size as well. About error from functions that return len. I'd have input param and return type the same, so that compiler don't complain when comparing those (maybe your audio was breaking on call yesterday on that part). No I didn't hear, my wifi router stopped working and had to be reset... e.g. size_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, size_t len); Better to use ssize_t then? size_t len, out; char str[SIZE]; len = sizeof(str); out = odp_cpumask_to_str(mask, str, len); if (out len) { Simple yes. But we just defined the convention that we use negative values to indicate failures. Why not follow that here? To use positive values to indicate both success and error conditions seems confusing to me. snprintf is not a good example here. printf(output needs %z chars, out); ABORT(); } -Petri ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/3] validation: buffer: fix for the use of cached return value of odp_packet_last_seg
On Wed, Jan 28, 2015 at 12:02:45PM -0500, Mike Holmes wrote: Any resolution, I know there have been discussions on going but I need to know if this is in 0.10.0 According to Petri, Application expects to reuse the seg handle after push/pull operations. so, No need to change the existing specification hence this patch is not applicable. validation: buffer: check the return value of odp_packet_l?_offset_set can be included in 0.10 On 27 January 2015 at 09:12, Mike Holmes mike.hol...@linaro.org wrote: Can we resolve this for 0.10.0 On 25 January 2015 at 22:40, Jerin Jacob jerin.ja...@caviumnetworks.com wrote: On Sun, Jan 25, 2015 at 03:01:24PM +0200, Taras Kondratiuk wrote: On 01/24/2015 08:06 PM, Bill Fischofer wrote: The issue is not whether the number of segments is changed but whether the pkt handle is changed. APIs that potentially substitute a new handle must return a handle. If a handle is not returned then the input handle is unchanged, however behavior of subsequent APIs against that handle may of course change. To take a trivial example, odp_packet_len() will obviously change following a push/pull even though the same handle is used. I agree with Jerin that we really need to take care to not overspecify behavior on ODP APIs. API observable effects should be minimally specified to allow implementations latitude in how best to map the required behavior to their platform. In the case of push/pull the purpose is simply to add or subtract bytes at the start or end of a packet. That's the essential function of these APIs and is the only thing that should be specified as required behavior. In the case of segmentation there are two philosophies one can adopt. The first is that the application desires and needs to have explicit control over packet segmentation. The second is that any packet segmentation is the responsibility of the implementation and the application need only be aware that packets may be segmented and take that into account in its design, realizing that segments are the units of contiguous addressability. The former is a very software-centric view which provides limited opportunity for implementations to optimize performance, and may in fact be impossible to implement efficiently on some platforms. The latter requires that existing software-centric applications may need some more redesign to better adapt to ODP. But the benefits of such adaptation is cleaner portability across a wider range of platforms with optimal performance on each, and that's really the goal of ODP. I agree on most of these items and I do understand Jerin's restrictions, but my main point: current test does follow specification. If it can't be implemented efficiently on a platform, then specification should be changed first. OK, How about following change in the specification ? diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index 920a593..e418e42 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -244,7 +244,7 @@ void *odp_packet_tail(odp_packet_t pkt); * headroom -= len * data -= len * - * Operation does not modify packet segmentation or move data. Handles and + * Operation does not modify packet segmentation or move data. pkt handle and * pointers remain valid. User is responsible to update packet metadata * offsets when needed. * @@ -272,7 +272,7 @@ void *odp_packet_push_head(odp_packet_t pkt, uint32_t len); * headroom += len * data += len * - * Operation does not modify packet segmentation or move data. Handles and + * Operation does not modify packet segmentation or move data. pkt handle and * pointers remain valid. User is responsible to update packet metadata * offsets when needed. * @@ -302,7 +302,7 @@ void *odp_packet_pull_head(odp_packet_t pkt, uint32_t len); * tail += len * tailroom -= len * - * Operation does not modify packet segmentation or move data. Handles, + * Operation does not modify packet segmentation or move data. pkt handle, * pointers and offsets remain valid. * * @param pkt Packet handle @@ -331,7 +331,7 @@ void *odp_packet_push_tail(odp_packet_t pkt, uint32_t len); * tail -= len * tailroom += len * - * Operation does not modify packet segmentation or move data. Handles and + * Operation does not modify packet segmentation or move data. pkt handle and * pointers remain valid. User is responsible to update packet metadata * offsets when needed. * ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp --
[lng-odp] [PATCHv4 5/5] example: ipsec: use event type at dequeue
Signed-off-by: Robbie King robk...@cisco.com --- example/ipsec/odp_ipsec.c| 15 +-- platform/linux-generic/include/odp_buffer_internal.h | 8 platform/linux-generic/odp_buffer.c | 7 +++ platform/linux-generic/odp_crypto.c | 5 + 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index b578f63..338abb3 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1057,10 +1057,15 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) ev = SCHEDULE(dispatchq, ODP_SCHED_WAIT); /* Determine new work versus completion or sequence number */ - if (seqnumq == dispatchq) { + if (ODP_EVENT_PACKET == odp_event_type(ev)) { pkt = odp_packet_from_event(ev); - ctx = get_pkt_ctx_from_pkt(pkt); - } else if (completionq == dispatchq) { + if (seqnumq == dispatchq) { + ctx = get_pkt_ctx_from_pkt(pkt); + } else { + ctx = alloc_pkt_ctx(pkt); + ctx-state = PKT_STATE_INPUT_VERIFY; + } + } else if (ODP_EVENT_CRYPTO_COMPL == odp_event_type(ev)) { odp_crypto_compl_t compl; compl = odp_crypto_compl_from_event(ev); @@ -1069,9 +1074,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED) pkt = result.pkt; ctx = result.ctx; } else { - pkt = odp_packet_from_event(ev); - ctx = alloc_pkt_ctx(pkt); - ctx-state = PKT_STATE_INPUT_VERIFY; + abort(); } /* diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 5a42653..1f3f69f 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -164,6 +164,14 @@ odp_buffer_t buffer_alloc(odp_pool_t pool, size_t size); */ int _odp_buffer_type(odp_buffer_t buf); +/* + * Buffer type set + * + * @param buf Buffer handle + * @param type New type value + * + */ + void _odp_buffer_type_set(odp_buffer_t buf, int type); #ifdef __cplusplus } diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index e657e00..18e8162 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -47,6 +47,13 @@ int _odp_buffer_type(odp_buffer_t buf) return hdr-type; } +void _odp_buffer_type_set(odp_buffer_t buf, int type) +{ + odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf); + + hdr-type = type; +} + int odp_buffer_is_valid(odp_buffer_t buf) { diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 2f2d701..154789b 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -400,6 +400,8 @@ odp_crypto_operation(odp_crypto_op_params_t *params, /* Linux generic will always use packet for completion event */ completion_event = odp_packet_to_event(params-out_pkt); + _odp_buffer_type_set(odp_buffer_from_event(completion_event), +ODP_EVENT_CRYPTO_COMPL); /* Asynchronous, build result (no HW so no errors) and send it*/ op_result = get_op_result_from_event(completion_event); @@ -454,6 +456,9 @@ odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED) odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev) { + /* This check not mandated by the API specification */ + if (odp_event_type(ev) != ODP_EVENT_CRYPTO_COMPL) + ODP_ABORT(Event not a crypto completion); return (odp_crypto_compl_t)ev; } -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv4 2/5] api: packet: add API to copy metadata
Add internal API to allow implementation to copy packet metatdata when replicating a packet. Add the call to crypto to fix test failure. Signed-off-by: Robbie King robk...@cisco.com --- platform/linux-generic/include/odp_packet_internal.h | 2 ++ platform/linux-generic/odp_crypto.c | 1 + platform/linux-generic/odp_packet.c | 14 ++ 3 files changed, 17 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 0ebc14b..16698cc 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -253,6 +253,8 @@ int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset, odp_packet_t dstpkt, uint32_t dstoffset, uint32_t len); +void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt); + odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl); int _odp_packet_parse(odp_packet_t pkt); diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index acf2f12..302c53e 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -368,6 +368,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params, ODP_ABORT(); _odp_packet_copy_to_packet(params-pkt, 0, params-out_pkt, 0, odp_packet_len(params-pkt)); + _odp_packet_copy_md_to_packet(params-pkt, params-out_pkt); odp_packet_free(params-pkt); params-pkt = ODP_PACKET_INVALID; } diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index bb049d1..a980239 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -591,6 +591,20 @@ int odp_packet_is_valid(odp_packet_t pkt) * */ +void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt) +{ + odp_packet_hdr_t *srchdr = odp_packet_hdr(srcpkt); + odp_packet_hdr_t *dsthdr = odp_packet_hdr(dstpkt); + + dsthdr-input = srchdr-input; + dsthdr-buf_hdr.buf_u64 = srchdr-buf_hdr.buf_u64; + odp_atomic_store_u32( + dsthdr-buf_hdr.ref_count, + odp_atomic_load_u32( + srchdr-buf_hdr.ref_count)); + copy_packet_parser_metadata(srchdr, dsthdr); +} + int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset, odp_packet_t dstpkt, uint32_t dstoffset, uint32_t len) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv4 0/5] api: crypto: ODP 1.0 API update
v1 - Move completion event allocation into implementation, allow synchronous implementation to return status immediately (i.e. no completion event involved). Fix two crypto related issues found during debug. v2 - Merged with odp_event_t changes. v3 - Changed bool to odp_bool_t throughout crypto API, examples and tests. v4 - Incorporate Petri's naming comments and fully implement events within crypto. Modified the IPSec example to use event type for steering dequeued work. Robbie King (5): api: crypto: new completion event scheme api: packet: add API to copy metadata example: ipsec: move L2/3/4 offset set api: crypto: change bool to odp_bool_t example: ipsec: use event type at dequeue example/ipsec/odp_ipsec.c | 100 ++ example/ipsec/odp_ipsec_cache.c| 2 +- example/ipsec/odp_ipsec_cache.h| 4 +- example/ipsec/odp_ipsec_misc.h | 4 +- example/ipsec/odp_ipsec_sa_db.c| 4 +- example/ipsec/odp_ipsec_sa_db.h| 4 +- example/ipsec/odp_ipsec_sp_db.h| 6 +- example/ipsec/odp_ipsec_stream.c | 20 ++-- example/ipsec/odp_ipsec_stream.h | 6 +- platform/linux-generic/include/api/odp_crypto.h| 108 ++- platform/linux-generic/include/api/odp_event.h | 2 + .../linux-generic/include/odp_buffer_internal.h| 8 ++ .../linux-generic/include/odp_crypto_internal.h| 8 +- .../linux-generic/include/odp_packet_internal.h| 2 + platform/linux-generic/odp_buffer.c| 7 ++ platform/linux-generic/odp_crypto.c| 116 ++--- platform/linux-generic/odp_packet.c| 14 +++ test/validation/crypto/odp_crypto_test_async_inp.c | 97 - test/validation/crypto/odp_crypto_test_sync_inp.c | 16 ++- 19 files changed, 264 insertions(+), 264 deletions(-) -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCHv3] linux-generic: Add odp_errno and adapt packet_io and timer implementations to use it
Any resolution to this for 0.10.0 ? On 22 January 2015 at 09:56, Taras Kondratiuk taras.kondrat...@linaro.org wrote: Sorry if formatting is wrong. Replying from a phone. On Jan 21, 2015 6:14 PM, Mario Torrecillas Rodriguez mario.torrecillasrodrig...@arm.com wrote: Added odp_errno.c and odp_errno.h Changed odp_packet_io and odp_timer to use it. Signed-off-by: Mario Torrecillas Rodriguez mario.torrecillasrodrig...@arm.com --- (This code contribution is provided under the terms of agreement LES-LTM-21309) Changes from previous version: * Changed doxygen comment * Removed errno.h from API file platform/linux-generic/Makefile.am | 2 + platform/linux-generic/include/api/odp_errno.h | 60 ++ platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/odp_errno.c | 35 +++ platform/linux-generic/odp_packet_io.c | 2 +- platform/linux-generic/odp_packet_socket.c | 17 platform/linux-generic/odp_timer.c | 5 ++- 7 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 platform/linux-generic/include/api/odp_errno.h create mode 100644 platform/linux-generic/odp_errno.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index a699ea6..1b71b71 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -19,6 +19,7 @@ include_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/api/odp_cpumask.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_crypto.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_debug.h \ + $(top_srcdir)/platform/linux-generic/include/api/odp_errno.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_hints.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_init.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_packet_flags.h \ @@ -80,6 +81,7 @@ __LIB__libodp_la_SOURCES = \ odp_classification.c \ odp_cpumask.c \ odp_crypto.c \ + odp_errno.c \ odp_init.c \ odp_impl.c \ odp_linux.c \ diff --git a/platform/linux-generic/include/api/odp_errno.h b/platform/linux-generic/include/api/odp_errno.h new file mode 100644 index 000..0157720 --- /dev/null +++ b/platform/linux-generic/include/api/odp_errno.h @@ -0,0 +1,60 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier:BSD-3-Clause + */ + +/** + * @file + * + * ODP errno API + */ + +#ifndef ODP_ERRNO_H_ +#define ODP_ERRNO_H_ + +#ifdef __cplusplus +extern C { +#endif + +/** +* Return latest ODP errno +* +* @return ODP errno +* @retval 0 No error +*/ +int odp_errno(void); + +/** +* Set ODP errno to zero +*/ +void odp_errno_zero(void); + +/** +* Print ODP errno +* +* Interprets the value of ODP errno as an error message, and prints it, +* optionally preceding it with the custom message specified in str. +* +* @param str NULL, or pointer to the string to be appended +*/ +void odp_errno_print(const char *str); + +/** +* Error message string +* +* Interprets the value of ODP errno, generating a string with a +* message that describes the error. +* It uses the system definition of errno. +* +* @param errnumError code +* +* @retval Pointer to the string +*/ +const char *odp_errno_str(int errnum); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 549d406..b953163 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -18,6 +18,7 @@ extern C { #endif +extern __thread int __odp_errno; int odp_system_info_init(void); diff --git a/platform/linux-generic/odp_errno.c b/platform/linux-generic/odp_errno.c new file mode 100644 index 000..ba080e7 --- /dev/null +++ b/platform/linux-generic/odp_errno.c @@ -0,0 +1,35 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier:BSD-3-Clause + */ + +#include odp_errno.h +#include odp_internal.h +#include string.h +#include stdio.h + +__thread int __odp_errno; + +int odp_errno(void) +{ + return __odp_errno; +} + +void odp_errno_zero(void) +{ + __odp_errno = 0; +} + +void odp_errno_print(const char *str) +{ + if (str != NULL) + printf(%s , str); + + printf(%s\n, strerror(__odp_errno)); ODP_PRINT should be used instead of printf. +} + +const char *odp_errno_str(int errnum) +{ +
Re: [lng-odp] [PATCH 2/3] validation: buffer: fix for the use of cached return value of odp_packet_last_seg
Any resolution, I know there have been discussions on going but I need to know if this is in 0.10.0 On 27 January 2015 at 09:12, Mike Holmes mike.hol...@linaro.org wrote: Can we resolve this for 0.10.0 On 25 January 2015 at 22:40, Jerin Jacob jerin.ja...@caviumnetworks.com wrote: On Sun, Jan 25, 2015 at 03:01:24PM +0200, Taras Kondratiuk wrote: On 01/24/2015 08:06 PM, Bill Fischofer wrote: The issue is not whether the number of segments is changed but whether the pkt handle is changed. APIs that potentially substitute a new handle must return a handle. If a handle is not returned then the input handle is unchanged, however behavior of subsequent APIs against that handle may of course change. To take a trivial example, odp_packet_len() will obviously change following a push/pull even though the same handle is used. I agree with Jerin that we really need to take care to not overspecify behavior on ODP APIs. API observable effects should be minimally specified to allow implementations latitude in how best to map the required behavior to their platform. In the case of push/pull the purpose is simply to add or subtract bytes at the start or end of a packet. That's the essential function of these APIs and is the only thing that should be specified as required behavior. In the case of segmentation there are two philosophies one can adopt. The first is that the application desires and needs to have explicit control over packet segmentation. The second is that any packet segmentation is the responsibility of the implementation and the application need only be aware that packets may be segmented and take that into account in its design, realizing that segments are the units of contiguous addressability. The former is a very software-centric view which provides limited opportunity for implementations to optimize performance, and may in fact be impossible to implement efficiently on some platforms. The latter requires that existing software-centric applications may need some more redesign to better adapt to ODP. But the benefits of such adaptation is cleaner portability across a wider range of platforms with optimal performance on each, and that's really the goal of ODP. I agree on most of these items and I do understand Jerin's restrictions, but my main point: current test does follow specification. If it can't be implemented efficiently on a platform, then specification should be changed first. OK, How about following change in the specification ? diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index 920a593..e418e42 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -244,7 +244,7 @@ void *odp_packet_tail(odp_packet_t pkt); * headroom -= len * data -= len * - * Operation does not modify packet segmentation or move data. Handles and + * Operation does not modify packet segmentation or move data. pkt handle and * pointers remain valid. User is responsible to update packet metadata * offsets when needed. * @@ -272,7 +272,7 @@ void *odp_packet_push_head(odp_packet_t pkt, uint32_t len); * headroom += len * data += len * - * Operation does not modify packet segmentation or move data. Handles and + * Operation does not modify packet segmentation or move data. pkt handle and * pointers remain valid. User is responsible to update packet metadata * offsets when needed. * @@ -302,7 +302,7 @@ void *odp_packet_pull_head(odp_packet_t pkt, uint32_t len); * tail += len * tailroom -= len * - * Operation does not modify packet segmentation or move data. Handles, + * Operation does not modify packet segmentation or move data. pkt handle, * pointers and offsets remain valid. * * @param pkt Packet handle @@ -331,7 +331,7 @@ void *odp_packet_push_tail(odp_packet_t pkt, uint32_t len); * tail -= len * tailroom += len * - * Operation does not modify packet segmentation or move data. Handles and + * Operation does not modify packet segmentation or move data. pkt handle and * pointers remain valid. User is responsible to update packet metadata * offsets when needed. * ___ 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
Re: [lng-odp] [PATCH 2/2] example: l2fwd: add return statements in thread functions
On 28 January 2015 at 17:23, Maxim Uvarov maxim.uva...@linaro.org wrote: If you want to add returns you need to do it in all other examples also. Someone should do it. We are not stopping Ciprian's patch because it did not fix the whole universe? Like example/packet Maxim. On 01/28/2015 07:01 PM, Ciprian Barbu wrote: Fix for https://bugs.linaro.org/show_bug.cgi?id=1161 Signe-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- example/l2fwd/odp_l2fwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 150de18..7c4e8bd 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -146,6 +146,7 @@ static void *pktio_queue_thread(void *arg) } /* unreachable */ + return NULL; } /** @@ -233,6 +234,7 @@ static void *pktio_ifburst_thread(void *arg) } /* unreachable */ + return NULL; } /** ___ 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] [Bug 1168] New: odp_schedule test can create more threads than ODP_CONFIG_MAX_THREADS
https://bugs.linaro.org/show_bug.cgi?id=1168 Bug ID: 1168 Summary: odp_schedule test can create more threads than ODP_CONFIG_MAX_THREADS Product: OpenDataPlane Version: 0.9 Hardware: All OS: Linux Status: UNCONFIRMED Severity: normal Priority: --- Component: Validation Assignee: mike.hol...@linaro.org Reporter: geoffrey.bl...@arm.com CC: lng-odp@lists.linaro.org Overview: More detailed restatement of summary. Steps to Reproduce: Minimized, easy-to-follow steps that will trigger the bug. Include any special setup steps. 1. Clone ODP repository on machine with at least 16 threads 2. Run odp_schedule validation test 3. Will fail with an assert triggered at odp_thread.c:76 ... Actual Results: Validation test fails Expected Results: Test should pass as at no one time does the application spawn more than ODP_CONFIG_MAX_THREADS. Additional Information: The bug is caused by the thread id counter in odp_thread.c increasing monotonically regardless of when threads are spawned and joined, so eventually an application that creates and destroys threads in ODP with hit the ODP_CONFIG_MAX_THREADS limit and crash. -- You are receiving this mail because: You are on the CC list for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCHv3] api: packet: odp_packet_flags: improve function names
Rename odp_packet_error() to odp_packet_has_error() and delete odp_packet_errflag_frame_len() for consistency with related packet APIs. Signed-off-by: Bill Fischofer bill.fischo...@linaro.org --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd/odp_l2fwd.c | 2 +- example/packet/odp_pktio.c| 2 +- platform/linux-generic/include/api/odp_packet_flags.h | 13 +++-- platform/linux-generic/odp_packet_flags.c | 9 + test/validation/buffer/odp_packet_test.c | 5 + test/validation/odp_pktio.c | 2 +- 8 files changed, 10 insertions(+), 27 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 492664e..ad62e08 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_event(ev); /* Drop packets with errors */ - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); continue; } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2d2fc7..22fddb2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -616,7 +616,7 @@ static pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx EXAMPLE_UNUSED) { - if (odp_unlikely(odp_packet_error(pkt))) + if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; if (!odp_packet_has_eth(pkt)) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 18403da..305d9ae 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index c4c720b..1972dfa 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index 24c4065..c239a28 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -32,17 +32,10 @@ extern C { * Checks all error flags at once. * * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise + * @retval 1 packet has errors + * @retval 0 packet has no errors */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); +int odp_packet_has_error(odp_packet_t pkt); /** * Check for L2 header, e.g. ethernet diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 3f0ea9f..e678f66 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -8,18 +8,11 @@ #include odp_packet_internal.h -int odp_packet_error(odp_packet_t pkt) +int odp_packet_has_error(odp_packet_t pkt) { return (odp_packet_hdr(pkt)-error_flags.all != 0); } -/* Get Error Flags */ - -int odp_packet_errflag_frame_len(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)-error_flags.frame_len; -} - /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index c1b28ab..022f9a3 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -435,10 +435,7 @@ static void packet_error_flags(void) * properly set. Just check that function return one of allowed values. * @todo: check classified packet when classifier is added in place. */ - err = odp_packet_error(pkt); - CU_ASSERT(err == 0 ||
Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t
I rebooted and made a new sandbox I get the same result as Anders if I run the test/performance tests, or the ones I mentioned with test/validation, I attached a log from both dirs and there are some core dumps below. I then did the reverse and took the patches out again git reset origin/master git co . make clean check and everything passes again Has anyone else tried these patches ? core dumps --- odp_timer Thread [6] 19528 [core: 1] (Suspended : Signal : SIGSEGV:Segmentation fault) get_buf() at odp_buffer_pool_internal.h:229 0x403d6b buffer_alloc() at odp_buffer_pool.c:475 0x403d6b odp_buffer_alloc() at odp_buffer_pool.c:513 0x4040c2 odp_timeout_alloc() at odp_timer.c:847 0x40af89 worker_entrypoint() at odp_timer.c:126 0x4028bb odp_run_start_routine() at odp_linux.c:76 0x404e17 start_thread() at pthread_create.c:309 0x770020a5 clone() at clone.S:111 0x7731288d odp_buffer Thread [1] 19611 [core: 1] (Suspended : Signal : SIGSEGV:Segmentation fault) odp_buffer_free() at odp_buffer_pool.c:520 0x40698e pool_alloc_type() at odp_buffer_pool_test.c:187 0x4026be run_single_test() at TestRun.c:991 0x775e512f run_single_suite() at TestRun.c:876 0x775e4d67 CU_run_all_tests() at TestRun.c:367 0x775e2af1 basic_run_all_tests() at Basic.c:195 0x775e6f83 CU_basic_run_tests() at Basic.c:87 0x775e6d25 main() at odp_cunit_common.c:72 0x401e19 odp_queue Thread [1] 18850 [core: 7] (Suspended : Signal : SIGSEGV:Segmentation fault) get_buf() at odp_buffer_pool_internal.h:229 0x4034bb buffer_alloc() at odp_buffer_pool.c:475 0x4034bb odp_buffer_alloc() at odp_buffer_pool.c:513 0x403812 test_odp_queue_sunnyday() at odp_queue.c:71 0x4020ce run_single_test() at TestRun.c:991 0x775e512f run_single_suite() at TestRun.c:876 0x775e4d67 CU_run_all_tests() at TestRun.c:367 0x775e2af1 basic_run_all_tests() at Basic.c:195 0x775e6f83 CU_basic_run_tests() at Basic.c:87 0x775e6d25 main() at odp_cunit_common.c:72 0x401e19 On 28 January 2015 at 14:44, Mike Holmes mike.hol...@linaro.org wrote: On 28 January 2015 at 14:03, Geoffrey Blake geoffrey.bl...@arm.com wrote: I cannot seem to reproduce the segmentation faults on the 4 machines I tested on. 4-core ARM A15 development board: All pass except for odp_pktio_run (no veth support) and odp_system(no huge pages support) 8-core X86_64 Avoton microserver: All pass 8c/16t X86_64 Xeon: All pass 4c/8t X86_64 Xeon: All pass I will run again after rebooting etc to make sure there are no artifacts, but other sandboxes are working fine, I will let you know. While testing I did find that the odp_schedule validation test will fail on a high core count machine because the thread id monotonically increases and will eventually hit the assert in odp_thread.c:76 during the test run. Not sure what the best way to fix this would be, just increasing ODP_CONFIG_MAX_THREADS is a hack. Can you add an bug https://bugs.linaro.org/enter_bug.cgi?product=OpenDataPlane -Geoff From: Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Wednesday, January 28, 2015 9:36 AM To: Geoffrey Blake Cc: Bill Fischofer; Anders Roxell; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t On 28 January 2015 at 10:33, Geoffrey Blake geoffrey.bl...@arm.com wrote: Hmmm, I cannot compile the validation tests as CUnit (using libcunit1 from apt-get) is trying to incorrectly cast a const char* string literal to a char* in its datastructures. This is usually a warning but ODP sets -Werror. Looking at the svn repo for CUnit, it appears this hasn't been addressed. Mike, how are you getting ODP to compile? Did you make your own version of CUnit? yes, make and install the latest and it will be on the same path I showed. We do need to fix autotools to specify the latest version of cunit. The odp_schedule test passed on my build machine, but I'll check on some other machines I have available and report back. -Geoff From: Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Wednesday, January 28, 2015 8:00 AM To: Bill Fischofer Cc: Anders Roxell; Geoffrey Blake; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t My details * 3a868e0 :2015-01-27 - (HEAD, master) linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t Geoffrey Blake * ff57dbe :2015-01-27 - linux-generic: Implement 32bit version of _odp_atomic_tptr_t Geoffrey Blake * f0f2247 :2015-01-27 - linux-generic: Implement _odp_atomic_tptr_t opaque type Geoffrey Blake * 30b60c5 :2015-01-23 - (origin/master, origin/HEAD, abort) test: makefile: remove check_PROGRAMS Mike Holmes git clean -xdf ./bootstrap ./configure --with-cunit-path=/home/mike/CUnitHome --enable-test-vald make check make[4]: Entering directory '/home/mike/git/odp/test/validation' PASS: odp_init ../../test-driver: line 107: 15468
[lng-odp] [PATCHv2] api: packet: odp_packet_flags spec changes
Rename odp_packet_error() to odp_packet_has_error() and delete odp_packet_errflag_frame_len() for consistency with related packet APIs as requested and approved by Petri. Signed-off-by: Bill Fischofer bill.fischo...@linaro.org --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd/odp_l2fwd.c | 2 +- example/packet/odp_pktio.c| 2 +- platform/linux-generic/include/api/odp_packet_flags.h | 13 +++-- platform/linux-generic/odp_packet_flags.c | 9 + test/validation/buffer/odp_packet_test.c | 5 + test/validation/odp_pktio.c | 2 +- 8 files changed, 10 insertions(+), 27 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 492664e..ad62e08 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_event(ev); /* Drop packets with errors */ - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); continue; } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2d2fc7..22fddb2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -616,7 +616,7 @@ static pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx EXAMPLE_UNUSED) { - if (odp_unlikely(odp_packet_error(pkt))) + if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; if (!odp_packet_has_eth(pkt)) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 18403da..305d9ae 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index c4c720b..1972dfa 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index 24c4065..c239a28 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -32,17 +32,10 @@ extern C { * Checks all error flags at once. * * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise + * @retval 1 packet has errors + * @retval 0 packet has no errors */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); +int odp_packet_has_error(odp_packet_t pkt); /** * Check for L2 header, e.g. ethernet diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 3f0ea9f..e678f66 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -8,18 +8,11 @@ #include odp_packet_internal.h -int odp_packet_error(odp_packet_t pkt) +int odp_packet_has_error(odp_packet_t pkt) { return (odp_packet_hdr(pkt)-error_flags.all != 0); } -/* Get Error Flags */ - -int odp_packet_errflag_frame_len(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)-error_flags.frame_len; -} - /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index c1b28ab..022f9a3 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -435,10 +435,7 @@ static void packet_error_flags(void) * properly set. Just check that function return one of allowed values. * @todo: check classified packet when classifier is added in place. */ - err =
[lng-odp] [PULL REQUESTv2] reorganisation of API header files
Hi, Updated after Taras suggestions. The following changes since commit 1641fe42647802a9191a50ab73035ada8f5d3349: api: cpumask: doxygen: add param to odp_cpumask_last (2015-01-28 15:49:23 +0300) are available in the git repository at: git://git.linaro.org/people/anders.roxell/odp.git header_restructure for you to fetch changes up to 9b0c98eb85cd42d1040d30e6cbaadda33eec857f: api: version: move defines (2015-01-29 01:32:40 +0100) Anders Roxell (21): api: move generic API into the odp namespace api: atomic: move typedefs and inline functions api: byteorder: move typedefs defines, and inline functions api: cpumask: move typedefs and defines api: align: move internal macros internal api: align: move platform defines out of public API api: pool: move typedef and define api: buffer: move typedefs and defines api: packet: move typedefs and defines api: packet_io: move typedef and defines api: shared_memory: move typedef and defines api: classification: move typedefs and defines api: std_types: move typedef api: plat: move platform type headers into plat directory helper: move headers into namespace the odp/helper api: remove platform includes api: queue: move types and defines api: crypto: move type, define and enums api: schedule: move defines api: event: move types and defines api: version: move defines Taras Kondratiuk (5): api: move ODP headers to a directory doc: cfg: disable TYPEDEF_HIDES_STRUCT doc: cfg: fix structure attributes parsing api: atomic: move types documentation out of linux-generic api: byteorder: move types documentation out of linux-generic doc/doxygen.cfg| 17 +- example/Makefile.inc | 4 +- example/generator/odp_generator.c | 10 +- example/ipsec/odp_ipsec.c | 10 +- example/ipsec/odp_ipsec_cache.c| 2 +- example/ipsec/odp_ipsec_cache.h| 2 +- example/ipsec/odp_ipsec_fwd_db.h | 2 +- example/ipsec/odp_ipsec_loop_db.h | 2 +- example/ipsec/odp_ipsec_misc.h | 6 +- example/ipsec/odp_ipsec_stream.c | 6 +- example/l2fwd/odp_l2fwd.c | 6 +- example/packet/odp_pktio.c | 6 +- example/timer/odp_timer_test.c | 2 +- .../include/{odph_chksum.h = odp/helper/chksum.h} | 2 +- helper/include/{odph_eth.h = odp/helper/eth.h}| 8 +- helper/include/{odph_icmp.h = odp/helper/icmp.h} | 6 +- helper/include/{odph_ip.h = odp/helper/ip.h} | 8 +- .../include/{odph_ipsec.h = odp/helper/ipsec.h} | 8 +- .../include/{odph_linux.h = odp/helper/linux.h} | 0 helper/include/{odph_ring.h = odp/helper/ring.h} | 6 +- helper/include/{odph_tcp.h = odp/helper/tcp.h}| 6 +- helper/include/{odph_udp.h = odp/helper/udp.h}| 6 +- include/odp.h | 57 include/odp/api/align.h| 77 ++ .../api/odp_atomic.h = include/odp/api/atomic.h | 208 ++- .../api/odp_barrier.h = include/odp/api/barrier.h | 3 - .../api/odp_buffer.h = include/odp/api/buffer.h | 24 +- include/odp/api/byteorder.h| 180 + .../odp/api/classification.h | 32 ++- .../odp_compiler.h = include/odp/api/compiler.h | 0 .../api/odp_config.h = include/odp/api/config.h | 0 .../api/odp_cpumask.h = include/odp/api/cpumask.h | 16 +- .../api/odp_crypto.h = include/odp/api/crypto.h | 115 ++--- .../api/odp_debug.h = include/odp/api/debug.h | 4 +- .../api/odp_event.h = include/odp/api/event.h | 43 ++- .../api/odp_hints.h = include/odp/api/hints.h | 0 .../api/odp_init.h = include/odp/api/init.h | 2 +- .../api/odp_packet.h = include/odp/api/packet.h | 28 +- .../odp/api/packet_flags.h | 4 +- .../odp_packet_io.h = include/odp/api/packet_io.h | 20 +- .../api/odp_pool.h = include/odp/api/pool.h | 18 +- .../api/odp_queue.h = include/odp/api/queue.h | 110 +--- .../api/odp_rwlock.h = include/odp/api/rwlock.h | 2 +- .../odp_schedule.h = include/odp/api/schedule.h | 16 +- .../odp/api/shared_memory.h| 18 +- .../odp_spinlock.h = include/odp/api/spinlock.h | 2 +- include/odp/api/std_types.h| 42 +++ .../api/odp_sync.h = include/odp/api/sync.h | 0 .../odp/api/system_info.h | 2 - .../api/odp_thread.h = include/odp/api/thread.h | 0 .../odp/api/ticketlock.h | 4 +- .../api/odp_time.h = include/odp/api/time.h | 2 -
Re: [lng-odp] [PULL REQUEST] reorganisation of API header files
On 28 January 2015 at 16:23, Taras Kondratiuk taras.kondrat...@linaro.org wrote: On 01/28/2015 02:02 PM, Mike Holmes wrote: I only ran it so far, there is a lot to look at :) I think Taras is actually basing his work on these changes as they make managing a platform easier, his comment will be valuable. The series is fine. There is one thing that confuses me a bit: odp_root/include/odp/api directory contains function prototypes now. But we still have platform/linux-generic/include/api/odp directory. Having both 'odp/api' and 'api/odp' is confusing. I think 'api' part can be dropped from platform include path. Public headers will be placed in platform/linux-generic/include/odp. Also some files are missing @file and @ingroup doxygen tags, but it can be fixed later in an incremental way when this massive change is merged. Thank for your comments. New pull request sent. Cheers, Anders ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t
Hmmm, I cannot compile the validation tests as CUnit (using libcunit1 from apt-get) is trying to incorrectly cast a const char* string literal to a char* in its datastructures. This is usually a warning but ODP sets -Werror. Looking at the svn repo for CUnit, it appears this hasn't been addressed. Mike, how are you getting ODP to compile? Did you make your own version of CUnit? The odp_schedule test passed on my build machine, but I'll check on some other machines I have available and report back. -Geoff From: Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Wednesday, January 28, 2015 8:00 AM To: Bill Fischofer Cc: Anders Roxell; Geoffrey Blake; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t My details * 3a868e0 :2015-01-27 - (HEAD, master) linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t Geoffrey Blake * ff57dbe :2015-01-27 - linux-generic: Implement 32bit version of _odp_atomic_tptr_t Geoffrey Blake * f0f2247 :2015-01-27 - linux-generic: Implement _odp_atomic_tptr_t opaque type Geoffrey Blake * 30b60c5 :2015-01-23 - (origin/master, origin/HEAD, abort) test: makefile: remove check_PROGRAMS Mike Holmes git clean -xdf ./bootstrap ./configure --with-cunit-path=/home/mike/CUnitHome --enable-test-vald make check make[4]: Entering directory '/home/mike/git/odp/test/validation' PASS: odp_init ../../test-driver: line 107: 15468 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_queue ../../test-driver: line 107: 15475 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_crypto PASS: odp_shm ../../test-driver: line 107: 15496 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_schedule FAIL: odp_pktio_run ../../test-driver: line 107: 15513 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_buffer PASS: odp_system ../../test-driver: line 107: 15526 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_timer PASS: odp_time PASS: odp_synchronizers ../../test-driver: line 107: 15655 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_classification make[5]: Entering directory '/home/mike/git/odp/test/validation' make[5]: Nothing to be done for 'all'. make[5]: Leaving directory '/home/mike/git/odp/test/validation' Testsuite summary for OpenDataPlane 0.9.0 # TOTAL: 12 # PASS: 5 # SKIP: 0 # XFAIL: 0 # FAIL: 7 # XPASS: 0 # ERROR: 0 See test/validation/test-suite.log Please report to lng-odp@lists.linaro.org ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [Bug 1161] New: l2fwd pktio_queue_thread missing return statement
https://bugs.linaro.org/show_bug.cgi?id=1161 Bug ID: 1161 Summary: l2fwd pktio_queue_thread missing return statement Product: OpenDataPlane Version: 0.9 Hardware: Other OS: Linux Status: UNCONFIRMED Severity: trivial Priority: --- Component: Examples Assignee: lng-odp@lists.linaro.org Reporter: ciprian.ba...@linaro.org The function in question returns a non void value, however gcc fails to detect this. If the EXAMPLE_ERR statement is replaced with odp_packet_print(pkt) then the result is: CC odp_l2fwd-odp_l2fwd.o odp_l2fwd.c: In function âpktio_queue_threadâ: odp_l2fwd.c:149:1: error: no return statement in function returning non-void [-Werror=return-type] } ^ -- You are receiving this mail because: You are the assignee for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH] example: l2fwd: fix a cpumask bug and compilation error
Ignore this patch, I will create a new bug for the missing return statements and send 2 patches instead. On Wed, Jan 28, 2015 at 3:11 PM, Maxim Uvarov maxim.uva...@linaro.org wrote: short subject says that you fixed compilation error, what is compilation error was there? Please change description to something more clear and put reference to bug to long log. Maxim. On 01/27/2015 03:31 PM, Ciprian Barbu wrote: Signed-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- Fix for https://bugs.linaro.org/show_bug.cgi?id=1146 example/l2fwd/odp_l2fwd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 10d5d32..74eaf84 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -146,6 +146,7 @@ static void *pktio_queue_thread(void *arg) } /* unreachable */ + return NULL; } /** @@ -393,7 +394,7 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(thread_tbl[i], thd_mask, thr_run_func, gbl_args-thread[i]); - cpu = odp_cpumask_next(thd_mask, cpu); + cpu = odp_cpumask_next(cpumask, cpu); } /* Master thread waits for other threads to exit */ ___ 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] [Bug 1161] l2fwd pktio_queue_thread missing return statement
https://bugs.linaro.org/show_bug.cgi?id=1161 --- Comment #1 from Ciprian Barbu ciprian.ba...@linaro.org --- The behavior is quite peculiar, it almost looks like gcc figures out that the function never exists the for loop so it doesn't complain about the missing return statement, but replacing EXAMPLE_ERR with odp_packet_print causes an error. I haven't look at the disassembled code, but I think for correctness we should add return NULL statements in the thread functions. -- You are receiving this mail because: You are the assignee for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 2/2] example: l2fwd: add return statements in thread functions
Fix for https://bugs.linaro.org/show_bug.cgi?id=1161 Signe-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- example/l2fwd/odp_l2fwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 150de18..7c4e8bd 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -146,6 +146,7 @@ static void *pktio_queue_thread(void *arg) } /* unreachable */ + return NULL; } /** @@ -233,6 +234,7 @@ static void *pktio_ifburst_thread(void *arg) } /* unreachable */ + return NULL; } /** -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 0/2] A couple of fixes for odp_l2fwd
Really simple fixes as described by the bugzilla tickets Ciprian Barbu (2): example: l2fwd: fix incorrect cpumask used when spawning threads example: l2fwd: add return statements in thread functions example/l2fwd/odp_l2fwd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.8.3.2 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/2] example: l2fwd: add return statements in thread functions
On 01/28/2015 10:53 PM, Bill Fischofer wrote: Wouldn't a cleaner fix be to change the routine signature from void * to void? It doesn't return so why should if have a return type in its signature in the first place? Because it's thread created with pthread: int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); On Wed, Jan 28, 2015 at 11:08 AM, Ola Liljedahl ola.liljed...@linaro.org mailto:ola.liljed...@linaro.org wrote: On 28 January 2015 at 17:23, Maxim Uvarov maxim.uva...@linaro.org mailto:maxim.uva...@linaro.org wrote: If you want to add returns you need to do it in all other examples also. Someone should do it. We are not stopping Ciprian's patch because it did not fix the whole universe? We should be consistent and have same code in all examples. Because this patch 2/2 actually does nothing I think we can skip it until there will be fix for all similar places. BR, Maxim. Like example/packet Maxim. On 01/28/2015 07:01 PM, Ciprian Barbu wrote: Fix for https://bugs.linaro.org/show_bug.cgi?id=1161 Signe-off-by: Ciprian Barbu ciprian.ba...@linaro.org mailto:ciprian.ba...@linaro.org --- example/l2fwd/odp_l2fwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 150de18..7c4e8bd 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -146,6 +146,7 @@ static void *pktio_queue_thread(void *arg) } /* unreachable */ + return NULL; } /** @@ -233,6 +234,7 @@ static void *pktio_ifburst_thread(void *arg) } /* unreachable */ + return NULL; } /** ___ 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 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] Strong Typing
Thanks to Petri's suggestion about using typed pointers, I have a set of updates that re-introduce strong typing but still allow the normal C == and != operators to work. I'll post it after Anders' API restructure patch is merged since that's higher priority and it will need to be rebased after that anyway. There is one problem that this change exposes, however, and it has to do with the fact that a number of the examples and tests need to print the value of handles and are currently doing that using printf-style format strings specifying things like %i, %d, %u, etc. This is decidedly non-portable and in particular doesn't work with these changes. We need to come up with a typedef-independent and portable means of allowing applications to print the values of ODP handles for diagnostic purposes. To be consistent with modern C conventions, we should probably use symbolic format macros similar to PRIu64, etc. introduced in C99. Each implementation could define their own code, however we cannot assume that every handle type has the same underlying representation in every implementation (they are in linux-generic, but they could differ) so a single format specifier code may not suffice. Something to discuss in our next call. Bill ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH 2/2] example: l2fwd: add return statements in thread functions
If you want to add returns you need to do it in all other examples also. Like example/packet Maxim. On 01/28/2015 07:01 PM, Ciprian Barbu wrote: Fix for https://bugs.linaro.org/show_bug.cgi?id=1161 Signe-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- example/l2fwd/odp_l2fwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 150de18..7c4e8bd 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -146,6 +146,7 @@ static void *pktio_queue_thread(void *arg) } /* unreachable */ + return NULL; } /** @@ -233,6 +234,7 @@ static void *pktio_ifburst_thread(void *arg) } /* unreachable */ + return NULL; } /** ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [Bug 1165] New: The additional checking maco POOL_ERROR_CHECK is broken
https://bugs.linaro.org/show_bug.cgi?id=1165 Bug ID: 1165 Summary: The additional checking maco POOL_ERROR_CHECK is broken Product: OpenDataPlane Version: 0.9 Hardware: Other OS: Linux Status: UNCONFIRMED Severity: normal Priority: --- Component: Buffers Packets Assignee: bill.fischo...@linaro.org Reporter: mike.hol...@linaro.org CC: lng-odp@lists.linaro.org The following change to enable the macro results in the errors listed --- a/platform/linux-generic/include/odp_buffer_pool_internal.h +++ b/platform/linux-generic/include/odp_buffer_pool_internal.h @@ -62,7 +62,7 @@ typedef struct local_cache_t { #define POOL_USE_TICKETLOCK /* Extra error checks */ -/* #define POOL_ERROR_CHECK */ + #define POOL_ERROR_CHECK ./include/odp_buffer_inlines.h:55:3: error: implicit declaration of function 'ODP_ERR' [-Werror=implicit-function-declaration] ODP_ERR(odp_buf_to_hdr: Bad pool id\n); ^ ./include/odp_buffer_inlines.h:55:3: error: nested extern declaration of 'ODP_ERR' [-Werror=nested-externs] In file included from ./include/odp_buffer_pool_internal.h:26:0, from odp_buffer.c:8: ./include/odp_buffer_inlines.h:63:39: error: 'odp_pool_param_t' has no member named 'num_bufs' if (odp_unlikely(index pool-params.num_bufs - 1)) { ^ ./include/api/odp_hints.h:52:43: note: in definition of macro 'odp_unlikely' #define odp_unlikely(x) __builtin_expect((x), 0) ^ cc1: all warnings being treated as errors -- You are receiving this mail because: You are on the CC list for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] API questions - sizes and numelems as inputs and outputs
Talking about API's that take some type of element count or buffer size as input and return a value related to that. There seems to be a number of different models. /** * Generate random byte string * * @param buf Pointer to store result * @param len Pointer to input length value as well as return value I assume the return value is the number of result bytes stored. But this is not very clear. * @param use_entropy Use entropy * * @todo Define the implication of the use_entropy parameter * * @retval 0 on success Not the same return value as described above. * @retval 0 on failure */ int odp_hw_random_get(uint8_t *buf, size_t *len, bool use_entropy); Here we return the actual size written (I assume) through the len parameter which is consequently passed by reference. /** * Write CPU mask as a string of hexadecimal digits * * @param mask CPU mask to write * @param bufOutput buffer * @param bufsz Size of output buffer * * @return 0 on success. Number of characters written (including the * terminating null char). * @return 0 on failure (output buffer too small). */ size_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *buf, size_t bufsz); The new definition of odp_cpumask_to_str() as recently agreed. Number of characters written is returned. It can't be 0 so 0 can be used as an error indicator. In other formatting-type of functions, 0 might be a valid return value (it primarily depends on whether the terminating null char should be included in the count). * @param[out] mac_addr Storage for MAC address of the packet IO interface. * @param addr_size Storage size for the address * * @retval Number of bytes written on success, 0 on failure. */ size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, size_t addr_size); This function returns 0 for failure (but this is incidental and prevents us to support pktio types that have zero-length MAC address (i.e. does not have any MAC address)). /** * Copy data from packet * * Copy 'len' bytes of data from the packet level offset to the destination * address. * * @param pktPacket handle * @param offset Byte offset into the packet * @param lenNumber of bytes to copy * @param dstDestination address * * @retval 0 on success * @retval 0 on failure Not documented what constitutes a failure. */ int odp_packet_copydata_out(odp_packet_t pkt, uint32_t offset, uint32_t len, void *dst); What if less than len bytes could be copied (because reaching end of packet)? How is this reported? Should we use uint32_t *len and update it on return with the actual number of bytes copied? Or is this situation considered an error and reported with a negative return value? Seems excessive. Better to just specify len as the size of the output buffer and in some way be notified about the actual number of bytes copied. /** * Copy data into packet * * Copy'len' bytes of data from the source address into the packet level * offset. Maximum number of bytes to copy is packet data length minus the * offset. Packet is not modified on an error. * * @param pktPacket handle * @param offset Byte offset into the packet * @param lenNumber of bytes to copy * @param srcSource address * * @retval 0 on success * @retval 0 on failure Not documented what constitutes a failure. */ int odp_packet_copydata_in(odp_packet_t pkt, uint32_t offset, uint32_t len, const void *src); Similar for this function. Is it an error if 'len' bytes does not fit into the current packet size? Is this good semantics? /** * Receive packets * * @param id ODP packet IO handle * @param pkt_table[] Storage for received packets (filled by function) * @param len Length of pkt_table[], i.e. max number of pkts to receive * * @return Number of packets received * @retval 0 on failure */ int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len); int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len); Here is a classic. Attempt to receive up to N items. Return actual number of items received or 0 on failure. 0 is a valid success code (not a failure). Why can't this be our model? The prototype uses unsigned and signed ints. How is different from using size_t and ssize_t? /** * Enqueue multiple events to a queue * * @param queue Queue handle * @param ev Event handles * @param num Number of event handles * * @retval 0 on success * @retval 0 on failure */ int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num); Here we use int for the number of items, at least this matches with the return type. But there is no indication that the function returns the number of events that were enqueued. What happens if we are trying to enqueue events to a fixed-size queue (e.g. ring buffer) and all items do not fit? Is this considered a failure? It could be problematic to have to retry this call until
Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t
I cannot seem to reproduce the segmentation faults on the 4 machines I tested on. 4-core ARM A15 development board: All pass except for odp_pktio_run (no veth support) and odp_system(no huge pages support) 8-core X86_64 Avoton microserver: All pass 8c/16t X86_64 Xeon: All pass 4c/8t X86_64 Xeon: All pass While testing I did find that the odp_schedule validation test will fail on a high core count machine because the thread id monotonically increases and will eventually hit the assert in odp_thread.c:76 during the test run. Not sure what the best way to fix this would be, just increasing ODP_CONFIG_MAX_THREADS is a hack. -Geoff From: Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Wednesday, January 28, 2015 9:36 AM To: Geoffrey Blake Cc: Bill Fischofer; Anders Roxell; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t On 28 January 2015 at 10:33, Geoffrey Blake geoffrey.bl...@arm.com wrote: Hmmm, I cannot compile the validation tests as CUnit (using libcunit1 from apt-get) is trying to incorrectly cast a const char* string literal to a char* in its datastructures. This is usually a warning but ODP sets -Werror. Looking at the svn repo for CUnit, it appears this hasn't been addressed. Mike, how are you getting ODP to compile? Did you make your own version of CUnit? yes, make and install the latest and it will be on the same path I showed. We do need to fix autotools to specify the latest version of cunit. The odp_schedule test passed on my build machine, but I'll check on some other machines I have available and report back. -Geoff From: Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Wednesday, January 28, 2015 8:00 AM To: Bill Fischofer Cc: Anders Roxell; Geoffrey Blake; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t My details * 3a868e0 :2015-01-27 - (HEAD, master) linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t Geoffrey Blake * ff57dbe :2015-01-27 - linux-generic: Implement 32bit version of _odp_atomic_tptr_t Geoffrey Blake * f0f2247 :2015-01-27 - linux-generic: Implement _odp_atomic_tptr_t opaque type Geoffrey Blake * 30b60c5 :2015-01-23 - (origin/master, origin/HEAD, abort) test: makefile: remove check_PROGRAMS Mike Holmes git clean -xdf ./bootstrap ./configure --with-cunit-path=/home/mike/CUnitHome --enable-test-vald make check make[4]: Entering directory '/home/mike/git/odp/test/validation' PASS: odp_init ../../test-driver: line 107: 15468 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_queue ../../test-driver: line 107: 15475 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_crypto PASS: odp_shm ../../test-driver: line 107: 15496 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_schedule FAIL: odp_pktio_run ../../test-driver: line 107: 15513 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_buffer PASS: odp_system ../../test-driver: line 107: 15526 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_timer PASS: odp_time PASS: odp_synchronizers ../../test-driver: line 107: 15655 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_classification make[5]: Entering directory '/home/mike/git/odp/test/validation' make[5]: Nothing to be done for 'all'. make[5]: Leaving directory '/home/mike/git/odp/test/validation' Testsuite summary for OpenDataPlane 0.9.0 # TOTAL: 12 # PASS: 5 # SKIP: 0 # XFAIL: 0 # FAIL: 7 # XPASS: 0 # ERROR: 0 See test/validation/test-suite.log Please report to lng-odp@lists.linaro.org -- Mike Holmes Linaro Sr Technical Manager LNG - ODP -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England Wales, Company No: 2557590 ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England Wales, Company No: 2548782 ___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t
On 28 January 2015 at 14:03, Geoffrey Blake geoffrey.bl...@arm.com wrote: I cannot seem to reproduce the segmentation faults on the 4 machines I tested on. 4-core ARM A15 development board: All pass except for odp_pktio_run (no veth support) and odp_system(no huge pages support) 8-core X86_64 Avoton microserver: All pass 8c/16t X86_64 Xeon: All pass 4c/8t X86_64 Xeon: All pass I will run again after rebooting etc to make sure there are no artifacts, but other sandboxes are working fine, I will let you know. While testing I did find that the odp_schedule validation test will fail on a high core count machine because the thread id monotonically increases and will eventually hit the assert in odp_thread.c:76 during the test run. Not sure what the best way to fix this would be, just increasing ODP_CONFIG_MAX_THREADS is a hack. Can you add an bug https://bugs.linaro.org/enter_bug.cgi?product=OpenDataPlane -Geoff From: Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Wednesday, January 28, 2015 9:36 AM To: Geoffrey Blake Cc: Bill Fischofer; Anders Roxell; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t On 28 January 2015 at 10:33, Geoffrey Blake geoffrey.bl...@arm.com wrote: Hmmm, I cannot compile the validation tests as CUnit (using libcunit1 from apt-get) is trying to incorrectly cast a const char* string literal to a char* in its datastructures. This is usually a warning but ODP sets -Werror. Looking at the svn repo for CUnit, it appears this hasn't been addressed. Mike, how are you getting ODP to compile? Did you make your own version of CUnit? yes, make and install the latest and it will be on the same path I showed. We do need to fix autotools to specify the latest version of cunit. The odp_schedule test passed on my build machine, but I'll check on some other machines I have available and report back. -Geoff From: Mike Holmes [mailto:mike.hol...@linaro.org] Sent: Wednesday, January 28, 2015 8:00 AM To: Bill Fischofer Cc: Anders Roxell; Geoffrey Blake; LNG ODP Mailman List Subject: Re: [lng-odp] [PATCH v7 3/3] linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t My details * 3a868e0 :2015-01-27 - (HEAD, master) linux-generic: Make buffer_pool allocators use _odp_atomic_tptr_t Geoffrey Blake * ff57dbe :2015-01-27 - linux-generic: Implement 32bit version of _odp_atomic_tptr_t Geoffrey Blake * f0f2247 :2015-01-27 - linux-generic: Implement _odp_atomic_tptr_t opaque type Geoffrey Blake * 30b60c5 :2015-01-23 - (origin/master, origin/HEAD, abort) test: makefile: remove check_PROGRAMS Mike Holmes git clean -xdf ./bootstrap ./configure --with-cunit-path=/home/mike/CUnitHome --enable-test-vald make check make[4]: Entering directory '/home/mike/git/odp/test/validation' PASS: odp_init ../../test-driver: line 107: 15468 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_queue ../../test-driver: line 107: 15475 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_crypto PASS: odp_shm ../../test-driver: line 107: 15496 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_schedule FAIL: odp_pktio_run ../../test-driver: line 107: 15513 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_buffer PASS: odp_system ../../test-driver: line 107: 15526 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_timer PASS: odp_time PASS: odp_synchronizers ../../test-driver: line 107: 15655 Segmentation fault (core dumped) $@ $log_file 21 FAIL: odp_classification make[5]: Entering directory '/home/mike/git/odp/test/validation' make[5]: Nothing to be done for 'all'. make[5]: Leaving directory '/home/mike/git/odp/test/validation' Testsuite summary for OpenDataPlane 0.9.0 # TOTAL: 12 # PASS: 5 # SKIP: 0 # XFAIL: 0 # FAIL: 7 # XPASS: 0 # ERROR: 0 See test/validation/test-suite.log Please report to lng-odp@lists.linaro.org -- Mike Holmes Linaro Sr Technical Manager LNG - ODP -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England Wales, Company No: 2557590 ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England Wales, Company No:
Re: [lng-odp] [PATCH 2/2] example: l2fwd: add return statements in thread functions
Wouldn't a cleaner fix be to change the routine signature from void * to void? It doesn't return so why should if have a return type in its signature in the first place? On Wed, Jan 28, 2015 at 11:08 AM, Ola Liljedahl ola.liljed...@linaro.org wrote: On 28 January 2015 at 17:23, Maxim Uvarov maxim.uva...@linaro.org wrote: If you want to add returns you need to do it in all other examples also. Someone should do it. We are not stopping Ciprian's patch because it did not fix the whole universe? Like example/packet Maxim. On 01/28/2015 07:01 PM, Ciprian Barbu wrote: Fix for https://bugs.linaro.org/show_bug.cgi?id=1161 Signe-off-by: Ciprian Barbu ciprian.ba...@linaro.org --- example/l2fwd/odp_l2fwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 150de18..7c4e8bd 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -146,6 +146,7 @@ static void *pktio_queue_thread(void *arg) } /* unreachable */ + return NULL; } /** @@ -233,6 +234,7 @@ static void *pktio_ifburst_thread(void *arg) } /* unreachable */ + return NULL; } /** ___ 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] [Bug 1165] The additional checking macro POOL_ERROR_CHECK is broken
https://bugs.linaro.org/show_bug.cgi?id=1165 Bill Fischofer bill.fischo...@linaro.org changed: What|Removed |Added Severity|normal |minor Priority|--- |Low --- Comment #1 from Bill Fischofer bill.fischo...@linaro.org --- This was an internal debugging macro that really doesn't serve a useful purpose at this point. It is not valid to attempt to define it. The resolution would be to delete all references to it. -- You are receiving this mail because: You are on the CC list for the bug.___ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp