DPDK  21.05.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 
26 struct rte_swx_pipeline;
27 
29 #ifndef RTE_SWX_CTL_NAME_SIZE
30 #define RTE_SWX_CTL_NAME_SIZE 64
31 #endif
32 
33 /*
34  * Pipeline Query API.
35  */
36 
40  uint32_t n_ports_in;
41 
43  uint32_t n_ports_out;
44 
46  uint32_t n_actions;
47 
49  uint32_t n_tables;
50 
52  uint32_t n_regarrays;
53 
55  uint32_t n_metarrays;
56 };
57 
69 __rte_experimental
70 int
71 rte_swx_ctl_pipeline_info_get(struct rte_swx_pipeline *p,
72  struct rte_swx_ctl_pipeline_info *pipeline);
73 
85 __rte_experimental
86 int
87 rte_swx_ctl_pipeline_numa_node_get(struct rte_swx_pipeline *p,
88  int *numa_node);
89 
90 /*
91  * Ports Query API.
92  */
93 
107 __rte_experimental
108 int
109 rte_swx_ctl_pipeline_port_in_stats_read(struct rte_swx_pipeline *p,
110  uint32_t port_id,
111  struct rte_swx_port_in_stats *stats);
112 
126 __rte_experimental
127 int
128 rte_swx_ctl_pipeline_port_out_stats_read(struct rte_swx_pipeline *p,
129  uint32_t port_id,
130  struct rte_swx_port_out_stats *stats);
131 
132 /*
133  * Action Query API.
134  */
135 
140 
142  uint32_t n_args;
143 };
144 
158 __rte_experimental
159 int
160 rte_swx_ctl_action_info_get(struct rte_swx_pipeline *p,
161  uint32_t action_id,
162  struct rte_swx_ctl_action_info *action);
163 
168 
170  uint32_t n_bits;
171 
177 };
178 
194 __rte_experimental
195 int
196 rte_swx_ctl_action_arg_info_get(struct rte_swx_pipeline *p,
197  uint32_t action_id,
198  uint32_t action_arg_id,
199  struct rte_swx_ctl_action_arg_info *action_arg);
200 
201 /*
202  * Table Query API.
203  */
204 
209 
212 
214  uint32_t n_match_fields;
215 
217  uint32_t n_actions;
218 
224 
226  uint32_t size;
227 };
228 
242 __rte_experimental
243 int
244 rte_swx_ctl_table_info_get(struct rte_swx_pipeline *p,
245  uint32_t table_id,
246  struct rte_swx_ctl_table_info *table);
247 
255  enum rte_swx_table_match_type match_type;
256 
261 
263  uint32_t n_bits;
264 
268  uint32_t offset;
269 };
270 
286 __rte_experimental
287 int
288 rte_swx_ctl_table_match_field_info_get(struct rte_swx_pipeline *p,
289  uint32_t table_id,
290  uint32_t match_field_id,
291  struct rte_swx_ctl_table_match_field_info *match_field);
292 
296  uint32_t action_id;
297 };
298 
317 __rte_experimental
318 int
319 rte_swx_ctl_table_action_info_get(struct rte_swx_pipeline *p,
320  uint32_t table_id,
321  uint32_t table_action_id,
322  struct rte_swx_ctl_table_action_info *table_action);
323 
343 __rte_experimental
344 int
345 rte_swx_ctl_table_ops_get(struct rte_swx_pipeline *p,
346  uint32_t table_id,
347  struct rte_swx_table_ops *table_ops,
348  int *is_stub);
349 
353  uint64_t n_pkts_hit;
354 
356  uint64_t n_pkts_miss;
357 
363  uint64_t *n_pkts_action;
364 };
365 
382 __rte_experimental
383 int
384 rte_swx_ctl_pipeline_table_stats_read(struct rte_swx_pipeline *p,
385  const char *table_name,
386  struct rte_swx_table_stats *stats);
387 
388 /*
389  * Table Update API.
390  */
391 
395  void *obj;
396 
399 
404 };
405 
422 __rte_experimental
423 int
424 rte_swx_pipeline_table_state_get(struct rte_swx_pipeline *p,
425  struct rte_swx_table_state **table_state);
426 
441 __rte_experimental
442 int
443 rte_swx_pipeline_table_state_set(struct rte_swx_pipeline *p,
444  struct rte_swx_table_state *table_state);
445 
446 /*
447  * High Level Reference Table Update API.
448  */
449 
451 struct rte_swx_ctl_pipeline;
452 
461 __rte_experimental
462 struct rte_swx_ctl_pipeline *
463 rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
464 
481 __rte_experimental
482 int
483 rte_swx_ctl_pipeline_table_entry_add(struct rte_swx_ctl_pipeline *ctl,
484  const char *table_name,
485  struct rte_swx_table_entry *entry);
486 
503 __rte_experimental
504 int
505 rte_swx_ctl_pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *ctl,
506  const char *table_name,
507  struct rte_swx_table_entry *entry);
508 
526 __rte_experimental
527 int
528 rte_swx_ctl_pipeline_table_entry_delete(struct rte_swx_ctl_pipeline *ctl,
529  const char *table_name,
530  struct rte_swx_table_entry *entry);
531 
547 __rte_experimental
548 int
549 rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
550  int abort_on_fail);
551 
560 __rte_experimental
561 void
562 rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
563 
583 __rte_experimental
584 struct rte_swx_table_entry *
585 rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
586  const char *table_name,
587  const char *string,
588  int *is_blank_or_comment);
589 
605 __rte_experimental
606 int
608  struct rte_swx_ctl_pipeline *ctl,
609  const char *table_name);
610 
611 /*
612  * Register Array Query API.
613  */
614 
619 
621  uint32_t size;
622 };
623 
637 __rte_experimental
638 int
639 rte_swx_ctl_regarray_info_get(struct rte_swx_pipeline *p,
640  uint32_t regarray_id,
641  struct rte_swx_ctl_regarray_info *regarray);
642 
658 __rte_experimental
659 int
660 rte_swx_ctl_pipeline_regarray_read(struct rte_swx_pipeline *p,
661  const char *regarray_name,
662  uint32_t regarray_index,
663  uint64_t *value);
664 
680 __rte_experimental
681 int
682 rte_swx_ctl_pipeline_regarray_write(struct rte_swx_pipeline *p,
683  const char *regarray_name,
684  uint32_t regarray_index,
685  uint64_t value);
686 
687 /*
688  * Meter Array Query and Configuration API.
689  */
690 
695 
697  uint32_t size;
698 };
699 
713 __rte_experimental
714 int
715 rte_swx_ctl_metarray_info_get(struct rte_swx_pipeline *p,
716  uint32_t metarray_id,
717  struct rte_swx_ctl_metarray_info *metarray);
718 
734 __rte_experimental
735 int
736 rte_swx_ctl_meter_profile_add(struct rte_swx_pipeline *p,
737  const char *name,
738  struct rte_meter_trtcm_params *params);
739 
752 __rte_experimental
753 int
754 rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p,
755  const char *name);
756 
775 __rte_experimental
776 int
777 rte_swx_ctl_meter_reset(struct rte_swx_pipeline *p,
778  const char *metarray_name,
779  uint32_t metarray_index);
780 
800 __rte_experimental
801 int
802 rte_swx_ctl_meter_set(struct rte_swx_pipeline *p,
803  const char *metarray_name,
804  uint32_t metarray_index,
805  const char *profile_name);
806 
810  uint64_t n_pkts[RTE_COLORS];
811 
813  uint64_t n_bytes[RTE_COLORS];
814 };
815 
831 __rte_experimental
832 int
833 rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
834  const char *metarray_name,
835  uint32_t metarray_index,
836  struct rte_swx_ctl_meter_stats *stats);
837 
844 __rte_experimental
845 void
846 rte_swx_ctl_pipeline_free(struct rte_swx_ctl_pipeline *ctl);
847 
848 #ifdef __cplusplus
849 }
850 #endif
851 
852 #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_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)
Definition: rte_swx_table.h:67
uint64_t * n_pkts_action
Definition: rte_swx_ctl.h:363
__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:403
__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_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:398
__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_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 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_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_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:30
__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)