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