aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index d88ce9fb1cbd..53b13deade95 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -744,26 +744,36 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr)
744 mdio_write(ioaddr, MII_BMCR, val & 0xffff); 744 mdio_write(ioaddr, MII_BMCR, val & 0xffff);
745} 745}
746 746
747static void rtl8169_check_link_status(struct net_device *dev, 747static void __rtl8169_check_link_status(struct net_device *dev,
748 struct rtl8169_private *tp, 748 struct rtl8169_private *tp,
749 void __iomem *ioaddr) 749 void __iomem *ioaddr,
750 bool pm)
750{ 751{
751 unsigned long flags; 752 unsigned long flags;
752 753
753 spin_lock_irqsave(&tp->lock, flags); 754 spin_lock_irqsave(&tp->lock, flags);
754 if (tp->link_ok(ioaddr)) { 755 if (tp->link_ok(ioaddr)) {
755 /* This is to cancel a scheduled suspend if there's one. */ 756 /* This is to cancel a scheduled suspend if there's one. */
756 pm_request_resume(&tp->pci_dev->dev); 757 if (pm)
758 pm_request_resume(&tp->pci_dev->dev);
757 netif_carrier_on(dev); 759 netif_carrier_on(dev);
758 netif_info(tp, ifup, dev, "link up\n"); 760 netif_info(tp, ifup, dev, "link up\n");
759 } else { 761 } else {
760 netif_carrier_off(dev); 762 netif_carrier_off(dev);
761 netif_info(tp, ifdown, dev, "link down\n"); 763 netif_info(tp, ifdown, dev, "link down\n");
762 pm_schedule_suspend(&tp->pci_dev->dev, 100); 764 if (pm)
765 pm_schedule_suspend(&tp->pci_dev->dev, 100);
763 } 766 }
764 spin_unlock_irqrestore(&tp->lock, flags); 767 spin_unlock_irqrestore(&tp->lock, flags);
765} 768}
766 769
770static void rtl8169_check_link_status(struct net_device *dev,
771 struct rtl8169_private *tp,
772 void __iomem *ioaddr)
773{
774 __rtl8169_check_link_status(dev, tp, ioaddr, false);
775}
776
767#define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) 777#define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST)
768 778
769static u32 __rtl8169_get_wol(struct rtl8169_private *tp) 779static u32 __rtl8169_get_wol(struct rtl8169_private *tp)
@@ -846,10 +856,10 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
846 else 856 else
847 tp->features &= ~RTL_FEATURE_WOL; 857 tp->features &= ~RTL_FEATURE_WOL;
848 __rtl8169_set_wol(tp, wol->wolopts); 858 __rtl8169_set_wol(tp, wol->wolopts);
849 device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
850
851 spin_unlock_irq(&tp->lock); 859 spin_unlock_irq(&tp->lock);
852 860
861 device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
862
853 return 0; 863 return 0;
854} 864}
855 865
@@ -2931,7 +2941,7 @@ static const struct rtl_cfg_info {
2931 .hw_start = rtl_hw_start_8168, 2941 .hw_start = rtl_hw_start_8168,
2932 .region = 2, 2942 .region = 2,
2933 .align = 8, 2943 .align = 8,
2934 .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | 2944 .intr_event = SYSErr | LinkChg | RxOverflow |
2935 TxErr | TxOK | RxOK | RxErr, 2945 TxErr | TxOK | RxOK | RxErr,
2936 .napi_event = TxErr | TxOK | RxOK | RxOverflow, 2946 .napi_event = TxErr | TxOK | RxOK | RxOverflow,
2937 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, 2947 .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI,
@@ -4440,8 +4450,7 @@ static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1)
4440 u32 status = opts1 & RxProtoMask; 4450 u32 status = opts1 & RxProtoMask;
4441 4451
4442 if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || 4452 if (((status == RxProtoTCP) && !(opts1 & TCPFail)) ||
4443 ((status == RxProtoUDP) && !(opts1 & UDPFail)) || 4453 ((status == RxProtoUDP) && !(opts1 & UDPFail)))
4444 ((status == RxProtoIP) && !(opts1 & IPFail)))
4445 skb->ip_summed = CHECKSUM_UNNECESSARY; 4454 skb->ip_summed = CHECKSUM_UNNECESSARY;
4446 else 4455 else
4447 skb_checksum_none_assert(skb); 4456 skb_checksum_none_assert(skb);
@@ -4588,7 +4597,8 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
4588 } 4597 }
4589 4598
4590 /* Work around for rx fifo overflow */ 4599 /* Work around for rx fifo overflow */
4591 if (unlikely(status & RxFIFOOver)) { 4600 if (unlikely(status & RxFIFOOver) &&
4601 (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
4592 netif_stop_queue(dev); 4602 netif_stop_queue(dev);
4593 rtl8169_tx_timeout(dev); 4603 rtl8169_tx_timeout(dev);
4594 break; 4604 break;
@@ -4600,7 +4610,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
4600 } 4610 }
4601 4611
4602 if (status & LinkChg) 4612 if (status & LinkChg)
4603 rtl8169_check_link_status(dev, tp, ioaddr); 4613 __rtl8169_check_link_status(dev, tp, ioaddr, true);
4604 4614
4605 /* We need to see the lastest version of tp->intr_mask to 4615 /* We need to see the lastest version of tp->intr_mask to
4606 * avoid ignoring an MSI interrupt and having to wait for 4616 * avoid ignoring an MSI interrupt and having to wait for
@@ -4890,11 +4900,7 @@ static int rtl8169_runtime_idle(struct device *device)
4890 struct net_device *dev = pci_get_drvdata(pdev); 4900 struct net_device *dev = pci_get_drvdata(pdev);
4891 struct rtl8169_private *tp = netdev_priv(dev); 4901 struct rtl8169_private *tp = netdev_priv(dev);
4892 4902
4893 if (!tp->TxDescArray) 4903 return tp->TxDescArray ? -EBUSY : 0;
4894 return 0;
4895
4896 rtl8169_check_link_status(dev, tp, tp->mmio_addr);
4897 return -EBUSY;
4898} 4904}
4899 4905
4900static const struct dev_pm_ops rtl8169_pm_ops = { 4906static const struct dev_pm_ops rtl8169_pm_ops = {