* * This routine disables all traffic on the adapter by issuing a * global reset on the MAC. * **********************************************************************/
| 1420 | * |
| 1421 | **********************************************************************/ |
| 1422 | static int |
| 1423 | eth_igb_stop(struct rte_eth_dev *dev) |
| 1424 | { |
| 1425 | struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); |
| 1426 | struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); |
| 1427 | struct rte_eth_link link; |
| 1428 | struct rte_intr_handle *intr_handle = pci_dev->intr_handle; |
| 1429 | struct e1000_adapter *adapter = |
| 1430 | E1000_DEV_PRIVATE(dev->data->dev_private); |
| 1431 | |
| 1432 | /* |
| 1433 | * This function calls into the base driver, which in turn will use |
| 1434 | * function pointers, which are not guaranteed to be valid in secondary |
| 1435 | * processes, so avoid using this function in secondary processes. |
| 1436 | */ |
| 1437 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) |
| 1438 | return -E_RTE_SECONDARY; |
| 1439 | |
| 1440 | if (adapter->stopped) |
| 1441 | return 0; |
| 1442 | |
| 1443 | eth_igb_rxtx_control(dev, false); |
| 1444 | |
| 1445 | igb_intr_disable(dev); |
| 1446 | |
| 1447 | /* disable intr eventfd mapping */ |
| 1448 | rte_intr_disable(intr_handle); |
| 1449 | |
| 1450 | igb_pf_reset_hw(hw); |
| 1451 | E1000_WRITE_REG(hw, E1000_WUC, 0); |
| 1452 | |
| 1453 | /* Set bit for Go Link disconnect if PHY reset is not blocked */ |
| 1454 | if (hw->mac.type >= e1000_82580 && |
| 1455 | (e1000_check_reset_block(hw) != E1000_BLK_PHY_RESET)) { |
| 1456 | uint32_t phpm_reg; |
| 1457 | |
| 1458 | phpm_reg = E1000_READ_REG(hw, E1000_82580_PHY_POWER_MGMT); |
| 1459 | phpm_reg |= E1000_82580_PM_GO_LINKD; |
| 1460 | E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, phpm_reg); |
| 1461 | } |
| 1462 | |
| 1463 | /* Power down the phy. Needed to make the link go Down */ |
| 1464 | eth_igb_dev_set_link_down(dev); |
| 1465 | |
| 1466 | igb_dev_clear_queues(dev); |
| 1467 | |
| 1468 | /* clear the recorded link status */ |
| 1469 | memset(&link, 0, sizeof(link)); |
| 1470 | rte_eth_linkstatus_set(dev, &link); |
| 1471 | |
| 1472 | if (!rte_intr_allow_others(intr_handle)) |
| 1473 | /* resume to the default handler */ |
| 1474 | rte_intr_callback_register(intr_handle, |
| 1475 | eth_igb_interrupt_handler, |
| 1476 | (void *)dev); |
| 1477 | |
| 1478 | /* Clean datapath event and queue/vec mapping */ |
| 1479 | rte_intr_efd_disable(intr_handle); |
no test coverage detected