* Configure device link speed and setup link. * It returns 0 on success. */
| 474 | * It returns 0 on success. |
| 475 | */ |
| 476 | static int |
| 477 | atl_dev_start(struct rte_eth_dev *dev) |
| 478 | { |
| 479 | struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); |
| 480 | struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); |
| 481 | struct rte_intr_handle *intr_handle = pci_dev->intr_handle; |
| 482 | uint32_t intr_vector = 0; |
| 483 | int status; |
| 484 | int err; |
| 485 | |
| 486 | PMD_INIT_FUNC_TRACE(); |
| 487 | |
| 488 | /* set adapter started */ |
| 489 | hw->adapter_stopped = 0; |
| 490 | |
| 491 | if (dev->data->dev_conf.link_speeds & RTE_ETH_LINK_SPEED_FIXED) { |
| 492 | PMD_INIT_LOG(ERR, |
| 493 | "Invalid link_speeds for port %u, fix speed not supported", |
| 494 | dev->data->port_id); |
| 495 | return -EINVAL; |
| 496 | } |
| 497 | |
| 498 | /* disable uio/vfio intr/eventfd mapping */ |
| 499 | rte_intr_disable(intr_handle); |
| 500 | |
| 501 | /* reinitialize adapter |
| 502 | * this calls reset and start |
| 503 | */ |
| 504 | status = atl_reset_hw(hw); |
| 505 | if (status != 0) |
| 506 | return -EIO; |
| 507 | |
| 508 | err = hw_atl_b0_hw_init(hw, dev->data->mac_addrs->addr_bytes); |
| 509 | |
| 510 | hw_atl_b0_hw_start(hw); |
| 511 | /* check and configure queue intr-vector mapping */ |
| 512 | if ((rte_intr_cap_multiple(intr_handle) || |
| 513 | !RTE_ETH_DEV_SRIOV(dev).active) && |
| 514 | dev->data->dev_conf.intr_conf.rxq != 0) { |
| 515 | intr_vector = dev->data->nb_rx_queues; |
| 516 | if (intr_vector > ATL_MAX_INTR_QUEUE_NUM) { |
| 517 | PMD_INIT_LOG(ERR, "At most %d intr queues supported", |
| 518 | ATL_MAX_INTR_QUEUE_NUM); |
| 519 | return -ENOTSUP; |
| 520 | } |
| 521 | if (rte_intr_efd_enable(intr_handle, intr_vector)) { |
| 522 | PMD_INIT_LOG(ERR, "rte_intr_efd_enable failed"); |
| 523 | return -1; |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | if (rte_intr_dp_is_en(intr_handle)) { |
| 528 | if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", |
| 529 | dev->data->nb_rx_queues)) { |
| 530 | PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues" |
| 531 | " intr_vec", dev->data->nb_rx_queues); |
| 532 | return -ENOMEM; |
| 533 | } |
nothing calls this directly
no test coverage detected