DPDK  21.08.0
rte_swx_ctl.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4 #ifndef __INCLUDE_RTE_SWX_CTL_H__
5 #define __INCLUDE_RTE_SWX_CTL_H__
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
16 #include <stddef.h>
17 #include <stdint.h>
18 #include <stdio.h>
19 
20 #include <rte_compat.h>
21 #include <rte_meter.h>
22 
23 #include "rte_swx_port.h"
24 #include "rte_swx_table.h"
25 #include "rte_swx_table_selector.h"
26 
27 struct rte_swx_pipeline;
28 
30 #ifndef RTE_SWX_CTL_NAME_SIZE
31 #define RTE_SWX_CTL_NAME_SIZE 64
32 #endif
33 
34 /*
35  * Pipeline Query API.
36  */
37 
41  uint32_t n_ports_in;
42 
44  uint32_t n_ports_out;
45 
47  uint32_t n_actions;
48 
50  uint32_t n_tables;
51 
53  uint32_t n_selectors;
54 
56  uint32_t n_regarrays;
57 
59  uint32_t n_metarrays;
60 };
61 
73 __rte_experimental
74 int
75 rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p,
76  struct rte_swx_ctl_pipeline_info *pipeline);
77 
89 __rte_experimental
90 int
91 rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p,
92  int *numa_node);
93 
94 /*
95  * Ports Query API.
96  */
97 
111 __rte_experimental
112 int
113 rte_swx_ctl_pipeline_port_in_stats_read(struct rte_swx_pipeline *p,
114  uint32_t port_id,
115  struct rte_swx_port_in_stats *stats);
116 
130 __rte_experimental
131 int
132 rte_swx_ctl_pipeline_port_out_stats_read(struct rte_swx_pipeline *p,
133  uint32_t port_id,
134  struct rte_swx_port_out_stats *stats);
135 
136 /*
137  * Action Query API.
138  */
139 
144 
146  uint32_t n_args;
147 };
148 
162 __rte_experimental
163 int
164 rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p,
165  uint32_t action_id,
166  struct rte_swx_ctl_action_info *action);
167 
172 
174  uint32_t n_bits;
175 
181 };
182 
198 __rte_experimental
199 int
200 rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p,
201  uint32_t action_id,
202  uint32_t action_arg_id,
203  struct rte_swx_ctl_action_arg_info *action_arg);
204 
205 /*
206  * Table Query API.
207  */
208 
213 
216 
218  uint32_t n_match_fields;
219 
221  uint32_t n_actions;
222 
228 
230  uint32_t size;
231 };
232 
246 __rte_experimental
247 int
248 rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p,
249  uint32_t table_id,
250  struct rte_swx_ctl_table_info *table);
251 
259  enum rte_swx_table_match_type match_type;
260 
265 
267  uint32_t n_bits;
268 
272  uint32_t offset;
273 };
274 
290 __rte_experimental
291 int
292 rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p,
293  uint32_t table_id,
294  uint32_t match_field_id,
295  struct rte_swx_ctl_table_match_field_info *match_field);
296 
300  uint32_t action_id;
301 };
302 
321 __rte_experimental
322 int
323 rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
324  uint32_t table_id,
325  uint32_t table_action_id,
326  struct rte_swx_ctl_table_action_info *table_action);
327 
347 __rte_experimental
348 int
349 rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
350  uint32_t table_id,
351  struct rte_swx_table_ops *table_ops,
352  int *is_stub);
353 
357  uint64_t n_pkts_hit;
358 
360  uint64_t n_pkts_miss;
361 
367  uint64_t *n_pkts_action;
368 };
369 
386 __rte_experimental
387 int
388 rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p,
389  const char *table_name,
390  struct rte_swx_table_stats *stats);
391 
392 /*
393  * Selector Table Query API.
394  */
395 
400 
403 
405  uint32_t n_groups_max;
406 
409 };
410 
424 __rte_experimental
425 int
426 rte_swx_ctl_selector_info_get(struct rte_swx_pipeline *p,
427  uint32_t selector_id,
428  struct rte_swx_ctl_selector_info *selector);
429 
443 __rte_experimental
444 int
445 rte_swx_ctl_selector_group_id_field_info_get(struct rte_swx_pipeline *p,
446  uint32_t selector_id,
447  struct rte_swx_ctl_table_match_field_info *field);
448 
464 __rte_experimental
465 int
466 rte_swx_ctl_selector_field_info_get(struct rte_swx_pipeline *p,
467  uint32_t selector_id,
468  uint32_t selector_field_id,
469  struct rte_swx_ctl_table_match_field_info *field);
470 
484 __rte_experimental
485 int
486 rte_swx_ctl_selector_member_id_field_info_get(struct rte_swx_pipeline *p,
487  uint32_t selector_id,
488  struct rte_swx_ctl_table_match_field_info *field);
489 
493  uint64_t n_pkts;
494 };
495 
509 __rte_experimental
510 int
511 rte_swx_ctl_pipeline_selector_stats_read(struct rte_swx_pipeline *p,
512  const char *selector_name,
513  struct rte_swx_pipeline_selector_stats *stats);
514 
515 /*
516  * Table Update API.
517  */
518 
522  void *obj;
523 
526 
531 };
532 
549 __rte_experimental
550 int
551 rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
552  struct rte_swx_table_state **table_state);
553 
568 __rte_experimental
569 int
570 rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
571  struct rte_swx_table_state *table_state);
572 
573 /*
574  * High Level Reference Table Update API.
575  */
576 
578 struct rte_swx_ctl_pipeline;
579 
588 __rte_experimental
589 struct rte_swx_ctl_pipeline *
590 rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
591 
608 __rte_experimental
609 int
610 rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
611  const char *table_name,
612  struct rte_swx_table_entry *entry);
613 
630 __rte_experimental
631 int
632 rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
633  const char *table_name,
634  struct rte_swx_table_entry *entry);
635 
653 __rte_experimental
654 int
655 rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
656  const char *table_name,
657  struct rte_swx_table_entry *entry);
658 
678 __rte_experimental
679 int
680 rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl,
681  const char *selector_name,
682  uint32_t *group_id);
683 
701 __rte_experimental
702 int
703 rte_swx_ctl_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl,
704  const char *selector_name,
705  uint32_t group_id);
706 
731 __rte_experimental
732 int
733 rte_swx_ctl_pipeline_selector_group_member_add(struct rte_swx_ctl_pipeline *ctl,
734  const char *selector_name,
735  uint32_t group_id,
736  uint32_t member_id,
737  uint32_t member_weight);
738 
757 __rte_experimental
758 int
759 rte_swx_ctl_pipeline_selector_group_member_delete(struct rte_swx_ctl_pipeline *ctl,
760  const char *selector_name,
761  uint32_t group_id,
762  uint32_t member_id);
763 
779 __rte_experimental
780 int
781 rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
782  int abort_on_fail);
783 
792 __rte_experimental
793 void
794 rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
795 
815 __rte_experimental
816 struct rte_swx_table_entry *
817 rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
818  const char *table_name,
819  const char *string,
820  int *is_blank_or_comment);
821 
837 __rte_experimental
838 int
840  struct rte_swx_ctl_pipeline *ctl,
841  const char *table_name);
842 
858 __rte_experimental
859 int
861  struct rte_swx_ctl_pipeline *ctl,
862  const char *selector_name);
863 
864 /*
865  * Register Array Query API.
866  */
867 
872 
874  uint32_t size;
875 };
876 
890 __rte_experimental
891 int
892 rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p,
893  uint32_t regarray_id,
894  struct rte_swx_ctl_regarray_info *regarray);
895 
911 __rte_experimental
912 int
913 rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p,
914  const char *regarray_name,
915  uint32_t regarray_index,
916  uint64_t *value);
917 
933 __rte_experimental
934 int
935 rte_swx_ctl_pipeline_regarray_write(struct rte_swx_pipeline *p,
936  const char *regarray_name,
937  uint32_t regarray_index,
938  uint64_t value);
939 
940 /*
941  * Meter Array Query and Configuration API.
942  */
943 
948 
950  uint32_t size;
951 };
952 
966 __rte_experimental
967 int
968 rte_swx_ctl_metarray_info_get(struct rte_swx_pipeline *p,
969  uint32_t metarray_id,
970  struct rte_swx_ctl_metarray_info *metarray);
971 
987 __rte_experimental
988 int
989 rte_swx_ctl_meter_profile_add(struct rte_swx_pipeline *p,
990  const char *name,
991  struct rte_meter_trtcm_params *params);
992 
1005 __rte_experimental
1006 int
1007 rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p,
1008  const char *name);
1009 
1028 __rte_experimental
1029 int
1030 rte_swx_ctl_meter_reset(struct rte_swx_pipeline *p,
1031  const char *metarray_name,
1032  uint32_t metarray_index);
1033 
1053 __rte_experimental
1054 int
1055 rte_swx_ctl_meter_set(struct rte_swx_pipeline *p,
1056  const char *metarray_name,
1057  uint32_t metarray_index,
1058  const char *profile_name);
1059 
1063  uint64_t n_pkts[RTE_COLORS];
1064 
1066  uint64_t n_bytes[RTE_COLORS];
1067 };
1068 
1084 __rte_experimental
1085 int
1086 rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
1087  const char *metarray_name,
1088  uint32_t metarray_index,
1089  struct rte_swx_ctl_meter_stats *stats);
1090 
1097 __rte_experimental
1098 void
1099 rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl);
1100 
1101 #ifdef __cplusplus
1102 }
1103 #endif
1104 
1105 #endif
__rte_experimental int rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p, uint32_t table_id, uint32_t table_action_id, struct rte_swx_ctl_table_action_info *table_action)
__rte_experimental int rte_swx_ctl_selector_info_get(struct rte_swx_pipeline *p, uint32_t selector_id, struct rte_swx_ctl_selector_info *selector)
__rte_experimental int rte_swx_ctl_meter_set(struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index, const char *profile_name)
__rte_experimental int rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p, const char *name)
__rte_experimental int rte_swx_ctl_pipeline_selector_stats_read(struct rte_swx_pipeline *p, const char *selector_name, struct rte_swx_pipeline_selector_stats *stats)
__rte_experimental int rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t *group_id)
Definition: rte_swx_table.h:67
uint64_t * n_pkts_action
Definition: rte_swx_ctl.h:367
__rte_experimental int rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl, const char *table_name, struct rte_swx_table_entry *entry)
uint8_t * default_action_data
Definition: rte_swx_ctl.h:530
__rte_experimental int rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p, const char *table_name, struct rte_swx_table_stats *stats)
__rte_experimental int rte_swx_ctl_pipeline_selector_group_member_add(struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t group_id, uint32_t member_id, uint32_t member_weight)
__rte_experimental int rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p, uint32_t action_id, uint32_t action_arg_id, struct rte_swx_ctl_action_arg_info *action_arg)
rte_swx_table_match_type
Definition: rte_swx_table.h:22
__rte_experimental int rte_swx_ctl_meter_profile_add(struct rte_swx_pipeline *p, const char *name, struct rte_meter_trtcm_params *params)
uint64_t default_action_id
Definition: rte_swx_ctl.h:525
__rte_experimental int rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p, int *numa_node)
__rte_experimental void rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl)
__rte_experimental int rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p, uint32_t table_id, struct rte_swx_table_ops *table_ops, int *is_stub)
__rte_experimental int rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl, const char *table_name, struct rte_swx_table_entry *entry)
__rte_experimental int rte_swx_ctl_meter_reset(struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index)
__rte_experimental int rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p, uint32_t action_id, struct rte_swx_ctl_action_info *action)
__rte_experimental int rte_swx_ctl_selector_member_id_field_info_get(struct rte_swx_pipeline *p, uint32_t selector_id, struct rte_swx_ctl_table_match_field_info *field)
__rte_experimental int rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl, const char *table_name, struct rte_swx_table_entry *entry)
__rte_experimental int rte_swx_ctl_pipeline_regarray_write(struct rte_swx_pipeline *p, const char *regarray_name, uint32_t regarray_index, uint64_t value)
__rte_experimental int rte_swx_ctl_metarray_info_get(struct rte_swx_pipeline *p, uint32_t metarray_id, struct rte_swx_ctl_metarray_info *metarray)
__rte_experimental int rte_swx_ctl_pipeline_port_out_stats_read(struct rte_swx_pipeline *p, uint32_t port_id, struct rte_swx_port_out_stats *stats)
__rte_experimental int rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p, struct rte_swx_ctl_pipeline_info *pipeline)
__rte_experimental struct rte_swx_ctl_pipeline * rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p)
__rte_experimental int rte_swx_ctl_pipeline_port_in_stats_read(struct rte_swx_pipeline *p, uint32_t port_id, struct rte_swx_port_in_stats *stats)
__rte_experimental int rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p, uint32_t table_id, uint32_t match_field_id, struct rte_swx_ctl_table_match_field_info *match_field)
__rte_experimental int rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p, struct rte_swx_table_state **table_state)
__rte_experimental int rte_swx_ctl_pipeline_selector_group_member_delete(struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t group_id, uint32_t member_id)
__rte_experimental struct rte_swx_table_entry * rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl, const char *table_name, const char *string, int *is_blank_or_comment)
__rte_experimental int rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p, uint32_t table_id, struct rte_swx_ctl_table_info *table)
__rte_experimental int rte_swx_ctl_selector_group_id_field_info_get(struct rte_swx_pipeline *p, uint32_t selector_id, struct rte_swx_ctl_table_match_field_info *field)
__rte_experimental int rte_swx_ctl_selector_field_info_get(struct rte_swx_pipeline *p, uint32_t selector_id, uint32_t selector_field_id, struct rte_swx_ctl_table_match_field_info *field)
__rte_experimental int rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl, int abort_on_fail)
__rte_experimental int rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p, const char *regarray_name, uint32_t regarray_index, uint64_t *value)
__rte_experimental int rte_swx_ctl_pipeline_selector_fprintf(FILE *f, struct rte_swx_ctl_pipeline *ctl, const char *selector_name)
__rte_experimental int rte_swx_ctl_pipeline_table_fprintf(FILE *f, struct rte_swx_ctl_pipeline *ctl, const char *table_name)
__rte_experimental int rte_swx_ctl_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t group_id)
#define RTE_SWX_CTL_NAME_SIZE
Definition: rte_swx_ctl.h:31
__rte_experimental int rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p, uint32_t regarray_id, struct rte_swx_ctl_regarray_info *regarray)
__rte_experimental int rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p, struct rte_swx_table_state *table_state)
__rte_experimental void rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl)
__rte_experimental int rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index, struct rte_swx_ctl_meter_stats *stats)