diff options
Diffstat (limited to 'drivers/net/ethernet/realtek/r8169.c')
-rw-r--r-- | drivers/net/ethernet/realtek/r8169.c | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 02dd92ac1764..1d81238fcb93 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -1847,33 +1847,31 @@ static void __rtl8169_set_features(struct net_device *dev, | |||
1847 | netdev_features_t features) | 1847 | netdev_features_t features) |
1848 | { | 1848 | { |
1849 | struct rtl8169_private *tp = netdev_priv(dev); | 1849 | struct rtl8169_private *tp = netdev_priv(dev); |
1850 | netdev_features_t changed = features ^ dev->features; | ||
1851 | void __iomem *ioaddr = tp->mmio_addr; | 1850 | void __iomem *ioaddr = tp->mmio_addr; |
1851 | u32 rx_config; | ||
1852 | 1852 | ||
1853 | if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM | | 1853 | rx_config = RTL_R32(RxConfig); |
1854 | NETIF_F_HW_VLAN_CTAG_RX))) | 1854 | if (features & NETIF_F_RXALL) |
1855 | return; | 1855 | rx_config |= (AcceptErr | AcceptRunt); |
1856 | else | ||
1857 | rx_config &= ~(AcceptErr | AcceptRunt); | ||
1856 | 1858 | ||
1857 | if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX)) { | 1859 | RTL_W32(RxConfig, rx_config); |
1858 | if (features & NETIF_F_RXCSUM) | ||
1859 | tp->cp_cmd |= RxChkSum; | ||
1860 | else | ||
1861 | tp->cp_cmd &= ~RxChkSum; | ||
1862 | 1860 | ||
1863 | if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) | 1861 | if (features & NETIF_F_RXCSUM) |
1864 | tp->cp_cmd |= RxVlan; | 1862 | tp->cp_cmd |= RxChkSum; |
1865 | else | 1863 | else |
1866 | tp->cp_cmd &= ~RxVlan; | 1864 | tp->cp_cmd &= ~RxChkSum; |
1867 | 1865 | ||
1868 | RTL_W16(CPlusCmd, tp->cp_cmd); | 1866 | if (features & NETIF_F_HW_VLAN_CTAG_RX) |
1869 | RTL_R16(CPlusCmd); | 1867 | tp->cp_cmd |= RxVlan; |
1870 | } | 1868 | else |
1871 | if (changed & NETIF_F_RXALL) { | 1869 | tp->cp_cmd &= ~RxVlan; |
1872 | int tmp = (RTL_R32(RxConfig) & ~(AcceptErr | AcceptRunt)); | 1870 | |
1873 | if (features & NETIF_F_RXALL) | 1871 | tp->cp_cmd |= RTL_R16(CPlusCmd) & ~(RxVlan | RxChkSum); |
1874 | tmp |= (AcceptErr | AcceptRunt); | 1872 | |
1875 | RTL_W32(RxConfig, tmp); | 1873 | RTL_W16(CPlusCmd, tp->cp_cmd); |
1876 | } | 1874 | RTL_R16(CPlusCmd); |
1877 | } | 1875 | } |
1878 | 1876 | ||
1879 | static int rtl8169_set_features(struct net_device *dev, | 1877 | static int rtl8169_set_features(struct net_device *dev, |
@@ -1881,8 +1879,11 @@ static int rtl8169_set_features(struct net_device *dev, | |||
1881 | { | 1879 | { |
1882 | struct rtl8169_private *tp = netdev_priv(dev); | 1880 | struct rtl8169_private *tp = netdev_priv(dev); |
1883 | 1881 | ||
1882 | features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; | ||
1883 | |||
1884 | rtl_lock_work(tp); | 1884 | rtl_lock_work(tp); |
1885 | __rtl8169_set_features(dev, features); | 1885 | if (features ^ dev->features) |
1886 | __rtl8169_set_features(dev, features); | ||
1886 | rtl_unlock_work(tp); | 1887 | rtl_unlock_work(tp); |
1887 | 1888 | ||
1888 | return 0; | 1889 | return 0; |
@@ -7531,8 +7532,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp) | |||
7531 | } | 7532 | } |
7532 | } | 7533 | } |
7533 | 7534 | ||
7534 | static int | 7535 | static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
7535 | rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
7536 | { | 7536 | { |
7537 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; | 7537 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; |
7538 | const unsigned int region = cfg->region; | 7538 | const unsigned int region = cfg->region; |
@@ -7607,7 +7607,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7607 | goto err_out_mwi_2; | 7607 | goto err_out_mwi_2; |
7608 | } | 7608 | } |
7609 | 7609 | ||
7610 | tp->cp_cmd = RxChkSum; | 7610 | tp->cp_cmd = 0; |
7611 | 7611 | ||
7612 | if ((sizeof(dma_addr_t) > 4) && | 7612 | if ((sizeof(dma_addr_t) > 4) && |
7613 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | 7613 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { |
@@ -7648,13 +7648,6 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7648 | 7648 | ||
7649 | pci_set_master(pdev); | 7649 | pci_set_master(pdev); |
7650 | 7650 | ||
7651 | /* | ||
7652 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7653 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7654 | */ | ||
7655 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
7656 | tp->cp_cmd |= RxVlan; | ||
7657 | |||
7658 | rtl_init_mdio_ops(tp); | 7651 | rtl_init_mdio_ops(tp); |
7659 | rtl_init_pll_power_ops(tp); | 7652 | rtl_init_pll_power_ops(tp); |
7660 | rtl_init_jumbo_ops(tp); | 7653 | rtl_init_jumbo_ops(tp); |
@@ -7738,8 +7731,14 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7738 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | 7731 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | |
7739 | NETIF_F_HIGHDMA; | 7732 | NETIF_F_HIGHDMA; |
7740 | 7733 | ||
7734 | tp->cp_cmd |= RxChkSum | RxVlan; | ||
7735 | |||
7736 | /* | ||
7737 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7738 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7739 | */ | ||
7741 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | 7740 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) |
7742 | /* 8110SCd requires hardware Rx VLAN - disallow toggling */ | 7741 | /* Disallow toggling */ |
7743 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; | 7742 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; |
7744 | 7743 | ||
7745 | if (tp->txd_version == RTL_TD_0) | 7744 | if (tp->txd_version == RTL_TD_0) |