API Reference Manual  1.45.1
api/spec/classification.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2014-2018 Linaro Limited
3  * Copyright (c) 2021-2023 Nokia
4  */
5 
12 #ifndef ODP_API_SPEC_CLASSIFICATION_H_
13 #define ODP_API_SPEC_CLASSIFICATION_H_
14 #include <odp/visibility_begin.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
21 #include <odp/api/pool_types.h>
22 #include <odp/api/std_types.h>
23 #include <odp/api/threshold.h>
24 
68 typedef enum {
72 
80 
83 
90 
97 
104 
107 
110 
117 
120 
123 
126 
129 
132 
135 
138 
141 
144 
147 
156 
165 
168 
171 
174 
177 
180 
183 
191 
194 
196 
202 typedef union odp_cls_pmr_terms_t {
204  struct {
206  uint64_t len:1;
208  uint64_t ethtype_0:1;
210  uint64_t ethtype_x:1;
212  uint64_t vlan_id_0:1;
214  uint64_t vlan_id_x:1;
216  uint64_t vlan_pcp_0:1;
218  uint64_t dmac:1;
220  uint64_t ip_proto:1;
222  uint64_t ip_dscp:1;
224  uint64_t udp_dport:1;
226  uint64_t tcp_dport:1;
228  uint64_t udp_sport:1;
230  uint64_t tcp_sport:1;
232  uint64_t sip_addr:1;
234  uint64_t dip_addr:1;
236  uint64_t sip6_addr:1;
238  uint64_t dip6_addr:1;
240  uint64_t ipsec_spi:1;
242  uint64_t ld_vni:1;
245  uint64_t custom_frame:1;
248  uint64_t custom_l3:1;
250  uint64_t igmp_grp_addr:1;
252  uint64_t icmp_id:1;
254  uint64_t icmp_type:1;
256  uint64_t icmp_code:1;
258  uint64_t sctp_sport:1;
260  uint64_t sctp_dport:1;
262  uint64_t gtpv1_teid:1;
263  } bit;
264 
266  uint64_t all_bits;
267 
269 
278 typedef struct odp_pmr_param_t {
281 
284 
286  union {
288  struct {
293  const void *value;
294 
297  const void *mask;
298  } match;
299 
301  struct {
303  const void *val_start;
304 
306  const void *val_end;
307  } range;
308  };
309 
311  uint32_t val_sz;
312 
319  uint32_t offset;
320 
322 
326 typedef struct odp_pmr_create_opt_t {
333 
336 
343  uint64_t mark;
344 
346 
370 typedef struct odp_red_param_t {
376 
382 
384 
389 typedef struct odp_bp_param_t {
396 
404 
412  uint8_t pfc_level;
413 
415 
422 typedef struct odp_cls_cos_stats_t {
425  uint64_t octets;
426 
429  uint64_t packets;
430 
433  uint64_t discards;
434 
436  uint64_t errors;
437 
439 
446 typedef struct odp_cls_queue_stats_t {
449  uint64_t octets;
450 
452  uint64_t packets;
453 
456  uint64_t discards;
457 
460  uint64_t errors;
461 
463 
469  struct {
471  union {
473  struct {
475  uint64_t octets : 1;
476 
478  uint64_t packets : 1;
479 
481  uint64_t discards : 1;
482 
484  uint64_t errors : 1;
485 
487 
492  uint64_t all_counters;
493  };
494  } cos;
495 
497  struct {
499  union {
501  struct {
503  uint64_t octets : 1;
504 
506  uint64_t packets : 1;
507 
509  uint64_t discards : 1;
510 
512  uint64_t errors : 1;
513 
515 
520  uint64_t all_counters;
521  };
522  } queue;
523 
525 
530 typedef struct odp_cls_capability_t {
535 
541  uint32_t max_pmr;
542 
544  uint32_t max_pmr_per_cos;
545 
548 
550  uint32_t max_cos;
551 
557  uint32_t max_cos_stats;
558 
562  uint32_t max_hash_queues;
563 
566 
569 
572 
575 
578 
581 
583  uint64_t max_mark;
584 
587 
589 
593 typedef enum {
600 
608 
610 
615 typedef struct odp_cls_cos_param {
628 
635 
648  uint32_t num_queue;
649 
651  union {
656 
659  struct {
662 
666  };
667  };
678 
681 
684 
687 
689 
698 
710 
728 odp_cos_t odp_cls_cos_create(const char *name,
729  const odp_cls_cos_param_t *param);
730 
751 int odp_cls_cos_create_multi(const char *name[],
752  const odp_cls_cos_param_t param[],
753  odp_cos_t cos[], int num);
754 
770 
785 
798 int odp_cos_destroy_multi(odp_cos_t cos[], int num);
799 
814 
825 
834 
846 uint32_t odp_cls_cos_queues(odp_cos_t cos, odp_queue_t queue[], uint32_t num);
847 
866 
887  odp_cls_queue_stats_t *stats);
888 
897 
906 
936 odp_pmr_t odp_cls_pmr_create(const odp_pmr_param_t *terms, int num_terms,
937  odp_cos_t src_cos, odp_cos_t dst_cos);
938 
957  odp_cos_t src_cos, odp_cos_t dst_cos);
958 
979  odp_cos_t src_cos[], odp_cos_t dst_cos[],
980  odp_pmr_t pmr[], int num);
981 
1000 
1014 
1030 
1040 
1053 
1066 
1074 
1079 #ifdef __cplusplus
1080 }
1081 #endif
1082 
1083 #include <odp/visibility_end.h>
1084 #endif
ODP Packet IO.
ODP pool.
Standard C language types and definitions for ODP.
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.
int odp_cls_cos_stats(odp_cos_t cos, odp_cls_cos_stats_t *stats)
Get statistics for a CoS.
uint64_t odp_pmr_to_u64(odp_pmr_t pmr)
Get printable value for an odp_pmr_t.
union odp_cls_pmr_terms_t odp_cls_pmr_terms_t
Supported PMR term values.
struct odp_pmr_param_t odp_pmr_param_t
Packet Matching Rule parameter structure.
struct odp_cls_queue_stats_t odp_cls_queue_stats_t
Classifier queue specific statistics counters.
int odp_cos_queue_set(odp_cos_t cos, odp_queue_t queue)
Assign a queue for a class-of-service.
uint32_t odp_cls_cos_num_queue(odp_cos_t cos)
Get the number of queues linked with the specific class-of-service.
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.
int odp_cos_destroy(odp_cos_t cos)
Discard a class-of-service along with all its associated resources.
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 ...
void odp_cls_pmr_create_opt_init(odp_pmr_create_opt_t *opt)
Initialize packet matching rule creation option.
struct odp_cls_stats_capability_t odp_cls_stats_capability_t
Classifier statistics capabilities.
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)
int odp_cos_destroy_multi(odp_cos_t cos[], int num)
Destroy multiple class-of-services.
int odp_cls_capability(odp_cls_capability_t *capability)
Query classification capabilities.
struct odp_cls_capability_t odp_cls_capability_t
Classification capabilities This capability structure defines system level classification capability.
uint64_t odp_cos_to_u64(odp_cos_t cos)
Get printable value for an odp_cos_t.
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...
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.
odp_cls_pmr_term_t
Packet Matching Rule terms.
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...
int odp_cls_pmr_destroy_multi(odp_pmr_t pmr[], int num)
Destroy multiple packet matching rules.
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.
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.
struct odp_cls_cos_param odp_cls_cos_param_t
Class of service parameters Used to communicate class of service creation options.
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.
void odp_cls_print_all(void)
Print classifier info.
int odp_cls_pmr_destroy(odp_pmr_t pmr)
Function to destroy a packet match rule.
odp_cos_action_t
Enumeration of actions for CoS.
odp_cos_t odp_cls_cos_create(const char *name, const odp_cls_cos_param_t *param)
Create a class-of-service.
void odp_cls_cos_param_init(odp_cls_cos_param_t *param)
Initialize class of service parameters.
odp_queue_t odp_cos_queue(odp_cos_t cos)
Get the queue associated with the specific class-of-service.
void odp_cls_pmr_param_init(odp_pmr_param_t *param)
Initialize packet matching rule parameters.
odp_pool_t odp_cls_cos_pool(odp_cos_t cos)
Get the pool associated with the given class of service.
struct odp_pmr_create_opt_t odp_pmr_create_opt_t
Packet Matching Rule creation options.
struct odp_cls_cos_stats_t odp_cls_cos_stats_t
Classifier CoS specific statistics counters.
@ ODP_PMR_IGMP_GRP_ADDR
IGMP Group address (val_sz = 4), implies IPPROTO=2.
@ ODP_PMR_TCP_DPORT
Destination TCP port (val_sz = 2)
@ ODP_PMR_ETHTYPE_0
Initial (outer) Ethertype only (val_sz = 2)
@ ODP_PMR_VLAN_PCP_0
PCP bits in the first (outer) VLAN header (val_sz = 1)
@ ODP_PMR_ICMP_TYPE
ICMP type (val_sz = 1), implies IPPROTO=1.
@ ODP_PMR_SIP_ADDR
Source IPv4 address (val_sz = 4)
@ ODP_PMR_DIP_ADDR
Destination IPv4 address (val_sz = 4)
@ ODP_PMR_SCTP_SPORT
Source SCTP port (val_sz = 2), implies IPPROTO=132.
@ ODP_PMR_TCP_SPORT
Source TCP port (val_sz = 2)
@ ODP_PMR_IPPROTO
IPv4 Protocol or IPv6 Next Header (val_sz = 1)
@ ODP_PMR_LD_VNI
NVGRE/VXLAN network identifier (val_sz = 4)
@ ODP_PMR_VLAN_ID_X
Last (most inner) VLAN ID (val_sz = 2)
@ ODP_PMR_GTPV1_TEID
GTPv1 tunnel endpoint identifier (val_sz = 4)
@ ODP_PMR_DIP6_ADDR
Destination IPv6 address (val_sz = 16)
@ ODP_PMR_SCTP_DPORT
Destination SCTP port (val_sz = 2), implies IPPROTO=132.
@ ODP_PMR_CUSTOM_FRAME
Custom frame match rule.
@ ODP_PMR_IPSEC_SPI
IPsec session identifier (val_sz = 4)
@ ODP_PMR_UDP_SPORT
Source UDP port (val_sz = 2)
@ ODP_PMR_VLAN_ID_0
First (outer) VLAN ID (val_sz = 2)
@ ODP_PMR_ICMP_ID
ICMP identifier (val_sz = 2), implies IPPROTO=1 and ICMP_TYPE=0 or ICMP_TYPE=8.
@ ODP_PMR_ICMP_CODE
ICMP code (val_sz = 1), implies IPPROTO=1.
@ ODP_PMR_UDP_DPORT
Destination UDP port (val_sz = 2)
@ ODP_PMR_LEN
Total length of received packet.
@ ODP_PMR_DMAC
Destination MAC address (val_sz = 6)
@ ODP_PMR_SIP6_ADDR
Source IPv6 address (val_sz = 16)
@ ODP_PMR_ETHTYPE_X
Ethertype of most inner VLAN tag (val_sz = 2)
@ ODP_PMR_INNER_HDR_OFF
Inner header may repeat above values with this offset.
@ ODP_PMR_CUSTOM_L3
Custom layer 3 match rule.
@ ODP_PMR_IP_DSCP
Differentiated Services Code Point (DSCP) bits in IPv4 or IPv6 header (val_sz = 1)
@ ODP_COS_ACTION_DROP
Drop packet.
@ ODP_COS_ACTION_ENQUEUE
Enqueue packet.
bool odp_bool_t
Boolean type.
odp_support_t
ODP support.
Dummy type for strong typing.
Back pressure (BP) When back pressure is enabled for a particular flow, the HW can send back pressure...
odp_bool_t enable
A boolean to enable Back pressure When true, back pressure is enabled and configured with the BP para...
odp_threshold_t threshold
Threshold value for back pressure.
uint8_t pfc_level
PFC priority level.
Classification capabilities This capability structure defines system level classification capability.
uint32_t max_pmr
Maximum number of single-term PMRs.
uint64_t max_mark
Maximum value of odp_pmr_create_opt_t::mark.
uint32_t max_hash_queues
Maximum number of queues supported per CoS.
odp_threshold_types_t threshold_red
Supported threshold type for RED.
odp_support_t back_pressure
Support for Back Pressure to the remote peer.
uint32_t max_terms_per_pmr
Maximum number of terms per composite PMR.
odp_threshold_types_t threshold_bp
Supported threshold type for BP.
odp_cls_pmr_terms_t supported_terms
PMR terms supported by the classifier.
uint32_t max_cos
Maximum number of CoS supported.
odp_support_t random_early_detection
Support for Random Early Detection.
odp_pktin_hash_proto_t hash_protocols
Protocol header combination supported for Hashing.
uint32_t max_cos_stats
Maximum number of concurrent CoS stats.
odp_bool_t pmr_range_supported
A Boolean to denote support of PMR range.
uint32_t max_pmr_per_cos
Maximum number of PMRs per CoS.
odp_cls_stats_capability_t stats
Statistics counters capabilities.
Class of service parameters Used to communicate class of service creation options.
odp_queue_t queue
Mapping used when num_queue = 1, hashing is disabled in this case and application has to configure th...
odp_pool_t pool
Pool associated with CoS.
odp_bool_t stats_enable
Enable statistics.
uint32_t num_queue
Number of queues to be linked to this CoS.
odp_pktin_vector_config_t vector
Packet input vector configuration.
odp_bp_param_t bp
Back Pressure configuration.
odp_queue_param_t queue_param
Queue parameters.
odp_red_param_t red
Random Early Detection configuration.
odp_cos_action_t action
Action to take.
odp_pktin_hash_proto_t hash_proto
Protocol header fields which are included in packet input hash calculation.
Classifier CoS specific statistics counters.
uint64_t errors
Number of packets with errors.
uint64_t octets
Number of octets in classified packets.
uint64_t packets
Number of classified packets, including packets dropped due to drop action.
uint64_t discards
Number of discarded packets due to other reasons than packet errors or drop action.
Classifier queue specific statistics counters.
uint64_t errors
Number of packets with errors.
uint64_t octets
Number of octets in successfully delivered packets.
uint64_t discards
Number of discarded packets due to other reasons (e.g.
uint64_t packets
Number of successfully delivered packets.
Classifier statistics capabilities.
struct odp_cls_stats_capability_t::@13 queue
Queue level capabilities.
uint64_t discards
See odp_cls_cos_stats_t::discards.
uint64_t errors
See odp_cls_cos_stats_t::errors.
struct odp_cls_stats_capability_t::@12::@14::@16 counter
Statistics counters in a bit field structure.
struct odp_cls_stats_capability_t::@12 cos
CoS level capabilities.
uint64_t packets
See odp_cls_cos_stats_t::packets.
uint64_t octets
See odp_cls_cos_stats_t::octets.
uint64_t all_counters
All bits of the bit field structure.
Packet input vector configuration.
Packet Matching Rule creation options.
uint64_t mark
Classification mark value.
int num_terms
Number of terms in the match rule.
odp_pmr_param_t * terms
PMR terms.
Packet Matching Rule parameter structure.
const void * val_start
Start value of the range.
uint32_t offset
Offset to the value.
uint32_t val_sz
Size of the value to be matched.
struct odp_pmr_param_t::@8::@10 match
Parameters for single-valued matches.
const void * value
Points to the value to be matched.
odp_bool_t range_term
True if the value is range and false if match.
const void * mask
Mask of the bits to be matched.
odp_cls_pmr_term_t term
Packet Matching Rule term.
const void * val_end
End value of the range.
struct odp_pmr_param_t::@8::@11 range
Parameter for range value matches.
ODP Queue parameters.
Random Early Detection (RED) Random Early Detection is enabled to initiate a drop probability for the...
odp_threshold_t threshold
Threshold parameters for RED RED is enabled when the resource usage is equal to or greater than the m...
odp_bool_t enable
A boolean to enable RED When true, RED is enabled and configured with RED parameters.
ODP Threshold.
ODP threshold API - platform specific header.
Supported PMR term values.
uint64_t vlan_pcp_0
PCP in the first VLAN header (ODP_PMR_VLAN_PCP_0)
uint64_t dip_addr
Destination IP address.
uint64_t udp_dport
Destination UDP port, implies IPPROTO=17.
uint64_t dmac
destination MAC address
uint64_t tcp_dport
Destination TCP port implies IPPROTO=6.
uint64_t ld_vni
NVGRE/VXLAN network identifier.
uint64_t sip_addr
Source IP address.
uint64_t icmp_id
ICMP identifier, implies IPPROTO=1 and ICMP_TYPE=0 or ICMP_TYPE=8.
uint64_t igmp_grp_addr
IGMP Group address, implies IPPROTO=2.
uint64_t ipsec_spi
IPsec session identifier.
uint64_t vlan_id_0
First VLAN ID (outer)
uint64_t custom_l3
Custom layer 3 match rule.
uint64_t custom_frame
Custom frame match rule.
uint64_t ethtype_0
Initial (outer) Ethertype only.
uint64_t udp_sport
Source UDP Port.
uint64_t sip6_addr
Source IP address.
uint64_t ip_proto
IP Protocol or IPv6 Next Header.
uint64_t dip6_addr
Destination IP address.
uint64_t ethtype_x
Ethertype of most inner VLAN tag.
uint64_t ip_dscp
DSCP in IP header (ODP_PMR_IP_DSCP)
uint64_t icmp_type
ICMP type, implies IPPROTO=1.
uint64_t all_bits
All bits of the bit field structure.
uint64_t sctp_sport
Source SCTP port, implies IPPROTO=132.
uint64_t tcp_sport
Source TCP port.
struct odp_cls_pmr_terms_t::@7 bit
Packet Matching Rule term fields.
uint64_t icmp_code
ICMP code, implies IPPROTO=1.
uint64_t vlan_id_x
Last VLAN ID (inner)
uint64_t sctp_dport
Destination SCTP port, implies IPPROTO=132.
uint64_t gtpv1_teid
GTPv1 tunnel endpoint identifier.
uint64_t len
Total length of received packet.
Packet input hash protocols.
Supported threshold types.