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

Function sfc_eth_dev_create_representors

dpdk/drivers/net/sfc/sfc_ethdev.c:3470–3539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3468}
3469
3470static int
3471sfc_eth_dev_create_representors(struct rte_eth_dev *dev,
3472 const struct rte_eth_devargs *eth_da)
3473{
3474 efx_pcie_interface_t intf;
3475 const efx_nic_cfg_t *encp;
3476 struct sfc_adapter *sa;
3477 uint16_t switch_domain_id;
3478 uint16_t i;
3479 int rc;
3480
3481 sa = sfc_adapter_by_eth_dev(dev);
3482 switch_domain_id = sa->mae.switch_domain_id;
3483
3484 switch (eth_da->type) {
3485 case RTE_ETH_REPRESENTOR_NONE:
3486 return 0;
3487 case RTE_ETH_REPRESENTOR_PF:
3488 case RTE_ETH_REPRESENTOR_VF:
3489 break;
3490 case RTE_ETH_REPRESENTOR_SF:
3491 sfc_err(sa, "SF representors are not supported");
3492 return -ENOTSUP;
3493 default:
3494 sfc_err(sa, "unknown representor type: %d",
3495 eth_da->type);
3496 return -ENOTSUP;
3497 }
3498
3499 if (!sa->switchdev) {
3500 sfc_err(sa, "cannot create representors in non-switchdev mode");
3501 return -EINVAL;
3502 }
3503
3504 if (!sfc_repr_available(sfc_sa2shared(sa))) {
3505 sfc_err(sa, "cannot create representors: unsupported");
3506
3507 return -ENOTSUP;
3508 }
3509
3510 /*
3511 * This is needed to construct the DPDK controller -> EFX interface
3512 * mapping.
3513 */
3514 sfc_adapter_lock(sa);
3515 rc = sfc_process_mport_journal(sa);
3516 sfc_adapter_unlock(sa);
3517 if (rc != 0) {
3518 SFC_ASSERT(rc > 0);
3519 return -rc;
3520 }
3521
3522 if (eth_da->nb_mh_controllers > 0) {
3523 for (i = 0; i < eth_da->nb_mh_controllers; i++) {
3524 rc = sfc_mae_switch_domain_get_intf(switch_domain_id,
3525 eth_da->mh_controllers[i],
3526 &intf);
3527 if (rc != 0) {

Callers 1

sfc_eth_dev_pci_probeFunction · 0.85

Calls 7

sfc_adapter_by_eth_devFunction · 0.85
sfc_repr_availableFunction · 0.85
sfc_sa2sharedFunction · 0.85
efx_nic_cfg_getFunction · 0.85

Tested by

no test coverage detected