DPDK 21.11.9
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
8extern "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"
26
27struct 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_learners;
57
59 uint32_t n_regarrays;
60
62 uint32_t n_metarrays;
63};
64
76__rte_experimental
77int
78rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p,
79 struct rte_swx_ctl_pipeline_info *pipeline);
80
92__rte_experimental
93int
94rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p,
95 int *numa_node);
96
97/*
98 * Ports Query API.
99 */
100
114__rte_experimental
115int
117 uint32_t port_id,
118 struct rte_swx_port_in_stats *stats);
119
133__rte_experimental
134int
136 uint32_t port_id,
137 struct rte_swx_port_out_stats *stats);
138
139/*
140 * Action Query API.
141 */
142
147
149 uint32_t n_args;
150};
151
165__rte_experimental
166int
167rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p,
168 uint32_t action_id,
169 struct rte_swx_ctl_action_info *action);
170
175
177 uint32_t n_bits;
178
184};
185
201__rte_experimental
202int
203rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p,
204 uint32_t action_id,
205 uint32_t action_arg_id,
206 struct rte_swx_ctl_action_arg_info *action_arg);
207
208/*
209 * Table Query API.
210 */
211
216
219
222
224 uint32_t n_actions;
225
231
233 uint32_t size;
234};
235
249__rte_experimental
250int
251rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p,
252 uint32_t table_id,
253 struct rte_swx_ctl_table_info *table);
254
263
268
270 uint32_t n_bits;
271
275 uint32_t offset;
276};
277
293__rte_experimental
294int
295rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p,
296 uint32_t table_id,
297 uint32_t match_field_id,
298 struct rte_swx_ctl_table_match_field_info *match_field);
299
303 uint32_t action_id;
304
307
310};
311
330__rte_experimental
331int
332rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
333 uint32_t table_id,
334 uint32_t table_action_id,
335 struct rte_swx_ctl_table_action_info *table_action);
336
356__rte_experimental
357int
358rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
359 uint32_t table_id,
360 struct rte_swx_table_ops *table_ops,
361 int *is_stub);
362
366 uint64_t n_pkts_hit;
367
369 uint64_t n_pkts_miss;
370
376 uint64_t *n_pkts_action;
377};
378
395__rte_experimental
396int
397rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p,
398 const char *table_name,
399 struct rte_swx_table_stats *stats);
400
401/*
402 * Selector Table Query API.
403 */
404
409
412
414 uint32_t n_groups_max;
415
418};
419
433__rte_experimental
434int
435rte_swx_ctl_selector_info_get(struct rte_swx_pipeline *p,
436 uint32_t selector_id,
437 struct rte_swx_ctl_selector_info *selector);
438
452__rte_experimental
453int
455 uint32_t selector_id,
457
473__rte_experimental
474int
475rte_swx_ctl_selector_field_info_get(struct rte_swx_pipeline *p,
476 uint32_t selector_id,
477 uint32_t selector_field_id,
479
493__rte_experimental
494int
496 uint32_t selector_id,
498
502 uint64_t n_pkts;
503};
504
518__rte_experimental
519int
521 const char *selector_name,
522 struct rte_swx_pipeline_selector_stats *stats);
523
524/*
525 * Learner Table Query API.
526 */
527
532
535
537 uint32_t n_actions;
538
544
546 uint32_t size;
547};
548
562__rte_experimental
563int
564rte_swx_ctl_learner_info_get(struct rte_swx_pipeline *p,
565 uint32_t learner_id,
566 struct rte_swx_ctl_learner_info *learner);
567
583__rte_experimental
584int
586 uint32_t learner_id,
587 uint32_t match_field_id,
588 struct rte_swx_ctl_table_match_field_info *match_field);
589
607__rte_experimental
608int
609rte_swx_ctl_learner_action_info_get(struct rte_swx_pipeline *p,
610 uint32_t learner_id,
611 uint32_t learner_action_id,
612 struct rte_swx_ctl_table_action_info *learner_action);
613
617 uint64_t n_pkts_hit;
618
620 uint64_t n_pkts_miss;
621
624
627
630
635 uint64_t *n_pkts_action;
636};
637
654__rte_experimental
655int
657 const char *learner_name,
658 struct rte_swx_learner_stats *stats);
659
660/*
661 * Table Update API.
662 */
663
667 void *obj;
668
671
676};
677
694__rte_experimental
695int
696rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
697 struct rte_swx_table_state **table_state);
698
713__rte_experimental
714int
715rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
716 struct rte_swx_table_state *table_state);
717
718/*
719 * High Level Reference Table Update API.
720 */
721
723struct rte_swx_ctl_pipeline;
724
733__rte_experimental
734struct rte_swx_ctl_pipeline *
735rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
736
753__rte_experimental
754int
755rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
756 const char *table_name,
757 struct rte_swx_table_entry *entry);
758
775__rte_experimental
776int
777rte_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);
780
798__rte_experimental
799int
800rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
801 const char *table_name,
802 struct rte_swx_table_entry *entry);
803
823__rte_experimental
824int
825rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl,
826 const char *selector_name,
827 uint32_t *group_id);
828
846__rte_experimental
847int
848rte_swx_ctl_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl,
849 const char *selector_name,
850 uint32_t group_id);
851
876__rte_experimental
877int
878rte_swx_ctl_pipeline_selector_group_member_add(struct rte_swx_ctl_pipeline *ctl,
879 const char *selector_name,
880 uint32_t group_id,
881 uint32_t member_id,
882 uint32_t member_weight);
883
902__rte_experimental
903int
905 const char *selector_name,
906 uint32_t group_id,
907 uint32_t member_id);
908
924__rte_experimental
925int
926rte_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);
929
945__rte_experimental
946int
947rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
948 int abort_on_fail);
949
958__rte_experimental
959void
960rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
961
981__rte_experimental
982struct rte_swx_table_entry *
983rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
984 const char *table_name,
985 const char *string,
986 int *is_blank_or_comment);
987
1007__rte_experimental
1008struct rte_swx_table_entry *
1010 const char *learner_name,
1011 const char *string,
1012 int *is_blank_or_comment);
1013
1029__rte_experimental
1030int
1032 struct rte_swx_ctl_pipeline *ctl,
1033 const char *table_name);
1034
1050__rte_experimental
1051int
1053 struct rte_swx_ctl_pipeline *ctl,
1054 const char *selector_name);
1055
1056/*
1057 * Register Array Query API.
1058 */
1059
1064
1066 uint32_t size;
1067};
1068
1082__rte_experimental
1083int
1084rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p,
1085 uint32_t regarray_id,
1086 struct rte_swx_ctl_regarray_info *regarray);
1087
1103__rte_experimental
1104int
1105rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p,
1106 const char *regarray_name,
1107 uint32_t regarray_index,
1108 uint64_t *value);
1109
1125__rte_experimental
1126int
1127rte_swx_ctl_pipeline_regarray_write(struct rte_swx_pipeline *p,
1128 const char *regarray_name,
1129 uint32_t regarray_index,
1130 uint64_t value);
1131
1132/*
1133 * Meter Array Query and Configuration API.
1134 */
1135
1140
1142 uint32_t size;
1143};
1144
1158__rte_experimental
1159int
1160rte_swx_ctl_metarray_info_get(struct rte_swx_pipeline *p,
1161 uint32_t metarray_id,
1162 struct rte_swx_ctl_metarray_info *metarray);
1163
1179__rte_experimental
1180int
1181rte_swx_ctl_meter_profile_add(struct rte_swx_pipeline *p,
1182 const char *name,
1183 struct rte_meter_trtcm_params *params);
1184
1197__rte_experimental
1198int
1199rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p,
1200 const char *name);
1201
1220__rte_experimental
1221int
1222rte_swx_ctl_meter_reset(struct rte_swx_pipeline *p,
1223 const char *metarray_name,
1224 uint32_t metarray_index);
1225
1245__rte_experimental
1246int
1247rte_swx_ctl_meter_set(struct rte_swx_pipeline *p,
1248 const char *metarray_name,
1249 uint32_t metarray_index,
1250 const char *profile_name);
1251
1256
1259};
1260
1276__rte_experimental
1277int
1278rte_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);
1282
1289__rte_experimental
1290void
1291rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl);
1292
1293#ifdef __cplusplus
1294}
1295#endif
1296
1297#endif
@ RTE_COLORS
Definition: rte_meter.h:40
__rte_experimental int rte_swx_ctl_pipeline_table_fprintf(FILE *f, struct rte_swx_ctl_pipeline *ctl, const char *table_name)
#define RTE_SWX_CTL_NAME_SIZE
Definition: rte_swx_ctl.h:31
__rte_experimental int rte_swx_ctl_pipeline_learner_default_entry_add(struct rte_swx_ctl_pipeline *ctl, const char *learner_name, struct rte_swx_table_entry *entry)
__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 void rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl)
__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 void rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl)
__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_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_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_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_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_experimental int rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p, const char *name)
__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 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_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 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_learner_action_info_get(struct rte_swx_pipeline *p, uint32_t learner_id, uint32_t learner_action_id, struct rte_swx_ctl_table_action_info *learner_action)
__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_meter_stats_read(struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index, struct rte_swx_ctl_meter_stats *stats)
__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_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t group_id)
__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)
__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_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_pipeline_learner_stats_read(struct rte_swx_pipeline *p, const char *learner_name, struct rte_swx_learner_stats *stats)
__rte_experimental int rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p, int *numa_node)
__rte_experimental int rte_swx_ctl_learner_info_get(struct rte_swx_pipeline *p, uint32_t learner_id, struct rte_swx_ctl_learner_info *learner)
__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_pipeline_commit(struct rte_swx_ctl_pipeline *ctl, int abort_on_fail)
__rte_experimental int rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl, const char *selector_name, uint32_t *group_id)
__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_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_info_get(struct rte_swx_pipeline *p, struct rte_swx_ctl_pipeline_info *pipeline)
__rte_experimental struct rte_swx_table_entry * rte_swx_ctl_pipeline_learner_default_entry_read(struct rte_swx_ctl_pipeline *ctl, const char *learner_name, const char *string, int *is_blank_or_comment)
__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_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_reset(struct rte_swx_pipeline *p, const char *metarray_name, uint32_t metarray_index)
__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_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_meter_profile_add(struct rte_swx_pipeline *p, const char *name, struct rte_meter_trtcm_params *params)
__rte_experimental struct rte_swx_ctl_pipeline * rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p)
__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_learner_match_field_info_get(struct rte_swx_pipeline *p, uint32_t learner_id, uint32_t match_field_id, struct rte_swx_ctl_table_match_field_info *match_field)
__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_pipeline_table_state_set(struct rte_swx_pipeline *p, struct rte_swx_table_state *table_state)
__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_ctl_pipeline_selector_fprintf(FILE *f, struct rte_swx_ctl_pipeline *ctl, const char *selector_name)
rte_swx_table_match_type
Definition: rte_swx_table.h:23
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:174
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:146
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:531
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:1139
uint64_t n_pkts[RTE_COLORS]
Definition: rte_swx_ctl.h:1255
uint64_t n_bytes[RTE_COLORS]
Definition: rte_swx_ctl.h:1258
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:1063
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:408
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:215
char args[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:218
enum rte_swx_table_match_type match_type
Definition: rte_swx_ctl.h:262
uint64_t * n_pkts_action
Definition: rte_swx_ctl.h:635
Definition: rte_swx_table.h:68
uint64_t default_action_id
Definition: rte_swx_ctl.h:670
uint8_t * default_action_data
Definition: rte_swx_ctl.h:675
uint64_t * n_pkts_action
Definition: rte_swx_ctl.h:376