aboutsummaryrefslogtreecommitdiff
path: root/include/odp/api/spec/classification.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/odp/api/spec/classification.h')
-rw-r--r--include/odp/api/spec/classification.h485
1 files changed, 248 insertions, 237 deletions
diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h
index 1c76ea192..f36826058 100644
--- a/include/odp/api/spec/classification.h
+++ b/include/odp/api/spec/classification.h
@@ -11,8 +11,8 @@
* ODP classification descriptor
*/
-#ifndef ODP_API_SPEC_CLASSIFY_H_
-#define ODP_API_SPEC_CLASSIFY_H_
+#ifndef ODP_API_SPEC_CLASSIFICATION_H_
+#define ODP_API_SPEC_CLASSIFICATION_H_
#include <odp/visibility_begin.h>
#ifdef __cplusplus
@@ -23,6 +23,7 @@ extern "C" {
#include <odp/api/pool_types.h>
#include <odp/api/std_types.h>
#include <odp/api/threshold.h>
+#include <odp/api/deprecated.h>
/** @defgroup odp_classification ODP CLASSIFICATION
* Packet input classification.
@@ -30,26 +31,171 @@ extern "C" {
*/
/**
+ * @typedef odp_pmr_t
+ * Packet matching rule handle
+ */
+
+/**
+ * @def ODP_PMR_INVALID
+ * Invalid packet matching rule handle
+ */
+
+/**
* @typedef odp_cos_t
- * ODP Class of service handle
+ * Class of service handle
*/
/**
* @def ODP_COS_INVALID
- * This value is returned from odp_cls_cos_create() on failure.
+ * Invalid class of service handle
*/
/**
* @def ODP_COS_NAME_LEN
- * Maximum ClassOfService name length in chars including null char
+ * Maximum class of service name length in chars including null char
*/
/**
- * @def ODP_PMR_INVALID
- * Invalid odp_pmr_t value.
- * This value is returned from odp_cls_pmr_create()
- * function on failure.
+ * Packet Matching Rule terms
+ *
+ * This enumeration selects the protocol field that is matched against PMR
+ * value/mask or value range. Protocol field values and masks are passed in big
+ * endian (network endian) format. However, ODP_PMR_LEN value and range are
+ * passed in CPU native endian (uint32_t words), as the term does not represent
+ * a protocol field.
+ *
+ * PMR value/mask data size is term specific. This size must be set into val_sz
+ * field of odp_pmr_param_t. There is no alignment requirement for PMR
+ * value/mask data.
*/
+typedef enum {
+ /** Total length of received packet. Exceptionally, value and mask are
+ * uint32_t (val_sz = 4) in CPU endian. */
+ ODP_PMR_LEN,
+
+ /** Initial (outer) Ethertype only (val_sz = 2)
+ *
+ * PMR matches Ethertype field when packet does not have VLAN headers. When there are
+ * VLAN headers, it matches Tag protocol identifier (TPID) field of the first VLAN header.
+ * I.e. it matches a field in the same offset from the start of the packet in both cases.
+ */
+ ODP_PMR_ETHTYPE_0,
+
+ /** Ethertype of most inner VLAN tag (val_sz = 2) */
+ ODP_PMR_ETHTYPE_X,
+
+ /** First (outer) VLAN ID (val_sz = 2)
+ *
+ * VLAN ID value and mask are stored into 12 least significant bits of a 16-bit word.
+ * The word is passed in big endian format.
+ */
+ ODP_PMR_VLAN_ID_0,
+
+ /** Last (most inner) VLAN ID (val_sz = 2)
+ *
+ * VLAN ID value and mask are stored into 12 least significant bits of a 16-bit word.
+ * The word is passed in big endian format.
+ */
+ ODP_PMR_VLAN_ID_X,
+
+ /** PCP bits in the first (outer) VLAN header (val_sz = 1)
+ *
+ * Priority Code Point (PCP) value is stored into three least significant bits of
+ * the octet pointed by odp_pmr_param_t::value. The same applies for odp_pmr_param_t::mask.
+ */
+ ODP_PMR_VLAN_PCP_0,
+
+ /** Destination MAC address (val_sz = 6) */
+ ODP_PMR_DMAC,
+
+ /** IPv4 Protocol or IPv6 Next Header (val_sz = 1) */
+ ODP_PMR_IPPROTO,
+
+ /** Differentiated Services Code Point (DSCP) bits in IPv4 or IPv6 header (val_sz = 1)
+ *
+ * DSCP value is stored into six least significant bits of the octet pointed by
+ * odp_pmr_param_t::value. The same applies for odp_pmr_param_t::mask.
+ */
+ ODP_PMR_IP_DSCP,
+
+ /** Destination UDP port (val_sz = 2) */
+ ODP_PMR_UDP_DPORT,
+
+ /** Destination TCP port (val_sz = 2) */
+ ODP_PMR_TCP_DPORT,
+
+ /** Source UDP port (val_sz = 2) */
+ ODP_PMR_UDP_SPORT,
+
+ /** Source TCP port (val_sz = 2) */
+ ODP_PMR_TCP_SPORT,
+
+ /** Source IPv4 address (val_sz = 4) */
+ ODP_PMR_SIP_ADDR,
+
+ /** Destination IPv4 address (val_sz = 4) */
+ ODP_PMR_DIP_ADDR,
+
+ /** Source IPv6 address (val_sz = 16) */
+ ODP_PMR_SIP6_ADDR,
+
+ /** Destination IPv6 address (val_sz = 16) */
+ ODP_PMR_DIP6_ADDR,
+
+ /** IPsec session identifier (val_sz = 4)*/
+ ODP_PMR_IPSEC_SPI,
+
+ /** NVGRE/VXLAN network identifier (val_sz = 4) */
+ ODP_PMR_LD_VNI,
+
+ /**
+ * Custom frame match rule
+ *
+ * PMR offset is counted from the start of the packet. The match is
+ * defined by the offset, the expected value, and its size. Custom frame
+ * rules must be applied before any other PMR.
+ */
+ ODP_PMR_CUSTOM_FRAME,
+
+ /**
+ * Custom layer 3 match rule
+ *
+ * PMR offset is counted from the start of layer 3 in the packet.
+ * The match is defined by the offset, the expected value, and its size.
+ * Custom L3 rules may be combined with other PMRs.
+ */
+ ODP_PMR_CUSTOM_L3,
+
+ /** IGMP Group address (val_sz = 4), implies IPPROTO=2 */
+ ODP_PMR_IGMP_GRP_ADDR,
+
+ /** ICMP identifier (val_sz = 2), implies IPPROTO=1 and ICMP_TYPE=0 or ICMP_TYPE=8 */
+ ODP_PMR_ICMP_ID,
+
+ /** ICMP type (val_sz = 1), implies IPPROTO=1 */
+ ODP_PMR_ICMP_TYPE,
+
+ /** ICMP code (val_sz = 1), implies IPPROTO=1 */
+ ODP_PMR_ICMP_CODE,
+
+ /** Source SCTP port (val_sz = 2), implies IPPROTO=132 */
+ ODP_PMR_SCTP_SPORT,
+
+ /** Destination SCTP port (val_sz = 2), implies IPPROTO=132 */
+ ODP_PMR_SCTP_DPORT,
+
+ /** GTPv1 tunnel endpoint identifier (val_sz = 4)
+ *
+ * Matches if and only if IP protocol is UDP, UDP destination port
+ * is 2152 and the UDP payload interpreted as GTP header has GTP
+ * version 1 and TEID as specified.
+ */
+ ODP_PMR_GTPV1_TEID,
+
+ /** Inner header may repeat above values with this offset */
+ ODP_PMR_INNER_HDR_OFF = 32
+
+} odp_cls_pmr_term_t;
/**
* Supported PMR term values
@@ -69,10 +215,14 @@ typedef union odp_cls_pmr_terms_t {
uint64_t vlan_id_0:1;
/** Last VLAN ID (inner) */
uint64_t vlan_id_x:1;
+ /** PCP in the first VLAN header (#ODP_PMR_VLAN_PCP_0) */
+ uint64_t vlan_pcp_0:1;
/** destination MAC address */
uint64_t dmac:1;
/** IP Protocol or IPv6 Next Header */
uint64_t ip_proto:1;
+ /** DSCP in IP header (#ODP_PMR_IP_DSCP) */
+ uint64_t ip_dscp:1;
/** Destination UDP port, implies IPPROTO=17 */
uint64_t udp_dport:1;
/** Destination TCP port implies IPPROTO=6 */
@@ -114,10 +264,89 @@ typedef union odp_cls_pmr_terms_t {
/** GTPv1 tunnel endpoint identifier */
uint64_t gtpv1_teid:1;
} bit;
+
/** All bits of the bit field structure */
uint64_t all_bits;
+
} odp_cls_pmr_terms_t;
+/**
+ * Packet Matching Rule parameter structure
+ *
+ * Match value/mask size and endianness are defined in PMR term documentation
+ * (@see odp_cls_pmr_term_t). Most values and masks are passed in big
+ * endian format without data alignment requirement. ODP_PMR_LEN is
+ * an exception to this (uint32_t in CPU endian).
+ */
+typedef struct odp_pmr_param_t {
+ /** Packet Matching Rule term */
+ odp_cls_pmr_term_t term;
+
+ /** True if the value is range and false if match. Default is false. */
+ odp_bool_t range_term;
+
+ /** Variant mappings for types of matches */
+ union {
+ /** Parameters for single-valued matches */
+ struct {
+ /** Points to the value to be matched. Value size and
+ * endianness are defined by the term used. Values of
+ * protocol fields are defined in big endian format.
+ */
+ const void *value;
+
+ /** Mask of the bits to be matched. The same size and
+ * endianness is used than with the value. */
+ const void *mask;
+ } match;
+
+ /** Parameter for range value matches */
+ struct {
+ /** Start value of the range */
+ const void *val_start;
+
+ /** End value of the range */
+ const void *val_end;
+ } range;
+ };
+
+ /** Size of the value to be matched */
+ uint32_t val_sz;
+
+ /** Offset to the value
+ *
+ * Byte offset to the value to be matched in a packet. PMR term defines
+ * starting point for the offset. Used only with custom PMR terms,
+ * ignored with other terms.
+ */
+ uint32_t offset;
+
+} odp_pmr_param_t;
+
+/**
+ * Packet Matching Rule creation options
+ */
+typedef struct odp_pmr_create_opt_t {
+ /** PMR terms
+ *
+ * Array of odp_pmr_param_t entries, one entry per term desired.
+ * Use odp_cls_pmr_param_init() to initialize parameters into their default values.
+ */
+ odp_pmr_param_t *terms;
+
+ /** Number of terms in the match rule. */
+ int num_terms;
+
+ /** Classification mark value
+ *
+ * Value to be set in the CLS mark of a packet when the packet matches this
+ * Packet Matching Rule. The default value is zero. The maximum value is indicated in
+ * odp_cls_capability_t::max_mark capability.
+ */
+ uint64_t mark;
+
+} odp_pmr_create_opt_t;
+
/** Random Early Detection (RED)
* Random Early Detection is enabled to initiate a drop probability for the
* incoming packet when the packets in the queue/pool cross the specified
@@ -153,6 +382,7 @@ typedef struct odp_red_param_t {
* the minimum threshold value and is disabled otherwise
*/
odp_threshold_t threshold;
+
} odp_red_param_t;
/** Back pressure (BP)
@@ -174,6 +404,7 @@ typedef struct odp_bp_param_t {
* @see odp_red_param_t for 'resource usage' documentation.
*/
odp_threshold_t threshold;
+
} odp_bp_param_t;
/**
@@ -346,28 +577,8 @@ typedef struct odp_cls_capability_t {
typedef enum {
ODP_COS_DROP_POOL, /**< Follow buffer pool drop policy */
ODP_COS_DROP_NEVER, /**< Never drop, ignoring buffer pool policy */
-} odp_cls_drop_t;
-/**
- * Packet header field enumeration
- * for fields that may be used to calculate
- * the flow signature, if present in a packet.
- */
-typedef enum {
- ODP_COS_FHDR_IN_PKTIO, /**< Ingress port number */
- ODP_COS_FHDR_L2_SAP, /**< Ethernet Source MAC address */
- ODP_COS_FHDR_L2_DAP, /**< Ethernet Destination MAC address */
- ODP_COS_FHDR_L2_VID, /**< Ethernet VLAN ID */
- ODP_COS_FHDR_L3_FLOW, /**< IPv6 flow_id */
- ODP_COS_FHDR_L3_SAP, /**< IP source address */
- ODP_COS_FHDR_L3_DAP, /**< IP destination address */
- ODP_COS_FHDR_L4_PROTO, /**< IP protocol (e.g. TCP/UDP/ICMP) */
- ODP_COS_FHDR_L4_SAP, /**< Transport source port */
- ODP_COS_FHDR_L4_DAP, /**< Transport destination port */
- ODP_COS_FHDR_IPSEC_SPI, /**< IPsec session identifier */
- ODP_COS_FHDR_LD_VNI, /**< NVGRE/VXLAN network identifier */
- ODP_COS_FHDR_USER /**< Application-specific header field(s) */
-} odp_cos_hdr_flow_fields_t;
+} odp_cls_drop_t;
/**
* Enumeration of actions for CoS.
@@ -387,6 +598,7 @@ typedef enum {
* their originating pool.
*/
ODP_COS_ACTION_DROP,
+
} odp_cos_action_t;
/**
@@ -458,6 +670,7 @@ typedef struct odp_cls_cos_param {
/** Packet input vector configuration */
odp_pktin_vector_config_t vector;
+
} odp_cls_cos_param_t;
/**
@@ -612,8 +825,9 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
odp_cos_t cos_table[]);
/**
- * Request to override per-port class of service
- * based on Layer-3 priority field if present.
+ * Request to override per-port class of service based on Layer-3 priority field if present.
+ *
+ * @deprecated Use #ODP_PMR_IP_DSCP instead.
*
* @param pktio_in Ingress port identifier.
* @param num_qos Number of allowed Layer-3 QoS levels.
@@ -624,14 +838,9 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
*
* @retval 0 on success
* @retval <0 on failure
- *
- * @note Optional.
*/
-int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
- uint32_t num_qos,
- uint8_t qos_table[],
- odp_cos_t cos_table[],
- odp_bool_t l3_preference);
+int ODP_DEPRECATE(odp_cos_with_l3_qos)(odp_pktio_t pktio_in, uint32_t num_qos, uint8_t qos_table[],
+ odp_cos_t cos_table[], odp_bool_t l3_preference);
/**
* Get statistics for a CoS
@@ -675,204 +884,6 @@ int odp_cls_queue_stats(odp_cos_t cos, odp_queue_t queue,
odp_cls_queue_stats_t *stats);
/**
- * @typedef odp_pmr_t
- * PMR - Packet Matching Rule
- * Up to 32 bit of ternary matching of one of the available header fields
- */
-
-/**
- * Packet Matching Rule terms
- *
- * This enumeration selects the protocol field that is matched against PMR
- * value/mask or value range. Protocol field values and masks are passed in big
- * endian (network endian) format. However, ODP_PMR_LEN value and range are
- * passed in CPU native endian (uint32_t words), as the term does not represent
- * a protocol field.
- *
- * PMR value/mask data size is term specific. This size must be set into val_sz
- * field of odp_pmr_param_t. There is no alignment requirement for PMR
- * value/mask data.
- */
-typedef enum {
- /** Total length of received packet. Exceptionally, value and mask are
- * uint32_t (val_sz = 4) in CPU endian. */
- ODP_PMR_LEN,
-
- /** Initial (outer) Ethertype only (val_sz = 2) */
- ODP_PMR_ETHTYPE_0,
-
- /** Ethertype of most inner VLAN tag (val_sz = 2) */
- ODP_PMR_ETHTYPE_X,
-
- /** First (outer) VLAN ID (val_sz = 2) */
- ODP_PMR_VLAN_ID_0,
-
- /** Last (most inner) VLAN ID (val_sz = 2) */
- ODP_PMR_VLAN_ID_X,
-
- /** Destination MAC address (val_sz = 6) */
- ODP_PMR_DMAC,
-
- /** IPv4 Protocol or IPv6 Next Header (val_sz = 1) */
- ODP_PMR_IPPROTO,
-
- /** Destination UDP port (val_sz = 2) */
- ODP_PMR_UDP_DPORT,
-
- /** Destination TCP port (val_sz = 2) */
- ODP_PMR_TCP_DPORT,
-
- /** Source UDP port (val_sz = 2) */
- ODP_PMR_UDP_SPORT,
-
- /** Source TCP port (val_sz = 2) */
- ODP_PMR_TCP_SPORT,
-
- /** Source IPv4 address (val_sz = 4) */
- ODP_PMR_SIP_ADDR,
-
- /** Destination IPv4 address (val_sz = 4) */
- ODP_PMR_DIP_ADDR,
-
- /** Source IPv6 address (val_sz = 16) */
- ODP_PMR_SIP6_ADDR,
-
- /** Destination IPv6 address (val_sz = 16) */
- ODP_PMR_DIP6_ADDR,
-
- /** IPsec session identifier (val_sz = 4)*/
- ODP_PMR_IPSEC_SPI,
-
- /** NVGRE/VXLAN network identifier (val_sz = 4) */
- ODP_PMR_LD_VNI,
-
- /**
- * Custom frame match rule
- *
- * PMR offset is counted from the start of the packet. The match is
- * defined by the offset, the expected value, and its size. Custom frame
- * rules must be applied before any other PMR.
- */
- ODP_PMR_CUSTOM_FRAME,
-
- /**
- * Custom layer 3 match rule
- *
- * PMR offset is counted from the start of layer 3 in the packet.
- * The match is defined by the offset, the expected value, and its size.
- * Custom L3 rules may be combined with other PMRs.
- */
- ODP_PMR_CUSTOM_L3,
-
- /** IGMP Group address (val_sz = 4), implies IPPROTO=2 */
- ODP_PMR_IGMP_GRP_ADDR,
-
- /** ICMP identifier (val_sz = 2), implies IPPROTO=1 and ICMP_TYPE=0 or ICMP_TYPE=8 */
- ODP_PMR_ICMP_ID,
-
- /** ICMP type (val_sz = 1), implies IPPROTO=1 */
- ODP_PMR_ICMP_TYPE,
-
- /** ICMP code (val_sz = 1), implies IPPROTO=1 */
- ODP_PMR_ICMP_CODE,
-
- /** Source SCTP port (val_sz = 2), implies IPPROTO=132 */
- ODP_PMR_SCTP_SPORT,
-
- /** Destination SCTP port (val_sz = 2), implies IPPROTO=132 */
- ODP_PMR_SCTP_DPORT,
-
- /** GTPv1 tunnel endpoint identifier (val_sz = 4)
- *
- * Matches if and only if IP protocol is UDP, UDP destination port
- * is 2152 and the UDP payload interpreted as GTP header has GTP
- * version 1 and TEID as specified.
- */
- ODP_PMR_GTPV1_TEID,
-
- /** Inner header may repeat above values with this offset */
- ODP_PMR_INNER_HDR_OFF = 32
-
-} odp_cls_pmr_term_t;
-
-/**
- * Packet Matching Rule parameter structure
- *
- * Match value/mask size and endianness are defined in PMR term documentation
- * (@see odp_cls_pmr_term_t). Most values and masks are passed in big
- * endian format without data alignment requirement. ODP_PMR_LEN is
- * an exception to this (uint32_t in CPU endian).
- */
-typedef struct odp_pmr_param_t {
- /** Packet Matching Rule term */
- odp_cls_pmr_term_t term;
-
- /** True if the value is range and false if match. Default is false. */
- odp_bool_t range_term;
-
- /** Variant mappings for types of matches */
- union {
- /** Parameters for single-valued matches */
- struct {
- /** Points to the value to be matched. Value size and
- * endianness are defined by the term used. Values of
- * protocol fields are defined in big endian format.
- */
- const void *value;
-
- /** Mask of the bits to be matched. The same size and
- * endianness is used than with the value. */
- const void *mask;
- } match;
-
- /** Parameter for range value matches */
- struct {
- /** Start value of the range */
- const void *val_start;
-
- /** End value of the range */
- const void *val_end;
- } range;
- };
-
- /** Size of the value to be matched */
- uint32_t val_sz;
-
- /** Offset to the value
- *
- * Byte offset to the value to be matched in a packet. PMR term defines
- * starting point for the offset. Used only with custom PMR terms,
- * ignored with other terms.
- */
- uint32_t offset;
-
-} odp_pmr_param_t;
-
-/**
- * Packet Matching Rule creation options
- */
-typedef struct odp_pmr_create_opt_t {
- /** PMR terms
- *
- * Array of odp_pmr_param_t entries, one entry per term desired.
- * Use odp_cls_pmr_param_init() to initialize parameters into their default values.
- */
- odp_pmr_param_t *terms;
-
- /** Number of terms in the match rule. */
- int num_terms;
-
- /** Classification mark value
- *
- * Value to be set in the CLS mark of a packet when the packet matches this
- * Packet Matching Rule. The default value is zero. The maximum value is indicated in
- * odp_cls_capability_t::max_mark capability.
- */
- uint64_t mark;
-
-} odp_pmr_create_opt_t;
-
-/**
* Initialize packet matching rule parameters
*
* Initialize an odp_pmr_param_t to its default values for all fields