aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include
diff options
context:
space:
mode:
authorTuomas Taipale <tuomas.taipale@nokia.com>2022-04-04 12:18:51 +0000
committerMatias Elo <matias.elo@nokia.com>2022-05-02 17:02:50 +0300
commit40e999eaeb52d34d5289b6b8d6e405f1623d8a53 (patch)
treebc7ac6aa0c7a5cd6eb14842886e9bd701267a033 /platform/linux-generic/include
parent32f878c9b291cc4f24c30819e45aa2605fcd84f4 (diff)
linux-gen: pktio: add AF_XDP socket based packet IO
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>
Diffstat (limited to 'platform/linux-generic/include')
-rw-r--r--platform/linux-generic/include/odp_packet_internal.h6
-rw-r--r--platform/linux-generic/include/odp_packet_io_internal.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index c8dade24c..9a6bc3254 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -35,6 +35,7 @@ extern "C" {
#include <odp_ipsec_internal.h>
#include <odp_pool_internal.h>
#include <odp_queue_if.h>
+#include <odp_config_internal.h>
#include <stdint.h>
#include <string.h>
@@ -151,6 +152,9 @@ typedef struct ODP_ALIGNED_CACHE odp_packet_hdr_t {
/* LSO profile index */
uint8_t lso_profile_idx;
+ /* Pktio where packet is used as a memory source */
+ uint8_t ms_pktio_idx;
+
union {
/* Result for crypto packet op */
odp_crypto_packet_result_t crypto_op_result;
@@ -171,6 +175,8 @@ typedef struct ODP_ALIGNED_CACHE odp_packet_hdr_t {
* grow over 256 bytes. */
ODP_STATIC_ASSERT(sizeof(odp_packet_hdr_t) <= 256, "PACKET_HDR_SIZE_ERROR");
+ODP_STATIC_ASSERT(ODP_CONFIG_PKTIO_ENTRIES < UINT8_MAX, "MS_PKTIO_IDX_SIZE_ERROR");
+
/**
* Return the packet header
*/
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index a8697c069..ca9f083da 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -70,7 +70,7 @@ struct pktio_if_ops;
#elif defined(_ODP_PKTIO_DPDK)
#define PKTIO_PRIVATE_SIZE 5632
#else
-#define PKTIO_PRIVATE_SIZE 384
+#define PKTIO_PRIVATE_SIZE 512
#endif
struct pktio_entry {
@@ -308,6 +308,7 @@ static inline void _odp_pktio_tx_ts_set(pktio_entry_t *entry)
extern const pktio_if_ops_t _odp_netmap_pktio_ops;
extern const pktio_if_ops_t _odp_dpdk_pktio_ops;
+extern const pktio_if_ops_t _odp_sock_xdp_pktio_ops;
extern const pktio_if_ops_t _odp_sock_mmsg_pktio_ops;
extern const pktio_if_ops_t _odp_sock_mmap_pktio_ops;
extern const pktio_if_ops_t _odp_loopback_pktio_ops;