net: hns: fix the wrong speed for bond
[deliverable/linux.git] / drivers / net / ethernet / hisilicon / hns / hns_enet.c
index ad742a6f587952f0d44826070561ed9d83c39832..cef9d12f0d7ddcc409f3cbbd95975ecef96dbc94 100644 (file)
@@ -600,6 +600,7 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data,
                ring->stats.sw_err_cnt++;
                return -ENOMEM;
        }
+       skb_reset_mac_header(skb);
 
        prefetchw(skb->data);
        length = le16_to_cpu(desc->rx.pkt_len);
@@ -990,8 +991,26 @@ 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 (priv->phy) {
+               h->dev->ops->adjust_link(h, ndev->phydev->speed,
+                                        ndev->phydev->duplex);
+               state = priv->phy->link;
+       }
+       state = state && h->dev->ops->get_status(h);
 
-       h->dev->ops->adjust_link(h, ndev->phydev->speed, ndev->phydev->duplex);
+       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;
+       }
 }
 
 /**
@@ -1576,27 +1595,14 @@ static void hns_nic_update_link_status(struct net_device *netdev)
        struct hns_nic_priv *priv = netdev_priv(netdev);
 
        struct hnae_handle *h = priv->ae_handle;
-       int state = 1;
 
-       if (priv->phy) {
-               if (!genphy_update_link(priv->phy))
-                       state = priv->phy->link;
-               else
-                       state = 0;
-       }
-       state = state && h->dev->ops->get_status(h);
+       if (h->phy_dev) {
+               if (h->phy_if != PHY_INTERFACE_MODE_XGMII)
+                       return;
 
-       if (state != priv->link) {
-               if (state) {
-                       netif_carrier_on(netdev);
-                       netif_tx_wake_all_queues(netdev);
-                       netdev_info(netdev, "link up\n");
-               } else {
-                       netif_carrier_off(netdev);
-                       netdev_info(netdev, "link down\n");
-               }
-               priv->link = state;
+               (void)genphy_read_status(h->phy_dev);
        }
+       hns_nic_adjust_link(netdev);
 }
 
 /* for dumping key regs*/
@@ -1632,7 +1638,7 @@ static void hns_nic_dump(struct hns_nic_priv *priv)
        }
 }
 
-/* for resetting suntask*/
+/* for resetting subtask */
 static void hns_nic_reset_subtask(struct hns_nic_priv *priv)
 {
        enum hnae_port_type type = priv->ae_handle->port_type;
@@ -1971,7 +1977,7 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
        if (!dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)))
                dev_dbg(dev, "set mask to 64bit\n");
        else
-               dev_err(dev, "set mask to 32bit fail!\n");
+               dev_err(dev, "set mask to 64bit fail!\n");
 
        /* carrier off reporting is important to ethtool even BEFORE open */
        netif_carrier_off(ndev);
This page took 0.03033 seconds and 5 git commands to generate.