diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-05-12 09:19:28 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-05-30 14:41:40 +0300 |
commit | d7afbc7d5ec0483c3a3915961b6f73f86ac6febb (patch) | |
tree | 5602646c56d753b747363ca727df469a92f08166 /platform | |
parent | f2775c359870719cd204534742cdbc77c2d637f0 (diff) |
linux-dpdk: pktio: refactor pkt_dpdk_t struct
Refactor pkt_dpdk_t struct by collecting fast path data to the beginning
of the struct. Unused 'ifname' member has been removed. As a result, the
maximum size of pkt_dpdk_t has been reduced from 1536 bytes (with 128 byte
cache lines) to 1408 bytes. With more common 64 byte cache line size only
1216 bytes are required.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linux-dpdk/include/odp_packet_io_internal.h | 7 | ||||
-rw-r--r-- | platform/linux-dpdk/odp_packet_dpdk.c | 50 |
2 files changed, 35 insertions, 22 deletions
diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h b/platform/linux-dpdk/include/odp_packet_io_internal.h index 8e06703fb..1f3fb650d 100644 --- a/platform/linux-dpdk/include/odp_packet_io_internal.h +++ b/platform/linux-dpdk/include/odp_packet_io_internal.h @@ -18,6 +18,7 @@ extern "C" { #endif +#include <odp/api/align.h> #include <odp/api/hints.h> #include <odp/api/packet_io.h> #include <odp/api/spinlock.h> @@ -53,7 +54,11 @@ ODP_STATIC_ASSERT(PKTIO_LSO_PROFILES < UINT8_MAX, "PKTIO_LSO_PROFILES_ERROR"); /* Forward declaration */ struct pktio_if_ops; -#define PKTIO_PRIVATE_SIZE 1536 +#if ODP_CACHE_LINE_SIZE == 128 +#define PKTIO_PRIVATE_SIZE 1408 +#else +#define PKTIO_PRIVATE_SIZE 1216 +#endif struct pktio_entry { const struct pktio_if_ops *ops; /**< Implementation specific methods */ diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c index 37bc7bdc2..e078754cb 100644 --- a/platform/linux-dpdk/odp_packet_dpdk.c +++ b/platform/linux-dpdk/odp_packet_dpdk.c @@ -86,39 +86,47 @@ typedef struct { int rx_drop_en; } dpdk_opt_t; -/** Packet socket using dpdk mmaped rings for both Rx and Tx */ +/* DPDK pktio specific data */ typedef struct ODP_ALIGNED_CACHE { - /** Supported RTE_PTYPE_XXX flags in a mask */ + /* --- Fast path data --- */ + + /* Supported RTE_PTYPE_XXX flags in a mask */ uint32_t supported_ptypes; - /** RSS configuration */ - struct rte_eth_rss_conf rss_conf; - char ifname[32]; - /** DPDK port identifier */ + /* DPDK port identifier */ uint16_t port_id; - /** Maximum transmission unit */ - uint16_t mtu; - /** Maximum supported MTU value */ - uint32_t mtu_max; - /** DPDK MTU has been modified */ - odp_bool_t mtu_set; struct { - /** No locking for rx */ + /* No locking for rx */ uint8_t lockless_rx : 1; - /** No locking for tx */ + /* No locking for tx */ uint8_t lockless_tx : 1; - /** Promiscuous mode defined with system call */ + /* Promiscuous mode defined with system call */ uint8_t vdev_sysc_promisc : 1; } flags; - /** Minimum RX burst size */ + /* Minimum RX burst size */ uint8_t min_rx_burst; - /** Number of TX descriptors per queue */ + + /* --- Control path data --- */ + + /* Configuration options */ + dpdk_opt_t opt; + /* RSS configuration */ + struct rte_eth_rss_conf rss_conf; + /* Maximum transmission unit */ + uint16_t mtu; + /* Maximum supported MTU value */ + uint32_t mtu_max; + /* DPDK MTU has been modified */ + odp_bool_t mtu_set; + /* Number of TX descriptors per queue */ uint16_t num_tx_desc[PKTIO_MAX_QUEUES]; - /** RX queue locks */ + + /* --- Locks for MT safe operations --- */ + + /* RX queue locks */ odp_ticketlock_t rx_lock[PKTIO_MAX_QUEUES] ODP_ALIGNED_CACHE; - /** TX queue locks */ + /* TX queue locks */ odp_ticketlock_t tx_lock[PKTIO_MAX_QUEUES] ODP_ALIGNED_CACHE; - /** Configuration options */ - dpdk_opt_t opt; + } pkt_dpdk_t; ODP_STATIC_ASSERT(PKTIO_PRIVATE_SIZE >= sizeof(pkt_dpdk_t), |