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_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[RTE_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[RTE_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[RTE_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,
384 /** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
385 RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
388 /** Pre-computed Ethernet header fields for encapsulation action. */
389 struct rte_table_action_ether_hdr {
390 struct rte_ether_addr da; /**< Destination address. */
391 struct rte_ether_addr sa; /**< Source address. */
394 /** Pre-computed VLAN header fields for encapsulation action. */
395 struct rte_table_action_vlan_hdr {
396 uint8_t pcp; /**< Priority Code Point (PCP). */
397 uint8_t dei; /**< Drop Eligibility Indicator (DEI). */
398 uint16_t vid; /**< VLAN Identifier (VID). */
401 /** Pre-computed MPLS header fields for encapsulation action. */
402 struct rte_table_action_mpls_hdr {
403 uint32_t label; /**< Label. */
404 uint8_t tc; /**< Traffic Class (TC). */
405 uint8_t ttl; /**< Time to Live (TTL). */
408 /** Pre-computed PPPoE header fields for encapsulation action. */
409 struct rte_table_action_pppoe_hdr {
410 uint16_t session_id; /**< Session ID. */
413 /** Pre-computed IPv4 header fields for encapsulation action. */
414 struct rte_table_action_ipv4_header {
415 uint32_t sa; /**< Source address. */
416 uint32_t da; /**< Destination address. */
417 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
418 uint8_t ttl; /**< Time To Live (TTL). */
421 /** Pre-computed IPv6 header fields for encapsulation action. */
422 struct rte_table_action_ipv6_header {
423 uint8_t sa[16]; /**< Source address. */
424 uint8_t da[16]; /**< Destination address. */
425 uint32_t flow_label; /**< Flow label. */
426 uint8_t dscp; /**< DiffServ Code Point (DSCP). */
427 uint8_t hop_limit; /**< Hop Limit (HL). */
430 /** Pre-computed UDP header fields for encapsulation action. */
431 struct rte_table_action_udp_header {
432 uint16_t sp; /**< Source port. */
433 uint16_t dp; /**< Destination port. */
436 /** Pre-computed VXLAN header fields for encapsulation action. */
437 struct rte_table_action_vxlan_hdr {
438 uint32_t vni; /**< VXLAN Network Identifier (VNI). */
441 /** Ether encap parameters. */
442 struct rte_table_action_encap_ether_params {
443 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
446 /** VLAN encap parameters. */
447 struct rte_table_action_encap_vlan_params {
448 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
449 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
452 /** QinQ encap parameters. */
453 struct rte_table_action_encap_qinq_params {
454 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
455 struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
456 struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
459 /** Max number of MPLS labels per output packet for MPLS encapsulation. */
460 #ifndef RTE_TABLE_ACTION_MPLS_LABELS_MAX
461 #define RTE_TABLE_ACTION_MPLS_LABELS_MAX 4
464 /** MPLS encap parameters. */
465 struct rte_table_action_encap_mpls_params {
466 /** Ethernet header. */
467 struct rte_table_action_ether_hdr ether;
470 struct rte_table_action_mpls_hdr mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX];
472 /** Number of MPLS labels in MPLS header. */
475 /** Non-zero for MPLS unicast, zero for MPLS multicast. */
479 /** PPPoE encap parameters. */
480 struct rte_table_action_encap_pppoe_params {
481 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
482 struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
485 /** VXLAN encap parameters. */
486 struct rte_table_action_encap_vxlan_params {
487 struct rte_table_action_ether_hdr ether; /**< Ethernet header. */
488 struct rte_table_action_vlan_hdr vlan; /**< VLAN header. */
492 struct rte_table_action_ipv4_header ipv4; /**< IPv4 header. */
493 struct rte_table_action_ipv6_header ipv6; /**< IPv6 header. */
496 struct rte_table_action_udp_header udp; /**< UDP header. */
497 struct rte_table_action_vxlan_hdr vxlan; /**< VXLAN header. */
500 /** Encap action configuration (per table action profile). */
501 struct rte_table_action_encap_config {
502 /** Bit mask defining the set of packet encapsulations enabled for the
503 * current table action profile. If bit (1 << N) is set in *encap_mask*,
504 * then packet encapsulation N is enabled, otherwise it is disabled.
506 * @see enum rte_table_action_encap_type
510 /** Encapsulation type specific configuration. */
514 /** Input packet to be encapsulated: offset within the
515 * input packet buffer to the start of the Ethernet
516 * frame to be encapsulated. Offset 0 points to the
517 * first byte of the MBUF structure.
519 uint32_t data_offset;
521 /** Encapsulation header: non-zero when encapsulation
522 * header includes a VLAN tag, zero otherwise.
526 /** Encapsulation header: IP version of the IP header
527 * within the encapsulation header. Non-zero for IPv4,
531 } vxlan; /**< VXLAN specific configuration. */
535 /** QinQ_PPPoE encap parameters. */
536 struct rte_table_encap_ether_qinq_pppoe {
538 /** Only valid when *type* is set to QinQ. */
539 struct rte_table_action_ether_hdr ether;
540 struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
541 struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
542 struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
545 /** Encap action parameters (per table rule). */
546 struct rte_table_action_encap_params {
547 /** Encapsulation type. */
548 enum rte_table_action_encap_type type;
552 /** Only valid when *type* is set to Ether. */
553 struct rte_table_action_encap_ether_params ether;
555 /** Only valid when *type* is set to VLAN. */
556 struct rte_table_action_encap_vlan_params vlan;
558 /** Only valid when *type* is set to QinQ. */
559 struct rte_table_action_encap_qinq_params qinq;
561 /** Only valid when *type* is set to MPLS. */
562 struct rte_table_action_encap_mpls_params mpls;
564 /** Only valid when *type* is set to PPPoE. */
565 struct rte_table_action_encap_pppoe_params pppoe;
567 /** Only valid when *type* is set to VXLAN. */
568 struct rte_table_action_encap_vxlan_params vxlan;
570 /** Only valid when *type* is set to QinQ_PPPoE. */
571 struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
576 * RTE_TABLE_ACTION_NAT
578 /** NAT action configuration (per table action profile). */
579 struct rte_table_action_nat_config {
580 /** When non-zero, the IP source address and L4 protocol source port are
581 * translated. When zero, the IP destination address and L4 protocol
582 * destination port are translated.
586 /** Layer 4 protocol, for example TCP (0x06) or UDP (0x11). The checksum
587 * field is computed differently and placed at different header offset
588 * by each layer 4 protocol.
593 /** NAT action parameters (per table rule). */
594 struct rte_table_action_nat_params {
595 /** IP version for *addr*: non-zero for IPv4, zero for IPv6. */
600 /** IPv4 address; only valid when *ip_version* is non-zero. */
603 /** IPv6 address; only valid when *ip_version* is set to 0. */
612 * RTE_TABLE_ACTION_TTL
614 /** TTL action configuration (per table action profile). */
615 struct rte_table_action_ttl_config {
616 /** When non-zero, the input packets whose updated IPv4 Time to Live
617 * (TTL) field or IPv6 Hop Limit (HL) field is zero are dropped.
618 * When zero, the input packets whose updated IPv4 TTL field or IPv6 HL
619 * field is zero are forwarded as usual (typically for debugging
624 /** When non-zero, the *n_packets* stats counter for TTL action is
625 * enabled, otherwise disabled.
627 * @see struct rte_table_action_ttl_counters
629 int n_packets_enabled;
632 /** TTL action parameters (per table rule). */
633 struct rte_table_action_ttl_params {
634 /** When non-zero, decrement the IPv4 TTL field and update the checksum
635 * field, or decrement the IPv6 HL field. When zero, the IPv4 TTL field
636 * or the IPv6 HL field is not changed.
641 /** TTL action statistics packets (per table rule). */
642 struct rte_table_action_ttl_counters {
643 /** Number of IPv4 packets whose updated TTL field is zero or IPv6
644 * packets whose updated HL field is zero.
650 * RTE_TABLE_ACTION_STATS
652 /** Stats action configuration (per table action profile). */
653 struct rte_table_action_stats_config {
654 /** When non-zero, the *n_packets* stats counter is enabled, otherwise
657 * @see struct rte_table_action_stats_counters
659 int n_packets_enabled;
661 /** When non-zero, the *n_bytes* stats counter is enabled, otherwise
664 * @see struct rte_table_action_stats_counters
669 /** Stats action parameters (per table rule). */
670 struct rte_table_action_stats_params {
671 /** Initial value for the *n_packets* stats counter. Typically set to 0.
673 * @see struct rte_table_action_stats_counters
677 /** Initial value for the *n_bytes* stats counter. Typically set to 0.
679 * @see struct rte_table_action_stats_counters
684 /** Stats action counters (per table rule). */
685 struct rte_table_action_stats_counters {
686 /** Number of packets. Valid only when *n_packets_valid* is non-zero. */
689 /** Number of bytes. Valid only when *n_bytes_valid* is non-zero. */
692 /** When non-zero, the *n_packets* field is valid, otherwise invalid. */
695 /** When non-zero, the *n_bytes* field is valid, otherwise invalid. */
700 * RTE_TABLE_ACTION_TIME
702 /** Timestamp action parameters (per table rule). */
703 struct rte_table_action_time_params {
704 /** Initial timestamp value. Typically set to current time. */
709 * RTE_TABLE_ACTION_CRYPTO
711 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX
712 #define RTE_TABLE_ACTION_SYM_CRYPTO_IV_SIZE_MAX (16)
715 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX
716 #define RTE_TABLE_ACTION_SYM_CRYPTO_AAD_SIZE_MAX (16)
719 #ifndef RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET
720 #define RTE_TABLE_ACTION_SYM_CRYPTO_IV_OFFSET \
721 (sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op))
724 /** Common action structure to store the data's value, length, and offset */
725 struct rte_table_action_vlo {
731 /** Symmetric crypto action configuration (per table action profile). */
732 struct rte_table_action_sym_crypto_config {
733 /** Target Cryptodev ID. */
734 uint8_t cryptodev_id;
737 * Offset to rte_crypto_op structure within the input packet buffer.
738 * Offset 0 points to the first byte of the MBUF structure.
742 /** The mempool for creating cryptodev sessions. */
743 struct rte_mempool *mp_create;
745 /** The mempool for initializing cryptodev sessions. */
746 struct rte_mempool *mp_init;
749 /** Symmetric Crypto action parameters (per table rule). */
750 struct rte_table_action_sym_crypto_params {
752 /** Xform pointer contains all relevant information */
753 struct rte_crypto_sym_xform *xform;
756 * Offset within the input packet buffer to the first byte of data
757 * to be processed by the crypto unit. Offset 0 points to the first
758 * byte of the MBUF structure.
760 uint32_t data_offset;
764 /** Cipher iv data. */
765 struct rte_table_action_vlo cipher_iv;
767 /** Cipher iv data. */
768 struct rte_table_action_vlo cipher_iv_update;
771 struct rte_table_action_vlo auth_iv;
774 struct rte_table_action_vlo auth_iv_update;
779 /** AEAD AAD data. */
780 struct rte_table_action_vlo aad;
783 struct rte_table_action_vlo iv;
785 /** AEAD AAD data. */
786 struct rte_table_action_vlo aad_update;
789 struct rte_table_action_vlo iv_update;
796 * RTE_TABLE_ACTION_TAG
798 /** Tag action parameters (per table rule). */
799 struct rte_table_action_tag_params {
800 /** Tag to be attached to the input packet. */
805 * RTE_TABLE_ACTION_DECAP
807 /** Decap action parameters (per table rule). */
808 struct rte_table_action_decap_params {
809 /** Number of bytes to be removed from the start of the packet. */
814 * Table action profile.
816 struct rte_table_action_profile;
819 * Table action profile create.
822 * Common action configuration.
824 * Table action profile handle on success, NULL otherwise.
827 struct rte_table_action_profile *
828 rte_table_action_profile_create(struct rte_table_action_common_config *common);
831 * Table action profile free.
834 * Table profile action handle (needs to be valid).
836 * Zero on success, non-zero error code otherwise.
840 rte_table_action_profile_free(struct rte_table_action_profile *profile);
843 * Table action profile action register.
846 * Table profile action handle (needs to be valid and not in frozen state).
848 * Specific table action to be registered for *profile*.
849 * @param[in] action_config
850 * Configuration for the *type* action.
851 * If struct rte_table_action_*type*_config is defined by the Table Action
852 * API, it needs to point to a valid instance of this structure, otherwise it
853 * needs to be set to NULL.
855 * Zero on success, non-zero error code otherwise.
859 rte_table_action_profile_action_register(struct rte_table_action_profile *profile,
860 enum rte_table_action_type type,
861 void *action_config);
864 * Table action profile freeze.
866 * Once this function is called successfully, the given profile enters the
867 * frozen state with the following immediate effects: no more actions can be
868 * registered for this profile, so the profile can be instantiated to create
869 * table action objects.
872 * Table profile action handle (needs to be valid and not in frozen state).
874 * Zero on success, non-zero error code otherwise.
876 * @see rte_table_action_create()
880 rte_table_action_profile_freeze(struct rte_table_action_profile *profile);
885 struct rte_table_action;
888 * Table action create.
890 * Instantiates the given table action profile to create a table action object.
893 * Table profile action handle (needs to be valid and in frozen state).
894 * @param[in] socket_id
895 * CPU socket ID where the internal data structures required by the new table
896 * action object should be allocated.
898 * Handle to table action object on success, NULL on error.
900 * @see rte_table_action_create()
903 struct rte_table_action *
904 rte_table_action_create(struct rte_table_action_profile *profile,
911 * Handle to table action object (needs to be valid).
913 * Zero on success, non-zero error code otherwise.
917 rte_table_action_free(struct rte_table_action *action);
920 * Table action table params get.
923 * Handle to table action object (needs to be valid).
924 * @param[inout] params
925 * Pipeline table parameters (needs to be pre-allocated).
927 * Zero on success, non-zero error code otherwise.
931 rte_table_action_table_params_get(struct rte_table_action *action,
932 struct rte_pipeline_table_params *params);
935 * Table action apply.
938 * Handle to table action object (needs to be valid).
940 * Data byte array (typically table rule data) to apply action *type* on.
942 * Specific table action previously registered for the table action profile of
943 * the *action* object.
944 * @param[in] action_params
945 * Parameters for the *type* action.
946 * If struct rte_table_action_*type*_params is defined by the Table Action
947 * API, it needs to point to a valid instance of this structure, otherwise it
948 * needs to be set to NULL.
950 * Zero on success, non-zero error code otherwise.
954 rte_table_action_apply(struct rte_table_action *action,
956 enum rte_table_action_type type,
957 void *action_params);
960 * Table action DSCP table update.
963 * Handle to table action object (needs to be valid).
964 * @param[in] dscp_mask
965 * 64-bit mask defining the DSCP table entries to be updated. If bit N is set
966 * in this bit mask, then DSCP table entry N is to be updated, otherwise not.
970 * Zero on success, non-zero error code otherwise.
974 rte_table_action_dscp_table_update(struct rte_table_action *action,
976 struct rte_table_action_dscp_table *table);
979 * Table action meter profile add.
982 * Handle to table action object (needs to be valid).
983 * @param[in] meter_profile_id
984 * Meter profile ID to be used for the *profile* once it is successfully added
985 * to the *action* object (needs to be unused by the set of meter profiles
986 * currently registered for the *action* object).
988 * Meter profile to be added.
990 * Zero on success, non-zero error code otherwise.
994 rte_table_action_meter_profile_add(struct rte_table_action *action,
995 uint32_t meter_profile_id,
996 struct rte_table_action_meter_profile *profile);
999 * Table action meter profile delete.
1002 * Handle to table action object (needs to be valid).
1003 * @param[in] meter_profile_id
1004 * Meter profile ID of the meter profile to be deleted from the *action*
1005 * object (needs to be valid for the *action* object).
1007 * Zero on success, non-zero error code otherwise.
1011 rte_table_action_meter_profile_delete(struct rte_table_action *action,
1012 uint32_t meter_profile_id);
1015 * Table action meter read.
1018 * Handle to table action object (needs to be valid).
1020 * Data byte array (typically table rule data) with meter action previously
1022 * @param[in] tc_mask
1023 * Bit mask defining which traffic classes should have the meter stats
1024 * counters read from *data* and stored into *stats*. If bit N is set in this
1025 * bit mask, then traffic class N is part of this operation, otherwise it is
1026 * not. If bit N is set in this bit mask, then traffic class N must be one of
1027 * the traffic classes that are enabled for the meter action in the table
1028 * action profile used by the *action* object.
1029 * @param[inout] stats
1030 * When non-NULL, it points to the area where the meter stats counters read
1031 * from *data* are saved. Only the meter stats counters for the *tc_mask*
1032 * traffic classes are read and stored to *stats*.
1034 * When non-zero, the meter stats counters are cleared (i.e. set to zero),
1035 * otherwise the counters are not modified. When the read operation is enabled
1036 * (*stats* is non-NULL), the clear operation is performed after the read
1037 * operation is completed.
1039 * Zero on success, non-zero error code otherwise.
1043 rte_table_action_meter_read(struct rte_table_action *action,
1046 struct rte_table_action_mtr_counters *stats,
1050 * Table action TTL read.
1053 * Handle to table action object (needs to be valid).
1055 * Data byte array (typically table rule data) with TTL action previously
1057 * @param[inout] stats
1058 * When non-NULL, it points to the area where the TTL stats counters read from
1061 * When non-zero, the TTL stats counters are cleared (i.e. set to zero),
1062 * otherwise the counters are not modified. When the read operation is enabled
1063 * (*stats* is non-NULL), the clear operation is performed after the read
1064 * operation is completed.
1066 * Zero on success, non-zero error code otherwise.
1070 rte_table_action_ttl_read(struct rte_table_action *action,
1072 struct rte_table_action_ttl_counters *stats,
1076 * Table action stats read.
1079 * Handle to table action object (needs to be valid).
1081 * Data byte array (typically table rule data) with stats action previously
1083 * @param[inout] stats
1084 * When non-NULL, it points to the area where the stats counters read from
1087 * When non-zero, the stats counters are cleared (i.e. set to zero), otherwise
1088 * the counters are not modified. When the read operation is enabled (*stats*
1089 * is non-NULL), the clear operation is performed after the read operation is
1092 * Zero on success, non-zero error code otherwise.
1096 rte_table_action_stats_read(struct rte_table_action *action,
1098 struct rte_table_action_stats_counters *stats,
1102 * Table action timestamp read.
1105 * Handle to table action object (needs to be valid).
1107 * Data byte array (typically table rule data) with timestamp action
1108 * previously applied on it.
1109 * @param[inout] timestamp
1110 * Pre-allocated memory where the timestamp read from *data* is saved (has to
1113 * Zero on success, non-zero error code otherwise.
1117 rte_table_action_time_read(struct rte_table_action *action,
1119 uint64_t *timestamp);
1122 * Table action cryptodev symmetric session get.
1125 * Handle to table action object (needs to be valid).
1127 * Data byte array (typically table rule data) with sym crypto action.
1129 * The pointer to the session on success, NULL otherwise.
1132 struct rte_cryptodev_sym_session *
1133 rte_table_action_crypto_sym_session_get(struct rte_table_action *action,
1140 #endif /* __INCLUDE_RTE_TABLE_ACTION_H__ */