aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/pktio/pcap.c
AgeCommit message (Collapse)Author
2023-05-08linux-gen: pktio: enqueue packets to destination queues from pktio devicesMatias Elo
Reduce latency by enqueueing packets directly to classifier and inline IPsec destination queues from pktio devices. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-10-07linux-gen: debug: prefix implementation internal debug macrosMatias Elo
Prefix implementation internal debug macro names with underscore. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-07-14linux-gen: pcap: promisc mode disabled by defaultPetri Savolainen
Set promiscuous mode disabled by default. Updated interface MAC address to match destination MAC used in test files. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-06-21linux-gen: remove an extra level of hierarchy from pktio_entry_tJere Leppänen
Remove an extra level of hierarchy from pktio_entry_t, and make the type cache aligned. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-06-21linux-gen: pktio: loop, pcap: use atomic in_errorsJere Leppänen
Use atomic instead of internal in_errors counter in loop and pcap so that these counters are handled the same way in every pktio. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-06-21linux-gen: pktio: increment in_discards when packet cannot be classifiedJere Leppänen
When classification is enabled, but packet doesn't match any CoS and default CoS is not set, or packet has an error and error CoS is not set, the packet is dropped. In this case, increment in_discards counter. Also, fit existing in_discards increment calls on one line. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-05-27linux-gen: pktio: remove struct pktio_entry::in_chksumsJere Leppänen
pktio_entry::in_chksums is just a copy of information in pktin config. Remove it, and instead use pktin config directly. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-05-27linux-gen: pktio: move received packets to the pool indicated by CoSJere Leppänen
All pktios except loop and pcap are missing the functionality to move received packets to the pool indicated by CoS. Add the missing implementation. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-05-27linux-gen: pktio: validate L4 checksum in _odp_packet_parse_common()Jere Leppänen
We've been avoiding L4 checksum validation in case the packet is dropped due to other parse errors or classification. However, L4 checksum must be validated before classification, otherwise packets with an invalid checksum are not classified to the error CoS. Move L4 checksum validation into _odp_packet_parse_common(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-05-27linux-gen: pktio: use stats_extra.in_discards instead of stats.in_discardsJere Leppänen
When unable to copy a packet, use stats_extra.in_discards instead of stats.in_discards. In many pktios (although not loop or pcap), the latter comes directly from e.g. a socket. The former is therefore more suitable for other errors. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-03-31linux-gen: pktio: pcap: fix statsJere Leppänen
Don't count packets with errors in in_octets and in_packets. Add in_errors and in_discards counters. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-31linux-gen: drop error packets according to pktin configurationJere Leppänen
When encountering a packet error in packet parser and pktin has been configured to drop on that kind of packet error, return an error, which causes pktio to drop the packet. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-31linux-gen: pktio: always call *_packet_parse_common()Jere Leppänen
Instead of calling *_packet_parse_layer() when classifier is not enabled, always call *_packet_parse_common(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-31linux-gen: pktio: validate L4 checksum also when classifier is enabledJere Leppänen
Unlike _odp_packet_parse_layer(), _odp_packet_parse_common() (which is called when classifier is enabled) does not validate L4 checksum. Call _odp_packet_l4_chksum() directly in each pktio, when classifier is enabled. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-10linux-gen: packet: move parse functions to new source filesJere Leppänen
Move packet parsing functions to new odp_parse.c and odp_parse_internal.h files. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-10linux-gen: cls: move parse call out of _odp_cls_classify_packet()Jere Leppänen
Instead of calling _odp_packet_parse_common() in _odp_cls_classify_packet(), make the call in pktio before the classify call. This is cleaner and makes for better error handling. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-02-08linux-gen: remove odp_api.h includes from implementationMatias Elo
Don't include odp_api.h header inside the implementation files as it unnecessarily includes all API headers. The remaining includes have been cleaned up and grouped. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21linux-gen: pktio: fix conversion overflow build errorsMatias Elo
Fix "overflow in conversion from 'int' to 'char' changes value" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-06-23linux-gen: pktio: implement statistics counters capabilitiesMatias Elo
Fill new odp_pktio_stats_capability_t capability for all pktio devices supporting statistics counters. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-05-05linux-gen: pktio: implement in_packets/out_packets countersMatias Elo
Implement new odp_pktio_stats_t.in_packets/out_packets packet IO statistics counters. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-02-26linux-gen: rename remaining global symbols in the static libraryJere Leppänen
Rename the rest of the global symbols in the static library that do not have the "_odp_" prefix. Fixes: https://github.com/OpenDataPlane/odp/issues/805 Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-02-08linux-gen: pcap: implement odp_pktio_maxlen_set()Matias Elo
Implementation of odp_pktio_maxlen_set() for pcap pktio. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-02-08linux-gen: pktio: rename pktio_if_ops_t mtu_get to maxlen_getMatias Elo
Rename pktio_if_ops_t.mtu_get to maxlen_get to make naming consistent with the API functions. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-12-23linux-gen: rename some global symbols in the static libraryJere Leppänen
Rename some symbols that are global in the static library, in order to avoid clashes with application code. The prefix "_odp_" is added to the existing names. This patch renames most of the global symbols, a few more still remain to be renamed. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-12-03linux-generic: pcap: enable packet classificationKiran Kumar K
Add classifier integration to pcap pktio. With the previous code packets received from a pcap interface were never classified. Signed-off-by: Kiran Kumar K <kirankumark@marvell.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2020-11-02linux-gen: pktio: pcap: add support for tx timestampingMatias Elo
Implement support for recording timestamps of transmitted packets. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-11-02linux-gen: pktio: update rx and tx timestamp implementationNithin Dabilpuram
This patch adds framework for new pktio and packet API to support retrieval of timestamps from Packet IO time source. Signed-off-by: Matias Elo <matias.elo@nokia.com> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-07-02linux-gen: pktio: use enum as odp_pktio_link_status() return valueMatias Elo
Use odp_pktio_link_status_t enum as odp_pktio_link_status() return value. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-07-02linux-gen: pcap: implement odp_pktio_link_info()Matias Elo
Add implementation for odp_pktio_link_info() function. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-07-02linux-gen: pcap: implement odp_pktio_link_status()Matias Elo
Add implementation for odp_pktio_link_status() function. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2020-02-26linux-gen: pcap: disable loop support in process modeMatias Elo
Reopening pcap interface, which is needed to implemement loop support, causes pcap internal failure in process mode. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2019-11-27linux-gen: pktio: always check pktio state before recv/sendMatias Elo
Previously some pktio types could recv/send packets even though the pktio was not in started state. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reported-by: Carl Wallen <carl.wallen@nokia.com>
2019-11-26linux-gen: pcap: implement frame offset configPetri Savolainen
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2019-09-27linux-gen: include config.h header in install directoryMatias Elo
Previously, config.h header was not included in install dir. This caused a compilation failure when an application tried to include ODP helper headers. config.h has been moved to include/odp subdirectory to avoid naming conflicts and unnecessary includes have been removed. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reported-by: Mikko Parpala <mikko.parpala@nokia.com>
2018-10-04linux-gen: pcap: allocate tx buffer from stackMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-06-01linux-gen: pktio: make pcap use generic private data fieldDmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-05-22linux-gen: packet: remove separate API inlining headerDmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-05-17linux-gen: packet: add IPv4 checksum validationDmitry Eremin-Solenikov
If configured, check IPv4 header checksum. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Bogdan Pricope <bogdan.pricope@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-02-26update Linaro Copyrights to 2018 yearMaxim Uvarov
Using simple commands: find . -not -path .git -type f -exec \ sed -i -E 's/ (201[0-9]), Linaro/ \1-2018, Linaro/g' {} + find . -not -path .git -type f -exec \ sed -i -E 's/ (201[0-9])(-201[0-9]), Linaro/ \1-2018, Linaro/g' {} + Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
2018-02-05linux-gen: packet: remove odp_packet_hdr functionPetri Savolainen
Use only one function (packet_hdr) in handle to header pointer conversion. odp_packet_hdr is bad name for an implementation internal function as API function prefix is odp_packet_. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-02-05linux-gen: packet: use inlined copy functionsPetri Savolainen
Use always inlined versions of packet to/from memory copy functions. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2018-01-22linux-gen: pktio: unify send/recv function argument namingMatias Elo
Use argument named 'num' on all pktio devices to pass the number of packets to receive/transmit. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-12-27linux-gen: pktio: implement MAC address set functionBogdan Pricope
Add implement of MAC address set API. It calls packet IO specific MAC address set function. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-08-25linux-gen: use config.h headerDmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2017-06-16linux-gen: packet: remove lazy parsingMatias Elo
Replace old lazy parsing code with a new packet parsing implementation which follows the latest API (parsing level is selected using odp_pktio_config()). Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-07-26linux-gen: pktio: use multi allocMatias Elo
Modify dpdk pktio to take advantage of multi-alloc/free. Others pktios do alloc/free still one packet at a time. For example, l2fwd test application packet throughput is increased about 10% (with dpdk pktio). Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-07-15example: remove reference from linux-generic internal envsMaxim Uvarov
Make print for example more platform independent and move prints about pktio states in platform initialization code. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
2016-07-05linux-gen: remove all dependencies to helperYi He
Remove all dependencies to helper by copying protocol header definitions into linux-generic, checked and decoupled all odph_* ODPH_* references. Signed-off-by: Yi He <yi.he@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-06-16linux-gen: packet: use packet_parser_t type argument with parser functionsMatias Elo
Modify packet parser functions to utilize new packet_parser_t structure. Renamed the main parser function _odp_parse_common() to packet_parse_common(). packet_parse_common() now takes also segment length as argument. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-06-16linux-gen: pktio: simplify state handlingPetri Savolainen
Removed 'int taken', so that 'enum state' is the only variable which holds pktio entry state. Added PKTIO_ prefix for better name space protection and code readability. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>