@@ -72,6 +72,70 @@ typedef enum {
#define ODP_NUM_PACKET_COLORS 3
+/** Parse result flags */
+typedef struct odp_packet_parse_result_flag_t {
+ /** Flags union */
+ union {
+ /** All flags as a 64 bit word */
+ uint64_t all;
+
+ /** Flags as a bitfield struct */
+ struct {
+ /** @see odp_packet_has_error() */
+ uint64_t has_error : 1;
+ /** @see odp_packet_has_l2_error() */
+ uint64_t has_l2_error : 1;
+ /** @see odp_packet_has_l3_error() */
+ uint64_t has_l3_error : 1;
+ /** @see odp_packet_has_l4_error() */
+ uint64_t has_l4_error : 1;
+ /** @see odp_packet_has_l2() */
+ uint64_t has_l2 : 1;
+ /** @see odp_packet_has_l3() */
+ uint64_t has_l3 : 1;
+ /** @see odp_packet_has_l4() */
+ uint64_t has_l4 : 1;
+ /** @see odp_packet_has_eth() */
+ uint64_t has_eth : 1;
+ /** @see odp_packet_has_eth_bcast() */
+ uint64_t has_eth_bcast : 1;
+ /** @see odp_packet_has_eth_mcast() */
+ uint64_t has_eth_mcast : 1;
+ /** @see odp_packet_has_jumbo() */
+ uint64_t has_jumbo : 1;
+ /** @see odp_packet_has_vlan() */
+ uint64_t has_vlan : 1;
+ /** @see odp_packet_has_vlan_qinq() */
+ uint64_t has_vlan_qinq : 1;
+ /** @see odp_packet_has_arp() */
+ uint64_t has_arp : 1;
+ /** @see odp_packet_has_ipv4() */
+ uint64_t has_ipv4 : 1;
+ /** @see odp_packet_has_ipv6() */
+ uint64_t has_ipv6 : 1;
+ /** @see odp_packet_has_ip_bcast() */
+ uint64_t has_ip_bcast : 1;
+ /** @see odp_packet_has_ip_mcast() */
+ uint64_t has_ip_mcast : 1;
+ /** @see odp_packet_has_ipfrag() */
+ uint64_t has_ipfrag : 1;
+ /** @see odp_packet_has_ipopt() */
+ uint64_t has_ipopt : 1;
+ /** @see odp_packet_has_ipsec() */
+ uint64_t has_ipsec : 1;
+ /** @see odp_packet_has_udp() */
+ uint64_t has_udp : 1;
+ /** @see odp_packet_has_tcp() */
+ uint64_t has_tcp : 1;
+ /** @see odp_packet_has_sctp() */
+ uint64_t has_sctp : 1;
+ /** @see odp_packet_has_icmp() */
+ uint64_t has_icmp : 1;
+ };
+ };
+
+} odp_packet_parse_result_flag_t;
+
/**
* @}
*/
@@ -1428,6 +1428,62 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset,
int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[],
int num, const odp_packet_parse_param_t *param);
+/** Packet parse results */
+typedef struct odp_packet_parse_result_t {
+ /** Parse result flags */
+ odp_packet_parse_result_flag_t flag;
+
+ /** @see odp_packet_len() */
+ uint32_t packet_len;
+
+ /** @see odp_packet_l2_offset() */
+ uint32_t l2_offset;
+ /** @see odp_packet_l3_offset() */
+ uint32_t l3_offset;
+ /** @see odp_packet_l4_offset() */
+ uint32_t l4_offset;
+
+ /** @see odp_packet_l3_chksum_status() */
+ odp_packet_chksum_status_t l3_chksum_status;
+ /** @see odp_packet_l4_chksum_status() */
+ odp_packet_chksum_status_t l4_chksum_status;
+
+ /** @see odp_packet_l2_type() */
+ odp_proto_l2_type_t l2_type;
+ /** @see odp_packet_l3_type() */
+ odp_proto_l3_type_t l3_type;
+ /** @see odp_packet_l4_type() */
+ odp_proto_l4_type_t l4_type;
+
+} odp_packet_parse_result_t;
+
+/**
+ * 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.
+ *
+ * @param pkt Packet handle
+ * @param[out] result Pointer for parse result output
+ */
+void odp_packet_parse_result(odp_packet_t pkt,
+ odp_packet_parse_result_t *result);
+
+/**
+ * Read parse results from multiple packets
+ *
+ * Otherwise same functionality as odp_packet_parse_result() but handles
+ * multiple packets.
+ *
+ * @param pkt Packet handle array
+ * @param[out] result Parse result array for output
+ * @param num Number of packets and results
+ */
+void odp_packet_parse_result_multi(const odp_packet_t pkt[],
+ odp_packet_parse_result_t *result[],
+ int num);
+
/**
* Packet pool
*
@@ -89,6 +89,41 @@ typedef enum {
#define ODP_NUM_PACKET_COLORS 3
+typedef struct odp_packet_parse_result_flag_t {
+ union {
+ uint64_t all;
+
+ struct {
+ uint64_t has_error : 1;
+ uint64_t has_l2_error : 1;
+ uint64_t has_l3_error : 1;
+ uint64_t has_l4_error : 1;
+ uint64_t has_l2 : 1;
+ uint64_t has_l3 : 1;
+ uint64_t has_l4 : 1;
+ uint64_t has_eth : 1;
+ uint64_t has_eth_bcast : 1;
+ uint64_t has_eth_mcast : 1;
+ uint64_t has_jumbo : 1;
+ uint64_t has_vlan : 1;
+ uint64_t has_vlan_qinq : 1;
+ uint64_t has_arp : 1;
+ uint64_t has_ipv4 : 1;
+ uint64_t has_ipv6 : 1;
+ uint64_t has_ip_bcast : 1;
+ uint64_t has_ip_mcast : 1;
+ uint64_t has_ipfrag : 1;
+ uint64_t has_ipopt : 1;
+ uint64_t has_ipsec : 1;
+ uint64_t has_udp : 1;
+ uint64_t has_tcp : 1;
+ uint64_t has_sctp : 1;
+ uint64_t has_icmp : 1;
+ };
+ };
+
+} odp_packet_parse_result_flag_t;
+
#include <odp/api/plat/packet_inlines.h>
/**