1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
4 #ifndef __INCLUDE_RTE_SWX_CTL_H__
5 #define __INCLUDE_RTE_SWX_CTL_H__
13 * RTE SWX Pipeline Control
19 #include <rte_compat.h>
20 #include <rte_meter.h>
22 #include "rte_swx_port.h"
23 #include "rte_swx_table.h"
25 struct rte_swx_pipeline;
28 #ifndef RTE_SWX_CTL_NAME_SIZE
29 #define RTE_SWX_CTL_NAME_SIZE 64
37 struct rte_swx_ctl_pipeline_info {
38 /** Number of input ports. */
41 /** Number of input ports. */
44 /** Number of actions. */
47 /** Number of tables. */
50 /** Number of selector tables. */
53 /** Number of learner tables. */
56 /** Number of register arrays. */
59 /** Number of meter arrays. */
68 * @param[out] pipeline
71 * 0 on success or the following error codes otherwise:
72 * -EINVAL: Invalid argument.
76 rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p,
77 struct rte_swx_ctl_pipeline_info *pipeline);
80 * Pipeline NUMA node get
84 * @param[out] numa_node
87 * 0 on success or the following error codes otherwise:
88 * -EINVAL: Invalid argument.
92 rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p,
100 * Input port statistics counters read
105 * Port ID (0 .. *n_ports_in* - 1).
109 * 0 on success or the following error codes otherwise:
110 * -EINVAL: Invalid argument.
114 rte_swx_ctl_pipeline_port_in_stats_read(struct rte_swx_pipeline *p,
116 struct rte_swx_port_in_stats *stats);
119 * Output port statistics counters read
124 * Port ID (0 .. *n_ports_out* - 1).
128 * 0 on success or the following error codes otherwise:
129 * -EINVAL: Invalid argument.
133 rte_swx_ctl_pipeline_port_out_stats_read(struct rte_swx_pipeline *p,
135 struct rte_swx_port_out_stats *stats);
142 struct rte_swx_ctl_action_info {
144 char name[RTE_SWX_CTL_NAME_SIZE];
146 /** Number of action arguments. */
155 * @param[in] action_id
156 * Action ID (0 .. *n_actions* - 1).
160 * 0 on success or the following error codes otherwise:
161 * -EINVAL: Invalid argument.
165 rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p,
167 struct rte_swx_ctl_action_info *action);
169 /** Action argument info. */
170 struct rte_swx_ctl_action_arg_info {
171 /** Action argument name. */
172 char name[RTE_SWX_CTL_NAME_SIZE];
174 /** Action argument size (in bits). */
177 /** Non-zero (true) when this action argument must be stored in the
178 * table in network byte order (NBO), zero when it must be stored in
179 * host byte order (HBO).
181 int is_network_byte_order;
185 * Action argument info get
189 * @param[in] action_id
190 * Action ID (0 .. *n_actions* - 1).
191 * @param[in] action_arg_id
192 * Action ID (0 .. *n_args* - 1).
193 * @param[out] action_arg
194 * Action argument info.
196 * 0 on success or the following error codes otherwise:
197 * -EINVAL: Invalid argument.
201 rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p,
203 uint32_t action_arg_id,
204 struct rte_swx_ctl_action_arg_info *action_arg);
211 struct rte_swx_ctl_table_info {
213 char name[RTE_SWX_CTL_NAME_SIZE];
215 /** Table creation arguments. */
216 char args[RTE_SWX_CTL_NAME_SIZE];
218 /** Number of match fields. */
219 uint32_t n_match_fields;
221 /** Number of actions. */
224 /** Non-zero (true) when the default action is constant, therefore it
225 * cannot be changed; zero (false) when the default action not constant,
226 * therefore it can be changed.
228 int default_action_is_const;
230 /** Table size parameter. */
239 * @param[in] table_id
240 * Table ID (0 .. *n_tables* - 1).
244 * 0 on success or the following error codes otherwise:
245 * -EINVAL: Invalid argument.
249 rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p,
251 struct rte_swx_ctl_table_info *table);
253 /** Table match field info.
255 * If (n_bits, offset) are known for all the match fields of the table, then the
256 * table (key_offset, key_size, key_mask0) can be computed.
258 struct rte_swx_ctl_table_match_field_info {
259 /** Match type of the current match field. */
260 enum rte_swx_table_match_type match_type;
262 /** Non-zero (true) when the current match field is part of a registered
263 * header, zero (false) when it is part of the registered meta-data.
267 /** Match field size (in bits). */
270 /** Match field offset within its parent struct (one of the headers or
277 * Table match field info get
281 * @param[in] table_id
282 * Table ID (0 .. *n_tables*).
283 * @param[in] match_field_id
284 * Match field ID (0 .. *n_match_fields* - 1).
285 * @param[out] match_field
286 * Table match field info.
288 * 0 on success or the following error codes otherwise:
289 * -EINVAL: Invalid argument.
293 rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p,
295 uint32_t match_field_id,
296 struct rte_swx_ctl_table_match_field_info *match_field);
298 /** Table action info. */
299 struct rte_swx_ctl_table_action_info {
303 /** When non-zero (true), the action can be assigned to regular table entries. */
304 int action_is_for_table_entries;
306 /** When non-zero (true), the action can be assigned to the table default entry. */
307 int action_is_for_default_entry;
311 * Table action info get
315 * @param[in] table_id
316 * Table ID (0 .. *n_tables*).
317 * @param[in] table_action_id
318 * Action index within the set of table actions (0 .. table n_actions - 1).
319 * Not to be confused with the action ID, which works at the pipeline level
320 * (0 .. pipeline n_actions - 1), which is precisely what this function
321 * returns as part of *table_action*.
322 * @param[out] table_action
325 * 0 on success or the following error codes otherwise:
326 * -EINVAL: Invalid argument.
330 rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
332 uint32_t table_action_id,
333 struct rte_swx_ctl_table_action_info *table_action);
336 * Table operations get
340 * @param[in] table_id
341 * Table ID (0 .. *n_tables*).
342 * @param[out] table_ops
343 * Table operations. Only valid when function returns success and *is_stub* is
345 * @param[out] is_stub
346 * A stub table is a table with no match fields. No "regular" table entries
347 * (i.e. entries other than the default entry) can be added to such a table,
348 * therefore the lookup operation always results in lookup miss. Non-zero
349 * (true) when the current table is a stub table, zero (false) otherwise.
351 * 0 on success or the following error codes otherwise:
352 * -EINVAL: Invalid argument.
356 rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
358 struct rte_swx_table_ops *table_ops,
361 /** Table statistics. */
362 struct rte_swx_table_stats {
363 /** Number of packets with lookup hit. */
366 /** Number of packets with lookup miss. */
367 uint64_t n_pkts_miss;
369 /** Number of packets (with either lookup hit or miss) per pipeline
370 * action. Array of pipeline *n_actions* elements indexed by the
371 * pipeline-level *action_id*, therefore this array has the same size
372 * for all the tables within the same pipeline.
374 uint64_t *n_pkts_action;
378 * Table statistics counters read
382 * @param[in] table_name
385 * Table stats. Must point to a pre-allocated structure. The *n_pkts_action*
386 * field also needs to be pre-allocated as array of pipeline *n_actions*
387 * elements. The pipeline actions that are not valid for the current table
388 * have their associated *n_pkts_action* element always set to zero.
390 * 0 on success or the following error codes otherwise:
391 * -EINVAL: Invalid argument.
395 rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p,
396 const char *table_name,
397 struct rte_swx_table_stats *stats);
400 * Selector Table Query API.
403 /** Selector info. */
404 struct rte_swx_ctl_selector_info {
405 /** Selector table name. */
406 char name[RTE_SWX_CTL_NAME_SIZE];
408 /** Number of selector fields. */
409 uint32_t n_selector_fields;
411 /** Maximum number of groups. */
412 uint32_t n_groups_max;
414 /** Maximum number of members per group. */
415 uint32_t n_members_per_group_max;
419 * Selector table info get
423 * @param[in] selector_id
424 * Selector table ID (0 .. *n_selectors* - 1).
425 * @param[out] selector
426 * Selector table info.
428 * 0 on success or the following error codes otherwise:
429 * -EINVAL: Invalid argument.
433 rte_swx_ctl_selector_info_get(struct rte_swx_pipeline *p,
434 uint32_t selector_id,
435 struct rte_swx_ctl_selector_info *selector);
438 * Selector table "group ID" field info get
442 * @param[in] selector_id
443 * Selector table ID (0 .. *n_selectors*).
445 * Selector table "group ID" field info.
447 * 0 on success or the following error codes otherwise:
448 * -EINVAL: Invalid argument.
452 rte_swx_ctl_selector_group_id_field_info_get(struct rte_swx_pipeline *p,
453 uint32_t selector_id,
454 struct rte_swx_ctl_table_match_field_info *field);
457 * Sselector table selector field info get
461 * @param[in] selector_id
462 * Selector table ID (0 .. *n_selectors*).
463 * @param[in] selector_field_id
464 * Selector table selector field ID (0 .. *n_selector_fields* - 1).
466 * Selector table selector field info.
468 * 0 on success or the following error codes otherwise:
469 * -EINVAL: Invalid argument.
473 rte_swx_ctl_selector_field_info_get(struct rte_swx_pipeline *p,
474 uint32_t selector_id,
475 uint32_t selector_field_id,
476 struct rte_swx_ctl_table_match_field_info *field);
479 * Selector table "member ID" field info get
483 * @param[in] selector_id
484 * Selector table ID (0 .. *n_selectors*).
486 * Selector table "member ID" field info.
488 * 0 on success or the following error codes otherwise:
489 * -EINVAL: Invalid argument.
493 rte_swx_ctl_selector_member_id_field_info_get(struct rte_swx_pipeline *p,
494 uint32_t selector_id,
495 struct rte_swx_ctl_table_match_field_info *field);
497 /** Selector table statistics. */
498 struct rte_swx_pipeline_selector_stats {
499 /** Number of packets. */
504 * Selector table statistics counters read
508 * @param[in] selector_name
509 * Selector table name.
511 * Selector table stats. Must point to a pre-allocated structure.
513 * 0 on success or the following error codes otherwise:
514 * -EINVAL: Invalid argument.
518 rte_swx_ctl_pipeline_selector_stats_read(struct rte_swx_pipeline *p,
519 const char *selector_name,
520 struct rte_swx_pipeline_selector_stats *stats);
523 * Learner Table Query API.
526 /** Learner table info. */
527 struct rte_swx_ctl_learner_info {
528 /** Learner table name. */
529 char name[RTE_SWX_CTL_NAME_SIZE];
531 /** Number of match fields. */
532 uint32_t n_match_fields;
534 /** Number of actions. */
537 /** Non-zero (true) when the default action is constant, therefore it
538 * cannot be changed; zero (false) when the default action not constant,
539 * therefore it can be changed.
541 int default_action_is_const;
543 /** Learner table size parameter. */
548 * Learner table info get
552 * @param[in] learner_id
553 * Learner table ID (0 .. *n_learners* - 1).
554 * @param[out] learner
555 * Learner table info.
557 * 0 on success or the following error codes otherwise:
558 * -EINVAL: Invalid argument.
562 rte_swx_ctl_learner_info_get(struct rte_swx_pipeline *p,
564 struct rte_swx_ctl_learner_info *learner);
567 * Learner table match field info get
571 * @param[in] learner_id
572 * Learner table ID (0 .. *n_learners* - 1).
573 * @param[in] match_field_id
574 * Match field ID (0 .. *n_match_fields* - 1).
575 * @param[out] match_field
576 * Learner table match field info.
578 * 0 on success or the following error codes otherwise:
579 * -EINVAL: Invalid argument.
583 rte_swx_ctl_learner_match_field_info_get(struct rte_swx_pipeline *p,
585 uint32_t match_field_id,
586 struct rte_swx_ctl_table_match_field_info *match_field);
589 * Learner table action info get
593 * @param[in] learner_id
594 * Learner table ID (0 .. *n_learners* - 1).
595 * @param[in] learner_action_id
596 * Action index within the set of learner table actions (0 .. learner table n_actions - 1). Not
597 * to be confused with the pipeline-leve action ID (0 .. pipeline n_actions - 1), which is
598 * precisely what this function returns as part of the *learner_action*.
599 * @param[out] learner_action
600 * Learner action info.
602 * 0 on success or the following error codes otherwise:
603 * -EINVAL: Invalid argument.
607 rte_swx_ctl_learner_action_info_get(struct rte_swx_pipeline *p,
609 uint32_t learner_action_id,
610 struct rte_swx_ctl_table_action_info *learner_action);
612 /** Learner table statistics. */
613 struct rte_swx_learner_stats {
614 /** Number of packets with lookup hit. */
617 /** Number of packets with lookup miss. */
618 uint64_t n_pkts_miss;
620 /** Number of packets with successful learning. */
621 uint64_t n_pkts_learn_ok;
623 /** Number of packets with learning error. */
624 uint64_t n_pkts_learn_err;
626 /** Number of packets with forget event. */
627 uint64_t n_pkts_forget;
629 /** Number of packets (with either lookup hit or miss) per pipeline action. Array of
630 * pipeline *n_actions* elements indexed by the pipeline-level *action_id*, therefore this
631 * array has the same size for all the tables within the same pipeline.
633 uint64_t *n_pkts_action;
637 * Learner table statistics counters read
641 * @param[in] learner_name
642 * Learner table name.
644 * Learner table stats. Must point to a pre-allocated structure. The *n_pkts_action* field also
645 * needs to be pre-allocated as array of pipeline *n_actions* elements. The pipeline actions that
646 * are not valid for the current learner table have their associated *n_pkts_action* element
647 * always set to zero.
649 * 0 on success or the following error codes otherwise:
650 * -EINVAL: Invalid argument.
654 rte_swx_ctl_pipeline_learner_stats_read(struct rte_swx_pipeline *p,
655 const char *learner_name,
656 struct rte_swx_learner_stats *stats);
663 struct rte_swx_table_state {
667 /** Action ID of the table default action. */
668 uint64_t default_action_id;
670 /** Action data of the table default action. Ignored when the action
671 * data size is zero; otherwise, action data size bytes are meaningful.
673 uint8_t *default_action_data;
677 * Pipeline table state get
681 * @param[out] table_state
682 * After successful execution, the *table_state* contains the pointer to the
683 * current pipeline table state, which is an array of *n_tables* elements,
684 * with array element i containing the state of the i-th pipeline table. The
685 * pipeline continues to own all the data structures directly or indirectly
686 * referenced by the *table_state* until the subsequent successful invocation
687 * of function *rte_swx_pipeline_table_state_set*.
689 * 0 on success or the following error codes otherwise:
690 * -EINVAL: Invalid argument.
694 rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
695 struct rte_swx_table_state **table_state);
698 * Pipeline table state set
702 * @param[out] table_state
703 * After successful execution, the pipeline table state is updated to this
704 * *table_state*. The ownership of all the data structures directly or
705 * indirectly referenced by this *table_state* is passed from the caller to
708 * 0 on success or the following error codes otherwise:
709 * -EINVAL: Invalid argument.
713 rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
714 struct rte_swx_table_state *table_state);
717 * High Level Reference Table Update API.
720 /** Pipeline control opaque data structure. */
721 struct rte_swx_ctl_pipeline;
724 * Pipeline control create
729 * Pipeline control handle, on success, or NULL, on error.
732 struct rte_swx_ctl_pipeline *
733 rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
736 * Pipeline table entry add
738 * Schedule entry for addition to table or update as part of the next commit
742 * Pipeline control handle.
743 * @param[in] table_name
746 * Entry to be added to the table.
748 * 0 on success or the following error codes otherwise:
749 * -EINVAL: Invalid argument.
753 rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
754 const char *table_name,
755 struct rte_swx_table_entry *entry);
758 * Pipeline table default entry add
760 * Schedule table default entry update as part of the next commit operation.
763 * Pipeline control handle.
764 * @param[in] table_name
767 * The new table default entry. The *key* and *key_mask* entry fields are
770 * 0 on success or the following error codes otherwise:
771 * -EINVAL: Invalid argument.
775 rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
776 const char *table_name,
777 struct rte_swx_table_entry *entry);
780 * Pipeline table entry delete
782 * Schedule entry for deletion from table as part of the next commit operation.
783 * Request is silently discarded if no such entry exists.
786 * Pipeline control handle.
787 * @param[in] table_name
790 * Entry to be deleted from the table. The *action_id* and *action_data* entry
791 * fields are ignored.
793 * 0 on success or the following error codes otherwise:
794 * -EINVAL: Invalid argument.
798 rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
799 const char *table_name,
800 struct rte_swx_table_entry *entry);
803 * Pipeline selector table group add
805 * Add a new group to a selector table. This operation is executed before this
806 * function returns and its result is independent of the result of the next
810 * Pipeline control handle.
811 * @param[in] selector_name
812 * Selector table name.
813 * @param[out] group_id
814 * The ID of the new group. Only valid when the function call is successful.
815 * This group is initially empty, i.e. it does not contain any members.
817 * 0 on success or the following error codes otherwise:
818 * -EINVAL: Invalid argument;
819 * -ENOSPC: All groups are currently in use, no group available.
823 rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl,
824 const char *selector_name,
828 * Pipeline selector table group delete
830 * Schedule a group for deletion as part of the next commit operation. The group
831 * to be deleted can be empty or non-empty.
834 * Pipeline control handle.
835 * @param[in] selector_name
836 * Selector table name.
837 * @param[in] group_id
838 * Group to be deleted from the selector table.
840 * 0 on success or the following error codes otherwise:
841 * -EINVAL: Invalid argument;
842 * -ENOMEM: Not enough memory.
846 rte_swx_ctl_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl,
847 const char *selector_name,
851 * Pipeline selector table member add to group
853 * Schedule the operation to add a new member to an existing group as part of
854 * the next commit operation. If this member is already in this group, the
855 * member weight is updated to the new value. A weight of zero means this member
856 * is to be deleted from the group.
859 * Pipeline control handle.
860 * @param[in] selector_name
861 * Selector table name.
862 * @param[in] group_id
864 * @param[in] member_id
865 * The member to be added to the group.
866 * @param[in] member_weight
869 * 0 on success or the following error codes otherwise:
870 * -EINVAL: Invalid argument;
871 * -ENOMEM: Not enough memory;
872 * -ENOSPC: The group is full.
876 rte_swx_ctl_pipeline_selector_group_member_add(struct rte_swx_ctl_pipeline *ctl,
877 const char *selector_name,
880 uint32_t member_weight);
883 * Pipeline selector table member delete from group
885 * Schedule the operation to delete a member from an existing group as part of
886 * the next commit operation.
889 * Pipeline control handle.
890 * @param[in] selector_name
891 * Selector table name.
892 * @param[in] group_id
893 * The group ID. Must be valid.
894 * @param[in] member_id
895 * The member to be added to the group. Must be valid.
897 * 0 on success or the following error codes otherwise:
898 * -EINVAL: Invalid argument.
902 rte_swx_ctl_pipeline_selector_group_member_delete(struct rte_swx_ctl_pipeline *ctl,
903 const char *selector_name,
908 * Pipeline learner table default entry add
910 * Schedule learner table default entry update as part of the next commit operation.
913 * Pipeline control handle.
914 * @param[in] learner_name
915 * Learner table name.
917 * The new table default entry. The *key* and *key_mask* entry fields are ignored.
919 * 0 on success or the following error codes otherwise:
920 * -EINVAL: Invalid argument.
924 rte_swx_ctl_pipeline_learner_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
925 const char *learner_name,
926 struct rte_swx_table_entry *entry);
931 * Perform all the scheduled table work.
934 * Pipeline control handle.
935 * @param[in] abort_on_fail
936 * When non-zero (false), all the scheduled work is discarded after a failed
937 * commit. Otherwise, the scheduled work is still kept pending for the next
940 * 0 on success or the following error codes otherwise:
941 * -EINVAL: Invalid argument.
945 rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
951 * Discard all the scheduled table work.
954 * Pipeline control handle.
958 rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
961 * Pipeline table entry read
963 * Read table entry from string.
966 * Pipeline control handle.
967 * @param[in] table_name
970 * String containing the table entry.
971 * @param[out] is_blank_or_comment
972 * On error, this argument provides an indication of whether *string* contains
973 * an invalid table entry (set to zero) or a blank or comment line that should
974 * typically be ignored (set to a non-zero value).
976 * 0 on success or the following error codes otherwise:
977 * -EINVAL: Invalid argument.
980 struct rte_swx_table_entry *
981 rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
982 const char *table_name,
984 int *is_blank_or_comment);
987 * Pipeline learner table default entry read
989 * Read learner table default entry from string.
992 * Pipeline control handle.
993 * @param[in] learner_name
994 * Learner table name.
996 * String containing the learner table default entry.
997 * @param[out] is_blank_or_comment
998 * On error, this argument provides an indication of whether *string* contains
999 * an invalid table entry (set to zero) or a blank or comment line that should
1000 * typically be ignored (set to a non-zero value).
1002 * 0 on success or the following error codes otherwise:
1003 * -EINVAL: Invalid argument.
1006 struct rte_swx_table_entry *
1007 rte_swx_ctl_pipeline_learner_default_entry_read(struct rte_swx_ctl_pipeline *ctl,
1008 const char *learner_name,
1010 int *is_blank_or_comment);
1013 * Pipeline table print to file
1015 * Print all the table entries to file.
1020 * Pipeline control handle.
1021 * @param[in] table_name
1024 * 0 on success or the following error codes otherwise:
1025 * -EINVAL: Invalid argument.
1029 rte_swx_ctl_pipeline_table_fprintf(FILE *f,
1030 struct rte_swx_ctl_pipeline *ctl,
1031 const char *table_name);
1034 * Pipeline selector print to file
1036 * Print all the selector entries to file.
1041 * Pipeline control handle.
1042 * @param[in] selector_name
1043 * Selector table name.
1045 * 0 on success or the following error codes otherwise:
1046 * -EINVAL: Invalid argument.
1050 rte_swx_ctl_pipeline_selector_fprintf(FILE *f,
1051 struct rte_swx_ctl_pipeline *ctl,
1052 const char *selector_name);
1055 * Register Array Query API.
1058 /** Register array info. */
1059 struct rte_swx_ctl_regarray_info {
1060 /** Register array name. */
1061 char name[RTE_SWX_CTL_NAME_SIZE];
1063 /** Register array size. */
1068 * Register array info get
1072 * @param[in] regarray_id
1073 * Register array ID (0 .. *n_regarrays* - 1).
1074 * @param[out] regarray
1075 * Register array info.
1077 * 0 on success or the following error codes otherwise:
1078 * -EINVAL: Invalid argument.
1082 rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p,
1083 uint32_t regarray_id,
1084 struct rte_swx_ctl_regarray_info *regarray);
1091 * @param[in] regarray_name
1092 * Register array name.
1093 * @param[in] regarray_index
1094 * Register index within the array (0 .. *size* - 1).
1096 * Current register value.
1098 * 0 on success or the following error codes otherwise:
1099 * -EINVAL: Invalid argument.
1103 rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p,
1104 const char *regarray_name,
1105 uint32_t regarray_index,
1113 * @param[in] regarray_name
1114 * Register array name.
1115 * @param[in] regarray_index
1116 * Register index within the array (0 .. *size* - 1).
1118 * Value to be written to the register.
1120 * 0 on success or the following error codes otherwise:
1121 * -EINVAL: Invalid argument.
1125 rte_swx_ctl_pipeline_regarray_write(struct rte_swx_pipeline *p,
1126 const char *regarray_name,
1127 uint32_t regarray_index,
1131 * Meter Array Query and Configuration API.
1134 /** Meter array info. */
1135 struct rte_swx_ctl_metarray_info {
1136 /** Meter array name. */
1137 char name[RTE_SWX_CTL_NAME_SIZE];
1139 /** Meter array size. */
1144 * Meter array info get
1148 * @param[in] metarray_id
1149 * Meter array ID (0 .. *n_metarrays* - 1).
1150 * @param[out] metarray
1153 * 0 on success or the following error codes otherwise:
1154 * -EINVAL: Invalid argument.
1158 rte_swx_ctl_metarray_info_get(struct rte_swx_pipeline *p,
1159 uint32_t metarray_id,
1160 struct rte_swx_ctl_metarray_info *metarray);
1168 * Meter profile name.
1170 * Meter profile parameters.
1172 * 0 on success or the following error codes otherwise:
1173 * -EINVAL: Invalid argument;
1174 * -ENOMEM: Not enough space/cannot allocate memory;
1175 * -EEXIST: Meter profile with this name already exists.
1179 rte_swx_ctl_meter_profile_add(struct rte_swx_pipeline *p,
1181 struct rte_meter_trtcm_params *params);
1184 * Meter profile delete
1189 * Meter profile name.
1191 * 0 on success or the following error codes otherwise:
1192 * -EINVAL: Invalid argument;
1193 * -EBUSY: Meter profile is currently in use.
1197 rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p,
1203 * Reset a meter within a given meter array to use the default profile that
1204 * causes all the input packets to be colored as green. It is the responsibility
1205 * of the control plane to make sure this meter is not used by the data plane
1206 * pipeline before calling this function.
1210 * @param[in] metarray_name
1212 * @param[in] metarray_index
1213 * Meter index within the meter array.
1215 * 0 on success or the following error codes otherwise:
1216 * -EINVAL: Invalid argument.
1220 rte_swx_ctl_meter_reset(struct rte_swx_pipeline *p,
1221 const char *metarray_name,
1222 uint32_t metarray_index);
1227 * Set a meter within a given meter array to use a specific profile. It is the
1228 * responsibility of the control plane to make sure this meter is not used by
1229 * the data plane pipeline before calling this function.
1233 * @param[in] metarray_name
1235 * @param[in] metarray_index
1236 * Meter index within the meter array.
1237 * @param[in] profile_name
1238 * Existing meter profile name.
1240 * 0 on success or the following error codes otherwise:
1241 * -EINVAL: Invalid argument.
1245 rte_swx_ctl_meter_set(struct rte_swx_pipeline *p,
1246 const char *metarray_name,
1247 uint32_t metarray_index,
1248 const char *profile_name);
1250 /** Meter statistics counters. */
1251 struct rte_swx_ctl_meter_stats {
1252 /** Number of packets tagged by the meter for each color. */
1253 uint64_t n_pkts[RTE_COLORS];
1255 /** Number of bytes tagged by the meter for each color. */
1256 uint64_t n_bytes[RTE_COLORS];
1260 * Meter statistics counters read
1264 * @param[in] metarray_name
1266 * @param[in] metarray_index
1267 * Meter index within the meter array.
1269 * Meter statistics counters.
1271 * 0 on success or the following error codes otherwise:
1272 * -EINVAL: Invalid argument.
1276 rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
1277 const char *metarray_name,
1278 uint32_t metarray_index,
1279 struct rte_swx_ctl_meter_stats *stats);
1282 * Pipeline control free
1285 * Pipeline control handle.
1289 rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl);