Initialize the driver for PF */
| 1246 | |
| 1247 | /* Initialize the driver for PF */ |
| 1248 | static int eth_enic_dev_init(struct rte_eth_dev *eth_dev, |
| 1249 | void *init_params __rte_unused) |
| 1250 | { |
| 1251 | struct rte_pci_device *pdev; |
| 1252 | struct rte_pci_addr *addr; |
| 1253 | struct enic *enic = pmd_priv(eth_dev); |
| 1254 | int err; |
| 1255 | |
| 1256 | ENICPMD_FUNC_TRACE(); |
| 1257 | eth_dev->dev_ops = &enicpmd_eth_dev_ops; |
| 1258 | eth_dev->rx_queue_count = enicpmd_dev_rx_queue_count; |
| 1259 | eth_dev->rx_pkt_burst = &enic_recv_pkts; |
| 1260 | eth_dev->tx_pkt_burst = &enic_xmit_pkts; |
| 1261 | eth_dev->tx_pkt_prepare = &enic_prep_pkts; |
| 1262 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) { |
| 1263 | enic_pick_tx_handler(eth_dev); |
| 1264 | enic_pick_rx_handler(eth_dev); |
| 1265 | return 0; |
| 1266 | } |
| 1267 | /* Only the primary sets up adapter and other data in shared memory */ |
| 1268 | enic->port_id = eth_dev->data->port_id; |
| 1269 | enic->rte_dev = eth_dev; |
| 1270 | enic->dev_data = eth_dev->data; |
| 1271 | |
| 1272 | pdev = RTE_ETH_DEV_TO_PCI(eth_dev); |
| 1273 | rte_eth_copy_pci_info(eth_dev, pdev); |
| 1274 | enic->pdev = pdev; |
| 1275 | addr = &pdev->addr; |
| 1276 | |
| 1277 | snprintf(enic->bdf_name, PCI_PRI_STR_SIZE, PCI_PRI_FMT, |
| 1278 | addr->domain, addr->bus, addr->devid, addr->function); |
| 1279 | |
| 1280 | err = enic_check_devargs(eth_dev); |
| 1281 | if (err) |
| 1282 | return err; |
| 1283 | err = enic_probe(enic); |
| 1284 | if (!err && enic->fm) { |
| 1285 | err = enic_fm_allocate_switch_domain(enic); |
| 1286 | if (err) |
| 1287 | ENICPMD_LOG(ERR, "failed to allocate switch domain id"); |
| 1288 | } |
| 1289 | return err; |
| 1290 | } |
| 1291 | |
| 1292 | static int eth_enic_dev_uninit(struct rte_eth_dev *eth_dev) |
| 1293 | { |
nothing calls this directly
no test coverage detected