* It gets and then prints the link status. * * @param dev * Pointer to struct rte_eth_dev. * * @return * - On success, zero. * - On failure, a negative value. */
| 1319 | * - On failure, a negative value. |
| 1320 | */ |
| 1321 | static void |
| 1322 | atl_dev_link_status_print(struct rte_eth_dev *dev) |
| 1323 | { |
| 1324 | struct rte_eth_link link; |
| 1325 | |
| 1326 | memset(&link, 0, sizeof(link)); |
| 1327 | rte_eth_linkstatus_get(dev, &link); |
| 1328 | if (link.link_status) { |
| 1329 | PMD_DRV_LOG(INFO, "Port %d: Link Up - speed %u Mbps - %s", |
| 1330 | (int)(dev->data->port_id), |
| 1331 | (unsigned int)link.link_speed, |
| 1332 | link.link_duplex == RTE_ETH_LINK_FULL_DUPLEX ? |
| 1333 | "full-duplex" : "half-duplex"); |
| 1334 | } else { |
| 1335 | PMD_DRV_LOG(INFO, " Port %d: Link Down", |
| 1336 | (int)(dev->data->port_id)); |
| 1337 | } |
| 1338 | |
| 1339 | |
| 1340 | #ifdef DEBUG |
| 1341 | { |
| 1342 | struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); |
| 1343 | |
| 1344 | PMD_DRV_LOG(DEBUG, "PCI Address: " PCI_PRI_FMT, |
| 1345 | pci_dev->addr.domain, |
| 1346 | pci_dev->addr.bus, |
| 1347 | pci_dev->addr.devid, |
| 1348 | pci_dev->addr.function); |
| 1349 | } |
| 1350 | #endif |
| 1351 | |
| 1352 | PMD_DRV_LOG(INFO, "Link speed:%d", link.link_speed); |
| 1353 | } |
| 1354 | |
| 1355 | /* |
| 1356 | * It executes link_update after knowing an interrupt occurred. |
no test coverage detected