diff options
Diffstat (limited to 'platform/linux-generic/include/odp_packet_internal.h')
-rw-r--r-- | platform/linux-generic/include/odp_packet_internal.h | 64 |
1 files changed, 20 insertions, 44 deletions
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 8c4149125..6f1521ca3 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -36,7 +36,8 @@ typedef union { uint32_t all; struct { - uint32_t unparsed:1; /**< Set to inticate parse needed */ + uint32_t parsed_l2:1; /**< L2 parsed */ + uint32_t parsed_all:1;/**< Parsing complete */ uint32_t l2:1; /**< known L2 protocol present */ uint32_t l3:1; /**< known L3 protocol present */ @@ -137,6 +138,9 @@ typedef struct { odp_pktio_t input; + uint32_t has_hash:1; /**< Flow hash present */ + uint32_t flow_hash; /**< Flow hash value */ + odp_crypto_generic_op_result_t op_result; /**< Result for crypto */ } odp_packet_hdr_t; @@ -152,43 +156,6 @@ static inline odp_packet_hdr_t *odp_packet_hdr(odp_packet_t pkt) return (odp_packet_hdr_t *)odp_buf_to_hdr((odp_buffer_t)pkt); } -/** - * Initialize packet buffer - */ -static inline void packet_init(pool_entry_t *pool, - odp_packet_hdr_t *pkt_hdr, - size_t size) -{ - /* - * Reset parser metadata. Note that we clear via memset to make - * this routine indepenent of any additional adds to packet metadata. - */ - const size_t start_offset = ODP_FIELD_SIZEOF(odp_packet_hdr_t, buf_hdr); - uint8_t *start; - size_t len; - - start = (uint8_t *)pkt_hdr + start_offset; - len = sizeof(odp_packet_hdr_t) - start_offset; - memset(start, 0, len); - - /* Set metadata items that initialize to non-zero values */ - pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID; - pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; - pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; - pkt_hdr->payload_offset = ODP_PACKET_OFFSET_INVALID; - - /* - * Packet headroom is set from the pool's headroom - * Packet tailroom is rounded up to fill the last - * segment occupied by the allocated length. - */ - pkt_hdr->frame_len = size; - pkt_hdr->headroom = pool->s.headroom; - pkt_hdr->tailroom = - (pool->s.seg_size * pkt_hdr->buf_hdr.segcount) - - (pool->s.headroom + size); -} - static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr, odp_packet_hdr_t *dst_hdr) { @@ -250,12 +217,14 @@ static inline void packet_set_len(odp_packet_t pkt, uint32_t len) odp_packet_hdr(pkt)->frame_len = len; } -#define ODP_PACKET_UNPARSED ~0 +static inline int packet_parse_l2_not_done(odp_packet_hdr_t *pkt_hdr) +{ + return !pkt_hdr->input_flags.parsed_l2; +} -static inline void _odp_packet_reset_parse(odp_packet_t pkt) +static inline int packet_parse_not_complete(odp_packet_hdr_t *pkt_hdr) { - odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); - pkt_hdr->input_flags.all = ODP_PACKET_UNPARSED; + return !pkt_hdr->input_flags.parsed_all; } /* Forward declarations */ @@ -265,9 +234,16 @@ int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset, void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt); -odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl); +odp_packet_t packet_alloc(odp_pool_t pool_hdl, uint32_t len, int parse); + +/* Fill in parser metadata for L2 */ +void packet_parse_l2(odp_packet_hdr_t *pkt_hdr); + +/* Perform full packet parse */ +int packet_parse_full(odp_packet_hdr_t *pkt_hdr); -int _odp_packet_parse(odp_packet_hdr_t *pkt_hdr); +/* Reset parser metadata for a new parse */ +void packet_parse_reset(odp_packet_t pkt); /* Convert a packet handle to a buffer handle */ odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt); |