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
20 #include <rte_compat.h>
21 #include <rte_meter.h>
23 #include "rte_swx_port.h"
24 #include "rte_swx_table.h"
25 #include "rte_swx_table_selector.h"
27 struct rte_swx_pipeline;
30 #ifndef RTE_SWX_CTL_NAME_SIZE
31 #define RTE_SWX_CTL_NAME_SIZE 64
39 struct rte_swx_ctl_pipeline_info {
40 /** Number of input ports. */
43 /** Number of input ports. */
46 /** Number of actions. */
49 /** Number of tables. */
52 /** Number of selector tables. */
55 /** Number of learner tables. */
58 /** Number of register arrays. */
61 /** Number of meter arrays. */
70 * @param[out] pipeline
73 * 0 on success or the following error codes otherwise:
74 * -EINVAL: Invalid argument.
78 rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p,
79 struct rte_swx_ctl_pipeline_info *pipeline);
82 * Pipeline NUMA node get
86 * @param[out] numa_node
89 * 0 on success or the following error codes otherwise:
90 * -EINVAL: Invalid argument.
94 rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p,
102 * Input port statistics counters read
107 * Port ID (0 .. *n_ports_in* - 1).
111 * 0 on success or the following error codes otherwise:
112 * -EINVAL: Invalid argument.
116 rte_swx_ctl_pipeline_port_in_stats_read(struct rte_swx_pipeline *p,
118 struct rte_swx_port_in_stats *stats);
121 * Output port statistics counters read
126 * Port ID (0 .. *n_ports_out* - 1).
130 * 0 on success or the following error codes otherwise:
131 * -EINVAL: Invalid argument.
135 rte_swx_ctl_pipeline_port_out_stats_read(struct rte_swx_pipeline *p,
137 struct rte_swx_port_out_stats *stats);
144 struct rte_swx_ctl_action_info {
146 char name[RTE_SWX_CTL_NAME_SIZE];
148 /** Number of action arguments. */
157 * @param[in] action_id
158 * Action ID (0 .. *n_actions* - 1).
162 * 0 on success or the following error codes otherwise:
163 * -EINVAL: Invalid argument.
167 rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p,
169 struct rte_swx_ctl_action_info *action);
171 /** Action argument info. */
172 struct rte_swx_ctl_action_arg_info {
173 /** Action argument name. */
174 char name[RTE_SWX_CTL_NAME_SIZE];
176 /** Action argument size (in bits). */
179 /** Non-zero (true) when this action argument must be stored in the
180 * table in network byte order (NBO), zero when it must be stored in
181 * host byte order (HBO).
183 int is_network_byte_order;
187 * Action argument info get
191 * @param[in] action_id
192 * Action ID (0 .. *n_actions* - 1).
193 * @param[in] action_arg_id
194 * Action ID (0 .. *n_args* - 1).
195 * @param[out] action_arg
196 * Action argument info.
198 * 0 on success or the following error codes otherwise:
199 * -EINVAL: Invalid argument.
203 rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p,
205 uint32_t action_arg_id,
206 struct rte_swx_ctl_action_arg_info *action_arg);
213 struct rte_swx_ctl_table_info {
215 char name[RTE_SWX_CTL_NAME_SIZE];
217 /** Table creation arguments. */
218 char args[RTE_SWX_CTL_NAME_SIZE];
220 /** Number of match fields. */
221 uint32_t n_match_fields;
223 /** Number of actions. */
226 /** Non-zero (true) when the default action is constant, therefore it
227 * cannot be changed; zero (false) when the default action not constant,
228 * therefore it can be changed.
230 int default_action_is_const;
232 /** Table size parameter. */
241 * @param[in] table_id
242 * Table ID (0 .. *n_tables* - 1).
246 * 0 on success or the following error codes otherwise:
247 * -EINVAL: Invalid argument.
251 rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p,
253 struct rte_swx_ctl_table_info *table);
255 /** Table match field info.
257 * If (n_bits, offset) are known for all the match fields of the table, then the
258 * table (key_offset, key_size, key_mask0) can be computed.
260 struct rte_swx_ctl_table_match_field_info {
261 /** Match type of the current match field. */
262 enum rte_swx_table_match_type match_type;
264 /** Non-zero (true) when the current match field is part of a registered
265 * header, zero (false) when it is part of the registered meta-data.
269 /** Match field size (in bits). */
272 /** Match field offset within its parent struct (one of the headers or
279 * Table match field info get
283 * @param[in] table_id
284 * Table ID (0 .. *n_tables*).
285 * @param[in] match_field_id
286 * Match field ID (0 .. *n_match_fields* - 1).
287 * @param[out] match_field
288 * Table match field info.
290 * 0 on success or the following error codes otherwise:
291 * -EINVAL: Invalid argument.
295 rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p,
297 uint32_t match_field_id,
298 struct rte_swx_ctl_table_match_field_info *match_field);
300 /** Table action info. */
301 struct rte_swx_ctl_table_action_info {
305 /** When non-zero (true), the action can be assigned to regular table entries. */
306 int action_is_for_table_entries;
308 /** When non-zero (true), the action can be assigned to the table default entry. */
309 int action_is_for_default_entry;
313 * Table action info get
317 * @param[in] table_id
318 * Table ID (0 .. *n_tables*).
319 * @param[in] table_action_id
320 * Action index within the set of table actions (0 .. table n_actions - 1).
321 * Not to be confused with the action ID, which works at the pipeline level
322 * (0 .. pipeline n_actions - 1), which is precisely what this function
323 * returns as part of *table_action*.
324 * @param[out] table_action
327 * 0 on success or the following error codes otherwise:
328 * -EINVAL: Invalid argument.
332 rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
334 uint32_t table_action_id,
335 struct rte_swx_ctl_table_action_info *table_action);
338 * Table operations get
342 * @param[in] table_id
343 * Table ID (0 .. *n_tables*).
344 * @param[out] table_ops
345 * Table operations. Only valid when function returns success and *is_stub* is
347 * @param[out] is_stub
348 * A stub table is a table with no match fields. No "regular" table entries
349 * (i.e. entries other than the default entry) can be added to such a table,
350 * therefore the lookup operation always results in lookup miss. Non-zero
351 * (true) when the current table is a stub table, zero (false) otherwise.
353 * 0 on success or the following error codes otherwise:
354 * -EINVAL: Invalid argument.
358 rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
360 struct rte_swx_table_ops *table_ops,
363 /** Table statistics. */
364 struct rte_swx_table_stats {
365 /** Number of packets with lookup hit. */
368 /** Number of packets with lookup miss. */
369 uint64_t n_pkts_miss;
371 /** Number of packets (with either lookup hit or miss) per pipeline
372 * action. Array of pipeline *n_actions* elements indedex by the
373 * pipeline-level *action_id*, therefore this array has the same size
374 * for all the tables within the same pipeline.
376 uint64_t *n_pkts_action;
380 * Table statistics counters read
384 * @param[in] table_name
387 * Table stats. Must point to a pre-allocated structure. The *n_pkts_action*
388 * field also needs to be pre-allocated as array of pipeline *n_actions*
389 * elements. The pipeline actions that are not valid for the current table
390 * have their associated *n_pkts_action* element always set to zero.
392 * 0 on success or the following error codes otherwise:
393 * -EINVAL: Invalid argument.
397 rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p,
398 const char *table_name,
399 struct rte_swx_table_stats *stats);
402 * Selector Table Query API.
405 /** Selector info. */
406 struct rte_swx_ctl_selector_info {
407 /** Selector table name. */
408 char name[RTE_SWX_CTL_NAME_SIZE];
410 /** Number of selector fields. */
411 uint32_t n_selector_fields;
413 /** Maximum number of groups. */
414 uint32_t n_groups_max;
416 /** Maximum number of members per group. */
417 uint32_t n_members_per_group_max;
421 * Selector table info get
425 * @param[in] selector_id
426 * Selector table ID (0 .. *n_selectors* - 1).
427 * @param[out] selector
428 * Selector table info.
430 * 0 on success or the following error codes otherwise:
431 * -EINVAL: Invalid argument.
435 rte_swx_ctl_selector_info_get(struct rte_swx_pipeline *p,
436 uint32_t selector_id,
437 struct rte_swx_ctl_selector_info *selector);
440 * Selector table "group ID" field info get
444 * @param[in] selector_id
445 * Selector table ID (0 .. *n_selectors*).
447 * Selector table "group ID" field info.
449 * 0 on success or the following error codes otherwise:
450 * -EINVAL: Invalid argument.
454 rte_swx_ctl_selector_group_id_field_info_get(struct rte_swx_pipeline *p,
455 uint32_t selector_id,
456 struct rte_swx_ctl_table_match_field_info *field);
459 * Sselector table selector field info get
463 * @param[in] selector_id
464 * Selector table ID (0 .. *n_selectors*).
465 * @param[in] selector_field_id
466 * Selector table selector field ID (0 .. *n_selector_fields* - 1).
468 * Selector table selector field info.
470 * 0 on success or the following error codes otherwise:
471 * -EINVAL: Invalid argument.
475 rte_swx_ctl_selector_field_info_get(struct rte_swx_pipeline *p,
476 uint32_t selector_id,
477 uint32_t selector_field_id,
478 struct rte_swx_ctl_table_match_field_info *field);
481 * Selector table "member ID" field info get
485 * @param[in] selector_id
486 * Selector table ID (0 .. *n_selectors*).
488 * Selector table "member ID" field info.
490 * 0 on success or the following error codes otherwise:
491 * -EINVAL: Invalid argument.
495 rte_swx_ctl_selector_member_id_field_info_get(struct rte_swx_pipeline *p,
496 uint32_t selector_id,
497 struct rte_swx_ctl_table_match_field_info *field);
499 /** Selector table statistics. */
500 struct rte_swx_pipeline_selector_stats {
501 /** Number of packets. */
506 * Selector table statistics counters read
510 * @param[in] selector_name
511 * Selector table name.
513 * Selector table stats. Must point to a pre-allocated structure.
515 * 0 on success or the following error codes otherwise:
516 * -EINVAL: Invalid argument.
520 rte_swx_ctl_pipeline_selector_stats_read(struct rte_swx_pipeline *p,
521 const char *selector_name,
522 struct rte_swx_pipeline_selector_stats *stats);
525 * Learner Table Query API.
528 /** Learner table info. */
529 struct rte_swx_ctl_learner_info {
530 /** Learner table name. */
531 char name[RTE_SWX_CTL_NAME_SIZE];
533 /** Number of match fields. */
534 uint32_t n_match_fields;
536 /** Number of actions. */
539 /** Non-zero (true) when the default action is constant, therefore it
540 * cannot be changed; zero (false) when the default action not constant,
541 * therefore it can be changed.
543 int default_action_is_const;
545 /** Learner table size parameter. */
550 * Learner table info get
554 * @param[in] learner_id
555 * Learner table ID (0 .. *n_learners* - 1).
556 * @param[out] learner
557 * Learner table info.
559 * 0 on success or the following error codes otherwise:
560 * -EINVAL: Invalid argument.
564 rte_swx_ctl_learner_info_get(struct rte_swx_pipeline *p,
566 struct rte_swx_ctl_learner_info *learner);
569 * Learner table match field info get
573 * @param[in] learner_id
574 * Learner table ID (0 .. *n_learners* - 1).
575 * @param[in] match_field_id
576 * Match field ID (0 .. *n_match_fields* - 1).
577 * @param[out] match_field
578 * Learner table match field info.
580 * 0 on success or the following error codes otherwise:
581 * -EINVAL: Invalid argument.
585 rte_swx_ctl_learner_match_field_info_get(struct rte_swx_pipeline *p,
587 uint32_t match_field_id,
588 struct rte_swx_ctl_table_match_field_info *match_field);
591 * Learner table action info get
595 * @param[in] learner_id
596 * Learner table ID (0 .. *n_learners* - 1).
597 * @param[in] learner_action_id
598 * Action index within the set of learner table actions (0 .. learner table n_actions - 1). Not
599 * to be confused with the pipeline-leve action ID (0 .. pipeline n_actions - 1), which is
600 * precisely what this function returns as part of the *learner_action*.
601 * @param[out] learner_action
602 * Learner action info.
604 * 0 on success or the following error codes otherwise:
605 * -EINVAL: Invalid argument.
609 rte_swx_ctl_learner_action_info_get(struct rte_swx_pipeline *p,
611 uint32_t learner_action_id,
612 struct rte_swx_ctl_table_action_info *learner_action);
614 /** Learner table statistics. */
615 struct rte_swx_learner_stats {
616 /** Number of packets with lookup hit. */
619 /** Number of packets with lookup miss. */
620 uint64_t n_pkts_miss;
622 /** Number of packets with successful learning. */
623 uint64_t n_pkts_learn_ok;
625 /** Number of packets with learning error. */
626 uint64_t n_pkts_learn_err;
628 /** Number of packets with forget event. */
629 uint64_t n_pkts_forget;
631 /** Number of packets (with either lookup hit or miss) per pipeline action. Array of
632 * pipeline *n_actions* elements indedex by the pipeline-level *action_id*, therefore this
633 * array has the same size for all the tables within the same pipeline.
635 uint64_t *n_pkts_action;
639 * Learner table statistics counters read
643 * @param[in] learner_name
644 * Learner table name.
646 * Learner table stats. Must point to a pre-allocated structure. The *n_pkts_action* field also
647 * needs to be pre-allocated as array of pipeline *n_actions* elements. The pipeline actions that
648 * are not valid for the current learner table have their associated *n_pkts_action* element
649 * always set to zero.
651 * 0 on success or the following error codes otherwise:
652 * -EINVAL: Invalid argument.
656 rte_swx_ctl_pipeline_learner_stats_read(struct rte_swx_pipeline *p,
657 const char *learner_name,
658 struct rte_swx_learner_stats *stats);
665 struct rte_swx_table_state {
669 /** Action ID of the table default action. */
670 uint64_t default_action_id;
672 /** Action data of the table default action. Ignored when the action
673 * data size is zero; otherwise, action data size bytes are meaningful.
675 uint8_t *default_action_data;
679 * Pipeline table state get
683 * @param[out] table_state
684 * After successful execution, the *table_state* contains the pointer to the
685 * current pipeline table state, which is an array of *n_tables* elements,
686 * with array element i containing the state of the i-th pipeline table. The
687 * pipeline continues to own all the data structures directly or indirectly
688 * referenced by the *table_state* until the subsequent successful invocation
689 * of function *rte_swx_pipeline_table_state_set*.
691 * 0 on success or the following error codes otherwise:
692 * -EINVAL: Invalid argument.
696 rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
697 struct rte_swx_table_state **table_state);
700 * Pipeline table state set
704 * @param[out] table_state
705 * After successful execution, the pipeline table state is updated to this
706 * *table_state*. The ownership of all the data structures directly or
707 * indirectly referenced by this *table_state* is passed from the caller to
710 * 0 on success or the following error codes otherwise:
711 * -EINVAL: Invalid argument.
715 rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
716 struct rte_swx_table_state *table_state);
719 * High Level Reference Table Update API.
722 /** Pipeline control opaque data structure. */
723 struct rte_swx_ctl_pipeline;
726 * Pipeline control create
731 * Pipeline control handle, on success, or NULL, on error.
734 struct rte_swx_ctl_pipeline *
735 rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
738 * Pipeline table entry add
740 * Schedule entry for addition to table or update as part of the next commit
744 * Pipeline control handle.
745 * @param[in] table_name
748 * Entry to be added to the table.
750 * 0 on success or the following error codes otherwise:
751 * -EINVAL: Invalid argument.
755 rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
756 const char *table_name,
757 struct rte_swx_table_entry *entry);
760 * Pipeline table default entry add
762 * Schedule table default entry update as part of the next commit operation.
765 * Pipeline control handle.
766 * @param[in] table_name
769 * The new table default entry. The *key* and *key_mask* entry fields are
772 * 0 on success or the following error codes otherwise:
773 * -EINVAL: Invalid argument.
777 rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
778 const char *table_name,
779 struct rte_swx_table_entry *entry);
782 * Pipeline table entry delete
784 * Schedule entry for deletion from table as part of the next commit operation.
785 * Request is silently discarded if no such entry exists.
788 * Pipeline control handle.
789 * @param[in] table_name
792 * Entry to be deleted from the table. The *action_id* and *action_data* entry
793 * fields are ignored.
795 * 0 on success or the following error codes otherwise:
796 * -EINVAL: Invalid argument.
800 rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
801 const char *table_name,
802 struct rte_swx_table_entry *entry);
805 * Pipeline selector table group add
807 * Add a new group to a selector table. This operation is executed before this
808 * function returns and its result is independent of the result of the next
812 * Pipeline control handle.
813 * @param[in] selector_name
814 * Selector table name.
815 * @param[out] group_id
816 * The ID of the new group. Only valid when the function call is successful.
817 * This group is initially empty, i.e. it does not contain any members.
819 * 0 on success or the following error codes otherwise:
820 * -EINVAL: Invalid argument;
821 * -ENOSPC: All groups are currently in use, no group available.
825 rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl,
826 const char *selector_name,
830 * Pipeline selector table group delete
832 * Schedule a group for deletion as part of the next commit operation. The group
833 * to be deleted can be empty or non-empty.
836 * Pipeline control handle.
837 * @param[in] selector_name
838 * Selector table name.
839 * @param[in] group_id
840 * Group to be deleted from the selector table.
842 * 0 on success or the following error codes otherwise:
843 * -EINVAL: Invalid argument;
844 * -ENOMEM: Not enough memory.
848 rte_swx_ctl_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl,
849 const char *selector_name,
853 * Pipeline selector table member add to group
855 * Schedule the operation to add a new member to an existing group as part of
856 * the next commit operation. If this member is already in this group, the
857 * member weight is updated to the new value. A weight of zero means this member
858 * is to be deleted from the group.
861 * Pipeline control handle.
862 * @param[in] selector_name
863 * Selector table name.
864 * @param[in] group_id
866 * @param[in] member_id
867 * The member to be added to the group.
868 * @param[in] member_weight
871 * 0 on success or the following error codes otherwise:
872 * -EINVAL: Invalid argument;
873 * -ENOMEM: Not enough memory;
874 * -ENOSPC: The group is full.
878 rte_swx_ctl_pipeline_selector_group_member_add(struct rte_swx_ctl_pipeline *ctl,
879 const char *selector_name,
882 uint32_t member_weight);
885 * Pipeline selector table member delete from group
887 * Schedule the operation to delete a member from an existing group as part of
888 * the next commit operation.
891 * Pipeline control handle.
892 * @param[in] selector_name
893 * Selector table name.
894 * @param[in] group_id
895 * The group ID. Must be valid.
896 * @param[in] member_id
897 * The member to be added to the group. Must be valid.
899 * 0 on success or the following error codes otherwise:
900 * -EINVAL: Invalid argument.
904 rte_swx_ctl_pipeline_selector_group_member_delete(struct rte_swx_ctl_pipeline *ctl,
905 const char *selector_name,
910 * Pipeline learner table default entry add
912 * Schedule learner table default entry update as part of the next commit operation.
915 * Pipeline control handle.
916 * @param[in] learner_name
917 * Learner table name.
919 * The new table default entry. The *key* and *key_mask* entry fields are ignored.
921 * 0 on success or the following error codes otherwise:
922 * -EINVAL: Invalid argument.
926 rte_swx_ctl_pipeline_learner_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
927 const char *learner_name,
928 struct rte_swx_table_entry *entry);
933 * Perform all the scheduled table work.
936 * Pipeline control handle.
937 * @param[in] abort_on_fail
938 * When non-zero (false), all the scheduled work is discarded after a failed
939 * commit. Otherwise, the scheduled work is still kept pending for the next
942 * 0 on success or the following error codes otherwise:
943 * -EINVAL: Invalid argument.
947 rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
953 * Discard all the scheduled table work.
956 * Pipeline control handle.
960 rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
963 * Pipeline table entry read
965 * Read table entry from string.
968 * Pipeline control handle.
969 * @param[in] table_name
972 * String containing the table entry.
973 * @param[out] is_blank_or_comment
974 * On error, this argument provides an indication of whether *string* contains
975 * an invalid table entry (set to zero) or a blank or comment line that should
976 * typically be ignored (set to a non-zero value).
978 * 0 on success or the following error codes otherwise:
979 * -EINVAL: Invalid argument.
982 struct rte_swx_table_entry *
983 rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
984 const char *table_name,
986 int *is_blank_or_comment);
989 * Pipeline learner table default entry read
991 * Read learner table default entry from string.
994 * Pipeline control handle.
995 * @param[in] learner_name
996 * Learner table name.
998 * String containing the learner table default entry.
999 * @param[out] is_blank_or_comment
1000 * On error, this argument provides an indication of whether *string* contains
1001 * an invalid table entry (set to zero) or a blank or comment line that should
1002 * typically be ignored (set to a non-zero value).
1004 * 0 on success or the following error codes otherwise:
1005 * -EINVAL: Invalid argument.
1008 struct rte_swx_table_entry *
1009 rte_swx_ctl_pipeline_learner_default_entry_read(struct rte_swx_ctl_pipeline *ctl,
1010 const char *learner_name,
1012 int *is_blank_or_comment);
1015 * Pipeline table print to file
1017 * Print all the table entries to file.
1022 * Pipeline control handle.
1023 * @param[in] table_name
1026 * 0 on success or the following error codes otherwise:
1027 * -EINVAL: Invalid argument.
1031 rte_swx_ctl_pipeline_table_fprintf(FILE *f,
1032 struct rte_swx_ctl_pipeline *ctl,
1033 const char *table_name);
1036 * Pipeline selector print to file
1038 * Print all the selector entries to file.
1043 * Pipeline control handle.
1044 * @param[in] selector_name
1045 * Selector table name.
1047 * 0 on success or the following error codes otherwise:
1048 * -EINVAL: Invalid argument.
1052 rte_swx_ctl_pipeline_selector_fprintf(FILE *f,
1053 struct rte_swx_ctl_pipeline *ctl,
1054 const char *selector_name);
1057 * Register Array Query API.
1060 /** Register array info. */
1061 struct rte_swx_ctl_regarray_info {
1062 /** Register array name. */
1063 char name[RTE_SWX_CTL_NAME_SIZE];
1065 /** Register array size. */
1070 * Register array info get
1074 * @param[in] regarray_id
1075 * Register array ID (0 .. *n_regarrays* - 1).
1076 * @param[out] regarray
1077 * Register array info.
1079 * 0 on success or the following error codes otherwise:
1080 * -EINVAL: Invalid argument.
1084 rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p,
1085 uint32_t regarray_id,
1086 struct rte_swx_ctl_regarray_info *regarray);
1093 * @param[in] regarray_name
1094 * Register array name.
1095 * @param[in] regarray_index
1096 * Register index within the array (0 .. *size* - 1).
1098 * Current register value.
1100 * 0 on success or the following error codes otherwise:
1101 * -EINVAL: Invalid argument.
1105 rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p,
1106 const char *regarray_name,
1107 uint32_t regarray_index,
1115 * @param[in] regarray_name
1116 * Register array name.
1117 * @param[in] regarray_index
1118 * Register index within the array (0 .. *size* - 1).
1120 * Value to be written to the register.
1122 * 0 on success or the following error codes otherwise:
1123 * -EINVAL: Invalid argument.
1127 rte_swx_ctl_pipeline_regarray_write(struct rte_swx_pipeline *p,
1128 const char *regarray_name,
1129 uint32_t regarray_index,
1133 * Meter Array Query and Configuration API.
1136 /** Meter array info. */
1137 struct rte_swx_ctl_metarray_info {
1138 /** Meter array name. */
1139 char name[RTE_SWX_CTL_NAME_SIZE];
1141 /** Meter array size. */
1146 * Meter array info get
1150 * @param[in] metarray_id
1151 * Meter array ID (0 .. *n_metarrays* - 1).
1152 * @param[out] metarray
1155 * 0 on success or the following error codes otherwise:
1156 * -EINVAL: Invalid argument.
1160 rte_swx_ctl_metarray_info_get(struct rte_swx_pipeline *p,
1161 uint32_t metarray_id,
1162 struct rte_swx_ctl_metarray_info *metarray);
1170 * Meter profile name.
1172 * Meter profile parameters.
1174 * 0 on success or the following error codes otherwise:
1175 * -EINVAL: Invalid argument;
1176 * -ENOMEM: Not enough space/cannot allocate memory;
1177 * -EEXIST: Meter profile with this name already exists.
1181 rte_swx_ctl_meter_profile_add(struct rte_swx_pipeline *p,
1183 struct rte_meter_trtcm_params *params);
1186 * Meter profile delete
1191 * Meter profile name.
1193 * 0 on success or the following error codes otherwise:
1194 * -EINVAL: Invalid argument;
1195 * -EBUSY: Meter profile is currently in use.
1199 rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p,
1205 * Reset a meter within a given meter array to use the default profile that
1206 * causes all the input packets to be colored as green. It is the responsibility
1207 * of the control plane to make sure this meter is not used by the data plane
1208 * pipeline before calling this function.
1212 * @param[in] metarray_name
1214 * @param[in] metarray_index
1215 * Meter index within the meter array.
1217 * 0 on success or the following error codes otherwise:
1218 * -EINVAL: Invalid argument.
1222 rte_swx_ctl_meter_reset(struct rte_swx_pipeline *p,
1223 const char *metarray_name,
1224 uint32_t metarray_index);
1229 * Set a meter within a given meter array to use a specific profile. It is the
1230 * responsibility of the control plane to make sure this meter is not used by
1231 * the data plane pipeline before calling this function.
1235 * @param[in] metarray_name
1237 * @param[in] metarray_index
1238 * Meter index within the meter array.
1239 * @param[in] profile_name
1240 * Existing meter profile name.
1242 * 0 on success or the following error codes otherwise:
1243 * -EINVAL: Invalid argument.
1247 rte_swx_ctl_meter_set(struct rte_swx_pipeline *p,
1248 const char *metarray_name,
1249 uint32_t metarray_index,
1250 const char *profile_name);
1252 /** Meter statistics counters. */
1253 struct rte_swx_ctl_meter_stats {
1254 /** Number of packets tagged by the meter for each color. */
1255 uint64_t n_pkts[RTE_COLORS];
1257 /** Number of bytes tagged by the meter for each color. */
1258 uint64_t n_bytes[RTE_COLORS];
1262 * Meter statistics counters read
1266 * @param[in] metarray_name
1268 * @param[in] metarray_index
1269 * Meter index within the meter array.
1271 * Meter statistics counters.
1273 * 0 on success or the following error codes otherwise:
1274 * -EINVAL: Invalid argument.
1278 rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
1279 const char *metarray_name,
1280 uint32_t metarray_index,
1281 struct rte_swx_ctl_meter_stats *stats);
1284 * Pipeline control free
1287 * Pipeline control handle.
1291 rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl);