API Reference Manual
1.46.0
|
Packet input classification.
Data Structures | |
union | odp_cls_pmr_terms_t |
Supported PMR term values. More... | |
struct | odp_pmr_param_t |
Packet Matching Rule parameter structure. More... | |
struct | odp_pmr_create_opt_t |
Packet Matching Rule creation options. More... | |
struct | odp_red_param_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 threshold values. More... | |
struct | odp_bp_param_t |
Back pressure (BP) When back pressure is enabled for a particular flow, the HW can send back pressure information to the remote peer indicating a network congestion. More... | |
struct | odp_cls_cos_stats_t |
Classifier CoS specific statistics counters. More... | |
struct | odp_cls_queue_stats_t |
Classifier queue specific statistics counters. More... | |
struct | odp_cls_stats_capability_t |
Classifier statistics capabilities. More... | |
struct | odp_cls_capability_t |
Classification capabilities This capability structure defines system level classification capability. More... | |
struct | odp_cls_cos_param |
Class of service parameters Used to communicate class of service creation options. More... | |
Macros | |
#define | ODP_COS_INVALID ((odp_cos_t)0) |
Invalid class of service handle. | |
#define | ODP_PMR_INVALID ((odp_pmr_t)0) |
Invalid packet matching rule handle. | |
#define | ODP_COS_NAME_LEN 32 |
Maximum class of service name length, including the null character. | |
Typedefs | |
typedef _odp_abi_cos_t * | odp_cos_t |
Class of service handle. | |
typedef _odp_abi_pmr_t * | odp_pmr_t |
Packet matching rule handle. | |
typedef union odp_cls_pmr_terms_t | odp_cls_pmr_terms_t |
Supported PMR term values. More... | |
typedef struct odp_pmr_param_t | odp_pmr_param_t |
Packet Matching Rule parameter structure. More... | |
typedef struct odp_pmr_create_opt_t | odp_pmr_create_opt_t |
Packet Matching Rule creation options. | |
typedef struct odp_red_param_t | odp_red_param_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 threshold values. More... | |
typedef struct odp_bp_param_t | odp_bp_param_t |
Back pressure (BP) When back pressure is enabled for a particular flow, the HW can send back pressure information to the remote peer indicating a network congestion. | |
typedef struct odp_cls_cos_stats_t | odp_cls_cos_stats_t |
Classifier CoS specific statistics counters. More... | |
typedef struct odp_cls_queue_stats_t | odp_cls_queue_stats_t |
Classifier queue specific statistics counters. More... | |
typedef struct odp_cls_stats_capability_t | odp_cls_stats_capability_t |
Classifier statistics capabilities. | |
typedef struct odp_cls_capability_t | odp_cls_capability_t |
Classification capabilities This capability structure defines system level classification capability. | |
typedef struct odp_cls_cos_param | odp_cls_cos_param_t |
Class of service parameters Used to communicate class of service creation options. | |
Enumerations | |
enum | odp_cls_pmr_term_t { ODP_PMR_LEN , ODP_PMR_ETHTYPE_0 , ODP_PMR_ETHTYPE_X , ODP_PMR_VLAN_ID_0 , ODP_PMR_VLAN_ID_X , ODP_PMR_VLAN_PCP_0 , ODP_PMR_DMAC , ODP_PMR_IPPROTO , ODP_PMR_IP_DSCP , ODP_PMR_UDP_DPORT , ODP_PMR_TCP_DPORT , ODP_PMR_UDP_SPORT , ODP_PMR_TCP_SPORT , ODP_PMR_SIP_ADDR , ODP_PMR_DIP_ADDR , ODP_PMR_SIP6_ADDR , ODP_PMR_DIP6_ADDR , ODP_PMR_IPSEC_SPI , ODP_PMR_LD_VNI , ODP_PMR_CUSTOM_FRAME , ODP_PMR_CUSTOM_L3 , ODP_PMR_IGMP_GRP_ADDR , ODP_PMR_ICMP_ID , ODP_PMR_ICMP_TYPE , ODP_PMR_ICMP_CODE , ODP_PMR_SCTP_SPORT , ODP_PMR_SCTP_DPORT , ODP_PMR_GTPV1_TEID , ODP_PMR_INNER_HDR_OFF = 32 } |
Packet Matching Rule terms. More... | |
enum | odp_cos_action_t { ODP_COS_ACTION_ENQUEUE , ODP_COS_ACTION_DROP } |
Enumeration of actions for CoS. More... | |
Functions | |
void | odp_cls_cos_param_init (odp_cls_cos_param_t *param) |
Initialize class of service parameters. More... | |
int | odp_cls_capability (odp_cls_capability_t *capability) |
Query classification capabilities. More... | |
odp_cos_t | odp_cls_cos_create (const char *name, const odp_cls_cos_param_t *param) |
Create a class-of-service. More... | |
int | odp_cls_cos_create_multi (const char *name[], const odp_cls_cos_param_t param[], odp_cos_t cos[], int num) |
Create multiple class-of-services. More... | |
odp_queue_t | odp_cls_hash_result (odp_cos_t cos, odp_packet_t packet) |
Queue hash result Returns the queue within a CoS in which a particular packet will be enqueued based on the packet parameters and hash protocol field configured with the class of service. More... | |
int | odp_cos_destroy (odp_cos_t cos) |
Discard a class-of-service along with all its associated resources. More... | |
int | odp_cos_destroy_multi (odp_cos_t cos[], int num) |
Destroy multiple class-of-services. More... | |
int | odp_cos_queue_set (odp_cos_t cos, odp_queue_t queue) |
Assign a queue for a class-of-service. More... | |
odp_queue_t | odp_cos_queue (odp_cos_t cos) |
Get the queue associated with the specific class-of-service. More... | |
uint32_t | odp_cls_cos_num_queue (odp_cos_t cos) |
Get the number of queues linked with the specific class-of-service. More... | |
uint32_t | odp_cls_cos_queues (odp_cos_t cos, odp_queue_t queue[], uint32_t num) |
Get the list of queue associated with the specific class-of-service. More... | |
int | odp_cls_cos_stats (odp_cos_t cos, odp_cls_cos_stats_t *stats) |
Get statistics for a CoS. More... | |
int | odp_cls_queue_stats (odp_cos_t cos, odp_queue_t queue, odp_cls_queue_stats_t *stats) |
Get statistics for a queue assigned to a CoS. More... | |
void | odp_cls_pmr_param_init (odp_pmr_param_t *param) |
Initialize packet matching rule parameters. More... | |
void | odp_cls_pmr_create_opt_init (odp_pmr_create_opt_t *opt) |
Initialize packet matching rule creation option. More... | |
odp_pmr_t | odp_cls_pmr_create (const odp_pmr_param_t *terms, int num_terms, odp_cos_t src_cos, odp_cos_t dst_cos) |
Create Packet Matching Rule (PMR) More... | |
odp_pmr_t | odp_cls_pmr_create_opt (const odp_pmr_create_opt_t *opt, odp_cos_t src_cos, odp_cos_t dst_cos) |
Create a packet matching rule with options. More... | |
int | odp_cls_pmr_create_multi (const odp_pmr_create_opt_t opt[], odp_cos_t src_cos[], odp_cos_t dst_cos[], odp_pmr_t pmr[], int num) |
Create multiple packet matching rules. More... | |
int | odp_cls_pmr_destroy (odp_pmr_t pmr) |
Function to destroy a packet match rule. More... | |
int | odp_cls_pmr_destroy_multi (odp_pmr_t pmr[], int num) |
Destroy multiple packet matching rules. More... | |
int | odp_cls_cos_pool_set (odp_cos_t cos, odp_pool_t pool_id) |
Assigns a packet pool for a specific class of service. More... | |
odp_pool_t | odp_cls_cos_pool (odp_cos_t cos) |
Get the pool associated with the given class of service. More... | |
uint64_t | odp_cos_to_u64 (odp_cos_t cos) |
Get printable value for an odp_cos_t. More... | |
uint64_t | odp_pmr_to_u64 (odp_pmr_t pmr) |
Get printable value for an odp_pmr_t. More... | |
void | odp_cls_print_all (void) |
Print classifier info. More... | |
typedef union odp_cls_pmr_terms_t odp_cls_pmr_terms_t |
Supported PMR term values.
Supported Packet Matching Rule term values in a bit field structure.
typedef struct odp_pmr_param_t odp_pmr_param_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_red_param_t odp_red_param_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 threshold values.
RED is enabled when 'red_enable' boolean is true and the resource usage is equal to or greater than the minimum threshold value. Resource usage could be defined either as the percentage of pool being full or the number of packets/bytes occupied in the queue depending on the platform capabilities.
When RED is enabled for a particular flow then further incoming packets are assigned a drop probability based on the size of the pool/queue.
Drop probability is configured as follows
RED is logically configured in the CoS and could be implemented in either pool or queue linked to the CoS depending on platform capabilities. Application should make sure not to link multiple CoS with different RED or BP configuration to the same queue or pool.
typedef struct odp_cls_cos_stats_t odp_cls_cos_stats_t |
Classifier CoS specific statistics counters.
Counters are incremented per packet classified to the CoS. In a CoS chain, counters are incremented in every CoS for which counters are enabled.
typedef struct odp_cls_queue_stats_t odp_cls_queue_stats_t |
Classifier queue specific statistics counters.
Counters are incremented per packet destined to the queue per originating CoS. Note that a single queue can be a destination for multiple CoS's.
enum odp_cls_pmr_term_t |
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.
Definition at line 68 of file api/spec/classification.h.
enum odp_cos_action_t |
Enumeration of actions for CoS.
Definition at line 593 of file api/spec/classification.h.
void odp_cls_cos_param_init | ( | odp_cls_cos_param_t * | param | ) |
Initialize class of service parameters.
Initialize an odp_cls_cos_param_t to its default value for all fields
param | Address of the odp_cls_cos_param_t to be initialized |
int odp_cls_capability | ( | odp_cls_capability_t * | capability | ) |
Query classification capabilities.
Outputs classification capabilities on success.
[out] | capability | Pointer to classification capability structure. |
0 | on success |
<0 | on failure |
odp_cos_t odp_cls_cos_create | ( | const char * | name, |
const odp_cls_cos_param_t * | param | ||
) |
Create a class-of-service.
Depending on the action parameter, packets to the CoS are either enqueued to a destination queue, or dropped.
The use of class-of-service name is optional. Unique names are not required. Use odp_cls_cos_param_init() to initialize parameters into their default values.
name | Name of the class-of-service or NULL. Maximum string length is ODP_COS_NAME_LEN, including the null character. |
param | Class-of-service parameters |
Class-of-service | handle |
ODP_COS_INVALID | on failure. |
int odp_cls_cos_create_multi | ( | const char * | name[], |
const odp_cls_cos_param_t | param[], | ||
odp_cos_t | cos[], | ||
int | num | ||
) |
Create multiple class-of-services.
Otherwise like odp_cls_cos_create(), but creates multiple CoSes with a single call. The output CoS handles are written in the same order as input parameters. A single odp_cls_cos_create_multi() call is equivalent to calling odp_cls_cos_create() 'num' times in row.
Each parameter array must contain 'num' elements with the exception that 'name' array may also be NULL.
name | Array of CoS name pointers or NULL. NULL is also valid CoS name pointer value. | |
param | Array of CoS parameters | |
[out] | cos | Array of CoS handles for output |
num | Number of CoSes to create |
<0 | on failure |
odp_queue_t odp_cls_hash_result | ( | odp_cos_t | cos, |
odp_packet_t | packet | ||
) |
Queue hash result Returns the queue within a CoS in which a particular packet will be enqueued based on the packet parameters and hash protocol field configured with the class of service.
cos | CoS handle |
packet | Packet handle |
Returns | the queue handle on which this packet will be enqueued. |
ODP_QUEUE_INVALID | for error case |
int odp_cos_destroy | ( | odp_cos_t | cos | ) |
Discard a class-of-service along with all its associated resources.
Before destroying a CoS, all the PMRs referring to the CoS (as a source or destination CoS) must be destroyed first. Also, the CoS must not be in use as the default CoS in any pktio (see odp_pktio_default_cos_set()) or as the destination CoS of any IPsec SA.
cos | CoS handle |
0 | on success |
<0 | on failure |
int odp_cos_destroy_multi | ( | odp_cos_t | cos[], |
int | num | ||
) |
Destroy multiple class-of-services.
Otherwise like odp_cos_destroy(), but destroys multiple CoSes with a single call.
cos | Array of CoS handles |
num | Number of CoSes to destroy |
Number | of CoSes actually destroyed (1 ... num) |
<0 | on failure |
int odp_cos_queue_set | ( | odp_cos_t | cos, |
odp_queue_t | queue | ||
) |
Assign a queue for a class-of-service.
Action of the given CoS may not be ODP_COS_ACTION_DROP.
cos | CoS handle |
queue | Handle of the queue where all packets of this specific class of service will be enqueued. Must not be ODP_QUEUE_INVALID. |
0 | on success |
<0 | on failure |
odp_queue_t odp_cos_queue | ( | odp_cos_t | cos | ) |
Get the queue associated with the specific class-of-service.
cos | CoS handle |
Queue | handle associated with the given class-of-service |
ODP_QUEUE_INVALID | on failure, or if there are multiple queues, or if the CoS action is ODP_COS_ACTION_DROP. |
uint32_t odp_cls_cos_num_queue | ( | odp_cos_t | cos | ) |
Get the number of queues linked with the specific class-of-service.
cos | CoS handle |
uint32_t odp_cls_cos_queues | ( | odp_cos_t | cos, |
odp_queue_t | queue[], | ||
uint32_t | num | ||
) |
Get the list of queue associated with the specific class-of-service.
cos | CoS handle | |
[out] | queue | Array of queue handles associated with the class-of-service. |
num | Maximum number of queue handles to output. |
0 | on failure |
int odp_cls_cos_stats | ( | odp_cos_t | cos, |
odp_cls_cos_stats_t * | stats | ||
) |
Get statistics for a CoS.
The statistics counters are incremented for packets classified to the given CoS.
Counters that are not supported are set to zero.
It's implementation defined if odp_pktio_stats_reset() call affects these counters.
cos | CoS handle | |
[out] | stats | Statistics structure for output |
0 | on success |
<0 | on failure |
int odp_cls_queue_stats | ( | odp_cos_t | cos, |
odp_queue_t | queue, | ||
odp_cls_queue_stats_t * | stats | ||
) |
Get statistics for a queue assigned to a CoS.
The statistics counters are incremented only for packets originating from the given CoS. Queue handles can be requested with odp_cos_queue() and odp_cls_cos_queues().
Counters not supported by the queue are set to zero.
It's implementation defined if odp_pktio_stats_reset() call affects these counters.
cos | CoS handle | |
queue | Queue handle | |
[out] | stats | Statistics structure for output |
0 | on success |
<0 | on failure |
void odp_cls_pmr_param_init | ( | odp_pmr_param_t * | param | ) |
Initialize packet matching rule parameters.
Initialize an odp_pmr_param_t to its default values for all fields
param | Address of the odp_pmr_param_t to be initialized |
void odp_cls_pmr_create_opt_init | ( | odp_pmr_create_opt_t * | opt | ) |
Initialize packet matching rule creation option.
Initialize an odp_pmr_create_opt_t to its default values for all fields
opt | Address of the odp_pmr_create_opt_t to be initialized |
odp_pmr_t odp_cls_pmr_create | ( | const odp_pmr_param_t * | terms, |
int | num_terms, | ||
odp_cos_t | src_cos, | ||
odp_cos_t | dst_cos | ||
) |
Create Packet Matching Rule (PMR)
Creates a PMR between source and destination Class of Service (CoS). A packet arriving to a CoS is matched against all the PMRs that define it as their source CoS. A PMR match moves the packet from the source to the destination CoS. If multiple PMRs of a CoS match with the packet, it is implementation specific which PMR is selected.
A composite PMR is created when PMR parameters define more than one term. A composite PMR is considered to match only if a packet matches with all its terms. It is implementation specific which term combinations are supported as composite PMRs. When creating a composite PMR, application should check the return value and perform appropriate fallback actions if the create call returns failure. See odp_cls_capability_t::max_pmr and odp_cls_capability_t::max_terms_per_pmr for related capabilities.
Use odp_cls_pmr_param_init() to initialize parameters into their default values.
PMRs created with this function are equivant to PMRs created through odp_cls_pmr_create_opt() with the same PMR terms and with all additional options set to their default values (e.g. CLS mark is set to zero in all matching packets).
terms | Array of odp_pmr_param_t entries, one entry per term |
num_terms | Number of terms in the PMR. |
src_cos | source CoS handle |
dst_cos | destination CoS handle |
ODP_PMR_INVALID | on failure |
odp_pmr_t odp_cls_pmr_create_opt | ( | const odp_pmr_create_opt_t * | opt, |
odp_cos_t | src_cos, | ||
odp_cos_t | dst_cos | ||
) |
Create a packet matching rule with options.
Similar to odp_cls_pmr_create() function with additional PMR creation options specified through odp_pmr_create_opt_t.
Use odp_cls_pmr_create_opt_init() to initialize options into their default values.
opt | points to PMR create options |
src_cos | source CoS handle |
dst_cos | destination CoS handle |
ODP_PMR_INVALID | on failure |
int odp_cls_pmr_create_multi | ( | const odp_pmr_create_opt_t | opt[], |
odp_cos_t | src_cos[], | ||
odp_cos_t | dst_cos[], | ||
odp_pmr_t | pmr[], | ||
int | num | ||
) |
Create multiple packet matching rules.
Otherwise like odp_cls_pmr_create_opt(), but creates multiple rules with a single call. The output PMR handles are written in the same order as input parameters. A single odp_cls_pmr_create_multi() call is equivalent to calling odp_cls_pmr_create_opt() 'num' times in row.
Each parameter array must contain 'num' elements.
opt | Array of PMR create options | |
src_cos | Array of source CoS handles | |
dst_cos | Array of destination CoS handles | |
[out] | pmr | Array of PMR handles for output |
num | Number of packet matching rules to create |
<0 | on failure |
int odp_cls_pmr_destroy | ( | odp_pmr_t | pmr | ) |
Function to destroy a packet match rule.
Destroying a PMR removes the link between the source and destination class of service and this PMR will no longer be applied for packets arriving at the source class of service. All the resources associated with the PMR will be released but the class of service will remain intact.
Depending on the implementation details, destroying a composite rule may not guarantee the availability of hardware resources to create the same or essentially similar rule.
pmr | Handle of the PMR to be destroyed |
0 | on success |
<0 | on failure |
int odp_cls_pmr_destroy_multi | ( | odp_pmr_t | pmr[], |
int | num | ||
) |
Destroy multiple packet matching rules.
Otherwise like odp_cls_pmr_destroy(), but destroys multiple PMRs with a single call.
pmr | Array of PMR handles |
num | Number of PMRs to destroy |
Number | of PMRs actually destroyed (1 ... num) |
<0 | on failure |
int odp_cls_cos_pool_set | ( | odp_cos_t | cos, |
odp_pool_t | pool_id | ||
) |
Assigns a packet pool for a specific class of service.
All the packets belonging to the given class of service will be allocated from the assigned packet pool. The packet pool associated with class of service will supersede the packet pool associated with the pktio interface.
cos | CoS handle |
pool_id | Packet pool handle |
0 | on success |
<0 | on failure |
odp_pool_t odp_cls_cos_pool | ( | odp_cos_t | cos | ) |
Get the pool associated with the given class of service.
cos | CoS handle |
pool | handle of the associated pool |
ODP_POOL_INVALID | on failure, or if the pool has not been set |
uint64_t odp_cos_to_u64 | ( | odp_cos_t | cos | ) |
Get printable value for an odp_cos_t.
cos | CoS handle to be printed |
uint64_t odp_pmr_to_u64 | ( | odp_pmr_t | pmr | ) |
Get printable value for an odp_pmr_t.
pmr | odp_pmr_t handle to be printed |
void odp_cls_print_all | ( | void | ) |
Print classifier info.
Print implementation defined information about classifier. The information is intended to be used for debugging.