DPDK  21.02.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 
22 #include "rte_swx_port.h"
23 #include "rte_swx_table.h"
24 
25 struct 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 
39  uint32_t n_ports_in;
40 
42  uint32_t n_ports_out;
43 
45  uint32_t n_actions;
46 
48  uint32_t n_tables;
49 };
50 
62 __rte_experimental
63 int
64 rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p,
65  struct rte_swx_ctl_pipeline_info *pipeline);
66 
78 __rte_experimental
79 int
80 rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p,
81  int *numa_node);
82 
83 /*
84  * Ports Query API.
85  */
86 
100 __rte_experimental
101 int
102 rte_swx_ctl_pipeline_port_in_stats_read(struct rte_swx_pipeline *p,
103  uint32_t port_id,
104  struct rte_swx_port_in_stats *stats);
105 
119 __rte_experimental
120 int
121 rte_swx_ctl_pipeline_port_out_stats_read(struct rte_swx_pipeline *p,
122  uint32_t port_id,
123  struct rte_swx_port_out_stats *stats);
124 
125 /*
126  * Action Query API.
127  */
128 
133 
135  uint32_t n_args;
136 };
137 
151 __rte_experimental
152 int
153 rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p,
154  uint32_t action_id,
155  struct rte_swx_ctl_action_info *action);
156 
161 
163  uint32_t n_bits;
164 };
165 
181 __rte_experimental
182 int
183 rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p,
184  uint32_t action_id,
185  uint32_t action_arg_id,
186  struct rte_swx_ctl_action_arg_info *action_arg);
187 
188 /*
189  * Table Query API.
190  */
191 
196 
199 
201  uint32_t n_match_fields;
202 
204  uint32_t n_actions;
205 
211 
213  uint32_t size;
214 };
215 
229 __rte_experimental
230 int
231 rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p,
232  uint32_t table_id,
233  struct rte_swx_ctl_table_info *table);
234 
243 
248 
250  uint32_t n_bits;
251 
255  uint32_t offset;
256 };
257 
273 __rte_experimental
274 int
275 rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p,
276  uint32_t table_id,
277  uint32_t match_field_id,
278  struct rte_swx_ctl_table_match_field_info *match_field);
279 
283  uint32_t action_id;
284 };
285 
304 __rte_experimental
305 int
306 rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
307  uint32_t table_id,
308  uint32_t table_action_id,
309  struct rte_swx_ctl_table_action_info *table_action);
310 
330 __rte_experimental
331 int
332 rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
333  uint32_t table_id,
334  struct rte_swx_table_ops *table_ops,
335  int *is_stub);
336 
337 /*
338  * Table Update API.
339  */
340 
344  void *obj;
345 
348 
353 };
354 
371 __rte_experimental
372 int
373 rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
374  struct rte_swx_table_state **table_state);
375 
390 __rte_experimental
391 int
392 rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
393  struct rte_swx_table_state *table_state);
394 
395 /*
396  * High Level Reference Table Update API.
397  */
398 
400 struct rte_swx_ctl_pipeline;
401 
410 __rte_experimental
411 struct rte_swx_ctl_pipeline *
412 rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
413 
430 __rte_experimental
431 int
432 rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
433  const char *table_name,
434  struct rte_swx_table_entry *entry);
435 
452 __rte_experimental
453 int
454 rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
455  const char *table_name,
456  struct rte_swx_table_entry *entry);
457 
475 __rte_experimental
476 int
477 rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
478  const char *table_name,
479  struct rte_swx_table_entry *entry);
480 
496 __rte_experimental
497 int
498 rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
499  int abort_on_fail);
500 
509 __rte_experimental
510 void
511 rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
512 
528 __rte_experimental
529 struct rte_swx_table_entry *
530 rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
531  const char *table_name,
532  const char *string);
533 
549 __rte_experimental
550 int
552  struct rte_swx_ctl_pipeline *ctl,
553  const char *table_name);
554 
561 __rte_experimental
562 void
563 rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl);
564 
565 #ifdef __cplusplus
566 }
567 #endif
568 
569 #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)
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:132
Definition: rte_swx_table.h:67
__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)
__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:352
__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)
char args[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:198
rte_swx_table_match_type
Definition: rte_swx_table.h:22
uint64_t default_action_id
Definition: rte_swx_ctl.h:347
__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_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_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_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)
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:195
__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_commit(struct rte_swx_ctl_pipeline *ctl, int abort_on_fail)
__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:29
char name[RTE_SWX_CTL_NAME_SIZE]
Definition: rte_swx_ctl.h:160
__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)
enum rte_swx_table_match_type match_type
Definition: rte_swx_ctl.h:242