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 /** Common action configuration (per table action profile). */
102 struct rte_table_action_common_config {
103 /** Input packet Internet Protocol (IP) version. Non-zero for IPv4, zero
108 /** IP header offset within the input packet buffer. Offset 0 points to
109 * the first byte of the MBUF structure.
115 * RTE_TABLE_ACTION_FWD
117 /** Forward action parameters (per table rule). */
118 struct rte_table_action_fwd_params {
119 /** Forward action. */
120 enum rte_pipeline_action action;
122 /** Pipeline table ID or output port ID. */
127 * RTE_TABLE_ACTION_LB
129 /** Load balance key size min (number of bytes). */
130 #define RTE_TABLE_ACTION_LB_KEY_SIZE_MIN 8
132 /** Load balance key size max (number of bytes). */
133 #define RTE_TABLE_ACTION_LB_KEY_SIZE_MAX 64
135 /** Load balance table size. */
136 #define RTE_TABLE_ACTION_LB_TABLE_SIZE 8
138 /** Load balance action configuration (per table action profile). */
139 struct rte_table_action_lb_config {
140 /** Key size (number of bytes). */
143 /** Key offset within the input packet buffer. Offset 0 points to the
144 * first byte of the MBUF structure.
148 /** Key mask (*key_size* bytes are valid). */
149 uint8_t key_mask[RTE_TABLE_ACTION_LB_KEY_SIZE_MAX];
151 /** Hash function. */
152 rte_table_hash_op_hash f_hash;
154 /** Seed value for *f_hash*. */
157 /** Output value offset within the input packet buffer. Offset 0 points
158 * to the first byte of the MBUF structure.
163 /** Load balance action parameters (per table rule). */
164 struct rte_table_action_lb_params {
165 /** Table defining the output values and their weights. The weights are
166 * set in 1/RTE_TABLE_ACTION_LB_TABLE_SIZE increments. To assign a
167 * weight of N/RTE_TABLE_ACTION_LB_TABLE_SIZE to a given output value
168 * (0 <= N <= RTE_TABLE_ACTION_LB_TABLE_SIZE), the same output value
169 * needs to show up exactly N times in this table.
171 uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE];
175 * RTE_TABLE_ACTION_MTR
177 /** Max number of traffic classes (TCs). */
178 #define RTE_TABLE_ACTION_TC_MAX 4
180 /** Max number of queues per traffic class. */
181 #define RTE_TABLE_ACTION_TC_QUEUE_MAX 4
183 /** Differentiated Services Code Point (DSCP) translation table entry. */
184 struct rte_table_action_dscp_table_entry {
185 /** Traffic class. Used by the meter or the traffic management actions.
186 * Has to be strictly smaller than *RTE_TABLE_ACTION_TC_MAX*. Traffic
187 * class 0 is the highest priority.
191 /** Traffic class queue. Used by the traffic management action. Has to
192 * be strictly smaller than *RTE_TABLE_ACTION_TC_QUEUE_MAX*.
194 uint32_t tc_queue_id;
196 /** Packet color. Used by the meter action as the packet input color
197 * for the color aware mode of the traffic metering algorithm.
199 enum rte_meter_color color;
202 /** DSCP translation table. */
203 struct rte_table_action_dscp_table {
204 /** Array of DSCP table entries */
205 struct rte_table_action_dscp_table_entry entry[64];
208 /** Supported traffic metering algorithms. */
209 enum rte_table_action_meter_algorithm {
210 /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
211 RTE_TABLE_ACTION_METER_SRTCM,
213 /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
214 RTE_TABLE_ACTION_METER_TRTCM,
217 /** Traffic metering profile (configuration template). */
218 struct rte_table_action_meter_profile {
219 /** Traffic metering algorithm. */
220 enum rte_table_action_meter_algorithm alg;
224 /** Only valid when *alg* is set to srTCM - IETF RFC 2697. */
225 struct rte_meter_srtcm_params srtcm;
227 /** Only valid when *alg* is set to trTCM - IETF RFC 2698. */
228 struct rte_meter_trtcm_params trtcm;
232 /** Policer actions. */
233 enum rte_table_action_policer {
234 /** Recolor the packet as green. */
235 RTE_TABLE_ACTION_POLICER_COLOR_GREEN = 0,
237 /** Recolor the packet as yellow. */
238 RTE_TABLE_ACTION_POLICER_COLOR_YELLOW,
240 /** Recolor the packet as red. */
241 RTE_TABLE_ACTION_POLICER_COLOR_RED,
243 /** Drop the packet. */
244 RTE_TABLE_ACTION_POLICER_DROP,
246 /** Number of policer actions. */
247 RTE_TABLE_ACTION_POLICER_MAX
250 /** Meter action configuration per traffic class. */
251 struct rte_table_action_mtr_tc_params {
252 /** Meter profile ID. */
253 uint32_t meter_profile_id;
255 /** Policer actions. */
256 enum rte_table_action_policer policer[e_RTE_METER_COLORS];
259 /** Meter action statistics counters per traffic class. */
260 struct rte_table_action_mtr_counters_tc {
261 /** Number of packets per color at the output of the traffic metering
262 * and before the policer actions are executed. Only valid when
263 * *n_packets_valid* is non-zero.
265 uint64_t n_packets[e_RTE_METER_COLORS];
267 /** Number of packet bytes per color at the output of the traffic
268 * metering and before the policer actions are executed. Only valid when
269 * *n_bytes_valid* is non-zero.
271 uint64_t n_bytes[e_RTE_METER_COLORS];
273 /** When non-zero, the *n_packets* field is valid. */
276 /** When non-zero, the *n_bytes* field is valid. */
280 /** Meter action configuration (per table action profile). */
281 struct rte_table_action_mtr_config {
282 /** Meter algorithm. */
283 enum rte_table_action_meter_algorithm alg;
285 /** Number of traffic classes. Each traffic class has its own traffic
286 * meter and policer instances. Needs to be equal to either 1 or to
287 * *RTE_TABLE_ACTION_TC_MAX*.
291 /** When non-zero, the *n_packets* meter stats counter is enabled,
292 * otherwise it is disabled.
294 * @see struct rte_table_action_mtr_counters_tc
296 int n_packets_enabled;
298 /** When non-zero, the *n_bytes* meter stats counter is enabled,
299 * otherwise it is disabled.
301 * @see struct rte_table_action_mtr_counters_tc
306 /** Meter action parameters (per table rule). */
307 struct rte_table_action_mtr_params {
308 /** Traffic meter and policer parameters for each of the *tc_mask*
311 struct rte_table_action_mtr_tc_params mtr[RTE_TABLE_ACTION_TC_MAX];
313 /** Bit mask defining which traffic class parameters are valid in *mtr*.
314 * If bit N is set in *tc_mask*, then parameters for traffic class N are
320 /** Meter action statistics counters (per table rule). */
321 struct rte_table_action_mtr_counters {
322 /** Stats counters for each of the *tc_mask* traffic classes. */
323 struct rte_table_action_mtr_counters_tc stats[RTE_TABLE_ACTION_TC_MAX];
325 /** Bit mask defining which traffic class parameters are valid in *mtr*.
326 * If bit N is set in *tc_mask*, then parameters for traffic class N are
333 * RTE_TABLE_ACTION_TM
335 /** Traffic management action configuration (per table action profile). */
336 struct rte_table_action_tm_config {
337 /** Number of subports per port. */
338 uint32_t n_subports_per_port;
340 /** Number of pipes per subport. */
341 uint32_t n_pipes_per_subport;
344 /** Traffic management action parameters (per table rule). */
345 struct rte_table_action_tm_params {
354 * RTE_TABLE_ACTION_ENCAP
356 /** Supported packet encapsulation types. */
357 enum rte_table_action_encap_type {
358 /** IP -> { Ether | IP } */
359 RTE_TABLE_ACTION_ENCAP_ETHER = 0,
361 /** IP -> { Ether | VLAN | IP } */
362 RTE_TABLE_ACTION_ENCAP_VLAN,
364 /** IP -> { Ether | S-VLAN | C-VLAN | IP } */
365 RTE_TABLE_ACTION_ENCAP_QINQ,
367 /** IP -> { Ether | MPLS | IP } */
368 RTE_TABLE_ACTION_ENCAP_MPLS,
370 /** IP -> { Ether | PPPoE | PPP | IP } */
371 RTE_TABLE_ACTION_ENCAP_PPPOE,
373 /** Ether -> { Ether | IP | UDP | VXLAN | Ether }
374 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
376 RTE_TABLE_ACTION_ENCAP_VXLAN,
379 /** Pre-computed Ethernet header fields for encapsulation action. */
380 struct rte_table_action_ether_hdr {
381 struct ether_addr da; /**< Destination address. */
382 struct ether_addr sa; /**< Source address. */
385 /** Pre-computed VLAN header fields for encapsulation action. */
386 struct rte_table_action_vlan_hdr {
387 uint8_t pcp; /**< Priority Code Point (PCP). */
388 uint8_t dei; /**< Drop Eligibility Indicator (DEI). */
389 uint16_t vid; /**< VLAN Identifier (VID). */
392 /** Pre-computed MPLS header fields for encapsulation action. */
393 struct rte_table_action_mpls_hdr {
394 uint32_t label; /**< Label. */
395 uint8_t tc; /**< Traffic Class (TC). */
396 uint8_t ttl; /**< Time to Live (TTL). */
399 /** Pre-computed PPPoE header fields for encapsulation action. */
400 struct rte_table_action_pppoe_hdr {
401 uint16_t session_id; /**< Session ID. */
404 /** Pre-computed IPv4 header fields for encapsulation action. */
405 struct rte_table_action_ipv4_header {
406 uint32_t sa; /**< Source address. */
407 uint32_t da; /**< Destination address. */
408 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
409 uint8_t ttl; /**< Time To Live (TTL). */
412 /** Pre-computed IPv6 header fields for encapsulation action. */
413 struct rte_table_action_ipv6_header {
414 uint8_t sa[16]; /**< Source address. */
415 uint8_t da[16]; /**< Destination address. */
416 uint32_t flow_label; /**< Flow label. */
417 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
418 uint8_t hop_limit; /**< Hop Limit (HL). */
421 /** Pre-computed UDP header fields for encapsulation action. */
422 struct rte_table_action_udp_header {
423 uint16_t sp; /**< Source port. */
424 uint16_t dp; /**< Destination port. */
427 /** Pre-computed VXLAN header fields for encapsulation action. */
428 struct rte_table_action_vxlan_hdr {
429 uint32_t vni; /**< VXLAN Network Identifier (VNI). */
432 /** Ether encap parameters. */
433 struct rte_table_action_encap_ether_params {
434 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
437 /** VLAN encap parameters. */
438 struct rte_table_action_encap_vlan_params {
439 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
440 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
443 /** QinQ encap parameters. */
444 struct rte_table_action_encap_qinq_params {
445 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
446 struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
447 struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
450 /** Max number of MPLS labels per output packet for MPLS encapsulation. */
451 #ifndef RTE_TABLE_ACTION_MPLS_LABELS_MAX
452 #define RTE_TABLE_ACTION_MPLS_LABELS_MAX 4
455 /** MPLS encap parameters. */
456 struct rte_table_action_encap_mpls_params {
457 /** Ethernet header. */
458 struct rte_table_action_ether_hdr ether;
461 struct rte_table_action_mpls_hdr mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX];
463 /** Number of MPLS labels in MPLS header. */
466 /** Non-zero for MPLS unicast, zero for MPLS multicast. */
470 /** PPPoE encap parameters. */
471 struct rte_table_action_encap_pppoe_params {
472 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
473 struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
476 /** VXLAN encap parameters. */
477 struct rte_table_action_encap_vxlan_params {
478 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
479 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
483 struct rte_table_action_ipv4_header ipv4; /**< IPv4 header. */
484 struct rte_table_action_ipv6_header ipv6; /**< IPv6 header. */
487 struct rte_table_action_udp_header udp; /**< UDP header. */
488 struct rte_table_action_vxlan_hdr vxlan; /**< VXLAN header. */
491 /** Encap action configuration (per table action profile). */
492 struct rte_table_action_encap_config {
493 /** Bit mask defining the set of packet encapsulations enabled for the
494 * current table action profile. If bit (1 << N) is set in *encap_mask*,
495 * then packet encapsulation N is enabled, otherwise it is disabled.
497 * @see enum rte_table_action_encap_type
501 /** Encapsulation type specific configuration. */
505 /** Input packet to be encapsulated: offset within the
506 * input packet buffer to the start of the Ethernet
507 * frame to be encapsulated. Offset 0 points to the
508 * first byte of the MBUF structure.
510 uint32_t data_offset;
512 /** Encapsulation header: non-zero when encapsulation
513 * header includes a VLAN tag, zero otherwise.
517 /** Encapsulation header: IP version of the IP header
518 * within the encapsulation header. Non-zero for IPv4,
522 } vxlan; /**< VXLAN specific configuration. */
526 /** Encap action parameters (per table rule). */
527 struct rte_table_action_encap_params {
528 /** Encapsulation type. */
529 enum rte_table_action_encap_type type;
533 /** Only valid when *type* is set to Ether. */
534 struct rte_table_action_encap_ether_params ether;
536 /** Only valid when *type* is set to VLAN. */
537 struct rte_table_action_encap_vlan_params vlan;
539 /** Only valid when *type* is set to QinQ. */
540 struct rte_table_action_encap_qinq_params qinq;
542 /** Only valid when *type* is set to MPLS. */
543 struct rte_table_action_encap_mpls_params mpls;
545 /** Only valid when *type* is set to PPPoE. */
546 struct rte_table_action_encap_pppoe_params pppoe;
548 /** Only valid when *type* is set to VXLAN. */
549 struct rte_table_action_encap_vxlan_params vxlan;
554 * RTE_TABLE_ACTION_NAT
556 /** NAT action configuration (per table action profile). */
557 struct rte_table_action_nat_config {
558 /** When non-zero, the IP source address and L4 protocol source port are
559 * translated. When zero, the IP destination address and L4 protocol
560 * destination port are translated.
564 /** Layer 4 protocol, for example TCP (0x06) or UDP (0x11). The checksum
565 * field is computed differently and placed at different header offset
566 * by each layer 4 protocol.
571 /** NAT action parameters (per table rule). */
572 struct rte_table_action_nat_params {
573 /** IP version for *addr*: non-zero for IPv4, zero for IPv6. */
578 /** IPv4 address; only valid when *ip_version* is non-zero. */
581 /** IPv6 address; only valid when *ip_version* is set to 0. */
590 * RTE_TABLE_ACTION_TTL
592 /** TTL action configuration (per table action profile). */
593 struct rte_table_action_ttl_config {
594 /** When non-zero, the input packets whose updated IPv4 Time to Live
595 * (TTL) field or IPv6 Hop Limit (HL) field is zero are dropped.
596 * When zero, the input packets whose updated IPv4 TTL field or IPv6 HL
597 * field is zero are forwarded as usual (typically for debugging
602 /** When non-zero, the *n_packets* stats counter for TTL action is
603 * enabled, otherwise disabled.
605 * @see struct rte_table_action_ttl_counters
607 int n_packets_enabled;
610 /** TTL action parameters (per table rule). */
611 struct rte_table_action_ttl_params {
612 /** When non-zero, decrement the IPv4 TTL field and update the checksum
613 * field, or decrement the IPv6 HL field. When zero, the IPv4 TTL field
614 * or the IPv6 HL field is not changed.
619 /** TTL action statistics packets (per table rule). */
620 struct rte_table_action_ttl_counters {
621 /** Number of IPv4 packets whose updated TTL field is zero or IPv6
622 * packets whose updated HL field is zero.
628 * RTE_TABLE_ACTION_STATS
630 /** Stats action configuration (per table action profile). */
631 struct rte_table_action_stats_config {
632 /** When non-zero, the *n_packets* stats counter is enabled, otherwise
635 * @see struct rte_table_action_stats_counters
637 int n_packets_enabled;
639 /** When non-zero, the *n_bytes* stats counter is enabled, otherwise
642 * @see struct rte_table_action_stats_counters
647 /** Stats action parameters (per table rule). */
648 struct rte_table_action_stats_params {
649 /** Initial value for the *n_packets* stats counter. Typically set to 0.
651 * @see struct rte_table_action_stats_counters
655 /** Initial value for the *n_bytes* stats counter. Typically set to 0.
657 * @see struct rte_table_action_stats_counters
662 /** Stats action counters (per table rule). */
663 struct rte_table_action_stats_counters {
664 /** Number of packets. Valid only when *n_packets_valid* is non-zero. */
667 /** Number of bytes. Valid only when *n_bytes_valid* is non-zero. */
670 /** When non-zero, the *n_packets* field is valid, otherwise invalid. */
673 /** When non-zero, the *n_bytes* field is valid, otherwise invalid. */
678 * RTE_TABLE_ACTION_TIME
680 /** Timestamp action parameters (per table rule). */
681 struct rte_table_action_time_params {
682 /** Initial timestamp value. Typically set to current time. */
687 * RTE_TABLE_ACTION_CRYPTO
689 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX
690 #define RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX (16)
693 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX
694 #define RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX (16)
697 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET
698 #define RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET \
699 (sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op))
702 /** Common action structure to store the data's value, length, and offset */
703 struct rte_table_action_vlo {
709 /** Symmetric crypto action configuration (per table action profile). */
710 struct rte_table_action_sym_crypto_config {
711 /** Target Cryptodev ID. */
712 uint8_t cryptodev_id;
715 * Offset to rte_crypto_op structure within the input packet buffer.
716 * Offset 0 points to the first byte of the MBUF structure.
720 /** The mempool for creating cryptodev sessions. */
721 struct rte_mempool *mp_create;
723 /** The mempool for initializing cryptodev sessions. */
724 struct rte_mempool *mp_init;
727 /** Symmetric Crypto action parameters (per table rule). */
728 struct rte_table_action_sym_crypto_params {
730 /** Xform pointer contains all relevant information */
731 struct rte_crypto_sym_xform *xform;
734 * Offset within the input packet buffer to the first byte of data
735 * to be processed by the crypto unit. Offset 0 points to the first
736 * byte of the MBUF structure.
738 uint32_t data_offset;
742 /** Cipher iv data. */
743 struct rte_table_action_vlo cipher_iv;
745 /** Cipher iv data. */
746 struct rte_table_action_vlo cipher_iv_update;
749 struct rte_table_action_vlo auth_iv;
752 struct rte_table_action_vlo auth_iv_update;
757 /** AEAD AAD data. */
758 struct rte_table_action_vlo aad;
761 struct rte_table_action_vlo iv;
763 /** AEAD AAD data. */
764 struct rte_table_action_vlo aad_update;
767 struct rte_table_action_vlo iv_update;
774 * Table action profile.
776 struct rte_table_action_profile;
779 * Table action profile create.
782 * Common action configuration.
784 * Table action profile handle on success, NULL otherwise.
786 struct rte_table_action_profile * __rte_experimental
787 rte_table_action_profile_create(struct rte_table_action_common_config *common);
790 * Table action profile free.
793 * Table profile action handle (needs to be valid).
795 * Zero on success, non-zero error code otherwise.
797 int __rte_experimental
798 rte_table_action_profile_free(struct rte_table_action_profile *profile);
801 * Table action profile action register.
804 * Table profile action handle (needs to be valid and not in frozen state).
806 * Specific table action to be registered for *profile*.
807 * @param[in] action_config
808 * Configuration for the *type* action.
809 * If struct rte_table_action_*type*_config 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_profile_action_register(struct rte_table_action_profile *profile,
817 enum rte_table_action_type type,
818 void *action_config);
821 * Table action profile freeze.
823 * Once this function is called successfully, the given profile enters the
824 * frozen state with the following immediate effects: no more actions can be
825 * registered for this profile, so the profile can be instantiated to create
826 * table action objects.
829 * Table profile action handle (needs to be valid and not in frozen state).
831 * Zero on success, non-zero error code otherwise.
833 * @see rte_table_action_create()
835 int __rte_experimental
836 rte_table_action_profile_freeze(struct rte_table_action_profile *profile);
841 struct rte_table_action;
844 * Table action create.
846 * Instantiates the given table action profile to create a table action object.
849 * Table profile action handle (needs to be valid and in frozen state).
850 * @param[in] socket_id
851 * CPU socket ID where the internal data structures required by the new table
852 * action object should be allocated.
854 * Handle to table action object on success, NULL on error.
856 * @see rte_table_action_create()
858 struct rte_table_action * __rte_experimental
859 rte_table_action_create(struct rte_table_action_profile *profile,
866 * Handle to table action object (needs to be valid).
868 * Zero on success, non-zero error code otherwise.
870 int __rte_experimental
871 rte_table_action_free(struct rte_table_action *action);
874 * Table action table params get.
877 * Handle to table action object (needs to be valid).
878 * @param[inout] params
879 * Pipeline table parameters (needs to be pre-allocated).
881 * Zero on success, non-zero error code otherwise.
883 int __rte_experimental
884 rte_table_action_table_params_get(struct rte_table_action *action,
885 struct rte_pipeline_table_params *params);
888 * Table action apply.
891 * Handle to table action object (needs to be valid).
893 * Data byte array (typically table rule data) to apply action *type* on.
895 * Specific table action previously registered for the table action profile of
896 * the *action* object.
897 * @param[in] action_params
898 * Parameters for the *type* action.
899 * If struct rte_table_action_*type*_params is defined by the Table Action
900 * API, it needs to point to a valid instance of this structure, otherwise it
901 * needs to be set to NULL.
903 * Zero on success, non-zero error code otherwise.
905 int __rte_experimental
906 rte_table_action_apply(struct rte_table_action *action,
908 enum rte_table_action_type type,
909 void *action_params);
912 * Table action DSCP table update.
915 * Handle to table action object (needs to be valid).
916 * @param[in] dscp_mask
917 * 64-bit mask defining the DSCP table entries to be updated. If bit N is set
918 * in this bit mask, then DSCP table entry N is to be updated, otherwise not.
922 * Zero on success, non-zero error code otherwise.
924 int __rte_experimental
925 rte_table_action_dscp_table_update(struct rte_table_action *action,
927 struct rte_table_action_dscp_table *table);
930 * Table action meter profile add.
933 * Handle to table action object (needs to be valid).
934 * @param[in] meter_profile_id
935 * Meter profile ID to be used for the *profile* once it is successfully added
936 * to the *action* object (needs to be unused by the set of meter profiles
937 * currently registered for the *action* object).
939 * Meter profile to be added.
941 * Zero on success, non-zero error code otherwise.
943 int __rte_experimental
944 rte_table_action_meter_profile_add(struct rte_table_action *action,
945 uint32_t meter_profile_id,
946 struct rte_table_action_meter_profile *profile);
949 * Table action meter profile delete.
952 * Handle to table action object (needs to be valid).
953 * @param[in] meter_profile_id
954 * Meter profile ID of the meter profile to be deleted from the *action*
955 * object (needs to be valid for the *action* object).
957 * Zero on success, non-zero error code otherwise.
959 int __rte_experimental
960 rte_table_action_meter_profile_delete(struct rte_table_action *action,
961 uint32_t meter_profile_id);
964 * Table action meter read.
967 * Handle to table action object (needs to be valid).
969 * Data byte array (typically table rule data) with meter action previously
972 * Bit mask defining which traffic classes should have the meter stats
973 * counters read from *data* and stored into *stats*. If bit N is set in this
974 * bit mask, then traffic class N is part of this operation, otherwise it is
975 * not. If bit N is set in this bit mask, then traffic class N must be one of
976 * the traffic classes that are enabled for the meter action in the table
977 * action profile used by the *action* object.
978 * @param[inout] stats
979 * When non-NULL, it points to the area where the meter stats counters read
980 * from *data* are saved. Only the meter stats counters for the *tc_mask*
981 * traffic classes are read and stored to *stats*.
983 * When non-zero, the meter stats counters are cleared (i.e. set to zero),
984 * otherwise the counters are not modified. When the read operation is enabled
985 * (*stats* is non-NULL), the clear operation is performed after the read
986 * operation is completed.
988 * Zero on success, non-zero error code otherwise.
990 int __rte_experimental
991 rte_table_action_meter_read(struct rte_table_action *action,
994 struct rte_table_action_mtr_counters *stats,
998 * Table action TTL read.
1001 * Handle to table action object (needs to be valid).
1003 * Data byte array (typically table rule data) with TTL action previously
1005 * @param[inout] stats
1006 * When non-NULL, it points to the area where the TTL stats counters read from
1009 * When non-zero, the TTL stats counters are cleared (i.e. set to zero),
1010 * otherwise the counters are not modified. When the read operation is enabled
1011 * (*stats* is non-NULL), the clear operation is performed after the read
1012 * operation is completed.
1014 * Zero on success, non-zero error code otherwise.
1016 int __rte_experimental
1017 rte_table_action_ttl_read(struct rte_table_action *action,
1019 struct rte_table_action_ttl_counters *stats,
1023 * Table action stats read.
1026 * Handle to table action object (needs to be valid).
1028 * Data byte array (typically table rule data) with stats action previously
1030 * @param[inout] stats
1031 * When non-NULL, it points to the area where the stats counters read from
1034 * When non-zero, the stats counters are cleared (i.e. set to zero), otherwise
1035 * the counters are not modified. When the read operation is enabled (*stats*
1036 * is non-NULL), the clear operation is performed after the read operation is
1039 * Zero on success, non-zero error code otherwise.
1041 int __rte_experimental
1042 rte_table_action_stats_read(struct rte_table_action *action,
1044 struct rte_table_action_stats_counters *stats,
1048 * Table action timestamp read.
1051 * Handle to table action object (needs to be valid).
1053 * Data byte array (typically table rule data) with timestamp action
1054 * previously applied on it.
1055 * @param[inout] timestamp
1056 * Pre-allocated memory where the timestamp read from *data* is saved (has to
1059 * Zero on success, non-zero error code otherwise.
1061 int __rte_experimental
1062 rte_table_action_time_read(struct rte_table_action *action,
1064 uint64_t *timestamp);
1067 * Table action cryptodev symmetric session get.
1070 * Handle to table action object (needs to be valid).
1072 * Data byte array (typically table rule data) with sym crypto action.
1074 * The pointer to the session on success, NULL otherwise.
1076 struct rte_cryptodev_sym_session *__rte_experimental
1077 rte_table_action_crypto_sym_session_get(struct rte_table_action *action,
1084 #endif /* __INCLUDE_RTE_TABLE_ACTION_H__ */