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

Function sfc_eth_dev_init

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

Source from the content-addressed store, hash-verified

3107}
3108
3109static int
3110sfc_eth_dev_init(struct rte_eth_dev *dev, void *init_params)
3111{
3112 struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
3113 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
3114 struct sfc_ethdev_init_data *init_data = init_params;
3115 uint32_t logtype_main;
3116 struct sfc_adapter *sa;
3117 int rc;
3118 const efx_nic_cfg_t *encp;
3119 const struct rte_ether_addr *from;
3120 int ret;
3121
3122 if (sfc_efx_dev_class_get(pci_dev->device.devargs) !=
3123 SFC_EFX_DEV_CLASS_NET) {
3124 SFC_GENERIC_LOG(DEBUG,
3125 "Incompatible device class: skip probing, should be probed by other sfc driver.");
3126 return 1;
3127 }
3128
3129 rc = sfc_dp_mport_register();
3130 if (rc != 0)
3131 return rc;
3132
3133 sfc_register_dp();
3134
3135 logtype_main = sfc_register_logtype(&pci_dev->addr,
3136 SFC_LOGTYPE_MAIN_STR,
3137 RTE_LOG_NOTICE);
3138
3139 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
3140 return -sfc_eth_dev_secondary_init(dev, logtype_main);
3141
3142 /* Required for logging */
3143 ret = snprintf(sas->log_prefix, sizeof(sas->log_prefix),
3144 "PMD: sfc_efx " PCI_PRI_FMT " #%" PRIu16 ": ",
3145 pci_dev->addr.domain, pci_dev->addr.bus,
3146 pci_dev->addr.devid, pci_dev->addr.function,
3147 dev->data->port_id);
3148 if (ret < 0 || ret >= (int)sizeof(sas->log_prefix)) {
3149 SFC_GENERIC_LOG(ERR,
3150 "reserved log prefix is too short for " PCI_PRI_FMT,
3151 pci_dev->addr.domain, pci_dev->addr.bus,
3152 pci_dev->addr.devid, pci_dev->addr.function);
3153 return -EINVAL;
3154 }
3155 sas->pci_addr = pci_dev->addr;
3156 sas->port_id = dev->data->port_id;
3157
3158 /*
3159 * Allocate process private data from heap, since it should not
3160 * be located in shared memory allocated using rte_malloc() API.
3161 */
3162 sa = calloc(1, sizeof(*sa));
3163 if (sa == NULL) {
3164 rc = ENOMEM;
3165 goto fail_alloc_sa;
3166 }

Callers

nothing calls this directly

Calls 15

sfc_efx_dev_class_getFunction · 0.85
sfc_dp_mport_registerFunction · 0.85
sfc_register_dpFunction · 0.85
sfc_register_logtypeFunction · 0.85
rte_eal_process_typeFunction · 0.85
snprintfFunction · 0.85
callocFunction · 0.85
rte_eth_copy_pci_infoFunction · 0.85
sfc_kvargs_parseFunction · 0.85
rte_zmallocFunction · 0.85

Tested by

no test coverage detected