MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dlb2_resource_init

Function dlb2_resource_init

dpdk/drivers/event/dlb2/pf/base/dlb2_resource.c:110–253  ·  view source on GitHub ↗

* dlb2_resource_init() - initialize the device * @hw: pointer to struct dlb2_hw. * @ver: device version. * * This function initializes the device's software state (pointed to by the hw * argument) and programs global scheduling QoS registers. This function should * be called during driver initialization, and the dlb2_hw structure should * be zero-initialized before calling the function. *

Source from the content-addressed store, hash-verified

108 * Returns 0 upon success, <0 otherwise.
109 */
110int dlb2_resource_init(struct dlb2_hw *hw, enum dlb2_hw_ver ver, const void *probe_args)
111{
112 const struct dlb2_devargs *args = (const struct dlb2_devargs *)probe_args;
113 bool ldb_port_default = args ? args->default_ldb_port_allocation : false;
114 struct dlb2_list_entry *list;
115 unsigned int i;
116 int ret;
117
118 /*
119 * For optimal load-balancing, ports that map to one or more QIDs in
120 * common should not be in numerical sequence. The port->QID mapping is
121 * application dependent, but the driver interleaves port IDs as much
122 * as possible to reduce the likelihood of sequential ports mapping to
123 * the same QID(s). This initial allocation of port IDs maximizes the
124 * average distance between an ID and its immediate neighbors (i.e.
125 * the distance from 1 to 0 and to 2, the distance from 2 to 1 and to
126 * 3, etc.).
127 */
128
129 const u8 init_ldb_port_allocation[DLB2_MAX_NUM_LDB_PORTS] = {
130 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9,
131 16, 23, 30, 21, 28, 19, 26, 17, 24, 31, 22, 29, 20, 27, 18, 25,
132 32, 39, 46, 37, 44, 35, 42, 33, 40, 47, 38, 45, 36, 43, 34, 41,
133 48, 55, 62, 53, 60, 51, 58, 49, 56, 63, 54, 61, 52, 59, 50, 57,
134 };
135
136 hw->ver = ver;
137
138 dlb2_init_fn_rsrc_lists(&hw->pf);
139
140 for (i = 0; i < DLB2_MAX_NUM_VDEVS; i++)
141 dlb2_init_fn_rsrc_lists(&hw->vdev[i]);
142
143 for (i = 0; i < DLB2_MAX_NUM_DOMAINS; i++) {
144 dlb2_init_domain_rsrc_lists(&hw->domains[i]);
145 hw->domains[i].parent_func = &hw->pf;
146 }
147
148 /* Give all resources to the PF driver */
149 hw->pf.num_avail_domains = DLB2_MAX_NUM_DOMAINS;
150 for (i = 0; i < hw->pf.num_avail_domains; i++) {
151 list = &hw->domains[i].func_list;
152
153 dlb2_list_add(&hw->pf.avail_domains, list);
154 }
155
156 hw->pf.num_avail_ldb_queues = DLB2_MAX_NUM_LDB_QUEUES;
157 for (i = 0; i < hw->pf.num_avail_ldb_queues; i++) {
158 list = &hw->rsrcs.ldb_queues[i].func_list;
159
160 dlb2_list_add(&hw->pf.avail_ldb_queues, list);
161 }
162
163 for (i = 0; i < DLB2_NUM_COS_DOMAINS; i++)
164 hw->pf.num_avail_ldb_ports[i] =
165 DLB2_MAX_NUM_LDB_PORTS / DLB2_NUM_COS_DOMAINS;
166
167 for (i = 0; i < DLB2_MAX_NUM_LDB_PORTS; i++) {

Callers 1

dlb2_probeFunction · 0.85

Calls 7

dlb2_init_fn_rsrc_listsFunction · 0.85
dlb2_list_addFunction · 0.85
dlb2_bitmap_allocFunction · 0.85
dlb2_bitmap_fillFunction · 0.85
dlb2_bitmap_zeroFunction · 0.85
dlb2_resource_freeFunction · 0.85

Tested by

no test coverage detected