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" 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 170 struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
172 struct rte_sched_pipe_params pipe_profiles[TM_MAX_PIPE_PROFILE];
173 uint32_t n_pipe_profiles;
174 uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
179 TM_NODE_LEVEL_PORT = 0,
180 TM_NODE_LEVEL_SUBPORT,
188 struct tm_shaper_profile {
189 TAILQ_ENTRY(tm_shaper_profile) node;
190 uint32_t shaper_profile_id;
195 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
198 struct tm_shared_shaper {
199 TAILQ_ENTRY(tm_shared_shaper) node;
200 uint32_t shared_shaper_id;
202 uint32_t shaper_profile_id;
205 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
208 struct tm_wred_profile {
209 TAILQ_ENTRY(tm_wred_profile) node;
210 uint32_t wred_profile_id;
215 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
219 TAILQ_ENTRY(tm_node) node;
221 uint32_t parent_node_id;
225 struct tm_node *parent_node;
226 struct tm_shaper_profile *shaper_profile;
227 struct tm_wred_profile *wred_profile;
236 struct tm_hierarchy {
237 struct tm_shaper_profile_list shaper_profiles;
238 struct tm_shared_shaper_list shared_shapers;
239 struct tm_wred_profile_list wred_profiles;
240 struct tm_node_list nodes;
242 uint32_t n_shaper_profiles;
243 uint32_t n_shared_shapers;
244 uint32_t n_wred_profiles;
247 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
250 struct tm_internals {
258 struct tm_hierarchy h;
259 int hierarchy_frozen;
262 struct tm_params params;
265 struct softnic_tmgr_port {
266 TAILQ_ENTRY(softnic_tmgr_port) node;
267 char name[NAME_SIZE];
268 struct rte_sched_port *s;
271 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
278 char name[NAME_SIZE];
288 const char *dev_name;
292 uint32_t session_pool_size;
295 struct softnic_cryptodev {
296 TAILQ_ENTRY(softnic_cryptodev) node;
297 char name[NAME_SIZE];
304 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
310 uint64_t action_mask;
315 struct softnic_port_in_action_profile {
316 TAILQ_ENTRY(softnic_port_in_action_profile) node;
317 char name[NAME_SIZE];
319 struct rte_port_in_action_profile *ap;
322 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
328 uint64_t action_mask;
340 struct softnic_table_action_profile {
341 TAILQ_ENTRY(softnic_table_action_profile) node;
342 char name[NAME_SIZE];
344 struct rte_table_action_profile *ap;
347 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
349 struct softnic_table_meter_profile {
350 TAILQ_ENTRY(softnic_table_meter_profile) node;
351 uint32_t meter_profile_id;
356 softnic_table_meter_profile);
362 uint32_t timer_period_ms;
363 uint32_t offset_port_id;
366 enum softnic_port_in_type {
375 struct softnic_port_in_params {
377 enum softnic_port_in_type type;
378 char dev_name[NAME_SIZE];
385 const char *mempool_name;
390 const char *mempool_name;
391 const char *file_name;
392 uint32_t n_bytes_per_pkt;
404 char action_profile_name[NAME_SIZE];
407 enum softnic_port_out_type {
416 struct softnic_port_out_params {
417 enum softnic_port_out_type type;
418 char dev_name[NAME_SIZE];
425 const char *file_name;
439 enum softnic_table_type {
447 struct softnic_table_acl_params {
449 uint32_t ip_header_offset;
453 struct softnic_table_array_params {
458 #ifndef TABLE_RULE_MATCH_SIZE_MAX 459 #define TABLE_RULE_MATCH_SIZE_MAX 256 462 struct softnic_table_hash_params {
466 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
468 int extendable_bucket;
471 struct softnic_table_lpm_params {
477 struct softnic_table_params {
479 enum softnic_table_type match_type;
481 struct softnic_table_acl_params acl;
482 struct softnic_table_array_params array;
483 struct softnic_table_hash_params hash;
484 struct softnic_table_lpm_params lpm;
488 char action_profile_name[NAME_SIZE];
491 struct softnic_port_in {
492 struct softnic_port_in_params params;
493 struct softnic_port_in_action_profile *ap;
494 struct rte_port_in_action *a;
497 struct softnic_port_out {
498 struct softnic_port_out_params params;
501 struct softnic_table {
502 struct softnic_table_params params;
503 struct softnic_table_action_profile *ap;
504 struct rte_table_action *a;
505 struct flow_list flows;
507 struct softnic_table_meter_profile_list meter_profiles;
511 TAILQ_ENTRY(pipeline) node;
512 char name[NAME_SIZE];
514 struct rte_pipeline *p;
516 struct softnic_port_in port_in[RTE_PIPELINE_PORT_IN_MAX];
517 struct softnic_port_out port_out[RTE_PIPELINE_PORT_OUT_MAX];
518 struct softnic_table table[RTE_PIPELINE_TABLE_MAX];
520 uint32_t n_ports_out;
525 uint32_t timer_period_ms;
537 #ifndef THREAD_PIPELINES_MAX 538 #define THREAD_PIPELINES_MAX 256 541 #ifndef THREAD_MSGQ_SIZE 542 #define THREAD_MSGQ_SIZE 64 545 #ifndef THREAD_TIMER_PERIOD_MS 546 #define THREAD_TIMER_PERIOD_MS 100 562 #ifndef TABLE_RULE_ACTION_SIZE_MAX 563 #define TABLE_RULE_ACTION_SIZE_MAX 2048 566 struct softnic_table_data {
567 struct rte_table_action *a;
570 struct pipeline_data {
571 struct rte_pipeline *p;
572 struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
577 uint64_t timer_period;
580 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
583 struct softnic_thread_data {
584 struct rte_pipeline *p[THREAD_PIPELINES_MAX];
585 uint32_t n_pipelines;
587 struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
590 uint64_t timer_period;
592 uint64_t time_next_min;
604 struct tm_internals
tm;
607 struct flow_internals flow;
608 struct mtr_internals mtr;
610 struct softnic_conn *conn;
611 struct softnic_mempool_list mempool_list;
612 struct softnic_swq_list swq_list;
613 struct softnic_link_list link_list;
614 struct softnic_tmgr_port_list tmgr_port_list;
615 struct softnic_tap_list tap_list;
616 struct softnic_cryptodev_list cryptodev_list;
617 struct softnic_port_in_action_profile_list port_in_action_profile_list;
618 struct softnic_table_action_profile_list table_action_profile_list;
619 struct pipeline_list pipeline_list;
621 struct softnic_thread_data thread_data[RTE_MAX_LCORE];
624 static inline struct rte_eth_dev *
637 return &rte_eth_devices[port_id];
647 const char *pipeline_name,
650 struct flow_attr_map *
672 uint32_t meter_profile_id);
674 extern const struct rte_mtr_ops pmd_mtr_ops;
685 struct softnic_mempool *
689 struct softnic_mempool *
704 softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
724 struct softnic_link *
728 struct softnic_link *
742 struct softnic_tmgr_port *
746 struct softnic_tmgr_port *
757 tm_used(
struct rte_eth_dev *dev)
761 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
764 extern const struct rte_tm_ops pmd_tm_ops;
792 struct softnic_cryptodev *
796 struct softnic_cryptodev *
805 softnic_port_in_action_profile_init(
struct pmd_internals *p);
808 softnic_port_in_action_profile_free(
struct pmd_internals *p);
810 struct softnic_port_in_action_profile *
814 struct softnic_port_in_action_profile *
815 softnic_port_in_action_profile_create(
struct pmd_internals *p,
828 struct softnic_table_action_profile *
832 struct softnic_table_action_profile *
853 softnic_pipeline_thread_count(
struct pmd_internals *p, uint32_t thread_id);
856 softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
865 const char *pipeline_name,
866 struct softnic_port_in_params *params,
870 softnic_pipeline_port_in_connect_to_table(
struct pmd_internals *p,
871 const char *pipeline_name,
877 const char *pipeline_name,
878 struct softnic_port_out_params *params);
881 softnic_pipeline_port_out_find(
struct pmd_internals *softnic,
882 const char *pipeline_name,
888 const char *pipeline_name,
889 struct softnic_table_params *params);
891 struct softnic_table_meter_profile *
892 softnic_pipeline_table_meter_profile_find(
struct softnic_table *table,
893 uint32_t meter_profile_id);
895 struct softnic_table_rule_match_acl {
922 struct softnic_table_rule_match_array {
926 struct softnic_table_rule_match_hash {
927 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
930 struct softnic_table_rule_match_lpm {
942 struct softnic_table_rule_match {
943 enum softnic_table_type match_type;
946 struct softnic_table_rule_match_acl acl;
947 struct softnic_table_rule_match_array array;
948 struct softnic_table_rule_match_hash hash;
949 struct softnic_table_rule_match_lpm lpm;
953 #ifndef SYM_CRYPTO_MAX_KEY_SIZE 954 #define SYM_CRYPTO_MAX_KEY_SIZE (256) 956 struct softnic_table_rule_action {
957 uint64_t action_mask;
970 uint8_t sym_crypto_key[SYM_CRYPTO_MAX_KEY_SIZE];
974 TAILQ_ENTRY(rte_flow) node;
975 struct softnic_table_rule_match match;
976 struct softnic_table_rule_action action;
978 struct pipeline *pipeline;
984 const char *pipeline_name,
991 const char *pipeline_name,
996 const char *pipeline_name,
1000 softnic_pipeline_port_out_stats_read(
struct pmd_internals *p,
1001 const char *pipeline_name,
1008 const char *pipeline_name,
1015 const char *pipeline_name,
1017 struct softnic_table_rule_match *match,
1018 struct softnic_table_rule_action *action,
1022 softnic_pipeline_table_rule_add_bulk(
struct pmd_internals *p,
1023 const char *pipeline_name,
1025 struct softnic_table_rule_match *match,
1026 struct softnic_table_rule_action *action,
1031 softnic_pipeline_table_rule_add_default(
struct pmd_internals *p,
1032 const char *pipeline_name,
1034 struct softnic_table_rule_action *action,
1039 const char *pipeline_name,
1041 struct softnic_table_rule_match *match);
1044 softnic_pipeline_table_rule_delete_default(
struct pmd_internals *p,
1045 const char *pipeline_name,
1049 softnic_pipeline_table_rule_stats_read(
struct pmd_internals *p,
1050 const char *pipeline_name,
1057 softnic_pipeline_table_mtr_profile_add(
struct pmd_internals *p,
1058 const char *pipeline_name,
1060 uint32_t meter_profile_id,
1064 softnic_pipeline_table_mtr_profile_delete(
struct pmd_internals *p,
1065 const char *pipeline_name,
1067 uint32_t meter_profile_id);
1070 softnic_pipeline_table_rule_mtr_read(
struct pmd_internals *p,
1071 const char *pipeline_name,
1079 softnic_pipeline_table_dscp_table_update(
struct pmd_internals *p,
1080 const char *pipeline_name,
1086 softnic_pipeline_table_rule_ttl_read(
struct pmd_internals *p,
1087 const char *pipeline_name,
1105 const char *pipeline_name);
1110 const char *pipeline_name);
1116 softnic_cli_process(
char *in,
1123 const char *file_name,
1124 size_t msg_in_len_max,
1125 size_t msg_out_len_max);
int rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
struct rte_table_action_mtr_tc_params mtr[RTE_TABLE_ACTION_TC_MAX]
#define __rte_cache_aligned
#define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver)