aboutsummaryrefslogtreecommitdiff
path: root/example
AgeCommit message (Collapse)Author
2016-01-21Merge remote-tracking branch 'linaro-odp/master' into new_masterIvan Khoronzhuk
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Conflicts: platform/linux-generic/odp_system_info.c
2016-01-20tests: harmonize posix extensions level definesPetri Savolainen
Allways use _GNU_SOURCE instead of various _POSIX_C_SOURCE defines. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-01-15Merge remote-tracking branch 'linaro-odp/master' into new_masterIvan Khoronzhuk
2016-01-15example: time: add test of global time API on monotonyIvan Khoronzhuk
This test example uses linux helper functions to schedule worker threads in order to check global time monotony between the threads. Each thread receives event from it's own queue, checks global time on correctness, writes in the buffer new current global time, chooses randomly next thread queue, sends event and waits on next event on it's own queue. Using for each thread it's own queue guarantees that event is read by not the same thread that sends it. When global time source is correct the time received with event by a thread must be less than read on the moment of receiving. Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-01-13example: classifier: use SCN macro to scan uint32_tNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-01-12helper: fix UDP checksum computationGrigore Ion
This patch fixes the following problems: - checksum computation for LE platforms - checksum computation for packets having the UDP length not a multiple of 2 - checksum computation in the test and the example applications Signed-off-by: Grigore Ion <ion.grigore@freescale.com> Reviewed-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-01-11helper: fix UDP checksum computationGrigore Ion
This patch fixes the following problems: - checksum computation for LE platforms - checksum computation for packets having the UDP length not a multiple of 2 - checksum computation in the test and the example applications Signed-off-by: Grigore Ion <ion.grigore@freescale.com> Reviewed-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-31Merge remote-tracking branch 'linaro-odp/master' into new_masterIvan Khoronzhuk
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Conflicts: include/odp/api/crypto.h platform/linux-generic/odp_init.c
2015-12-29api/validation/linux-generic: classification: implement class of service ↵Balasubramanian Manoharan
create api Implements odp_cls_cos_create() and odp_cls_cos_param_init() functions and replace odp_cos_create() function with odp_cls_cos_create() in validation and examples. Class of service create function now takes pool, queue, drop policy and name as input parameters. Adds class of service parameter structure odp_cls_cos_param_t and initialization function odp_cls_cos_param_init() Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-29test/example: use local time API as wall timeIvan Khoronzhuk
The local time API is supposed to behave like wall time now, so correct it in examples and tests. Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-29example: classifier: add odp_cls_cos_pool_set() apiBalasubramanian Manoharan
Adds packet pool to CoS using odp_cls_cos_pool_set() api. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-16helper: linux: add thread type in pthread_createHemant Agrawal
The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal <Hemant@freescale.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-15Merge remote-tracking branch 'linaro-odp/master' into new_masterIvan Khoronzhuk
2015-12-11example: classifier: fix add queue param init callBalasubramanian Manoharan
Fixes crash caused by queue param not being initialized. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-11example: classifier: fix ipv4 address input formatBalasubramanian Manoharan
Fixes ipv4 address input format issue. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-03example/helper/test: include deleted linux-genericIvan Khoronzhuk
It's required for linux-ks2 implementation. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
2015-11-30Merge branch 'next'Maxim Uvarov
2015-11-30example: timer: warn if timeout less than resolutionIvan Khoronzhuk
The period shouldn't be less than timer resolution. If it's less there is no guarantee about timeout accuracy, it can be executed right after setting it or after up to timer resolution timeout or even be set late, in which case application will be stopped with error. So it's better to warn user that timeout is less then resolution instead of silence. Reviewed-by: Ola Liljedahl <ola.liljedahl@linaro.org> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-25example: ipsec: add support for HMAC-SHA-256-128Nicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-25api: crypto: move enums from platform types to odp and rename to fit the API ↵Nicolas Morey-Chaisemartin
format Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-25api: time: change order of arguments for diff functionIvan Khoronzhuk
It's more convenient to pass parameters in order, like t2 - t1, when t2 is supposed to be more. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-25api: time: unbind CPU cycles from time APIIvan Khoronzhuk
Current time API supposes that frequency of counter is equal to CPU frequency. But that's not always true, for instance, in case if no access to CPU cycle counter, another hi-resolution timer can be used, and it`s rate can be different from CPU rate. There is no big difference in which cycles to measure time, the better hi-resolution timer the better measurements. So, unbind CPU cycle counter from time API by eliminating word "cycle" as it's believed to be used with CPU. Also add new opaque type for time odp_time_t, as it asks user to use API and abstracts time from units. New odp_time_t requires several additional API functions to be added: odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2); int odp_time_cmp(odp_time_t t1, odp_time_t t2); uint64_t odp_time_to_u64(odp_time_t hdl); Also added new definition that represents 0 ticks for time - ODP_TIME_NULL. It can be used instead of odp_time_from_ns(0) for comparison and initialization. This patch changes only used time API, it doesn't change used var names for simplicity. This time API can be implemented with local timer counter, so shouldn't be used between threads. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: platform/linux-generic/odp_time.c
2015-11-25example: generator: compare ticks instead of ns in loopIvan Khoronzhuk
It's more accurate to compare ticks instead of ns in each iteration, so calculate wait range before entering the loop. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-24remove hard platform linksMike Holmes
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-05example: ipsec: check push_tail return codeNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-02example/ipsec: Increase ip_data_len for Tunnel modeAkhil Goyal
In case of tunnel mode, while moving the ip_data- number of bytes to be moved should be original ip_data_len plus ip_header_len. Currently, ip_data pointer is adjusted but ip_data_len is not updated for tunnel mode. Also update for encrypt_len also does not need any check for tunnel mode if we are updating the ip_data_len. Also ip->tot_len is not used with proper endianness while calculating encrypt_len. Signed-off-by: Akhil Goyal <akhil.goyal@freescale.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-27example:generator : Fix data race conditionGrigore Ion
The counters.seq counter is used to check if the configured number of packets was processed. There is a race condition between the counter incrementation time and its value testing time. If code is running on multiple CPUs it is possible the application send more packets than expected (with number of CPUs - 1). A separate counter must be used for the processed packets. Signed-off-by: Grigore Ion <ion.grigore@freescale.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-27example: classifier: use uint32_t instead of unsignedNicolas Morey-Chaisemartin
Fixes build issue on arch where uint32_t != unsigned: example/classifier/odp_classifier.c:694:8: error: passing argument 3 of ‘parse_value’ from incompatible pointer type [-Werror] &stats[policy_count].rule.val_sz); Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-22example: use odp_pktio_param_init() APIBill Fischofer
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-22example: classifier: implement ODP_PMR_CUSTOM_FRAME matchNicolas Morey-Chaisemartin
Signed-off-by: Benoît Ganne <bganne@kalray.eu> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-22api: classification: use a structure instead of many args for odp_pmr_createNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-22example: classifier: check return valueBalasubramanian Manoharan
Checks return value of odp_cos_queue_set() and odp_pktio_default_cos_set() functions. Fixes: https://bugs.linaro.org/show_bug.cgi?id=1786 Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-22api: rename odp_cpumask_def to _defaultMaxim Uvarov
Use full default word in api to make function name more clear. https://bugs.linaro.org/show_bug.cgi?id=1745 Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2015-10-22example: classifier: queue and drop policy API name changeBalasubramanian Manoharan
API name change from odp_cos_set_queue() to odp_cos_queue_set() Fixes: https://bugs.linaro.org/show_bug.cgi?id=1711 Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-20example: classifier: fix potential buffer overflowStuart Haslam
cos_name will overflow if args->if_name is long, so change the sprintf to snprintf. For consistency the other uses of sprintf are also removed. Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-09example:ipsec: Using environment varibale for pktio mode.Nikhil Agarwal
Pktio input mode of operation should be derived from environment variable input instead of compile time flag. Signed-off-by: Nikhil Agarwal <nikhil.agarwal@freescale.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-08linux-generic: pktio: add netmap pktio supportMatias Elo
Added new netmap pktio interface type which operates in the same manner as the existing socket io interfaces. The code is based on the odp-netmap branch. Using netmap io requires netmap headers and loaded netmap kernel module. Netmap can be installed from https://github.com/luigirizzo/netmap. ODP netmap support is enabled using --with-netmap-path=<netmap_dir> configuration option. If netmap kernel module is loaded when starting ODP application netmap io will be used by default. If the module is not found standard socket io is used. Netmap io can be disabled with ODP_PKTIO_DISABLE_NETMAP environment variable. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-and-tested by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-05example:generator : Fix UDP checksum computationGrigore Ion
The UDP checksum is computed in the CPU endianness. The returned result must be converted to the BE ordering when it is used to update the UDP checksum in a packet. Signed-off-by: Grigore Ion <ion.grigore@freescale.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-05example:packet: Add pktio start in burst Mode.Nikhil Agarwal
default state of pktio interface after odp_pktio_open is disabled. Need to enable the interface befaore using it. Seems like it has been missed for burst mode. Signed-off-by: Nikhil Agarwal <nikhil.agarwal@freescale.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-09-22example: ipsec: avoid mixing of scheduler wait time and time API timeIvan Khoronzhuk
It's not correct to mix time API time and scheduler wait time, used timers can have different rates. As in this example scheduler is used only for polling till event, using wait time for scheduling can be avoided at all. This patch replaces callback function on function w/o wait time, and doesn't add any functional changes. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-09-22example: timer: print timer ticks/ns table instead of cycles/nsIvan Khoronzhuk
The timer API can have nothing common with CPU cycles or time API. Thus timer test shouldn't print conversion cycles/ns table. More correct to print conversion table for timer ticks/ns. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-27linux-generic: default state for pktio is STOPMaxim Uvarov
After open pktio remains stopped. Inside worker thread (after all configuration done it should be started.) In that patch I just start it everywhere to keep original logic and be easy for review. Putting it inside worker threads will require thread arguments change and understanding logic of current app. It's better to do further changes in separate patches per app. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-27Merge branch 'master' into api-nextMaxim Uvarov
2015-08-27example:generator:move verbose from worker to controlBalakrishna.Garapati
Signed-off-by: Balakrishna.Garapati <balakrishna.garapati@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-19example:generator:option to supply core maskBalakrishna.Garapati
Signed-off-by: Balakrishna.Garapati <balakrishna.garapati@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-18Merge branch 'master' into api-nextMaxim Uvarov
2015-08-18linux-generic: pktio: remove basic socket implementationNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-and-Tested-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-11Merge branch 'master' into api-nextMaxim Uvarov
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: example/timer/odp_timer_test.c
2015-08-06example: classifier: resolve text alignment issuesStuart Haslam
When the string containing the number of packets processed by one of the queues gets for be longer than a tab the alignment is messed up and the fields overlap with part of a previous value. Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-04example: timer: use ability to indicate that event was lostIvan Khoronzhuk
In case if for some reason one of the TMOs was lost, the test will be polling forever in order to take it and delete. It can be used to indicate that event was lost. Just abort the test if it cannot receive one of the "last" TMOs for some period. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>