| 245 | } |
| 246 | |
| 247 | static int |
| 248 | nfp_netvf_init(struct rte_eth_dev *eth_dev) |
| 249 | { |
| 250 | int err; |
| 251 | uint16_t port; |
| 252 | uint32_t start_q; |
| 253 | struct nfp_hw *hw; |
| 254 | struct nfp_net_hw *net_hw; |
| 255 | uint64_t tx_bar_off = 0; |
| 256 | uint64_t rx_bar_off = 0; |
| 257 | struct rte_pci_device *pci_dev; |
| 258 | const struct nfp_dev_info *dev_info; |
| 259 | |
| 260 | port = eth_dev->data->port_id; |
| 261 | pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); |
| 262 | |
| 263 | dev_info = nfp_dev_info_get(pci_dev->id.device_id); |
| 264 | if (dev_info == NULL) { |
| 265 | PMD_INIT_LOG(ERR, "Not supported device ID"); |
| 266 | return -ENODEV; |
| 267 | } |
| 268 | |
| 269 | net_hw = eth_dev->data->dev_private; |
| 270 | net_hw->dev_info = dev_info; |
| 271 | hw = &net_hw->super; |
| 272 | |
| 273 | hw->ctrl_bar = pci_dev->mem_resource[0].addr; |
| 274 | if (hw->ctrl_bar == NULL) { |
| 275 | PMD_DRV_LOG(ERR, "hw->super.ctrl_bar is NULL. BAR0 not configured"); |
| 276 | return -ENODEV; |
| 277 | } |
| 278 | |
| 279 | PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar); |
| 280 | |
| 281 | err = nfp_net_common_init(pci_dev, net_hw); |
| 282 | if (err != 0) |
| 283 | return err; |
| 284 | |
| 285 | nfp_netvf_ethdev_ops_mount(net_hw, eth_dev); |
| 286 | |
| 287 | /* For secondary processes, the primary has done all the work */ |
| 288 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) |
| 289 | return 0; |
| 290 | |
| 291 | net_hw->eth_xstats_base = rte_malloc("rte_eth_xstat", |
| 292 | sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0); |
| 293 | if (net_hw->eth_xstats_base == NULL) { |
| 294 | PMD_INIT_LOG(ERR, "No memory for xstats base values on device %s!", |
| 295 | pci_dev->device.name); |
| 296 | return -ENOMEM; |
| 297 | } |
| 298 | |
| 299 | /* Work out where in the BAR the queues start. */ |
| 300 | start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ); |
| 301 | tx_bar_off = nfp_qcp_queue_offset(dev_info, start_q); |
| 302 | start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_RXQ); |
| 303 | rx_bar_off = nfp_qcp_queue_offset(dev_info, start_q); |
| 304 |
nothing calls this directly
no test coverage detected