5#ifndef __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
6#define __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
22#include <ethdev_driver.h>
27#include "rte_eth_softnic.h"
31#define SOFTNIC_PATH_MAX 4096
39 char firmware[SOFTNIC_PATH_MAX];
56TAILQ_HEAD(flow_list, rte_flow);
59 char pipeline_name[NAME_SIZE];
64#ifndef SOFTNIC_FLOW_MAX_GROUPS
65#define SOFTNIC_FLOW_MAX_GROUPS 64
68struct 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;
88struct softnic_mtr_meter_policy {
89 TAILQ_ENTRY(softnic_mtr_meter_policy) node;
90 uint32_t meter_policy_id;
95TAILQ_HEAD(softnic_mtr_meter_policy_list, softnic_mtr_meter_policy);
99 TAILQ_ENTRY(softnic_mtr) node;
102 struct rte_flow *flow;
105TAILQ_HEAD(softnic_mtr_list, softnic_mtr);
107struct 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;
122struct softnic_mempool {
123 TAILQ_ENTRY(softnic_mempool) node;
124 char name[NAME_SIZE];
126 uint32_t buffer_size;
129TAILQ_HEAD(softnic_mempool_list, softnic_mempool);
139 TAILQ_ENTRY(softnic_swq) node;
140 char name[NAME_SIZE];
144TAILQ_HEAD(softnic_swq_list, softnic_swq);
150 const char *dev_name;
155 TAILQ_ENTRY(softnic_link) node;
156 char name[NAME_SIZE];
162TAILQ_HEAD(softnic_link_list, softnic_link);
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,
207struct tm_shaper_profile {
208 TAILQ_ENTRY(tm_shaper_profile) node;
209 uint32_t shaper_profile_id;
214TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
217struct tm_shared_shaper {
218 TAILQ_ENTRY(tm_shared_shaper) node;
219 uint32_t shared_shaper_id;
221 uint32_t shaper_profile_id;
224TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
227struct tm_wred_profile {
228 TAILQ_ENTRY(tm_wred_profile) node;
229 uint32_t wred_profile_id;
234TAILQ_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;
252TAILQ_HEAD(tm_node_list, tm_node);
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];
277 struct tm_hierarchy h;
278 int hierarchy_frozen;
281 struct tm_params params;
284struct softnic_tmgr_port {
285 TAILQ_ENTRY(softnic_tmgr_port) node;
286 char name[NAME_SIZE];
287 struct rte_sched_port *s;
290TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);
297 char name[NAME_SIZE];
307 const char *dev_name;
311 uint32_t session_pool_size;
314struct softnic_cryptodev {
315 TAILQ_ENTRY(softnic_cryptodev) node;
316 char name[NAME_SIZE];
323TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
329 uint64_t action_mask;
334struct 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;
341TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
347 uint64_t action_mask;
359struct softnic_table_action_profile {
360 TAILQ_ENTRY(softnic_table_action_profile) node;
361 char name[NAME_SIZE];
363 struct rte_table_action_profile *ap;
366TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
368struct softnic_table_meter_profile {
369 TAILQ_ENTRY(softnic_table_meter_profile) node;
370 uint32_t meter_profile_id;
374TAILQ_HEAD(softnic_table_meter_profile_list,
375 softnic_table_meter_profile);
381 uint32_t timer_period_ms;
382 uint32_t offset_port_id;
385enum softnic_port_in_type {
394struct 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];
426enum softnic_port_out_type {
435struct softnic_port_out_params {
436 enum softnic_port_out_type type;
437 char dev_name[NAME_SIZE];
444 const char *file_name;
458enum softnic_table_type {
466struct softnic_table_acl_params {
468 uint32_t ip_header_offset;
472struct softnic_table_array_params {
477#ifndef TABLE_RULE_MATCH_SIZE_MAX
478#define TABLE_RULE_MATCH_SIZE_MAX 256
481struct softnic_table_hash_params {
485 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
487 int extendable_bucket;
490struct softnic_table_lpm_params {
496struct 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];
510struct 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;
516struct softnic_port_out {
517 struct softnic_port_out_params params;
520struct 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;
539 uint32_t n_ports_out;
544 uint32_t timer_period_ms;
551TAILQ_HEAD(pipeline_list, pipeline);
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
585struct softnic_table_data {
586 struct rte_table_action *a;
589struct pipeline_data {
590 struct rte_pipeline *p;
596 uint64_t timer_period;
599 uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
602struct 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];
643static inline struct rte_eth_dev *
656 return &rte_eth_devices[port_id];
666 const char *pipeline_name,
669struct flow_attr_map *
691 uint32_t meter_profile_id);
693struct softnic_mtr_meter_policy *
695 uint32_t meter_policy_id);
697extern const struct rte_mtr_ops pmd_mtr_ops;
708struct softnic_mempool *
712struct softnic_mempool *
727softnic_softnic_swq_free_keep_rxq_txq(
struct pmd_internals *p);
765struct softnic_tmgr_port *
769struct softnic_tmgr_port *
780tm_used(
struct rte_eth_dev *dev)
784 return p->soft.
tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];
787extern const struct rte_tm_ops pmd_tm_ops;
815struct softnic_cryptodev *
819struct softnic_cryptodev *
833struct softnic_port_in_action_profile *
837struct softnic_port_in_action_profile *
838softnic_port_in_action_profile_create(
struct pmd_internals *p,
851struct softnic_table_action_profile *
855struct softnic_table_action_profile *
873softnic_pipeline_thread_count(
struct pmd_internals *p, uint32_t thread_id);
876softnic_pipeline_find(
struct pmd_internals *p,
const char *name);
885 const char *pipeline_name,
886 struct softnic_port_in_params *params,
890softnic_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);
902 const char *pipeline_name,
908 const char *pipeline_name,
909 struct softnic_table_params *params);
911struct softnic_table_meter_profile *
912softnic_pipeline_table_meter_profile_find(
struct softnic_table *table,
913 uint32_t meter_profile_id);
915struct softnic_table_rule_match_acl {
942struct softnic_table_rule_match_array {
946struct softnic_table_rule_match_hash {
947 uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
950struct softnic_table_rule_match_lpm {
962struct 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)
976struct 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;
1004 const char *pipeline_name,
1011 const char *pipeline_name,
1016 const char *pipeline_name,
1020softnic_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,
1042softnic_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,
1051softnic_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);
1064softnic_pipeline_table_rule_delete_default(
struct pmd_internals *p,
1065 const char *pipeline_name,
1069softnic_pipeline_table_rule_stats_read(
struct pmd_internals *p,
1070 const char *pipeline_name,
1077softnic_pipeline_table_mtr_profile_add(
struct pmd_internals *p,
1078 const char *pipeline_name,
1080 uint32_t meter_profile_id,
1084softnic_pipeline_table_mtr_profile_delete(
struct pmd_internals *p,
1085 const char *pipeline_name,
1087 uint32_t meter_profile_id);
1090softnic_pipeline_table_rule_mtr_read(
struct pmd_internals *p,
1091 const char *pipeline_name,
1099softnic_pipeline_table_dscp_table_update(
struct pmd_internals *p,
1100 const char *pipeline_name,
1106softnic_pipeline_table_rule_ttl_read(
struct pmd_internals *p,
1107 const char *pipeline_name,
1125 const char *pipeline_name);
1130 const char *pipeline_name);
1136softnic_cli_process(
char *in,
1143 const char *file_name,
1144 size_t msg_in_len_max,
1145 size_t msg_out_len_max);
#define __rte_cache_aligned
int rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
#define RTE_PIPELINE_PORT_IN_MAX
#define RTE_PIPELINE_TABLE_MAX
#define RTE_PIPELINE_PORT_OUT_MAX
#define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE
struct pmd_params::@15 tm
struct rte_table_action_mtr_tc_params mtr[RTE_TABLE_ACTION_TC_MAX]