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

Function cpfl_adapter_ext_init

dpdk/drivers/net/cpfl/cpfl_ethdev.c:2273–2364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2271
2272
2273static int
2274cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adapter,
2275 struct cpfl_devargs *devargs)
2276{
2277 struct idpf_adapter *base = &adapter->base;
2278 struct idpf_hw *hw = &base->hw;
2279 int ret = 0;
2280
2281#ifndef RTE_HAS_JANSSON
2282 RTE_SET_USED(devargs);
2283#endif
2284
2285 hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
2286 hw->hw_addr_len = pci_dev->mem_resource[0].len;
2287 hw->back = base;
2288 hw->vendor_id = pci_dev->id.vendor_id;
2289 hw->device_id = pci_dev->id.device_id;
2290 hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
2291
2292 strncpy(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE);
2293
2294 rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities));
2295
2296 ret = idpf_adapter_init(base);
2297 if (ret != 0) {
2298 PMD_INIT_LOG(ERR, "Failed to init adapter");
2299 goto err_adapter_init;
2300 }
2301
2302 ret = cpfl_vport_map_init(adapter);
2303 if (ret) {
2304 PMD_INIT_LOG(ERR, "Failed to init vport map");
2305 goto err_vport_map_init;
2306 }
2307
2308 ret = cpfl_repr_allowlist_init(adapter);
2309 if (ret) {
2310 PMD_INIT_LOG(ERR, "Failed to init representor allowlist");
2311 goto err_repr_allowlist_init;
2312 }
2313
2314 rte_eal_alarm_set(CPFL_ALARM_INTERVAL, cpfl_dev_alarm_handler, adapter);
2315
2316 adapter->max_vport_nb = adapter->base.caps.max_vports > CPFL_MAX_VPORT_NUM ?
2317 CPFL_MAX_VPORT_NUM : adapter->base.caps.max_vports;
2318
2319 adapter->vports = rte_zmalloc("vports",
2320 adapter->max_vport_nb *
2321 sizeof(*adapter->vports),
2322 0);
2323 if (adapter->vports == NULL) {
2324 PMD_INIT_LOG(ERR, "Failed to allocate vports memory");
2325 ret = -ENOMEM;
2326 goto err_vports_alloc;
2327 }
2328
2329 ret = cpfl_ctrl_path_open(adapter);
2330 if (ret) {

Callers 1

cpfl_pci_probe_firstFunction · 0.85

Calls 15

strncpyFunction · 0.85
idpf_adapter_initFunction · 0.85
cpfl_vport_map_initFunction · 0.85
cpfl_repr_allowlist_initFunction · 0.85
rte_zmallocFunction · 0.85
cpfl_ctrl_path_openFunction · 0.85
cpfl_flow_initFunction · 0.85
cpfl_ctrl_path_closeFunction · 0.85
rte_freeFunction · 0.85
cpfl_vport_map_uninitFunction · 0.85
idpf_adapter_deinitFunction · 0.85

Tested by

no test coverage detected