5 #ifndef __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
6 #define __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
10 #include <sys/queue.h>
24 #include "rte_eth_softnic.h"
55 struct softnic_mempool {
56 TAILQ_ENTRY(softnic_mempool) node;
62 TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
72 TAILQ_ENTRY(softnic_swq) node;
88 TAILQ_ENTRY(softnic_link) node;
101 #ifndef TM_MAX_SUBPORTS
102 #define TM_MAX_SUBPORTS 8
105 #ifndef TM_MAX_PIPES_PER_SUBPORT
106 #define TM_MAX_PIPES_PER_SUBPORT 4096
112 struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
114 struct rte_sched_pipe_params
116 uint32_t n_pipe_profiles;
117 uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
122 TM_NODE_LEVEL_PORT = 0,
123 TM_NODE_LEVEL_SUBPORT,
131 struct tm_shaper_profile {
132 TAILQ_ENTRY(tm_shaper_profile) node;
133 uint32_t shaper_profile_id;
138 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
141 struct tm_shared_shaper {
142 TAILQ_ENTRY(tm_shared_shaper) node;
143 uint32_t shared_shaper_id;
145 uint32_t shaper_profile_id;
148 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
151 struct tm_wred_profile {
152 TAILQ_ENTRY(tm_wred_profile) node;
153 uint32_t wred_profile_id;
158 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
162 TAILQ_ENTRY(tm_node) node;
164 uint32_t parent_node_id;
168 struct tm_node *parent_node;
169 struct tm_shaper_profile *shaper_profile;
170 struct tm_wred_profile *wred_profile;
179 struct tm_hierarchy {
180 struct tm_shaper_profile_list shaper_profiles;
181 struct tm_shared_shaper_list shared_shapers;
182 struct tm_wred_profile_list wred_profiles;
183 struct tm_node_list nodes;
185 uint32_t n_shaper_profiles;
186 uint32_t n_shared_shapers;
187 uint32_t n_wred_profiles;
190 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
193 struct tm_internals {
201 struct tm_hierarchy h;
202 int hierarchy_frozen;
205 struct tm_params params;
208 struct softnic_tmgr_port {
209 TAILQ_ENTRY(softnic_tmgr_port) node;
210 char name[NAME_SIZE];
211 struct rte_sched_port *s;
214 TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
220 TAILQ_ENTRY(softnic_tap) node;
221 char name[NAME_SIZE];
231 uint64_t action_mask;
236 struct softnic_port_in_action_profile {
237 TAILQ_ENTRY(softnic_port_in_action_profile) node;
238 char name[NAME_SIZE];
240 struct rte_port_in_action_profile *ap;
243 TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
249 uint64_t action_mask;
260 struct softnic_table_action_profile {
261 TAILQ_ENTRY(softnic_table_action_profile) node;
262 char name[NAME_SIZE];
264 struct rte_table_action_profile *ap;
267 TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
273 uint32_t timer_period_ms;
274 uint32_t offset_port_id;
277 enum softnic_port_in_type {
285 struct softnic_port_in_params {
287 enum softnic_port_in_type type;
288 const char *dev_name;
295 const char *mempool_name;
300 const char *mempool_name;
301 const char *file_name;
302 uint32_t n_bytes_per_pkt;
308 const char *action_profile_name;
311 enum softnic_port_out_type {
319 struct softnic_port_out_params {
320 enum softnic_port_out_type type;
321 const char *dev_name;
328 const char *file_name;
337 enum softnic_table_type {
345 struct softnic_table_acl_params {
347 uint32_t ip_header_offset;
351 struct softnic_table_array_params {
356 struct softnic_table_hash_params {
362 int extendable_bucket;
365 struct softnic_table_lpm_params {
371 struct softnic_table_params {
373 enum softnic_table_type match_type;
375 struct softnic_table_acl_params acl;
376 struct softnic_table_array_params array;
377 struct softnic_table_hash_params hash;
378 struct softnic_table_lpm_params lpm;
382 const char *action_profile_name;
385 struct softnic_port_in {
386 struct softnic_port_in_params params;
387 struct softnic_port_in_action_profile *ap;
388 struct rte_port_in_action *a;
391 struct softnic_table {
392 struct softnic_table_params params;
393 struct softnic_table_action_profile *ap;
394 struct rte_table_action *a;
398 TAILQ_ENTRY(pipeline) node;
399 char name[NAME_SIZE];
401 struct rte_pipeline *p;
405 uint32_t n_ports_out;
410 uint32_t timer_period_ms;
422 #ifndef THREAD_PIPELINES_MAX
423 #define THREAD_PIPELINES_MAX 256
426 #ifndef THREAD_MSGQ_SIZE
427 #define THREAD_MSGQ_SIZE 64
430 #ifndef THREAD_TIMER_PERIOD_MS
431 #define THREAD_TIMER_PERIOD_MS 100
447 #ifndef TABLE_RULE_ACTION_SIZE_MAX
448 #define TABLE_RULE_ACTION_SIZE_MAX 2048
451 struct softnic_table_data {
452 struct rte_table_action *a;
455 struct pipeline_data {
456 struct rte_pipeline *p;
457 struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
462 uint64_t timer_period;
465 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
468 struct softnic_thread_data {
469 struct rte_pipeline *p[THREAD_PIPELINES_MAX];
470 uint32_t n_pipelines;
472 struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
475 uint64_t timer_period;
477 uint64_t time_next_min;
489 struct tm_internals tm;
492 struct softnic_conn *conn;
493 struct softnic_mempool_list mempool_list;
494 struct softnic_swq_list swq_list;
495 struct softnic_link_list link_list;
496 struct softnic_tmgr_port_list tmgr_port_list;
497 struct softnic_tap_list tap_list;
498 struct softnic_port_in_action_profile_list port_in_action_profile_list;
499 struct softnic_table_action_profile_list table_action_profile_list;
500 struct pipeline_list pipeline_list;
502 struct softnic_thread_data thread_data[RTE_MAX_LCORE];
514 struct softnic_mempool *
518 struct softnic_mempool *
533 softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
553 struct softnic_link *
557 struct softnic_link *
571 struct softnic_tmgr_port *
575 struct softnic_tmgr_port *
586 tm_used(
struct rte_eth_dev *dev)
590 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
593 extern const struct rte_tm_ops pmd_tm_ops;
616 softnic_port_in_action_profile_init(
struct pmd_internals *p);
619 softnic_port_in_action_profile_free(
struct pmd_internals *p);
621 struct softnic_port_in_action_profile *
625 struct softnic_port_in_action_profile *
626 softnic_port_in_action_profile_create(
struct pmd_internals *p,
639 struct softnic_table_action_profile *
643 struct softnic_table_action_profile *
661 softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
670 const char *pipeline_name,
671 struct softnic_port_in_params *params,
675 softnic_pipeline_port_in_connect_to_table(
struct pmd_internals *p,
676 const char *pipeline_name,
682 const char *pipeline_name,
683 struct softnic_port_out_params *params);
687 const char *pipeline_name,
688 struct softnic_table_params *params);
690 struct softnic_table_rule_match_acl {
717 struct softnic_table_rule_match_array {
721 #ifndef TABLE_RULE_MATCH_SIZE_MAX
722 #define TABLE_RULE_MATCH_SIZE_MAX 256
725 struct softnic_table_rule_match_hash {
726 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
729 struct softnic_table_rule_match_lpm {
741 struct softnic_table_rule_match {
742 enum softnic_table_type match_type;
745 struct softnic_table_rule_match_acl acl;
746 struct softnic_table_rule_match_array array;
747 struct softnic_table_rule_match_hash hash;
748 struct softnic_table_rule_match_lpm lpm;
752 struct softnic_table_rule_action {
753 uint64_t action_mask;
767 const char *pipeline_name,
774 const char *pipeline_name,
779 const char *pipeline_name,
783 softnic_pipeline_port_out_stats_read(
struct pmd_internals *p,
784 const char *pipeline_name,
791 const char *pipeline_name,
798 const char *pipeline_name,
800 struct softnic_table_rule_match *match,
801 struct softnic_table_rule_action *action,
805 softnic_pipeline_table_rule_add_bulk(
struct pmd_internals *p,
806 const char *pipeline_name,
808 struct softnic_table_rule_match *match,
809 struct softnic_table_rule_action *action,
814 softnic_pipeline_table_rule_add_default(
struct pmd_internals *p,
815 const char *pipeline_name,
817 struct softnic_table_rule_action *action,
822 const char *pipeline_name,
824 struct softnic_table_rule_match *match);
827 softnic_pipeline_table_rule_delete_default(
struct pmd_internals *p,
828 const char *pipeline_name,
832 softnic_pipeline_table_rule_stats_read(
struct pmd_internals *p,
833 const char *pipeline_name,
840 softnic_pipeline_table_mtr_profile_add(
struct pmd_internals *p,
841 const char *pipeline_name,
843 uint32_t meter_profile_id,
847 softnic_pipeline_table_mtr_profile_delete(
struct pmd_internals *p,
848 const char *pipeline_name,
850 uint32_t meter_profile_id);
853 softnic_pipeline_table_rule_mtr_read(
struct pmd_internals *p,
854 const char *pipeline_name,
862 softnic_pipeline_table_dscp_table_update(
struct pmd_internals *p,
863 const char *pipeline_name,
869 softnic_pipeline_table_rule_ttl_read(
struct pmd_internals *p,
870 const char *pipeline_name,
888 const char *pipeline_name);
893 const char *pipeline_name);
899 softnic_cli_process(
char *in,
906 const char *file_name,
907 size_t msg_in_len_max,
908 size_t msg_out_len_max);