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"
56 struct flow_attr_map {
57 char pipeline_name[NAME_SIZE];
62 #ifndef SOFTNIC_FLOW_MAX_GROUPS
63 #define SOFTNIC_FLOW_MAX_GROUPS 64
66 struct flow_internals {
67 struct flow_attr_map ingress_map[SOFTNIC_FLOW_MAX_GROUPS];
68 struct flow_attr_map egress_map[SOFTNIC_FLOW_MAX_GROUPS];
78 uint32_t meter_profile_id;
87 TAILQ_ENTRY(softnic_mtr) node;
90 struct rte_flow *flow;
95 struct mtr_internals {
96 struct softnic_mtr_meter_profile_list meter_profiles;
97 struct softnic_mtr_list mtrs;
104 uint32_t buffer_size;
109 struct softnic_mempool {
110 TAILQ_ENTRY(softnic_mempool) node;
111 char name[NAME_SIZE];
113 uint32_t buffer_size;
116 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
126 TAILQ_ENTRY(softnic_swq) node;
127 char name[NAME_SIZE];
137 const char *dev_name;
141 struct softnic_link {
142 TAILQ_ENTRY(softnic_link) node;
143 char name[NAME_SIZE];
155 #ifndef TM_MAX_SUBPORTS
156 #define TM_MAX_SUBPORTS 8
159 #ifndef TM_MAX_PIPES_PER_SUBPORT
160 #define TM_MAX_PIPES_PER_SUBPORT 4096
166 struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
168 struct rte_sched_pipe_params
170 uint32_t n_pipe_profiles;
171 uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
176 TM_NODE_LEVEL_PORT = 0,
177 TM_NODE_LEVEL_SUBPORT,
185 struct tm_shaper_profile {
186 TAILQ_ENTRY(tm_shaper_profile) node;
187 uint32_t shaper_profile_id;
192 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
195 struct tm_shared_shaper {
196 TAILQ_ENTRY(tm_shared_shaper) node;
197 uint32_t shared_shaper_id;
199 uint32_t shaper_profile_id;
202 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
205 struct tm_wred_profile {
206 TAILQ_ENTRY(tm_wred_profile) node;
207 uint32_t wred_profile_id;
212 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
216 TAILQ_ENTRY(tm_node) node;
218 uint32_t parent_node_id;
222 struct tm_node *parent_node;
223 struct tm_shaper_profile *shaper_profile;
224 struct tm_wred_profile *wred_profile;
233 struct tm_hierarchy {
234 struct tm_shaper_profile_list shaper_profiles;
235 struct tm_shared_shaper_list shared_shapers;
236 struct tm_wred_profile_list wred_profiles;
237 struct tm_node_list nodes;
239 uint32_t n_shaper_profiles;
240 uint32_t n_shared_shapers;
241 uint32_t n_wred_profiles;
244 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
247 struct tm_internals {
255 struct tm_hierarchy h;
256 int hierarchy_frozen;
259 struct tm_params params;
262 struct softnic_tmgr_port {
263 TAILQ_ENTRY(softnic_tmgr_port) node;
264 char name[NAME_SIZE];
265 struct rte_sched_port *s;
268 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
274 TAILQ_ENTRY(softnic_tap) node;
275 char name[NAME_SIZE];
285 const char *dev_name;
291 struct softnic_cryptodev {
292 TAILQ_ENTRY(softnic_cryptodev) node;
293 char name[NAME_SIZE];
298 TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
304 uint64_t action_mask;
309 struct softnic_port_in_action_profile {
310 TAILQ_ENTRY(softnic_port_in_action_profile) node;
311 char name[NAME_SIZE];
313 struct rte_port_in_action_profile *ap;
316 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
322 uint64_t action_mask;
334 struct softnic_table_action_profile {
335 TAILQ_ENTRY(softnic_table_action_profile) node;
336 char name[NAME_SIZE];
338 struct rte_table_action_profile *ap;
341 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
343 struct softnic_table_meter_profile {
344 TAILQ_ENTRY(softnic_table_meter_profile) node;
345 uint32_t meter_profile_id;
350 softnic_table_meter_profile);
356 uint32_t timer_period_ms;
357 uint32_t offset_port_id;
360 enum softnic_port_in_type {
369 struct softnic_port_in_params {
371 enum softnic_port_in_type type;
372 char dev_name[NAME_SIZE];
379 const char *mempool_name;
384 const char *mempool_name;
385 const char *file_name;
386 uint32_t n_bytes_per_pkt;
398 char action_profile_name[NAME_SIZE];
401 enum softnic_port_out_type {
410 struct softnic_port_out_params {
411 enum softnic_port_out_type type;
412 char dev_name[NAME_SIZE];
419 const char *file_name;
433 enum softnic_table_type {
441 struct softnic_table_acl_params {
443 uint32_t ip_header_offset;
447 struct softnic_table_array_params {
452 #ifndef TABLE_RULE_MATCH_SIZE_MAX
453 #define TABLE_RULE_MATCH_SIZE_MAX 256
456 struct softnic_table_hash_params {
460 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
462 int extendable_bucket;
465 struct softnic_table_lpm_params {
471 struct softnic_table_params {
473 enum softnic_table_type match_type;
475 struct softnic_table_acl_params acl;
476 struct softnic_table_array_params array;
477 struct softnic_table_hash_params hash;
478 struct softnic_table_lpm_params lpm;
482 char action_profile_name[NAME_SIZE];
485 struct softnic_port_in {
486 struct softnic_port_in_params params;
487 struct softnic_port_in_action_profile *ap;
488 struct rte_port_in_action *a;
491 struct softnic_port_out {
492 struct softnic_port_out_params params;
495 struct softnic_table {
496 struct softnic_table_params params;
497 struct softnic_table_action_profile *ap;
498 struct rte_table_action *a;
499 struct flow_list flows;
501 struct softnic_table_meter_profile_list meter_profiles;
505 TAILQ_ENTRY(pipeline) node;
506 char name[NAME_SIZE];
508 struct rte_pipeline *p;
514 uint32_t n_ports_out;
519 uint32_t timer_period_ms;
531 #ifndef THREAD_PIPELINES_MAX
532 #define THREAD_PIPELINES_MAX 256
535 #ifndef THREAD_MSGQ_SIZE
536 #define THREAD_MSGQ_SIZE 64
539 #ifndef THREAD_TIMER_PERIOD_MS
540 #define THREAD_TIMER_PERIOD_MS 100
556 #ifndef TABLE_RULE_ACTION_SIZE_MAX
557 #define TABLE_RULE_ACTION_SIZE_MAX 2048
560 struct softnic_table_data {
561 struct rte_table_action *a;
564 struct pipeline_data {
565 struct rte_pipeline *p;
566 struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
571 uint64_t timer_period;
574 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
577 struct softnic_thread_data {
578 struct rte_pipeline *p[THREAD_PIPELINES_MAX];
579 uint32_t n_pipelines;
581 struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
584 uint64_t timer_period;
586 uint64_t time_next_min;
598 struct tm_internals tm;
601 struct flow_internals flow;
602 struct mtr_internals mtr;
604 struct softnic_conn *conn;
605 struct softnic_mempool_list mempool_list;
606 struct softnic_swq_list swq_list;
607 struct softnic_link_list link_list;
608 struct softnic_tmgr_port_list tmgr_port_list;
609 struct softnic_tap_list tap_list;
610 struct softnic_cryptodev_list cryptodev_list;
611 struct softnic_port_in_action_profile_list port_in_action_profile_list;
612 struct softnic_table_action_profile_list table_action_profile_list;
613 struct pipeline_list pipeline_list;
615 struct softnic_thread_data thread_data[RTE_MAX_LCORE];
618 static inline struct rte_eth_dev *
631 return &rte_eth_devices[port_id];
641 const char *pipeline_name,
644 struct flow_attr_map *
666 uint32_t meter_profile_id);
668 extern const struct rte_mtr_ops pmd_mtr_ops;
679 struct softnic_mempool *
683 struct softnic_mempool *
698 softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
718 struct softnic_link *
722 struct softnic_link *
736 struct softnic_tmgr_port *
740 struct softnic_tmgr_port *
751 tm_used(
struct rte_eth_dev *dev)
755 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
758 extern const struct rte_tm_ops pmd_tm_ops;
786 struct softnic_cryptodev *
790 struct softnic_cryptodev *
799 softnic_port_in_action_profile_init(
struct pmd_internals *p);
802 softnic_port_in_action_profile_free(
struct pmd_internals *p);
804 struct softnic_port_in_action_profile *
808 struct softnic_port_in_action_profile *
809 softnic_port_in_action_profile_create(
struct pmd_internals *p,
822 struct softnic_table_action_profile *
826 struct softnic_table_action_profile *
847 softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
856 const char *pipeline_name,
857 struct softnic_port_in_params *params,
861 softnic_pipeline_port_in_connect_to_table(
struct pmd_internals *p,
862 const char *pipeline_name,
868 const char *pipeline_name,
869 struct softnic_port_out_params *params);
872 softnic_pipeline_port_out_find(
struct pmd_internals *softnic,
873 const char *pipeline_name,
879 const char *pipeline_name,
880 struct softnic_table_params *params);
882 struct softnic_table_meter_profile *
883 softnic_pipeline_table_meter_profile_find(
struct softnic_table *table,
884 uint32_t meter_profile_id);
886 struct softnic_table_rule_match_acl {
913 struct softnic_table_rule_match_array {
917 struct softnic_table_rule_match_hash {
918 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
921 struct softnic_table_rule_match_lpm {
933 struct softnic_table_rule_match {
934 enum softnic_table_type match_type;
937 struct softnic_table_rule_match_acl acl;
938 struct softnic_table_rule_match_array array;
939 struct softnic_table_rule_match_hash hash;
940 struct softnic_table_rule_match_lpm lpm;
944 struct softnic_table_rule_action {
945 uint64_t action_mask;
961 TAILQ_ENTRY(rte_flow) node;
962 struct softnic_table_rule_match match;
963 struct softnic_table_rule_action action;
965 struct pipeline *pipeline;
971 const
char *pipeline_name,
978 const
char *pipeline_name,
983 const
char *pipeline_name,
987 softnic_pipeline_port_out_stats_read(struct
pmd_internals *p,
988 const
char *pipeline_name,
995 const
char *pipeline_name,
1002 const
char *pipeline_name,
1004 struct softnic_table_rule_match *match,
1005 struct softnic_table_rule_action *action,
1009 softnic_pipeline_table_rule_add_bulk(struct
pmd_internals *p,
1010 const
char *pipeline_name,
1012 struct softnic_table_rule_match *match,
1013 struct softnic_table_rule_action *action,
1018 softnic_pipeline_table_rule_add_default(struct
pmd_internals *p,
1019 const
char *pipeline_name,
1021 struct softnic_table_rule_action *action,
1026 const
char *pipeline_name,
1028 struct softnic_table_rule_match *match);
1031 softnic_pipeline_table_rule_delete_default(struct
pmd_internals *p,
1032 const
char *pipeline_name,
1036 softnic_pipeline_table_rule_stats_read(struct
pmd_internals *p,
1037 const
char *pipeline_name,
1044 softnic_pipeline_table_mtr_profile_add(struct
pmd_internals *p,
1045 const
char *pipeline_name,
1047 uint32_t meter_profile_id,
1051 softnic_pipeline_table_mtr_profile_delete(struct
pmd_internals *p,
1052 const
char *pipeline_name,
1054 uint32_t meter_profile_id);
1057 softnic_pipeline_table_rule_mtr_read(struct
pmd_internals *p,
1058 const
char *pipeline_name,
1066 softnic_pipeline_table_dscp_table_update(struct
pmd_internals *p,
1067 const
char *pipeline_name,
1073 softnic_pipeline_table_rule_ttl_read(struct
pmd_internals *p,
1074 const
char *pipeline_name,
1092 const
char *pipeline_name);
1097 const
char *pipeline_name);
1103 softnic_cli_process(
char *in,
1110 const
char *file_name,
1111 size_t msg_in_len_max,
1112 size_t msg_out_len_max);
#define RTE_PIPELINE_TABLE_MAX
TAILQ_HEAD(rte_bus_list, rte_bus)
#define RTE_SCHED_PIPE_PROFILES_PER_PORT
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
#define RTE_PIPELINE_PORT_IN_MAX
#define RTE_PIPELINE_PORT_OUT_MAX