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
Next revision
Previous revision
phy_link_update [2018/08/28 11:52]
rpjday [freescale/fs_enet/fs_enet-main.c]
phy_link_update [2018/08/28 11:57] (current)
rpjday [freescale/ucc_geth.c]
Line 249: Line 249:
                                        ​phydev->​speed != priv->​oldspeed))))                                        ​phydev->​speed != priv->​oldspeed))))
                 gfar_update_link_state(priv);​                 gfar_update_link_state(priv);​
 +}
 +</​code>​
 +
 +==== freescale/​dpaa/​dpaa_eth.c ====
 +
 +<​code>​
 +static void dpaa_adjust_link(struct net_device *net_dev)
 +{
 +        struct mac_device *mac_dev;
 +        struct dpaa_priv *priv;
 +
 +        priv = netdev_priv(net_dev);​
 +        mac_dev = priv->​mac_dev;​
 +        mac_dev->​adjust_link(mac_dev);​
 +}
 +</​code>​
 +
 +==== freescale/​ucc_geth.c ====
 +
 +<​code>​
 +/* Called every time the controller might need to be made
 + * aware of new link state. ​ The PHY code conveys this
 + * information through variables in the ugeth structure, and this
 + * function converts those variables into the appropriate
 + * register values, and can bring down the device if needed.
 + */
 +
 +static void adjust_link(struct net_device *dev)
 +{
 +        struct ucc_geth_private *ugeth = netdev_priv(dev);​
 +        struct ucc_geth __iomem *ug_regs;
 +        struct ucc_fast __iomem *uf_regs;
 +        struct phy_device *phydev = ugeth->​phydev;​
 +        int new_state = 0;
 +
 +        ug_regs = ugeth->​ug_regs;​
 +        uf_regs = ugeth->​uccf->​uf_regs;​
 +
 +        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.1535457170.txt.gz ยท Last modified: 2018/08/28 11:52 by rpjday