net/softnic: add flow API
[dpdk.git] / drivers / net / softnic / rte_eth_softnic_internals.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4
5 #ifndef __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
6 #define __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
7
8 #include <stddef.h>
9 #include <stdint.h>
10 #include <sys/queue.h>
11
12 #include <rte_mempool.h>
13 #include <rte_mbuf.h>
14 #include <rte_ring.h>
15 #include <rte_ethdev.h>
16 #include <rte_sched.h>
17 #include <rte_port_in_action.h>
18 #include <rte_table_action.h>
19 #include <rte_pipeline.h>
20
21 #include <rte_ethdev_driver.h>
22 #include <rte_tm_driver.h>
23 #include <rte_flow_driver.h>
24
25 #include "rte_eth_softnic.h"
26 #include "conn.h"
27
28 #define NAME_SIZE                                            64
29
30 /**
31  * PMD Parameters
32  */
33
34 struct pmd_params {
35         const char *name;
36         const char *firmware;
37         uint16_t conn_port;
38         uint32_t cpu_id;
39
40         /** Traffic Management (TM) */
41         struct {
42                 uint32_t n_queues; /**< Number of queues */
43                 uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
44         } tm;
45 };
46
47 /**
48  * Ethdev Flow API
49  */
50 struct rte_flow;
51
52 TAILQ_HEAD(flow_list, rte_flow);
53
54 /**
55  * MEMPOOL
56  */
57 struct softnic_mempool_params {
58         uint32_t buffer_size;
59         uint32_t pool_size;
60         uint32_t cache_size;
61 };
62
63 struct softnic_mempool {
64         TAILQ_ENTRY(softnic_mempool) node;
65         char name[NAME_SIZE];
66         struct rte_mempool *m;
67         uint32_t buffer_size;
68 };
69
70 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
71
72 /**
73  * SWQ
74  */
75 struct softnic_swq_params {
76         uint32_t size;
77 };
78
79 struct softnic_swq {
80         TAILQ_ENTRY(softnic_swq) node;
81         char name[NAME_SIZE];
82         struct rte_ring *r;
83 };
84
85 TAILQ_HEAD(softnic_swq_list, softnic_swq);
86
87 /**
88  * LINK
89  */
90 struct softnic_link_params {
91         const char *dev_name;
92         uint16_t port_id; /**< Valid only when *dev_name* is NULL. */
93 };
94
95 struct softnic_link {
96         TAILQ_ENTRY(softnic_link) node;
97         char name[NAME_SIZE];
98         uint16_t port_id;
99         uint32_t n_rxq;
100         uint32_t n_txq;
101 };
102
103 TAILQ_HEAD(softnic_link_list, softnic_link);
104
105 /**
106  * TMGR
107  */
108
109 #ifndef TM_MAX_SUBPORTS
110 #define TM_MAX_SUBPORTS                                 8
111 #endif
112
113 #ifndef TM_MAX_PIPES_PER_SUBPORT
114 #define TM_MAX_PIPES_PER_SUBPORT                        4096
115 #endif
116
117 struct tm_params {
118         struct rte_sched_port_params port_params;
119
120         struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
121
122         struct rte_sched_pipe_params
123                 pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PORT];
124         uint32_t n_pipe_profiles;
125         uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
126 };
127
128 /* TM Levels */
129 enum tm_node_level {
130         TM_NODE_LEVEL_PORT = 0,
131         TM_NODE_LEVEL_SUBPORT,
132         TM_NODE_LEVEL_PIPE,
133         TM_NODE_LEVEL_TC,
134         TM_NODE_LEVEL_QUEUE,
135         TM_NODE_LEVEL_MAX,
136 };
137
138 /* TM Shaper Profile */
139 struct tm_shaper_profile {
140         TAILQ_ENTRY(tm_shaper_profile) node;
141         uint32_t shaper_profile_id;
142         uint32_t n_users;
143         struct rte_tm_shaper_params params;
144 };
145
146 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
147
148 /* TM Shared Shaper */
149 struct tm_shared_shaper {
150         TAILQ_ENTRY(tm_shared_shaper) node;
151         uint32_t shared_shaper_id;
152         uint32_t n_users;
153         uint32_t shaper_profile_id;
154 };
155
156 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
157
158 /* TM WRED Profile */
159 struct tm_wred_profile {
160         TAILQ_ENTRY(tm_wred_profile) node;
161         uint32_t wred_profile_id;
162         uint32_t n_users;
163         struct rte_tm_wred_params params;
164 };
165
166 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
167
168 /* TM Node */
169 struct tm_node {
170         TAILQ_ENTRY(tm_node) node;
171         uint32_t node_id;
172         uint32_t parent_node_id;
173         uint32_t priority;
174         uint32_t weight;
175         uint32_t level;
176         struct tm_node *parent_node;
177         struct tm_shaper_profile *shaper_profile;
178         struct tm_wred_profile *wred_profile;
179         struct rte_tm_node_params params;
180         struct rte_tm_node_stats stats;
181         uint32_t n_children;
182 };
183
184 TAILQ_HEAD(tm_node_list, tm_node);
185
186 /* TM Hierarchy Specification */
187 struct tm_hierarchy {
188         struct tm_shaper_profile_list shaper_profiles;
189         struct tm_shared_shaper_list shared_shapers;
190         struct tm_wred_profile_list wred_profiles;
191         struct tm_node_list nodes;
192
193         uint32_t n_shaper_profiles;
194         uint32_t n_shared_shapers;
195         uint32_t n_wred_profiles;
196         uint32_t n_nodes;
197
198         uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
199 };
200
201 struct tm_internals {
202         /** Hierarchy specification
203          *
204          *     -Hierarchy is unfrozen at init and when port is stopped.
205          *     -Hierarchy is frozen on successful hierarchy commit.
206          *     -Run-time hierarchy changes are not allowed, therefore it makes
207          *      sense to keep the hierarchy frozen after the port is started.
208          */
209         struct tm_hierarchy h;
210         int hierarchy_frozen;
211
212         /** Blueprints */
213         struct tm_params params;
214 };
215
216 struct softnic_tmgr_port {
217         TAILQ_ENTRY(softnic_tmgr_port) node;
218         char name[NAME_SIZE];
219         struct rte_sched_port *s;
220 };
221
222 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
223
224 /**
225  * TAP
226  */
227 struct softnic_tap {
228         TAILQ_ENTRY(softnic_tap) node;
229         char name[NAME_SIZE];
230         int fd;
231 };
232
233 TAILQ_HEAD(softnic_tap_list, softnic_tap);
234
235 /**
236  * Input port action
237  */
238 struct softnic_port_in_action_profile_params {
239         uint64_t action_mask;
240         struct rte_port_in_action_fltr_config fltr;
241         struct rte_port_in_action_lb_config lb;
242 };
243
244 struct softnic_port_in_action_profile {
245         TAILQ_ENTRY(softnic_port_in_action_profile) node;
246         char name[NAME_SIZE];
247         struct softnic_port_in_action_profile_params params;
248         struct rte_port_in_action_profile *ap;
249 };
250
251 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
252
253 /**
254  * Table action
255  */
256 struct softnic_table_action_profile_params {
257         uint64_t action_mask;
258         struct rte_table_action_common_config common;
259         struct rte_table_action_lb_config lb;
260         struct rte_table_action_mtr_config mtr;
261         struct rte_table_action_tm_config tm;
262         struct rte_table_action_encap_config encap;
263         struct rte_table_action_nat_config nat;
264         struct rte_table_action_ttl_config ttl;
265         struct rte_table_action_stats_config stats;
266 };
267
268 struct softnic_table_action_profile {
269         TAILQ_ENTRY(softnic_table_action_profile) node;
270         char name[NAME_SIZE];
271         struct softnic_table_action_profile_params params;
272         struct rte_table_action_profile *ap;
273 };
274
275 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
276
277 /**
278  * Pipeline
279  */
280 struct pipeline_params {
281         uint32_t timer_period_ms;
282         uint32_t offset_port_id;
283 };
284
285 enum softnic_port_in_type {
286         PORT_IN_RXQ,
287         PORT_IN_SWQ,
288         PORT_IN_TMGR,
289         PORT_IN_TAP,
290         PORT_IN_SOURCE,
291 };
292
293 struct softnic_port_in_params {
294         /* Read */
295         enum softnic_port_in_type type;
296         const char *dev_name;
297         union {
298                 struct {
299                         uint16_t queue_id;
300                 } rxq;
301
302                 struct {
303                         const char *mempool_name;
304                         uint32_t mtu;
305                 } tap;
306
307                 struct {
308                         const char *mempool_name;
309                         const char *file_name;
310                         uint32_t n_bytes_per_pkt;
311                 } source;
312         };
313         uint32_t burst_size;
314
315         /* Action */
316         const char *action_profile_name;
317 };
318
319 enum softnic_port_out_type {
320         PORT_OUT_TXQ,
321         PORT_OUT_SWQ,
322         PORT_OUT_TMGR,
323         PORT_OUT_TAP,
324         PORT_OUT_SINK,
325 };
326
327 struct softnic_port_out_params {
328         enum softnic_port_out_type type;
329         const char *dev_name;
330         union {
331                 struct {
332                         uint16_t queue_id;
333                 } txq;
334
335                 struct {
336                         const char *file_name;
337                         uint32_t max_n_pkts;
338                 } sink;
339         };
340         uint32_t burst_size;
341         int retry;
342         uint32_t n_retries;
343 };
344
345 enum softnic_table_type {
346         TABLE_ACL,
347         TABLE_ARRAY,
348         TABLE_HASH,
349         TABLE_LPM,
350         TABLE_STUB,
351 };
352
353 struct softnic_table_acl_params {
354         uint32_t n_rules;
355         uint32_t ip_header_offset;
356         int ip_version;
357 };
358
359 struct softnic_table_array_params {
360         uint32_t n_keys;
361         uint32_t key_offset;
362 };
363
364 struct softnic_table_hash_params {
365         uint32_t n_keys;
366         uint32_t key_offset;
367         uint32_t key_size;
368         uint8_t *key_mask;
369         uint32_t n_buckets;
370         int extendable_bucket;
371 };
372
373 struct softnic_table_lpm_params {
374         uint32_t n_rules;
375         uint32_t key_offset;
376         uint32_t key_size;
377 };
378
379 struct softnic_table_params {
380         /* Match */
381         enum softnic_table_type match_type;
382         union {
383                 struct softnic_table_acl_params acl;
384                 struct softnic_table_array_params array;
385                 struct softnic_table_hash_params hash;
386                 struct softnic_table_lpm_params lpm;
387         } match;
388
389         /* Action */
390         const char *action_profile_name;
391 };
392
393 struct softnic_port_in {
394         struct softnic_port_in_params params;
395         struct softnic_port_in_action_profile *ap;
396         struct rte_port_in_action *a;
397 };
398
399 struct softnic_table {
400         struct softnic_table_params params;
401         struct softnic_table_action_profile *ap;
402         struct rte_table_action *a;
403 };
404
405 struct pipeline {
406         TAILQ_ENTRY(pipeline) node;
407         char name[NAME_SIZE];
408
409         struct rte_pipeline *p;
410         struct softnic_port_in port_in[RTE_PIPELINE_PORT_IN_MAX];
411         struct softnic_table table[RTE_PIPELINE_TABLE_MAX];
412         uint32_t n_ports_in;
413         uint32_t n_ports_out;
414         uint32_t n_tables;
415
416         struct rte_ring *msgq_req;
417         struct rte_ring *msgq_rsp;
418         uint32_t timer_period_ms;
419
420         int enabled;
421         uint32_t thread_id;
422         uint32_t cpu_id;
423 };
424
425 TAILQ_HEAD(pipeline_list, pipeline);
426
427 /**
428  * Thread
429  */
430 #ifndef THREAD_PIPELINES_MAX
431 #define THREAD_PIPELINES_MAX                               256
432 #endif
433
434 #ifndef THREAD_MSGQ_SIZE
435 #define THREAD_MSGQ_SIZE                                   64
436 #endif
437
438 #ifndef THREAD_TIMER_PERIOD_MS
439 #define THREAD_TIMER_PERIOD_MS                             100
440 #endif
441
442 /**
443  * Master thead: data plane thread context
444  */
445 struct softnic_thread {
446         struct rte_ring *msgq_req;
447         struct rte_ring *msgq_rsp;
448
449         uint32_t enabled;
450 };
451
452 /**
453  * Data plane threads: context
454  */
455 #ifndef TABLE_RULE_ACTION_SIZE_MAX
456 #define TABLE_RULE_ACTION_SIZE_MAX                         2048
457 #endif
458
459 struct softnic_table_data {
460         struct rte_table_action *a;
461 };
462
463 struct pipeline_data {
464         struct rte_pipeline *p;
465         struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
466         uint32_t n_tables;
467
468         struct rte_ring *msgq_req;
469         struct rte_ring *msgq_rsp;
470         uint64_t timer_period; /* Measured in CPU cycles. */
471         uint64_t time_next;
472
473         uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
474 };
475
476 struct softnic_thread_data {
477         struct rte_pipeline *p[THREAD_PIPELINES_MAX];
478         uint32_t n_pipelines;
479
480         struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
481         struct rte_ring *msgq_req;
482         struct rte_ring *msgq_rsp;
483         uint64_t timer_period; /* Measured in CPU cycles. */
484         uint64_t time_next;
485         uint64_t time_next_min;
486         uint64_t iter;
487 } __rte_cache_aligned;
488
489 /**
490  * PMD Internals
491  */
492 struct pmd_internals {
493         /** Params */
494         struct pmd_params params;
495
496         struct {
497                 struct tm_internals tm; /**< Traffic Management */
498         } soft;
499
500         struct softnic_conn *conn;
501         struct softnic_mempool_list mempool_list;
502         struct softnic_swq_list swq_list;
503         struct softnic_link_list link_list;
504         struct softnic_tmgr_port_list tmgr_port_list;
505         struct softnic_tap_list tap_list;
506         struct softnic_port_in_action_profile_list port_in_action_profile_list;
507         struct softnic_table_action_profile_list table_action_profile_list;
508         struct pipeline_list pipeline_list;
509         struct softnic_thread thread[RTE_MAX_LCORE];
510         struct softnic_thread_data thread_data[RTE_MAX_LCORE];
511 };
512
513 /**
514  * MEMPOOL
515  */
516 int
517 softnic_mempool_init(struct pmd_internals *p);
518
519 void
520 softnic_mempool_free(struct pmd_internals *p);
521
522 struct softnic_mempool *
523 softnic_mempool_find(struct pmd_internals *p,
524         const char *name);
525
526 struct softnic_mempool *
527 softnic_mempool_create(struct pmd_internals *p,
528         const char *name,
529         struct softnic_mempool_params *params);
530
531 /**
532  * SWQ
533  */
534 int
535 softnic_swq_init(struct pmd_internals *p);
536
537 void
538 softnic_swq_free(struct pmd_internals *p);
539
540 void
541 softnic_softnic_swq_free_keep_rxq_txq(struct pmd_internals *p);
542
543 struct softnic_swq *
544 softnic_swq_find(struct pmd_internals *p,
545         const char *name);
546
547 struct softnic_swq *
548 softnic_swq_create(struct pmd_internals *p,
549         const char *name,
550         struct softnic_swq_params *params);
551
552 /**
553  * LINK
554  */
555 int
556 softnic_link_init(struct pmd_internals *p);
557
558 void
559 softnic_link_free(struct pmd_internals *p);
560
561 struct softnic_link *
562 softnic_link_find(struct pmd_internals *p,
563         const char *name);
564
565 struct softnic_link *
566 softnic_link_create(struct pmd_internals *p,
567         const char *name,
568         struct softnic_link_params *params);
569
570 /**
571  * TMGR
572  */
573 int
574 softnic_tmgr_init(struct pmd_internals *p);
575
576 void
577 softnic_tmgr_free(struct pmd_internals *p);
578
579 struct softnic_tmgr_port *
580 softnic_tmgr_port_find(struct pmd_internals *p,
581         const char *name);
582
583 struct softnic_tmgr_port *
584 softnic_tmgr_port_create(struct pmd_internals *p,
585         const char *name);
586
587 void
588 tm_hierarchy_init(struct pmd_internals *p);
589
590 void
591 tm_hierarchy_free(struct pmd_internals *p);
592
593 static inline int
594 tm_used(struct rte_eth_dev *dev)
595 {
596         struct pmd_internals *p = dev->data->dev_private;
597
598         return p->soft.tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
599 }
600
601 extern const struct rte_tm_ops pmd_tm_ops;
602
603 /**
604  * TAP
605  */
606 int
607 softnic_tap_init(struct pmd_internals *p);
608
609 void
610 softnic_tap_free(struct pmd_internals *p);
611
612 struct softnic_tap *
613 softnic_tap_find(struct pmd_internals *p,
614         const char *name);
615
616 struct softnic_tap *
617 softnic_tap_create(struct pmd_internals *p,
618         const char *name);
619
620 /**
621  * Input port action
622  */
623 int
624 softnic_port_in_action_profile_init(struct pmd_internals *p);
625
626 void
627 softnic_port_in_action_profile_free(struct pmd_internals *p);
628
629 struct softnic_port_in_action_profile *
630 softnic_port_in_action_profile_find(struct pmd_internals *p,
631         const char *name);
632
633 struct softnic_port_in_action_profile *
634 softnic_port_in_action_profile_create(struct pmd_internals *p,
635         const char *name,
636         struct softnic_port_in_action_profile_params *params);
637
638 /**
639  * Table action
640  */
641 int
642 softnic_table_action_profile_init(struct pmd_internals *p);
643
644 void
645 softnic_table_action_profile_free(struct pmd_internals *p);
646
647 struct softnic_table_action_profile *
648 softnic_table_action_profile_find(struct pmd_internals *p,
649         const char *name);
650
651 struct softnic_table_action_profile *
652 softnic_table_action_profile_create(struct pmd_internals *p,
653         const char *name,
654         struct softnic_table_action_profile_params *params);
655
656 /**
657  * Pipeline
658  */
659 int
660 softnic_pipeline_init(struct pmd_internals *p);
661
662 void
663 softnic_pipeline_free(struct pmd_internals *p);
664
665 void
666 softnic_pipeline_disable_all(struct pmd_internals *p);
667
668 struct pipeline *
669 softnic_pipeline_find(struct pmd_internals *p, const char *name);
670
671 struct pipeline *
672 softnic_pipeline_create(struct pmd_internals *p,
673         const char *name,
674         struct pipeline_params *params);
675
676 int
677 softnic_pipeline_port_in_create(struct pmd_internals *p,
678         const char *pipeline_name,
679         struct softnic_port_in_params *params,
680         int enabled);
681
682 int
683 softnic_pipeline_port_in_connect_to_table(struct pmd_internals *p,
684         const char *pipeline_name,
685         uint32_t port_id,
686         uint32_t table_id);
687
688 int
689 softnic_pipeline_port_out_create(struct pmd_internals *p,
690         const char *pipeline_name,
691         struct softnic_port_out_params *params);
692
693 int
694 softnic_pipeline_table_create(struct pmd_internals *p,
695         const char *pipeline_name,
696         struct softnic_table_params *params);
697
698 struct softnic_table_rule_match_acl {
699         int ip_version;
700
701         RTE_STD_C11
702         union {
703                 struct {
704                         uint32_t sa;
705                         uint32_t da;
706                 } ipv4;
707
708                 struct {
709                         uint8_t sa[16];
710                         uint8_t da[16];
711                 } ipv6;
712         };
713
714         uint32_t sa_depth;
715         uint32_t da_depth;
716         uint16_t sp0;
717         uint16_t sp1;
718         uint16_t dp0;
719         uint16_t dp1;
720         uint8_t proto;
721         uint8_t proto_mask;
722         uint32_t priority;
723 };
724
725 struct softnic_table_rule_match_array {
726         uint32_t pos;
727 };
728
729 #ifndef TABLE_RULE_MATCH_SIZE_MAX
730 #define TABLE_RULE_MATCH_SIZE_MAX                          256
731 #endif
732
733 struct softnic_table_rule_match_hash {
734         uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
735 };
736
737 struct softnic_table_rule_match_lpm {
738         int ip_version;
739
740         RTE_STD_C11
741         union {
742                 uint32_t ipv4;
743                 uint8_t ipv6[16];
744         };
745
746         uint8_t depth;
747 };
748
749 struct softnic_table_rule_match {
750         enum softnic_table_type match_type;
751
752         union {
753                 struct softnic_table_rule_match_acl acl;
754                 struct softnic_table_rule_match_array array;
755                 struct softnic_table_rule_match_hash hash;
756                 struct softnic_table_rule_match_lpm lpm;
757         } match;
758 };
759
760 struct softnic_table_rule_action {
761         uint64_t action_mask;
762         struct rte_table_action_fwd_params fwd;
763         struct rte_table_action_lb_params lb;
764         struct rte_table_action_mtr_params mtr;
765         struct rte_table_action_tm_params tm;
766         struct rte_table_action_encap_params encap;
767         struct rte_table_action_nat_params nat;
768         struct rte_table_action_ttl_params ttl;
769         struct rte_table_action_stats_params stats;
770         struct rte_table_action_time_params time;
771 };
772
773 struct rte_flow {
774         TAILQ_ENTRY(rte_flow) node;
775         struct softnic_table_rule_match match;
776         struct softnic_table_rule_action action;
777         void *data;
778         struct pipeline *pipeline;
779         uint32_t table_id;
780 };
781
782 int
783 softnic_pipeline_port_in_stats_read(struct pmd_internals *p,
784         const char *pipeline_name,
785         uint32_t port_id,
786         struct rte_pipeline_port_in_stats *stats,
787         int clear);
788
789 int
790 softnic_pipeline_port_in_enable(struct pmd_internals *p,
791         const char *pipeline_name,
792         uint32_t port_id);
793
794 int
795 softnic_pipeline_port_in_disable(struct pmd_internals *p,
796         const char *pipeline_name,
797         uint32_t port_id);
798
799 int
800 softnic_pipeline_port_out_stats_read(struct pmd_internals *p,
801         const char *pipeline_name,
802         uint32_t port_id,
803         struct rte_pipeline_port_out_stats *stats,
804         int clear);
805
806 int
807 softnic_pipeline_table_stats_read(struct pmd_internals *p,
808         const char *pipeline_name,
809         uint32_t table_id,
810         struct rte_pipeline_table_stats *stats,
811         int clear);
812
813 int
814 softnic_pipeline_table_rule_add(struct pmd_internals *p,
815         const char *pipeline_name,
816         uint32_t table_id,
817         struct softnic_table_rule_match *match,
818         struct softnic_table_rule_action *action,
819         void **data);
820
821 int
822 softnic_pipeline_table_rule_add_bulk(struct pmd_internals *p,
823         const char *pipeline_name,
824         uint32_t table_id,
825         struct softnic_table_rule_match *match,
826         struct softnic_table_rule_action *action,
827         void **data,
828         uint32_t *n_rules);
829
830 int
831 softnic_pipeline_table_rule_add_default(struct pmd_internals *p,
832         const char *pipeline_name,
833         uint32_t table_id,
834         struct softnic_table_rule_action *action,
835         void **data);
836
837 int
838 softnic_pipeline_table_rule_delete(struct pmd_internals *p,
839         const char *pipeline_name,
840         uint32_t table_id,
841         struct softnic_table_rule_match *match);
842
843 int
844 softnic_pipeline_table_rule_delete_default(struct pmd_internals *p,
845         const char *pipeline_name,
846         uint32_t table_id);
847
848 int
849 softnic_pipeline_table_rule_stats_read(struct pmd_internals *p,
850         const char *pipeline_name,
851         uint32_t table_id,
852         void *data,
853         struct rte_table_action_stats_counters *stats,
854         int clear);
855
856 int
857 softnic_pipeline_table_mtr_profile_add(struct pmd_internals *p,
858         const char *pipeline_name,
859         uint32_t table_id,
860         uint32_t meter_profile_id,
861         struct rte_table_action_meter_profile *profile);
862
863 int
864 softnic_pipeline_table_mtr_profile_delete(struct pmd_internals *p,
865         const char *pipeline_name,
866         uint32_t table_id,
867         uint32_t meter_profile_id);
868
869 int
870 softnic_pipeline_table_rule_mtr_read(struct pmd_internals *p,
871         const char *pipeline_name,
872         uint32_t table_id,
873         void *data,
874         uint32_t tc_mask,
875         struct rte_table_action_mtr_counters *stats,
876         int clear);
877
878 int
879 softnic_pipeline_table_dscp_table_update(struct pmd_internals *p,
880         const char *pipeline_name,
881         uint32_t table_id,
882         uint64_t dscp_mask,
883         struct rte_table_action_dscp_table *dscp_table);
884
885 int
886 softnic_pipeline_table_rule_ttl_read(struct pmd_internals *p,
887         const char *pipeline_name,
888         uint32_t table_id,
889         void *data,
890         struct rte_table_action_ttl_counters *stats,
891         int clear);
892
893 /**
894  * Thread
895  */
896 int
897 softnic_thread_init(struct pmd_internals *p);
898
899 void
900 softnic_thread_free(struct pmd_internals *p);
901
902 int
903 softnic_thread_pipeline_enable(struct pmd_internals *p,
904         uint32_t thread_id,
905         const char *pipeline_name);
906
907 int
908 softnic_thread_pipeline_disable(struct pmd_internals *p,
909         uint32_t thread_id,
910         const char *pipeline_name);
911
912 /**
913  * CLI
914  */
915 void
916 softnic_cli_process(char *in,
917         char *out,
918         size_t out_size,
919         void *arg);
920
921 int
922 softnic_cli_script_process(struct pmd_internals *softnic,
923         const char *file_name,
924         size_t msg_in_len_max,
925         size_t msg_out_len_max);
926
927 #endif /* __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__ */