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 RTE_TABLE_ACTION_SYM_CRYPTO,
101 RTE_TABLE_ACTION_TAG,
103 /** Packet decapsulations. */
104 RTE_TABLE_ACTION_DECAP,
107 /** Common action configuration (per table action profile). */
108 struct rte_table_action_common_config {
109 /** Input packet Internet Protocol (IP) version. Non-zero for IPv4, zero
114 /** IP header offset within the input packet buffer. Offset 0 points to
115 * the first byte of the MBUF structure.
121 * RTE_TABLE_ACTION_FWD
123 /** Forward action parameters (per table rule). */
124 struct rte_table_action_fwd_params {
125 /** Forward action. */
126 enum rte_pipeline_action action;
128 /** Pipeline table ID or output port ID. */
133 * RTE_TABLE_ACTION_LB
135 /** Load balance key size min (number of bytes). */
136 #define RTE_TABLE_ACTION_LB_KEY_SIZE_MIN 8
138 /** Load balance key size max (number of bytes). */
139 #define RTE_TABLE_ACTION_LB_KEY_SIZE_MAX 64
141 /** Load balance table size. */
142 #define RTE_TABLE_ACTION_LB_TABLE_SIZE 8
144 /** Load balance action configuration (per table action profile). */
145 struct rte_table_action_lb_config {
146 /** Key size (number of bytes). */
149 /** Key offset within the input packet buffer. Offset 0 points to the
150 * first byte of the MBUF structure.
154 /** Key mask (*key_size* bytes are valid). */
155 uint8_t key_mask[RTE_TABLE_ACTION_LB_KEY_SIZE_MAX];
157 /** Hash function. */
158 rte_table_hash_op_hash f_hash;
160 /** Seed value for *f_hash*. */
163 /** Output value offset within the input packet buffer. Offset 0 points
164 * to the first byte of the MBUF structure.
169 /** Load balance action parameters (per table rule). */
170 struct rte_table_action_lb_params {
171 /** Table defining the output values and their weights. The weights are
172 * set in 1/RTE_TABLE_ACTION_LB_TABLE_SIZE increments. To assign a
173 * weight of N/RTE_TABLE_ACTION_LB_TABLE_SIZE to a given output value
174 * (0 <= N <= RTE_TABLE_ACTION_LB_TABLE_SIZE), the same output value
175 * needs to show up exactly N times in this table.
177 uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE];
181 * RTE_TABLE_ACTION_MTR
183 /** Max number of traffic classes (TCs). */
184 #define RTE_TABLE_ACTION_TC_MAX 4
186 /** Max number of queues per traffic class. */
187 #define RTE_TABLE_ACTION_TC_QUEUE_MAX 4
189 /** Differentiated Services Code Point (DSCP) translation table entry. */
190 struct rte_table_action_dscp_table_entry {
191 /** Traffic class. Used by the meter or the traffic management actions.
192 * Has to be strictly smaller than *RTE_TABLE_ACTION_TC_MAX*. Traffic
193 * class 0 is the highest priority.
197 /** Traffic class queue. Used by the traffic management action. Has to
198 * be strictly smaller than *RTE_TABLE_ACTION_TC_QUEUE_MAX*.
200 uint32_t tc_queue_id;
202 /** Packet color. Used by the meter action as the packet input color
203 * for the color aware mode of the traffic metering algorithm.
205 enum rte_meter_color color;
208 /** DSCP translation table. */
209 struct rte_table_action_dscp_table {
210 /** Array of DSCP table entries */
211 struct rte_table_action_dscp_table_entry entry[64];
214 /** Supported traffic metering algorithms. */
215 enum rte_table_action_meter_algorithm {
216 /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
217 RTE_TABLE_ACTION_METER_SRTCM,
219 /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
220 RTE_TABLE_ACTION_METER_TRTCM,
223 /** Traffic metering profile (configuration template). */
224 struct rte_table_action_meter_profile {
225 /** Traffic metering algorithm. */
226 enum rte_table_action_meter_algorithm alg;
230 /** Only valid when *alg* is set to srTCM - IETF RFC 2697. */
231 struct rte_meter_srtcm_params srtcm;
233 /** Only valid when *alg* is set to trTCM - IETF RFC 2698. */
234 struct rte_meter_trtcm_params trtcm;
238 /** Policer actions. */
239 enum rte_table_action_policer {
240 /** Recolor the packet as green. */
241 RTE_TABLE_ACTION_POLICER_COLOR_GREEN = 0,
243 /** Recolor the packet as yellow. */
244 RTE_TABLE_ACTION_POLICER_COLOR_YELLOW,
246 /** Recolor the packet as red. */
247 RTE_TABLE_ACTION_POLICER_COLOR_RED,
249 /** Drop the packet. */
250 RTE_TABLE_ACTION_POLICER_DROP,
252 /** Number of policer actions. */
253 RTE_TABLE_ACTION_POLICER_MAX
256 /** Meter action configuration per traffic class. */
257 struct rte_table_action_mtr_tc_params {
258 /** Meter profile ID. */
259 uint32_t meter_profile_id;
261 /** Policer actions. */
262 enum rte_table_action_policer policer[e_RTE_METER_COLORS];
265 /** Meter action statistics counters per traffic class. */
266 struct rte_table_action_mtr_counters_tc {
267 /** Number of packets per color at the output of the traffic metering
268 * and before the policer actions are executed. Only valid when
269 * *n_packets_valid* is non-zero.
271 uint64_t n_packets[e_RTE_METER_COLORS];
273 /** Number of packet bytes per color at the output of the traffic
274 * metering and before the policer actions are executed. Only valid when
275 * *n_bytes_valid* is non-zero.
277 uint64_t n_bytes[e_RTE_METER_COLORS];
279 /** When non-zero, the *n_packets* field is valid. */
282 /** When non-zero, the *n_bytes* field is valid. */
286 /** Meter action configuration (per table action profile). */
287 struct rte_table_action_mtr_config {
288 /** Meter algorithm. */
289 enum rte_table_action_meter_algorithm alg;
291 /** Number of traffic classes. Each traffic class has its own traffic
292 * meter and policer instances. Needs to be equal to either 1 or to
293 * *RTE_TABLE_ACTION_TC_MAX*.
297 /** When non-zero, the *n_packets* meter stats counter is enabled,
298 * otherwise it is disabled.
300 * @see struct rte_table_action_mtr_counters_tc
302 int n_packets_enabled;
304 /** When non-zero, the *n_bytes* meter stats counter is enabled,
305 * otherwise it is disabled.
307 * @see struct rte_table_action_mtr_counters_tc
312 /** Meter action parameters (per table rule). */
313 struct rte_table_action_mtr_params {
314 /** Traffic meter and policer parameters for each of the *tc_mask*
317 struct rte_table_action_mtr_tc_params mtr[RTE_TABLE_ACTION_TC_MAX];
319 /** Bit mask defining which traffic class parameters are valid in *mtr*.
320 * If bit N is set in *tc_mask*, then parameters for traffic class N are
326 /** Meter action statistics counters (per table rule). */
327 struct rte_table_action_mtr_counters {
328 /** Stats counters for each of the *tc_mask* traffic classes. */
329 struct rte_table_action_mtr_counters_tc stats[RTE_TABLE_ACTION_TC_MAX];
331 /** Bit mask defining which traffic class parameters are valid in *mtr*.
332 * If bit N is set in *tc_mask*, then parameters for traffic class N are
339 * RTE_TABLE_ACTION_TM
341 /** Traffic management action configuration (per table action profile). */
342 struct rte_table_action_tm_config {
343 /** Number of subports per port. */
344 uint32_t n_subports_per_port;
346 /** Number of pipes per subport. */
347 uint32_t n_pipes_per_subport;
350 /** Traffic management action parameters (per table rule). */
351 struct rte_table_action_tm_params {
360 * RTE_TABLE_ACTION_ENCAP
362 /** Supported packet encapsulation types. */
363 enum rte_table_action_encap_type {
364 /** IP -> { Ether | IP } */
365 RTE_TABLE_ACTION_ENCAP_ETHER = 0,
367 /** IP -> { Ether | VLAN | IP } */
368 RTE_TABLE_ACTION_ENCAP_VLAN,
370 /** IP -> { Ether | S-VLAN | C-VLAN | IP } */
371 RTE_TABLE_ACTION_ENCAP_QINQ,
373 /** IP -> { Ether | MPLS | IP } */
374 RTE_TABLE_ACTION_ENCAP_MPLS,
376 /** IP -> { Ether | PPPoE | PPP | IP } */
377 RTE_TABLE_ACTION_ENCAP_PPPOE,
379 /** Ether -> { Ether | IP | UDP | VXLAN | Ether }
380 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
382 RTE_TABLE_ACTION_ENCAP_VXLAN,
385 /** Pre-computed Ethernet header fields for encapsulation action. */
386 struct rte_table_action_ether_hdr {
387 struct ether_addr da; /**< Destination address. */
388 struct ether_addr sa; /**< Source address. */
391 /** Pre-computed VLAN header fields for encapsulation action. */
392 struct rte_table_action_vlan_hdr {
393 uint8_t pcp; /**< Priority Code Point (PCP). */
394 uint8_t dei; /**< Drop Eligibility Indicator (DEI). */
395 uint16_t vid; /**< VLAN Identifier (VID). */
398 /** Pre-computed MPLS header fields for encapsulation action. */
399 struct rte_table_action_mpls_hdr {
400 uint32_t label; /**< Label. */
401 uint8_t tc; /**< Traffic Class (TC). */
402 uint8_t ttl; /**< Time to Live (TTL). */
405 /** Pre-computed PPPoE header fields for encapsulation action. */
406 struct rte_table_action_pppoe_hdr {
407 uint16_t session_id; /**< Session ID. */
410 /** Pre-computed IPv4 header fields for encapsulation action. */
411 struct rte_table_action_ipv4_header {
412 uint32_t sa; /**< Source address. */
413 uint32_t da; /**< Destination address. */
414 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
415 uint8_t ttl; /**< Time To Live (TTL). */
418 /** Pre-computed IPv6 header fields for encapsulation action. */
419 struct rte_table_action_ipv6_header {
420 uint8_t sa[16]; /**< Source address. */
421 uint8_t da[16]; /**< Destination address. */
422 uint32_t flow_label; /**< Flow label. */
423 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
424 uint8_t hop_limit; /**< Hop Limit (HL). */
427 /** Pre-computed UDP header fields for encapsulation action. */
428 struct rte_table_action_udp_header {
429 uint16_t sp; /**< Source port. */
430 uint16_t dp; /**< Destination port. */
433 /** Pre-computed VXLAN header fields for encapsulation action. */
434 struct rte_table_action_vxlan_hdr {
435 uint32_t vni; /**< VXLAN Network Identifier (VNI). */
438 /** Ether encap parameters. */
439 struct rte_table_action_encap_ether_params {
440 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
443 /** VLAN encap parameters. */
444 struct rte_table_action_encap_vlan_params {
445 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
446 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
449 /** QinQ encap parameters. */
450 struct rte_table_action_encap_qinq_params {
451 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
452 struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
453 struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
456 /** Max number of MPLS labels per output packet for MPLS encapsulation. */
457 #ifndef RTE_TABLE_ACTION_MPLS_LABELS_MAX
458 #define RTE_TABLE_ACTION_MPLS_LABELS_MAX 4
461 /** MPLS encap parameters. */
462 struct rte_table_action_encap_mpls_params {
463 /** Ethernet header. */
464 struct rte_table_action_ether_hdr ether;
467 struct rte_table_action_mpls_hdr mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX];
469 /** Number of MPLS labels in MPLS header. */
472 /** Non-zero for MPLS unicast, zero for MPLS multicast. */
476 /** PPPoE encap parameters. */
477 struct rte_table_action_encap_pppoe_params {
478 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
479 struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
482 /** VXLAN encap parameters. */
483 struct rte_table_action_encap_vxlan_params {
484 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
485 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
489 struct rte_table_action_ipv4_header ipv4; /**< IPv4 header. */
490 struct rte_table_action_ipv6_header ipv6; /**< IPv6 header. */
493 struct rte_table_action_udp_header udp; /**< UDP header. */
494 struct rte_table_action_vxlan_hdr vxlan; /**< VXLAN header. */
497 /** Encap action configuration (per table action profile). */
498 struct rte_table_action_encap_config {
499 /** Bit mask defining the set of packet encapsulations enabled for the
500 * current table action profile. If bit (1 << N) is set in *encap_mask*,
501 * then packet encapsulation N is enabled, otherwise it is disabled.
503 * @see enum rte_table_action_encap_type
507 /** Encapsulation type specific configuration. */
511 /** Input packet to be encapsulated: offset within the
512 * input packet buffer to the start of the Ethernet
513 * frame to be encapsulated. Offset 0 points to the
514 * first byte of the MBUF structure.
516 uint32_t data_offset;
518 /** Encapsulation header: non-zero when encapsulation
519 * header includes a VLAN tag, zero otherwise.
523 /** Encapsulation header: IP version of the IP header
524 * within the encapsulation header. Non-zero for IPv4,
528 } vxlan; /**< VXLAN specific configuration. */
532 /** Encap action parameters (per table rule). */
533 struct rte_table_action_encap_params {
534 /** Encapsulation type. */
535 enum rte_table_action_encap_type type;
539 /** Only valid when *type* is set to Ether. */
540 struct rte_table_action_encap_ether_params ether;
542 /** Only valid when *type* is set to VLAN. */
543 struct rte_table_action_encap_vlan_params vlan;
545 /** Only valid when *type* is set to QinQ. */
546 struct rte_table_action_encap_qinq_params qinq;
548 /** Only valid when *type* is set to MPLS. */
549 struct rte_table_action_encap_mpls_params mpls;
551 /** Only valid when *type* is set to PPPoE. */
552 struct rte_table_action_encap_pppoe_params pppoe;
554 /** Only valid when *type* is set to VXLAN. */
555 struct rte_table_action_encap_vxlan_params vxlan;
560 * RTE_TABLE_ACTION_NAT
562 /** NAT action configuration (per table action profile). */
563 struct rte_table_action_nat_config {
564 /** When non-zero, the IP source address and L4 protocol source port are
565 * translated. When zero, the IP destination address and L4 protocol
566 * destination port are translated.
570 /** Layer 4 protocol, for example TCP (0x06) or UDP (0x11). The checksum
571 * field is computed differently and placed at different header offset
572 * by each layer 4 protocol.
577 /** NAT action parameters (per table rule). */
578 struct rte_table_action_nat_params {
579 /** IP version for *addr*: non-zero for IPv4, zero for IPv6. */
584 /** IPv4 address; only valid when *ip_version* is non-zero. */
587 /** IPv6 address; only valid when *ip_version* is set to 0. */
596 * RTE_TABLE_ACTION_TTL
598 /** TTL action configuration (per table action profile). */
599 struct rte_table_action_ttl_config {
600 /** When non-zero, the input packets whose updated IPv4 Time to Live
601 * (TTL) field or IPv6 Hop Limit (HL) field is zero are dropped.
602 * When zero, the input packets whose updated IPv4 TTL field or IPv6 HL
603 * field is zero are forwarded as usual (typically for debugging
608 /** When non-zero, the *n_packets* stats counter for TTL action is
609 * enabled, otherwise disabled.
611 * @see struct rte_table_action_ttl_counters
613 int n_packets_enabled;
616 /** TTL action parameters (per table rule). */
617 struct rte_table_action_ttl_params {
618 /** When non-zero, decrement the IPv4 TTL field and update the checksum
619 * field, or decrement the IPv6 HL field. When zero, the IPv4 TTL field
620 * or the IPv6 HL field is not changed.
625 /** TTL action statistics packets (per table rule). */
626 struct rte_table_action_ttl_counters {
627 /** Number of IPv4 packets whose updated TTL field is zero or IPv6
628 * packets whose updated HL field is zero.
634 * RTE_TABLE_ACTION_STATS
636 /** Stats action configuration (per table action profile). */
637 struct rte_table_action_stats_config {
638 /** When non-zero, the *n_packets* stats counter is enabled, otherwise
641 * @see struct rte_table_action_stats_counters
643 int n_packets_enabled;
645 /** When non-zero, the *n_bytes* stats counter is enabled, otherwise
648 * @see struct rte_table_action_stats_counters
653 /** Stats action parameters (per table rule). */
654 struct rte_table_action_stats_params {
655 /** Initial value for the *n_packets* stats counter. Typically set to 0.
657 * @see struct rte_table_action_stats_counters
661 /** Initial value for the *n_bytes* stats counter. Typically set to 0.
663 * @see struct rte_table_action_stats_counters
668 /** Stats action counters (per table rule). */
669 struct rte_table_action_stats_counters {
670 /** Number of packets. Valid only when *n_packets_valid* is non-zero. */
673 /** Number of bytes. Valid only when *n_bytes_valid* is non-zero. */
676 /** When non-zero, the *n_packets* field is valid, otherwise invalid. */
679 /** When non-zero, the *n_bytes* field is valid, otherwise invalid. */
684 * RTE_TABLE_ACTION_TIME
686 /** Timestamp action parameters (per table rule). */
687 struct rte_table_action_time_params {
688 /** Initial timestamp value. Typically set to current time. */
693 * RTE_TABLE_ACTION_CRYPTO
695 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX
696 #define RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX (16)
699 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX
700 #define RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX (16)
703 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET
704 #define RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET \
705 (sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op))
708 /** Common action structure to store the data's value, length, and offset */
709 struct rte_table_action_vlo {
715 /** Symmetric crypto action configuration (per table action profile). */
716 struct rte_table_action_sym_crypto_config {
717 /** Target Cryptodev ID. */
718 uint8_t cryptodev_id;
721 * Offset to rte_crypto_op structure within the input packet buffer.
722 * Offset 0 points to the first byte of the MBUF structure.
726 /** The mempool for creating cryptodev sessions. */
727 struct rte_mempool *mp_create;
729 /** The mempool for initializing cryptodev sessions. */
730 struct rte_mempool *mp_init;
733 /** Symmetric Crypto action parameters (per table rule). */
734 struct rte_table_action_sym_crypto_params {
736 /** Xform pointer contains all relevant information */
737 struct rte_crypto_sym_xform *xform;
740 * Offset within the input packet buffer to the first byte of data
741 * to be processed by the crypto unit. Offset 0 points to the first
742 * byte of the MBUF structure.
744 uint32_t data_offset;
748 /** Cipher iv data. */
749 struct rte_table_action_vlo cipher_iv;
751 /** Cipher iv data. */
752 struct rte_table_action_vlo cipher_iv_update;
755 struct rte_table_action_vlo auth_iv;
758 struct rte_table_action_vlo auth_iv_update;
763 /** AEAD AAD data. */
764 struct rte_table_action_vlo aad;
767 struct rte_table_action_vlo iv;
769 /** AEAD AAD data. */
770 struct rte_table_action_vlo aad_update;
773 struct rte_table_action_vlo iv_update;
780 * RTE_TABLE_ACTION_TAG
782 /** Tag action parameters (per table rule). */
783 struct rte_table_action_tag_params {
784 /** Tag to be attached to the input packet. */
789 * RTE_TABLE_ACTION_DECAP
791 /** Decap action parameters (per table rule). */
792 struct rte_table_action_decap_params {
793 /** Number of bytes to be removed from the start of the packet. */
798 * Table action profile.
800 struct rte_table_action_profile;
803 * Table action profile create.
806 * Common action configuration.
808 * Table action profile handle on success, NULL otherwise.
810 struct rte_table_action_profile * __rte_experimental
811 rte_table_action_profile_create(struct rte_table_action_common_config *common);
814 * Table action profile free.
817 * Table profile action handle (needs to be valid).
819 * Zero on success, non-zero error code otherwise.
821 int __rte_experimental
822 rte_table_action_profile_free(struct rte_table_action_profile *profile);
825 * Table action profile action register.
828 * Table profile action handle (needs to be valid and not in frozen state).
830 * Specific table action to be registered for *profile*.
831 * @param[in] action_config
832 * Configuration for the *type* action.
833 * If struct rte_table_action_*type*_config is defined by the Table Action
834 * API, it needs to point to a valid instance of this structure, otherwise it
835 * needs to be set to NULL.
837 * Zero on success, non-zero error code otherwise.
839 int __rte_experimental
840 rte_table_action_profile_action_register(struct rte_table_action_profile *profile,
841 enum rte_table_action_type type,
842 void *action_config);
845 * Table action profile freeze.
847 * Once this function is called successfully, the given profile enters the
848 * frozen state with the following immediate effects: no more actions can be
849 * registered for this profile, so the profile can be instantiated to create
850 * table action objects.
853 * Table profile action handle (needs to be valid and not in frozen state).
855 * Zero on success, non-zero error code otherwise.
857 * @see rte_table_action_create()
859 int __rte_experimental
860 rte_table_action_profile_freeze(struct rte_table_action_profile *profile);
865 struct rte_table_action;
868 * Table action create.
870 * Instantiates the given table action profile to create a table action object.
873 * Table profile action handle (needs to be valid and in frozen state).
874 * @param[in] socket_id
875 * CPU socket ID where the internal data structures required by the new table
876 * action object should be allocated.
878 * Handle to table action object on success, NULL on error.
880 * @see rte_table_action_create()
882 struct rte_table_action * __rte_experimental
883 rte_table_action_create(struct rte_table_action_profile *profile,
890 * Handle to table action object (needs to be valid).
892 * Zero on success, non-zero error code otherwise.
894 int __rte_experimental
895 rte_table_action_free(struct rte_table_action *action);
898 * Table action table params get.
901 * Handle to table action object (needs to be valid).
902 * @param[inout] params
903 * Pipeline table parameters (needs to be pre-allocated).
905 * Zero on success, non-zero error code otherwise.
907 int __rte_experimental
908 rte_table_action_table_params_get(struct rte_table_action *action,
909 struct rte_pipeline_table_params *params);
912 * Table action apply.
915 * Handle to table action object (needs to be valid).
917 * Data byte array (typically table rule data) to apply action *type* on.
919 * Specific table action previously registered for the table action profile of
920 * the *action* object.
921 * @param[in] action_params
922 * Parameters for the *type* action.
923 * If struct rte_table_action_*type*_params is defined by the Table Action
924 * API, it needs to point to a valid instance of this structure, otherwise it
925 * needs to be set to NULL.
927 * Zero on success, non-zero error code otherwise.
929 int __rte_experimental
930 rte_table_action_apply(struct rte_table_action *action,
932 enum rte_table_action_type type,
933 void *action_params);
936 * Table action DSCP table update.
939 * Handle to table action object (needs to be valid).
940 * @param[in] dscp_mask
941 * 64-bit mask defining the DSCP table entries to be updated. If bit N is set
942 * in this bit mask, then DSCP table entry N is to be updated, otherwise not.
946 * Zero on success, non-zero error code otherwise.
948 int __rte_experimental
949 rte_table_action_dscp_table_update(struct rte_table_action *action,
951 struct rte_table_action_dscp_table *table);
954 * Table action meter profile add.
957 * Handle to table action object (needs to be valid).
958 * @param[in] meter_profile_id
959 * Meter profile ID to be used for the *profile* once it is successfully added
960 * to the *action* object (needs to be unused by the set of meter profiles
961 * currently registered for the *action* object).
963 * Meter profile to be added.
965 * Zero on success, non-zero error code otherwise.
967 int __rte_experimental
968 rte_table_action_meter_profile_add(struct rte_table_action *action,
969 uint32_t meter_profile_id,
970 struct rte_table_action_meter_profile *profile);
973 * Table action meter profile delete.
976 * Handle to table action object (needs to be valid).
977 * @param[in] meter_profile_id
978 * Meter profile ID of the meter profile to be deleted from the *action*
979 * object (needs to be valid for the *action* object).
981 * Zero on success, non-zero error code otherwise.
983 int __rte_experimental
984 rte_table_action_meter_profile_delete(struct rte_table_action *action,
985 uint32_t meter_profile_id);
988 * Table action meter read.
991 * Handle to table action object (needs to be valid).
993 * Data byte array (typically table rule data) with meter action previously
996 * Bit mask defining which traffic classes should have the meter stats
997 * counters read from *data* and stored into *stats*. If bit N is set in this
998 * bit mask, then traffic class N is part of this operation, otherwise it is
999 * not. If bit N is set in this bit mask, then traffic class N must be one of
1000 * the traffic classes that are enabled for the meter action in the table
1001 * action profile used by the *action* object.
1002 * @param[inout] stats
1003 * When non-NULL, it points to the area where the meter stats counters read
1004 * from *data* are saved. Only the meter stats counters for the *tc_mask*
1005 * traffic classes are read and stored to *stats*.
1007 * When non-zero, the meter stats counters are cleared (i.e. set to zero),
1008 * otherwise the counters are not modified. When the read operation is enabled
1009 * (*stats* is non-NULL), the clear operation is performed after the read
1010 * operation is completed.
1012 * Zero on success, non-zero error code otherwise.
1014 int __rte_experimental
1015 rte_table_action_meter_read(struct rte_table_action *action,
1018 struct rte_table_action_mtr_counters *stats,
1022 * Table action TTL read.
1025 * Handle to table action object (needs to be valid).
1027 * Data byte array (typically table rule data) with TTL action previously
1029 * @param[inout] stats
1030 * When non-NULL, it points to the area where the TTL stats counters read from
1033 * When non-zero, the TTL stats counters are cleared (i.e. set to zero),
1034 * otherwise the counters are not modified. When the read operation is enabled
1035 * (*stats* is non-NULL), the clear operation is performed after the read
1036 * operation is completed.
1038 * Zero on success, non-zero error code otherwise.
1040 int __rte_experimental
1041 rte_table_action_ttl_read(struct rte_table_action *action,
1043 struct rte_table_action_ttl_counters *stats,
1047 * Table action stats read.
1050 * Handle to table action object (needs to be valid).
1052 * Data byte array (typically table rule data) with stats action previously
1054 * @param[inout] stats
1055 * When non-NULL, it points to the area where the stats counters read from
1058 * When non-zero, the stats counters are cleared (i.e. set to zero), otherwise
1059 * the counters are not modified. When the read operation is enabled (*stats*
1060 * is non-NULL), the clear operation is performed after the read operation is
1063 * Zero on success, non-zero error code otherwise.
1065 int __rte_experimental
1066 rte_table_action_stats_read(struct rte_table_action *action,
1068 struct rte_table_action_stats_counters *stats,
1072 * Table action timestamp read.
1075 * Handle to table action object (needs to be valid).
1077 * Data byte array (typically table rule data) with timestamp action
1078 * previously applied on it.
1079 * @param[inout] timestamp
1080 * Pre-allocated memory where the timestamp read from *data* is saved (has to
1083 * Zero on success, non-zero error code otherwise.
1085 int __rte_experimental
1086 rte_table_action_time_read(struct rte_table_action *action,
1088 uint64_t *timestamp);
1091 * Table action cryptodev symmetric session get.
1094 * Handle to table action object (needs to be valid).
1096 * Data byte array (typically table rule data) with sym crypto action.
1098 * The pointer to the session on success, NULL otherwise.
1100 struct rte_cryptodev_sym_session *__rte_experimental
1101 rte_table_action_crypto_sym_session_get(struct rte_table_action *action,
1108 #endif /* __INCLUDE_RTE_TABLE_ACTION_H__ */