diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-04-29 15:04:22 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-05-25 10:57:59 +0300 |
commit | 8defbf0b033a27af901ed749a321528d9855db07 (patch) | |
tree | 1d34c585a7dd068505da87e586d31e90598a3029 | |
parent | 2fadc2d629abc51c81b2beaa52905e33842f1cb3 (diff) |
Port 9c4f7863c "linux-gen: packet: implement packet aging API"
Port original commit from linux-generic.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
-rw-r--r-- | platform/linux-dpdk/include/odp/api/plat/packet_inline_types.h | 7 | ||||
-rw-r--r-- | platform/linux-dpdk/include/odp_packet_internal.h | 4 | ||||
-rw-r--r-- | platform/linux-dpdk/odp_packet.c | 11 |
3 files changed, 15 insertions, 7 deletions
diff --git a/platform/linux-dpdk/include/odp/api/plat/packet_inline_types.h b/platform/linux-dpdk/include/odp/api/plat/packet_inline_types.h index 2b8e849e6..06e322066 100644 --- a/platform/linux-dpdk/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-dpdk/include/odp/api/plat/packet_inline_types.h @@ -113,7 +113,7 @@ typedef union { uint32_t all_flags; struct { - uint32_t reserved1: 7; + uint32_t reserved1: 6; /* * Init flags @@ -131,6 +131,7 @@ typedef union { uint32_t l4_chksum: 1; /* L4 chksum override */ uint32_t ts_set: 1; /* Set Tx timestamp */ uint32_t tx_compl: 1; /* Tx completion event requested */ + uint32_t tx_aging: 1; /* Packet aging at Tx requested */ uint32_t shaper_len_adj: 8; /* Adjustment for traffic mgr */ /* @@ -148,8 +149,8 @@ typedef union { /* Flag groups */ struct { - uint32_t reserved2: 7; - uint32_t other: 17; /* All other flags */ + uint32_t reserved2: 6; + uint32_t other: 18; /* All other flags */ uint32_t error: 8; /* All error flags */ } all; diff --git a/platform/linux-dpdk/include/odp_packet_internal.h b/platform/linux-dpdk/include/odp_packet_internal.h index 3c1735367..f50250202 100644 --- a/platform/linux-dpdk/include/odp_packet_internal.h +++ b/platform/linux-dpdk/include/odp_packet_internal.h @@ -147,6 +147,10 @@ typedef struct odp_packet_hdr_t { /* Max payload size in a LSO segment */ uint16_t lso_max_payload; + /* Packet aging drop timeout before enqueue. Once enqueued holds the maximum age (time of + * request + requested drop timeout). */ + uint64_t tx_aging_ns; + /* LSO profile index */ uint8_t lso_profile_idx; diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c index e26f63ffc..24e3ab69a 100644 --- a/platform/linux-dpdk/odp_packet.c +++ b/platform/linux-dpdk/odp_packet.c @@ -1860,14 +1860,17 @@ int odp_packet_payload_offset_set(odp_packet_t pkt, uint32_t offset) void odp_packet_aging_tmo_set(odp_packet_t pkt, uint64_t tmo_ns) { - (void)pkt; - (void)tmo_ns; + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + pkt_hdr->p.flags.tx_aging = tmo_ns ? 1 : 0; + pkt_hdr->tx_aging_ns = tmo_ns; } uint64_t odp_packet_aging_tmo(odp_packet_t pkt) { - (void)pkt; - return 0; + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + return pkt_hdr->p.flags.tx_aging ? pkt_hdr->tx_aging_ns : 0; } int odp_packet_tx_compl_request(odp_packet_t pkt, const odp_packet_tx_compl_opt_t *opt) |