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

Function sfc_estimate_resource_limits

dpdk/drivers/net/sfc/sfc.c:202–354  ·  view source on GitHub ↗

* Find out maximum number of receive and transmit queues which could be * advertised. * * NIC is kept initialized on success to allow other modules acquire * defaults and capabilities. */

Source from the content-addressed store, hash-verified

200 * defaults and capabilities.
201 */
202static int
203sfc_estimate_resource_limits(struct sfc_adapter *sa)
204{
205 const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
206 struct sfc_adapter_shared *sas = sfc_sa2shared(sa);
207 efx_drv_limits_t limits;
208 int rc;
209 uint32_t evq_allocated;
210 uint32_t rxq_allocated;
211 uint32_t txq_allocated;
212
213 memset(&limits, 0, sizeof(limits));
214
215 /* Request at least one Rx and Tx queue */
216 limits.edl_min_rxq_count = 1;
217 limits.edl_min_txq_count = 1;
218 /* Management event queue plus event queue for each Tx and Rx queue */
219 limits.edl_min_evq_count =
220 1 + limits.edl_min_rxq_count + limits.edl_min_txq_count;
221
222 /* Divide by number of functions to guarantee that all functions
223 * will get promised resources
224 */
225 /* FIXME Divide by number of functions (not 2) below */
226 limits.edl_max_evq_count = encp->enc_evq_limit / 2;
227 SFC_ASSERT(limits.edl_max_evq_count >= limits.edl_min_rxq_count);
228
229 /* Split equally between receive and transmit */
230 limits.edl_max_rxq_count =
231 MIN(encp->enc_rxq_limit, (limits.edl_max_evq_count - 1) / 2);
232 SFC_ASSERT(limits.edl_max_rxq_count >= limits.edl_min_rxq_count);
233
234 limits.edl_max_txq_count =
235 MIN(encp->enc_txq_limit,
236 limits.edl_max_evq_count - 1 - limits.edl_max_rxq_count);
237
238 if (sa->tso && encp->enc_fw_assisted_tso_v2_enabled)
239 limits.edl_max_txq_count =
240 MIN(limits.edl_max_txq_count,
241 encp->enc_fw_assisted_tso_v2_n_contexts /
242 encp->enc_hw_pf_count);
243
244 SFC_ASSERT(limits.edl_max_txq_count >= limits.edl_min_rxq_count);
245
246 /* Configure the minimum required resources needed for the
247 * driver to operate, and the maximum desired resources that the
248 * driver is capable of using.
249 */
250 efx_nic_set_drv_limits(sa->nic, &limits);
251
252 sfc_log_init(sa, "init nic");
253 rc = efx_nic_init(sa->nic);
254 if (rc != 0)
255 goto fail_nic_init;
256
257 /* Find resource dimensions assigned by firmware to this function */
258 rc = efx_nic_get_vi_pool(sa->nic, &evq_allocated, &rxq_allocated,
259 &txq_allocated);

Callers 1

sfc_attachFunction · 0.85

Calls 9

efx_nic_cfg_getFunction · 0.85
sfc_sa2sharedFunction · 0.85
memsetFunction · 0.85
efx_nic_set_drv_limitsFunction · 0.85
efx_nic_initFunction · 0.85
efx_nic_get_vi_poolFunction · 0.85
sfc_repr_supportedFunction · 0.85
efx_nic_finiFunction · 0.85

Tested by

no test coverage detected