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