5 #ifndef __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__ 6 #define __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__ 10 #include <sys/queue.h> 27 #include "rte_eth_softnic.h" 31 #define SOFTNIC_PATH_MAX 4096 39 char firmware[SOFTNIC_PATH_MAX];
58 struct flow_attr_map {
59 char pipeline_name[NAME_SIZE];
64 #ifndef SOFTNIC_FLOW_MAX_GROUPS 65 #define SOFTNIC_FLOW_MAX_GROUPS 64 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];
80 uint32_t meter_profile_id;
89 TAILQ_ENTRY(softnic_mtr) node;
92 struct rte_flow *flow;
97 struct mtr_internals {
98 struct softnic_mtr_meter_profile_list meter_profiles;
99 struct softnic_mtr_list mtrs;
106 uint32_t buffer_size;
111 struct softnic_mempool {
112 TAILQ_ENTRY(softnic_mempool) node;
113 char name[NAME_SIZE];
115 uint32_t buffer_size;
118 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
128 TAILQ_ENTRY(softnic_swq) node;
129 char name[NAME_SIZE];
139 const char *dev_name;
143 struct softnic_link {
144 TAILQ_ENTRY(softnic_link) node;
145 char name[NAME_SIZE];
157 #ifndef TM_MAX_SUBPORTS 158 #define TM_MAX_SUBPORTS 8 161 #ifndef TM_MAX_PIPES_PER_SUBPORT 162 #define TM_MAX_PIPES_PER_SUBPORT 4096 165 #ifndef TM_MAX_PIPE_PROFILE 166 #define TM_MAX_PIPE_PROFILE 256 169 #ifndef TM_MAX_SUBPORT_PROFILE 170 #define TM_MAX_SUBPORT_PROFILE 256 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];
187 TM_NODE_LEVEL_PORT = 0,
188 TM_NODE_LEVEL_SUBPORT,
196 struct tm_shaper_profile {
197 TAILQ_ENTRY(tm_shaper_profile) node;
198 uint32_t shaper_profile_id;
203 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
206 struct tm_shared_shaper {
207 TAILQ_ENTRY(tm_shared_shaper) node;
208 uint32_t shared_shaper_id;
210 uint32_t shaper_profile_id;
213 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
216 struct tm_wred_profile {
217 TAILQ_ENTRY(tm_wred_profile) node;
218 uint32_t wred_profile_id;
223 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
227 TAILQ_ENTRY(tm_node) node;
229 uint32_t parent_node_id;
233 struct tm_node *parent_node;
234 struct tm_shaper_profile *shaper_profile;
235 struct tm_wred_profile *wred_profile;
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;
250 uint32_t n_shaper_profiles;
251 uint32_t n_shared_shapers;
252 uint32_t n_wred_profiles;
255 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
258 struct tm_internals {
266 struct tm_hierarchy h;
267 int hierarchy_frozen;
270 struct tm_params params;
273 struct softnic_tmgr_port {
274 TAILQ_ENTRY(softnic_tmgr_port) node;
275 char name[NAME_SIZE];
276 struct rte_sched_port *s;
279 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
286 char name[NAME_SIZE];
296 const char *dev_name;
300 uint32_t session_pool_size;
303 struct softnic_cryptodev {
304 TAILQ_ENTRY(softnic_cryptodev) node;
305 char name[NAME_SIZE];
312 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
318 uint64_t action_mask;
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;
330 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
336 uint64_t action_mask;
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;
355 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
357 struct softnic_table_meter_profile {
358 TAILQ_ENTRY(softnic_table_meter_profile) node;
359 uint32_t meter_profile_id;
364 softnic_table_meter_profile);
370 uint32_t timer_period_ms;
371 uint32_t offset_port_id;
374 enum softnic_port_in_type {
383 struct softnic_port_in_params {
385 enum softnic_port_in_type type;
386 char dev_name[NAME_SIZE];
393 const char *mempool_name;
398 const char *mempool_name;
399 const char *file_name;
400 uint32_t n_bytes_per_pkt;
412 char action_profile_name[NAME_SIZE];
415 enum softnic_port_out_type {
424 struct softnic_port_out_params {
425 enum softnic_port_out_type type;
426 char dev_name[NAME_SIZE];
433 const char *file_name;
447 enum softnic_table_type {
455 struct softnic_table_acl_params {
457 uint32_t ip_header_offset;
461 struct softnic_table_array_params {
466 #ifndef TABLE_RULE_MATCH_SIZE_MAX 467 #define TABLE_RULE_MATCH_SIZE_MAX 256 470 struct softnic_table_hash_params {
474 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
476 int extendable_bucket;
479 struct softnic_table_lpm_params {
485 struct softnic_table_params {
487 enum softnic_table_type match_type;
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;
496 char action_profile_name[NAME_SIZE];
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;
505 struct softnic_port_out {
506 struct softnic_port_out_params params;
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;
515 struct softnic_table_meter_profile_list meter_profiles;
519 TAILQ_ENTRY(pipeline) node;
520 char name[NAME_SIZE];
522 struct rte_pipeline *p;
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];
528 uint32_t n_ports_out;
533 uint32_t timer_period_ms;
545 #ifndef THREAD_PIPELINES_MAX 546 #define THREAD_PIPELINES_MAX 256 549 #ifndef THREAD_MSGQ_SIZE 550 #define THREAD_MSGQ_SIZE 64 553 #ifndef THREAD_TIMER_PERIOD_MS 554 #define THREAD_TIMER_PERIOD_MS 100 570 #ifndef TABLE_RULE_ACTION_SIZE_MAX 571 #define TABLE_RULE_ACTION_SIZE_MAX 2048 574 struct softnic_table_data {
575 struct rte_table_action *a;
578 struct pipeline_data {
579 struct rte_pipeline *p;
580 struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
585 uint64_t timer_period;
588 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
591 struct softnic_thread_data {
592 struct rte_pipeline *p[THREAD_PIPELINES_MAX];
593 uint32_t n_pipelines;
595 struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
598 uint64_t timer_period;
600 uint64_t time_next_min;
612 struct tm_internals
tm;
615 struct flow_internals flow;
616 struct mtr_internals mtr;
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;
629 struct softnic_thread_data thread_data[RTE_MAX_LCORE];
632 static inline struct rte_eth_dev *
645 return &rte_eth_devices[port_id];
655 const char *pipeline_name,
658 struct flow_attr_map *
680 uint32_t meter_profile_id);
682 extern const struct rte_mtr_ops pmd_mtr_ops;
693 struct softnic_mempool *
697 struct softnic_mempool *
712 softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
732 struct softnic_link *
736 struct softnic_link *
750 struct softnic_tmgr_port *
754 struct softnic_tmgr_port *
765 tm_used(
struct rte_eth_dev *dev)
769 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
772 extern const struct rte_tm_ops pmd_tm_ops;
800 struct softnic_cryptodev *
804 struct softnic_cryptodev *
813 softnic_port_in_action_profile_init(
struct pmd_internals *p);
816 softnic_port_in_action_profile_free(
struct pmd_internals *p);
818 struct softnic_port_in_action_profile *
822 struct softnic_port_in_action_profile *
823 softnic_port_in_action_profile_create(
struct pmd_internals *p,
836 struct softnic_table_action_profile *
840 struct softnic_table_action_profile *
861 softnic_pipeline_thread_count(
struct pmd_internals *p, uint32_t thread_id);
864 softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
873 const char *pipeline_name,
874 struct softnic_port_in_params *params,
878 softnic_pipeline_port_in_connect_to_table(
struct pmd_internals *p,
879 const char *pipeline_name,
885 const char *pipeline_name,
886 struct softnic_port_out_params *params);
889 softnic_pipeline_port_out_find(
struct pmd_internals *softnic,
890 const char *pipeline_name,
896 const char *pipeline_name,
897 struct softnic_table_params *params);
899 struct softnic_table_meter_profile *
900 softnic_pipeline_table_meter_profile_find(
struct softnic_table *table,
901 uint32_t meter_profile_id);
903 struct softnic_table_rule_match_acl {
930 struct softnic_table_rule_match_array {
934 struct softnic_table_rule_match_hash {
935 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
938 struct softnic_table_rule_match_lpm {
950 struct softnic_table_rule_match {
951 enum softnic_table_type match_type;
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;
961 #ifndef SYM_CRYPTO_MAX_KEY_SIZE 962 #define SYM_CRYPTO_MAX_KEY_SIZE (256) 964 struct softnic_table_rule_action {
965 uint64_t action_mask;
978 uint8_t sym_crypto_key[SYM_CRYPTO_MAX_KEY_SIZE];
982 TAILQ_ENTRY(rte_flow) node;
983 struct softnic_table_rule_match match;
984 struct softnic_table_rule_action action;
986 struct pipeline *pipeline;
992 const char *pipeline_name,
999 const char *pipeline_name,
1004 const char *pipeline_name,
1008 softnic_pipeline_port_out_stats_read(
struct pmd_internals *p,
1009 const char *pipeline_name,
1016 const char *pipeline_name,
1023 const char *pipeline_name,
1025 struct softnic_table_rule_match *match,
1026 struct softnic_table_rule_action *action,
1030 softnic_pipeline_table_rule_add_bulk(
struct pmd_internals *p,
1031 const char *pipeline_name,
1033 struct softnic_table_rule_match *match,
1034 struct softnic_table_rule_action *action,
1039 softnic_pipeline_table_rule_add_default(
struct pmd_internals *p,
1040 const char *pipeline_name,
1042 struct softnic_table_rule_action *action,
1047 const char *pipeline_name,
1049 struct softnic_table_rule_match *match);
1052 softnic_pipeline_table_rule_delete_default(
struct pmd_internals *p,
1053 const char *pipeline_name,
1057 softnic_pipeline_table_rule_stats_read(
struct pmd_internals *p,
1058 const char *pipeline_name,
1065 softnic_pipeline_table_mtr_profile_add(
struct pmd_internals *p,
1066 const char *pipeline_name,
1068 uint32_t meter_profile_id,
1072 softnic_pipeline_table_mtr_profile_delete(
struct pmd_internals *p,
1073 const char *pipeline_name,
1075 uint32_t meter_profile_id);
1078 softnic_pipeline_table_rule_mtr_read(
struct pmd_internals *p,
1079 const char *pipeline_name,
1087 softnic_pipeline_table_dscp_table_update(
struct pmd_internals *p,
1088 const char *pipeline_name,
1094 softnic_pipeline_table_rule_ttl_read(
struct pmd_internals *p,
1095 const char *pipeline_name,
1113 const char *pipeline_name);
1118 const char *pipeline_name);
1124 softnic_cli_process(
char *in,
1131 const char *file_name,
1132 size_t msg_in_len_max,
1133 size_t msg_out_len_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)