pipeline: auto-detect endianness of action arguments
[dpdk.git] / lib / librte_pipeline / rte_swx_ctl.h
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
11 /**
12  * @file
13  * RTE SWX Pipeline Control
14  */
15
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
28 /** Name size. */
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
37 /** Pipeline info. */
38 struct rte_swx_ctl_pipeline_info {
39         /** Number of input ports. */
40         uint32_t n_ports_in;
41
42         /** Number of input ports. */
43         uint32_t n_ports_out;
44
45         /** Number of actions. */
46         uint32_t n_actions;
47
48         /** Number of tables. */
49         uint32_t n_tables;
50
51         /** Number of register arrays. */
52         uint32_t n_regarrays;
53
54         /** Number of meter arrays. */
55         uint32_t n_metarrays;
56 };
57
58 /**
59  * Pipeline info get
60  *
61  * @param[in] p
62  *   Pipeline handle.
63  * @param[out] pipeline
64  *   Pipeline info.
65  * @return
66  *   0 on success or the following error codes otherwise:
67  *   -EINVAL: Invalid argument.
68  */
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
74 /**
75  * Pipeline NUMA node get
76  *
77  * @param[in] p
78  *   Pipeline handle.
79  * @param[out] numa_node
80  *   Pipeline NUMA node.
81  * @return
82  *   0 on success or the following error codes otherwise:
83  *   -EINVAL: Invalid argument.
84  */
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
94 /**
95  * Input port statistics counters read
96  *
97  * @param[in] p
98  *   Pipeline handle.
99  * @param[in] port_id
100  *   Port ID (0 .. *n_ports_in* - 1).
101  * @param[out] stats
102  *   Input port stats.
103  * @return
104  *   0 on success or the following error codes otherwise:
105  *   -EINVAL: Invalid argument.
106  */
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
113 /**
114  * Output port statistics counters read
115  *
116  * @param[in] p
117  *   Pipeline handle.
118  * @param[in] port_id
119  *   Port ID (0 .. *n_ports_out* - 1).
120  * @param[out] stats
121  *   Output port stats.
122  * @return
123  *   0 on success or the following error codes otherwise:
124  *   -EINVAL: Invalid argument.
125  */
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
136 /** Action info. */
137 struct rte_swx_ctl_action_info {
138         /** Action name. */
139         char name[RTE_SWX_CTL_NAME_SIZE];
140
141         /** Number of action arguments. */
142         uint32_t n_args;
143 };
144
145 /**
146  * Action info get
147  *
148  * @param[in] p
149  *   Pipeline handle.
150  * @param[in] action_id
151  *   Action ID (0 .. *n_actions* - 1).
152  * @param[out] action
153  *   Action info.
154  * @return
155  *   0 on success or the following error codes otherwise:
156  *   -EINVAL: Invalid argument.
157  */
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
164 /** Action argument info. */
165 struct rte_swx_ctl_action_arg_info {
166         /** Action argument name. */
167         char name[RTE_SWX_CTL_NAME_SIZE];
168
169         /** Action argument size (in bits). */
170         uint32_t n_bits;
171
172         /** Non-zero (true) when this action argument must be stored in the
173          * table in network byte order (NBO), zero when it must be stored in
174          * host byte order (HBO).
175          */
176         int is_network_byte_order;
177 };
178
179 /**
180  * Action argument info get
181  *
182  * @param[in] p
183  *   Pipeline handle.
184  * @param[in] action_id
185  *   Action ID (0 .. *n_actions* - 1).
186  * @param[in] action_arg_id
187  *   Action ID (0 .. *n_args* - 1).
188  * @param[out] action_arg
189  *   Action argument info.
190  * @return
191  *   0 on success or the following error codes otherwise:
192  *   -EINVAL: Invalid argument.
193  */
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
205 /** Table info. */
206 struct rte_swx_ctl_table_info {
207         /** Table name. */
208         char name[RTE_SWX_CTL_NAME_SIZE];
209
210         /** Table creation arguments. */
211         char args[RTE_SWX_CTL_NAME_SIZE];
212
213         /** Number of match fields. */
214         uint32_t n_match_fields;
215
216         /** Number of actions. */
217         uint32_t n_actions;
218
219         /** Non-zero (true) when the default action is constant, therefore it
220          * cannot be changed; zero (false) when the default action not constant,
221          * therefore it can be changed.
222          */
223         int default_action_is_const;
224
225         /** Table size parameter. */
226         uint32_t size;
227 };
228
229 /**
230  * Table info get
231  *
232  * @param[in] p
233  *   Pipeline handle.
234  * @param[in] table_id
235  *   Table ID (0 .. *n_tables* - 1).
236  * @param[out] table
237  *   Table info.
238  * @return
239  *   0 on success or the following error codes otherwise:
240  *   -EINVAL: Invalid argument.
241  */
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
248 /** Table match field info.
249  *
250  * If (n_bits, offset) are known for all the match fields of the table, then the
251  * table (key_offset, key_size, key_mask0) can be computed.
252  */
253 struct rte_swx_ctl_table_match_field_info {
254         /** Match type of the current match field. */
255         enum rte_swx_table_match_type match_type;
256
257         /** Non-zero (true) when the current match field is part of a registered
258          * header, zero (false) when it is part of the registered meta-data.
259          */
260         int is_header;
261
262         /** Match field size (in bits). */
263         uint32_t n_bits;
264
265         /** Match field offset within its parent struct (one of the headers or
266          * the meta-data).
267          */
268         uint32_t offset;
269 };
270
271 /**
272  * Table match field info get
273  *
274  * @param[in] p
275  *   Pipeline handle.
276  * @param[in] table_id
277  *   Table ID (0 .. *n_tables*).
278  * @param[in] match_field_id
279  *   Match field ID (0 .. *n_match_fields* - 1).
280  * @param[out] match_field
281  *   Table match field info.
282  * @return
283  *   0 on success or the following error codes otherwise:
284  *   -EINVAL: Invalid argument.
285  */
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
293 /** Table action info. */
294 struct rte_swx_ctl_table_action_info {
295         /** Action ID. */
296         uint32_t action_id;
297 };
298
299 /**
300  * Table action info get
301  *
302  * @param[in] p
303  *   Pipeline handle.
304  * @param[in] table_id
305  *   Table ID (0 .. *n_tables*).
306  * @param[in] table_action_id
307  *   Action index within the set of table actions (0 .. table n_actions - 1).
308  *   Not to be confused with the action ID, which works at the pipeline level
309  *   (0 .. pipeline n_actions - 1), which is precisely what this function
310  *   returns as part of *table_action*.
311  * @param[out] table_action
312  *   Table action info.
313  * @return
314  *   0 on success or the following error codes otherwise:
315  *   -EINVAL: Invalid argument.
316  */
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
324 /**
325  * Table operations get
326  *
327  * @param[in] p
328  *   Pipeline handle.
329  * @param[in] table_id
330  *   Table ID (0 .. *n_tables*).
331  * @param[out] table_ops
332  *   Table operations. Only valid when function returns success and *is_stub* is
333  *   zero (false).
334  * @param[out] is_stub
335  *   A stub table is a table with no match fields. No "regular" table entries
336  *   (i.e. entries other than the default entry) can be added to such a table,
337  *   therefore the lookup operation always results in lookup miss. Non-zero
338  *   (true) when the current table is a stub table, zero (false) otherwise.
339  * @return
340  *   0 on success or the following error codes otherwise:
341  *   -EINVAL: Invalid argument.
342  */
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
350 /** Table statistics. */
351 struct rte_swx_table_stats {
352         /** Number of packets with lookup hit. */
353         uint64_t n_pkts_hit;
354
355         /** Number of packets with lookup miss. */
356         uint64_t n_pkts_miss;
357
358         /** Number of packets (with either lookup hit or miss) per pipeline
359          * action. Array of pipeline *n_actions* elements indedex by the
360          * pipeline-level *action_id*, therefore this array has the same size
361          * for all the tables within the same pipeline.
362          */
363         uint64_t *n_pkts_action;
364 };
365
366 /**
367  * Table statistics counters read
368  *
369  * @param[in] p
370  *   Pipeline handle.
371  * @param[in] table_name
372  *   Table name.
373  * @param[out] stats
374  *   Table stats. Must point to a pre-allocated structure. The *n_pkts_action*
375  *   field also needs to be pre-allocated as array of pipeline *n_actions*
376  *   elements. The pipeline actions that are not valid for the current table
377  *   have their associated *n_pkts_action* element always set to zero.
378  * @return
379  *   0 on success or the following error codes otherwise:
380  *   -EINVAL: Invalid argument.
381  */
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
392 /** Table state. */
393 struct rte_swx_table_state {
394         /** Table object. */
395         void *obj;
396
397         /** Action ID of the table default action. */
398         uint64_t default_action_id;
399
400         /** Action data of the table default action. Ignored when the action
401          * data size is zero; otherwise, action data size bytes are meaningful.
402          */
403         uint8_t *default_action_data;
404 };
405
406 /**
407  * Pipeline table state get
408  *
409  * @param[in] p
410  *   Pipeline handle.
411  * @param[out] table_state
412  *   After successful execution, the *table_state* contains the pointer to the
413  *   current pipeline table state, which is an array of *n_tables* elements,
414  *   with array element i containing the state of the i-th pipeline table. The
415  *   pipeline continues to own all the data structures directly or indirectly
416  *   referenced by the *table_state* until the subsequent successful invocation
417  *   of function *rte_swx_pipeline_table_state_set*.
418  * @return
419  *   0 on success or the following error codes otherwise:
420  *   -EINVAL: Invalid argument.
421  */
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
427 /**
428  * Pipeline table state set
429  *
430  * @param[in] p
431  *   Pipeline handle.
432  * @param[out] table_state
433  *   After successful execution, the pipeline table state is updated to this
434  *   *table_state*. The ownership of all the data structures directly or
435  *   indirectly referenced by this *table_state* is passed from the caller to
436  *   the pipeline.
437  * @return
438  *   0 on success or the following error codes otherwise:
439  *   -EINVAL: Invalid argument.
440  */
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
450 /** Pipeline control opaque data structure. */
451 struct rte_swx_ctl_pipeline;
452
453 /**
454  * Pipeline control create
455  *
456  * @param[in] p
457  *   Pipeline handle.
458  * @return
459  *   Pipeline control handle, on success, or NULL, on error.
460  */
461 __rte_experimental
462 struct rte_swx_ctl_pipeline *
463 rte_swx_ctl_pipeline_create(struct rte_swx_pipeline *p);
464
465 /**
466  * Pipeline table entry add
467  *
468  * Schedule entry for addition to table or update as part of the next commit
469  * operation.
470  *
471  * @param[in] ctl
472  *   Pipeline control handle.
473  * @param[in] table_name
474  *   Table name.
475  * @param[in] entry
476  *   Entry to be added to the table.
477  * @return
478  *   0 on success or the following error codes otherwise:
479  *   -EINVAL: Invalid argument.
480  */
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
487 /**
488  * Pipeline table default entry add
489  *
490  * Schedule table default entry update as part of the next commit operation.
491  *
492  * @param[in] ctl
493  *   Pipeline control handle.
494  * @param[in] table_name
495  *   Table name.
496  * @param[in] entry
497  *   The new table default entry. The *key* and *key_mask* entry fields are
498  *   ignored.
499  * @return
500  *   0 on success or the following error codes otherwise:
501  *   -EINVAL: Invalid argument.
502  */
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
509 /**
510  * Pipeline table entry delete
511  *
512  * Schedule entry for deletion from table as part of the next commit operation.
513  * Request is silently discarded if no such entry exists.
514  *
515  * @param[in] ctl
516  *   Pipeline control handle.
517  * @param[in] table_name
518  *   Table name.
519  * @param[in] entry
520  *   Entry to be deleted from the table. The *action_id* and *action_data* entry
521  *   fields are ignored.
522  * @return
523  *   0 on success or the following error codes otherwise:
524  *   -EINVAL: Invalid argument.
525  */
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
532 /**
533  * Pipeline commit
534  *
535  * Perform all the scheduled table work.
536  *
537  * @param[in] ctl
538  *   Pipeline control handle.
539  * @param[in] abort_on_fail
540  *   When non-zero (false), all the scheduled work is discarded after a failed
541  *   commit. Otherwise, the scheduled work is still kept pending for the next
542  *   commit.
543  * @return
544  *   0 on success or the following error codes otherwise:
545  *   -EINVAL: Invalid argument.
546  */
547 __rte_experimental
548 int
549 rte_swx_ctl_pipeline_commit(struct rte_swx_ctl_pipeline *ctl,
550                             int abort_on_fail);
551
552 /**
553  * Pipeline abort
554  *
555  * Discard all the scheduled table work.
556  *
557  * @param[in] ctl
558  *   Pipeline control handle.
559  */
560 __rte_experimental
561 void
562 rte_swx_ctl_pipeline_abort(struct rte_swx_ctl_pipeline *ctl);
563
564 /**
565  * Pipeline table entry read
566  *
567  * Read table entry from string.
568  *
569  * @param[in] ctl
570  *   Pipeline control handle.
571  * @param[in] table_name
572  *   Table name.
573  * @param[in] string
574  *   String containing the table entry.
575  * @param[out] is_blank_or_comment
576  *   On error, this argument provides an indication of whether *string* contains
577  *   an invalid table entry (set to zero) or a blank or comment line that should
578  *   typically be ignored (set to a non-zero value).
579  * @return
580  *   0 on success or the following error codes otherwise:
581  *   -EINVAL: Invalid argument.
582  */
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
590 /**
591  * Pipeline table print to file
592  *
593  * Print all the table entries to file.
594  *
595  * @param[in] f
596  *   Output file.
597  * @param[in] ctl
598  *   Pipeline control handle.
599  * @param[in] table_name
600  *   Table name.
601  * @return
602  *   0 on success or the following error codes otherwise:
603  *   -EINVAL: Invalid argument.
604  */
605 __rte_experimental
606 int
607 rte_swx_ctl_pipeline_table_fprintf(FILE *f,
608                                    struct rte_swx_ctl_pipeline *ctl,
609                                    const char *table_name);
610
611 /*
612  * Register Array Query API.
613  */
614
615 /** Register array info. */
616 struct rte_swx_ctl_regarray_info {
617         /** Register array name. */
618         char name[RTE_SWX_CTL_NAME_SIZE];
619
620         /** Register array size. */
621         uint32_t size;
622 };
623
624 /**
625  * Register array info get
626  *
627  * @param[in] p
628  *   Pipeline handle.
629  * @param[in] regarray_id
630  *   Register array ID (0 .. *n_regarrays* - 1).
631  * @param[out] regarray
632  *   Register array info.
633  * @return
634  *   0 on success or the following error codes otherwise:
635  *   -EINVAL: Invalid argument.
636  */
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
643 /**
644  * Register read
645  *
646  * @param[in] p
647  *   Pipeline handle.
648  * @param[in] regarray_name
649  *   Register array name.
650  * @param[in] regarray_index
651  *   Register index within the array (0 .. *size* - 1).
652  * @param[out] value
653  *   Current register value.
654  * @return
655  *   0 on success or the following error codes otherwise:
656  *   -EINVAL: Invalid argument.
657  */
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
665 /**
666  * Register write
667  *
668  * @param[in] p
669  *   Pipeline handle.
670  * @param[in] regarray_name
671  *   Register array name.
672  * @param[in] regarray_index
673  *   Register index within the array (0 .. *size* - 1).
674  * @param[in] value
675  *   Value to be written to the register.
676  * @return
677  *   0 on success or the following error codes otherwise:
678  *   -EINVAL: Invalid argument.
679  */
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
691 /** Meter array info. */
692 struct rte_swx_ctl_metarray_info {
693         /** Meter array name. */
694         char name[RTE_SWX_CTL_NAME_SIZE];
695
696         /** Meter array size. */
697         uint32_t size;
698 };
699
700 /**
701  * Meter array info get
702  *
703  * @param[in] p
704  *   Pipeline handle.
705  * @param[in] metarray_id
706  *   Meter array ID (0 .. *n_metarrays* - 1).
707  * @param[out] metarray
708  *   Meter array info.
709  * @return
710  *   0 on success or the following error codes otherwise:
711  *   -EINVAL: Invalid argument.
712  */
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
719 /**
720  * Meter profile add
721  *
722  * @param[in] p
723  *   Pipeline handle.
724  * @param[in] name
725  *   Meter profile name.
726  * @param[in] params
727  *   Meter profile parameters.
728  * @return
729  *   0 on success or the following error codes otherwise:
730  *   -EINVAL: Invalid argument;
731  *   -ENOMEM: Not enough space/cannot allocate memory;
732  *   -EEXIST: Meter profile with this name already exists.
733  */
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
740 /**
741  * Meter profile delete
742  *
743  * @param[in] p
744  *   Pipeline handle.
745  * @param[in] name
746  *   Meter profile name.
747  * @return
748  *   0 on success or the following error codes otherwise:
749  *   -EINVAL: Invalid argument;
750  *   -EBUSY: Meter profile is currently in use.
751  */
752 __rte_experimental
753 int
754 rte_swx_ctl_meter_profile_delete(struct rte_swx_pipeline *p,
755                                  const char *name);
756
757 /**
758  * Meter reset
759  *
760  * Reset a meter within a given meter array to use the default profile that
761  * causes all the input packets to be colored as green. It is the responsibility
762  * of the control plane to make sure this meter is not used by the data plane
763  * pipeline before calling this function.
764  *
765  * @param[in] p
766  *   Pipeline handle.
767  * @param[in] metarray_name
768  *   Meter array name.
769  * @param[in] metarray_index
770  *   Meter index within the meter array.
771  * @return
772  *   0 on success or the following error codes otherwise:
773  *   -EINVAL: Invalid argument.
774  */
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
781 /**
782  * Meter set
783  *
784  * Set a meter within a given meter array to use a specific profile. It is the
785  * responsibility of the control plane to make sure this meter is not used by
786  * the data plane pipeline before calling this function.
787  *
788  * @param[in] p
789  *   Pipeline handle.
790  * @param[in] metarray_name
791  *   Meter array name.
792  * @param[in] metarray_index
793  *   Meter index within the meter array.
794  * @param[in] profile_name
795  *   Existing meter profile name.
796  * @return
797  *   0 on success or the following error codes otherwise:
798  *   -EINVAL: Invalid argument.
799  */
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
807 /** Meter statistics counters. */
808 struct rte_swx_ctl_meter_stats {
809         /** Number of packets tagged by the meter for each color. */
810         uint64_t n_pkts[RTE_COLORS];
811
812         /** Number of bytes tagged by the meter for each color. */
813         uint64_t n_bytes[RTE_COLORS];
814 };
815
816 /**
817  * Meter statistics counters read
818  *
819  * @param[in] p
820  *   Pipeline handle.
821  * @param[in] metarray_name
822  *   Meter array name.
823  * @param[in] metarray_index
824  *   Meter index within the meter array.
825  * @param[out] stats
826  *   Meter statistics counters.
827  * @return
828  *   0 on success or the following error codes otherwise:
829  *   -EINVAL: Invalid argument.
830  */
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
838 /**
839  * Pipeline control free
840  *
841  * @param[in] ctl
842  *   Pipeline control handle.
843  */
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