DPDK 25.11.0
 
Loading...
Searching...
No Matches
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
11
12#include <stdint.h>
13#include <stdio.h>
14
15#include <rte_compat.h>
16#include <rte_meter.h>
17
18#include "rte_swx_port.h"
19#include "rte_swx_table.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct rte_swx_pipeline;
26
28#ifndef RTE_SWX_CTL_NAME_SIZE
29#define RTE_SWX_CTL_NAME_SIZE 64
30#endif
31
32/*
33 * Pipeline Query API.
34 */
35
40
42 uint32_t n_ports_in;
43
45 uint32_t n_ports_out;
46
49
52
54 uint32_t n_actions;
55
57 uint32_t n_tables;
58
60 uint32_t n_selectors;
61
63 uint32_t n_learners;
64
66 uint32_t n_regarrays;
67
69 uint32_t n_metarrays;
70
72 uint32_t n_rss;
73};
74
86__rte_experimental
87int
88rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p,
90
102__rte_experimental
103int
104rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p,
105 int *numa_node);
106
107/*
108 * Ports Query API.
109 */
110
124__rte_experimental
125int
127 uint32_t port_id,
128 struct rte_swx_port_in_stats *stats);
129
143__rte_experimental
144int
146 uint32_t port_id,
147 struct rte_swx_port_out_stats *stats);
148
149/*
150 * Action Query API.
151 */
152
161
175__rte_experimental
176int
177rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p,
178 uint32_t action_id,
179 struct rte_swx_ctl_action_info *action);
180
195
211__rte_experimental
212int
213rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p,
214 uint32_t action_id,
215 uint32_t action_arg_id,
216 struct rte_swx_ctl_action_arg_info *action_arg);
217
218/*
219 * Table Query API.
220 */
221
248
262__rte_experimental
263int
264rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p,
265 uint32_t table_id,
266 struct rte_swx_ctl_table_info *table);
267
290
306__rte_experimental
307int
308rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p,
309 uint32_t table_id,
310 uint32_t match_field_id,
311 struct rte_swx_ctl_table_match_field_info *match_field);
312
324
343__rte_experimental
344int
345rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
346 uint32_t table_id,
347 uint32_t table_action_id,
348 struct rte_swx_ctl_table_action_info *table_action);
349
369__rte_experimental
370int
371rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
372 uint32_t table_id,
373 struct rte_swx_table_ops *table_ops,
374 int *is_stub);
375
379 uint64_t n_pkts_hit;
380
382 uint64_t n_pkts_miss;
383
389 uint64_t *n_pkts_action;
390};
391
408__rte_experimental
409int
410rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p,
411 const char *table_name,
412 struct rte_swx_table_stats *stats);
413
414/*
415 * Selector Table Query API.
416 */
417
432
446__rte_experimental
447int
448rte_swx_ctl_selector_info_get(struct rte_swx_pipeline *p,
449 uint32_t selector_id,
450 struct rte_swx_ctl_selector_info *selector);
451
465__rte_experimental
466int
468 uint32_t selector_id,
470
486__rte_experimental
487int
488rte_swx_ctl_selector_field_info_get(struct rte_swx_pipeline *p,
489 uint32_t selector_id,
490 uint32_t selector_field_id,
492
506__rte_experimental
507int
509 uint32_t selector_id,
511
517
531__rte_experimental
532int
534 const char *selector_name,
535 struct rte_swx_pipeline_selector_stats *stats);
536
537/*
538 * Learner Table Query API.
539 */
540
545
548
550 uint32_t n_actions;
551
557
559 uint32_t size;
560
563};
564
578__rte_experimental
579int
580rte_swx_ctl_learner_info_get(struct rte_swx_pipeline *p,
581 uint32_t learner_id,
582 struct rte_swx_ctl_learner_info *learner);
583
599__rte_experimental
600int
602 uint32_t learner_id,
603 uint32_t match_field_id,
604 struct rte_swx_ctl_table_match_field_info *match_field);
605
623__rte_experimental
624int
625rte_swx_ctl_learner_action_info_get(struct rte_swx_pipeline *p,
626 uint32_t learner_id,
627 uint32_t learner_action_id,
628 struct rte_swx_ctl_table_action_info *learner_action);
629
645__rte_experimental
646int
648 uint32_t learner_id,
649 uint32_t timeout_id,
650 uint32_t *timeout);
651
667__rte_experimental
668int
670 uint32_t learner_id,
671 uint32_t timeout_id,
672 uint32_t timeout);
673
677 uint64_t n_pkts_hit;
678
680 uint64_t n_pkts_miss;
681
684
687
689 uint64_t n_pkts_rearm;
690
693
698 uint64_t *n_pkts_action;
699};
700
717__rte_experimental
718int
720 const char *learner_name,
721 struct rte_swx_learner_stats *stats);
722
723/*
724 * Packet mirroring API.
725 */
726
738
753__rte_experimental
754int
756 uint32_t session_id,
758
759/*
760 * Table Update API.
761 */
762
766 void *obj;
767
770
775};
776
793__rte_experimental
794int
795rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
796 struct rte_swx_table_state **table_state);
797
812__rte_experimental
813int
814rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
815 struct rte_swx_table_state *table_state);
816
817/*
818 * High Level Reference Table Update API.
819 */
820
822struct rte_swx_ctl_pipeline;
823
832__rte_experimental
833struct rte_swx_ctl_pipeline *
835
844__rte_experimental
845struct rte_swx_ctl_pipeline *
846rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
847
864__rte_experimental
865int
866rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
867 const char *table_name,
868 struct rte_swx_table_entry *entry);
869
886__rte_experimental
887int
888rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
889 const char *table_name,
890 struct rte_swx_table_entry *entry);
891
909__rte_experimental
910int
911rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
912 const char *table_name,
913 struct rte_swx_table_entry *entry);
914
934__rte_experimental
935int
936rte_swx_ctl_pipeline_selector_group_add(struct rte_swx_ctl_pipeline *ctl,
937 const char *selector_name,
938 uint32_t *group_id);
939
957__rte_experimental
958int
959rte_swx_ctl_pipeline_selector_group_delete(struct rte_swx_ctl_pipeline *ctl,
960 const char *selector_name,
961 uint32_t group_id);
962
987__rte_experimental
988int
989rte_swx_ctl_pipeline_selector_group_member_add(struct rte_swx_ctl_pipeline *ctl,
990 const char *selector_name,
991 uint32_t group_id,
992 uint32_t member_id,
993 uint32_t member_weight);
994
1013__rte_experimental
1014int
1016 const char *selector_name,
1017 uint32_t group_id,
1018 uint32_t member_id);
1019
1035__rte_experimental
1036int
1037rte_swx_ctl_pipeline_learner_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
1038 const char *learner_name,
1039 struct rte_swx_table_entry *entry);
1040
1056__rte_experimental
1057int
1058rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
1059 int abort_on_fail);
1060
1069__rte_experimental
1070void
1071rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
1072
1092__rte_experimental
1093struct rte_swx_table_entry *
1094rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
1095 const char *table_name,
1096 const char *string,
1097 int *is_blank_or_comment);
1098
1118__rte_experimental
1119struct rte_swx_table_entry *
1121 const char *learner_name,
1122 const char *string,
1123 int *is_blank_or_comment);
1124
1140__rte_experimental
1141int
1143 struct rte_swx_ctl_pipeline *ctl,
1144 const char *table_name);
1145
1161__rte_experimental
1162int
1164 struct rte_swx_ctl_pipeline *ctl,
1165 const char *selector_name);
1166
1167/*
1168 * Register Array Query API.
1169 */
1170
1179
1193__rte_experimental
1194int
1195rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p,
1196 uint32_t regarray_id,
1197 struct rte_swx_ctl_regarray_info *regarray);
1198
1214__rte_experimental
1215int
1216rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p,
1217 const char *regarray_name,
1218 uint32_t regarray_index,
1219 uint64_t *value);
1220