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