@@ -1783,42 +1783,43 @@ static void __rtl8169_set_features(struct net_device *dev,
1783
1783
netdev_features_t features )
1784
1784
{
1785
1785
struct rtl8169_private * tp = netdev_priv (dev );
1786
- netdev_features_t changed = features ^ dev -> features ;
1787
1786
void __iomem * ioaddr = tp -> mmio_addr ;
1787
+ u32 rx_config ;
1788
1788
1789
- if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM |
1790
- NETIF_F_HW_VLAN_CTAG_RX )))
1791
- return ;
1789
+ rx_config = RTL_R32 (RxConfig );
1790
+ if (features & NETIF_F_RXALL )
1791
+ rx_config |= (AcceptErr | AcceptRunt );
1792
+ else
1793
+ rx_config &= ~(AcceptErr | AcceptRunt );
1792
1794
1793
- if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX )) {
1794
- if (features & NETIF_F_RXCSUM )
1795
- tp -> cp_cmd |= RxChkSum ;
1796
- else
1797
- tp -> cp_cmd &= ~RxChkSum ;
1795
+ RTL_W32 (RxConfig , rx_config );
1798
1796
1799
- if (features & NETIF_F_HW_VLAN_CTAG_RX )
1800
- tp -> cp_cmd |= RxVlan ;
1801
- else
1802
- tp -> cp_cmd &= ~RxVlan ;
1797
+ if (features & NETIF_F_RXCSUM )
1798
+ tp -> cp_cmd |= RxChkSum ;
1799
+ else
1800
+ tp -> cp_cmd &= ~RxChkSum ;
1803
1801
1804
- RTL_W16 ( CPlusCmd , tp -> cp_cmd );
1805
- RTL_R16 ( CPlusCmd ) ;
1806
- }
1807
- if ( changed & NETIF_F_RXALL ) {
1808
- int tmp = ( RTL_R32 ( RxConfig ) & ~( AcceptErr | AcceptRunt ));
1809
- if ( features & NETIF_F_RXALL )
1810
- tmp |= ( AcceptErr | AcceptRunt );
1811
- RTL_W32 ( RxConfig , tmp );
1812
- }
1802
+ if ( features & NETIF_F_HW_VLAN_CTAG_RX )
1803
+ tp -> cp_cmd |= RxVlan ;
1804
+ else
1805
+ tp -> cp_cmd &= ~ RxVlan ;
1806
+
1807
+ tp -> cp_cmd |= RTL_R16 ( CPlusCmd ) & ~( RxVlan | RxChkSum );
1808
+
1809
+ RTL_W16 ( CPlusCmd , tp -> cp_cmd );
1810
+ RTL_R16 ( CPlusCmd );
1813
1811
}
1814
1812
1815
1813
static int rtl8169_set_features (struct net_device * dev ,
1816
1814
netdev_features_t features )
1817
1815
{
1818
1816
struct rtl8169_private * tp = netdev_priv (dev );
1819
1817
1818
+ features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX ;
1819
+
1820
1820
rtl_lock_work (tp );
1821
- __rtl8169_set_features (dev , features );
1821
+ if (features ^ dev -> features );
1822
+ __rtl8169_set_features (dev , features );
1822
1823
rtl_unlock_work (tp );
1823
1824
1824
1825
return 0 ;
@@ -6707,12 +6708,7 @@ static int rtl_open(struct net_device *dev)
6707
6708
6708
6709
rtl8169_init_phy (dev , tp );
6709
6710
6710
- if (dev -> features & NETIF_F_HW_VLAN_CTAG_RX )
6711
- tp -> cp_cmd |= RxVlan ;
6712
- else
6713
- tp -> cp_cmd &= ~RxVlan ;
6714
-
6715
- RTL_W16 (CPlusCmd , tp -> cp_cmd );
6711
+ __rtl8169_set_features (dev , dev -> features );
6716
6712
6717
6713
rtl_pll_power_up (tp );
6718
6714
@@ -7123,8 +7119,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
7123
7119
}
7124
7120
}
7125
7121
7126
- static int
7127
- rtl_init_one (struct pci_dev * pdev , const struct pci_device_id * ent )
7122
+ static int rtl_init_one (struct pci_dev * pdev , const struct pci_device_id * ent )
7128
7123
{
7129
7124
const struct rtl_cfg_info * cfg = rtl_cfg_infos + ent -> driver_data ;
7130
7125
const unsigned int region = cfg -> region ;
@@ -7199,7 +7194,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7199
7194
goto err_out_mwi_2 ;
7200
7195
}
7201
7196
7202
- tp -> cp_cmd = RxChkSum ;
7197
+ tp -> cp_cmd = 0 ;
7203
7198
7204
7199
if ((sizeof (dma_addr_t ) > 4 ) &&
7205
7200
!pci_set_dma_mask (pdev , DMA_BIT_MASK (64 )) && use_dac ) {
@@ -7240,13 +7235,6 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7240
7235
7241
7236
pci_set_master (pdev );
7242
7237
7243
- /*
7244
- * Pretend we are using VLANs; This bypasses a nasty bug where
7245
- * Interrupts stop flowing on high load on 8110SCd controllers.
7246
- */
7247
- if (tp -> mac_version == RTL_GIGA_MAC_VER_05 )
7248
- tp -> cp_cmd |= RxVlan ;
7249
-
7250
7238
rtl_init_mdio_ops (tp );
7251
7239
rtl_init_pll_power_ops (tp );
7252
7240
rtl_init_jumbo_ops (tp );
@@ -7307,8 +7295,14 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7307
7295
dev -> vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
7308
7296
NETIF_F_HIGHDMA ;
7309
7297
7298
+ tp -> cp_cmd |= RxChkSum | RxVlan ;
7299
+
7300
+ /*
7301
+ * Pretend we are using VLANs; This bypasses a nasty bug where
7302
+ * Interrupts stop flowing on high load on 8110SCd controllers.
7303
+ */
7310
7304
if (tp -> mac_version == RTL_GIGA_MAC_VER_05 )
7311
- /* 8110SCd requires hardware Rx VLAN - disallow toggling */
7305
+ /* Disallow toggling */
7312
7306
dev -> hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX ;
7313
7307
7314
7308
if (tp -> txd_version == RTL_TD_0 )
0 commit comments