User Tools

Site Tools


phy_link_update

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
phy_link_update [2018/08/28 11:55]
rpjday [freescale/dpaa/dpaa_eth.c]
phy_link_update [2018/08/28 11:57] (current)
rpjday [freescale/ucc_geth.c]
Line 288: Line 288:
  
         if (phydev->​link) { ...         if (phydev->​link) { ...
 +</​code>​
 +
 +==== hisilicon/​hns/​hns_enet.c ====
 +
 +<​code>​
 +/**
 + ​*hns_nic_adjust_link - adjust net work mode by the phy stat or new param
 + ​*@ndev:​ net device
 + */
 +static void hns_nic_adjust_link(struct net_device *ndev)
 +{
 +        struct hns_nic_priv *priv = netdev_priv(ndev);​
 +        struct hnae_handle *h = priv->​ae_handle;​
 +        int state = 1;
 +
 +        if (ndev->​phydev) {
 +                h->​dev->​ops->​adjust_link(h,​ ndev->​phydev->​speed,​
 +                                         ​ndev->​phydev->​duplex);​
 +                state = ndev->​phydev->​link;​
 +        }
 +        state = state && h->​dev->​ops->​get_status(h);​
 +
 +        if (state != priv->​link) {
 +                if (state) {
 +                        netif_carrier_on(ndev);​
 +                        netif_tx_wake_all_queues(ndev);​
 +                        netdev_info(ndev,​ "link up\n"​);​
 +                } else {
 +                        netif_carrier_off(ndev);​
 +                        netdev_info(ndev,​ "link down\n"​);​
 +                }
 +                priv->​link = state;
 +        }
 +}
 </​code>​ </​code>​
phy_link_update.txt ยท Last modified: 2018/08/28 11:57 by rpjday