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 {
307 * Table action info get
311 * @param[in] table_id
312 * Table ID (0 .. *n_tables*).
313 * @param[in] table_action_id
314 * Action index within the set of table actions (0 .. table n_actions - 1).
315 * Not to be confused with the action ID, which works at the pipeline level
316 * (0 .. pipeline n_actions - 1), which is precisely what this function
317 * returns as part of *table_action*.
318 * @param[out] table_action
321 * 0 on success or the following error codes otherwise:
322 * -EINVAL: Invalid argument.
326 rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
328 uint32_t table_action_id,
329 struct rte_swx_ctl_table_action_info *table_action);
332 * Table operations get
336 * @param[in] table_id
337 * Table ID (0 .. *n_tables*).
338 * @param[out] table_ops
339 * Table operations. Only valid when function returns success and *is_stub* is
341 * @param[out] is_stub
342 * A stub table is a table with no match fields. No "regular" table entries
343 * (i.e. entries other than the default entry) can be added to such a table,
344 * therefore the lookup operation always results in lookup miss. Non-zero
345 * (true) when the current table is a stub table, zero (false) otherwise.
347 * 0 on success or the following error codes otherwise:
348 * -EINVAL: Invalid argument.
352 rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
354 struct rte_swx_table_ops *table_ops,
357 /** Table statistics. */
358 struct rte_swx_table_stats {
359 /** Number of packets with lookup hit. */
362 /** Number of packets with lookup miss. */
363 uint64_t n_pkts_miss;
365 /** Number of packets (with either lookup hit or miss) per pipeline
366 * action. Array of pipeline *n_actions* elements indedex by the
367 * pipeline-level *action_id*, therefore this array has the same size
368 * for all the tables within the same pipeline.
370 uint64_t *n_pkts_action;
374 * Table statistics counters read
378 * @param[in] table_name
381 * Table stats. Must point to a pre-allocated structure. The *n_pkts_action*
382 * field also needs to be pre-allocated as array of pipeline *n_actions*
383 * elements. The pipeline actions that are not valid for the current table
384 * have their associated *n_pkts_action* element always set to zero.
386 * 0 on success or the following error codes otherwise:
387 * -EINVAL: Invalid argument.
391 rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p,
392 const char *table_name,
393 struct rte_swx_table_stats *stats);
396 * Selector Table Query API.
399 /** Selector info. */
400 struct rte_swx_ctl_selector_info {
401 /** Selector table name. */
402 char name[RTE_SWX_CTL_NAME_SIZE];
404 /** Number of selector fields. */
405 uint32_t n_selector_fields;
407 /** Maximum number of groups. */
408 uint32_t n_groups_max;
410 /** Maximum number of members per group. */
411 uint32_t n_members_per_group_max;
415 * Selector table info get
419 * @param[in] selector_id
420 * Selector table ID (0 .. *n_selectors* - 1).
421 * @param[out] selector
422 * Selector table info.
424 * 0 on success or the following error codes otherwise:
425 * -EINVAL: Invalid argument.
429 rte_swx_ctl_selector_info_get(struct rte_swx_pipeline *p,
430 uint32_t selector_id,
431 struct rte_swx_ctl_selector_info *selector);
434 * Selector table "group ID" field info get
438 * @param[in] selector_id
439 * Selector table ID (0 .. *n_selectors*).
441 * Selector table "group ID" field info.
443 * 0 on success or the following error codes otherwise:
444 * -EINVAL: Invalid argument.
448 rte_swx_ctl_selector_group_id_field_info_get(struct rte_swx_pipeline *p,
449 uint32_t selector_id,
450 struct rte_swx_ctl_table_match_field_info *field);
453 * Sselector table selector field info get
457 * @param[in] selector_id
458 * Selector table ID (0 .. *n_selectors*).
459 * @param[in] selector_field_id
460 * Selector table selector field ID (0 .. *n_selector_fields* - 1).
462 * Selector table selector field info.
464 * 0 on success or the following error codes otherwise:
465 * -EINVAL: Invalid argument.
469 rte_swx_ctl_selector_field_info_get(struct rte_swx_pipeline *p,
470 uint32_t selector_id,
471 uint32_t selector_field_id,
472 struct rte_swx_ctl_table_match_field_info *field);
475 * Selector table "member ID" field info get
479 * @param[in] selector_id
480 * Selector table ID (0 .. *n_selectors*).
482 * Selector table "member ID" field info.
484 * 0 on success or the following error codes otherwise:
485 * -EINVAL: Invalid argument.
489 rte_swx_ctl_selector_member_id_field_info_get(struct rte_swx_pipeline *p,
490 uint32_t selector_id,
491 struct rte_swx_ctl_table_match_field_info *field);
493 /** Selector table statistics. */
494 struct rte_swx_pipeline_selector_stats {
495 /** Number of packets. */
500 * Selector table statistics counters read
504 * @param[in] selector_name
505 * Selector table name.
507 * Selector table stats. Must point to a pre-allocated structure.
509 * 0 on success or the following error codes otherwise:
510 * -EINVAL: Invalid argument.
514 rte_swx_ctl_pipeline_selector_stats_read(struct rte_swx_pipeline *p,
515 const char *selector_name,
516 struct rte_swx_pipeline_selector_stats *stats);
519 * Learner Table Query API.
522 /** Learner table info. */
523 struct rte_swx_ctl_learner_info {
524 /** Learner table name. */
525 char name[RTE_SWX_CTL_NAME_SIZE];
527 /** Number of match fields. */
528 uint32_t n_match_fields;
530 /** Number of actions. */
533 /** Non-zero (true) when the default action is constant, therefore it
534 * cannot be changed; zero (false) when the default action not constant,
535 * therefore it can be changed.
537 int default_action_is_const;
539 /** Learner table size parameter. */
544 * Learner table info get
548 * @param[in] learner_id
549 * Learner table ID (0 .. *n_learners* - 1).
550 * @param[out] learner
551 * Learner table info.
553 * 0 on success or the following error codes otherwise:
554 * -EINVAL: Invalid argument.
558 rte_swx_ctl_learner_info_get(struct rte_swx_pipeline *p,
560 struct rte_swx_ctl_learner_info *learner);
563 * Learner table match field info get
567 * @param[in] learner_id
568 * Learner table ID (0 .. *n_learners* - 1).
569 * @param[in] match_field_id
570 * Match field ID (0 .. *n_match_fields* - 1).
571 * @param[out] match_field
572 * Learner table match field info.
574 * 0 on success or the following error codes otherwise:
575 * -EINVAL: Invalid argument.
579 rte_swx_ctl_learner_match_field_info_get(struct rte_swx_pipeline *p,
581 uint32_t match_field_id,
582 struct rte_swx_ctl_table_match_field_info *match_field);
585 * Learner table action info get
589 * @param[in] learner_id
590 * Learner table ID (0 .. *n_learners* - 1).
591 * @param[in] learner_action_id
592 * Action index within the set of learner table actions (0 .. learner table n_actions - 1). Not
593 * to be confused with the pipeline-leve action ID (0 .. pipeline n_actions - 1), which is
594 * precisely what this function returns as part of the *learner_action*.
595 * @param[out] learner_action
596 * Learner action info.
598 * 0 on success or the following error codes otherwise:
599 * -EINVAL: Invalid argument.
603 rte_swx_ctl_learner_action_info_get(struct rte_swx_pipeline *p,
605 uint32_t learner_action_id,
606 struct rte_swx_ctl_table_action_info *learner_action);
608 /** Learner table statistics. */
609 struct rte_swx_learner_stats {
610 /** Number of packets with lookup hit. */
613 /** Number of packets with lookup miss. */
614 uint64_t n_pkts_miss;
616 /** Number of packets with successful learning. */
617 uint64_t n_pkts_learn_ok;
619 /** Number of packets with learning error. */
620 uint64_t n_pkts_learn_err;
622 /** Number of packets with forget event. */
623 uint64_t n_pkts_forget;
625 /** Number of packets (with either lookup hit or miss) per pipeline action. Array of
626 * pipeline *n_actions* elements indedex by the pipeline-level *action_id*, therefore this
627 * array has the same size for all the tables within the same pipeline.
629 uint64_t *n_pkts_action;
633 * Learner table statistics counters read
637 * @param[in] learner_name
638 * Learner table name.
640 * Learner table stats. Must point to a pre-allocated structure. The *n_pkts_action* field also
641 * needs to be pre-allocated as array of pipeline *n_actions* elements. The pipeline actions that
642 * are not valid for the current learner table have their associated *n_pkts_action* element
643 * always set to zero.
645 * 0 on success or the following error codes otherwise:
646 * -EINVAL: Invalid argument.
650 rte_swx_ctl_pipeline_learner_stats_read(struct rte_swx_pipeline *p,
651 const char *learner_name,
652 struct rte_swx_learner_stats *stats);
659 struct rte_swx_table_state {
663 /** Action ID of the table default action. */
664 uint64_t default_action_id;
666 /** Action data of the table default action. Ignored when the action
667 * data size is zero; otherwise, action data size bytes are meaningful.
669 uint8_t *default_action_data;
673 * Pipeline table state get
677 * @param[out] table_state
678 * After successful execution, the *table_state* contains the pointer to the
679 * current pipeline table state, which is an array of *n_tables* elements,
680 * with array element i containing the state of the i-th pipeline table. The
681 * pipeline continues to own all the data structures directly or indirectly
682 * referenced by the *table_state* until the subsequent successful invocation
683 * of function *rte_swx_pipeline_table_state_set*.
685 * 0 on success or the following error codes otherwise:
686 * -EINVAL: Invalid argument.
690 rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
691 struct rte_swx_table_state **table_state);
694 * Pipeline table state set
698 * @param[out] table_state
699 * After successful execution, the pipeline table state is updated to this
700 * *table_state*. The ownership of all the data structures directly or
701 * indirectly referenced by this *table_state* is passed from the caller to
704 * 0 on success or the following error codes otherwise:
705 * -EINVAL: Invalid argument.
709 rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
710 struct rte_swx_table_state *table_state);
713 * High Level Reference Table Update API.
716 /** Pipeline control opaque data structure. */
717 struct rte_swx_ctl_pipeline;
720 * Pipeline control create
725 * Pipeline control handle, on success, or NULL, on error.
728 struct rte_swx_ctl_pipeline *
729 rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
732 * Pipeline table entry add
734 * Schedule entry for addition to table or update as part of the next commit
738 * Pipeline control handle.
739 * @param[in] table_name
742 * Entry to be added to the table.
744 * 0 on success or the following error codes otherwise:
745 * -EINVAL: Invalid argument.
749 rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
750 const char *table_name,
751 struct rte_swx_table_entry *entry);
754 * Pipeline table default entry add
756 * Schedule table default entry update as part of the next commit operation.
759 * Pipeline control handle.
760 * @param[in] table_name
763 * The new table default entry. The *key* and *key_mask* entry fields are
766 * 0 on success or the following error codes otherwise:
767 * -EINVAL: Invalid argument.
771 rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
772 const char *table_name,
773 struct rte_swx_table_entry *entry);
776 * Pipeline table entry delete
778 * Schedule entry for deletion from table as part of the next commit operation.
779 * Request is silently discarded if no such entry exists.
782 * Pipeline control handle.
783 * @param[in] table_name
786 * Entry to be deleted from the table. The *action_id* and *action_data* entry
787 * fields are ignored.
789 * 0 on success or the following error codes otherwise:
790 * -EINVAL: Invalid argument.
794 rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
795 const char *table_name,
796 struct rte_swx_table_entry *entry);
799 * Pipeline selector table group add
801 * Add a new group to a selector table. This operation is executed before this
802 * function returns and its result is independent of the result of the next
806 * Pipeline control handle.
807 * @param[in] selector_name
808 * Selector table name.
809 * @param[out] group_id
810 * The ID of the new group. Only valid when the function call is successful.
811 * This group is initially empty, i.e. it does not contain any members.
813 * 0 on success or the following error codes otherwise:
814 * -EINVAL: Invalid argument;
815 * -ENOSPC: All groups are currently in use, no group available.
819 rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl,
820 const char *selector_name,
824 * Pipeline selector table group delete
826 * Schedule a group for deletion as part of the next commit operation. The group
827 * to be deleted can be empty or non-empty.
830 * Pipeline control handle.
831 * @param[in] selector_name
832 * Selector table name.
833 * @param[in] group_id
834 * Group to be deleted from the selector table.
836 * 0 on success or the following error codes otherwise:
837 * -EINVAL: Invalid argument;
838 * -ENOMEM: Not enough memory.
842 rte_swx_ctl_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl,
843 const char *selector_name,
847 * Pipeline selector table member add to group
849 * Schedule the operation to add a new member to an existing group as part of
850 * the next commit operation. If this member is already in this group, the
851 * member weight is updated to the new value. A weight of zero means this member
852 * is to be deleted from the group.
855 * Pipeline control handle.
856 * @param[in] selector_name
857 * Selector table name.
858 * @param[in] group_id
860 * @param[in] member_id
861 * The member to be added to the group.
862 * @param[in] member_weight
865 * 0 on success or the following error codes otherwise:
866 * -EINVAL: Invalid argument;
867 * -ENOMEM: Not enough memory;
868 * -ENOSPC: The group is full.
872 rte_swx_ctl_pipeline_selector_group_member_add(struct rte_swx_ctl_pipeline *ctl,
873 const char *selector_name,
876 uint32_t member_weight);
879 * Pipeline selector table member delete from group
881 * Schedule the operation to delete a member from an existing group as part of
882 * the next commit operation.
885 * Pipeline control handle.
886 * @param[in] selector_name
887 * Selector table name.
888 * @param[in] group_id
889 * The group ID. Must be valid.
890 * @param[in] member_id
891 * The member to be added to the group. Must be valid.
893 * 0 on success or the following error codes otherwise:
894 * -EINVAL: Invalid argument.
898 rte_swx_ctl_pipeline_selector_group_member_delete(struct rte_swx_ctl_pipeline *ctl,
899 const char *selector_name,
904 * Pipeline learner table default entry add
906 * Schedule learner table default entry update as part of the next commit operation.
909 * Pipeline control handle.
910 * @param[in] learner_name
911 * Learner table name.
913 * The new table default entry. The *key* and *key_mask* entry fields are ignored.
915 * 0 on success or the following error codes otherwise:
916 * -EINVAL: Invalid argument.
920 rte_swx_ctl_pipeline_learner_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
921 const char *learner_name,
922 struct rte_swx_table_entry *entry);
927 * Perform all the scheduled table work.
930 * Pipeline control handle.
931 * @param[in] abort_on_fail
932 * When non-zero (false), all the scheduled work is discarded after a failed
933 * commit. Otherwise, the scheduled work is still kept pending for the next
936 * 0 on success or the following error codes otherwise:
937 * -EINVAL: Invalid argument.
941 rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
947 * Discard all the scheduled table work.
950 * Pipeline control handle.
954 rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
957 * Pipeline table entry read
959 * Read table entry from string.
962 * Pipeline control handle.
963 * @param[in] table_name
966 * String containing the table entry.
967 * @param[out] is_blank_or_comment
968 * On error, this argument provides an indication of whether *string* contains
969 * an invalid table entry (set to zero) or a blank or comment line that should
970 * typically be ignored (set to a non-zero value).
972 * 0 on success or the following error codes otherwise:
973 * -EINVAL: Invalid argument.
976 struct rte_swx_table_entry *
977 rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
978 const char *table_name,
980 int *is_blank_or_comment);
983 * Pipeline learner table default entry read
985 * Read learner table default entry from string.
988 * Pipeline control handle.
989 * @param[in] learner_name
990 * Learner table name.
992 * String containing the learner table default entry.
993 * @param[out] is_blank_or_comment
994 * On error, this argument provides an indication of whether *string* contains
995 * an invalid table entry (set to zero) or a blank or comment line that should
996 * typically be ignored (set to a non-zero value).
998 * 0 on success or the following error codes otherwise:
999 * -EINVAL: Invalid argument.
1002 struct rte_swx_table_entry *
1003 rte_swx_ctl_pipeline_learner_default_entry_read(struct rte_swx_ctl_pipeline *ctl,
1004 const char *learner_name,
1006 int *is_blank_or_comment);
1009 * Pipeline table print to file
1011 * Print all the table entries to file.
1016 * Pipeline control handle.
1017 * @param[in] table_name
1020 * 0 on success or the following error codes otherwise:
1021 * -EINVAL: Invalid argument.
1025 rte_swx_ctl_pipeline_table_fprintf(FILE *f,
1026 struct rte_swx_ctl_pipeline *ctl,
1027 const char *table_name);
1030 * Pipeline selector print to file
1032 * Print all the selector entries to file.
1037 * Pipeline control handle.
1038 * @param[in] selector_name
1039 * Selector table name.
1041 * 0 on success or the following error codes otherwise:
1042 * -EINVAL: Invalid argument.
1046 rte_swx_ctl_pipeline_selector_fprintf(FILE *f,
1047 struct rte_swx_ctl_pipeline *ctl,
1048 const char *selector_name);
1051 * Register Array Query API.
1054 /** Register array info. */
1055 struct rte_swx_ctl_regarray_info {
1056 /** Register array name. */
1057 char name[RTE_SWX_CTL_NAME_SIZE];
1059 /** Register array size. */
1064 * Register array info get
1068 * @param[in] regarray_id
1069 * Register array ID (0 .. *n_regarrays* - 1).
1070 * @param[out] regarray
1071 * Register array info.
1073 * 0 on success or the following error codes otherwise:
1074 * -EINVAL: Invalid argument.
1078 rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p,
1079 uint32_t regarray_id,
1080 struct rte_swx_ctl_regarray_info *regarray);
1087 * @param[in] regarray_name
1088 * Register array name.
1089 * @param[in] regarray_index
1090 * Register index within the array (0 .. *size* - 1).
1092 * Current register value.
1094 * 0 on success or the following error codes otherwise:
1095 * -EINVAL: Invalid argument.
1099 rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p,
1100 const char *regarray_name,
1101 uint32_t regarray_index,
1109 * @param[in] regarray_name
1110 * Register array name.
1111 * @param[in] regarray_index
1112 * Register index within the array (0 .. *size* - 1).
1114 * Value to be written to the register.
1116 * 0 on success or the following error codes otherwise:
1117 * -EINVAL: Invalid argument.
1121 rte_swx_ctl_pipeline_regarray_write(struct rte_swx_pipeline *p,
1122 const char *regarray_name,
1123 uint32_t regarray_index,
1127 * Meter Array Query and Configuration API.
1130 /** Meter array info. */
1131 struct rte_swx_ctl_metarray_info {
1132 /** Meter array name. */
1133 char name[RTE_SWX_CTL_NAME_SIZE];
1135 /** Meter array size. */
1140 * Meter array info get
1144 * @param[in] metarray_id
1145 * Meter array ID (0 .. *n_metarrays* - 1).
1146 * @param[out] metarray
1149 * 0 on success or the following error codes otherwise:
1150 * -EINVAL: Invalid argument.
1154 rte_swx_ctl_metarray_info_get(struct rte_swx_pipeline *p,
1155 uint32_t metarray_id,
1156 struct rte_swx_ctl_metarray_info *metarray);
1164 * Meter profile name.
1166 * Meter profile parameters.
1168 * 0 on success or the following error codes otherwise:
1169 * -EINVAL: Invalid argument;
1170 * -ENOMEM: Not enough space/cannot allocate memory;
1171 * -EEXIST: Meter profile with this name already exists.
1175 rte_swx_ctl_meter_profile_add(struct rte_swx_pipeline *p,
1177 struct rte_meter_trtcm_params *params);
1180 * Meter profile delete
1185 * Meter profile name.
1187 * 0 on success or the following error codes otherwise:
1188 * -EINVAL: Invalid argument;
1189 * -EBUSY: Meter profile is currently in use.
1193 rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p,
1199 * Reset a meter within a given meter array to use the default profile that
1200 * causes all the input packets to be colored as green. It is the responsibility
1201 * of the control plane to make sure this meter is not used by the data plane
1202 * pipeline before calling this function.
1206 * @param[in] metarray_name
1208 * @param[in] metarray_index
1209 * Meter index within the meter array.
1211 * 0 on success or the following error codes otherwise:
1212 * -EINVAL: Invalid argument.
1216 rte_swx_ctl_meter_reset(struct rte_swx_pipeline *p,
1217 const char *metarray_name,
1218 uint32_t metarray_index);
1223 * Set a meter within a given meter array to use a specific profile. It is the
1224 * responsibility of the control plane to make sure this meter is not used by
1225 * the data plane pipeline before calling this function.
1229 * @param[in] metarray_name
1231 * @param[in] metarray_index
1232 * Meter index within the meter array.
1233 * @param[in] profile_name
1234 * Existing meter profile name.
1236 * 0 on success or the following error codes otherwise:
1237 * -EINVAL: Invalid argument.
1241 rte_swx_ctl_meter_set(struct rte_swx_pipeline *p,
1242 const char *metarray_name,
1243 uint32_t metarray_index,
1244 const char *profile_name);
1246 /** Meter statistics counters. */
1247 struct rte_swx_ctl_meter_stats {
1248 /** Number of packets tagged by the meter for each color. */
1249 uint64_t n_pkts[RTE_COLORS];
1251 /** Number of bytes tagged by the meter for each color. */
1252 uint64_t n_bytes[RTE_COLORS];
1256 * Meter statistics counters read
1260 * @param[in] metarray_name
1262 * @param[in] metarray_index
1263 * Meter index within the meter array.
1265 * Meter statistics counters.
1267 * 0 on success or the following error codes otherwise:
1268 * -EINVAL: Invalid argument.
1272 rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
1273 const char *metarray_name,
1274 uint32_t metarray_index,
1275 struct rte_swx_ctl_meter_stats *stats);
1278 * Pipeline control free
1281 * Pipeline control handle.
1285 rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl);