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;
87 struct softnic_mtr_meter_policy {
88 TAILQ_ENTRY(softnic_mtr_meter_policy) node;
89 uint32_t meter_policy_id;
94 TAILQ_HEAD(softnic_mtr_meter_policy_list, softnic_mtr_meter_policy);
98 TAILQ_ENTRY(softnic_mtr) node;
101 struct rte_flow *flow;
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;
116 uint32_t buffer_size;
121 struct softnic_mempool {
122 TAILQ_ENTRY(softnic_mempool) node;
123 char name[NAME_SIZE];
125 uint32_t buffer_size;
128 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
138 TAILQ_ENTRY(softnic_swq) node;
139 char name[NAME_SIZE];
149 const char *dev_name;
153 struct softnic_link {
154 TAILQ_ENTRY(softnic_link) node;
155 char name[NAME_SIZE];
167 #ifndef TM_MAX_SUBPORTS 168 #define TM_MAX_SUBPORTS 8 171 #ifndef TM_MAX_PIPES_PER_SUBPORT 172 #define TM_MAX_PIPES_PER_SUBPORT 4096 175 #ifndef TM_MAX_PIPE_PROFILE 176 #define TM_MAX_PIPE_PROFILE 256 179 #ifndef TM_MAX_SUBPORT_PROFILE 180 #define TM_MAX_SUBPORT_PROFILE 256 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];
197 TM_NODE_LEVEL_PORT = 0,
198 TM_NODE_LEVEL_SUBPORT,
206 struct tm_shaper_profile {
207 TAILQ_ENTRY(tm_shaper_profile) node;
208 uint32_t shaper_profile_id;
213 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
216 struct tm_shared_shaper {
217 TAILQ_ENTRY(tm_shared_shaper) node;
218 uint32_t shared_shaper_id;
220 uint32_t shaper_profile_id;
223 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
226 struct tm_wred_profile {
227 TAILQ_ENTRY(tm_wred_profile) node;
228 uint32_t wred_profile_id;
233 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
237 TAILQ_ENTRY(tm_node) node;
239 uint32_t parent_node_id;
243 struct tm_node *parent_node;
244 struct tm_shaper_profile *shaper_profile;
245 struct tm_wred_profile *wred_profile;
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;
260 uint32_t n_shaper_profiles;
261 uint32_t n_shared_shapers;
262 uint32_t n_wred_profiles;
265 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
268 struct tm_internals {
276 struct tm_hierarchy h;
277 int hierarchy_frozen;
280 struct tm_params params;
283 struct softnic_tmgr_port {
284 TAILQ_ENTRY(softnic_tmgr_port) node;
285 char name[NAME_SIZE];
286 struct rte_sched_port *s;
289 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
296 char name[NAME_SIZE];
306 const char *dev_name;
310 uint32_t session_pool_size;
313 struct softnic_cryptodev {
314 TAILQ_ENTRY(softnic_cryptodev) node;
315 char name[NAME_SIZE];
322 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
328 uint64_t action_mask;
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;
340 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
346 uint64_t action_mask;
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;
365 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
367 struct softnic_table_meter_profile {
368 TAILQ_ENTRY(softnic_table_meter_profile) node;
369 uint32_t meter_profile_id;
374 softnic_table_meter_profile);
380 uint32_t timer_period_ms;
381 uint32_t offset_port_id;
384 enum softnic_port_in_type {
393 struct softnic_port_in_params {
395 enum softnic_port_in_type type;
396 char dev_name[NAME_SIZE];
403 const char *mempool_name;
408 const char *mempool_name;
409 const char *file_name;
410 uint32_t n_bytes_per_pkt;
422 char action_profile_name[NAME_SIZE];
425 enum softnic_port_out_type {
434 struct softnic_port_out_params {
435 enum softnic_port_out_type type;
436 char dev_name[NAME_SIZE];
443 const char *file_name;
457 enum softnic_table_type {
465 struct softnic_table_acl_params {
467 uint32_t ip_header_offset;
471 struct softnic_table_array_params {
476 #ifndef TABLE_RULE_MATCH_SIZE_MAX 477 #define TABLE_RULE_MATCH_SIZE_MAX 256 480 struct softnic_table_hash_params {
484 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
486 int extendable_bucket;
489 struct softnic_table_lpm_params {
495 struct softnic_table_params {
497 enum softnic_table_type match_type;
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;
506 char action_profile_name[NAME_SIZE];
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;
515 struct softnic_port_out {
516 struct softnic_port_out_params params;
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;
525 struct softnic_table_meter_profile_list meter_profiles;
529 TAILQ_ENTRY(pipeline) node;
530 char name[NAME_SIZE];
532 struct rte_pipeline *p;
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];
538 uint32_t n_ports_out;
543 uint32_t timer_period_ms;
555 #ifndef THREAD_PIPELINES_MAX 556 #define THREAD_PIPELINES_MAX 256 559 #ifndef THREAD_MSGQ_SIZE 560 #define THREAD_MSGQ_SIZE 64 563 #ifndef THREAD_TIMER_PERIOD_MS 564 #define THREAD_TIMER_PERIOD_MS 100 580 #ifndef TABLE_RULE_ACTION_SIZE_MAX 581 #define TABLE_RULE_ACTION_SIZE_MAX 2048 584 struct softnic_table_data {
585 struct rte_table_action *a;
588 struct pipeline_data {
589 struct rte_pipeline *p;
590 struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
595 uint64_t timer_period;
598 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
601 struct softnic_thread_data {
602 struct rte_pipeline *p[THREAD_PIPELINES_MAX];
603 uint32_t n_pipelines;
605 struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
608 uint64_t timer_period;
610 uint64_t time_next_min;
622 struct tm_internals
tm;
625 struct flow_internals flow;
626 struct mtr_internals mtr;
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;
639 struct softnic_thread_data thread_data[RTE_MAX_LCORE];
642 static inline struct rte_eth_dev *
655 return &rte_eth_devices[port_id];
665 const char *pipeline_name,
668 struct flow_attr_map *
690 uint32_t meter_profile_id);
692 struct softnic_mtr_meter_policy *
694 uint32_t meter_policy_id);
696 extern const struct rte_mtr_ops pmd_mtr_ops;
707 struct softnic_mempool *
711 struct softnic_mempool *
726 softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
746 struct softnic_link *
750 struct softnic_link *
764 struct softnic_tmgr_port *
768 struct softnic_tmgr_port *
779 tm_used(
struct rte_eth_dev *dev)
783 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
786 extern const struct rte_tm_ops pmd_tm_ops;
814 struct softnic_cryptodev *
818 struct softnic_cryptodev *
827 softnic_port_in_action_profile_init(
struct pmd_internals *p);
830 softnic_port_in_action_profile_free(
struct pmd_internals *p);
832 struct softnic_port_in_action_profile *
836 struct softnic_port_in_action_profile *
837 softnic_port_in_action_profile_create(
struct pmd_internals *p,
850 struct softnic_table_action_profile *
854 struct softnic_table_action_profile *
872 softnic_pipeline_thread_count(
struct pmd_internals *p, uint32_t thread_id);
875 softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
884 const char *pipeline_name,
885 struct softnic_port_in_params *params,
889 softnic_pipeline_port_in_connect_to_table(
struct pmd_internals *p,
890 const char *pipeline_name,
896 const char *pipeline_name,
897 struct softnic_port_out_params *params);
900 softnic_pipeline_port_out_find(
struct pmd_internals *softnic,
901 const char *pipeline_name,
907 const char *pipeline_name,
908 struct softnic_table_params *params);
910 struct softnic_table_meter_profile *
911 softnic_pipeline_table_meter_profile_find(
struct softnic_table *table,
912 uint32_t meter_profile_id);
914 struct softnic_table_rule_match_acl {
941 struct softnic_table_rule_match_array {
945 struct softnic_table_rule_match_hash {
946 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
949 struct softnic_table_rule_match_lpm {
961 struct softnic_table_rule_match {
962 enum softnic_table_type match_type;
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;
972 #ifndef SYM_CRYPTO_MAX_KEY_SIZE 973 #define SYM_CRYPTO_MAX_KEY_SIZE (256) 975 struct softnic_table_rule_action {
976 uint64_t action_mask;
989 uint8_t sym_crypto_key[SYM_CRYPTO_MAX_KEY_SIZE];
993 TAILQ_ENTRY(rte_flow) node;
994 struct softnic_table_rule_match match;
995 struct softnic_table_rule_action action;
997 struct pipeline *pipeline;
1002 softnic_pipeline_port_in_stats_read(
struct pmd_internals *p,
1003 const char *pipeline_name,
1010 const char *pipeline_name,
1015 const char *pipeline_name,
1019 softnic_pipeline_port_out_stats_read(
struct pmd_internals *p,
1020 const char *pipeline_name,
1027 const char *pipeline_name,
1034 const char *pipeline_name,
1036 struct softnic_table_rule_match *match,
1037 struct softnic_table_rule_action *action,
1041 softnic_pipeline_table_rule_add_bulk(
struct pmd_internals *p,
1042 const char *pipeline_name,
1044 struct softnic_table_rule_match *match,
1045 struct softnic_table_rule_action *action,
1050 softnic_pipeline_table_rule_add_default(
struct pmd_internals *p,
1051 const char *pipeline_name,
1053 struct softnic_table_rule_action *action,
1058 const char *pipeline_name,
1060 struct softnic_table_rule_match *match);
1063 softnic_pipeline_table_rule_delete_default(
struct pmd_internals *p,
1064 const char *pipeline_name,
1068 softnic_pipeline_table_rule_stats_read(
struct pmd_internals *p,
1069 const char *pipeline_name,
1076 softnic_pipeline_table_mtr_profile_add(
struct pmd_internals *p,
1077 const char *pipeline_name,
1079 uint32_t meter_profile_id,
1083 softnic_pipeline_table_mtr_profile_delete(
struct pmd_internals *p,
1084 const char *pipeline_name,
1086 uint32_t meter_profile_id);
1089 softnic_pipeline_table_rule_mtr_read(
struct pmd_internals *p,
1090 const char *pipeline_name,
1098 softnic_pipeline_table_dscp_table_update(
struct pmd_internals *p,
1099 const char *pipeline_name,
1105 softnic_pipeline_table_rule_ttl_read(
struct pmd_internals *p,
1106 const char *pipeline_name,
1124 const char *pipeline_name);
1129 const char *pipeline_name);
1135 softnic_cli_process(
char *in,
1142 const char *file_name,
1143 size_t msg_in_len_max,
1144 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)