1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
5 #ifndef __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
6 #define __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__
12 #include <rte_ethdev.h>
13 #include <rte_sched.h>
14 #include <rte_ethdev_driver.h>
15 #include <rte_tm_driver.h>
17 #include "rte_eth_softnic.h"
28 /** Traffic Management (TM) */
30 uint32_t n_queues; /**< Number of queues */
31 uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
36 * Traffic Management (TM) Internals
39 #ifndef TM_MAX_SUBPORTS
40 #define TM_MAX_SUBPORTS 8
43 #ifndef TM_MAX_PIPES_PER_SUBPORT
44 #define TM_MAX_PIPES_PER_SUBPORT 4096
48 struct rte_sched_port_params port_params;
50 struct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];
52 struct rte_sched_pipe_params
53 pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PORT];
54 uint32_t n_pipe_profiles;
55 uint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];
60 TM_NODE_LEVEL_PORT = 0,
61 TM_NODE_LEVEL_SUBPORT,
68 /* TM Shaper Profile */
69 struct tm_shaper_profile {
70 TAILQ_ENTRY(tm_shaper_profile) node;
71 uint32_t shaper_profile_id;
73 struct rte_tm_shaper_params params;
76 TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);
78 /* TM Shared Shaper */
79 struct tm_shared_shaper {
80 TAILQ_ENTRY(tm_shared_shaper) node;
81 uint32_t shared_shaper_id;
83 uint32_t shaper_profile_id;
86 TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);
89 struct tm_wred_profile {
90 TAILQ_ENTRY(tm_wred_profile) node;
91 uint32_t wred_profile_id;
93 struct rte_tm_wred_params params;
96 TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);
100 TAILQ_ENTRY(tm_node) node;
102 uint32_t parent_node_id;
106 struct tm_node *parent_node;
107 struct tm_shaper_profile *shaper_profile;
108 struct tm_wred_profile *wred_profile;
109 struct rte_tm_node_params params;
110 struct rte_tm_node_stats stats;
114 TAILQ_HEAD(tm_node_list, tm_node);
116 /* TM Hierarchy Specification */
117 struct tm_hierarchy {
118 struct tm_shaper_profile_list shaper_profiles;
119 struct tm_shared_shaper_list shared_shapers;
120 struct tm_wred_profile_list wred_profiles;
121 struct tm_node_list nodes;
123 uint32_t n_shaper_profiles;
124 uint32_t n_shared_shapers;
125 uint32_t n_wred_profiles;
128 uint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];
131 struct tm_internals {
132 /** Hierarchy specification
134 * -Hierarchy is unfrozen at init and when port is stopped.
135 * -Hierarchy is frozen on successful hierarchy commit.
136 * -Run-time hierarchy changes are not allowed, therefore it makes
137 * sense to keep the hierarchy frozen after the port is started.
139 struct tm_hierarchy h;
140 int hierarchy_frozen;
143 struct tm_params params;
144 struct rte_sched_port *sched;
150 struct pmd_internals {
152 struct pmd_params params;
156 struct tm_internals tm; /**< Traffic Management */
161 * Traffic Management (TM) Operation
163 extern const struct rte_tm_ops pmd_tm_ops;
166 tm_init(struct pmd_internals *p, struct pmd_params *params, int numa_node);
169 tm_free(struct pmd_internals *p);
172 tm_start(struct pmd_internals *p);
175 tm_stop(struct pmd_internals *p);
178 tm_used(struct rte_eth_dev *dev __rte_unused)
183 #endif /* __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__ */