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" 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;
88 struct softnic_mtr_meter_policy {
89 TAILQ_ENTRY(softnic_mtr_meter_policy) node;
90 uint32_t meter_policy_id;
95 TAILQ_HEAD(softnic_mtr_meter_policy_list, softnic_mtr_meter_policy);
99 TAILQ_ENTRY(softnic_mtr) node;
102 struct rte_flow *flow;
107 struct mtr_internals {
108 struct softnic_mtr_meter_profile_list meter_profiles;
109 struct softnic_mtr_meter_policy_list meter_policies;
110 struct softnic_mtr_list mtrs;
117 uint32_t buffer_size;
122 struct softnic_mempool {
123 TAILQ_ENTRY(softnic_mempool) node;
124 char name[NAME_SIZE];
126 uint32_t buffer_size;
129 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
139 TAILQ_ENTRY(softnic_swq) node;
140 char name[NAME_SIZE];
150 const char *dev_name;
154 struct softnic_link {
155 TAILQ_ENTRY(softnic_link) node;
156 char name[NAME_SIZE];
168 #ifndef TM_MAX_SUBPORTS 169 #define TM_MAX_SUBPORTS 8 172 #ifndef TM_MAX_PIPES_PER_SUBPORT 173 #define TM_MAX_PIPES_PER_SUBPORT 4096 176 #ifndef TM_MAX_PIPE_PROFILE 177 #define TM_MAX_PIPE_PROFILE 256 180 #ifndef TM_MAX_SUBPORT_PROFILE 181 #define TM_MAX_SUBPORT_PROFILE 256 186 struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
187 struct rte_sched_subport_profile_params
188 subport_profile[TM_MAX_SUBPORT_PROFILE];
189 uint32_t n_subport_profiles;
190 uint32_t subport_to_profile[TM_MAX_SUBPORT_PROFILE];
191 struct rte_sched_pipe_params pipe_profiles[TM_MAX_PIPE_PROFILE];
192 uint32_t n_pipe_profiles;
193 uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
198 TM_NODE_LEVEL_PORT = 0,
199 TM_NODE_LEVEL_SUBPORT,
207 struct tm_shaper_profile {
208 TAILQ_ENTRY(tm_shaper_profile) node;
209 uint32_t shaper_profile_id;
214 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
217 struct tm_shared_shaper {
218 TAILQ_ENTRY(tm_shared_shaper) node;
219 uint32_t shared_shaper_id;
221 uint32_t shaper_profile_id;
224 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
227 struct tm_wred_profile {
228 TAILQ_ENTRY(tm_wred_profile) node;
229 uint32_t wred_profile_id;
234 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
238 TAILQ_ENTRY(tm_node) node;
240 uint32_t parent_node_id;
244 struct tm_node *parent_node;
245 struct tm_shaper_profile *shaper_profile;
246 struct tm_wred_profile *wred_profile;
255 struct tm_hierarchy {
256 struct tm_shaper_profile_list shaper_profiles;
257 struct tm_shared_shaper_list shared_shapers;
258 struct tm_wred_profile_list wred_profiles;
259 struct tm_node_list nodes;
261 uint32_t n_shaper_profiles;
262 uint32_t n_shared_shapers;
263 uint32_t n_wred_profiles;
266 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
269 struct tm_internals {
277 struct tm_hierarchy h;
278 int hierarchy_frozen;
281 struct tm_params params;
284 struct softnic_tmgr_port {
285 TAILQ_ENTRY(softnic_tmgr_port) node;
286 char name[NAME_SIZE];
287 struct rte_sched_port *s;
290 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
297 char name[NAME_SIZE];
307 const char *dev_name;
311 uint32_t session_pool_size;
314 struct softnic_cryptodev {
315 TAILQ_ENTRY(softnic_cryptodev) node;
316 char name[NAME_SIZE];
323 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
329 uint64_t action_mask;
334 struct softnic_port_in_action_profile {
335 TAILQ_ENTRY(softnic_port_in_action_profile) node;
336 char name[NAME_SIZE];
338 struct rte_port_in_action_profile *ap;
341 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
347 uint64_t action_mask;
359 struct softnic_table_action_profile {
360 TAILQ_ENTRY(softnic_table_action_profile) node;
361 char name[NAME_SIZE];
363 struct rte_table_action_profile *ap;
366 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
368 struct softnic_table_meter_profile {
369 TAILQ_ENTRY(softnic_table_meter_profile) node;
370 uint32_t meter_profile_id;
375 softnic_table_meter_profile);
381 uint32_t timer_period_ms;
382 uint32_t offset_port_id;
385 enum softnic_port_in_type {
394 struct softnic_port_in_params {
396 enum softnic_port_in_type type;
397 char dev_name[NAME_SIZE];
404 const char *mempool_name;
409 const char *mempool_name;
410 const char *file_name;
411 uint32_t n_bytes_per_pkt;
423 char action_profile_name[NAME_SIZE];
426 enum softnic_port_out_type {
435 struct softnic_port_out_params {
436 enum softnic_port_out_type type;
437 char dev_name[NAME_SIZE];
444 const char *file_name;
458 enum softnic_table_type {
466 struct softnic_table_acl_params {
468 uint32_t ip_header_offset;
472 struct softnic_table_array_params {
477 #ifndef TABLE_RULE_MATCH_SIZE_MAX 478 #define TABLE_RULE_MATCH_SIZE_MAX 256 481 struct softnic_table_hash_params {
485 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
487 int extendable_bucket;
490 struct softnic_table_lpm_params {
496 struct softnic_table_params {
498 enum softnic_table_type match_type;
500 struct softnic_table_acl_params acl;
501 struct softnic_table_array_params array;
502 struct softnic_table_hash_params hash;
503 struct softnic_table_lpm_params lpm;
507 char action_profile_name[NAME_SIZE];
510 struct softnic_port_in {
511 struct softnic_port_in_params params;
512 struct softnic_port_in_action_profile *ap;
513 struct rte_port_in_action *a;
516 struct softnic_port_out {
517 struct softnic_port_out_params params;
520 struct softnic_table {
521 struct softnic_table_params params;
522 struct softnic_table_action_profile *ap;
523 struct rte_table_action *a;
524 struct flow_list flows;
526 struct softnic_table_meter_profile_list meter_profiles;
530 TAILQ_ENTRY(pipeline) node;
531 char name[NAME_SIZE];
533 struct rte_pipeline *p;
535 struct softnic_port_in port_in[RTE_PIPELINE_PORT_IN_MAX];
536 struct softnic_port_out port_out[RTE_PIPELINE_PORT_OUT_MAX];
537 struct softnic_table table[RTE_PIPELINE_TABLE_MAX];
539 uint32_t n_ports_out;
544 uint32_t timer_period_ms;
556 #ifndef THREAD_PIPELINES_MAX 557 #define THREAD_PIPELINES_MAX 256 560 #ifndef THREAD_MSGQ_SIZE 561 #define THREAD_MSGQ_SIZE 64 564 #ifndef THREAD_TIMER_PERIOD_MS 565 #define THREAD_TIMER_PERIOD_MS 100 581 #ifndef TABLE_RULE_ACTION_SIZE_MAX 582 #define TABLE_RULE_ACTION_SIZE_MAX 2048 585 struct softnic_table_data {
586 struct rte_table_action *a;
589 struct pipeline_data {
590 struct rte_pipeline *p;
591 struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
596 uint64_t timer_period;
599 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
602 struct softnic_thread_data {
603 struct rte_pipeline *p[THREAD_PIPELINES_MAX];
604 uint32_t n_pipelines;
606 struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
609 uint64_t timer_period;
611 uint64_t time_next_min;
623 struct tm_internals
tm;
626 struct flow_internals flow;
627 struct mtr_internals mtr;
629 struct softnic_conn *conn;
630 struct softnic_mempool_list mempool_list;
631 struct softnic_swq_list swq_list;
632 struct softnic_link_list link_list;
633 struct softnic_tmgr_port_list tmgr_port_list;
634 struct softnic_tap_list tap_list;
635 struct softnic_cryptodev_list cryptodev_list;
636 struct softnic_port_in_action_profile_list port_in_action_profile_list;
637 struct softnic_table_action_profile_list table_action_profile_list;
638 struct pipeline_list pipeline_list;
640 struct softnic_thread_data thread_data[RTE_MAX_LCORE];
643 static inline struct rte_eth_dev *
656 return &rte_eth_devices[port_id];
666 const char *pipeline_name,
669 struct flow_attr_map *
691 uint32_t meter_profile_id);
693 struct softnic_mtr_meter_policy *
695 uint32_t meter_policy_id);
697 extern const struct rte_mtr_ops pmd_mtr_ops;
708 struct softnic_mempool *
712 struct softnic_mempool *
727 softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
747 struct softnic_link *
751 struct softnic_link *
765 struct softnic_tmgr_port *
769 struct softnic_tmgr_port *
780 tm_used(
struct rte_eth_dev *dev)
784 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
787 extern const struct rte_tm_ops pmd_tm_ops;
815 struct softnic_cryptodev *
819 struct softnic_cryptodev *
828 softnic_port_in_action_profile_init(
struct pmd_internals *p);
831 softnic_port_in_action_profile_free(
struct pmd_internals *p);
833 struct softnic_port_in_action_profile *
837 struct softnic_port_in_action_profile *
838 softnic_port_in_action_profile_create(
struct pmd_internals *p,
851 struct softnic_table_action_profile *
855 struct softnic_table_action_profile *
873 softnic_pipeline_thread_count(
struct pmd_internals *p, uint32_t thread_id);
876 softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
885 const char *pipeline_name,
886 struct softnic_port_in_params *params,
890 softnic_pipeline_port_in_connect_to_table(
struct pmd_internals *p,
891 const char *pipeline_name,
897 const char *pipeline_name,
898 struct softnic_port_out_params *params);
901 softnic_pipeline_port_out_find(
struct pmd_internals *softnic,
902 const char *pipeline_name,
908 const char *pipeline_name,
909 struct softnic_table_params *params);
911 struct softnic_table_meter_profile *
912 softnic_pipeline_table_meter_profile_find(
struct softnic_table *table,
913 uint32_t meter_profile_id);
915 struct softnic_table_rule_match_acl {
942 struct softnic_table_rule_match_array {
946 struct softnic_table_rule_match_hash {
947 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
950 struct softnic_table_rule_match_lpm {
962 struct softnic_table_rule_match {
963 enum softnic_table_type match_type;
966 struct softnic_table_rule_match_acl acl;
967 struct softnic_table_rule_match_array array;
968 struct softnic_table_rule_match_hash hash;
969 struct softnic_table_rule_match_lpm lpm;
973 #ifndef SYM_CRYPTO_MAX_KEY_SIZE 974 #define SYM_CRYPTO_MAX_KEY_SIZE (256) 976 struct softnic_table_rule_action {
977 uint64_t action_mask;
990 uint8_t sym_crypto_key[SYM_CRYPTO_MAX_KEY_SIZE];
994 TAILQ_ENTRY(rte_flow) node;
995 struct softnic_table_rule_match match;
996 struct softnic_table_rule_action action;
998 struct pipeline *pipeline;
1003 softnic_pipeline_port_in_stats_read(
struct pmd_internals *p,
1004 const char *pipeline_name,
1011 const char *pipeline_name,
1016 const char *pipeline_name,
1020 softnic_pipeline_port_out_stats_read(
struct pmd_internals *p,
1021 const char *pipeline_name,
1028 const char *pipeline_name,
1035 const char *pipeline_name,
1037 struct softnic_table_rule_match *match,
1038 struct softnic_table_rule_action *action,
1042 softnic_pipeline_table_rule_add_bulk(
struct pmd_internals *p,
1043 const char *pipeline_name,
1045 struct softnic_table_rule_match *match,
1046 struct softnic_table_rule_action *action,
1051 softnic_pipeline_table_rule_add_default(
struct pmd_internals *p,
1052 const char *pipeline_name,
1054 struct softnic_table_rule_action *action,
1059 const char *pipeline_name,
1061 struct softnic_table_rule_match *match);
1064 softnic_pipeline_table_rule_delete_default(
struct pmd_internals *p,
1065 const char *pipeline_name,
1069 softnic_pipeline_table_rule_stats_read(
struct pmd_internals *p,
1070 const char *pipeline_name,
1077 softnic_pipeline_table_mtr_profile_add(
struct pmd_internals *p,
1078 const char *pipeline_name,
1080 uint32_t meter_profile_id,
1084 softnic_pipeline_table_mtr_profile_delete(
struct pmd_internals *p,
1085 const char *pipeline_name,
1087 uint32_t meter_profile_id);
1090 softnic_pipeline_table_rule_mtr_read(
struct pmd_internals *p,
1091 const char *pipeline_name,
1099 softnic_pipeline_table_dscp_table_update(
struct pmd_internals *p,
1100 const char *pipeline_name,
1106 softnic_pipeline_table_rule_ttl_read(
struct pmd_internals *p,
1107 const char *pipeline_name,
1125 const char *pipeline_name);
1130 const char *pipeline_name);
1136 softnic_cli_process(
char *in,
1143 const char *file_name,
1144 size_t msg_in_len_max,
1145 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)