5 #ifndef __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
6 #define __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
10 #include <sys/queue.h>
22 #include <ethdev_driver.h>
27 #include "rte_eth_softnic.h"
57 struct flow_attr_map {
58 char pipeline_name[NAME_SIZE];
63 #ifndef SOFTNIC_FLOW_MAX_GROUPS
64 #define SOFTNIC_FLOW_MAX_GROUPS 64
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];
79 uint32_t meter_profile_id;
88 TAILQ_ENTRY(softnic_mtr) node;
91 struct rte_flow *flow;
96 struct mtr_internals {
97 struct softnic_mtr_meter_profile_list meter_profiles;
98 struct softnic_mtr_list mtrs;
105 uint32_t buffer_size;
110 struct softnic_mempool {
111 TAILQ_ENTRY(softnic_mempool) node;
112 char name[NAME_SIZE];
114 uint32_t buffer_size;
117 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
127 TAILQ_ENTRY(softnic_swq) node;
128 char name[NAME_SIZE];
138 const char *dev_name;
142 struct softnic_link {
143 TAILQ_ENTRY(softnic_link) node;
144 char name[NAME_SIZE];
156 #ifndef TM_MAX_SUBPORTS
157 #define TM_MAX_SUBPORTS 8
160 #ifndef TM_MAX_PIPES_PER_SUBPORT
161 #define TM_MAX_PIPES_PER_SUBPORT 4096
164 #ifndef TM_MAX_PIPE_PROFILE
165 #define TM_MAX_PIPE_PROFILE 256
168 #ifndef TM_MAX_SUBPORT_PROFILE
169 #define TM_MAX_SUBPORT_PROFILE 256
174 struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
175 struct rte_sched_subport_profile_params
176 subport_profile[TM_MAX_SUBPORT_PROFILE];
177 uint32_t n_subport_profiles;
178 uint32_t subport_to_profile[TM_MAX_SUBPORT_PROFILE];
179 struct rte_sched_pipe_params pipe_profiles[TM_MAX_PIPE_PROFILE];
180 uint32_t n_pipe_profiles;
181 uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
186 TM_NODE_LEVEL_PORT = 0,
187 TM_NODE_LEVEL_SUBPORT,
195 struct tm_shaper_profile {
196 TAILQ_ENTRY(tm_shaper_profile) node;
197 uint32_t shaper_profile_id;
202 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
205 struct tm_shared_shaper {
206 TAILQ_ENTRY(tm_shared_shaper) node;
207 uint32_t shared_shaper_id;
209 uint32_t shaper_profile_id;
212 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
215 struct tm_wred_profile {
216 TAILQ_ENTRY(tm_wred_profile) node;
217 uint32_t wred_profile_id;
222 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
226 TAILQ_ENTRY(tm_node) node;
228 uint32_t parent_node_id;
232 struct tm_node *parent_node;
233 struct tm_shaper_profile *shaper_profile;
234 struct tm_wred_profile *wred_profile;
243 struct tm_hierarchy {
244 struct tm_shaper_profile_list shaper_profiles;
245 struct tm_shared_shaper_list shared_shapers;
246 struct tm_wred_profile_list wred_profiles;
247 struct tm_node_list nodes;
249 uint32_t n_shaper_profiles;
250 uint32_t n_shared_shapers;
251 uint32_t n_wred_profiles;
254 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
257 struct tm_internals {
265 struct tm_hierarchy h;
266 int hierarchy_frozen;
269 struct tm_params params;
272 struct softnic_tmgr_port {
273 TAILQ_ENTRY(softnic_tmgr_port) node;
274 char name[NAME_SIZE];
275 struct rte_sched_port *s;
278 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
284 TAILQ_ENTRY(softnic_tap) node;
285 char name[NAME_SIZE];
295 const char *dev_name;
299 uint32_t session_pool_size;
302 struct softnic_cryptodev {
303 TAILQ_ENTRY(softnic_cryptodev) node;
304 char name[NAME_SIZE];
311 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
317 uint64_t action_mask;
322 struct softnic_port_in_action_profile {
323 TAILQ_ENTRY(softnic_port_in_action_profile) node;
324 char name[NAME_SIZE];
326 struct rte_port_in_action_profile *ap;
329 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
335 uint64_t action_mask;
347 struct softnic_table_action_profile {
348 TAILQ_ENTRY(softnic_table_action_profile) node;
349 char name[NAME_SIZE];
351 struct rte_table_action_profile *ap;
354 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
356 struct softnic_table_meter_profile {
357 TAILQ_ENTRY(softnic_table_meter_profile) node;
358 uint32_t meter_profile_id;
363 softnic_table_meter_profile);
369 uint32_t timer_period_ms;
370 uint32_t offset_port_id;
373 enum softnic_port_in_type {
382 struct softnic_port_in_params {
384 enum softnic_port_in_type type;
385 char dev_name[NAME_SIZE];
392 const char *mempool_name;
397 const char *mempool_name;
398 const char *file_name;
399 uint32_t n_bytes_per_pkt;
411 char action_profile_name[NAME_SIZE];
414 enum softnic_port_out_type {
423 struct softnic_port_out_params {
424 enum softnic_port_out_type type;
425 char dev_name[NAME_SIZE];
432 const char *file_name;
446 enum softnic_table_type {
454 struct softnic_table_acl_params {
456 uint32_t ip_header_offset;
460 struct softnic_table_array_params {
465 #ifndef TABLE_RULE_MATCH_SIZE_MAX
466 #define TABLE_RULE_MATCH_SIZE_MAX 256
469 struct softnic_table_hash_params {
473 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
475 int extendable_bucket;
478 struct softnic_table_lpm_params {
484 struct softnic_table_params {
486 enum softnic_table_type match_type;
488 struct softnic_table_acl_params acl;
489 struct softnic_table_array_params array;
490 struct softnic_table_hash_params hash;
491 struct softnic_table_lpm_params lpm;
495 char action_profile_name[NAME_SIZE];
498 struct softnic_port_in {
499 struct softnic_port_in_params params;
500 struct softnic_port_in_action_profile *ap;
501 struct rte_port_in_action *a;
504 struct softnic_port_out {
505 struct softnic_port_out_params params;
508 struct softnic_table {
509 struct softnic_table_params params;
510 struct softnic_table_action_profile *ap;
511 struct rte_table_action *a;
512 struct flow_list flows;
514 struct softnic_table_meter_profile_list meter_profiles;
518 TAILQ_ENTRY(pipeline) node;
519 char name[NAME_SIZE];
521 struct rte_pipeline *p;
527 uint32_t n_ports_out;
532 uint32_t timer_period_ms;
544 #ifndef THREAD_PIPELINES_MAX
545 #define THREAD_PIPELINES_MAX 256
548 #ifndef THREAD_MSGQ_SIZE
549 #define THREAD_MSGQ_SIZE 64
552 #ifndef THREAD_TIMER_PERIOD_MS
553 #define THREAD_TIMER_PERIOD_MS 100
569 #ifndef TABLE_RULE_ACTION_SIZE_MAX
570 #define TABLE_RULE_ACTION_SIZE_MAX 2048
573 struct softnic_table_data {
574 struct rte_table_action *a;
577 struct pipeline_data {
578 struct rte_pipeline *p;
579 struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
584 uint64_t timer_period;
587 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
590 struct softnic_thread_data {
591 struct rte_pipeline *p[THREAD_PIPELINES_MAX];
592 uint32_t n_pipelines;
594 struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
597 uint64_t timer_period;
599 uint64_t time_next_min;
611 struct tm_internals tm;
614 struct flow_internals flow;
615 struct mtr_internals mtr;
617 struct softnic_conn *conn;
618 struct softnic_mempool_list mempool_list;
619 struct softnic_swq_list swq_list;
620 struct softnic_link_list link_list;
621 struct softnic_tmgr_port_list tmgr_port_list;
622 struct softnic_tap_list tap_list;
623 struct softnic_cryptodev_list cryptodev_list;
624 struct softnic_port_in_action_profile_list port_in_action_profile_list;
625 struct softnic_table_action_profile_list table_action_profile_list;
626 struct pipeline_list pipeline_list;
628 struct softnic_thread_data thread_data[RTE_MAX_LCORE];
631 static inline struct rte_eth_dev *
644 return &rte_eth_devices[port_id];
654 const char *pipeline_name,
657 struct flow_attr_map *
679 uint32_t meter_profile_id);
681 extern const struct rte_mtr_ops pmd_mtr_ops;
692 struct softnic_mempool *
696 struct softnic_mempool *
711 softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
731 struct softnic_link *
735 struct softnic_link *
749 struct softnic_tmgr_port *
753 struct softnic_tmgr_port *
764 tm_used(
struct rte_eth_dev *dev)
768 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
771 extern const struct rte_tm_ops pmd_tm_ops;
799 struct softnic_cryptodev *
803 struct softnic_cryptodev *
812 softnic_port_in_action_profile_init(
struct pmd_internals *p);
815 softnic_port_in_action_profile_free(
struct pmd_internals *p);
817 struct softnic_port_in_action_profile *
821 struct softnic_port_in_action_profile *
822 softnic_port_in_action_profile_create(
struct pmd_internals *p,
835 struct softnic_table_action_profile *
839 struct softnic_table_action_profile *
860 softnic_pipeline_thread_count(
struct pmd_internals *p, uint32_t thread_id);
863 softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
872 const char *pipeline_name,
873 struct softnic_port_in_params *params,
877 softnic_pipeline_port_in_connect_to_table(
struct pmd_internals *p,
878 const char *pipeline_name,
884 const char *pipeline_name,
885 struct softnic_port_out_params *params);
888 softnic_pipeline_port_out_find(
struct pmd_internals *softnic,
889 const char *pipeline_name,
895 const char *pipeline_name,
896 struct softnic_table_params *params);
898 struct softnic_table_meter_profile *
899 softnic_pipeline_table_meter_profile_find(
struct softnic_table *table,
900 uint32_t meter_profile_id);
902 struct softnic_table_rule_match_acl {
929 struct softnic_table_rule_match_array {
933 struct softnic_table_rule_match_hash {
934 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
937 struct softnic_table_rule_match_lpm {
949 struct softnic_table_rule_match {
950 enum softnic_table_type match_type;
953 struct softnic_table_rule_match_acl acl;
954 struct softnic_table_rule_match_array array;
955 struct softnic_table_rule_match_hash hash;
956 struct softnic_table_rule_match_lpm lpm;
960 #ifndef SYM_CRYPTO_MAX_KEY_SIZE
961 #define SYM_CRYPTO_MAX_KEY_SIZE (256)
963 struct softnic_table_rule_action {
964 uint64_t action_mask;
977 uint8_t sym_crypto_key[SYM_CRYPTO_MAX_KEY_SIZE];
981 TAILQ_ENTRY(rte_flow) node;
982 struct softnic_table_rule_match match;
983 struct softnic_table_rule_action action;
985 struct pipeline *pipeline;
991 const
char *pipeline_name,
998 const
char *pipeline_name,
1003 const
char *pipeline_name,
1007 softnic_pipeline_port_out_stats_read(struct
pmd_internals *p,
1008 const
char *pipeline_name,
1015 const
char *pipeline_name,
1022 const
char *pipeline_name,
1024 struct softnic_table_rule_match *match,
1025 struct softnic_table_rule_action *action,
1029 softnic_pipeline_table_rule_add_bulk(struct
pmd_internals *p,
1030 const
char *pipeline_name,
1032 struct softnic_table_rule_match *match,
1033 struct softnic_table_rule_action *action,
1038 softnic_pipeline_table_rule_add_default(struct
pmd_internals *p,
1039 const
char *pipeline_name,
1041 struct softnic_table_rule_action *action,
1046 const
char *pipeline_name,
1048 struct softnic_table_rule_match *match);
1051 softnic_pipeline_table_rule_delete_default(struct
pmd_internals *p,
1052 const
char *pipeline_name,
1056 softnic_pipeline_table_rule_stats_read(struct
pmd_internals *p,
1057 const
char *pipeline_name,
1064 softnic_pipeline_table_mtr_profile_add(struct
pmd_internals *p,
1065 const
char *pipeline_name,
1067 uint32_t meter_profile_id,
1071 softnic_pipeline_table_mtr_profile_delete(struct
pmd_internals *p,
1072 const
char *pipeline_name,
1074 uint32_t meter_profile_id);
1077 softnic_pipeline_table_rule_mtr_read(struct
pmd_internals *p,
1078 const
char *pipeline_name,
1086 softnic_pipeline_table_dscp_table_update(struct
pmd_internals *p,
1087 const
char *pipeline_name,
1093 softnic_pipeline_table_rule_ttl_read(struct
pmd_internals *p,
1094 const
char *pipeline_name,
1112 const
char *pipeline_name);
1117 const
char *pipeline_name);
1123 softnic_cli_process(
char *in,
1130 const
char *file_name,
1131 size_t msg_in_len_max,
1132 size_t msg_out_len_max);
#define RTE_PIPELINE_TABLE_MAX
struct pmd_params::@15 tm
int rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
#define __rte_cache_aligned
struct rte_table_action_mtr_tc_params mtr[RTE_TABLE_ACTION_TC_MAX]
#define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver)
#define RTE_PIPELINE_PORT_IN_MAX
#define RTE_PIPELINE_PORT_OUT_MAX