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

Function eth_ena_dev_init

dpdk/drivers/net/ena/ena_ethdev.c:2168–2359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2166}
2167
2168static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
2169{
2170 struct ena_calc_queue_size_ctx calc_queue_ctx = { 0 };
2171 struct rte_pci_device *pci_dev;
2172 struct rte_intr_handle *intr_handle;
2173 struct ena_adapter *adapter = eth_dev->data->dev_private;
2174 struct ena_com_dev *ena_dev = &adapter->ena_dev;
2175 struct ena_com_dev_get_features_ctx get_feat_ctx;
2176 struct ena_llq_configurations llq_config;
2177 const char *queue_type_str;
2178 uint32_t max_num_io_queues;
2179 int rc;
2180 static int adapters_found;
2181 bool disable_meta_caching;
2182
2183 eth_dev->dev_ops = &ena_dev_ops;
2184 eth_dev->rx_pkt_burst = &eth_ena_recv_pkts;
2185 eth_dev->tx_pkt_burst = &eth_ena_xmit_pkts;
2186 eth_dev->tx_pkt_prepare = &eth_ena_prep_pkts;
2187
2188 rc = ena_init_once();
2189 if (rc != 0)
2190 return rc;
2191
2192 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
2193 return 0;
2194
2195 eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
2196
2197 memset(adapter, 0, sizeof(struct ena_adapter));
2198 ena_dev = &adapter->ena_dev;
2199
2200 adapter->edev_data = eth_dev->data;
2201
2202 pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
2203
2204 PMD_INIT_LOG(INFO, "Initializing " PCI_PRI_FMT "\n",
2205 pci_dev->addr.domain,
2206 pci_dev->addr.bus,
2207 pci_dev->addr.devid,
2208 pci_dev->addr.function);
2209
2210 intr_handle = pci_dev->intr_handle;
2211
2212 adapter->regs = pci_dev->mem_resource[ENA_REGS_BAR].addr;
2213 adapter->dev_mem_base = pci_dev->mem_resource[ENA_MEM_BAR].addr;
2214
2215 if (!adapter->regs) {
2216 PMD_INIT_LOG(CRIT, "Failed to access registers BAR(%d)\n",
2217 ENA_REGS_BAR);
2218 return -ENXIO;
2219 }
2220
2221 ena_dev->reg_bar = adapter->regs;
2222 /* Pass device data as a pointer which can be passed to the IO functions
2223 * by the ena_com (for example - the memory allocation).
2224 */
2225 ena_dev->dmadev = eth_dev->data;

Callers 1

ena_dev_resetFunction · 0.85

Calls 15

ena_init_onceFunction · 0.85
rte_eal_process_typeFunction · 0.85
memsetFunction · 0.85
snprintfFunction · 0.85
ena_parse_devargsFunction · 0.85
ena_device_initFunction · 0.85
ena_calc_io_queue_sizeFunction · 0.85
ena_init_ringsFunction · 0.85

Tested by

no test coverage detected