1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
5 #ifndef __INCLUDE_RTE_TABLE_ACTION_H__
6 #define __INCLUDE_RTE_TABLE_ACTION_H__
10 * RTE Pipeline Table Actions
12 * This API provides a common set of actions for pipeline tables to speed up
13 * application development.
15 * Each match-action rule added to a pipeline table has associated data that
16 * stores the action context. This data is input to the table action handler
17 * called for every input packet that hits the rule as part of the table lookup
18 * during the pipeline execution. The pipeline library allows the user to define
19 * his own table actions by providing customized table action handlers (table
20 * lookup) and complete freedom of setting the rules and their data (table rule
21 * add/delete). While the user can still follow this process, this API is
22 * intended to provide a quicker development alternative for a set of predefined
25 * The typical steps to use this API are:
26 * - Define a table action profile. This is a configuration template that can
27 * potentially be shared by multiple tables from the same or different
28 * pipelines, with different tables from the same pipeline likely to use
29 * different action profiles. For every table using a given action profile,
30 * the profile defines the set of actions and the action configuration to be
31 * implemented for all the table rules. API functions:
32 * rte_table_action_profile_create(),
33 * rte_table_action_profile_action_register(),
34 * rte_table_action_profile_freeze().
36 * - Instantiate the table action profile to create table action objects. Each
37 * pipeline table has its own table action object. API functions:
38 * rte_table_action_create().
40 * - Use the table action object to generate the pipeline table action handlers
41 * (invoked by the pipeline table lookup operation). API functions:
42 * rte_table_action_table_params_get().
44 * - Use the table action object to generate the rule data (for the pipeline
45 * table rule add operation) based on given action parameters. API functions:
46 * rte_table_action_apply().
48 * - Use the table action object to read action data (e.g. stats counters) for
49 * any given rule. API functions: rte_table_action_XYZ_read().
52 * @b EXPERIMENTAL: this API may change without prior notice
61 #include <rte_compat.h>
62 #include <rte_ether.h>
63 #include <rte_meter.h>
64 #include <rte_table_hash.h>
66 #include "rte_pipeline.h"
69 enum rte_table_action_type {
70 /** Forward to next pipeline table, output port or drop. */
71 RTE_TABLE_ACTION_FWD = 0,
76 /** Traffic Metering and Policing. */
79 /** Traffic Management. */
82 /** Packet encapsulations. */
83 RTE_TABLE_ACTION_ENCAP,
85 /** Network Address Translation (NAT). */
88 /** Time to Live (TTL) update. */
92 RTE_TABLE_ACTION_STATS,
95 RTE_TABLE_ACTION_TIME,
98 /** Common action configuration (per table action profile). */
99 struct rte_table_action_common_config {
100 /** Input packet Internet Protocol (IP) version. Non-zero for IPv4, zero
105 /** IP header offset within the input packet buffer. Offset 0 points to
106 * the first byte of the MBUF structure.
112 * RTE_TABLE_ACTION_FWD
114 /** Forward action parameters (per table rule). */
115 struct rte_table_action_fwd_params {
116 /** Forward action. */
117 enum rte_pipeline_action action;
119 /** Pipeline table ID or output port ID. */
124 * RTE_TABLE_ACTION_LB
126 /** Load balance key size min (number of bytes). */
127 #define RTE_TABLE_ACTION_LB_KEY_SIZE_MIN 8
129 /** Load balance key size max (number of bytes). */
130 #define RTE_TABLE_ACTION_LB_KEY_SIZE_MAX 64
132 /** Load balance table size. */
133 #define RTE_TABLE_ACTION_LB_TABLE_SIZE 8
135 /** Load balance action configuration (per table action profile). */
136 struct rte_table_action_lb_config {
137 /** Key size (number of bytes). */
140 /** Key offset within the input packet buffer. Offset 0 points to the
141 * first byte of the MBUF structure.
145 /** Key mask (*key_size* bytes are valid). */
146 uint8_t key_mask[RTE_TABLE_ACTION_LB_KEY_SIZE_MAX];
148 /** Hash function. */
149 rte_table_hash_op_hash f_hash;
151 /** Seed value for *f_hash*. */
154 /** Output value offset within the input packet buffer. Offset 0 points
155 * to the first byte of the MBUF structure.
160 /** Load balance action parameters (per table rule). */
161 struct rte_table_action_lb_params {
162 /** Table defining the output values and their weights. The weights are
163 * set in 1/RTE_TABLE_ACTION_LB_TABLE_SIZE increments. To assign a
164 * weight of N/RTE_TABLE_ACTION_LB_TABLE_SIZE to a given output value
165 * (0 <= N <= RTE_TABLE_ACTION_LB_TABLE_SIZE), the same output value
166 * needs to show up exactly N times in this table.
168 uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE];
172 * RTE_TABLE_ACTION_MTR
174 /** Max number of traffic classes (TCs). */
175 #define RTE_TABLE_ACTION_TC_MAX 4
177 /** Max number of queues per traffic class. */
178 #define RTE_TABLE_ACTION_TC_QUEUE_MAX 4
180 /** Differentiated Services Code Point (DSCP) translation table entry. */
181 struct rte_table_action_dscp_table_entry {
182 /** Traffic class. Used by the meter or the traffic management actions.
183 * Has to be strictly smaller than *RTE_TABLE_ACTION_TC_MAX*. Traffic
184 * class 0 is the highest priority.
188 /** Traffic class queue. Used by the traffic management action. Has to
189 * be strictly smaller than *RTE_TABLE_ACTION_TC_QUEUE_MAX*.
191 uint32_t tc_queue_id;
193 /** Packet color. Used by the meter action as the packet input color
194 * for the color aware mode of the traffic metering algorithm.
196 enum rte_meter_color color;
199 /** DSCP translation table. */
200 struct rte_table_action_dscp_table {
201 /** Array of DSCP table entries */
202 struct rte_table_action_dscp_table_entry entry[64];
205 /** Supported traffic metering algorithms. */
206 enum rte_table_action_meter_algorithm {
207 /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
208 RTE_TABLE_ACTION_METER_SRTCM,
210 /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
211 RTE_TABLE_ACTION_METER_TRTCM,
214 /** Traffic metering profile (configuration template). */
215 struct rte_table_action_meter_profile {
216 /** Traffic metering algorithm. */
217 enum rte_table_action_meter_algorithm alg;
221 /** Only valid when *alg* is set to srTCM - IETF RFC 2697. */
222 struct rte_meter_srtcm_params srtcm;
224 /** Only valid when *alg* is set to trTCM - IETF RFC 2698. */
225 struct rte_meter_trtcm_params trtcm;
229 /** Policer actions. */
230 enum rte_table_action_policer {
231 /** Recolor the packet as green. */
232 RTE_TABLE_ACTION_POLICER_COLOR_GREEN = 0,
234 /** Recolor the packet as yellow. */
235 RTE_TABLE_ACTION_POLICER_COLOR_YELLOW,
237 /** Recolor the packet as red. */
238 RTE_TABLE_ACTION_POLICER_COLOR_RED,
240 /** Drop the packet. */
241 RTE_TABLE_ACTION_POLICER_DROP,
243 /** Number of policer actions. */
244 RTE_TABLE_ACTION_POLICER_MAX
247 /** Meter action configuration per traffic class. */
248 struct rte_table_action_mtr_tc_params {
249 /** Meter profile ID. */
250 uint32_t meter_profile_id;
252 /** Policer actions. */
253 enum rte_table_action_policer policer[e_RTE_METER_COLORS];
256 /** Meter action statistics counters per traffic class. */
257 struct rte_table_action_mtr_counters_tc {
258 /** Number of packets per color at the output of the traffic metering
259 * and before the policer actions are executed. Only valid when
260 * *n_packets_valid* is non-zero.
262 uint64_t n_packets[e_RTE_METER_COLORS];
264 /** Number of packet bytes per color at the output of the traffic
265 * metering and before the policer actions are executed. Only valid when
266 * *n_bytes_valid* is non-zero.
268 uint64_t n_bytes[e_RTE_METER_COLORS];
270 /** When non-zero, the *n_packets* field is valid. */
273 /** When non-zero, the *n_bytes* field is valid. */
277 /** Meter action configuration (per table action profile). */
278 struct rte_table_action_mtr_config {
279 /** Meter algorithm. */
280 enum rte_table_action_meter_algorithm alg;
282 /** Number of traffic classes. Each traffic class has its own traffic
283 * meter and policer instances. Needs to be equal to either 1 or to
284 * *RTE_TABLE_ACTION_TC_MAX*.
288 /** When non-zero, the *n_packets* meter stats counter is enabled,
289 * otherwise it is disabled.
291 * @see struct rte_table_action_mtr_counters_tc
293 int n_packets_enabled;
295 /** When non-zero, the *n_bytes* meter stats counter is enabled,
296 * otherwise it is disabled.
298 * @see struct rte_table_action_mtr_counters_tc
303 /** Meter action parameters (per table rule). */
304 struct rte_table_action_mtr_params {
305 /** Traffic meter and policer parameters for each of the *tc_mask*
308 struct rte_table_action_mtr_tc_params mtr[RTE_TABLE_ACTION_TC_MAX];
310 /** Bit mask defining which traffic class parameters are valid in *mtr*.
311 * If bit N is set in *tc_mask*, then parameters for traffic class N are
317 /** Meter action statistics counters (per table rule). */
318 struct rte_table_action_mtr_counters {
319 /** Stats counters for each of the *tc_mask* traffic classes. */
320 struct rte_table_action_mtr_counters_tc stats[RTE_TABLE_ACTION_TC_MAX];
322 /** Bit mask defining which traffic class parameters are valid in *mtr*.
323 * If bit N is set in *tc_mask*, then parameters for traffic class N are
330 * RTE_TABLE_ACTION_TM
332 /** Traffic management action configuration (per table action profile). */
333 struct rte_table_action_tm_config {
334 /** Number of subports per port. */
335 uint32_t n_subports_per_port;
337 /** Number of pipes per subport. */
338 uint32_t n_pipes_per_subport;
341 /** Traffic management action parameters (per table rule). */
342 struct rte_table_action_tm_params {
351 * RTE_TABLE_ACTION_ENCAP
353 /** Supported packet encapsulation types. */
354 enum rte_table_action_encap_type {
355 /** IP -> { Ether | IP } */
356 RTE_TABLE_ACTION_ENCAP_ETHER = 0,
358 /** IP -> { Ether | VLAN | IP } */
359 RTE_TABLE_ACTION_ENCAP_VLAN,
361 /** IP -> { Ether | S-VLAN | C-VLAN | IP } */
362 RTE_TABLE_ACTION_ENCAP_QINQ,
364 /** IP -> { Ether | MPLS | IP } */
365 RTE_TABLE_ACTION_ENCAP_MPLS,
367 /** IP -> { Ether | PPPoE | PPP | IP } */
368 RTE_TABLE_ACTION_ENCAP_PPPOE,
370 /** Ether -> { Ether | IP | UDP | VXLAN | Ether }
371 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
373 RTE_TABLE_ACTION_ENCAP_VXLAN,
376 /** Pre-computed Ethernet header fields for encapsulation action. */
377 struct rte_table_action_ether_hdr {
378 struct ether_addr da; /**< Destination address. */
379 struct ether_addr sa; /**< Source address. */
382 /** Pre-computed VLAN header fields for encapsulation action. */
383 struct rte_table_action_vlan_hdr {
384 uint8_t pcp; /**< Priority Code Point (PCP). */
385 uint8_t dei; /**< Drop Eligibility Indicator (DEI). */
386 uint16_t vid; /**< VLAN Identifier (VID). */
389 /** Pre-computed MPLS header fields for encapsulation action. */
390 struct rte_table_action_mpls_hdr {
391 uint32_t label; /**< Label. */
392 uint8_t tc; /**< Traffic Class (TC). */
393 uint8_t ttl; /**< Time to Live (TTL). */
396 /** Pre-computed PPPoE header fields for encapsulation action. */
397 struct rte_table_action_pppoe_hdr {
398 uint16_t session_id; /**< Session ID. */
401 /** Pre-computed IPv4 header fields for encapsulation action. */
402 struct rte_table_action_ipv4_header {
403 uint32_t sa; /**< Source address. */
404 uint32_t da; /**< Destination address. */
405 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
406 uint8_t ttl; /**< Time To Live (TTL). */
409 /** Pre-computed IPv6 header fields for encapsulation action. */
410 struct rte_table_action_ipv6_header {
411 uint8_t sa[16]; /**< Source address. */
412 uint8_t da[16]; /**< Destination address. */
413 uint32_t flow_label; /**< Flow label. */
414 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
415 uint8_t hop_limit; /**< Hop Limit (HL). */
418 /** Pre-computed UDP header fields for encapsulation action. */
419 struct rte_table_action_udp_header {
420 uint16_t sp; /**< Source port. */
421 uint16_t dp; /**< Destination port. */
424 /** Pre-computed VXLAN header fields for encapsulation action. */
425 struct rte_table_action_vxlan_hdr {
426 uint32_t vni; /**< VXLAN Network Identifier (VNI). */
429 /** Ether encap parameters. */
430 struct rte_table_action_encap_ether_params {
431 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
434 /** VLAN encap parameters. */
435 struct rte_table_action_encap_vlan_params {
436 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
437 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
440 /** QinQ encap parameters. */
441 struct rte_table_action_encap_qinq_params {
442 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
443 struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
444 struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
447 /** Max number of MPLS labels per output packet for MPLS encapsulation. */
448 #ifndef RTE_TABLE_ACTION_MPLS_LABELS_MAX
449 #define RTE_TABLE_ACTION_MPLS_LABELS_MAX 4
452 /** MPLS encap parameters. */
453 struct rte_table_action_encap_mpls_params {
454 /** Ethernet header. */
455 struct rte_table_action_ether_hdr ether;
458 struct rte_table_action_mpls_hdr mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX];
460 /** Number of MPLS labels in MPLS header. */
463 /** Non-zero for MPLS unicast, zero for MPLS multicast. */
467 /** PPPoE encap parameters. */
468 struct rte_table_action_encap_pppoe_params {
469 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
470 struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
473 /** VXLAN encap parameters. */
474 struct rte_table_action_encap_vxlan_params {
475 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
476 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
480 struct rte_table_action_ipv4_header ipv4; /**< IPv4 header. */
481 struct rte_table_action_ipv6_header ipv6; /**< IPv6 header. */
484 struct rte_table_action_udp_header udp; /**< UDP header. */
485 struct rte_table_action_vxlan_hdr vxlan; /**< VXLAN header. */
488 /** Encap action configuration (per table action profile). */
489 struct rte_table_action_encap_config {
490 /** Bit mask defining the set of packet encapsulations enabled for the
491 * current table action profile. If bit (1 << N) is set in *encap_mask*,
492 * then packet encapsulation N is enabled, otherwise it is disabled.
494 * @see enum rte_table_action_encap_type
498 /** Encapsulation type specific configuration. */
502 /** Input packet to be encapsulated: offset within the
503 * input packet buffer to the start of the Ethernet
504 * frame to be encapsulated. Offset 0 points to the
505 * first byte of the MBUF structure.
507 uint32_t data_offset;
509 /** Encapsulation header: non-zero when encapsulation
510 * header includes a VLAN tag, zero otherwise.
514 /** Encapsulation header: IP version of the IP header
515 * within the encapsulation header. Non-zero for IPv4,
519 } vxlan; /**< VXLAN specific configuration. */
523 /** Encap action parameters (per table rule). */
524 struct rte_table_action_encap_params {
525 /** Encapsulation type. */
526 enum rte_table_action_encap_type type;
530 /** Only valid when *type* is set to Ether. */
531 struct rte_table_action_encap_ether_params ether;
533 /** Only valid when *type* is set to VLAN. */
534 struct rte_table_action_encap_vlan_params vlan;
536 /** Only valid when *type* is set to QinQ. */
537 struct rte_table_action_encap_qinq_params qinq;
539 /** Only valid when *type* is set to MPLS. */
540 struct rte_table_action_encap_mpls_params mpls;
542 /** Only valid when *type* is set to PPPoE. */
543 struct rte_table_action_encap_pppoe_params pppoe;
545 /** Only valid when *type* is set to VXLAN. */
546 struct rte_table_action_encap_vxlan_params vxlan;
551 * RTE_TABLE_ACTION_NAT
553 /** NAT action configuration (per table action profile). */
554 struct rte_table_action_nat_config {
555 /** When non-zero, the IP source address and L4 protocol source port are
556 * translated. When zero, the IP destination address and L4 protocol
557 * destination port are translated.
561 /** Layer 4 protocol, for example TCP (0x06) or UDP (0x11). The checksum
562 * field is computed differently and placed at different header offset
563 * by each layer 4 protocol.
568 /** NAT action parameters (per table rule). */
569 struct rte_table_action_nat_params {
570 /** IP version for *addr*: non-zero for IPv4, zero for IPv6. */
575 /** IPv4 address; only valid when *ip_version* is non-zero. */
578 /** IPv6 address; only valid when *ip_version* is set to 0. */
587 * RTE_TABLE_ACTION_TTL
589 /** TTL action configuration (per table action profile). */
590 struct rte_table_action_ttl_config {
591 /** When non-zero, the input packets whose updated IPv4 Time to Live
592 * (TTL) field or IPv6 Hop Limit (HL) field is zero are dropped.
593 * When zero, the input packets whose updated IPv4 TTL field or IPv6 HL
594 * field is zero are forwarded as usual (typically for debugging
599 /** When non-zero, the *n_packets* stats counter for TTL action is
600 * enabled, otherwise disabled.
602 * @see struct rte_table_action_ttl_counters
604 int n_packets_enabled;
607 /** TTL action parameters (per table rule). */
608 struct rte_table_action_ttl_params {
609 /** When non-zero, decrement the IPv4 TTL field and update the checksum
610 * field, or decrement the IPv6 HL field. When zero, the IPv4 TTL field
611 * or the IPv6 HL field is not changed.
616 /** TTL action statistics packets (per table rule). */
617 struct rte_table_action_ttl_counters {
618 /** Number of IPv4 packets whose updated TTL field is zero or IPv6
619 * packets whose updated HL field is zero.
625 * RTE_TABLE_ACTION_STATS
627 /** Stats action configuration (per table action profile). */
628 struct rte_table_action_stats_config {
629 /** When non-zero, the *n_packets* stats counter is enabled, otherwise
632 * @see struct rte_table_action_stats_counters
634 int n_packets_enabled;
636 /** When non-zero, the *n_bytes* stats counter is enabled, otherwise
639 * @see struct rte_table_action_stats_counters
644 /** Stats action parameters (per table rule). */
645 struct rte_table_action_stats_params {
646 /** Initial value for the *n_packets* stats counter. Typically set to 0.
648 * @see struct rte_table_action_stats_counters
652 /** Initial value for the *n_bytes* stats counter. Typically set to 0.
654 * @see struct rte_table_action_stats_counters
659 /** Stats action counters (per table rule). */
660 struct rte_table_action_stats_counters {
661 /** Number of packets. Valid only when *n_packets_valid* is non-zero. */
664 /** Number of bytes. Valid only when *n_bytes_valid* is non-zero. */
667 /** When non-zero, the *n_packets* field is valid, otherwise invalid. */
670 /** When non-zero, the *n_bytes* field is valid, otherwise invalid. */
675 * RTE_TABLE_ACTION_TIME
677 /** Timestamp action parameters (per table rule). */
678 struct rte_table_action_time_params {
679 /** Initial timestamp value. Typically set to current time. */
684 * Table action profile.
686 struct rte_table_action_profile;
689 * Table action profile create.
692 * Common action configuration.
694 * Table action profile handle on success, NULL otherwise.
696 struct rte_table_action_profile * __rte_experimental
697 rte_table_action_profile_create(struct rte_table_action_common_config *common);
700 * Table action profile free.
703 * Table profile action handle (needs to be valid).
705 * Zero on success, non-zero error code otherwise.
707 int __rte_experimental
708 rte_table_action_profile_free(struct rte_table_action_profile *profile);
711 * Table action profile action register.
714 * Table profile action handle (needs to be valid and not in frozen state).
716 * Specific table action to be registered for *profile*.
717 * @param[in] action_config
718 * Configuration for the *type* action.
719 * If struct rte_table_action_*type*_config is defined by the Table Action
720 * API, it needs to point to a valid instance of this structure, otherwise it
721 * needs to be set to NULL.
723 * Zero on success, non-zero error code otherwise.
725 int __rte_experimental
726 rte_table_action_profile_action_register(struct rte_table_action_profile *profile,
727 enum rte_table_action_type type,
728 void *action_config);
731 * Table action profile freeze.
733 * Once this function is called successfully, the given profile enters the
734 * frozen state with the following immediate effects: no more actions can be
735 * registered for this profile, so the profile can be instantiated to create
736 * table action objects.
739 * Table profile action handle (needs to be valid and not in frozen state).
741 * Zero on success, non-zero error code otherwise.
743 * @see rte_table_action_create()
745 int __rte_experimental
746 rte_table_action_profile_freeze(struct rte_table_action_profile *profile);
751 struct rte_table_action;
754 * Table action create.
756 * Instantiates the given table action profile to create a table action object.
759 * Table profile action handle (needs to be valid and in frozen state).
760 * @param[in] socket_id
761 * CPU socket ID where the internal data structures required by the new table
762 * action object should be allocated.
764 * Handle to table action object on success, NULL on error.
766 * @see rte_table_action_create()
768 struct rte_table_action * __rte_experimental
769 rte_table_action_create(struct rte_table_action_profile *profile,
776 * Handle to table action object (needs to be valid).
778 * Zero on success, non-zero error code otherwise.
780 int __rte_experimental
781 rte_table_action_free(struct rte_table_action *action);
784 * Table action table params get.
787 * Handle to table action object (needs to be valid).
788 * @param[inout] params
789 * Pipeline table parameters (needs to be pre-allocated).
791 * Zero on success, non-zero error code otherwise.
793 int __rte_experimental
794 rte_table_action_table_params_get(struct rte_table_action *action,
795 struct rte_pipeline_table_params *params);
798 * Table action apply.
801 * Handle to table action object (needs to be valid).
803 * Data byte array (typically table rule data) to apply action *type* on.
805 * Specific table action previously registered for the table action profile of
806 * the *action* object.
807 * @param[in] action_params
808 * Parameters for the *type* action.
809 * If struct rte_table_action_*type*_params is defined by the Table Action
810 * API, it needs to point to a valid instance of this structure, otherwise it
811 * needs to be set to NULL.
813 * Zero on success, non-zero error code otherwise.
815 int __rte_experimental
816 rte_table_action_apply(struct rte_table_action *action,
818 enum rte_table_action_type type,
819 void *action_params);
822 * Table action DSCP table update.
825 * Handle to table action object (needs to be valid).
826 * @param[in] dscp_mask
827 * 64-bit mask defining the DSCP table entries to be updated. If bit N is set
828 * in this bit mask, then DSCP table entry N is to be updated, otherwise not.
832 * Zero on success, non-zero error code otherwise.
834 int __rte_experimental
835 rte_table_action_dscp_table_update(struct rte_table_action *action,
837 struct rte_table_action_dscp_table *table);
840 * Table action meter profile add.
843 * Handle to table action object (needs to be valid).
844 * @param[in] meter_profile_id
845 * Meter profile ID to be used for the *profile* once it is successfully added
846 * to the *action* object (needs to be unused by the set of meter profiles
847 * currently registered for the *action* object).
849 * Meter profile to be added.
851 * Zero on success, non-zero error code otherwise.
853 int __rte_experimental
854 rte_table_action_meter_profile_add(struct rte_table_action *action,
855 uint32_t meter_profile_id,
856 struct rte_table_action_meter_profile *profile);
859 * Table action meter profile delete.
862 * Handle to table action object (needs to be valid).
863 * @param[in] meter_profile_id
864 * Meter profile ID of the meter profile to be deleted from the *action*
865 * object (needs to be valid for the *action* object).
867 * Zero on success, non-zero error code otherwise.
869 int __rte_experimental
870 rte_table_action_meter_profile_delete(struct rte_table_action *action,
871 uint32_t meter_profile_id);
874 * Table action meter read.
877 * Handle to table action object (needs to be valid).
879 * Data byte array (typically table rule data) with meter action previously
882 * Bit mask defining which traffic classes should have the meter stats
883 * counters read from *data* and stored into *stats*. If bit N is set in this
884 * bit mask, then traffic class N is part of this operation, otherwise it is
885 * not. If bit N is set in this bit mask, then traffic class N must be one of
886 * the traffic classes that are enabled for the meter action in the table
887 * action profile used by the *action* object.
888 * @param[inout] stats
889 * When non-NULL, it points to the area where the meter stats counters read
890 * from *data* are saved. Only the meter stats counters for the *tc_mask*
891 * traffic classes are read and stored to *stats*.
893 * When non-zero, the meter stats counters are cleared (i.e. set to zero),
894 * otherwise the counters are not modified. When the read operation is enabled
895 * (*stats* is non-NULL), the clear operation is performed after the read
896 * operation is completed.
898 * Zero on success, non-zero error code otherwise.
900 int __rte_experimental
901 rte_table_action_meter_read(struct rte_table_action *action,
904 struct rte_table_action_mtr_counters *stats,
908 * Table action TTL read.
911 * Handle to table action object (needs to be valid).
913 * Data byte array (typically table rule data) with TTL action previously
915 * @param[inout] stats
916 * When non-NULL, it points to the area where the TTL stats counters read from
919 * When non-zero, the TTL stats counters are cleared (i.e. set to zero),
920 * otherwise the counters are not modified. When the read operation is enabled
921 * (*stats* is non-NULL), the clear operation is performed after the read
922 * operation is completed.
924 * Zero on success, non-zero error code otherwise.
926 int __rte_experimental
927 rte_table_action_ttl_read(struct rte_table_action *action,
929 struct rte_table_action_ttl_counters *stats,
933 * Table action stats read.
936 * Handle to table action object (needs to be valid).
938 * Data byte array (typically table rule data) with stats action previously
940 * @param[inout] stats
941 * When non-NULL, it points to the area where the stats counters read from
944 * When non-zero, the stats counters are cleared (i.e. set to zero), otherwise
945 * the counters are not modified. When the read operation is enabled (*stats*
946 * is non-NULL), the clear operation is performed after the read operation is
949 * Zero on success, non-zero error code otherwise.
951 int __rte_experimental
952 rte_table_action_stats_read(struct rte_table_action *action,
954 struct rte_table_action_stats_counters *stats,
958 * Table action timestamp read.
961 * Handle to table action object (needs to be valid).
963 * Data byte array (typically table rule data) with timestamp action
964 * previously applied on it.
965 * @param[inout] timestamp
966 * Pre-allocated memory where the timestamp read from *data* is saved (has to
969 * Zero on success, non-zero error code otherwise.
971 int __rte_experimental
972 rte_table_action_time_read(struct rte_table_action *action,
974 uint64_t *timestamp);
980 #endif /* __INCLUDE_RTE_TABLE_ACTION_H__ */