aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/pktio
AgeCommit message (Collapse)Author
2022-06-20Merge tag 'v1.37.0.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2022-05-04Merge tag 'v1.36.0.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>
2022-05-02linux-gen: pktio: add AF_XDP socket based packet IOTuomas Taipale
Add new AF_XDP socket based packet IO implementation. Information about AF_XDP and XDP can be found in [1]. ODP packet pool(s) created for packet IO entries are used as the UMEM areas. Currently, only zero-copy mode is supported, copy-mode support will be added later. Depending on the XDP program loaded into the environment's NIC(s), TX and RX queue selection for packets may differ. By default, only a single combined queue is supported and this may require changing the configuration of the NIC accordingly so that packets end up on the AF_XDP socket created by ODP. [1] https://www.kernel.org/doc/Documentation/networking/af_xdp.rst Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-05-02linux-gen: dpdk: adapt to new memory source operations interfaceTuomas Taipale
Adapt DPDK packet IO to use the new `_odp_pool_mem_src_ops_t` interface. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-05-02linux-gen: macros: prefix implementation internal macro namesMatias Elo
Add _ODP_ prefixes to implementation internal helper macros and collect common macros into a single header file (odp_macros_internal.h). Unused macros (DIV_ROUND_UP, odp_container_of) have been removed. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-04-14linux-gen: pktio: loop: remove unnecessary odp_ipsec_result() callJanne Peltonen
Remove the odp_ipsec_result() call that is made just in case it performs some post-processing for odp_ipsec_out_inline(). Since no post-processing is actually done and since the call currently generates a warning (due to unchecked return value), simply remove the call. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-04-13linux-gen: pktio: use uint32_t for number of queuesPetri Savolainen
Update odp_pktin_recv_mq_tmo() and other parts of packet IO to use uint32_t instead of 'unsigned int'. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-03-31linux-gen: pktio: socket: copy segmented data to memory for parsingJere Leppänen
If received packet data segments are smaller than the parser contiguous data requirement, copy to memory. 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: 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-31linux-gen: pktio: loop: fix copying segmented data to memoryJere Leppänen
Copy packet data to memory for parsing if segment size is smaller than parser requirement (PARSE_BYTES) and the packet is longer than a segment. The latter check was for whether the packet is longer than PARSE_BYTES, but that leaves the possibility of a multi-segment packet equal to or shorter than PARSE_BYTES. 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-23Merge tag 'v1.35.0.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>
2022-03-18linux-gen: dpdk: remove unsupported conditional codeTuomas Taipale
Remove conditional code that is not relevant anymore from DPDK 19.11 onwards. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-03-16linux-gen: dpdk: check rte_eth_dev_info_get() return valueTuomas Taipale
In `dpdk_open()`, when `rte_eth_dev_info_get()` is called for the first time, handle its return value. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-03-16linux-gen: dpdk: add support for DPDK 21.11Tuomas Taipale
Main impacts: - A few macro name deprecations, new names taken into use, old names mapped to the new names with older versions. - rte_eth_dev_set_mtu() is now forbidden to be used before device is configured (rte_eth_dev_configure()), so "MTU-settability" checking becomes less complete: support can still be inferred based on return codes but proper error checking cannot be done due to the pre-config condition. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-03-14linux-gen: dpdk: refactor zero-copy memory populationTuomas Taipale
With zero-copy, DPDK seems to expect external memory buffers that would be crossing a hugepage boundary to be aligned to the boundary. This isn't the case with ODP pools as boundary-crossing buffers are skipped and unused but still part of the pool. Thus, change DPDK external memory pool population to be done with several virtually and physically contiguous chunks as dictated by the skipped buffers. This additionally fixes zero-copy operation with Mellanox NICs, which didn't work properly with the previous single memory chunk population. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2022-03-10linux-gen: parse: fix _odp_packet_parse_common() contiguous data requirementJere Leppänen
Change the value of PACKET_PARSE_SEG_LEN from 96 to PARSE_ETH_BYTES + PARSE_L3_L4_BYTES, which is 110 bytes. Also change the name of the macro to PARSE_BYTES, which is in line with other similar macros. The parse function itself does not change, only the value (and name) of the macro changes. 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: pktio: loop: fix countersJere Leppänen
Increment in_errors only on parse errors, and in_packets and in_octets only on successfully parsed and classified errorless packets. 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: pktio: loop: use in_discards counterJere Leppänen
Use the in_discards counter for errors that are not errors in the received 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-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-03-10linux-gen: pktio: fix classification result handlingJere Leppänen
When classification result is to drop the packet, make all pktios do so cleanly without logging errors. 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: pktio: loop: fix in_packets in case of errorsJere Leppänen
When incrementing in_packets, don't subtract failed from num_rx, since it was never added there. 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-02linux-gen: dpdk: implement new packet output queue size parameterMatias Elo
Implement new packet output queue size API for dpdk pktio. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-02linux-gen: loop: clean internal queue on device close/reconfigureMatias Elo
Free possible remaining packets in the implementation's internal plain queue during odp_pktio_close() or odp_pktout_queue_config(). Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-03-02linux-gen: loop: implement new packet output queue size parameterMatias Elo
Implement new packet output queue size API for loop pktio. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-02-21linux-gen: dpdk: fix potential undefined behavior with zero-copyTuomas Taipale
When freeing copied packets after zero-copy send, copy need was checked by accessing the packet header. At this point, the data may or may not be valid anymore. Fix this by saving the indices of copied packets already beforehand and use those for later access. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@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>
2022-02-07Merge tag 'v1.34.0.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>
2022-02-04linux-gen: packet: rename internal classifier metadata copy functionMatias Elo
Rename implementation internal copy_packet_cls_metadata() function to _odp_packet_copy_cls_md() to better align with internal function naming convention. The argument order has also been swapped for the same reason. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-02-03linux-gen: ipc: get rid of possible uninitialized variable accessJanne Peltonen
When compiling with LTO, the compiler may complain about uninitialized variable access in case odp_shm_info would fail. Return a pointer to a static string instead of an uninitialized pointer in that case. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-12-29linux-gen: pktio: socket: fix log textTuomas Taipale
Add missing whitespace to `sock_init_global()` log. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-12-16Merge tag 'v1.33.0.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>
2021-11-23linux-gen: buffer: use common event headerMatias Elo
Use common _odp_event_hdr_t in odp_buffer_hdr_t. Cache line alignment constraint has been moved to odp_buffer_hdr_t. The implementation internal scheduler and queue interfaces have been modified to use event headers instead of buffer headers. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-11-23linux-gen: packet: use common event headerMatias Elo
Use common _odp_event_hdr_t in odp_packet_hdr_t. Cache line alignment constraint has been moved to odp_packet_hdr_t. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-11-23Merge tag 'v1.32.1.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>
2021-11-12linux-gen: dpdk: packet parsing fixesMatias Elo
Merge fixes done to the generic packet parsing code (ad9638fd9, 50fe59300, adae181a7) into the DPDK specific packet parsing implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
2021-10-21linux-gen: use common debug print macroMatias Elo
Use common implementation internal debug macro ODP_DBG_LVL() to avoid "ISO C99 requires at least one argument for the "..." in a variadic macro" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21linux-gen: fix print format build errorsMatias Elo
Fix "format '%p' expects argument of type 'void *'" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21linux-gen: fix extra semicolon build errorsMatias Elo
Fix "ISO C does not allow extra ';' outside of a function" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21linux-gen: pktio: fix empty translation unit build errorsMatias Elo
Fix "ISO C forbids an empty translation unit" errors when building with 'pedantic' option. 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-10-11linux-gen: dpdk: packet parsing fixesMatias Elo
Merge fixes done to the generic packet parsing code (ad9638fd9, 50fe59300, adae181a7) into the DPDK specific packet parsing implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-10-05Merge tag 'v1.32.0.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>
2021-09-23linux-gen: pktio: loop: fix parsing of segmented packetsJanne Peltonen
The receive processing in loop pktio processes packets that have the same underlying packet buffers as they had when sent. This means that, unlike other pktios that allocate packet buffers, loop may have packets with inconvenient segment boundaries in the receive path. Such packets may get parsed incorrectly since loop uses a parsing function that assumes contiguous packet data for the parsed headers. Fix the problem by doing parsing using odp_packet_parse() which can handle segmented packets too. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-08-18Merge tag 'v1.31.0.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>
2021-08-16linux-gen: dpdk: fix invalid mbuf data offsetMatias Elo
Fix the check in mbuf_update() which detects if mbuf data offset needs to be updated. The previous check didn't detect a scenario where data offset was not at default value (caused by e.g. odp_packet_push_head()). Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reported-and-tested-by: Christian Hong <guochun.hgc@alibaba-inc.com>
2021-07-13Merge tag 'v1.30.1.0' of https://github.com/OpenDataPlane/odp into odp-dpdkMatias Elo
Signed-off-by: Matias Elo <matias.elo@nokia.com>