aboutsummaryrefslogtreecommitdiff
path: root/example
AgeCommit message (Collapse)Author
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>
2015-08-04example: timer: delete races while terminationIvan Khoronzhuk
Current implementation has at least two races that lead to several issues: - gbls->remain can overflow. One thread can decrement remain counter to 0. While another can decrement it once again and it will be > 0. After what some thread will loop very long time ... - Several threads can terminate the same timer and as result the same event. After out from the main loop a thread terminates a last timer it used. But a last timer saved in ttp for a thread can be received in another thread. So after leaving the main loop two threads can hold the same timer. - Some timer cannot be freed as several threads try to delete the same timer, as result one of the timer/tmo stay not freed after termination. - The test can send more events that requested. The receiving of requested number of tmos doesn't mean the test sent the same number. It rather sent more. This patch is intended to fix above drawbacks. The termination path must follow the next things: - An event can be in the following places: in a timer (waiting to be scheduled), in a queue for a thread to be scheduled, received in the main loop. - An event "holds" a timer, so when we receive an event we can delete it's timer. - a thread cannot delete timer w/o an event as it doesn't know who is owner of the event (and obvious the timer). - a thread shouldn't send events more than requested. - all threads have to be "held" in the loop till a last received event. The scheduler can assign event for any of the threads, so one thread can receive two last events for example. According to above, added several improvements: - don't send more timeouts that supposed to receive - free timer and tmo for a last received tmos = num of threads. - leave the main loop only if a last tmo/timer is free. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-31example: classifier: fix buffer size warningBalasubramanian Manoharan
Fixes: https://bugs.linaro.org/show_bug.cgi?id=1722 Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-30example:generator:printing verbose outputBalakrishna.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-07-27example: ipsec: fix copy/paste error in READMEStuart Haslam
Instructions should include adding static ARP entry as per the instructions for the other end of the tunnel on line #138. Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-24example: classifier: fix string overflowBala Manoharan
Fixes: https://bugs.linaro.org/show_bug.cgi?id=1512 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-07-24example:ipsec: Fix for Polled queuesNikhil Agarwal
This patch updates IPSEC application to create proper Pktin queues in poll mode of operation. PKTIN queue is created as polled queues if no scheduling parameters is passed to queue create API. Signed-off-by: Nikhil Agarwal <nikhil.agarwal@freescale.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-23api: helper: deleted odph_linux_cpumask_defaultPetri Savolainen
The linux specific helper was replaced by default cpumask calls (odp_cpumask_def_worker()) in the cpumask API. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Christophe Milard <christophe.milard@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: helper/linux.c
2015-07-23api: init: added thread type to local initPetri Savolainen
User needs to select the thread type (worker or control) of the initialized thread. Implementation may reserve HW direct access only to worker threads, while control threads share HW access, etc. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: helper/linux.c
2015-07-22configure: use stricter warningsMike Holmes
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-21api: pool: remove shm paramter from odp_pool_create()Bill Fischofer
This patch removes the 2nd parameter to odp_pool_create() because it has two major issues: 1. Applications have no way to know how big a shm area is required for a given pool since that information is implementation specific. So there's no portable means of using this parameter. 2. Some implementations (e.g., odp-dpdk) cannot accept an external memory area for pool creation since they need to control the memory themselves. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: test/validation/pktio/pktio.c test/validation/pool/pool.c helper/test/odp_chksum.c
2015-07-17example: ipsec: Fix context state race condition inNikhil Agarwal
If the packet sumbitted for cyprto operation returns back to other thread before pre crypto thread has completed processing, ctx will has old state hence packet will be re-submitted for crypto operation. To fix this issue, update the ctx state before packet submission. Signed-off-by: Nikhil Agarwal <nikhil.agarwal@freescale.com> Reviewed-by: Steve Kordus <skordus@cisco.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-17test: do not use negative array indexMaxim Uvarov
odp_pktio_send() can return -1 error and that return code can be used as array index in code bellow. On error just increase drop counter and free packets. https://bugs.linaro.org/show_bug.cgi?id=1688 Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofe@linaro.org>
2015-07-16queue: handle return value of odp_queue_enq()Zoltan Kiss
Unsent packet has to be released. If the event type is obvious from the context, use directly the relevant release functions, otherwise odp_event(free). Wider error handling is attempted, but this patch can't fix all the flaws in the many calling functions of odp_queue_enq() Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16odp_timer_test: remove redundant free functionZoltan Kiss
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-15examples: ipsec: fix inner IP checksum computationAlexandru Badicioiu
Signed-off-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-14example:generator:print correct appl_modeBalakrishna.Garapati
Signed-off-by: Balakrishna.Garapati <balakrishna.garapati@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-09helper: convert to a libraryMike Holmes
Remove the need to build helper source files into the linux-generic library by converting helpers to be their own library. This removes the need for all other platforms to also build in the helpers which are optional just to run the tests. Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Christophe Milard <christophe.milard@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-08packet_io: release unsent packets after odp_pktio_send()Zoltan Kiss
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-06-29configurable binaries extensionNicolas Morey-Chaisemartin
Add $(EXEEXT) to all binary generated so platform can easily configure the binaries extension and use the LOG_COMPILER features of automake. This should have no visible effect unless EXEEXT is set by the configure Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Acked-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-06-16helpers: fix udp checksum computationAlexandru Badicioiu
Signed-off-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-06-12example: use SCNx32/PRIx32 macroNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-06-12example: classifier: check sscanf return codeNicolas Morey-Chaisemartin
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-06-10example: ipsec: tunnel mode supportAlexandru Badicioiu
Tunnel mode is enabled from the command line using -t argument with the following format: SrcIP:DstIP:TunnelSrcIP:TunnelDstIP. SrcIP - cleartext packet source IP DstIP - cleartext packet destination IP TunnelSrcIP - tunnel source IP TunnelDstIP - tunnel destination IP The outbound packets matching SrcIP:DstIP will be encapsulated in a TunnelSrcIP:TunnelDstIP IPSec tunnel (AH/ESP/AH+ESP) if a matching outbound SA is determined (as for transport mode). For inbound packets each entry in the IPSec cache is matched for the cleartext addresses, as in the transport mode (SrcIP:DstIP) and then for the tunnel addresses (TunnelSrcIP:TunnelDstIP) in case cleartext addresses didn't match. After authentication and decryption tunneled packets are verified against the tunnel entry (packets came in from the expected tunnel). Signed-off-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Reviewed-by: Steve Kordus <skordus@cisco.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-06-05codespell: fix spellingMike Holmes
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-05-28example: classifier: remove extra local initPetri Savolainen
Worker threads are created with odph_linux_pthread_create() which calls odp_local_init() before entering the function. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
2015-05-18example: classifier: check for null tokenMike Holmes
fixes https://bugs.linaro.org/show_bug.cgi?id=1534 Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-05-08example: timer: remove global variables to share the data between workersJerin Jacob
use the odp_shared_memory allocater instead of global variables to enable the timer example to run on baremetal/linux process execution environments Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Reviewed-and-tested-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-05-08api/linux-generic/example/validation: remove odp_pmr_create_range() function ↵Balasubramanian Manoharan
definition This is combined commit of 4 following mailing list patches: linux-generic: classification: remove odp_pmr_create_range() function implementation. This patch removes the implementation of odp_pmr_create_range() function. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> api: classification: remove odp_pmr_create_range() function definition. The support for a range based packet matching rule is not available in most of the hardwares and hence this API is removed. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> validation: remove test case for odp_pmr_create_range() function This patch removes the validation suite test case for odp_pmr_create_range() function. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> example: classifier: remove odp_pmr_create_range() support This patch removes support for odp_pmr_create_range() function in the classifier example application. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-24example: ODP classifier exampleBalasubramanian Manoharan
ODP Classifier example This programs gets pmr rules as command-line parameter and configures the classification engine in the system. This initial version supports the following * ODP_PMR_SIP_ADDR pmr term * PMR term MATCH and RANGE type * Multiple PMR rule can be set on a single pktio interface with different queues associated to each PMR rule * Automatically configures a default queue and provides statistics for the same * Prints statistics interms of the number of packets dispatched to each queue Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-and-tested-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-23example: timer: clean up prescheduled eventsOla Liljedahl
Fixes https://bugs.linaro.org/show_bug.cgi?id=1450 Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-23example: doxygen: remove examples from src pathMike Holmes
If the examples are on the src path they pollute the documentation with their own declarations. The correct mechanism is to declare the examples to be seen in the documentation in one location that is on the .dox path, and have the EXAMPLE_PATH locate the actual example code. Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-14validation: move l2fwd from example to performance testsMaxim Uvarov
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> Reviewed-and-tested-by: Mike Holmes <Mike.holmes@linaro.org>
2015-04-10examples: odp_ipsec: runtime select multiple vs single deqAlexandru Badicioiu
Signed-off-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Reviewed-by: Robbie King <robking@cisco.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-10examples: odp_ipsec: runtime select scheduled vs poll queuesAlexandru Badicioiu
Signed-off-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Reviewed-by: Robbie King <robking@cisco.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-10examples: odp_ipsec: handle alloc_pkt_ctx failureAlexandru Badicioiu
Application should continue in case a packet context cannot be allocated. Signed-off-by: Alexandru Badicioiu <alexandru.badicioiu@linaro.org> Reviewed-by: Robbie King <robking@cisco.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-30example: odp_generator: use odp_timerOla Liljedahl
Use ODP timer facility instead of POSIX sleep/nanosleep. https://bugs.linaro.org/show_bug.cgi?id=1025 Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-27example: generator: replace strtok_r with strtok and fix leaksCiprian Barbu
The odp_ipsec example leaks some strings allocated during parse_args. https://bugs.linaro.org/show_bug.cgi?id=1117 CID 56899: Resource leak (RESOURCE_LEAK) Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-27example: odp_ipsec: replace strtok_r with strtok and fix leaksCiprian Barbu
The odp_ipsec example leaks some strings allocated during parse_args. https://bugs.linaro.org/show_bug.cgi?id=1117 CID 56899: Resource leak (RESOURCE_LEAK) Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-27example: odp_l2fwd: replace strtok_r with strtok and fix leaksCiprian Barbu
The odp_l2fwd example leaks some strings allocated during parse_args. https://bugs.linaro.org/show_bug.cgi?id=1117 CID 56899: Resource leak (RESOURCE_LEAK) Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-25example: l2fwd print packets per secondMaxim Uvarov
Current print in l2fwd is not useful with slow links and also it's hard to say how fast does it work. Print pps and packets drops. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-and-tested-by: Ciprian Barbu <ciprian.barbu@linaro.org>
2015-03-16example: odp_ipsec: remove USE_MAC_ADDR_HACKCiprian Barbu
Remove the old hack and switch to using the provided API This also fixes https://bugs.linaro.org/show_bug.cgi?id=1330 Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-10example: odp_packet uncomment polling queuesMaxim Uvarov
odp_packet examples has polling queues commented out with if 1. Input queue (ODP_QUEUE_TYPE_PKTIN) is not attached to scheduler but it make sense in example show that packets can be accessed with polling queues also. https://bugs.linaro.org/show_bug.cgi?id=301 Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-06replace deprecated _BSD_SOURCE with _DEFAULT_SOURCEGary S. Robertson
Compilation of ODP v1.0 on OpenEmbedded failed due to the following warning being treated as an error: | In file included from /usr/include/stdlib.h:24:0, | from odp/example/ipsec/odp_ipsec.c:16: | /usr/include/features.h:148:3: | error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, | use _DEFAULT_SOURCE" [-Werror=cpp] | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, | use _DEFAULT_SOURCE" | ^ Modified the source 'example/ipsec/odp_ipsec.c' as recommended. Change-Id: I3b8fb392611ea3ad35d17a9492637f44d7ca5d2c Reviewed-and-tested-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Gary S. Robertson <gary.robertson@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-27example: odp_ipsec_stream: fix c99 unknown type name ‘uint’Mike Holmes
odp_ipsec_stream.c:190:2: error: unknown type name ‘uint’ uint i; Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-and-tested-by: Maxim Uvarov <maxim.uvarov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-27example: fix multiple c99 implicit declaration of function ‘strtok_r’Mike Holmes
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-and-tested-by: Maxim Uvarov <maxim.uvarov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-27example: odp_ipsec: fix c99 storage size of ‘ifr’ isn’t knownMike Holmes
odp_ipsec.c:233:15: error: storage size of ‘ifr’ isn’t known struct ifreq ifr; Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-and-tested-by: Maxim Uvarov <maxim.uvarov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-27example: odp_ipsec_stream: fix c99 unknown type name ‘uint’Mike Holmes
./odp_ipsec_stream.h:27:2: error: unknown type name ‘uint’ uint length; /**< Packet payload length */ Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-and-tested-by: Maxim Uvarov <maxim.uvarov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-27example: odp_generator: fix c99 usleepMike Holmes
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-and-tested-by: Maxim Uvarov <maxim.uvarov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-27example: packet: add more missing doxygen documentationBill Fischofer
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>