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

Function sfc_rx_hash_init

dpdk/drivers/net/sfc/sfc_rx.c:1394–1448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392}
1393
1394int
1395sfc_rx_hash_init(struct sfc_adapter *sa)
1396{
1397 struct sfc_rss *rss = &sfc_sa2shared(sa)->rss;
1398 const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
1399 uint32_t alg_mask = encp->enc_rx_scale_hash_alg_mask;
1400 efx_rx_hash_alg_t alg;
1401 unsigned int flags_supp[EFX_RX_HASH_NFLAGS];
1402 unsigned int nb_flags_supp;
1403 struct sfc_rss_hf_rte_to_efx *hf_map;
1404 struct sfc_rss_hf_rte_to_efx *entry;
1405 efx_rx_hash_type_t efx_hash_types;
1406 unsigned int i;
1407 int rc;
1408
1409 if (alg_mask & (1U << EFX_RX_HASHALG_TOEPLITZ))
1410 alg = EFX_RX_HASHALG_TOEPLITZ;
1411 else if (alg_mask & (1U << EFX_RX_HASHALG_PACKED_STREAM))
1412 alg = EFX_RX_HASHALG_PACKED_STREAM;
1413 else
1414 return EINVAL;
1415
1416 rc = efx_rx_scale_hash_flags_get(sa->nic, alg, flags_supp,
1417 RTE_DIM(flags_supp), &nb_flags_supp);
1418 if (rc != 0)
1419 return rc;
1420
1421 hf_map = rte_calloc_socket("sfc-rss-hf-map",
1422 RTE_DIM(sfc_rss_hf_map),
1423 sizeof(*hf_map), 0, sa->socket_id);
1424 if (hf_map == NULL)
1425 return ENOMEM;
1426
1427 entry = hf_map;
1428 efx_hash_types = 0;
1429 for (i = 0; i < RTE_DIM(sfc_rss_hf_map); ++i) {
1430 efx_rx_hash_type_t ht;
1431
1432 ht = sfc_rx_hash_types_mask_supp(sfc_rss_hf_map[i].efx,
1433 flags_supp, nb_flags_supp);
1434 if (ht != 0) {
1435 entry->rte = sfc_rss_hf_map[i].rte;
1436 entry->efx = ht;
1437 efx_hash_types |= ht;
1438 ++entry;
1439 }
1440 }
1441
1442 rss->hash_alg = alg;
1443 rss->hf_map_nb_entries = (unsigned int)(entry - hf_map);
1444 rss->hf_map = hf_map;
1445 rss->hash_types = efx_hash_types;
1446
1447 return 0;
1448}
1449
1450void
1451sfc_rx_hash_fini(struct sfc_adapter *sa)

Callers 1

sfc_rss_attachFunction · 0.85

Calls 5

sfc_sa2sharedFunction · 0.85
efx_nic_cfg_getFunction · 0.85
rte_calloc_socketFunction · 0.85

Tested by

no test coverage detected