MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bnxt_link_update_op

Function bnxt_link_update_op

dpdk/drivers/net/bnxt/bnxt_ethdev.c:1845–1896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1843}
1844
1845int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
1846{
1847 int rc = 0;
1848 struct bnxt *bp = eth_dev->data->dev_private;
1849 struct rte_eth_link new;
1850 int cnt = wait_to_complete ? BNXT_MAX_LINK_WAIT_CNT :
1851 BNXT_MIN_LINK_WAIT_CNT;
1852
1853 rc = is_bnxt_in_error(bp);
1854 if (rc)
1855 return rc;
1856
1857 memset(&new, 0, sizeof(new));
1858
1859 if (bp->link_info == NULL)
1860 goto out;
1861
1862 /* Only single function PF can bring the phy down.
1863 * In certain scenarios, device is not obliged link down even when forced.
1864 * When port is stopped, report link down in those cases.
1865 */
1866 if (!eth_dev->data->dev_started &&
1867 (!BNXT_SINGLE_PF(bp) || bnxt_force_link_config(bp)))
1868 goto out;
1869
1870 do {
1871 /* Retrieve link info from hardware */
1872 rc = bnxt_get_hwrm_link_config(bp, &new);
1873 if (rc) {
1874 new.link_speed = RTE_ETH_LINK_SPEED_100M;
1875 new.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
1876 PMD_DRV_LOG(ERR,
1877 "Failed to retrieve link rc = 0x%x!\n", rc);
1878 goto out;
1879 }
1880
1881 if (!wait_to_complete || new.link_status)
1882 break;
1883
1884 rte_delay_ms(BNXT_LINK_WAIT_INTERVAL);
1885 } while (cnt--);
1886
1887out:
1888 /* Timed out or success */
1889 if (new.link_status != eth_dev->data->dev_link.link_status ||
1890 new.link_speed != eth_dev->data->dev_link.link_speed) {
1891 rte_eth_linkstatus_set(eth_dev, &new);
1892 bnxt_print_link_info(eth_dev);
1893 }
1894
1895 return rc;
1896}
1897
1898static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
1899{

Callers 3

bnxt_handle_async_eventFunction · 0.85
bnxt_dev_start_opFunction · 0.85
bnxt_rep_link_update_opFunction · 0.85

Calls 7

is_bnxt_in_errorFunction · 0.85
memsetFunction · 0.85
bnxt_force_link_configFunction · 0.85
rte_delay_msFunction · 0.85
rte_eth_linkstatus_setFunction · 0.85
bnxt_print_link_infoFunction · 0.85

Tested by

no test coverage detected