DPDK  18.11.11
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_core.h>
22 #include <rte_ethdev_driver.h>
23 #include <rte_tm_driver.h>
24 #include <rte_flow_driver.h>
25 #include <rte_mtr_driver.h>
26 
27 #include "rte_eth_softnic.h"
28 #include "conn.h"
29 
30 #define NAME_SIZE 64
31 
36 struct pmd_params {
37  const char *name;
38  const char *firmware;
39  uint16_t conn_port;
40  uint32_t cpu_id;
41 
43  struct {
44  uint32_t n_queues;
45  uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
46  } tm;
47 };
48 
52 struct rte_flow;
53 
54 TAILQ_HEAD(flow_list, rte_flow);
55 
56 struct flow_attr_map {
57  char pipeline_name[NAME_SIZE];
58  uint32_t table_id;
59  int valid;
60 };
61 
62 #ifndef SOFTNIC_FLOW_MAX_GROUPS
63 #define SOFTNIC_FLOW_MAX_GROUPS 64
64 #endif
65 
66 struct flow_internals {
67  struct flow_attr_map ingress_map[SOFTNIC_FLOW_MAX_GROUPS];
68  struct flow_attr_map egress_map[SOFTNIC_FLOW_MAX_GROUPS];
69 };
70 
75 /* MTR meter profile */
77  TAILQ_ENTRY(softnic_mtr_meter_profile) node;
78  uint32_t meter_profile_id;
79  struct rte_mtr_meter_profile params;
80  uint32_t n_users;
81 };
82 
83 TAILQ_HEAD(softnic_mtr_meter_profile_list, softnic_mtr_meter_profile);
84 
85 /* MTR meter object */
86 struct softnic_mtr {
87  TAILQ_ENTRY(softnic_mtr) node;
88  uint32_t mtr_id;
89  struct rte_mtr_params params;
90  struct rte_flow *flow;
91 };
92 
93 TAILQ_HEAD(softnic_mtr_list, softnic_mtr);
94 
95 struct mtr_internals {
96  struct softnic_mtr_meter_profile_list meter_profiles;
97  struct softnic_mtr_list mtrs;
98 };
99 
104  uint32_t buffer_size;
105  uint32_t pool_size;
106  uint32_t cache_size;
107 };
108 
109 struct softnic_mempool {
110  TAILQ_ENTRY(softnic_mempool) node;
111  char name[NAME_SIZE];
112  struct rte_mempool *m;
113  uint32_t buffer_size;
114 };
115 
116 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
117 
122  uint32_t size;
123 };
124 
125 struct softnic_swq {
126  TAILQ_ENTRY(softnic_swq) node;
127  char name[NAME_SIZE];
128  struct rte_ring *r;
129 };
130 
131 TAILQ_HEAD(softnic_swq_list, softnic_swq);
132 
137  const char *dev_name;
138  uint16_t port_id;
139 };
140 
141 struct softnic_link {
142  TAILQ_ENTRY(softnic_link) node;
143  char name[NAME_SIZE];
144  uint16_t port_id;
145  uint32_t n_rxq;
146  uint32_t n_txq;
147 };
148 
149 TAILQ_HEAD(softnic_link_list, softnic_link);
150 
155 #ifndef TM_MAX_SUBPORTS
156 #define TM_MAX_SUBPORTS 8
157 #endif
158 
159 #ifndef TM_MAX_PIPES_PER_SUBPORT
160 #define TM_MAX_PIPES_PER_SUBPORT 4096
161 #endif
162 
163 struct tm_params {
164  struct rte_sched_port_params port_params;
165 
166  struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
167 
168  struct rte_sched_pipe_params
169  pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PORT];
170  uint32_t n_pipe_profiles;
171  uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
172 };
173 
174 /* TM Levels */
175 enum tm_node_level {
176  TM_NODE_LEVEL_PORT = 0,
177  TM_NODE_LEVEL_SUBPORT,
178  TM_NODE_LEVEL_PIPE,
179  TM_NODE_LEVEL_TC,
180  TM_NODE_LEVEL_QUEUE,
181  TM_NODE_LEVEL_MAX,
182 };
183 
184 /* TM Shaper Profile */
185 struct tm_shaper_profile {
186  TAILQ_ENTRY(tm_shaper_profile) node;
187  uint32_t shaper_profile_id;
188  uint32_t n_users;
189  struct rte_tm_shaper_params params;
190 };
191 
192 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
193 
194 /* TM Shared Shaper */
195 struct tm_shared_shaper {
196  TAILQ_ENTRY(tm_shared_shaper) node;
197  uint32_t shared_shaper_id;
198  uint32_t n_users;
199  uint32_t shaper_profile_id;
200 };
201 
202 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
203 
204 /* TM WRED Profile */
205 struct tm_wred_profile {
206  TAILQ_ENTRY(tm_wred_profile) node;
207  uint32_t wred_profile_id;
208  uint32_t n_users;
209  struct rte_tm_wred_params params;
210 };
211 
212 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
213 
214 /* TM Node */
215 struct tm_node {
216  TAILQ_ENTRY(tm_node) node;
217  uint32_t node_id;
218  uint32_t parent_node_id;
219  uint32_t priority;
220  uint32_t weight;
221  uint32_t level;
222  struct tm_node *parent_node;
223  struct tm_shaper_profile *shaper_profile;
224  struct tm_wred_profile *wred_profile;
225  struct rte_tm_node_params params;
226  struct rte_tm_node_stats stats;
227  uint32_t n_children;
228 };
229 
230 TAILQ_HEAD(tm_node_list, tm_node);
231 
232 /* TM Hierarchy Specification */
233 struct tm_hierarchy {
234  struct tm_shaper_profile_list shaper_profiles;
235  struct tm_shared_shaper_list shared_shapers;
236  struct tm_wred_profile_list wred_profiles;
237  struct tm_node_list nodes;
238 
239  uint32_t n_shaper_profiles;
240  uint32_t n_shared_shapers;
241  uint32_t n_wred_profiles;
242  uint32_t n_nodes;
243 
244  uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
245 };
246 
247 struct tm_internals {
255  struct tm_hierarchy h;
256  int hierarchy_frozen;
257 
259  struct tm_params params;
260 };
261 
262 struct softnic_tmgr_port {
263  TAILQ_ENTRY(softnic_tmgr_port) node;
264  char name[NAME_SIZE];
265  struct rte_sched_port *s;
266 };
267 
268 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
269 
273 struct softnic_tap {
274  TAILQ_ENTRY(softnic_tap) node;
275  char name[NAME_SIZE];
276  int fd;
277 };
278 
279 TAILQ_HEAD(softnic_tap_list, softnic_tap);
280 
285  const char *dev_name;
286  uint32_t dev_id;
287  uint32_t n_queues;
288  uint32_t queue_size;
289 };
290 
291 struct softnic_cryptodev {
292  TAILQ_ENTRY(softnic_cryptodev) node;
293  char name[NAME_SIZE];
294  uint16_t dev_id;
295  uint32_t n_queues;
296 };
297 
298 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
299 
304  uint64_t action_mask;
305  struct rte_port_in_action_fltr_config fltr;
307 };
308 
309 struct softnic_port_in_action_profile {
310  TAILQ_ENTRY(softnic_port_in_action_profile) node;
311  char name[NAME_SIZE];
313  struct rte_port_in_action_profile *ap;
314 };
315 
316 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
317 
322  uint64_t action_mask;
323  struct rte_table_action_common_config common;
324  struct rte_table_action_lb_config lb;
325  struct rte_table_action_mtr_config mtr;
326  struct rte_table_action_tm_config tm;
327  struct rte_table_action_encap_config encap;
328  struct rte_table_action_nat_config nat;
329  struct rte_table_action_ttl_config ttl;
330  struct rte_table_action_stats_config stats;
331  struct rte_table_action_sym_crypto_config sym_crypto;
332 };
333 
334 struct softnic_table_action_profile {
335  TAILQ_ENTRY(softnic_table_action_profile) node;
336  char name[NAME_SIZE];
338  struct rte_table_action_profile *ap;
339 };
340 
341 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
342 
343 struct softnic_table_meter_profile {
344  TAILQ_ENTRY(softnic_table_meter_profile) node;
345  uint32_t meter_profile_id;
346  struct rte_table_action_meter_profile profile;
347 };
348 
349 TAILQ_HEAD(softnic_table_meter_profile_list,
350  softnic_table_meter_profile);
351 
356  uint32_t timer_period_ms;
357  uint32_t offset_port_id;
358 };
359 
360 enum softnic_port_in_type {
361  PORT_IN_RXQ,
362  PORT_IN_SWQ,
363  PORT_IN_TMGR,
364  PORT_IN_TAP,
365  PORT_IN_SOURCE,
366  PORT_IN_CRYPTODEV,
367 };
368 
369 struct softnic_port_in_params {
370  /* Read */
371  enum softnic_port_in_type type;
372  char dev_name[NAME_SIZE];
373  union {
374  struct {
375  uint16_t queue_id;
376  } rxq;
377 
378  struct {
379  const char *mempool_name;
380  uint32_t mtu;
381  } tap;
382 
383  struct {
384  const char *mempool_name;
385  const char *file_name;
386  uint32_t n_bytes_per_pkt;
387  } source;
388 
389  struct {
390  uint16_t queue_id;
391  void *f_callback;
392  void *arg_callback;
393  } cryptodev;
394  };
395  uint32_t burst_size;
396 
397  /* Action */
398  char action_profile_name[NAME_SIZE];
399 };
400 
401 enum softnic_port_out_type {
402  PORT_OUT_TXQ,
403  PORT_OUT_SWQ,
404  PORT_OUT_TMGR,
405  PORT_OUT_TAP,
406  PORT_OUT_SINK,
407  PORT_OUT_CRYPTODEV,
408 };
409 
410 struct softnic_port_out_params {
411  enum softnic_port_out_type type;
412  char dev_name[NAME_SIZE];
413  union {
414  struct {
415  uint16_t queue_id;
416  } txq;
417 
418  struct {
419  const char *file_name;
420  uint32_t max_n_pkts;
421  } sink;
422 
423  struct {
424  uint16_t queue_id;
425  uint32_t op_offset;
426  } cryptodev;
427  };
428  uint32_t burst_size;
429  int retry;
430  uint32_t n_retries;
431 };
432 
433 enum softnic_table_type {
434  TABLE_ACL,
435  TABLE_ARRAY,
436  TABLE_HASH,
437  TABLE_LPM,
438  TABLE_STUB,
439 };
440 
441 struct softnic_table_acl_params {
442  uint32_t n_rules;
443  uint32_t ip_header_offset;
444  int ip_version;
445 };
446 
447 struct softnic_table_array_params {
448  uint32_t n_keys;
449  uint32_t key_offset;
450 };
451 
452 #ifndef TABLE_RULE_MATCH_SIZE_MAX
453 #define TABLE_RULE_MATCH_SIZE_MAX 256
454 #endif
455 
456 struct softnic_table_hash_params {
457  uint32_t n_keys;
458  uint32_t key_offset;
459  uint32_t key_size;
460  uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
461  uint32_t n_buckets;
462  int extendable_bucket;
463 };
464 
465 struct softnic_table_lpm_params {
466  uint32_t n_rules;
467  uint32_t key_offset;
468  uint32_t key_size;
469 };
470 
471 struct softnic_table_params {
472  /* Match */
473  enum softnic_table_type match_type;
474  union {
475  struct softnic_table_acl_params acl;
476  struct softnic_table_array_params array;
477  struct softnic_table_hash_params hash;
478  struct softnic_table_lpm_params lpm;
479  } match;
480 
481  /* Action */
482  char action_profile_name[NAME_SIZE];
483 };
484 
485 struct softnic_port_in {
486  struct softnic_port_in_params params;
487  struct softnic_port_in_action_profile *ap;
488  struct rte_port_in_action *a;
489 };
490 
491 struct softnic_port_out {
492  struct softnic_port_out_params params;
493 };
494 
495 struct softnic_table {
496  struct softnic_table_params params;
497  struct softnic_table_action_profile *ap;
498  struct rte_table_action *a;
499  struct flow_list flows;
500  struct rte_table_action_dscp_table dscp_table;
501  struct softnic_table_meter_profile_list meter_profiles;
502 };
503 
504 struct pipeline {
505  TAILQ_ENTRY(pipeline) node;
506  char name[NAME_SIZE];
507 
508  struct rte_pipeline *p;
509  struct pipeline_params params;
510  struct softnic_port_in port_in[RTE_PIPELINE_PORT_IN_MAX];
511  struct softnic_port_out port_out[RTE_PIPELINE_PORT_OUT_MAX];
512  struct softnic_table table[RTE_PIPELINE_TABLE_MAX];
513  uint32_t n_ports_in;
514  uint32_t n_ports_out;
515  uint32_t n_tables;
516 
517  struct rte_ring *msgq_req;
518  struct rte_ring *msgq_rsp;
519  uint32_t timer_period_ms;
520 
521  int enabled;
522  uint32_t thread_id;
523  uint32_t cpu_id;
524 };
525 
526 TAILQ_HEAD(pipeline_list, pipeline);
527 
531 #ifndef THREAD_PIPELINES_MAX
532 #define THREAD_PIPELINES_MAX 256
533 #endif
534 
535 #ifndef THREAD_MSGQ_SIZE
536 #define THREAD_MSGQ_SIZE 64
537 #endif
538 
539 #ifndef THREAD_TIMER_PERIOD_MS
540 #define THREAD_TIMER_PERIOD_MS 100
541 #endif
542 
547  struct rte_ring *msgq_req;
548  struct rte_ring *msgq_rsp;
549 
550  uint32_t enabled;
551 };
552 
556 #ifndef TABLE_RULE_ACTION_SIZE_MAX
557 #define TABLE_RULE_ACTION_SIZE_MAX 2048
558 #endif
559 
560 struct softnic_table_data {
561  struct rte_table_action *a;
562 };
563 
564 struct pipeline_data {
565  struct rte_pipeline *p;
566  struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
567  uint32_t n_tables;
568 
569  struct rte_ring *msgq_req;
570  struct rte_ring *msgq_rsp;
571  uint64_t timer_period; /* Measured in CPU cycles. */
572  uint64_t time_next;
573 
574  uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
575 };
576 
577 struct softnic_thread_data {
578  struct rte_pipeline *p[THREAD_PIPELINES_MAX];
579  uint32_t n_pipelines;
580 
581  struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
582  struct rte_ring *msgq_req;
583  struct rte_ring *msgq_rsp;
584  uint64_t timer_period; /* Measured in CPU cycles. */
585  uint64_t time_next;
586  uint64_t time_next_min;
587  uint64_t iter;
589 
595  struct pmd_params params;
596 
597  struct {
598  struct tm_internals tm;
599  } soft;
600 
601  struct flow_internals flow;
602  struct mtr_internals mtr;
603 
604  struct softnic_conn *conn;
605  struct softnic_mempool_list mempool_list;
606  struct softnic_swq_list swq_list;
607  struct softnic_link_list link_list;
608  struct softnic_tmgr_port_list tmgr_port_list;
609  struct softnic_tap_list tap_list;
610  struct softnic_cryptodev_list cryptodev_list;
611  struct softnic_port_in_action_profile_list port_in_action_profile_list;
612  struct softnic_table_action_profile_list table_action_profile_list;
613  struct pipeline_list pipeline_list;
614  struct softnic_thread thread[RTE_MAX_LCORE];
615  struct softnic_thread_data thread_data[RTE_MAX_LCORE];
616 };
617 
618 static inline struct rte_eth_dev *
619 ETHDEV(struct pmd_internals *softnic)
620 {
621  uint16_t port_id;
622  int status;
623 
624  if (softnic == NULL)
625  return NULL;
626 
627  status = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);
628  if (status)
629  return NULL;
630 
631  return &rte_eth_devices[port_id];
632 }
633 
637 int
638 flow_attr_map_set(struct pmd_internals *softnic,
639  uint32_t group_id,
640  int ingress,
641  const char *pipeline_name,
642  uint32_t table_id);
643 
644 struct flow_attr_map *
645 flow_attr_map_get(struct pmd_internals *softnic,
646  uint32_t group_id,
647  int ingress);
648 
649 extern const struct rte_flow_ops pmd_flow_ops;
650 
654 int
655 softnic_mtr_init(struct pmd_internals *p);
656 
657 void
658 softnic_mtr_free(struct pmd_internals *p);
659 
660 struct softnic_mtr *
661 softnic_mtr_find(struct pmd_internals *p,
662  uint32_t mtr_id);
663 
665 softnic_mtr_meter_profile_find(struct pmd_internals *p,
666  uint32_t meter_profile_id);
667 
668 extern const struct rte_mtr_ops pmd_mtr_ops;
669 
673 int
674 softnic_mempool_init(struct pmd_internals *p);
675 
676 void
677 softnic_mempool_free(struct pmd_internals *p);
678 
679 struct softnic_mempool *
680 softnic_mempool_find(struct pmd_internals *p,
681  const char *name);
682 
683 struct softnic_mempool *
684 softnic_mempool_create(struct pmd_internals *p,
685  const char *name,
686  struct softnic_mempool_params *params);
687 
691 int
692 softnic_swq_init(struct pmd_internals *p);
693 
694 void
695 softnic_swq_free(struct pmd_internals *p);
696 
697 void
698 softnic_softnic_swq_free_keep_rxq_txq(struct pmd_internals *p);
699 
700 struct softnic_swq *
701 softnic_swq_find(struct pmd_internals *p,
702  const char *name);
703 
704 struct softnic_swq *
705 softnic_swq_create(struct pmd_internals *p,
706  const char *name,
707  struct softnic_swq_params *params);
708 
712 int
713 softnic_link_init(struct pmd_internals *p);
714 
715 void
716 softnic_link_free(struct pmd_internals *p);
717 
718 struct softnic_link *
719 softnic_link_find(struct pmd_internals *p,
720  const char *name);
721 
722 struct softnic_link *
723 softnic_link_create(struct pmd_internals *p,
724  const char *name,
725  struct softnic_link_params *params);
726 
730 int
731 softnic_tmgr_init(struct pmd_internals *p);
732 
733 void
734 softnic_tmgr_free(struct pmd_internals *p);
735 
736 struct softnic_tmgr_port *
737 softnic_tmgr_port_find(struct pmd_internals *p,
738  const char *name);
739 
740 struct softnic_tmgr_port *
741 softnic_tmgr_port_create(struct pmd_internals *p,
742  const char *name);
743 
744 void
745 tm_hierarchy_init(struct pmd_internals *p);
746 
747 void
748 tm_hierarchy_free(struct pmd_internals *p);
749 
750 static inline int
751 tm_used(struct rte_eth_dev *dev)
752 {
753  struct pmd_internals *p = dev->data->dev_private;
754 
755  return p->soft.tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
756 }
757 
758 extern const struct rte_tm_ops pmd_tm_ops;
759 
763 int
764 softnic_tap_init(struct pmd_internals *p);
765 
766 void
767 softnic_tap_free(struct pmd_internals *p);
768 
769 struct softnic_tap *
770 softnic_tap_find(struct pmd_internals *p,
771  const char *name);
772 
773 struct softnic_tap *
774 softnic_tap_create(struct pmd_internals *p,
775  const char *name);
776 
780 int
781 softnic_cryptodev_init(struct pmd_internals *p);
782 
783 void
784 softnic_cryptodev_free(struct pmd_internals *p);
785 
786 struct softnic_cryptodev *
787 softnic_cryptodev_find(struct pmd_internals *p,
788  const char *name);
789 
790 struct softnic_cryptodev *
791 softnic_cryptodev_create(struct pmd_internals *p,
792  const char *name,
793  struct softnic_cryptodev_params *params);
794 
798 int
799 softnic_port_in_action_profile_init(struct pmd_internals *p);
800 
801 void
802 softnic_port_in_action_profile_free(struct pmd_internals *p);
803 
804 struct softnic_port_in_action_profile *
805 softnic_port_in_action_profile_find(struct pmd_internals *p,
806  const char *name);
807 
808 struct softnic_port_in_action_profile *
809 softnic_port_in_action_profile_create(struct pmd_internals *p,
810  const char *name,
812 
816 int
817 softnic_table_action_profile_init(struct pmd_internals *p);
818 
819 void
820 softnic_table_action_profile_free(struct pmd_internals *p);
821 
822 struct softnic_table_action_profile *
823 softnic_table_action_profile_find(struct pmd_internals *p,
824  const char *name);
825 
826 struct softnic_table_action_profile *
827 softnic_table_action_profile_create(struct pmd_internals *p,
828  const char *name,
829  struct softnic_table_action_profile_params *params);
830 
832 softnic_table_action_policer(enum rte_mtr_policer_action action);
833 
837 int
838 softnic_pipeline_init(struct pmd_internals *p);
839 
840 void
841 softnic_pipeline_free(struct pmd_internals *p);
842 
843 void
844 softnic_pipeline_disable_all(struct pmd_internals *p);
845 
846 struct pipeline *
847 softnic_pipeline_find(struct pmd_internals *p, const char *name);
848 
849 struct pipeline *
850 softnic_pipeline_create(struct pmd_internals *p,
851  const char *name,
852  struct pipeline_params *params);
853 
854 int
855 softnic_pipeline_port_in_create(struct pmd_internals *p,
856  const char *pipeline_name,
857  struct softnic_port_in_params *params,
858  int enabled);
859 
860 int
861 softnic_pipeline_port_in_connect_to_table(struct pmd_internals *p,
862  const char *pipeline_name,
863  uint32_t port_id,
864  uint32_t table_id);
865 
866 int
867 softnic_pipeline_port_out_create(struct pmd_internals *p,
868  const char *pipeline_name,
869  struct softnic_port_out_params *params);
870 
871 int
872 softnic_pipeline_port_out_find(struct pmd_internals *softnic,
873  const char *pipeline_name,
874  const char *name,
875  uint32_t *port_id);
876 
877 int
878 softnic_pipeline_table_create(struct pmd_internals *p,
879  const char *pipeline_name,
880  struct softnic_table_params *params);
881 
882 struct softnic_table_meter_profile *
883 softnic_pipeline_table_meter_profile_find(struct softnic_table *table,
884  uint32_t meter_profile_id);
885 
886 struct softnic_table_rule_match_acl {
887  int ip_version;
888 
890  union {
891  struct {
892  uint32_t sa;
893  uint32_t da;
894  } ipv4;
895 
896  struct {
897  uint8_t sa[16];
898  uint8_t da[16];
899  } ipv6;
900  };
901 
902  uint32_t sa_depth;
903  uint32_t da_depth;
904  uint16_t sp0;
905  uint16_t sp1;
906  uint16_t dp0;
907  uint16_t dp1;
908  uint8_t proto;
909  uint8_t proto_mask;
910  uint32_t priority;
911 };
912 
913 struct softnic_table_rule_match_array {
914  uint32_t pos;
915 };
916 
917 struct softnic_table_rule_match_hash {
918  uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
919 };
920 
921 struct softnic_table_rule_match_lpm {
922  int ip_version;
923 
925  union {
926  uint32_t ipv4;
927  uint8_t ipv6[16];
928  };
929 
930  uint8_t depth;
931 };
932 
933 struct softnic_table_rule_match {
934  enum softnic_table_type match_type;
935 
936  union {
937  struct softnic_table_rule_match_acl acl;
938  struct softnic_table_rule_match_array array;
939  struct softnic_table_rule_match_hash hash;
940  struct softnic_table_rule_match_lpm lpm;
941  } match;
942 };
943 
944 struct softnic_table_rule_action {
945  uint64_t action_mask;
946  struct rte_table_action_fwd_params fwd;
947  struct rte_table_action_lb_params lb;
949  struct rte_table_action_tm_params tm;
950  struct rte_table_action_encap_params encap;
951  struct rte_table_action_nat_params nat;
952  struct rte_table_action_ttl_params ttl;
953  struct rte_table_action_stats_params stats;
956  struct rte_table_action_decap_params decap;
957  struct rte_table_action_sym_crypto_params sym_crypto;
958 };
959 
960 struct rte_flow {
961  TAILQ_ENTRY(rte_flow) node;
962  struct softnic_table_rule_match match;
963  struct softnic_table_rule_action action;
964  void *data;
965  struct pipeline *pipeline;
966  uint32_t table_id;
967 };
968 
969 int
970 softnic_pipeline_port_in_stats_read(struct pmd_internals *p,
971  const char *pipeline_name,
972  uint32_t port_id,
973  struct rte_pipeline_port_in_stats *stats,
974  int clear);
975 
976 int
977 softnic_pipeline_port_in_enable(struct pmd_internals *p,
978  const char *pipeline_name,
979  uint32_t port_id);
980 
981 int
982 softnic_pipeline_port_in_disable(struct pmd_internals *p,
983  const char *pipeline_name,
984  uint32_t port_id);
985 
986 int
987 softnic_pipeline_port_out_stats_read(struct pmd_internals *p,
988  const char *pipeline_name,
989  uint32_t port_id,
990  struct rte_pipeline_port_out_stats *stats,
991  int clear);
992 
993 int
994 softnic_pipeline_table_stats_read(struct pmd_internals *p,
995  const char *pipeline_name,
996  uint32_t table_id,
997  struct rte_pipeline_table_stats *stats,
998  int clear);
999 
1000 int
1001 softnic_pipeline_table_rule_add(struct pmd_internals *p,
1002  const char *pipeline_name,
1003  uint32_t table_id,
1004  struct softnic_table_rule_match *match,
1005  struct softnic_table_rule_action *action,
1006  void **data);
1007 
1008 int
1009 softnic_pipeline_table_rule_add_bulk(struct pmd_internals *p,
1010  const char *pipeline_name,
1011  uint32_t table_id,
1012  struct softnic_table_rule_match *match,
1013  struct softnic_table_rule_action *action,
1014  void **data,
1015  uint32_t *n_rules);
1016 
1017 int
1018 softnic_pipeline_table_rule_add_default(struct pmd_internals *p,
1019  const char *pipeline_name,
1020  uint32_t table_id,
1021  struct softnic_table_rule_action *action,
1022  void **data);
1023 
1024 int
1025 softnic_pipeline_table_rule_delete(struct pmd_internals *p,
1026  const char *pipeline_name,
1027  uint32_t table_id,
1028  struct softnic_table_rule_match *match);
1029 
1030 int
1031 softnic_pipeline_table_rule_delete_default(struct pmd_internals *p,
1032  const char *pipeline_name,
1033  uint32_t table_id);
1034 
1035 int
1036 softnic_pipeline_table_rule_stats_read(struct pmd_internals *p,
1037  const char *pipeline_name,
1038  uint32_t table_id,
1039  void *data,
1040  struct rte_table_action_stats_counters *stats,
1041  int clear);
1042 
1043 int
1044 softnic_pipeline_table_mtr_profile_add(struct pmd_internals *p,
1045  const char *pipeline_name,
1046  uint32_t table_id,
1047  uint32_t meter_profile_id,
1048  struct rte_table_action_meter_profile *profile);
1049 
1050 int
1051 softnic_pipeline_table_mtr_profile_delete(struct pmd_internals *p,
1052  const char *pipeline_name,
1053  uint32_t table_id,
1054  uint32_t meter_profile_id);
1055 
1056 int
1057 softnic_pipeline_table_rule_mtr_read(struct pmd_internals *p,
1058  const char *pipeline_name,
1059  uint32_t table_id,
1060  void *data,
1061  uint32_t tc_mask,
1062  struct rte_table_action_mtr_counters *stats,
1063  int clear);
1064 
1065 int
1066 softnic_pipeline_table_dscp_table_update(struct pmd_internals *p,
1067  const char *pipeline_name,
1068  uint32_t table_id,
1069  uint64_t dscp_mask,
1070  struct rte_table_action_dscp_table *dscp_table);
1071 
1072 int
1073 softnic_pipeline_table_rule_ttl_read(struct pmd_internals *p,
1074  const char *pipeline_name,
1075  uint32_t table_id,
1076  void *data,
1077  struct rte_table_action_ttl_counters *stats,
1078  int clear);
1079 
1083 int
1084 softnic_thread_init(struct pmd_internals *p);
1085 
1086 void
1087 softnic_thread_free(struct pmd_internals *p);
1088 
1089 int
1090 softnic_thread_pipeline_enable(struct pmd_internals *p,
1091  uint32_t thread_id,
1092  const char *pipeline_name);
1093 
1094 int
1095 softnic_thread_pipeline_disable(struct pmd_internals *p,
1096  uint32_t thread_id,
1097  const char *pipeline_name);
1098 
1102 void
1103 softnic_cli_process(char *in,
1104  char *out,
1105  size_t out_size,
1106  void *arg);
1107 
1108 int
1109 softnic_cli_script_process(struct pmd_internals *softnic,
1110  const char *file_name,
1111  size_t msg_in_len_max,
1112  size_t msg_out_len_max);
1113 
1114 #endif /* __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__ */
rte_mtr_policer_action
Definition: rte_mtr.h:217
#define RTE_PIPELINE_TABLE_MAX
Definition: rte_pipeline.h:204
struct tm_internals tm
TAILQ_HEAD(rte_bus_list, rte_bus)
struct pmd_params::@4 tm
struct pmd_params params
rte_table_action_policer
#define RTE_SCHED_PIPE_PROFILES_PER_PORT
Definition: rte_sched.h:86
int rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
#define RTE_STD_C11
Definition: rte_common.h:37
struct rte_table_action_mtr_tc_params mtr[RTE_TABLE_ACTION_TC_MAX]
#define __rte_cache_aligned
Definition: rte_memory.h:66
#define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE
Definition: rte_sched.h:72
#define RTE_PIPELINE_PORT_IN_MAX
Definition: rte_pipeline.h:537
#define RTE_PIPELINE_PORT_OUT_MAX
Definition: rte_pipeline.h:669