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