API Reference Manual
1.46.0
|
Packet event metadata and operations.
If user sets multiple conflicting packet metadata flags using odp_packet_has_XX_set() functions, only the last set flag value is guaranteed to hold. The values of other conflicting flags are implementation specific. The conflicting flag combinations are defined in function documentations.
Data Structures | |
struct | odp_packet_parse_result_flag_t |
Parse result flags. More... | |
struct | odp_packet_data_range |
Packet API data range specifier. More... | |
struct | odp_packet_reass_info_t |
Information about a completed reassembly. More... | |
struct | odp_packet_reass_partial_state_t |
Result from odp_packet_reass_partial_state() More... | |
union | odp_proto_chksums_t |
Flags to control packet data checksum checking. More... | |
struct | odp_packet_parse_param_t |
Packet parse parameters. More... | |
struct | odp_packet_parse_result_t |
Packet parse results. More... | |
struct | odp_packet_lso_opt_t |
LSO options. More... | |
struct | odp_packet_tx_compl_opt_t |
Packet transmit completion request options. More... | |
struct | odp_packet_proto_stats_opt_t |
Packet proto stats options. More... | |
Macros | |
#define | ODP_PACKET_INVALID ((odp_packet_t)0) |
Invalid packet. | |
#define | ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0) |
Invalid packet segment. | |
#define | ODP_PACKET_BUF_INVALID ((odp_packet_buf_t)0) |
Invalid packet buffer. | |
#define | ODP_PACKET_OFFSET_INVALID 0xffff |
Invalid packet offset. | |
#define | ODP_PACKET_VECTOR_INVALID ((odp_packet_vector_t)0) |
Invalid packet vector. | |
#define | ODP_PACKET_TX_COMPL_INVALID ((odp_packet_tx_compl_t)0) |
Invalid packet Tx completion. | |
#define | ODP_NUM_PACKET_COLORS 3 |
Maximum number of packet colors which accommodates ODP_PACKET_GREEN, ODP_PACKET_YELLOW and ODP_PACKET_RED. | |
#define | ODP_PROTO_L2_TYPE_NONE 0 |
Layer 2 protocol type not defined. | |
#define | ODP_PROTO_L2_TYPE_ETH 1 |
Layer 2 protocol is Ethernet. | |
#define | ODP_PROTO_L3_TYPE_NONE 0xFFFF |
Layer 3 protocol type not defined. | |
#define | ODP_PROTO_L3_TYPE_ARP 0x0806 |
Layer 3 protocol is ARP. | |
#define | ODP_PROTO_L3_TYPE_RARP 0x8035 |
Layer 3 protocol is RARP. | |
#define | ODP_PROTO_L3_TYPE_MPLS 0x8847 |
Layer 3 protocol is MPLS. | |
#define | ODP_PROTO_L3_TYPE_IPV4 0x0800 |
Layer 3 protocol type is IPv4. | |
#define | ODP_PROTO_L3_TYPE_IPV6 0x86DD |
Layer 3 protocol type is IPv6. | |
#define | ODP_PROTO_L4_TYPE_NONE 255 |
Layer 4 protocol type not defined. | |
#define | ODP_PROTO_L4_TYPE_ICMPV4 1 |
Layer 4 protocol type is ICMPv4. | |
#define | ODP_PROTO_L4_TYPE_IGMP 2 |
Layer 4 protocol type is IGMP. | |
#define | ODP_PROTO_L4_TYPE_IPV4 4 |
Layer 4 protocol type is IPv4. | |
#define | ODP_PROTO_L4_TYPE_TCP 6 |
Layer 4 protocol type is TCP. | |
#define | ODP_PROTO_L4_TYPE_UDP 17 |
Layer 4 protocol type is UDP. | |
#define | ODP_PROTO_L4_TYPE_IPV6 41 |
Layer 4 protocol type is IPv6. | |
#define | ODP_PROTO_L4_TYPE_GRE 47 |
Layer 4 protocol type is GRE. | |
#define | ODP_PROTO_L4_TYPE_ESP 50 |
Layer 4 protocol type is IPSEC ESP. | |
#define | ODP_PROTO_L4_TYPE_AH 51 |
Layer 4 protocol type is IPSEC AH. | |
#define | ODP_PROTO_L4_TYPE_ICMPV6 58 |
Layer 4 protocol type is ICMPv6. | |
#define | ODP_PROTO_L4_TYPE_NO_NEXT 59 |
Layer 4 protocol type is No Next Header for IPv6. | |
#define | ODP_PROTO_L4_TYPE_IPCOMP 108 |
Layer 4 protocol type is IP Payload Compression Protocol. | |
#define | ODP_PROTO_L4_TYPE_SCTP 132 |
Layer 4 protocol type is SCTP. | |
#define | ODP_PROTO_L4_TYPE_ROHC 142 |
Layer 4 protocol type is ROHC. | |
#define | ODP_PACKET_TX_COMPL_ALL ODP_PACKET_TX_COMPL_EVENT |
For backwards compatibility, ODP_PACKET_TX_COMPL_ALL is synonym of ODP_PACKET_TX_COMPL_EVENT. More... | |
Functions | |
odp_event_subtype_t | odp_packet_subtype (odp_packet_t packet) |
Event subtype of a packet. More... | |
odp_packet_t | odp_packet_alloc (odp_pool_t pool, uint32_t len) |
Allocate a packet from a packet pool. More... | |
int | odp_packet_alloc_multi (odp_pool_t pool, uint32_t len, odp_packet_t pkt[], int num) |
Allocate multiple packets from a packet pool. More... | |
void | odp_packet_free (odp_packet_t pkt) |
Free packet. More... | |
void | odp_packet_free_multi (const odp_packet_t pkt[], int num) |
Free multiple packets. More... | |
void | odp_packet_free_sp (const odp_packet_t pkt[], int num) |
Free multiple packets to the same pool. More... | |
int | odp_packet_reset (odp_packet_t pkt, uint32_t len) |
Reset packet. More... | |
uint32_t | odp_packet_reset_max_len (odp_packet_t pkt) |
Maximum packet data reset length. More... | |
void | odp_packet_reset_meta (odp_packet_t pkt) |
Reset packet metadata. More... | |
odp_packet_t | odp_packet_from_event (odp_event_t ev) |
Get packet handle from event. More... | |
void | odp_packet_from_event_multi (odp_packet_t pkt[], const odp_event_t ev[], int num) |
Convert multiple packet events to packet handles. More... | |
odp_event_t | odp_packet_to_event (odp_packet_t pkt) |
Convert packet handle to event. More... | |
void | odp_packet_to_event_multi (const odp_packet_t pkt[], odp_event_t ev[], int num) |
Convert multiple packet handles to events. More... | |
int | odp_packet_reass_info (odp_packet_t pkt, odp_packet_reass_info_t *info) |
Get information about successful reassembly offload that has happened. More... | |
int | odp_packet_reass_partial_state (odp_packet_t pkt, odp_packet_t frags[], odp_packet_reass_partial_state_t *res) |
Get partial reassembly state from a packet. More... | |
void * | odp_packet_head (odp_packet_t pkt) |
Packet head address. More... | |
uint32_t | odp_packet_buf_len (odp_packet_t pkt) |
Total packet buffer length. More... | |
void * | odp_packet_data (odp_packet_t pkt) |
Packet data pointer. More... | |
uint32_t | odp_packet_seg_len (odp_packet_t pkt) |
Packet data length following the data pointer. More... | |
void * | odp_packet_data_seg_len (odp_packet_t pkt, uint32_t *seg_len) |
Packet data pointer with segment length. More... | |
uint32_t | odp_packet_len (odp_packet_t pkt) |
Packet data length. More... | |
uint32_t | odp_packet_headroom (odp_packet_t pkt) |
Packet headroom length. More... | |
uint32_t | odp_packet_tailroom (odp_packet_t pkt) |
Packet tailroom length. More... | |
void * | odp_packet_tail (odp_packet_t pkt) |
Packet tailroom pointer. More... | |
void * | odp_packet_offset (odp_packet_t pkt, uint32_t offset, uint32_t *len, odp_packet_seg_t *seg) |
Packet offset pointer. More... | |
void | odp_packet_prefetch (odp_packet_t pkt, uint32_t offset, uint32_t len) |
Packet data prefetch. More... | |
void * | odp_packet_push_head (odp_packet_t pkt, uint32_t len) |
Push out packet head. More... | |
void * | odp_packet_pull_head (odp_packet_t pkt, uint32_t len) |
Pull in packet head. More... | |
void * | odp_packet_push_tail (odp_packet_t pkt, uint32_t len) |
Push out packet tail. More... | |
void * | odp_packet_pull_tail (odp_packet_t pkt, uint32_t len) |
Pull in packet tail. More... | |
int | odp_packet_extend_head (odp_packet_t *pkt, uint32_t len, void **data_ptr, uint32_t *seg_len) |
Extend packet head. More... | |
int | odp_packet_trunc_head (odp_packet_t *pkt, uint32_t len, void **data_ptr, uint32_t *seg_len) |
Truncate packet head. More... | |
int | odp_packet_extend_tail (odp_packet_t *pkt, uint32_t len, void **data_ptr, uint32_t *seg_len) |
Extend packet tail. More... | |
int | odp_packet_trunc_tail (odp_packet_t *pkt, uint32_t len, void **tail_ptr, uint32_t *tailroom) |
Truncate packet tail. More... | |
int | odp_packet_add_data (odp_packet_t *pkt, uint32_t offset, uint32_t len) |
Add data into an offset. More... | |
int | odp_packet_rem_data (odp_packet_t *pkt, uint32_t offset, uint32_t len) |
Remove data from an offset. More... | |
int | odp_packet_align (odp_packet_t *pkt, uint32_t offset, uint32_t len, uint32_t align) |
Align packet data. More... | |
int | odp_packet_is_segmented (odp_packet_t pkt) |
Tests if packet is segmented. More... | |
int | odp_packet_num_segs (odp_packet_t pkt) |
Number of segments. More... | |
odp_packet_seg_t | odp_packet_first_seg (odp_packet_t pkt) |
First segment in packet. More... | |
odp_packet_seg_t | odp_packet_last_seg (odp_packet_t pkt) |
Last segment in packet. More... | |
odp_packet_seg_t | odp_packet_next_seg (odp_packet_t pkt, odp_packet_seg_t seg) |
Next segment in packet. More... | |
void * | odp_packet_seg_data (odp_packet_t pkt, odp_packet_seg_t seg) |
Segment data pointer. More... | |
uint32_t | odp_packet_seg_data_len (odp_packet_t pkt, odp_packet_seg_t seg) |
Segment data length. More... | |
int | odp_packet_concat (odp_packet_t *dst, odp_packet_t src) |
Concatenate two packets. More... | |
int | odp_packet_split (odp_packet_t *pkt, uint32_t len, odp_packet_t *tail) |
Split packet into two packets. More... | |
void * | odp_packet_buf_head (odp_packet_buf_t pkt_buf) |
Packet buffer head pointer. More... | |
uint32_t | odp_packet_buf_size (odp_packet_buf_t pkt_buf) |
Packet buffer size in bytes. More... | |
uint32_t | odp_packet_buf_data_offset (odp_packet_buf_t pkt_buf) |
Packet buffer data offset. More... | |
uint32_t | odp_packet_buf_data_len (odp_packet_buf_t pkt_buf) |
Packet buffer data length in bytes. More... | |
void | odp_packet_buf_data_set (odp_packet_buf_t pkt_buf, uint32_t data_offset, uint32_t data_len) |
Packet buffer data set. More... | |
odp_packet_buf_t | odp_packet_buf_from_head (odp_pool_t pool, void *head) |
Convert packet buffer head pointer to handle. More... | |
uint32_t | odp_packet_disassemble (odp_packet_t pkt, odp_packet_buf_t pkt_buf[], uint32_t num) |
Disassemble packet into packet buffers. More... | |
odp_packet_t | odp_packet_reassemble (odp_pool_t pool, odp_packet_buf_t pkt_buf[], uint32_t num) |
Reassemble packet from packet buffers. More... | |
odp_packet_t | odp_packet_ref_static (odp_packet_t pkt) |
Create a static reference to a packet. More... | |
odp_packet_t | odp_packet_ref (odp_packet_t pkt, uint32_t offset) |
Create a reference to a packet. More... | |
odp_packet_t | odp_packet_ref_pkt (odp_packet_t pkt, uint32_t offset, odp_packet_t hdr) |
Create a reference to a packet with a header packet. More... | |
int | odp_packet_has_ref (odp_packet_t pkt) |
Test if packet has multiple references. More... | |
odp_packet_t | odp_packet_copy (odp_packet_t pkt, odp_pool_t pool) |
Full copy of a packet. More... | |
odp_packet_t | odp_packet_copy_part (odp_packet_t pkt, uint32_t offset, uint32_t len, odp_pool_t pool) |
Partial copy of a packet. More... | |
int | odp_packet_copy_to_mem (odp_packet_t pkt, uint32_t offset, uint32_t len, void *dst) |
Copy data from packet to memory. More... | |
int | odp_packet_copy_from_mem (odp_packet_t pkt, uint32_t offset, uint32_t len, const void *src) |
Copy data from memory to packet. More... | |
int | odp_packet_copy_from_pkt (odp_packet_t dst, uint32_t dst_offset, odp_packet_t src, uint32_t src_offset, uint32_t len) |
Copy data from another packet. More... | |
int | odp_packet_copy_data (odp_packet_t pkt, uint32_t dst_offset, uint32_t src_offset, uint32_t len) |
Copy data within packet. More... | |
int | odp_packet_move_data (odp_packet_t pkt, uint32_t dst_offset, uint32_t src_offset, uint32_t len) |
Move data within packet. More... | |
int | odp_packet_parse (odp_packet_t pkt, uint32_t offset, const odp_packet_parse_param_t *param) |
Parse packet. More... | |
int | odp_packet_parse_multi (const odp_packet_t pkt[], const uint32_t offset[], int num, const odp_packet_parse_param_t *param) |
Parse multiple packets. More... | |
void | odp_packet_parse_result (odp_packet_t pkt, odp_packet_parse_result_t *result) |
Read parse results. More... | |
void | odp_packet_parse_result_multi (const odp_packet_t pkt[], odp_packet_parse_result_t *result[], int num) |
Read parse results from multiple packets. More... | |
odp_pool_t | odp_packet_pool (odp_packet_t pkt) |
Packet pool. More... | |
odp_pktio_t | odp_packet_input (odp_packet_t pkt) |
Packet input interface. More... | |
void | odp_packet_input_set (odp_packet_t pkt, odp_pktio_t pktio) |
Set packet input interface. More... | |
int | odp_packet_input_index (odp_packet_t pkt) |
Packet input interface index. More... | |
void * | odp_packet_user_ptr (odp_packet_t pkt) |
User context pointer. More... | |
void | odp_packet_user_ptr_set (odp_packet_t pkt, const void *user_ptr) |
Set user context pointer. More... | |
void * | odp_packet_user_area (odp_packet_t pkt) |
User area address. More... | |
uint32_t | odp_packet_user_area_size (odp_packet_t pkt) |
User area size. More... | |
int | odp_packet_user_flag (odp_packet_t pkt) |
Check user flag. More... | |
void | odp_packet_user_flag_set (odp_packet_t pkt, int val) |
Set user flag. More... | |
void * | odp_packet_l2_ptr (odp_packet_t pkt, uint32_t *len) |
Layer 2 start pointer. More... | |
uint32_t | odp_packet_l2_offset (odp_packet_t pkt) |
Layer 2 start offset. More... | |
int | odp_packet_l2_offset_set (odp_packet_t pkt, uint32_t offset) |
Set layer 2 start offset. More... | |
void * | odp_packet_l3_ptr (odp_packet_t pkt, uint32_t *len) |
Layer 3 start pointer. More... | |
uint32_t | odp_packet_l3_offset (odp_packet_t pkt) |
Layer 3 start offset. More... | |
int | odp_packet_l3_offset_set (odp_packet_t pkt, uint32_t offset) |
Set layer 3 start offset. More... | |
void * | odp_packet_l4_ptr (odp_packet_t pkt, uint32_t *len) |
Layer 4 start pointer. More... | |
uint32_t | odp_packet_l4_offset (odp_packet_t pkt) |
Layer 4 start offset. More... | |
int | odp_packet_l4_offset_set (odp_packet_t pkt, uint32_t offset) |
Set layer 4 start offset. More... | |
odp_proto_l2_type_t | odp_packet_l2_type (odp_packet_t pkt) |
Layer 2 protocol type. More... | |
odp_proto_l3_type_t | odp_packet_l3_type (odp_packet_t pkt) |
Layer 3 protocol type. More... | |
odp_proto_l4_type_t | odp_packet_l4_type (odp_packet_t pkt) |
Layer 4 protocol type. More... | |
odp_packet_chksum_status_t | odp_packet_l3_chksum_status (odp_packet_t pkt) |
Layer 3 checksum check status. More... | |
odp_packet_chksum_status_t | odp_packet_l4_chksum_status (odp_packet_t pkt) |
Layer 4 checksum check status. More... | |
void | odp_packet_l3_chksum_insert (odp_packet_t pkt, int insert) |
Layer 3 checksum insertion override. More... | |
void | odp_packet_l4_chksum_insert (odp_packet_t pkt, int insert) |
Layer 4 checksum insertion override. More... | |
uint16_t | odp_packet_ones_comp (odp_packet_t pkt, odp_packet_data_range_t *range) |
Ones' complement sum of packet data. More... | |
uint32_t | odp_packet_flow_hash (odp_packet_t pkt) |
Packet flow hash value. More... | |
void | odp_packet_flow_hash_set (odp_packet_t pkt, uint32_t flow_hash) |
Set packet flow hash value. More... | |
odp_time_t | odp_packet_ts (odp_packet_t pkt) |
Packet timestamp. More... | |
void | odp_packet_ts_set (odp_packet_t pkt, odp_time_t timestamp) |
Set packet timestamp. More... | |
void | odp_packet_ts_request (odp_packet_t pkt, int enable) |
Request Tx timestamp capture. More... | |
odp_packet_color_t | odp_packet_color (odp_packet_t pkt) |
Get packet color. More... | |
void | odp_packet_color_set (odp_packet_t pkt, odp_packet_color_t color) |
Set packet color. More... | |
odp_bool_t | odp_packet_drop_eligible (odp_packet_t pkt) |
Get drop eligible status. More... | |
void | odp_packet_drop_eligible_set (odp_packet_t pkt, odp_bool_t status) |
Set drop eligible status. More... | |
int8_t | odp_packet_shaper_len_adjust (odp_packet_t pkt) |
Get shaper length adjustment. More... | |
void | odp_packet_shaper_len_adjust_set (odp_packet_t pkt, int8_t adj) |
Set shaper length adjustment. More... | |
uint64_t | odp_packet_cls_mark (odp_packet_t pkt) |
Classification mark value. More... | |
int | odp_packet_lso_request (odp_packet_t pkt, const odp_packet_lso_opt_t *lso_opt) |
Request Large Send Offload (LSO) for a packet. More... | |
void | odp_packet_lso_request_clr (odp_packet_t pkt) |
Clear LSO request from a packet. More... | |
int | odp_packet_has_lso_request (odp_packet_t pkt) |
Check if LSO is requested for the packet. More... | |
uint32_t | odp_packet_payload_offset (odp_packet_t pkt) |
Payload data offset. More... | |
int | odp_packet_payload_offset_set (odp_packet_t pkt, uint32_t offset) |
Set payload data start offset. More... | |
void | odp_packet_aging_tmo_set (odp_packet_t pkt, uint64_t tmo_ns) |
Enable or disable Tx packet aging. More... | |
uint64_t | odp_packet_aging_tmo (odp_packet_t pkt) |
Check if packet has Tx aging drop enabled. More... | |
int | odp_packet_tx_compl_request (odp_packet_t pkt, const odp_packet_tx_compl_opt_t *opt) |
Request packet transmit completion. More... | |
int | odp_packet_has_tx_compl_request (odp_packet_t pkt) |
Check if packet transmit completion is requested. More... | |
void | odp_packet_free_ctrl_set (odp_packet_t pkt, odp_packet_free_ctrl_t ctrl) |
Set packet free control option. More... | |
odp_packet_free_ctrl_t | odp_packet_free_ctrl (odp_packet_t pkt) |
Returns packet free control option value. More... | |
void | odp_packet_proto_stats_request (odp_packet_t pkt, odp_packet_proto_stats_opt_t *opt) |
Request packet proto stats. More... | |
odp_proto_stats_t | odp_packet_proto_stats (odp_packet_t pkt) |
Get proto stats object. More... | |
odp_packet_vector_t | odp_packet_vector_from_event (odp_event_t ev) |
Get packet vector handle from event. More... | |
odp_event_t | odp_packet_vector_to_event (odp_packet_vector_t pktv) |
Convert packet vector handle to event. More... | |
odp_packet_vector_t | odp_packet_vector_alloc (odp_pool_t pool) |
Allocate a packet vector from a packet vector pool. More... | |
void | odp_packet_vector_free (odp_packet_vector_t pktv) |
Free packet vector. More... | |
uint32_t | odp_packet_vector_tbl (odp_packet_vector_t pktv, odp_packet_t **pkt_tbl) |
Get packet vector table. More... | |
uint32_t | odp_packet_vector_size (odp_packet_vector_t pktv) |
Number of packets in a vector. More... | |
void | odp_packet_vector_size_set (odp_packet_vector_t pktv, uint32_t size) |
Set the number of packets stored in a vector. More... | |
void * | odp_packet_vector_user_area (odp_packet_vector_t pktv) |
Packet vector user area. More... | |
int | odp_packet_vector_user_flag (odp_packet_vector_t pktv) |
Check user flag. More... | |
void | odp_packet_vector_user_flag_set (odp_packet_vector_t pktv, int val) |
Set user flag. More... | |
int | odp_packet_vector_valid (odp_packet_vector_t pktv) |
Check that packet vector is valid. More... | |
odp_pool_t | odp_packet_vector_pool (odp_packet_vector_t pktv) |
Packet vector pool. More... | |
void | odp_packet_vector_print (odp_packet_vector_t pktv) |
Print packet vector debug information. More... | |
uint64_t | odp_packet_vector_to_u64 (odp_packet_vector_t pktv) |
Get printable value for packet vector handle. More... | |
odp_packet_reass_status_t | odp_packet_reass_status (odp_packet_t pkt) |
Check reassembly status of the packet. More... | |
odp_packet_tx_compl_t | odp_packet_tx_compl_from_event (odp_event_t ev) |
Get packet Tx completion handle from event. More... | |
odp_event_t | odp_packet_tx_compl_to_event (odp_packet_tx_compl_t tx_compl) |
Convert packet Tx completion to event. More... | |
void | odp_packet_tx_compl_free (odp_packet_tx_compl_t tx_compl) |
Free packet Tx completion. More... | |
void * | odp_packet_tx_compl_user_ptr (odp_packet_tx_compl_t tx_compl) |
User context pointer. More... | |
int | odp_packet_tx_compl_done (odp_pktio_t pktio, uint32_t compl_id) |
Check packet transmit completion. More... | |
void | odp_packet_print (odp_packet_t pkt) |
Print packet debug information. More... | |
void | odp_packet_print_data (odp_packet_t pkt, uint32_t offset, uint32_t len) |
Print packet data. More... | |
int | odp_packet_is_valid (odp_packet_t pkt) |
Check that packet is valid. More... | |
uint64_t | odp_packet_to_u64 (odp_packet_t pkt) |
Get printable value for packet handle. More... | |
uint64_t | odp_packet_seg_to_u64 (odp_packet_seg_t seg) |
Get printable value for packet segment handle. More... | |
uint64_t | odp_packet_tx_compl_to_u64 (odp_packet_tx_compl_t tx_compl) |
Get printable value for packet Tx completion handle. More... | |
int | odp_packet_has_error (odp_packet_t pkt) |
Check for all parse errors in packet. More... | |
int | odp_packet_has_l2_error (odp_packet_t pkt) |
Check for errors in layer 2. More... | |
int | odp_packet_has_l3_error (odp_packet_t pkt) |
Check for errors in layer 3. More... | |
int | odp_packet_has_l4_error (odp_packet_t pkt) |
Check for errors in layer 4. More... | |
int | odp_packet_has_l2 (odp_packet_t pkt) |
Check for layer 2 protocols. More... | |
int | odp_packet_has_l3 (odp_packet_t pkt) |
Check for layer 3 protocols. More... | |
int | odp_packet_has_l4 (odp_packet_t pkt) |
Check for layer 4 protocols. More... | |
int | odp_packet_has_eth (odp_packet_t pkt) |
Check for Ethernet header. More... | |
int | odp_packet_has_eth_bcast (odp_packet_t pkt) |
Check for Ethernet broadcast address. More... | |
int | odp_packet_has_eth_mcast (odp_packet_t pkt) |
Check for Ethernet multicast address. More... | |
int | odp_packet_has_jumbo (odp_packet_t pkt) |
Check for jumbo frame. More... | |
int | odp_packet_has_vlan (odp_packet_t pkt) |
Check for VLAN. More... | |
int | odp_packet_has_vlan_qinq (odp_packet_t pkt) |
Check for VLAN QinQ (stacked VLAN) More... | |
int | odp_packet_has_arp (odp_packet_t pkt) |
Check for ARP. More... | |
int | odp_packet_has_ipv4 (odp_packet_t pkt) |
Check for IPv4. More... | |
int | odp_packet_has_ipv6 (odp_packet_t pkt) |
Check for IPv6. More... | |
int | odp_packet_has_ip_bcast (odp_packet_t pkt) |
Check for IP broadcast address. More... | |
int | odp_packet_has_ip_mcast (odp_packet_t pkt) |
Check for IP multicast address. More... | |
int | odp_packet_has_ipfrag (odp_packet_t pkt) |
Check for IP fragment. More... | |
int | odp_packet_has_ipopt (odp_packet_t pkt) |
Check for IP options. More... | |
int | odp_packet_has_ipsec (odp_packet_t pkt) |
Check for IPSec. More... | |
int | odp_packet_has_udp (odp_packet_t pkt) |
Check for UDP. More... | |
int | odp_packet_has_tcp (odp_packet_t pkt) |
Check for TCP. More... | |
int | odp_packet_has_sctp (odp_packet_t pkt) |
Check for SCTP. More... | |
int | odp_packet_has_icmp (odp_packet_t pkt) |
Check for ICMP. More... | |
int | odp_packet_has_flow_hash (odp_packet_t pkt) |
Check for packet flow hash. More... | |
int | odp_packet_has_ts (odp_packet_t pkt) |
Check for packet timestamp. More... | |
void | odp_packet_has_l2_set (odp_packet_t pkt, int val) |
Set flag for L2 header, e.g. More... | |
void | odp_packet_has_l3_set (odp_packet_t pkt, int val) |
Set flag for L3 header, e.g. More... | |
void | odp_packet_has_l4_set (odp_packet_t pkt, int val) |
Set flag for L4 header, e.g. More... | |
void | odp_packet_has_eth_set (odp_packet_t pkt, int val) |
Set flag for Ethernet header. More... | |
void | odp_packet_has_eth_bcast_set (odp_packet_t pkt, int val) |
Set flag for Ethernet broadcast address. More... | |
void | odp_packet_has_eth_mcast_set (odp_packet_t pkt, int val) |
Set flag for Ethernet multicast address. More... | |
void | odp_packet_has_jumbo_set (odp_packet_t pkt, int val) |
Set flag for jumbo frame. More... | |
void | odp_packet_has_vlan_set (odp_packet_t pkt, int val) |
Set flag for VLAN. More... | |
void | odp_packet_has_vlan_qinq_set (odp_packet_t pkt, int val) |
Set flag for VLAN QinQ (stacked VLAN) More... | |
void | odp_packet_has_arp_set (odp_packet_t pkt, int val) |
Set flag for ARP. More... | |
void | odp_packet_has_ipv4_set (odp_packet_t pkt, int val) |
Set flag for IPv4. More... | |
void | odp_packet_has_ipv6_set (odp_packet_t pkt, int val) |
Set flag for IPv6. More... | |
void | odp_packet_has_ip_bcast_set (odp_packet_t pkt, int val) |
Set flag for IP broadcast address. More... | |
void | odp_packet_has_ip_mcast_set (odp_packet_t pkt, int val) |
Set flag for IP multicast address. More... | |
void | odp_packet_has_ipfrag_set (odp_packet_t pkt, int val) |
Set flag for IP fragment. More... | |
void | odp_packet_has_ipopt_set (odp_packet_t pkt, int val) |
Set flag for IP options. More... | |
void | odp_packet_has_ipsec_set (odp_packet_t pkt, int val) |
Set flag for IPSec. More... | |
void | odp_packet_has_udp_set (odp_packet_t pkt, int val) |
Set flag for UDP. More... | |
void | odp_packet_has_tcp_set (odp_packet_t pkt, int val) |
Set flag for TCP. More... | |
void | odp_packet_has_sctp_set (odp_packet_t pkt, int val) |
Set flag for SCTP. More... | |
void | odp_packet_has_icmp_set (odp_packet_t pkt, int val) |
Set flag for ICMP. More... | |
void | odp_packet_has_flow_hash_clr (odp_packet_t pkt) |
Clear flag for packet flow hash. More... | |
void | odp_packet_has_ts_clr (odp_packet_t pkt) |
Clear flag for packet timestamp. More... | |
#define ODP_PACKET_TX_COMPL_ALL ODP_PACKET_TX_COMPL_EVENT |
For backwards compatibility, ODP_PACKET_TX_COMPL_ALL is synonym of ODP_PACKET_TX_COMPL_EVENT.
Definition at line 449 of file api/spec/packet_types.h.
ODP packet segment.
A packet segment refers to a contiguous part of packet data (in memory). Segments of a packet can be examined with odp_packet_seg_data(), odp_packet_seg_data_len() and other calls.
Definition at line 35 of file api/abi-default/packet_types.h.
ODP packet buffer.
Packet buffers are not part of any packet, but they result from a previous odp_packet_disassemble() call. A new packet is formed from packet buffers with a odp_packet_reassemble() call.
Definition at line 36 of file api/abi-default/packet_types.h.
enum odp_packet_color_t |
Packet Color.
Color of packet for shaper/drop processing.
Enumerator | |
---|---|
ODP_PACKET_GREEN | Packet is green. |
ODP_PACKET_YELLOW | Packet is yellow. |
ODP_PACKET_RED | Packet is red. |
Definition at line 48 of file api/abi-default/packet_types.h.
Packet Checksum Status.
Checksum check status in packet.
Definition at line 56 of file api/abi-default/packet_types.h.
enum odp_proto_t |
Protocol.
Enumerator | |
---|---|
ODP_PROTO_NONE | No protocol defined. |
ODP_PROTO_ETH | Ethernet (including VLAN) |
ODP_PROTO_IPV4 | IP version 4. |
ODP_PROTO_IPV6 | IP version 6. |
Definition at line 216 of file api/spec/packet_types.h.
enum odp_proto_layer_t |
Protocol layer.
Definition at line 234 of file api/spec/packet_types.h.
Reassembly status of a packet.
Enumerator | |
---|---|
ODP_PACKET_REASS_NONE | Reassembly was not attempted. |
ODP_PACKET_REASS_INCOMPLETE | Reassembly was attempted but is incomplete. Partial reassembly result can be accessed using The packet does not contain valid packet data and cannot be used in normal packet operations. |
ODP_PACKET_REASS_COMPLETE | Reassembly was successfully done. The packet has been reassembled from multiple received fragments. |
Definition at line 267 of file api/spec/packet_types.h.
Packet transmit completion mode.
Definition at line 423 of file api/spec/packet_types.h.
Packet free control option.
Enumerator | |
---|---|
ODP_PACKET_FREE_CTRL_DISABLED | Packet free control disabled. |
ODP_PACKET_FREE_CTRL_DONT_FREE | Don't free packet after processing it. |
Definition at line 494 of file api/spec/packet_types.h.
odp_event_subtype_t odp_packet_subtype | ( | odp_packet_t | packet | ) |
Event subtype of a packet.
Returns the subtype of a packet event. Subtype tells if the packet contains only basic metadata (ODP_EVENT_PACKET_BASIC) or in addition to that some specific metadata (e.g. ODP_EVENT_PACKET_CRYPTO or ODP_EVENT_PACKET_IPSEC).
packet | Packet handle |
odp_packet_t odp_packet_alloc | ( | odp_pool_t | pool, |
uint32_t | len | ||
) |
Allocate a packet from a packet pool.
Allocates a packet of the requested length from the specified packet pool. The pool must have been created with ODP_POOL_PACKET type. The packet is initialized with data pointers and lengths set according to the specified len, and the default headroom and tailroom length settings. All other packet metadata are set to their default values. Packet length must be greater than zero and not exceed packet pool parameter 'max_len' value.
pool | Pool handle |
len | Packet data length (1 ... pool max_len) |
ODP_PACKET_INVALID | Packet could not be allocated |
int odp_packet_alloc_multi | ( | odp_pool_t | pool, |
uint32_t | len, | ||
odp_packet_t | pkt[], | ||
int | num | ||
) |
Allocate multiple packets from a packet pool.
Otherwise like odp_packet_alloc(), but allocates multiple packets from a pool.
pool | Pool handle | |
len | Packet data length (1 ... pool max_len) | |
[out] | pkt | Array of packet handles for output |
num | Maximum number of packets to allocate |
<0 | on failure |
void odp_packet_free | ( | odp_packet_t | pkt | ) |
Free packet.
Frees the packet into the packet pool it was allocated from.
pkt | Packet handle |
void odp_packet_free_multi | ( | const odp_packet_t | pkt[], |
int | num | ||
) |
Free multiple packets.
Otherwise like odp_packet_free(), but frees multiple packets to their originating pools.
pkt | Array of packet handles |
num | Number of packet handles to free |
void odp_packet_free_sp | ( | const odp_packet_t | pkt[], |
int | num | ||
) |
Free multiple packets to the same pool.
Otherwise like odp_packet_free_multi(), but all packets must be from the same originating pool.
pkt | Array of packet handles |
num | Number of packets to free |
int odp_packet_reset | ( | odp_packet_t | pkt, |
uint32_t | len | ||
) |
Reset packet.
Resets all packet metadata and adjusts packet data to start according to pool parameters (align, seg_len, headroom). Packet data length is set to 'len'. Maximum value for 'len' can be queried with odp_packet_reset_max_len() function. Passing larger 'len' than the maximum value is allowed, but will cause failure to be returned.
Packet reset maintains the original user area content. The operation may change data layout in packet segments and free possible extra segments. Data content may not be preserved. Packet is not modified on failure.
This function must not be called for packets with references or incomplete reassembly status (ODP_PACKET_REASS_INCOMPLETE).
pkt | Packet handle |
len | Packet data length (1 ... odp_packet_reset_max_len()) |
0 | on success |
<0 | on failure |
uint32_t odp_packet_reset_max_len | ( | odp_packet_t | pkt | ) |
Maximum packet data reset length.
Returns the maximum packet data reset length for odp_packet_reset() based on current packet buffer space and pool parameters (align, seg_len, headroom). Note that the returned length may be less than the current packet data length if data length has been increased by utilizing head- or tailroom.
pkt | Packet handle |
void odp_packet_reset_meta | ( | odp_packet_t | pkt | ) |
Reset packet metadata.
Resets all packet metadata to their default values, except the ones listed below which are not modified:
This function must not be called for packets with static references or incomplete reassembly status (ODP_PACKET_REASS_INCOMPLETE).
pkt | Packet handle |
odp_packet_t odp_packet_from_event | ( | odp_event_t | ev | ) |
Get packet handle from event.
Converts an ODP_EVENT_PACKET type event to a packet.
ev | Event handle |
void odp_packet_from_event_multi | ( | odp_packet_t | pkt[], |
const odp_event_t | ev[], | ||
int | num | ||
) |
Convert multiple packet events to packet handles.
All events must be of type ODP_EVENT_PACKET.
[out] | pkt | Packet handle array for output |
ev | Array of event handles to convert | |
num | Number of packets and events |
odp_event_t odp_packet_to_event | ( | odp_packet_t | pkt | ) |
Convert packet handle to event.
pkt | Packet handle |
void odp_packet_to_event_multi | ( | const odp_packet_t | pkt[], |
odp_event_t | ev[], | ||
int | num | ||
) |
Convert multiple packet handles to events.
pkt | Array of packet handles to convert | |
[out] | ev | Event handle array for output |
num | Number of packets and events |
int odp_packet_reass_info | ( | odp_packet_t | pkt, |
odp_packet_reass_info_t * | info | ||
) |
Get information about successful reassembly offload that has happened.
This function may be called only if the reassembly status of a packet is ODP_PACKET_REASS_COMPLETE.
pkt | Completely reassembled packet. | |
[out] | info | Pointer to the info structure to be filled |
0 | on success |
<0 | on failure |
int odp_packet_reass_partial_state | ( | odp_packet_t | pkt, |
odp_packet_t | frags[], | ||
odp_packet_reass_partial_state_t * | res | ||
) |
Get partial reassembly state from a packet.
In case of incomplete reassembly, a packet carries information on the time already used for the reassembly attempt and one or more fragments. The fragments are not necessarily the original received fragments but may be partially reassembled parts of the packet.
This function may be called only if the reassembly status of a packet is ODP_PACKET_REASS_INCOMPLETE.
pkt | Incompletely reassembled packet. The packet will be consumed if the function succeeds. | |
[out] | frags | Packet handle array for output. The size of this array must be at least odp_reass_config_t::max_num_frags . |
[out] | res | Pointer to result structure |
0 | on success |
<0 | on failure |
void* odp_packet_head | ( | odp_packet_t | pkt | ) |
Packet head address.
Returns start address of the first segment. Packet level headroom starts from here. Use odp_packet_data() or odp_packet_l2_ptr() to return the packet data start address.
pkt | Packet handle |
uint32_t odp_packet_buf_len | ( | odp_packet_t | pkt | ) |
Total packet buffer length.
Returns sum of buffer lengths over all packet segments. Buffer length includes headroom, data, and tailroom lengths.
pkt | Packet handle |
void* odp_packet_data | ( | odp_packet_t | pkt | ) |
Packet data pointer.
Returns pointer to the first byte of packet data. When packet is segmented, only a portion of packet data follows the pointer. When unsure, use e.g. odp_packet_seg_len() to check the data length following the pointer. Packet level offsets are calculated relative to this position.
When a packet is received from packet input, this points to the first byte of the received packet. Pool configuration parameters may be used to ensure that the first packet segment contains all/most of the data relevant to the application.
User can adjust the data pointer with e.g. push_head/pull_head (does not modify segmentation) and extend_head/trunc_head (may modify segmentation) calls.
pkt | Packet handle |
uint32_t odp_packet_seg_len | ( | odp_packet_t | pkt | ) |
Packet data length following the data pointer.
Returns number of data bytes (in the segment) following the current data pointer position. When unsure, use this function to check how many bytes can be accessed linearly after data pointer (odp_packet_data()). This equals to odp_packet_len() for single segment packets.
pkt | Packet handle |
void* odp_packet_data_seg_len | ( | odp_packet_t | pkt, |
uint32_t * | seg_len | ||
) |
Packet data pointer with segment length.
Returns both data pointer and number of data bytes (in the segment) following it. This is equivalent to calling odp_packet_data() and odp_packet_seg_len().
pkt | Packet handle | |
[out] | seg_len | Pointer to output segment length |
uint32_t odp_packet_len | ( | odp_packet_t | pkt | ) |
Packet data length.
Returns total data length over all packet segments. This equals the sum of segment level data lengths (odp_packet_seg_data_len()).
pkt | Packet handle |
uint32_t odp_packet_headroom | ( | odp_packet_t | pkt | ) |
Packet headroom length.
Returns the current packet level headroom length.
pkt | Packet handle |
uint32_t odp_packet_tailroom | ( | odp_packet_t | pkt | ) |
Packet tailroom length.
Returns the current packet level tailroom length.
pkt | Packet handle |
void* odp_packet_tail | ( | odp_packet_t | pkt | ) |
Packet tailroom pointer.
Returns pointer to the start of the current packet level tailroom.
User can adjust the tail pointer with tail_push/tail_pull (does not modify segmentation) and add_data/rem_data calls (may modify segmentation).
pkt | Packet handle |
void* odp_packet_offset | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
uint32_t * | len, | ||
odp_packet_seg_t * | seg | ||
) |
Packet offset pointer.
Returns pointer to data in the packet offset. The packet level byte offset is calculated from the current odp_packet_data() position. Optionally outputs handle to the segment and number of data bytes in the segment following the pointer.
pkt | Packet handle | |
offset | Byte offset into the packet | |
[out] | len | Number of data bytes remaining in the segment (output). Ignored when NULL. |
[out] | seg | Handle to the segment containing the address (output). Ignored when NULL. |
NULL | Requested offset exceeds packet length |
void odp_packet_prefetch | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
uint32_t | len | ||
) |
Packet data prefetch.
Prefetch 'len' bytes of packet data starting from 'offset' into various caches close to the calling thread.
pkt | Packet handle |
offset | Byte offset into packet data |
len | Number of bytes to prefetch starting from 'offset' |
void* odp_packet_push_head | ( | odp_packet_t | pkt, |
uint32_t | len | ||
) |
Push out packet head.
Increase packet data length by moving packet head into packet headroom. Packet headroom is decreased with the same amount. The packet head may be pushed out up to 'headroom' bytes. Packet is not modified if there's not enough headroom space.
odp_packet_xxx: seg_len += len len += len headroom -= len data -= len
Operation does not modify packet segmentation or move data. Handles and pointers remain valid. User is responsible to update packet metadata offsets when needed.
pkt | Packet handle |
len | Number of bytes to push the head (0 ... headroom) |
NULL | Requested offset exceeds available headroom |
void* odp_packet_pull_head | ( | odp_packet_t | pkt, |
uint32_t | len | ||
) |
Pull in packet head.
Decrease packet data length by removing data from the head of the packet. Packet headroom is increased with the same amount. Packet head may be pulled in up to seg_len - 1 bytes (i.e. packet data pointer must stay in the first segment). Packet is not modified if there's not enough data.
odp_packet_xxx: seg_len -= len len -= len headroom += len data += len
Operation does not modify packet segmentation or move data. Handles and pointers remain valid. User is responsible to update packet metadata offsets when needed.
pkt | Packet handle |
len | Number of bytes to pull the head (0 ... seg_len - 1) |
NULL | Requested offset exceeds packet segment length |
void* odp_packet_push_tail | ( | odp_packet_t | pkt, |
uint32_t | len | ||
) |
Push out packet tail.
Increase packet data length by moving packet tail into packet tailroom. Packet tailroom is decreased with the same amount. The packet tail may be pushed out up to 'tailroom' bytes. Packet is not modified if there's not enough tailroom.
last_seg: data_len += len
odp_packet_xxx: len += len tail += len tailroom -= len
Operation does not modify packet segmentation or move data. Handles, pointers and offsets remain valid.
pkt | Packet handle |
len | Number of bytes to push the tail (0 ... tailroom) |
NULL | Requested offset exceeds available tailroom |
void* odp_packet_pull_tail | ( | odp_packet_t | pkt, |
uint32_t | len | ||
) |
Pull in packet tail.
Decrease packet data length by removing data from the tail of the packet. Packet tailroom is increased with the same amount. Packet tail may be pulled in up to last segment data_len - 1 bytes. (i.e. packet tail must stay in the last segment). Packet is not modified if there's not enough data.
last_seg: data_len -= len
odp_packet_xxx: len -= len tail -= len tailroom += len
Operation does not modify packet segmentation or move data. Handles and pointers remain valid. User is responsible to update packet metadata offsets when needed.
pkt | Packet handle |
len | Number of bytes to pull the tail (0 ... last_seg:data_len - 1) |
NULL | The specified offset exceeds allowable data length |
int odp_packet_extend_head | ( | odp_packet_t * | pkt, |
uint32_t | len, | ||
void ** | data_ptr, | ||
uint32_t * | seg_len | ||
) |
Extend packet head.
Increase packet data length at packet head. Functionality is analogous to odp_packet_push_head() when data length is extended up to headroom size. When data length is increased more than that, new segments are added into the packet head and old segment handles become invalid.
A successful operation overwrites the packet handle with a new handle, which application must use as the reference to the packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
User is responsible to update packet metadata offsets when needed. Packet is not modified if operation fails.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs the new packet handle. |
len | Number of bytes to extend the head | |
[out] | data_ptr | Pointer to output the new data pointer. Ignored when NULL. |
[out] | seg_len | Pointer to output segment length at 'data_ptr' above. Ignored when NULL. |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed (e.g. due to an allocation failure) |
int odp_packet_trunc_head | ( | odp_packet_t * | pkt, |
uint32_t | len, | ||
void ** | data_ptr, | ||
uint32_t * | seg_len | ||
) |
Truncate packet head.
Decrease packet data length at packet head. Functionality is analogous to odp_packet_pull_head() when data length is truncated less than the first segment data length. When data length is decreased more than that, some head segments are removed from the packet and old segment handles become invalid.
A successful operation overwrites the packet handle with a new handle, which application must use as the reference to the packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
User is responsible to update packet metadata offsets when needed. Packet is not modified if operation fails.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs the new packet handle. |
len | Number of bytes to truncate the head (0 ... packet_len - 1) | |
[out] | data_ptr | Pointer to output the new data pointer. Ignored when NULL. |
[out] | seg_len | Pointer to output segment length at 'data_ptr' above. Ignored when NULL. |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed |
int odp_packet_extend_tail | ( | odp_packet_t * | pkt, |
uint32_t | len, | ||
void ** | data_ptr, | ||
uint32_t * | seg_len | ||
) |
Extend packet tail.
Increase packet data length at packet tail. Functionality is analogous to odp_packet_push_tail() when data length is extended up to tailroom size. When data length is increased more than that, new segments are added into the packet tail and old segment handles become invalid.
A successful operation overwrites the packet handle with a new handle, which application must use as the reference to the packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
User is responsible to update packet metadata offsets when needed. Packet is not modified if operation fails.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs the new packet handle. |
len | Number of bytes to extend the tail | |
[out] | data_ptr | Pointer to output pointer to the last 'len' bytes of the resulting packet (the previous tail). Ignored when NULL. |
[out] | seg_len | Pointer to output segment length at 'data_ptr' above. Ignored when NULL. |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed (e.g. due to an allocation failure) |
int odp_packet_trunc_tail | ( | odp_packet_t * | pkt, |
uint32_t | len, | ||
void ** | tail_ptr, | ||
uint32_t * | tailroom | ||
) |
Truncate packet tail.
Decrease packet data length at packet tail. Functionality is analogous to odp_packet_pull_tail() when data length is truncated less the last segment data length. When data length is decreased more than that, some tail segments are removed from the packet and old segment handles become invalid.
A successful operation overwrites the packet handle with a new handle, which application must use as the reference to the packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
User is responsible to update packet metadata offsets when needed. Packet is not modified if operation fails.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs the new packet handle. |
len | Number of bytes to truncate the tail (0 ... packet_len - 1) | |
[out] | tail_ptr | Pointer to output the new tail pointer. Ignored when NULL. |
[out] | tailroom | Pointer to output the new tailroom. Ignored when NULL. |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed |
int odp_packet_add_data | ( | odp_packet_t * | pkt, |
uint32_t | offset, | ||
uint32_t | len | ||
) |
Add data into an offset.
Increase packet data length by adding new data area into the specified offset. The operation may modify packet segmentation and move data.
A successful operation overwrites the packet handle with a new handle, which application must use as the reference to the packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
User is responsible to update packet metadata offsets when needed. Packet is not modified if operation fails.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs the new packet handle. |
offset | Byte offset into the packet | |
len | Number of bytes to add into the offset |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed |
int odp_packet_rem_data | ( | odp_packet_t * | pkt, |
uint32_t | offset, | ||
uint32_t | len | ||
) |
Remove data from an offset.
Decrease packet data length by removing data area from the specified offset. The operation may modify packet segmentation and move data.
A successful operation overwrites the packet handle with a new handle, which application must use as the reference to the packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
User is responsible to update packet metadata offsets when needed. Packet is not modified if operation fails.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs the new packet handle. |
offset | Byte offset into the packet | |
len | Number of bytes to remove from the offset. When offset is zero: 0 ... packet_len - 1 bytes, otherwise 0 ... packet_len - offset bytes. |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed |
int odp_packet_align | ( | odp_packet_t * | pkt, |
uint32_t | offset, | ||
uint32_t | len, | ||
uint32_t | align | ||
) |
Align packet data.
Modify packet data alignment so that 'len' bytes between 'offset' and 'offset' plus 'len' are contiguous in memory and have a minimum alignment of 'align' bytes.
A successful operation overwrites the packet handle with a new handle, which the application must use as the reference to the packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data outside of the requested area or metadata (e.g. user_area) were moved in memory during the operation. If some other memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, old pointers remain valid.
Packet is not modified if operation fails.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs the new packet handle. |
offset | Byte offset of the contiguous area | |
len | Byte length of the contiguous area (0 ... packet_len) | |
align | Minimum byte alignment of the contiguous area. Valid values are powers of 2. Use 0 to indicate no special alignment requirement. All implementations support alignments of up to at least 32 bytes. Request will fail if requested alignment exceeds implementation limits. |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed |
int odp_packet_is_segmented | ( | odp_packet_t | pkt | ) |
Tests if packet is segmented.
pkt | Packet handle |
0 | Packet is not segmented |
1 | Packet is segmented |
int odp_packet_num_segs | ( | odp_packet_t | pkt | ) |
Number of segments.
Returns number of segments in the packet. A packet has always at least one segment.
pkt | Packet handle |
odp_packet_seg_t odp_packet_first_seg | ( | odp_packet_t | pkt | ) |
First segment in packet.
A packet has always the first segment (has at least one segment).
pkt | Packet handle |
odp_packet_seg_t odp_packet_last_seg | ( | odp_packet_t | pkt | ) |
Last segment in packet.
A packet has always the last segment (has at least one segment).
pkt | Packet handle |
odp_packet_seg_t odp_packet_next_seg | ( | odp_packet_t | pkt, |
odp_packet_seg_t | seg | ||
) |
Next segment in packet.
Returns handle to the next segment after the current segment, or ODP_PACKET_SEG_INVALID if there are no more segments. Use odp_packet_first_seg() to get handle to the first segment.
pkt | Packet handle |
seg | Current segment handle |
ODP_PACKET_SEG_INVALID | if there are no more segments |
void* odp_packet_seg_data | ( | odp_packet_t | pkt, |
odp_packet_seg_t | seg | ||
) |
Segment data pointer.
Returns pointer to the first byte of data in the segment.
pkt | Packet handle |
seg | Segment handle |
NULL | on failure |
uint32_t odp_packet_seg_data_len | ( | odp_packet_t | pkt, |
odp_packet_seg_t | seg | ||
) |
Segment data length.
Returns segment data length in bytes.
pkt | Packet handle |
seg | Segment handle |
int odp_packet_concat | ( | odp_packet_t * | dst, |
odp_packet_t | src | ||
) |
Concatenate two packets.
Concatenate all packet data from 'src' packet into tail of 'dst' packet. Operation preserves 'dst' packet metadata in the resulting packet, while 'src' packet handle, metadata and old segment handles for both packets become invalid. Source and destination packet handles must not refer to the same packet.
A successful operation overwrites 'dst' packet handle with a new handle, which application must use as the reference to the resulting packet instead of the old handle. Depending on the implementation, the old and new handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
The resulting packet is always allocated from the same pool as the destination packet. The source packet may have been allocated from any pool.
On failure, both handles remain valid and packets are not modified.
[in,out] | dst | Pointer to destination packet handle. A successful operation outputs the new packet handle. |
src | Source packet handle |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed |
int odp_packet_split | ( | odp_packet_t * | pkt, |
uint32_t | len, | ||
odp_packet_t * | tail | ||
) |
Split packet into two packets.
Split the packet after 'len' bytes. The first 'len' bytes of data and metadata remain in the head packet. A successful operation outputs a handle for the tail packet and overwrites 'pkt' packet handle with a new handle, which application must use as the reference to the resulting head packet. Depending on the implementation, the old and new 'pkt' handles may be equal.
The operation return value indicates if any packet data or metadata (e.g. user_area) were moved in memory during the operation. If some memory areas were moved, application must use new packet/segment handles to update data pointers. Otherwise, all old pointers remain valid.
The tail packet holds the rest of the data (odp_packet_len() - 'len' bytes). The packet is allocated from the same pool as the original packet and metadata is initialized with default values.
For performance reasons (zero copy), the head packet may have zero tailroom and the tail packet may have zero headroom length after the operation. Both packets may be extended normally.
The original packet is not modified on failure.
[in,out] | pkt | Pointer to packet handle. A successful operation outputs a new packet handle for the head packet. |
len | Data length remaining in the head packet (1 ... packet_len - 1) | |
tail | Pointer to output the tail packet handle |
0 | Operation successful, old pointers remain valid |
>0 | Operation successful, old pointers need to be updated |
<0 | Operation failed |
void* odp_packet_buf_head | ( | odp_packet_buf_t | pkt_buf | ) |
Packet buffer head pointer.
Packet buffer start address. Buffer level headroom starts from here. For the first packet buffer of a packet this is equivalent to odp_packet_head().
pkt_buf | Packet buffer |
uint32_t odp_packet_buf_size | ( | odp_packet_buf_t | pkt_buf | ) |
Packet buffer size in bytes.
Packet buffer size is calculated from the buffer head pointer (see odp_packet_buf_head()). It contains all buffer level headroom, data, and tailroom. For a single segmented packet this is equivalent to odp_packet_buf_len().
pkt_buf | Packet buffer |
uint32_t odp_packet_buf_data_offset | ( | odp_packet_buf_t | pkt_buf | ) |
Packet buffer data offset.
Offset from the buffer head pointer to the first byte of packet data in the packet buffer. Valid values range from 0 to buf_size - 1. For the first packet buffer of a packet this is equivalent to odp_packet_headroom().
pkt_buf | Packet buffer |
uint32_t odp_packet_buf_data_len | ( | odp_packet_buf_t | pkt_buf | ) |
Packet buffer data length in bytes.
Packet buffer contains this many bytes of packet data. Valid values range from 1 to buf_size - data_offset. For the first packet buffer of a packet this is equivalent to odp_packet_seg_len().
pkt_buf | Packet buffer |
void odp_packet_buf_data_set | ( | odp_packet_buf_t | pkt_buf, |
uint32_t | data_offset, | ||
uint32_t | data_len | ||
) |
Packet buffer data set.
Update packet data start offset and length in the packet buffer. Valid offset values range from 0 to buf_size - 1. Valid length values range from 1 to buf_size - data_offset.
pkt_buf | Packet buffer |
data_offset | Packet buffer data offset in bytes (from the buffer head pointer) |
data_len | Packet buffer data length in bytes |
odp_packet_buf_t odp_packet_buf_from_head | ( | odp_pool_t | pool, |
void * | head | ||
) |
Convert packet buffer head pointer to handle.
Converts a packet buffer head pointer (from a previous odp_packet_buf_head() call) to a packet buffer handle. This allows an application to save memory as it can store only buffer pointers (instead of pointers and handles) and convert those to handles when needed. This conversion may be done only for packet buffers that are not part of any packet (i.e. buffers between odp_packet_disassemble() and odp_packet_reassemble() calls).
This call can be used only for packets of an external memory pool (see odp_pool_ext_create()).
pool | Pool from which the packet buffer (disassembled packet) originate from |
head | Head pointer |
ODP_PACKET_BUF_INVALID | on failure |
uint32_t odp_packet_disassemble | ( | odp_packet_t | pkt, |
odp_packet_buf_t | pkt_buf[], | ||
uint32_t | num | ||
) |
Disassemble packet into packet buffers.
Breaks up a packet into a list of packet buffers. Outputs a packet buffer handle for each segment of the packet (see odp_packet_num_segs()). After a successful operation the packet handle must not be referenced anymore. Packet buffers are reassembled into a new packet (or several new packets) with a later odp_packet_reassemble() call(s). All packet buffers must be reassembled into a packet and freed into the originating pool before the pool is destroyed.
This call can be used only for packets of an external memory pool (see odp_pool_ext_create()).
pkt | Packet to be disassembled | |
[out] | pkt_buf | Packet buffer handle array for output |
num | Number of elements in packet buffer handle array. Must be equal to or larger than number of segments in the packet. |
0 | on failure |
odp_packet_t odp_packet_reassemble | ( | odp_pool_t | pool, |
odp_packet_buf_t | pkt_buf[], | ||
uint32_t | num | ||
) |
Reassemble packet from packet buffers.
Forms a new packet from packet buffers of a previous odp_packet_disassemble() call(s). Packet buffers from different disassembled packets may be used, but all buffers must be from packets of the same pool. Packet pool capability 'max_segs_per_pkt' defines the maximum number of packet buffers that can be reassembled to form a new packet.
Application may use odp_packet_buf_data_set() to adjust data_offset and data_len values in each packet buffer to match the current packet data placement. The operation maintains packet data content and position. Each buffer becomes a segment in the new packet. Packet metadata related to data length and position are set according data layout in the buffers. All other packet metadata are set to their default values. After a successful operation packet buffer handles must not be referenced anymore.
This call can be used only for packets of an external memory pool (see odp_pool_ext_create()).
pool | Pool from which all packet buffers (disassembled packets) originate from |
pkt_buf | Packet buffers to form a new packet |
num | Number of packet buffers. Must not exceed max_segs_per_pkt pool capability. |
ODP_PACKET_INVALID | on failure |
odp_packet_t odp_packet_ref_static | ( | odp_packet_t | pkt | ) |
Create a static reference to a packet.
A static reference is used to obtain an additional handle for referring to the entire packet as it is. As long as a packet has multiple (static) references, any of the references (including 'pkt') must not be used to modify the packet in any way - both data and metadata must remain static. The packet may be modified again when there is a single reference left. Static and dynamic references must not be mixed. Results are undefined if these restrictions are not observed.
While static references are inflexible they offer efficient way to do, e.g., packet retransmissions. Use odp_packet_ref() or odp_packet_ref_pkt() for more flexible, dynamic references.
Packet is not modified on failure.
pkt | Handle of the packet for which a static reference is to be created. |
ODP_PACKET_INVALID | On failure |
odp_packet_t odp_packet_ref | ( | odp_packet_t | pkt, |
uint32_t | offset | ||
) |
Create a reference to a packet.
Returns a new (dynamic) reference to a packet starting the shared part of the data at a specified byte offset. Metadata and data before the offset are not shared with other references of the packet. The rest of the data is shared and must be treated as read only. Initially the returned reference has metadata initialized to default values and does not contain unshared data. Packet (head) manipulation functions may be used normally to, e.g., add a unique header onto the shared payload. The shared part of the packet may be modified again when there is a single reference left. Static and dynamic references must not be mixed. Results are undefined if these restrictions are not observed.
The packet handle 'pkt' may itself be a (dynamic) reference to a packet.
If the caller does not intend to modify either the packet or the new reference to it, odp_packet_ref_static() may be used to create a static reference that is more optimized for that use case.
Packet is not modified on failure.
pkt | Handle of the packet for which a reference is to be created. |
offset | Byte offset in the packet at which the shared part is to begin. This must be in the range 0 ... odp_packet_len(pkt)-1. |
ODP_PACKET_INVALID | On failure |
odp_packet_t odp_packet_ref_pkt | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
odp_packet_t | hdr | ||
) |
Create a reference to a packet with a header packet.
This operation is otherwise identical to odp_packet_ref(), but it prepends a supplied 'hdr' packet as the head of the new reference. The resulting packet consists metadata and data of the 'hdr' packet, followed by the shared part of packet 'pkt'.
The packet handle ('pkt') may itself be a (dynamic) reference to a packet, but the header packet handle ('hdr') must be unique. Both packets must be have been allocated from the same pool and the handles must not refer to the same packet. Results are undefined if these restrictions are not observed.
Packets are not modified on failure. The header packet 'hdr' is consumed on success.
pkt | Handle of the packet for which a reference is to be created. |
offset | Byte offset in 'pkt' at which the shared part is to begin. Must be in the range 0 ... odp_packet_len(pkt)-1. |
hdr | Handle of the header packet to be prefixed onto the new reference. Must be a unique reference. |
ODP_PACKET_INVALID | On failure |
int odp_packet_has_ref | ( | odp_packet_t | pkt | ) |
Test if packet has multiple references.
A packet that has multiple references share data with other packets. In case of a static reference it also shares metadata. Shared parts must be treated as read only.
New references are created with odp_packet_ref_static(), odp_packet_ref() and odp_packet_ref_pkt() calls. The intent of multiple references is to avoid packet copies, however some implementations may do a packet copy for some of the calls. If a copy is done, the new reference is actually a new, unique packet and this function returns '0' for it. When a real reference is created (instead of a copy), this function returns '1' for both packets (the original packet and the new reference).
pkt | Packet handle |
0 | This is the single reference to the packet |
1 | Packet has multiple references |
odp_packet_t odp_packet_copy | ( | odp_packet_t | pkt, |
odp_pool_t | pool | ||
) |
Full copy of a packet.
Create a new copy of the packet. The new packet is exact copy of the source packet (incl. data and metadata). The pool must have been created with ODP_POOL_PACKET type.
pkt | Packet handle |
pool | Packet pool for allocation of the new packet. |
ODP_PACKET_INVALID | on failure |
odp_packet_t odp_packet_copy_part | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
uint32_t | len, | ||
odp_pool_t | pool | ||
) |
Partial copy of a packet.
Copy 'len' bytes of data starting from 'offset' into a new packet. Metadata in the new packet is initialized with default values. Maximum number of bytes to copy is packet data length minus the offset. The pool must be a packet pool.
pkt | Packet handle |
offset | Byte offset into the packet |
len | Number of bytes to copy |
pool | Packet pool for allocation of the new packet |
ODP_PACKET_INVALID | on failure |
int odp_packet_copy_to_mem | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
uint32_t | len, | ||
void * | dst | ||
) |
Copy data from packet to memory.
Copy 'len' bytes of data starting from 'offset' to the destination address. Maximum number of bytes to copy is packet data length minus the offset.
pkt | Packet handle |
offset | Byte offset into the packet |
len | Number of bytes to copy |
dst | Destination address |
0 | on success |
<0 | on failure |
int odp_packet_copy_from_mem | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
uint32_t | len, | ||
const void * | src | ||
) |
Copy data from memory to packet.
Copy 'len' bytes of data from the source address into the packet level offset. Maximum number of bytes to copy is packet data length minus the offset. Packet is not modified on an error.
pkt | Packet handle |
offset | Byte offset into the packet |
len | Number of bytes to copy |
src | Source address |
0 | on success |
<0 | on failure |
int odp_packet_copy_from_pkt | ( | odp_packet_t | dst, |
uint32_t | dst_offset, | ||
odp_packet_t | src, | ||
uint32_t | src_offset, | ||
uint32_t | len | ||
) |
Copy data from another packet.
Copy 'len' bytes of data from 'src' packet to 'dst' packet. Copy starts from the specified source and destination packet offsets. Copied areas (offset ... offset + len) must not exceed their packet data lengths. Source and destination packet handles must not refer to the same packet (use odp_packet_copy_data() or odp_packet_move_data() for a single packet).
Packet is not modified on an error.
dst | Destination packet handle |
dst_offset | Byte offset into destination packet |
src | Source packet handle |
src_offset | Byte offset into source packet |
len | Number of bytes to copy |
0 | on success |
<0 | on failure |
int odp_packet_copy_data | ( | odp_packet_t | pkt, |
uint32_t | dst_offset, | ||
uint32_t | src_offset, | ||
uint32_t | len | ||
) |
Copy data within packet.
Copy 'len' bytes of data from 'src_offset' to 'dst_offset'. Copied areas (offset ... offset + len) must not overlap or exceed packet data length. Packet is not modified on an error.
pkt | Packet handle |
dst_offset | Destination byte offset |
src_offset | Source byte offset |
len | Number of bytes to copy |
0 | on success |
<0 | on failure |
int odp_packet_move_data | ( | odp_packet_t | pkt, |
uint32_t | dst_offset, | ||
uint32_t | src_offset, | ||
uint32_t | len | ||
) |
Move data within packet.
Copy 'len' bytes of data from 'src_offset' to 'dst_offset'. Copied areas (offset ... offset + len) may overlap by any number of bytes, but must not exceed packet data length. When areas overlap, copying takes place as if source bytes are first copied into a temporary buffer, and then from there to the destination. Packet is not modified on an error.
pkt | Packet handle |
dst_offset | Destination byte offset |
src_offset | Source byte offset |
len | Number of bytes to move |
0 | on success |
<0 | on failure |
int odp_packet_parse | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
const odp_packet_parse_param_t * | param | ||
) |
Parse packet.
Parse protocol headers in packet data and update layer/protocol specific metadata (e.g. offsets, errors, protocols, checksum statuses, etc). Parsing starts at 'offset', which is the first header byte of protocol 'param.proto'. Parameter 'param.last_layer' defines the last layer application requests to check. Use ODP_PROTO_LAYER_ALL for all layers. A successful operation sets (or resets) packet metadata for all layers from the layer of 'param.proto' to the application defined last layer. In addition, offset (and pointer) to the next layer is set. Other layer/protocol specific metadata have undefined values. When operation fails, all layer/protocol specific metadata have undefined values.
pkt | Packet handle |
offset | Byte offset into the packet |
param | Parse parameters. Proto and last_layer fields must be set. Clear all check bits that are not used. |
0 | on success |
<0 | on failure |
int odp_packet_parse_multi | ( | const odp_packet_t | pkt[], |
const uint32_t | offset[], | ||
int | num, | ||
const odp_packet_parse_param_t * | param | ||
) |
Parse multiple packets.
Otherwise like odp_packet_parse(), but parses multiple packets. Packets may have unique offsets, but must start with the same protocol. The same parse parameters are applied to all packets.
pkt | Packet handle array |
offset | Byte offsets into the packets |
num | Number of packets and offsets |
param | Parse parameters. Proto and last_layer fields must be set. Clear all check bits that are not used. |
<0 | on failure |
void odp_packet_parse_result | ( | odp_packet_t | pkt, |
odp_packet_parse_result_t * | result | ||
) |
Read parse results.
Read out the most commonly used packet parse results. The same information is available through individual function calls, but this call may be more efficient when reading multiple results from a packet.
pkt | Packet handle | |
[out] | result | Pointer for parse result output |
void odp_packet_parse_result_multi | ( | const odp_packet_t | pkt[], |
odp_packet_parse_result_t * | result[], | ||
int | num | ||
) |
Read parse results from multiple packets.
Otherwise same functionality as odp_packet_parse_result() but handles multiple packets.
pkt | Packet handle array | |
[out] | result | Parse result array for output |
num | Number of packets and results |
odp_pool_t odp_packet_pool | ( | odp_packet_t | pkt | ) |
Packet pool.
Returns handle to the packet pool where the packet was allocated from.
pkt | Packet handle |
odp_pktio_t odp_packet_input | ( | odp_packet_t | pkt | ) |
Packet input interface.
Returns handle to the packet IO interface which received the packet or ODP_PKTIO_INVALID when the packet was allocated/reset by the application.
pkt | Packet handle |
ODP_PKTIO_INVALID | Packet was not received on any interface |
void odp_packet_input_set | ( | odp_packet_t | pkt, |
odp_pktio_t | pktio | ||
) |
Set packet input interface.
Set packet input interface to a valid packet IO handle or ODP_PKTIO_INVALID. An application may use this for testing or other purposes, when perception of the packet input interface need to be changed. The call updates both input interface handle (odp_packet_input()) and index (odp_packet_input_index()).
pkt | Packet handle |
pktio | Handle to a valid packet input interface or ODP_PKTIO_INVALID. ODP_PKTIO_INVALID indicates that the packet was not received by any packet IO interface. |
int odp_packet_input_index | ( | odp_packet_t | pkt | ) |
Packet input interface index.
Returns the index of the packet I/O interface that received the packet, or <0 when the packet was allocated/reset by the application.
pkt | Packet handle |
<0 | Packet was not received on any interface |
void* odp_packet_user_ptr | ( | odp_packet_t | pkt | ) |
User context pointer.
Return previously stored user context pointer. If not otherwise documented, the pointer value is maintained over packet manipulating operations. Implementation initializes the pointer value to NULL during new packet creation (e.g. alloc and packet input) and reset.
pkt | Packet handle |
void odp_packet_user_ptr_set | ( | odp_packet_t | pkt, |
const void * | user_ptr | ||
) |
Set user context pointer.
Each packet has room for a user defined context pointer. The pointer value does not necessarily represent a valid address - e.g. user may store any value of type intptr_t. ODP may use the pointer for data prefetching, but must ignore any invalid addresses.
pkt | Packet handle |
user_ptr | User context pointer |
void* odp_packet_user_area | ( | odp_packet_t | pkt | ) |
User area address.
Each packet has an area for user data. Size of the area is fixed and defined in packet pool parameters.
pkt | Packet handle |
NULL | The packet does not have user area |
uint32_t odp_packet_user_area_size | ( | odp_packet_t | pkt | ) |
User area size.
The size is fixed and defined in packet pool parameters.
pkt | Packet handle |
int odp_packet_user_flag | ( | odp_packet_t | pkt | ) |
Check user flag.
Implementation clears user flag during new packet creation (e.g. alloc and packet input) and reset. User may set the flag with odp_packet_user_flag_set(). Implementation never sets the flag, only clears it. The flag may be useful e.g. to mark when the user area content is valid.
pkt | Packet handle |
0 | User flag is clear |
>0 | User flag is set |
void odp_packet_user_flag_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set user flag.
Set (or clear) the user flag.
pkt | Packet handle |
val | New value for the flag. Zero clears the flag, other values set the flag. |
void* odp_packet_l2_ptr | ( | odp_packet_t | pkt, |
uint32_t * | len | ||
) |
Layer 2 start pointer.
Returns pointer to the start of layer 2. Optionally, outputs number of data bytes in the segment following the pointer. The pointer value is generated from the current layer 2 offset.
pkt | Packet handle | |
[out] | len | Number of data bytes remaining in the segment (output). Ignored when NULL. |
NULL | Layer 2 offset has not been set |
uint32_t odp_packet_l2_offset | ( | odp_packet_t | pkt | ) |
Layer 2 start offset.
Returns offset to the start of layer 2. The offset is calculated from the current odp_packet_data() position in bytes. Packet parsing sets the offset according to parse configuration and layers recognized in the packet. Data start position updating functions (e.g. odp_packet_push_head()) do not modify the offset, but user sets a new value when needed.
pkt | Packet handle |
ODP_PACKET_OFFSET_INVALID | Layer 2 offset has not been set |
int odp_packet_l2_offset_set | ( | odp_packet_t | pkt, |
uint32_t | offset | ||
) |
Set layer 2 start offset.
Set offset to the start of layer 2. The offset is calculated from the current odp_packet_data() position in bytes. Offset must not exceed packet data length. Offset is not modified on an error.
pkt | Packet handle |
offset | Layer 2 start offset (0 ... odp_packet_len()-1) |
0 | on success |
<0 | on failure |
void* odp_packet_l3_ptr | ( | odp_packet_t | pkt, |
uint32_t * | len | ||
) |
Layer 3 start pointer.
Returns pointer to the start of layer 3. Optionally, outputs number of data bytes in the segment following the pointer. The pointer value is generated from the current layer 3 offset.
pkt | Packet handle | |
[out] | len | Number of data bytes remaining in the segment (output). Ignored when NULL. |
NULL | Layer 3 offset has not been set |
uint32_t odp_packet_l3_offset | ( | odp_packet_t | pkt | ) |
Layer 3 start offset.
Returns offset to the start of layer 3. The offset is calculated from the current odp_packet_data() position in bytes. Packet parsing sets the offset according to parse configuration and layers recognized in the packet. Data start position updating functions (e.g. odp_packet_push_head()) do not modify the offset, but user sets a new value when needed.
pkt | Packet handle |
ODP_PACKET_OFFSET_INVALID | Layer 3 offset has not been set |
int odp_packet_l3_offset_set | ( | odp_packet_t | pkt, |
uint32_t | offset | ||
) |
Set layer 3 start offset.
Set offset to the start of layer 3. The offset is calculated from the current odp_packet_data() position in bytes. Offset must not exceed packet data length. Offset is not modified on an error.
pkt | Packet handle |
offset | Layer 3 start offset (0 ... odp_packet_len()-1) |
0 | on success |
<0 | on failure |
void* odp_packet_l4_ptr | ( | odp_packet_t | pkt, |
uint32_t * | len | ||
) |
Layer 4 start pointer.
Returns pointer to the start of layer 4. Optionally, outputs number of data bytes in the segment following the pointer. The pointer value is generated from the current layer 4 offset.
pkt | Packet handle | |
[out] | len | Number of data bytes remaining in the segment (output). Ignored when NULL. |
NULL | Layer 4 offset has not been set |
uint32_t odp_packet_l4_offset | ( | odp_packet_t | pkt | ) |
Layer 4 start offset.
Returns offset to the start of layer 4. The offset is calculated from the current odp_packet_data() position in bytes. Packet parsing sets the offset according to parse configuration and layers recognized in the packet. Data start position updating functions (e.g. odp_packet_push_head()) do not modify the offset, but user sets a new value when needed.
pkt | Packet handle |
ODP_PACKET_OFFSET_INVALID | Layer 4 offset has not been set |
int odp_packet_l4_offset_set | ( | odp_packet_t | pkt, |
uint32_t | offset | ||
) |
Set layer 4 start offset.
Set offset to the start of layer 4. The offset is calculated from the current odp_packet_data() position in bytes. Offset must not exceed packet data length. Offset is not modified on an error.
pkt | Packet handle |
offset | Layer 4 start offset (0 ... odp_packet_len()-1) |
0 | on success |
<0 | on failure |
odp_proto_l2_type_t odp_packet_l2_type | ( | odp_packet_t | pkt | ) |
Layer 2 protocol type.
Returns layer 2 protocol type. Initial type value is ODP_PROTO_L2_TYPE_NONE.
pkt | Packet handle |
odp_proto_l3_type_t odp_packet_l3_type | ( | odp_packet_t | pkt | ) |
Layer 3 protocol type.
Returns layer 3 protocol type. Initial type value is ODP_PROTO_L3_TYPE_NONE.
In addition to protocol types specified in ODP_PROTO_L3_TYPE_* defines, the function may also return other L3 protocol types (e.g. from IEEE EtherTypes list) recognized by the parser. If protocol type is not recognized, ODP_PROTO_L3_TYPE_NONE is returned.
pkt | Packet handle |
odp_proto_l4_type_t odp_packet_l4_type | ( | odp_packet_t | pkt | ) |
Layer 4 protocol type.
Returns layer 4 protocol type. Initial type value is ODP_PROTO_L4_TYPE_NONE.
In addition to protocol types specified in ODP_PROTO_L4_TYPE_* defines, the function may also return other L4 protocol types (e.g. from IANA protocol number list) recognized by the parser. If protocol type is not recognized, ODP_PROTO_L4_TYPE_NONE is returned.
pkt | Packet handle |
odp_packet_chksum_status_t odp_packet_l3_chksum_status | ( | odp_packet_t | pkt | ) |
Layer 3 checksum check status.
Returns the result of the latest layer 3 checksum check done for the packet. The status tells if checksum check was attempted and the result of the attempt. It depends on packet input (or IPSEC) configuration, packet content and implementation capabilities if checksum check is attempted for a packet.
pkt | Packet handle |
odp_packet_chksum_status_t odp_packet_l4_chksum_status | ( | odp_packet_t | pkt | ) |
Layer 4 checksum check status.
Returns the result of the latest layer 4 checksum check done for the packet. The status tells if checksum check was attempted and the result of the attempt. It depends on packet input (or IPSEC) configuration, packet content and implementation capabilities if checksum check is attempted for a packet.
When a UDP packet does not have a checksum (e.g. checksum field of a UDP/IPv4 packet is zero), checksum check result is ODP_PACKET_CHKSUM_OK.
pkt | Packet handle |
void odp_packet_l3_chksum_insert | ( | odp_packet_t | pkt, |
int | insert | ||
) |
Layer 3 checksum insertion override.
Override checksum insertion configuration per packet. This per packet setting overrides a higher level configuration for checksum insertion into a L3 header during packet output processing.
Calling this function is always allowed but the checksum will not be inserted if the packet is output through a pktio that does not have the relevant checksum insertion enabled.
L3 type and L3 offset in packet metadata should provide valid protocol and header offset for checksum insertion purposes.
pkt | Packet handle |
insert | 0: do not insert L3 checksum 1: insert L3 checksum |
void odp_packet_l4_chksum_insert | ( | odp_packet_t | pkt, |
int | insert | ||
) |
Layer 4 checksum insertion override.
Override checksum insertion configuration per packet. This per packet setting overrides a higher level configuration for checksum insertion into a L4 header during packet output processing.
Calling this function is always allowed but the checksum will not be inserted if the packet is output through a pktio that does not have the relevant checksum insertion enabled.
L3 type, L4 type, L3 offset and L4 offset in packet metadata should provide valid protocols and header offsets for checksum insertion purposes.
pkt | Packet handle |
insert | 0: do not insert L4 checksum 1: insert L4 checksum |
uint16_t odp_packet_ones_comp | ( | odp_packet_t | pkt, |
odp_packet_data_range_t * | range | ||
) |
Ones' complement sum of packet data.
Returns 16-bit ones' complement sum that was calculated over a portion of packet data during a packet processing operation (e.g. packet input or IPSEC offload). The data range is output with 'range' parameter, and usually includes IP payload (L4 headers and payload). When 'range.length' is zero, the sum has not been calculated. In case of odd number of bytes, calculation uses a zero byte as padding at the end. The sum may be used as part of e.g. UDP/TCP checksum checking, especially with IP fragments.
pkt | Packet handle | |
[out] | range | Data range of the sum (output). The calculation started from range.offset and included range.length bytes. When range.length is zero, the sum has not been calculated. |
uint32_t odp_packet_flow_hash | ( | odp_packet_t | pkt | ) |
Packet flow hash value.
Returns the hash generated from the packet header. Use odp_packet_has_flow_hash() to check if packet contains a hash.
pkt | Packet handle |
void odp_packet_flow_hash_set | ( | odp_packet_t | pkt, |
uint32_t | flow_hash | ||
) |
Set packet flow hash value.
Store the packet flow hash for the packet and sets the flow hash flag. This enables (but does not require!) application to reflect packet header changes in the hash.
pkt | Packet handle |
flow_hash | Hash value to set |
odp_time_t odp_packet_ts | ( | odp_packet_t | pkt | ) |
Packet timestamp.
Returns timestamp value recorded into the packet. Use odp_packet_has_ts() to check if the packet has a valid timestamp. Packet input uses packet IO interface specific time source and thus timestamp (or nanosecond) values from one interface cannot be mixed with values from another interface (or time source in general). Packet IO interface timestamp resolution can be checked with odp_pktio_ts_res() and current time with odp_pktio_time().
Time API operations (e.g. odp_time_diff()) can be used with packet timestamp values or when converting those into nanoseconds (odp_time_to_ns()).
pkt | Packet handle |
void odp_packet_ts_set | ( | odp_packet_t | pkt, |
odp_time_t | timestamp | ||
) |
Set packet timestamp.
Stores timestamp value and sets timestamp flag for the packet.
pkt | Packet handle |
timestamp | Timestamp value |
void odp_packet_ts_request | ( | odp_packet_t | pkt, |
int | enable | ||
) |
Request Tx timestamp capture.
Control whether timestamp needs to be captured when this packet is transmitted. By default, Tx timestamping is disabled. This API is allowed to be called always, but the Tx timestamp is not captured if the output packet IO device is not configured to enable timestamping.
pkt | Packet handle |
enable | 0: do not capture timestamp on Tx 1: capture timestamp on Tx |
odp_packet_color_t odp_packet_color | ( | odp_packet_t | pkt | ) |
Get packet color.
pkt | Packet handle |
void odp_packet_color_set | ( | odp_packet_t | pkt, |
odp_packet_color_t | color | ||
) |
odp_bool_t odp_packet_drop_eligible | ( | odp_packet_t | pkt | ) |
Get drop eligible status.
pkt | Packet handle |
0 | Packet is not drop eligible |
1 | Packet is drop |
void odp_packet_drop_eligible_set | ( | odp_packet_t | pkt, |
odp_bool_t | status | ||
) |
Set drop eligible status.
pkt | Packet handle |
status | Drop eligibility status |
int8_t odp_packet_shaper_len_adjust | ( | odp_packet_t | pkt | ) |
Get shaper length adjustment.
pkt | Packet handle |
void odp_packet_shaper_len_adjust_set | ( | odp_packet_t | pkt, |
int8_t | adj | ||
) |
Set shaper length adjustment.
pkt | Packet handle |
adj | Signed adjustment value |
uint64_t odp_packet_cls_mark | ( | odp_packet_t | pkt | ) |
Classification mark value.
Get the value of the CLS mark of the packet. The mark value is zero by default, but may be changed by the classification subsystem.
pkt | Packet handle |
int odp_packet_lso_request | ( | odp_packet_t | pkt, |
const odp_packet_lso_opt_t * | lso_opt | ||
) |
Request Large Send Offload (LSO) for a packet.
Setup packet metadata which requests LSO segmentation to be performed during packet output. The selected LSO profile specifies details of the segmentation operation to be done. Depending on LSO profile options, additional metadata (e.g. L3/L4 protocol header offsets) may need to be set on the packet.
pkt | Packet handle |
lso_opt | LSO options |
0 | On success |
<0 | On failure |
void odp_packet_lso_request_clr | ( | odp_packet_t | pkt | ) |
Clear LSO request from a packet.
Clears packet metadata not to request LSO segmentation.
pkt | Packet handle |
int odp_packet_has_lso_request | ( | odp_packet_t | pkt | ) |
Check if LSO is requested for the packet.
pkt | Packet handle |
non-zero | LSO is requested |
0 | LSO is not requested |
uint32_t odp_packet_payload_offset | ( | odp_packet_t | pkt | ) |
Payload data offset.
Returns offset to the start of payload data. Packet data before this offset is considered as protocol headers. The offset is calculated from the current odp_packet_data() position in bytes. Data start position updating functions (e.g. odp_packet_push_head()) do not modify the offset, but user sets a new value when needed.
Packet parsing does not set this offset. Initial offset value is undefined. Application may utilize the offset for internal purposes or when requesting LSO segmentation for the packet.
pkt | Packet handle |
ODP_PACKET_OFFSET_INVALID | Payload data offset has not been set |
int odp_packet_payload_offset_set | ( | odp_packet_t | pkt, |
uint32_t | offset | ||
) |
Set payload data start offset.
Set offset to the start of payload data. The offset is calculated from the current odp_packet_data() position in bytes. Offset must not exceed packet data length. Offset is not modified on an error.
pkt | Packet handle |
offset | Payload data start offset (0 ... odp_packet_len()-1) or ODP_PACKET_OFFSET_INVALID |
0 | on success |
<0 | on failure |
void odp_packet_aging_tmo_set | ( | odp_packet_t | pkt, |
uint64_t | tmo_ns | ||
) |
Enable or disable Tx packet aging.
Enable or disable Tx packet drop based on packet age. When enabled, packet will be dropped if it is in Tx pktout queue or traffic shapers/schedulers for longer than timeout set.
When tmo_ns is !0: Aging is enabled 0: Aging is disabled
Aging is disabled by default. Maximum tmo value is defined by max_tx_aging_tmo_ns capa.
pkt | Packet handle |
tmo_ns | Packet aging drop timeout in nsec. When 0, aging drop is disabled (default). |
uint64_t odp_packet_aging_tmo | ( | odp_packet_t | pkt | ) |
Check if packet has Tx aging drop enabled.
pkt | Packet handle |
>0 | Aging drop timeout in nano seconds and implies aging drop is enabled. |
0 | If Aging drop is disabled. |
int odp_packet_tx_compl_request | ( | odp_packet_t | pkt, |
const odp_packet_tx_compl_opt_t * | opt | ||
) |
Request packet transmit completion.
Enables or disables packet transmit completion request for the packet. Completion may be requested either in event (ODP_PACKET_TX_COMPL_EVENT) or poll (ODP_PACKET_TX_COMPL_POLL) mode. When event mode is enabled, an event of type ODP_EVENT_PACKET_TX_COMPL will be sent to the destination queue to signal transmit completion. When poll mode is enabled, odp_packet_tx_compl_done() is used with the provided completion identifier to check the completion. In both cases, transmit completion is reported only after pktio interface has finished processing the packet.
A previously enabled request can be disabled by setting the mode to ODP_PACKET_TX_COMPL_DISABLED. Transmit completion request is disabled by default.
pkt | Packet handle |
opt | Packet transmit completion request options |
0 | On success |
<0 | On failure |
int odp_packet_has_tx_compl_request | ( | odp_packet_t | pkt | ) |
Check if packet transmit completion is requested.
pkt | Packet handle |
non-zero | Transmit completion is requested |
0 | Transmit completion is not requested |
void odp_packet_free_ctrl_set | ( | odp_packet_t | pkt, |
odp_packet_free_ctrl_t | ctrl | ||
) |
Set packet free control option.
This option enables application to control if a packet is freed/not freed back into a pool after an ODP offload feature has finished processing it. The option does not have an effect on odp_packet_free() or other direct free calls. It affects only packets that are sent directly through a packet output interface queue (odp_pktout_queue_t or odp_queue_t), also when packets are LSO offloaded. Packets transmitted through inline IPsec or TM are not affected.
Packet output interface frees transmitted packets by default. When the option is set to ODP_PACKET_FREE_CTRL_DONT_FREE, packet output will not free the packet after transmit and application may reuse or free the packet as soon as its transmission is complete (see e.g. odp_packet_tx_compl_done()). Check packet IO interface capability free_ctrl.dont_free (odp_pktio_capability_t.free_ctrl) for the option support. When an interface does not support the option, it ignores the value.
The option must not be enabled on packets that have multiple references. The default value is ODP_PACKET_FREE_CTRL_DISABLED.
pkt | Packet handle |
ctrl | Packet free control option value |
odp_packet_free_ctrl_t odp_packet_free_ctrl | ( | odp_packet_t | pkt | ) |
Returns packet free control option value.
pkt | Packet handle |
void odp_packet_proto_stats_request | ( | odp_packet_t | pkt, |
odp_packet_proto_stats_opt_t * | opt | ||
) |
Request packet proto stats.
The statistics enabled in the proto stats object are updated for the packet in packet output when the packet is transmitted or dropped. The statistics update is done as the last step of output processing after possible packet transformations (e.g. fragmentation, IPsec) that may occur. If a packet is fragmented or segmented to multiple packets as part of output processing, all the resulting packets inherit the proto stats object association from the original packet.
The relevant octet counts will be updated with the actual packet length at the time of transmission or drop plus the respective adjustment value passed in the 'opt' parameter. The octet counts thus include possible additional headers added by ODP during packet output (e.g. ESP header added by inline outbound IPsec processing). Ethernet padding and FCS are not included in the octet counts. The adjustment value is added only if the respective capability field is true and otherwise ignored.
pkt | Packet handle |
opt | Proto stats options. If NULL, then proto stats update is disabled for this packet. |
odp_proto_stats_t odp_packet_proto_stats | ( | odp_packet_t | pkt | ) |
Get proto stats object.
Get the proto stats object associated with the given packet.
pkt | Packet handle |
odp_packet_vector_t odp_packet_vector_from_event | ( | odp_event_t | ev | ) |
Get packet vector handle from event.
Converts an ODP_EVENT_PACKET_VECTOR type event to a packet vector handle
ev | Event handle |
odp_event_t odp_packet_vector_to_event | ( | odp_packet_vector_t | pktv | ) |
Convert packet vector handle to event.
pktv | Packet vector handle |
odp_packet_vector_t odp_packet_vector_alloc | ( | odp_pool_t | pool | ) |
Allocate a packet vector from a packet vector pool.
Allocates a packet vector from the specified packet vector pool. The pool must have been created with the ODP_POOL_VECTOR type.
pool | Packet vector pool handle |
ODP_PACKET_VECTOR_INVALID | Packet vector could not be allocated |
void odp_packet_vector_free | ( | odp_packet_vector_t | pktv | ) |
Free packet vector.
Frees the packet vector into the packet vector pool it was allocated from.
pktv | Packet vector handle |
uint32_t odp_packet_vector_tbl | ( | odp_packet_vector_t | pktv, |
odp_packet_t ** | pkt_tbl | ||
) |
Get packet vector table.
Packet vector table is an array of packets (odp_packet_t) stored in contiguous memory location. Upon completion of this API, the implementation returns the packet table pointer in pkt_tbl.
pktv | Packet vector handle | |
[out] | pkt_tbl | Points to packet vector table |
uint32_t odp_packet_vector_size | ( | odp_packet_vector_t | pktv | ) |
Number of packets in a vector.
pktv | Packet vector handle |
void odp_packet_vector_size_set | ( | odp_packet_vector_t | pktv, |
uint32_t | size | ||
) |
Set the number of packets stored in a vector.
Update the number of packets stored in a vector. When the application is producing a packet vector, this function shall be used by the application to set the number of packets available in this vector.
pktv | Packet vector handle |
size | Number of packets in this vector |
void* odp_packet_vector_user_area | ( | odp_packet_vector_t | pktv | ) |
Packet vector user area.
Returns pointer to the user area associated with the packet vector. Size of the area is fixed and defined in vector pool parameters.
pktv | Packet vector handle |
NULL | The packet vector does not have user area |
int odp_packet_vector_user_flag | ( | odp_packet_vector_t | pktv | ) |
Check user flag.
Implementation clears user flag during new packet vector creation (e.g. alloc and packet input) and reset. User may set the flag with odp_packet_vector_user_flag_set(). Implementation never sets the flag, only clears it. The flag may be useful e.g. to mark when the user area content is valid.
pktv | Packet vector handle |
0 | User flag is clear |
>0 | User flag is set |
void odp_packet_vector_user_flag_set | ( | odp_packet_vector_t | pktv, |
int | val | ||
) |
Set user flag.
Set (or clear) the user flag.
pktv | Packet vector handle |
val | New value for the flag. Zero clears the flag, other values set the flag. |
int odp_packet_vector_valid | ( | odp_packet_vector_t | pktv | ) |
Check that packet vector is valid.
This function can be used for debugging purposes to check if a packet vector handle represents a valid packet vector. The level of error checks depends on the implementation. Considerable number of cpu cycles may be consumed depending on the level. The call should not crash if the packet vector handle is corrupted.
pktv | Packet vector handle |
0 | Packet vector is not valid |
1 | Packet vector is valid |
odp_pool_t odp_packet_vector_pool | ( | odp_packet_vector_t | pktv | ) |
Packet vector pool.
Returns handle to the packet vector pool where the packet vector was allocated from.
pktv | Packet vector handle |
void odp_packet_vector_print | ( | odp_packet_vector_t | pktv | ) |
Print packet vector debug information.
Print all packet vector debug information to ODP log.
pktv | Packet vector handle |
uint64_t odp_packet_vector_to_u64 | ( | odp_packet_vector_t | pktv | ) |
Get printable value for packet vector handle.
pktv | Handle to be converted for debugging |
odp_packet_reass_status_t odp_packet_reass_status | ( | odp_packet_t | pkt | ) |
Check reassembly status of the packet.
pkt | Packet handle |
odp_packet_tx_compl_t odp_packet_tx_compl_from_event | ( | odp_event_t | ev | ) |
Get packet Tx completion handle from event.
Converts an ODP_EVENT_PACKET_TX_COMPL type event to packet Tx completion handle.
ev | Event handle |
odp_event_t odp_packet_tx_compl_to_event | ( | odp_packet_tx_compl_t | tx_compl | ) |
Convert packet Tx completion to event.
tx_compl | Packet Tx completion |
void odp_packet_tx_compl_free | ( | odp_packet_tx_compl_t | tx_compl | ) |
Free packet Tx completion.
Frees the packet Tx completion back to platform. It frees packet Tx completion that gets allocated as part of packet Tx completion request for a given packet.
tx_compl | Packet Tx completion handle |
void* odp_packet_tx_compl_user_ptr | ( | odp_packet_tx_compl_t | tx_compl | ) |
User context pointer.
Return user context pointer from packet Tx completion event. This is the same value set to packet using odp_packet_user_ptr_set().
tx_compl | Packet Tx completion handle |
int odp_packet_tx_compl_done | ( | odp_pktio_t | pktio, |
uint32_t | compl_id | ||
) |
Check packet transmit completion.
Checks if a previously sent packet with a ODP_PACKET_TX_COMPL_POLL type transmit completion request (see odp_packet_tx_compl_opt_t) has been transmitted. The packet send function call clears completion identifier status, and 0 is returned while the transmit is in progress. When >0 is returned, transmit of the packet is complete and the completion identifier may be reused for another transmit.
When transmit of a packet is complete, it indicates that transmit of other packets sent before the packet through the same queue have also completed.
Returns initially 0 for all configured completion identifiers.
pktio | Packet IO interface that was used to send the packet |
compl_id | Completion identifier that was used in the transmit completion request |
>0 | Packet transmit is complete |
0 | Packet transmit is not complete |
<0 | Failed to read packet transmit status |
void odp_packet_print | ( | odp_packet_t | pkt | ) |
Print packet debug information.
Print all packet debug information to the ODP log.
pkt | Packet handle |
void odp_packet_print_data | ( | odp_packet_t | pkt, |
uint32_t | offset, | ||
uint32_t | len | ||
) |
Print packet data.
Print packet debug information with packet data to the ODP log. Operation prints 'len' bytes of packet data starting from 'offset' byte. Offset plus length must not exceed packet length (odp_packet_len()).
pkt | Packet handle |
offset | Byte offset into the packet |
len | Number of bytes to print |
int odp_packet_is_valid | ( | odp_packet_t | pkt | ) |
Check that packet is valid.
This function can be used for debugging purposes to check if a packet handle represents a valid packet. The level of error checks depends on the implementation. Considerable number of cpu cycles may be consumed depending on the level. The call should not crash if the packet handle is corrupted.
pkt | Packet handle |
0 | Packet is not valid |
1 | Packet is valid |
uint64_t odp_packet_to_u64 | ( | odp_packet_t | pkt | ) |
Get printable value for packet handle.
pkt | Handle to be converted for debugging |
uint64_t odp_packet_seg_to_u64 | ( | odp_packet_seg_t | seg | ) |
Get printable value for packet segment handle.
seg | Handle to be converted for debugging |
uint64_t odp_packet_tx_compl_to_u64 | ( | odp_packet_tx_compl_t | tx_compl | ) |
Get printable value for packet Tx completion handle.
tx_compl | Handle to be converted for debugging |
int odp_packet_has_error | ( | odp_packet_t | pkt | ) |
Check for all parse errors in packet.
Check if packet parsing has found any errors in the packet. The level of error checking depends on the parse configuration (e.g. included layers and checksums). Protocol layer functions (e.g. odp_packet_has_l3()) indicate which layers have been checked, and layer error functions (e.g. odp_packet_has_l3_error()) which layers have errors.
If packet subtype is ODP_EVENT_PACKET_IPSEC, odp_packet_has_error() would indicate parsing errors after IPSEC processing. IPSEC errors/warnings need to be checked using odp_ipsec_result().
pkt | Packet handle |
non-zero | Packet has errors |
0 | No errors were found |
int odp_packet_has_l2_error | ( | odp_packet_t | pkt | ) |
Check for errors in layer 2.
When layer 2 is included in the parse configuration, check if any errors were found in layer 2 of the packet.
pkt | Packet handle |
non-zero | Packet has errors in layer 2 |
0 | No errors were found in layer 2 |
int odp_packet_has_l3_error | ( | odp_packet_t | pkt | ) |
Check for errors in layer 3.
When layer 3 is included in the parse configuration, check if any errors were found in layer 3 of the packet.
pkt | Packet handle |
non-zero | Packet has errors in layer 3 |
0 | No errors found in layer 3 |
int odp_packet_has_l4_error | ( | odp_packet_t | pkt | ) |
Check for errors in layer 4.
When layer 4 is included in the parse configuration, check if any errors were found in layer 4 of the packet.
pkt | Packet handle |
non-zero | Packet has errors in layer 4 |
0 | No errors were found in layer 4 |
int odp_packet_has_l2 | ( | odp_packet_t | pkt | ) |
Check for layer 2 protocols.
When layer 2 is included in the parse configuration, check if packet parsing has found and checked a layer 2 protocol (e.g. Ethernet) in the packet.
pkt | Packet handle |
non-zero | A layer 2 protocol header was found and checked |
0 | No layer 2 protocol was found |
int odp_packet_has_l3 | ( | odp_packet_t | pkt | ) |
Check for layer 3 protocols.
When layer 3 is included in the parse configuration, check if packet parsing has found and checked a layer 3 protocol (e.g. IPv4, IPv6) in the packet.
pkt | Packet handle |
non-zero | A layer 3 protocol header was found and checked |
0 | No layer 3 protocol was found |
int odp_packet_has_l4 | ( | odp_packet_t | pkt | ) |
Check for layer 4 protocols.
When layer 4 is included in the parse configuration, check if packet parsing has found and checked a layer 4 protocol (e.g. UDP, TCP, SCTP) in the packet.
pkt | Packet handle |
non-zero | A layer 4 protocol header was found and checked |
0 | No layer 4 protocol was found |
int odp_packet_has_eth | ( | odp_packet_t | pkt | ) |
Check for Ethernet header.
pkt | Packet handle |
non-zero | Packet contains an Ethernet header |
0 | Packet does not contain an Ethernet header |
int odp_packet_has_eth_bcast | ( | odp_packet_t | pkt | ) |
Check for Ethernet broadcast address.
ODP recognizes the destination MAC address FF:FF:FF:FF:FF:FF as a broadcast address. All others are considered non-broadcast.
pkt | Packet handle |
non-zero | Ethernet destination address is the broadcast address |
0 | Ethernet destination address is not the broadcast address |
int odp_packet_has_eth_mcast | ( | odp_packet_t | pkt | ) |
Check for Ethernet multicast address.
ODP recognizes the destination MAC address as multicast if bit 7 is 1.
pkt | Packet handle |
non-zero | Ethernet destination address is a multicast address |
0 | Ethernet destination address is not a multicast address |
int odp_packet_has_jumbo | ( | odp_packet_t | pkt | ) |
Check for jumbo frame.
pkt | Packet handle |
non-zero | Packet is a jumbo frame |
0 | Packet is not a jumbo frame |
int odp_packet_has_vlan | ( | odp_packet_t | pkt | ) |
Check for VLAN.
Check if packet contains normal or QinQ VLAN header.
pkt | Packet handle |
non-zero | Packet contains a VLAN header |
0 | Packet does not contain a VLAN header |
int odp_packet_has_vlan_qinq | ( | odp_packet_t | pkt | ) |
Check for VLAN QinQ (stacked VLAN)
Check if packet contains QinQ VLAN header.
pkt | Packet handle |
non-zero | Packet contains a VLAN QinQ header |
0 | Packet does not contain a VLAN QinQ header |
int odp_packet_has_arp | ( | odp_packet_t | pkt | ) |
Check for ARP.
pkt | Packet handle |
non-zero | Packet contains an ARP message |
0 | Packet does not contain an ARP message |
int odp_packet_has_ipv4 | ( | odp_packet_t | pkt | ) |
Check for IPv4.
pkt | Packet handle |
non-zero | Packet contains an IPv4 header |
0 | Packet does not contain an IPv4 header |
int odp_packet_has_ipv6 | ( | odp_packet_t | pkt | ) |
Check for IPv6.
pkt | Packet handle |
non-zero | Packet contains an IPv6 header |
0 | Packet does not contain an IPv6 header |
int odp_packet_has_ip_bcast | ( | odp_packet_t | pkt | ) |
Check for IP broadcast address.
For IPv4, ODP recognizes the destination IP address 255.255.255.255 as a broadcast address. All other addresses are considered non-broadcast.
For IPv6, no destination addresses are recognized as broadcast addresses.
pkt | Packet handle |
non-zero | IP destination address is a broadcast address |
0 | IP destination address is not a broadcast address |
int odp_packet_has_ip_mcast | ( | odp_packet_t | pkt | ) |
Check for IP multicast address.
For IPv4 ODP recognizes destination IP addresses in the range 224.0.0.0 through 239.255.255.255 as multicast addresses.
For IPv6 ODP recognizes destination IP addresses with prefixes FF00:: through FFFF:: as multicast addresses.
pkt | Packet handle |
non-zero | IP destination address is a multicast address |
0 | IP destination address is not a multicast address |
int odp_packet_has_ipfrag | ( | odp_packet_t | pkt | ) |
Check for IP fragment.
pkt | Packet handle |
non-zero | Packet is an IP fragment |
0 | Packet is not an IP fragment |
int odp_packet_has_ipopt | ( | odp_packet_t | pkt | ) |
Check for IP options.
pkt | Packet handle |
non-zero | Packet contains IP options |
0 | Packet does not contain IP options |
int odp_packet_has_ipsec | ( | odp_packet_t | pkt | ) |
Check for IPSec.
pkt | Packet handle |
non-zero | Packet requires IPSec processing |
0 | Packet does not require IPSec processing |
int odp_packet_has_udp | ( | odp_packet_t | pkt | ) |
Check for UDP.
pkt | Packet handle |
non-zero | Packet contains a UDP header |
0 | Packet does not contain a UDP header |
int odp_packet_has_tcp | ( | odp_packet_t | pkt | ) |
Check for TCP.
pkt | Packet handle |
non-zero | Packet contains a TCP header |
0 | Packet does not contain a TCP header |
int odp_packet_has_sctp | ( | odp_packet_t | pkt | ) |
Check for SCTP.
pkt | Packet handle |
non-zero | Packet contains a SCTP header |
0 | Packet does not contain a SCTP header |
int odp_packet_has_icmp | ( | odp_packet_t | pkt | ) |
Check for ICMP.
pkt | Packet handle |
non-zero | Packet contains an ICMP header |
0 | Packet does not contain an ICMP header |
int odp_packet_has_flow_hash | ( | odp_packet_t | pkt | ) |
Check for packet flow hash.
pkt | Packet handle |
non-zero | Packet contains a hash value |
0 | Packet does not contain a hash value |
int odp_packet_has_ts | ( | odp_packet_t | pkt | ) |
Check for packet timestamp.
pkt | Packet handle |
non-zero | Packet contains a timestamp value |
0 | Packet does not contain a timestamp value |
void odp_packet_has_l2_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for L2 header, e.g.
ethernet
pkt | Packet handle |
val | Value |
void odp_packet_has_l3_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for L3 header, e.g.
IPv4, IPv6
pkt | Packet handle |
val | Value |
void odp_packet_has_l4_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for L4 header, e.g.
UDP, TCP, SCTP (also ICMP)
pkt | Packet handle |
val | Value |
void odp_packet_has_eth_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
void odp_packet_has_eth_bcast_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for Ethernet broadcast address.
pkt | Packet handle |
val | Value |
void odp_packet_has_eth_mcast_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for Ethernet multicast address.
pkt | Packet handle |
val | Value |
void odp_packet_has_jumbo_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for jumbo frame.
pkt | Packet handle |
val | Value |
void odp_packet_has_vlan_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for VLAN.
Set when packet contains normal VLAN header. Only one VLAN flag (VLAN/VLAN QinQ) can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_vlan_qinq_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for VLAN QinQ (stacked VLAN)
Set when packet contains QinQ VLAN header. Only one VLAN flag (VLAN/VLAN QinQ) can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_arp_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for ARP.
Only one of ARP/IPv4/IPv6 flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_ipv4_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for IPv4.
Only one of ARP/IPv4/IPv6 flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_ipv6_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for IPv6.
Only one of ARP/IPv4/IPv6 flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_ip_bcast_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for IP broadcast address.
Only one of IP broadcast/multicast flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_ip_mcast_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for IP multicast address.
Only one of IP broadcast/multicast flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_ipfrag_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for IP fragment.
pkt | Packet handle |
val | Value |
void odp_packet_has_ipopt_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for IP options.
pkt | Packet handle |
val | Value |
void odp_packet_has_ipsec_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for IPSec.
pkt | Packet handle |
val | Value |
void odp_packet_has_udp_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for UDP.
Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_tcp_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for TCP.
Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_sctp_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for SCTP.
Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_icmp_set | ( | odp_packet_t | pkt, |
int | val | ||
) |
Set flag for ICMP.
Only one of TCP/UDP/SCTP/ICMP flags can be set simultaneously.
pkt | Packet handle |
val | Value |
void odp_packet_has_flow_hash_clr | ( | odp_packet_t | pkt | ) |
Clear flag for packet flow hash.
pkt | Packet handle |
void odp_packet_has_ts_clr | ( | odp_packet_t | pkt | ) |
Clear flag for packet timestamp.
This call clears the timestamp flag. A odp_packet_ts_set() call sets the flag in addition to the timestamp value.
pkt | Packet handle |