@@ -108,6 +108,24 @@ static inline uint32_t _odp_packet_user_area_size(odp_packet_t pkt)
return _odp_pool_get(pool, uint32_t, uarea_size);
}
+/** @internal Inline function @param pkt @return */
+static inline uint32_t _odp_packet_l2_offset(odp_packet_t pkt)
+{
+ return _odp_pkt_get(pkt, uint16_t, l2_offset);
+}
+
+/** @internal Inline function @param pkt @return */
+static inline uint32_t _odp_packet_l3_offset(odp_packet_t pkt)
+{
+ return _odp_pkt_get(pkt, uint16_t, l3_offset);
+}
+
+/** @internal Inline function @param pkt @return */
+static inline uint32_t _odp_packet_l4_offset(odp_packet_t pkt)
+{
+ return _odp_pkt_get(pkt, uint16_t, l4_offset);
+}
+
/** @internal Inline function @param pkt @return */
static inline uint32_t _odp_packet_flow_hash(odp_packet_t pkt)
{
@@ -68,6 +68,21 @@ _ODP_INLINE uint32_t odp_packet_user_area_size(odp_packet_t pkt)
return _odp_packet_user_area_size(pkt);
}
+_ODP_INLINE uint32_t odp_packet_l2_offset(odp_packet_t pkt)
+{
+ return _odp_packet_l2_offset(pkt);
+}
+
+_ODP_INLINE uint32_t odp_packet_l3_offset(odp_packet_t pkt)
+{
+ return _odp_packet_l3_offset(pkt);
+}
+
+_ODP_INLINE uint32_t odp_packet_l4_offset(odp_packet_t pkt)
+{
+ return _odp_packet_l4_offset(pkt);
+}
+
_ODP_INLINE uint32_t odp_packet_flow_hash(odp_packet_t pkt)
{
return _odp_packet_flow_hash(pkt);
@@ -94,6 +94,12 @@ typedef struct _odp_packet_inline_offset_t {
/** @internal field offset */
uint16_t user_area;
/** @internal field offset */
+ uint16_t l2_offset;
+ /** @internal field offset */
+ uint16_t l3_offset;
+ /** @internal field offset */
+ uint16_t l4_offset;
+ /** @internal field offset */
uint16_t flow_hash;
/** @internal field offset */
uint16_t timestamp;
@@ -37,6 +37,9 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = {
.segcount = offsetof(odp_packet_hdr_t, buf_hdr.segcount),
.user_ptr = offsetof(odp_packet_hdr_t, buf_hdr.buf_ctx),
.user_area = offsetof(odp_packet_hdr_t, buf_hdr.uarea_addr),
+ .l2_offset = offsetof(odp_packet_hdr_t, p.l2_offset),
+ .l3_offset = offsetof(odp_packet_hdr_t, p.l3_offset),
+ .l4_offset = offsetof(odp_packet_hdr_t, p.l4_offset),
.flow_hash = offsetof(odp_packet_hdr_t, flow_hash),
.timestamp = offsetof(odp_packet_hdr_t, timestamp),
.input_flags = offsetof(odp_packet_hdr_t, p.input_flags)
@@ -1213,15 +1216,6 @@ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len)
return packet_map(pkt_hdr, pkt_hdr->p.l2_offset, len, NULL);
}
-uint32_t odp_packet_l2_offset(odp_packet_t pkt)
-{
- odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
-
- if (!packet_hdr_has_l2(pkt_hdr))
- return ODP_PACKET_OFFSET_INVALID;
- return pkt_hdr->p.l2_offset;
-}
-
int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset)
{
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
@@ -1241,13 +1235,6 @@ void *odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len)
return packet_map(pkt_hdr, pkt_hdr->p.l3_offset, len, NULL);
}
-uint32_t odp_packet_l3_offset(odp_packet_t pkt)
-{
- odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
-
- return pkt_hdr->p.l3_offset;
-}
-
int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset)
{
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
@@ -1266,13 +1253,6 @@ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len)
return packet_map(pkt_hdr, pkt_hdr->p.l4_offset, len, NULL);
}
-uint32_t odp_packet_l4_offset(odp_packet_t pkt)
-{
- odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
-
- return pkt_hdr->p.l4_offset;
-}
-
int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset)
{
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
@@ -26,6 +26,7 @@
#include <protocols/eth.h>
#include <protocols/ip.h>
#include <odp_traffic_mngr_internal.h>
+#include <odp/api/plat/packet_inlines.h>
/* Local vars */
static const
@@ -1966,7 +1967,7 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking,
uint32_t hdr_len, l3_offset, old_chksum, ones_compl_sum, tos_diff;
uint8_t old_tos, new_tos, ecn;
- l3_offset = odp_packet_l3_offset(odp_pkt);
+ l3_offset = _odp_packet_l3_offset(odp_pkt);
ipv4_hdr_ptr = odp_packet_l3_ptr(odp_pkt, &hdr_len);
/* If the split_hdr variable below is TRUE, then this indicates that
@@ -2032,7 +2033,7 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking,
uint32_t hdr_len, old_ver_tc_flow, new_ver_tc_flow, l3_offset;
uint8_t old_tc, new_tc, ecn;
- l3_offset = odp_packet_l3_offset(odp_pkt);
+ l3_offset = _odp_packet_l3_offset(odp_pkt);
ipv6_hdr_ptr = odp_packet_l3_ptr(odp_pkt, &hdr_len);
/* If the split_hdr variable below is TRUE, then this indicates that