Overview

Request 6052 (accepted)

- Update to new version r8168-8.053.00
- Remove patches now upstream
* r8168-gcc14.patch
- Port patches
* r8168-kernel_version.patch
* r8168-support-dev0x8136.patch
* r8168-support-linux-5.19.patch
- Add patch r8168-support-ethtool_keee.patch
* Port struct ethtool_eee to new kernel struct ethtool_eee
and hopefully this works

Submit package home:bitstreamout:Essentials / r8168 to package Essentials / r8168

r8168.changes Changed
x
 
1
@@ -1,4 +1,18 @@
2
 -------------------------------------------------------------------
3
+Tue May 21 10:35:10 UTC 2024 - Dr. Werner Fink <werner@suse.de>
4
+
5
+- Update to new version r8168-8.053.00
6
+- Remove patches now upstream
7
+  * r8168-gcc14.patch
8
+- Port patches
9
+  * r8168-kernel_version.patch
10
+  * r8168-support-dev0x8136.patch
11
+  * r8168-support-linux-5.19.patch
12
+- Add patch r8168-support-ethtool_keee.patch
13
+  * Port struct ethtool_eee to new kernel struct ethtool_eee
14
+    and hopefully this works
15
+
16
+-------------------------------------------------------------------
17
 Thu Mar 28 12:50:15 UTC 2024 - Dr. Werner Fink <werner@suse.de>
18
 
19
 - Use kernel version of the include diretory instead of the used
20
r8168.spec Changed
39
 
1
@@ -18,7 +18,7 @@
2
 
3
 #!BuildIgnore: enough-build-resources
4
 Name:           r8168
5
-Version:        8.052.01
6
+Version:        8.053.00
7
 Release:        0
8
 Summary:        Device driver for RealTek Gigabit Ethernet controllers
9
 License:        GPL-2.0-or-later
10
@@ -32,7 +32,7 @@
11
 Patch0:         r8168-kernel_version.patch
12
 Patch1:         r8168-configuration.patch
13
 Patch2:         r8168-support-linux-5.19.patch
14
-Patch3:         r8168-gcc14.patch
15
+Patch3:         r8168-support-ethtool_keee.patch
16
 Patch4:         r8168-support-dev0x8136.patch
17
 Patch5:         r8168-support-linux-L15.5.patch
18
 BuildRequires:  kernel-source
19
@@ -65,7 +65,6 @@
20
 %patch -P 0 -b .p0
21
 %patch -P 1 -b .p1
22
 %patch -P 2 -p1 -b .p2
23
-%patch -P 3 -b .p3
24
 %patch -P 4 -p1 -b .p4
25
 if test -e /usr/src/linux/include/linux/ethtool.h
26
 then
27
@@ -74,6 +73,11 @@
28
     then
29
 %patch -P 5 -b .p5
30
     fi
31
+    argc=$(sed -rn '/ethtool_keee/p' /usr/src/linux/include/linux/ethtool.h | wc -l)
32
+    if test -n "$argc" -a "$argc" -eq 3
33
+    then
34
+%patch -P 3 -p1 -b .p3
35
+    fi
36
 fi
37
 if test -e /usr/src/linux/include/net/gso.h
38
 then
39
r8168-gcc14.patch Deleted
27
 
1
@@ -1,25 +0,0 @@
2
----
3
- src/r8168_n.c |    5 +++--
4
- 1 file changed, 3 insertions(+), 2 deletions(-)
5
-
6
---- src/r8168_n.c
7
-+++ src/r8168_n.c  2024-03-13 12:25:52.886342182 +0000
8
-@@ -6312,7 +6312,7 @@ rtl8168_get_drvinfo(struct net_device *d
9
-         info->eedump_len = tp->eeprom_len;
10
-         BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version));
11
-         if (rtl_fw)
12
--                strlcpy(info->fw_version, rtl_fw->version,
13
-+                strscpy(info->fw_version, rtl_fw->version,
14
-                         sizeof(info->fw_version));
15
- }
16
- 
17
-@@ -28103,7 +28103,8 @@ rtl8168_link_timer(struct timer_list *t)
18
- }
19
- */
20
- 
21
--int rtl8168_enable_msix(struct rtl8168_private *tp)
22
-+static int
23
-+rtl8168_enable_msix(struct rtl8168_private *tp)
24
- {
25
-         int i, nvecs = 0;
26
-         struct msix_entry msix_entR8168_MAX_MSIX_VEC;
27
r8168-kernel_version.patch Changed
37
 
1
@@ -5,7 +5,7 @@
2
 
3
 --- src/r8168.h
4
 +++ src/r8168.h    2024-03-13 11:51:59.011947503 +0000
5
-@@ -133,6 +133,10 @@ do { \
6
+@@ -196,6 +196,10 @@ do { \
7
  } while (0)
8
  #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
9
  
10
@@ -35,7 +35,7 @@
11
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37)
12
  #include <linux/prefetch.h>
13
  #endif
14
-@@ -590,8 +595,12 @@ static void rtl8168_set_rx_mode(struct n
15
+@@ -586,8 +591,12 @@ static void rtl8168_set_rx_mode(struct n
16
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
17
  static void rtl8168_tx_timeout(struct net_device *dev, unsigned int txqueue);
18
  #else
19
@@ -48,7 +48,7 @@
20
  static struct net_device_stats *rtl8168_get_stats(struct net_device *dev);
21
  static int rtl8168_rx_interrupt(struct net_device *, struct rtl8168_private *, struct rtl8168_rx_ring *, napi_budget);
22
  #ifdef CONFIG_R8168_NAPI
23
-@@ -30765,8 +30774,12 @@ static void
24
+@@ -30897,8 +30906,12 @@ static void
25
  rtl8168_tx_timeout(struct net_device *dev, unsigned int txqueue)
26
  #else
27
  static void
28
@@ -61,7 +61,7 @@
29
  {
30
          struct rtl8168_private *tp = netdev_priv(dev);
31
  
32
-@@ -31502,7 +31515,7 @@ rtl8168_rx_interrupt(struct net_device *
33
+@@ -31636,7 +31649,7 @@ rtl8168_rx_interrupt(struct net_device *
34
  
35
                  if (rtl8168_rx_vlan_skb(tp, desc, skb) < 0)
36
                          rtl8168_rx_skb(tp, skb, ring_index);
37
r8168-support-dev0x8136.patch Changed
10
 
1
@@ -12,7 +12,7 @@
2
 index 28d7636..cbf43d1 100755
3
 --- a/src/r8168_n.c
4
 +++ b/src/r8168_n.c
5
-@@ -430,6 +430,7 @@ static const struct {
6
+@@ -426,6 +426,7 @@ static const struct {
7
  
8
  static struct pci_device_id rtl8168_pci_tbl = {
9
          { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), },
10
r8168-support-ethtool_keee.patch Added
121
 
1
@@ -0,0 +1,119 @@
2
+From 94426e16197c244d03aad0434e3490acdaa830fe Mon Sep 17 00:00:00 2001
3
+From: Masato TOYOSHIMA <phoepsilonix@phoepsilonix.love>
4
+Date: Tue, 14 May 2024 14:52:58 +0900
5
+Subject: PATCH Linux 6.9 compat: change to ethtool_keee from ethtool_eee
6
+
7
+linux/include/linux/ethtool.h
8
+
9
+struct ethtool_ops
10
+    int (*get_eee)(struct net_device *dev, struct ethtool_keee *eee);
11
+    int (*set_eee)(struct net_device *dev, struct ethtool_keee *eee);
12
+
13
+change to ethtool_keee from ethtool_eee
14
+    rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
15
+    rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
16
+---
17
+ src/r8168_n.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
18
+ 1 file changed, 44 insertions(+)
19
+
20
+diff --git a/src/r8168_n.c b/src/r8168_n.c
21
+index ad63f42..3d67641 100755
22
+--- a/src/r8168_n.c
23
++++ b/src/r8168_n.c
24
+@@ -7941,7 +7941,11 @@ rtl8168_device_lpi_t_to_ethtool_lpi_t(struct rtl8168_private *tp , u32 lpi_timer
25
+ }
26
+ 
27
+ static int
28
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
29
++rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
30
++#else
31
+ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
32
++#endif
33
+ {
34
+         struct rtl8168_private *tp = netdev_priv(net);
35
+         struct ethtool_eee *eee = &tp->eee;
36
+@@ -7975,9 +7979,15 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
37
+ 
38
+         edata->eee_enabled = !!val;
39
+         edata->eee_active = !!(supported & adv & lp);
40
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
41
++        ethtool_convert_legacy_u32_to_link_mode(edata->supported, supported);
42
++        ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
43
++        ethtool_convert_legacy_u32_to_link_mode(edata->lp_advertised, lp);
44
++#else
45
+         edata->supported = supported;
46
+         edata->advertised = adv;
47
+         edata->lp_advertised = lp;
48
++#endif
49
+         edata->tx_lpi_enabled = edata->eee_enabled;
50
+         edata->tx_lpi_timer = tx_lpi_timer;
51
+ 
52
+@@ -7985,11 +7995,19 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
53
+ }
54
+ 
55
+ static int
56
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
57
++rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
58
++#else
59
+ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
60
++#endif
61
+ {
62
+         struct rtl8168_private *tp = netdev_priv(net);
63
+         struct ethtool_eee *eee = &tp->eee;
64
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
65
++        u32 advertising, adv;
66
++#else
67
+         u32 advertising;
68
++#endif
69
+         int rc = 0;
70
+ 
71
+         if (!rtl8168_support_eee(tp))
72
+@@ -8013,6 +8031,18 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
73
+         }
74
+ 
75
+         advertising = tp->advertising;
76
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
77
++        ethtool_convert_link_mode_to_legacy_u32(&adv, edata->advertised);
78
++        if (linkmode_empty(edata->advertised)) {
79
++                adv = advertising & eee->supported;
80
++                ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
81
++        } else if (!linkmode_empty(edata->advertised) & ~advertising) {
82
++                dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
83
++                           adv, advertising);
84
++                rc = -EINVAL;
85
++                goto out;
86
++        }
87
++#else
88
+         if (!edata->advertised) {
89
+                 edata->advertised = advertising & eee->supported;
90
+         } else if (edata->advertised & ~advertising) {
91
+@@ -8021,15 +8051,29 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
92
+                 rc = -EINVAL;
93
+                 goto out;
94
+         }
95
++#endif
96
+ 
97
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
98
++        if (!linkmode_empty(edata->advertised) & ~eee->supported) {
99
++                dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
100
++                           adv, eee->supported);
101
++                rc = -EINVAL;
102
++                goto out;
103
++        }
104
++#else
105
+         if (edata->advertised & ~eee->supported) {
106
+                 dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
107
+                            edata->advertised, eee->supported);
108
+                 rc = -EINVAL;
109
+                 goto out;
110
+         }
111
++#endif
112
+ 
113
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
114
++        ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, edata->advertised);
115
++#else
116
+         eee->advertised = edata->advertised;
117
++#endif
118
+         eee->eee_enabled = edata->eee_enabled;
119
+ 
120
+         if (eee->eee_enabled)
121
r8168-support-linux-5.19.patch Changed
32
 
1
@@ -1,18 +1,22 @@
2
---- r8168-8.050.03/src/r8168_n.c
3
-+++ r8168-8.050.03/src/r8168_n.c
4
+---
5
+ r8168-8.053.00/src/r8168_n.c |    9 +++++++++
6
+ 1 file changed, 9 insertions(+)
7
+
8
+--- r8168-8.053.00/src/r8168_n.c
9
++++ r8168-8.053.00/src/r8168_n.c   2024-05-21 09:57:57.192604776 +0000
10
 @@ -126,6 +126,15 @@
11
  #define FIRMWARE_8168FP_3   "rtl_nic/rtl8168fp-3.fw"
12
  #define FIRMWARE_8168FP_4   "rtl_nic/rtl8168fp-4.fw"
13
  
14
 +#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 18, 0)
15
 +static inline void netif_set_gso_max_size(struct net_device *dev,
16
-+                    unsigned int size)
17
++                                          unsigned int size)
18
 +{
19
-+  /* dev->gso_max_size is read locklessly from sk_setup_caps() */
20
-+  WRITE_ONCE(dev->gso_max_size, size);
21
++        /* dev->gso_max_size is read locklessly from sk_setup_caps() */
22
++        WRITE_ONCE(dev->gso_max_size, size);
23
 +}
24
 +#endif
25
 +
26
- /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
27
-    The RTL chips use a 64 element hash table based on the Ethernet CRC. */
28
- static const int multicast_filter_limit = 32;
29
+ static const struct {
30
+         const char *name;
31
+         const char *fw_name;
32
r8168-support-linux-L15.5.patch Changed
46
 
1
@@ -4,7 +4,7 @@
2
 
3
 --- src/r8168_n.c
4
 +++ src/r8168_n.c  2024-03-13 12:10:07.947820999 +0000
5
-@@ -6986,7 +6986,7 @@ rtl8168_set_ring_size(struct rtl8168_pri
6
+@@ -7234,7 +7234,7 @@ rtl8168_set_ring_size(struct rtl8168_pri
7
  }
8
  
9
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
10
@@ -13,7 +13,7 @@
11
  static void rtl8168_get_ringparam(struct net_device *dev,
12
                                    struct ethtool_ringparam *ring,
13
                                    struct kernel_ethtool_ringparam *kernel_ring,
14
-@@ -6994,7 +6994,7 @@ static void rtl8168_get_ringparam(struct
15
+@@ -7242,7 +7242,7 @@ static void rtl8168_get_ringparam(struct
16
  #else
17
  static void rtl8168_get_ringparam(struct net_device *dev,
18
                                    struct ethtool_ringparam *ring)
19
@@ -22,7 +22,7 @@
20
  {
21
          struct rtl8168_private *tp = netdev_priv(dev);
22
  
23
-@@ -7004,7 +7004,7 @@ static void rtl8168_get_ringparam(struct
24
+@@ -7252,7 +7252,7 @@ static void rtl8168_get_ringparam(struct
25
          ring->tx_pending = tp->tx_ring0.num_tx_desc;
26
  }
27
  
28
@@ -31,7 +31,7 @@
29
  static int rtl8168_set_ringparam(struct net_device *dev,
30
                                   struct ethtool_ringparam *ring,
31
                                   struct kernel_ethtool_ringparam *kernel_ring,
32
-@@ -7012,7 +7012,7 @@ static int rtl8168_set_ringparam(struct
33
+@@ -7260,7 +7260,7 @@ static int rtl8168_set_ringparam(struct
34
  #else
35
  static int rtl8168_set_ringparam(struct net_device *dev,
36
                                   struct ethtool_ringparam *ring)
37
@@ -40,7 +40,7 @@
38
  {
39
          struct rtl8168_private *tp = netdev_priv(dev);
40
          u32 new_rx_count, new_tx_count;
41
-@@ -26644,11 +26644,11 @@ rtl8168_release_board(struct pci_dev *pd
42
+@@ -26737,11 +26737,11 @@ rtl8168_release_board(struct pci_dev *pd
43
  static void
44
  rtl8168_hw_address_set(struct net_device *dev, u8 mac_addrMAC_ADDR_LEN)
45
  {
46
r8168-8.052.01.tar.gz.asc Deleted
9
 
1
@@ -1,7 +0,0 @@
2
------BEGIN PGP SIGNATURE-----
3
-
4
-iHUEABYIAB0WIQQMrarPcPZMZU4TGzERZ1x0NCnd7wUCZRk1EAAKCRARZ1x0NCnd
5
-761TAPsHdh+FI5/eoR1/vSKJ8nCBXVmP6xR9q5bHvknbyzcGJAD/Zq5BWgkYnfBR
6
-M3Ow6FM7EZ7+iAlkIRAavYHASGXERQ4=
7
-=QvU5
8
------END PGP SIGNATURE-----
9
r8168-8.053.00.tar.gz.asc Added
9
 
1
@@ -0,0 +1,7 @@
2
+-----BEGIN PGP SIGNATURE-----
3
+
4
+iHUEABYKAB0WIQQMrarPcPZMZU4TGzERZ1x0NCnd7wUCZiUOBgAKCRARZ1x0NCnd
5
+7zwaAP9/wR9UAKCbpYCVY4a527hxVnKbIskev0+SNUa++NYyKAD+KCZaGOKSVUOF
6
+AUqJsVPNzKZkPn162vhgkJH9EOfBmQ0=
7
+=DNig
8
+-----END PGP SIGNATURE-----
9
r8168-8.052.01.tar.gz/Makefile -> r8168-8.053.00.tar.gz/Makefile Changed
10
 
1
@@ -4,7 +4,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/README -> r8168-8.053.00.tar.gz/README Changed
9
 
1
@@ -1,6 +1,6 @@
2
 <Linux device driver for Realtek Ethernet controllers>
3
 
4
-   This is the Linux device driver released for RealTek RTL8168B/8111B, RTL8168C/8111C, RTL8168CP/8111CP, RTL8168D/8111D, RTL8168DP/8111DP, and RTL8168E/8111E Gigabit Ethernet controllers with PCI-Express interface.
5
+   This is the Linux device driver released for RealTek Gigabit Ethernet controllers with PCI-Express interface.
6
 
7
 <Requirements>
8
 
9
r8168-8.052.01.tar.gz/src/Makefile -> r8168-8.053.00.tar.gz/src/Makefile Changed
10
 
1
@@ -4,7 +4,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/Makefile_linux24x -> r8168-8.053.00.tar.gz/src/Makefile_linux24x Changed
10
 
1
@@ -4,7 +4,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/r8168.h -> r8168-8.053.00.tar.gz/src/r8168.h Changed
441
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
@@ -49,6 +49,69 @@
11
 #endif
12
 */
13
 
14
+#ifndef fallthrough
15
+#define fallthrough
16
+#endif
17
+
18
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
19
+static inline
20
+ssize_t strscpy(char *dest, const char *src, size_t count)
21
+{
22
+        long res = 0;
23
+
24
+        if (count == 0)
25
+                return -E2BIG;
26
+
27
+        while (count) {
28
+                char c;
29
+
30
+                c = srcres;
31
+                destres = c;
32
+                if (!c)
33
+                        return res;
34
+                res++;
35
+                count--;
36
+        }
37
+
38
+        /* Hit buffer length without finding a NUL; force NUL-termination. */
39
+        if (res)
40
+                destres-1 = '\0';
41
+
42
+        return -E2BIG;
43
+}
44
+#endif
45
+
46
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0))
47
+static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
48
+{
49
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
50
+        return skb->head + skb->csum_start;
51
+#else /* < 2.6.22 */
52
+        return skb_transport_header(skb);
53
+#endif
54
+}
55
+#endif
56
+
57
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
58
+static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
59
+                                        unsigned int bytes)
60
+{}
61
+static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
62
+                unsigned int pkts,
63
+                unsigned int bytes)
64
+{}
65
+static inline void netdev_tx_reset_queue(struct netdev_queue *q) {}
66
+#endif
67
+
68
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0)
69
+#define netdev_xmit_more() (0)
70
+#endif
71
+
72
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)
73
+#define netif_testing_on(dev)
74
+#define netif_testing_off(dev)
75
+#endif
76
+
77
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
78
 typedef int netdev_tx_t;
79
 #endif
80
@@ -175,6 +238,10 @@
81
 #define ENABLE_R8168_PROCFS
82
 #endif
83
 
84
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
85
+#define ENABLE_R8168_SYSFS
86
+#endif
87
+
88
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
89
 #define NETIF_F_HW_VLAN_RX NETIF_F_HW_VLAN_CTAG_RX
90
 #define NETIF_F_HW_VLAN_TX NETIF_F_HW_VLAN_CTAG_TX
91
@@ -364,19 +431,19 @@
92
 #define RSS_SUFFIX ""
93
 #endif
94
 
95
-#define RTL8168_VERSION "8.052.01" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX RSS_SUFFIX
96
+#define RTL8168_VERSION "8.053.00" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX RSS_SUFFIX
97
 #define MODULENAME "r8168"
98
 #define PFX MODULENAME ": "
99
 
100
 #define GPL_CLAIM "\
101
-r8168  Copyright (C) 2023 Realtek NIC software team <nicfae@realtek.com> \n \
102
+r8168  Copyright (C) 2024 Realtek NIC software team <nicfae@realtek.com> \n \
103
 This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>. \n \
104
 This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>. \n"
105
 
106
 #ifdef RTL8168_DEBUG
107
 #define assert(expr) \
108
         if(!(expr)) {                   \
109
-            printk( "Assertion failed! %s,%s,%s,line=%d\n", \
110
+            printk("Assertion failed! %s,%s,%s,line=%d\n", \
111
             #expr,__FILE__,__FUNCTION__,__LINE__);      \
112
         }
113
 #define dprintk(fmt, args...)   do { printk(PFX fmt, ## args); } while (0)
114
@@ -453,6 +520,7 @@
115
 #define RTL8168_TX_TIMEOUT  (6 * HZ)
116
 #define RTL8168_LINK_TIMEOUT    (1 * HZ)
117
 #define RTL8168_ESD_TIMEOUT (2 * HZ)
118
+#define RTL8168_DASH_TIMEOUT    (0)
119
 
120
 #define MAX_NUM_TX_DESC 1024    /* Maximum number of Tx descriptor registers */
121
 #define MAX_NUM_RX_DESC 1024    /* Maximum number of Rx descriptor registers */
122
@@ -548,9 +616,9 @@
123
 /*****************************************************************************/
124
 
125
 //#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)
126
-#if (( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) ) || \
127
-     (( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) && \
128
-      ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) )))
129
+#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)) || \
130
+     ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && \
131
+      (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3))))
132
 /* copied from linux kernel 2.6.20 include/linux/netdev.h */
133
 #define NETDEV_ALIGN        32
134
 #define NETDEV_ALIGN_CONST  (NETDEV_ALIGN - 1)
135
@@ -636,6 +704,23 @@
136
 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
137
 
138
 /*****************************************************************************/
139
+#ifdef CONFIG_R8168_NAPI
140
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
141
+#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget)          napi_consume_skb(skb, budget)
142
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
143
+#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget)          dev_consume_skb_any(skb);
144
+#else
145
+#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget)          dev_kfree_skb_any(skb);
146
+#endif  //LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
147
+#else   //CONFIG_R8168_NAPI
148
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
149
+#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget)          dev_consume_skb_any(skb);
150
+#else
151
+#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget)          dev_kfree_skb_any(skb);
152
+#endif
153
+#endif  //CONFIG_R8168_NAPI
154
+
155
+/*****************************************************************************/
156
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
157
 #ifdef __CHECKER__
158
 #define __iomem __attribute__((noderef, address_space(2)))
159
@@ -669,7 +754,7 @@
160
 
161
 /*****************************************************************************/
162
 /* 2.5.28 => 2.4.23 */
163
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) )
164
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28))
165
 
166
 static inline void _kc_synchronize_irq(void)
167
 {
168
@@ -690,12 +775,12 @@
169
 
170
 /*****************************************************************************/
171
 /* 2.6.4 => 2.6.0 */
172
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) )
173
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4))
174
 #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
175
 #endif /* 2.6.4 => 2.6.0 */
176
 /*****************************************************************************/
177
 /* 2.6.0 => 2.5.28 */
178
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) )
179
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
180
 #define MODULE_INFO(version, _version)
181
 #ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
182
 #define CONFIG_E1000_DISABLE_PACKET_SPLIT 1
183
@@ -726,13 +811,13 @@
184
 
185
 /*****************************************************************************/
186
 /* 2.4.22 => 2.4.17 */
187
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) )
188
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22))
189
 #define pci_name(x) ((x)->slot_name)
190
 #endif /* 2.4.22 => 2.4.17 */
191
 
192
 /*****************************************************************************/
193
 /* 2.6.5 => 2.6.0 */
194
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) )
195
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5))
196
 #define pci_dma_sync_single_for_cpu pci_dma_sync_single
197
 #define pci_dma_sync_single_for_device  pci_dma_sync_single_for_cpu
198
 #endif /* 2.6.5 => 2.6.0 */
199
@@ -1487,7 +1572,7 @@
200
 };
201
 
202
 #define RTL8168_CP_NUM 4
203
-#define RTL8168_MAX_SUPPORT_cp_len 110
204
+#define RTL8168_MAX_SUPPORT_CP_LEN 110
205
 
206
 enum rtl8168_cp_status {
207
         rtl8168_cp_normal = 0,
208
@@ -1543,6 +1628,8 @@
209
 struct ring_info {
210
         struct sk_buff  *skb;
211
         u32     len;
212
+        unsigned int   bytecount;
213
+        unsigned short gso_segs;
214
         u8      __padsizeof(void *) - sizeof(u32);
215
 };
216
 
217
@@ -1566,14 +1653,29 @@
218
         u32 pci_sn_h;
219
 };
220
 
221
+enum r8168_dash_req_flag {
222
+        R8168_RCV_REQ_SYS_OK = 0,
223
+        R8168_RCV_REQ_DASH_OK,
224
+        R8168_SEND_REQ_HOST_OK,
225
+        R8168_CMAC_RESET,
226
+        R8168_CMAC_DISALE_RX_FLAG_MAX,
227
+        R8168_DASH_REQ_FLAG_MAX
228
+};
229
+
230
 enum r8168_flag {
231
         R8168_FLAG_DOWN = 0,
232
         R8168_FLAG_TASK_RESET_PENDING,
233
         R8168_FLAG_TASK_ESD_CHECK_PENDING,
234
         R8168_FLAG_TASK_LINKCHG_CHECK_PENDING,
235
+        R8168_FLAG_TASK_DASH_CHECK_PENDING,
236
         R8168_FLAG_MAX
237
 };
238
 
239
+enum r8168_sysfs_flag {
240
+        R8168_SYSFS_RTL_ADV = 0,
241
+        R8168_SYSFS_FLAG_MAX
242
+};
243
+
244
 /* Flow Control Settings */
245
 enum rtl8168_fc_mode {
246
         rtl8168_fc_none = 0,
247
@@ -1585,6 +1687,7 @@
248
 
249
 struct rtl8168_tx_ring {
250
         void* priv;
251
+        struct net_device *netdev;
252
         u32 index;
253
         u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
254
         u32 dirty_tx;
255
@@ -1600,6 +1703,7 @@
256
 
257
 struct rtl8168_rx_ring {
258
         void* priv;
259
+        struct net_device *netdev;
260
         u32 index;
261
         u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
262
         u32 dirty_rx;
263
@@ -1880,10 +1984,12 @@
264
         struct work_struct reset_task;
265
         struct work_struct esd_task;
266
         struct work_struct linkchg_task;
267
+        struct work_struct dash_task;
268
 #else
269
         struct delayed_work reset_task;
270
         struct delayed_work esd_task;
271
         struct delayed_work linkchg_task;
272
+        struct delayed_work dash_task;
273
 #endif
274
         DECLARE_BITMAP(task_flags, R8168_FLAG_MAX);
275
         unsigned features;
276
@@ -1968,6 +2074,7 @@
277
         u8 dash_printer_enabled;
278
         u8 HwPkgDet;
279
         void __iomem *cmac_ioaddr; /* cmac memory map physical address */
280
+        DECLARE_BITMAP(dash_req_flags, R8168_DASH_REQ_FLAG_MAX);
281
 
282
 #ifdef ENABLE_DASH_SUPPORT
283
         u16 AfterRecvFromFwBufLen;
284
@@ -1975,51 +2082,45 @@
285
         u16 AfterSendToFwBufLen;
286
         u8 AfterSendToFwBufSEND_TO_FW_BUF_SIZE;
287
         u16 SendToFwBufferLen;
288
-        u32 SizeOfSendToFwBuffer ;
289
-        u32 SizeOfSendToFwBufferMemAlloc ;
290
-        u32 NumOfSendToFwBuffer ;
291
+        u32 SizeOfSendToFwBuffer;
292
+        u32 SizeOfSendToFwBufferMemAlloc;
293
+        u32 NumOfSendToFwBuffer;
294
 
295
         u8 OobReq;
296
         u8 OobAck;
297
         u32 OobReqComplete;
298
         u32 OobAckComplete;
299
 
300
-        u8 RcvFwReqSysOkEvt;
301
-        u8 RcvFwDashOkEvt;
302
-        u8 SendFwHostOkEvt;
303
-
304
-        u8 DashFwDisableRx;
305
-
306
-        void *SendToFwBuffer ;
307
-        dma_addr_t SendToFwBufferPhy ;
308
+        void *SendToFwBuffer;
309
+        dma_addr_t SendToFwBufferPhy;
310
         u8 SendingToFw;
311
         PTX_DASH_SEND_FW_DESC TxDashSendFwDesc;
312
         dma_addr_t TxDashSendFwDescPhy;
313
         u32 SizeOfTxDashSendFwDescMemAlloc;
314
-        u32 SizeOfTxDashSendFwDesc ;
315
-        u32 NumTxDashSendFwDesc ;
316
-        u32 CurrNumTxDashSendFwDesc ;
317
-        u32 LastSendNumTxDashSendFwDesc ;
318
+        u32 SizeOfTxDashSendFwDesc;
319
+        u32 NumTxDashSendFwDesc;
320
+        u32 CurrNumTxDashSendFwDesc;
321
+        u32 LastSendNumTxDashSendFwDesc;
322
 
323
-        u32 NumRecvFromFwBuffer ;
324
-        u32 SizeOfRecvFromFwBuffer ;
325
-        u32 SizeOfRecvFromFwBufferMemAlloc ;
326
-        void *RecvFromFwBuffer ;
327
-        dma_addr_t RecvFromFwBufferPhy ;
328
+        u32 NumRecvFromFwBuffer;
329
+        u32 SizeOfRecvFromFwBuffer;
330
+        u32 SizeOfRecvFromFwBufferMemAlloc;
331
+        void *RecvFromFwBuffer;
332
+        dma_addr_t RecvFromFwBufferPhy;
333
 
334
         PRX_DASH_FROM_FW_DESC RxDashRecvFwDesc;
335
         dma_addr_t RxDashRecvFwDescPhy;
336
         u32 SizeOfRxDashRecvFwDescMemAlloc;
337
-        u32 SizeOfRxDashRecvFwDesc ;
338
-        u32 NumRxDashRecvFwDesc ;
339
-        u32 CurrNumRxDashRecvFwDesc ;
340
+        u32 SizeOfRxDashRecvFwDesc;
341
+        u32 NumRxDashRecvFwDesc;
342
+        u32 CurrNumRxDashRecvFwDesc;
343
         u8 DashReqRegValue;
344
         u16 HostReqValue;
345
 
346
         u32 CmacResetIsrCounter;
347
-        u8 CmacResetIntr ;
348
-        u8 CmacResetting ;
349
-        u8 CmacOobIssueCmacReset ;
350
+        u8 CmacResetIntr;
351
+        u8 CmacResetting;
352
+        u8 CmacOobIssueCmacReset;
353
         u32 CmacResetbyFwCnt;
354
 
355
 #if defined(ENABLE_DASH_PRINTER_SUPPORT)
356
@@ -2049,6 +2150,13 @@
357
 #ifdef ENABLE_R8168_PROCFS
358
         //Procfs support
359
         struct proc_dir_entry *proc_dir;
360
+        struct proc_dir_entry *proc_dir_debug;
361
+        struct proc_dir_entry *proc_dir_test;
362
+#endif
363
+#ifdef ENABLE_R8168_SYSFS
364
+        //sysfs support
365
+        DECLARE_BITMAP(sysfs_flag, R8168_SYSFS_FLAG_MAX);
366
+        u32 testmode;
367
 #endif
368
         u8 HwSuppRxDescType;
369
         u8 InitRxDescType;
370
@@ -2087,7 +2195,7 @@
371
 {
372
         int count, i;
373
 
374
-        for (count = 0, i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++)
375
+        for (count = 0, i = 1; i < tp->HwSuppNumRxQueues; i++)
376
                 if(tp->lib_rx_ringi.enabled)
377
                         count++;
378
 
379
@@ -2118,7 +2226,7 @@
380
         int i;
381
         bool released = 0;
382
 
383
-        for (i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) {
384
+        for (i = 1; i < tp->HwSuppNumRxQueues; i++) {
385
                 struct rtl8168_ring *ring = &tp->lib_rx_ringi;
386
                 if (ring->allocated)
387
                         goto exit;
388
@@ -2169,6 +2277,11 @@
389
         return tp->num_rx_rings + rtl8168_num_lib_rx_rings(tp);
390
 }
391
 
392
+static inline struct netdev_queue *txring_txq(const struct rtl8168_tx_ring *ring)
393
+{
394
+        return netdev_get_tx_queue(ring->netdev, ring->index);
395
+}
396
+
397
 static inline bool
398
 rtl8168_lib_all_ring_released(struct rtl8168_private *tp)
399
 {
400
@@ -2328,6 +2441,31 @@
401
         return (struct RxDesc*)desc;
402
 }
403
 
404
+#ifdef ENABLE_DASH_SUPPORT
405
+
406
+static inline void
407
+rtl8168_enable_dash2_interrupt(struct rtl8168_private *tp)
408
+{
409
+        if (!tp->DASH)
410
+                return;
411
+
412
+        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
413
+                RTL_CMAC_W8(tp, CMAC_IBIMR0, (ISRIMR_DASH_TYPE2_ROK | ISRIMR_DASH_TYPE2_TOK | ISRIMR_DASH_TYPE2_TDU | ISRIMR_DASH_TYPE2_RDU | ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE));
414
+        }
415
+}
416
+
417
+static inline void
418
+rtl8168_disable_dash2_interrupt(struct rtl8168_private *tp)
419
+{
420
+        if (!tp->DASH)
421
+                return;
422
+
423
+        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
424
+                RTL_CMAC_W8(tp, CMAC_IBIMR0, 0);
425
+        }
426
+}
427
+#endif
428
+
429
 static inline void
430
 rtl8168_disable_interrupt_by_vector(struct rtl8168_private *tp,
431
                                     u32 message_id)
432
@@ -2380,7 +2518,7 @@
433
 static inline void rtl8168_lib_reset_complete(struct rtl8168_private *tp) { }
434
 #endif
435
 
436
-#define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M)        ((_M)->HwSuppCheckPhyDisableModeVer > 0 )
437
+#define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M)        ((_M)->HwSuppCheckPhyDisableModeVer > 0)
438
 #define HW_SUPP_SERDES_PHY(_M)        ((_M)->HwSuppSerDesPhyVer > 0)
439
 #define HW_HAS_WRITE_PHY_MCU_RAM_CODE(_M)        (((_M)->HwHasWrRamCodeToMicroP == TRUE) ? 1 : 0)
440
 #define HW_SUPPORT_UPS_MODE(_M)        ((_M)->HwSuppUpsVer > 0)
441
r8168-8.052.01.tar.gz/src/r8168_asf.c -> r8168-8.053.00.tar.gz/src/r8168_asf.c Changed
35
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
@@ -384,10 +384,10 @@
11
         int i;
12
 
13
         if (arg == ASF_GET)
14
-                for (i = 0; i < SYSID_LEN ; i++)
15
+                for (i = 0; i < SYSID_LEN; i++)
16
                         datai = rtl8168_eri_read(tp, SysID + i, RW_ONE_BYTE, ERIAR_ASF);
17
         else /* arg == ASF_SET */
18
-                for (i = 0; i < SYSID_LEN ; i++)
19
+                for (i = 0; i < SYSID_LEN; i++)
20
                         rtl8168_eri_write(tp, SysID + i, RW_ONE_BYTE, datai, ERIAR_ASF);
21
 }
22
 
23
@@ -408,9 +408,9 @@
24
         int i, j;
25
 
26
         if (arg == ASF_GET)
27
-                for (i = UUID_LEN - 1, j = 0; i >= 0 ; i--, j++)
28
+                for (i = UUID_LEN - 1, j = 0; i >= 0; i--, j++)
29
                         dataj = rtl8168_eri_read(tp, UUID + i, RW_ONE_BYTE, ERIAR_ASF);
30
         else /* arg == ASF_SET */
31
-                for (i = UUID_LEN - 1, j = 0; i >= 0 ; i--, j++)
32
+                for (i = UUID_LEN - 1, j = 0; i >= 0; i--, j++)
33
                         rtl8168_eri_write(tp, UUID + i, RW_ONE_BYTE, dataj, ERIAR_ASF);
34
 }
35
r8168-8.052.01.tar.gz/src/r8168_asf.h -> r8168-8.053.00.tar.gz/src/r8168_asf.h Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/r8168_dash.h -> r8168-8.053.00.tar.gz/src/r8168_dash.h Changed
18
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
@@ -247,6 +247,7 @@
11
 #define RTL_CMAC_R32(tp, reg)        ((unsigned long) readl (tp->cmac_ioaddr + (reg)))
12
 
13
 int rtl8168_dash_ioctl(struct net_device *dev, struct ifreq *ifr);
14
+bool CheckDashInterrupt(struct net_device *dev, u16 status);
15
 void HandleDashInterrupt(struct net_device *dev);
16
 int AllocateDashShareMemory(struct net_device *dev);
17
 void FreeAllocatedDashShareMemory(struct net_device *dev);
18
r8168-8.052.01.tar.gz/src/r8168_fiber.h -> r8168-8.053.00.tar.gz/src/r8168_fiber.h Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/r8168_firmware.c -> r8168-8.053.00.tar.gz/src/r8168_firmware.c Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/r8168_firmware.h -> r8168-8.053.00.tar.gz/src/r8168_firmware.h Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/r8168_n.c -> r8168-8.053.00.tar.gz/src/r8168_n.c Changed
5048
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
@@ -121,10 +121,6 @@
11
 #define FIRMWARE_8168FP_3   "rtl_nic/rtl8168fp-3.fw"
12
 #define FIRMWARE_8168FP_4   "rtl_nic/rtl8168fp-4.fw"
13
 
14
-/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
15
-   The RTL chips use a 64 element hash table based on the Ethernet CRC. */
16
-static const int multicast_filter_limit = 32;
17
-
18
 static const struct {
19
         const char *name;
20
         const char *fw_name;
21
@@ -630,14 +626,17 @@
22
 static void rtl8168_reset_task(void *_data);
23
 static void rtl8168_esd_task(void *_data);
24
 static void rtl8168_linkchg_task(void *_data);
25
+static void rtl8168_dash_task(void *_data);
26
 #else
27
 static void rtl8168_reset_task(struct work_struct *work);
28
 static void rtl8168_esd_task(struct work_struct *work);
29
 static void rtl8168_linkchg_task(struct work_struct *work);
30
+static void rtl8168_dash_task(struct work_struct *work);
31
 #endif
32
 static void rtl8168_schedule_reset_work(struct rtl8168_private *tp);
33
 static void rtl8168_schedule_esd_work(struct rtl8168_private *tp);
34
 static void rtl8168_schedule_linkchg_work(struct rtl8168_private *tp);
35
+void rtl8168_schedule_dash_work(struct rtl8168_private *tp);
36
 static void rtl8168_init_all_schedule_work(struct rtl8168_private *tp);
37
 static void rtl8168_cancel_all_schedule_work(struct rtl8168_private *tp);
38
 
39
@@ -791,7 +790,7 @@
40
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
41
 #ifndef SET_ETHTOOL_OPS
42
 #define SET_ETHTOOL_OPS(netdev,ops) \
43
-         ( (netdev)->ethtool_ops = (ops) )
44
+         ((netdev)->ethtool_ops = (ops))
45
 #endif //SET_ETHTOOL_OPS
46
 #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
47
 
48
@@ -983,6 +982,16 @@
49
         return retval;
50
 }
51
 
52
+static bool
53
+rtl8168_sysfs_testmode_on(struct rtl8168_private *tp)
54
+{
55
+#ifdef ENABLE_R8168_SYSFS
56
+        return !!tp->testmode;
57
+#else
58
+        return 1;
59
+#endif
60
+}
61
+
62
 static u32 rtl8168_convert_link_speed(u16 status)
63
 {
64
         u32 speed = SPEED_UNKNOWN;
65
@@ -1046,34 +1055,34 @@
66
 }
67
 
68
 static void rtl8168_get_cp_len(struct rtl8168_private *tp,
69
-                               u16 cp_lenRTL8168_CP_NUM)
70
+                               int cp_lenRTL8168_CP_NUM)
71
 {
72
         int i;
73
         u16 status;
74
-        u16 tmp_cp_len = 0;
75
+        int tmp_cp_len;
76
 
77
         status = RTL_R8(tp, PHYstatus);
78
         if (status & LinkStatus) {
79
                 if (status & _10bps) {
80
-                        tmp_cp_len = 0;
81
-                } else if (status & _1000bpsF) {
82
+                        tmp_cp_len = -1;
83
+                } else if (status & (_100bps | _1000bpsF)) {
84
                         rtl8168_mdio_write(tp, 0x1f, 0x0a88);
85
                         tmp_cp_len = rtl8168_mdio_read(tp, 0x10);
86
                 } else
87
-                        goto exit;
88
+                        tmp_cp_len = 0;
89
         } else
90
-                goto exit;
91
+                tmp_cp_len = 0;
92
 
93
-        tmp_cp_len &= 0xff;
94
+        if (tmp_cp_len > 0)
95
+                tmp_cp_len &= 0xff;
96
         for (i=0; i<RTL8168_CP_NUM; i++)
97
                 cp_leni = tmp_cp_len;
98
 
99
-exit:
100
         rtl8168_mdio_write(tp, 0x1f, 0x0000);
101
 
102
         for (i=0; i<RTL8168_CP_NUM; i++)
103
-                if (cp_leni > RTL8168_MAX_SUPPORT_cp_len)
104
-                        cp_leni = RTL8168_MAX_SUPPORT_cp_len;
105
+                if (cp_leni > RTL8168_MAX_SUPPORT_CP_LEN)
106
+                        cp_leni = RTL8168_MAX_SUPPORT_CP_LEN;
107
 
108
         return;
109
 }
110
@@ -1150,12 +1159,30 @@
111
 }
112
 
113
 static void rtl8168_get_cp_status(struct rtl8168_private *tp,
114
-                                  int cp_statusRTL8168_CP_NUM)
115
+                                  int cp_statusRTL8168_CP_NUM,
116
+                                  bool poe_mode)
117
 {
118
+        u16 status;
119
         int i;
120
 
121
-        for (i =0; i<RTL8168_CP_NUM; i++)
122
-                cp_statusi = _rtl8168_get_cp_status(tp, i);
123
+        status = RTL_R8(tp, PHYstatus);
124
+        if (status & LinkStatus && !(status & (_10bps | _100bps))) {
125
+                for (i=0; i<RTL8168_CP_NUM; i++)
126
+                        cp_statusi = rtl8168_cp_normal;
127
+        } else {
128
+                /* cannot do vcd when link is on */
129
+                rtl8168_vcd_test(tp);
130
+
131
+                for (i=0; i<RTL8168_CP_NUM; i++)
132
+                        cp_statusi = _rtl8168_get_cp_status(tp, i);
133
+        }
134
+
135
+        if (poe_mode) {
136
+                for (i=0; i<RTL8168_CP_NUM; i++) {
137
+                        if (cp_statusi == rtl8168_cp_mismatch)
138
+                                cp_statusi = rtl8168_cp_normal;
139
+                }
140
+        }
141
 }
142
 
143
 #ifdef ENABLE_R8168_PROCFS
144
@@ -1494,35 +1521,42 @@
145
         return 0;
146
 }
147
 
148
-static int proc_get_cable_info(struct seq_file *m, void *v)
149
+static int _proc_get_cable_info(struct seq_file *m, void *v, bool poe_mode)
150
 {
151
         int i;
152
         u16 status;
153
         int cp_statusRTL8168_CP_NUM = {0};
154
-        u16 cp_lenRTL8168_CP_NUM = {0};
155
+        int cp_lenRTL8168_CP_NUM = {0};
156
         struct net_device *dev = m->private;
157
         struct rtl8168_private *tp = netdev_priv(dev);
158
         const char *pair_strRTL8168_CP_NUM = {"1-2", "3-6", "4-5", "7-8"};
159
+        int ret;
160
 
161
         switch (tp->mcfg) {
162
         case CFG_METHOD_30:
163
-        case CFG_METHOD_35:
164
-        case CFG_METHOD_36:
165
-        case CFG_METHOD_37:
166
                 /* support */
167
                 break;
168
         default:
169
-                return -EOPNOTSUPP;
170
+                ret = -EOPNOTSUPP;
171
+                goto error_out;
172
         }
173
 
174
         rtnl_lock();
175
 
176
+        if (!rtl8168_sysfs_testmode_on(tp)) {
177
+                seq_puts(m, "\nPlease turn on ""/sys/class/net/<iface>/rtk_adv/testmode"".\n\n");
178
+                ret = 0;
179
+                goto error_unlock;
180
+        }
181
+
182
         rtl8168_mdio_write(tp, 0x1f, 0x0000);
183
         if (rtl8168_mdio_read(tp, MII_BMCR) & BMCR_PDOWN) {
184
-                rtnl_unlock();
185
-                return -EIO;
186
+                ret = -EIO;
187
+                goto error_unlock;
188
         }
189
 
190
+        netif_testing_on(dev);
191
+
192
         status = RTL_R8(tp, PHYstatus);
193
         if (status & LinkStatus)
194
                 seq_printf(m, "\nlink speed:%d",
195
@@ -1532,30 +1566,46 @@
196
 
197
         rtl8168_get_cp_len(tp, cp_len);
198
 
199
-        rtl8168_vcd_test(tp);
200
-
201
-        rtl8168_get_cp_status(tp, cp_status);
202
+        rtl8168_get_cp_status(tp, cp_status, poe_mode);
203
 
204
         seq_puts(m, "\npair\tlength\tstatus   \tpp\n");
205
 
206
-        for (i =0; i<RTL8168_CP_NUM; i++) {
207
-                seq_printf(m, "%s\t%d\t%s\t",
208
-                           pair_stri, cp_leni,
209
-                           rtl8168_get_cp_status_string(cp_statusi));
210
+        for (i=0; i<RTL8168_CP_NUM; i++) {
211
+                if (cp_leni < 0)
212
+                        seq_printf(m, "%s\t%s\t%s\t",
213
+                                   pair_stri, "none",
214
+                                   rtl8168_get_cp_status_string(cp_statusi));
215
+                else
216
+                        seq_printf(m, "%s\t%d\t%s\t",
217
+                                   pair_stri, cp_leni,
218
+                                   rtl8168_get_cp_status_string(cp_statusi));
219
                 if (cp_statusi == rtl8168_cp_normal)
220
                         seq_printf(m, "none\n");
221
                 else
222
                         seq_printf(m, "%dm\n", rtl8168_get_cp_pp(tp, i));
223
         }
224
 
225
-        tp->phy_reset_enable(dev);
226
+        netif_testing_off(dev);
227
 
228
-        rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
229
+        seq_putc(m, '\n');
230
+
231
+        ret = 0;
232
 
233
+error_unlock:
234
         rtnl_unlock();
235
 
236
-        seq_putc(m, '\n');
237
-        return 0;
238
+error_out:
239
+        return ret;
240
+}
241
+
242
+static int proc_get_cable_info(struct seq_file *m, void *v)
243
+{
244
+        return _proc_get_cable_info(m, v, 0);
245
+}
246
+
247
+static int proc_get_poe_cable_info(struct seq_file *m, void *v)
248
+{
249
+        return _proc_get_cable_info(m, v, 1);
250
 }
251
 
252
 static int proc_dump_rx_desc(struct seq_file *m, void *v)
253
@@ -1621,8 +1671,8 @@
254
         return 0;
255
 }
256
 
257
-void _proc_dump_tx_desc(struct seq_file *m, struct TxDesc *desc_base,
258
-                        u32 alloc_size, u32 num_desc)
259
+static void _proc_dump_tx_desc(struct seq_file *m, struct TxDesc *desc_base,
260
+                               u32 alloc_size, u32 num_desc)
261
 {
262
         int i;
263
         u32 *pdword;
264
@@ -1682,6 +1732,7 @@
265
 static int proc_dump_msix_tbl(struct seq_file *m, void *v)
266
 {
267
         int i, j;
268
+        void __iomem *ioaddr;
269
         struct net_device *dev = m->private;
270
         struct rtl8168_private *tp = netdev_priv(dev);
271
 
272
@@ -1692,22 +1743,26 @@
273
                 break;
274
         }
275
 
276
+        /* ioremap MMIO region */
277
+        ioaddr = ioremap(pci_resource_start(tp->pci_dev, 4), pci_resource_len(tp->pci_dev, 4));
278
+        if (!ioaddr)
279
+                return -EFAULT;
280
+
281
         rtnl_lock();
282
 
283
-        seq_printf(m, "\ndump MSI-X Table. Total Entry %d. \n",
284
-                   tp->hw_supp_irq_nvecs);
285
+        seq_printf(m, "\ndump MSI-X Table. Total Entry %d. \n", tp->hw_supp_irq_nvecs);
286
 
287
         for (i=0; i<tp->hw_supp_irq_nvecs; i++) {
288
                 seq_printf(m, "\n%04x ", i);
289
                 for (j=0; j<4; j++)
290
                         seq_printf(m, "%08x ",
291
-                                   rtl8168_eri_read(
292
-                                           tp, i*0x10 + 4 * j, 4,
293
-                                           ERIAR_MSIX));
294
+                                   readl(ioaddr + i*0x10 + 4*j));
295
         }
296
 
297
         rtnl_unlock();
298
 
299
+        iounmap(ioaddr);
300
+
301
         seq_putc(m, '\n');
302
         return 0;
303
 }
304
@@ -1956,8 +2011,7 @@
305
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
306
                         dev->perm_addr,
307
 #endif
308
-                        dev->dev_addr
309
-                       );
310
+                        dev->dev_addr);
311
 
312
         rtnl_unlock();
313
 
314
@@ -2023,8 +2077,7 @@
315
                         le64_to_cpu(counters->rx_broadcast),
316
                         le32_to_cpu(counters->rx_multicast),
317
                         le16_to_cpu(counters->tx_aborted),
318
-                        le16_to_cpu(counters->tx_underrun)
319
-                       );
320
+                        le16_to_cpu(counters->tx_underrun));
321
 
322
         len += snprintf(page + len, count - len, "\n");
323
 out_unlock:
324
@@ -2247,24 +2300,22 @@
325
         return len;
326
 }
327
 
328
-static int proc_get_cable_info(char *page, char **start,
329
-                               off_t offset, int count,
330
-                               int *eof, void *data)
331
+static int _proc_get_cable_info(char *page, char **start,
332
+                                off_t offset, int count,
333
+                                int *eof, void *data,
334
+                                bool poe_mode)
335
 {
336
         int i;
337
         u16 status;
338
         int len = 0;
339
         struct net_device *dev = data;
340
         int cp_statusRTL8168_CP_NUM = {0};
341
-        u16 cp_lenRTL8168_CP_NUM = {0};
342
+        int cp_lenRTL8168_CP_NUM = {0};
343
         struct rtl8168_private *tp = netdev_priv(dev);
344
         const char *pair_strRTL8168_CP_NUM = {"1-2", "3-6", "4-5", "7-8"};
345
 
346
         switch (tp->mcfg) {
347
         case CFG_METHOD_30:
348
-        case CFG_METHOD_35:
349
-        case CFG_METHOD_36:
350
-        case CFG_METHOD_37:
351
                 /* support */
352
                 break;
353
         default:
354
@@ -2273,6 +2324,12 @@
355
 
356
         rtnl_lock();
357
 
358
+        if (!rtl8168_sysfs_testmode_on(tp)) {
359
+                len += snprintf(page + len, count - len,
360
+                                "\nPlease turn on ""/sys/class/net/<iface>/rtk_adv/testmode"".\n\n");
361
+                goto out_unlock;
362
+        }
363
+
364
         status = RTL_R8(tp, PHYstatus);
365
         if (status & LinkStatus)
366
                 len += snprintf(page + len, count - len,
367
@@ -2282,16 +2339,24 @@
368
                 len += snprintf(page + len, count - len,
369
                                 "\nlink status:off");
370
 
371
-        rtl8168_get_cp(tp, cp_len, cp_status);
372
+        rtl8168_get_cp_len(tp, cp_len);
373
+
374
+        rtl8168_get_cp_status(tp, cp_status, poe_mode);
375
 
376
         len += snprintf(page + len, count - len,
377
                         "\npair\tlength\tstatus   \tpp\n");
378
 
379
-        for (i =0; i<RTL8168_CP_NUM; i++) {
380
-                len += snprintf(page + len, count - len,
381
-                                "%s\t%d\t%s\t",
382
-                                pair_stri, cp_leni,
383
-                                rtl8168_get_cp_status_string(cp_statusi));
384
+        for (i=0; i<RTL8168_CP_NUM; i++) {
385
+                if (cp_leni < 0)
386
+                        len += snprintf(page + len, count - len,
387
+                                        "%s\t%s\t%s\t",
388
+                                        pair_stri, "none",
389
+                                        rtl8168_get_cp_status_string(cp_statusi));
390
+                else
391
+                        len += snprintf(page + len, count - len,
392
+                                        "%s\t%d\t%s\t",
393
+                                        pair_stri, cp_leni,
394
+                                        rtl8168_get_cp_status_string(cp_statusi));
395
                 if (cp_statusi == rtl8168_cp_normal)
396
                         len += snprintf(page + len, count - len, "none\n");
397
                 else
398
@@ -2299,14 +2364,29 @@
399
                                         rtl8168_get_cp_pp(tp, i));
400
         }
401
 
402
-        rtnl_unlock();
403
-
404
         len += snprintf(page + len, count - len, "\n");
405
 
406
+out_unlock:
407
+        rtnl_unlock();
408
+
409
         *eof = 1;
410
         return len;
411
 }
412
 
413
+static int proc_get_cable_info(char *page, char **start,
414
+                               off_t offset, int count,
415
+                               int *eof, void *data)
416
+{
417
+        return _proc_get_cable_info(page, start, offset, count, eof, data, 0);
418
+}
419
+
420
+static int proc_get_poe_cable_info(char *page, char **start,
421
+                                   off_t offset, int count,
422
+                                   int *eof, void *data)
423
+{
424
+        return _proc_get_cable_info(page, start, offset, count, eof, data, 1);
425
+}
426
+
427
 static int proc_dump_rx_desc(char *page, char **start,
428
                              off_t offset, int count,
429
                              int *eof, void *data)
430
@@ -2537,9 +2617,22 @@
431
 {
432
         int i, j;
433
         int len = 0;
434
+        void __iomem *ioaddr;
435
         struct net_device *dev = data;
436
         struct rtl8168_private *tp = netdev_priv(dev);
437
 
438
+        switch (tp->mcfg) {
439
+        case CFG_METHOD_1 ... CFG_METHOD_8:
440
+                return -EOPNOTSUPP;
441
+        default:
442
+                break;
443
+        }
444
+
445
+        /* ioremap MMIO region */
446
+        ioaddr = ioremap(pci_resource_start(tp->pci_dev, 4), pci_resource_len(tp->pci_dev, 4));
447
+        if (!ioaddr)
448
+                return -EFAULT;
449
+
450
         rtnl_lock();
451
 
452
         len += snprintf(page + len, count - len,
453
@@ -2551,8 +2644,7 @@
454
                                 "\n%04x ", i);
455
                 for (j=0; j<4; j++)
456
                         len += snprintf(page + len, count - len, "%08x ",
457
-                                        rtl8168_eri_read(tp, i*0x10 + 4*j, 4,
458
-                                                         ERIAR_MSIX));
459
+                                        readl(ioaddr + i*0x10 + 4*j));
460
         }
461
 
462
         rtnl_unlock();
463
@@ -2614,7 +2706,7 @@
464
  * Table of proc files we need to create.
465
  */
466
 struct rtl8168_proc_file {
467
-        char name12;
468
+        char name16;
469
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
470
         int (*show)(struct seq_file *, void *);
471
 #else
472
@@ -2622,7 +2714,7 @@
473
 #endif
474
 };
475
 
476
-static const struct rtl8168_proc_file rtl8168_proc_files = {
477
+static const struct rtl8168_proc_file rtl8168_debug_proc_files = {
478
         { "driver_var", &proc_get_driver_variable },
479
         { "tally", &proc_get_tally_counter },
480
         { "registers", &proc_get_registers },
481
@@ -2630,7 +2722,6 @@
482
         { "eth_phy", &proc_get_eth_phy },
483
         { "ext_regs", &proc_get_extended_registers },
484
         { "pci_regs", &proc_get_pci_registers },
485
-        { "cdt", &proc_get_cable_info },
486
         { "tx_desc", &proc_dump_tx_desc },
487
         { "rx_desc", &proc_dump_rx_desc },
488
         { "rx_desc_2", &proc_dump_rx_desc_2 },
489
@@ -2638,55 +2729,127 @@
490
         { "" }
491
 };
492
 
493
+static const struct rtl8168_proc_file rtl8168_test_proc_files = {
494
+        { "cdt", &proc_get_cable_info },
495
+        { "cdt_poe", &proc_get_poe_cable_info },
496
+        { "" }
497
+};
498
+
499
+#define R8168_PROC_DEBUG_DIR "debug"
500
+#define R8168_PROC_TEST_DIR "test"
501
+
502
 static void rtl8168_proc_init(struct net_device *dev)
503
 {
504
         struct rtl8168_private *tp = netdev_priv(dev);
505
         const struct rtl8168_proc_file *f;
506
         struct proc_dir_entry *dir;
507
 
508
-        if (rtl8168_proc && !tp->proc_dir) {
509
+        if (!rtl8168_proc)
510
+                return;
511
+
512
+        if (tp->proc_dir_debug || tp->proc_dir_test)
513
+                return;
514
+
515
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
516
-                dir = proc_mkdir_data(dev->name, 0, rtl8168_proc, dev);
517
-                if (!dir) {
518
-                        printk("Unable to initialize /proc/net/%s/%s\n",
519
-                               MODULENAME, dev->name);
520
+        dir = proc_mkdir_data(dev->name, 0, rtl8168_proc, dev);
521
+        if (!dir) {
522
+                printk("Unable to initialize /proc/net/%s/%s\n",
523
+                       MODULENAME, dev->name);
524
+                return;
525
+        }
526
+        tp->proc_dir = dir;
527
+        proc_init_num++;
528
+
529
+        /* create debug entry */
530
+        dir = proc_mkdir_data(R8168_PROC_DEBUG_DIR, 0, tp->proc_dir, dev);
531
+        if (!dir) {
532
+                printk("Unable to initialize /proc/net/%s/%s/%s\n",
533
+                       MODULENAME, dev->name, R8168_PROC_DEBUG_DIR);
534
+                return;
535
+        }
536
+
537
+        tp->proc_dir_debug = dir;
538
+        for (f = rtl8168_debug_proc_files; f->name0; f++) {
539
+                if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir,
540
+                                      &rtl8168_proc_fops, f->show)) {
541
+                        printk("Unable to initialize "
542
+                               "/proc/net/%s/%s/%s/%s\n",
543
+                               MODULENAME, dev->name, R8168_PROC_DEBUG_DIR,
544
+                               f->name);
545
                         return;
546
                 }
547
+        }
548
 
549
-                tp->proc_dir = dir;
550
-                proc_init_num++;
551
+        /* create test entry */
552
+        dir = proc_mkdir_data(R8168_PROC_TEST_DIR, 0, tp->proc_dir, dev);
553
+        if (!dir) {
554
+                printk("Unable to initialize /proc/net/%s/%s/%s\n",
555
+                       MODULENAME, dev->name, R8168_PROC_TEST_DIR);
556
+                return;
557
+        }
558
 
559
-                for (f = rtl8168_proc_files; f->name0; f++) {
560
-                        if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir,
561
-                                              &rtl8168_proc_fops, f->show)) {
562
-                                printk("Unable to initialize "
563
-                                       "/proc/net/%s/%s/%s\n",
564
-                                       MODULENAME, dev->name, f->name);
565
-                                return;
566
-                        }
567
+        tp->proc_dir_test = dir;
568
+        for (f = rtl8168_test_proc_files; f->name0; f++) {
569
+                if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir,
570
+                                      &rtl8168_proc_fops, f->show)) {
571
+                        printk("Unable to initialize "
572
+                               "/proc/net/%s/%s/%s/%s\n",
573
+                               MODULENAME, dev->name, R8168_PROC_TEST_DIR,
574
+                               f->name);
575
+                        return;
576
                 }
577
+        }
578
 #else
579
-                dir = proc_mkdir(dev->name, rtl8168_proc);
580
-                if (!dir) {
581
-                        printk("Unable to initialize /proc/net/%s/%s\n",
582
-                               MODULENAME, dev->name);
583
+        dir = proc_mkdir(dev->name, rtl8168_proc);
584
+        if (!dir) {
585
+                printk("Unable to initialize /proc/net/%s/%s\n",
586
+                       MODULENAME, dev->name);
587
+                return;
588
+        }
589
+
590
+        tp->proc_dir = dir;
591
+        proc_init_num++;
592
+
593
+        /* create debug entry */
594
+        dir = proc_mkdir(R8168_PROC_DEBUG_DIR, tp->proc_dir);
595
+        if (!dir) {
596
+                printk("Unable to initialize /proc/net/%s/%s/%s\n",
597
+                       MODULENAME, dev->name, R8168_PROC_DEBUG_DIR);
598
+                return;
599
+        }
600
+
601
+        tp->proc_dir_debug = dir;
602
+        for (f = rtl8168_debug_proc_files; f->name0; f++) {
603
+                if (!create_proc_read_entry(f->name, S_IFREG | S_IRUGO,
604
+                                            dir, f->show, dev)) {
605
+                        printk("Unable to initialize "
606
+                               "/proc/net/%s/%s/%s/%s\n",
607
+                               MODULENAME, dev->name, R8168_PROC_DEBUG_DIR,
608
+                               f->name);
609
                         return;
610
                 }
611
+        }
612
 
613
-                tp->proc_dir = dir;
614
-                proc_init_num++;
615
+        /* create test entry */
616
+        dir = proc_mkdir(R8168_PROC_TEST_DIR, tp->proc_dir);
617
+        if (!dir) {
618
+                printk("Unable to initialize /proc/net/%s/%s/%s\n",
619
+                       MODULENAME, dev->name, R8168_PROC_TEST_DIR);
620
+                return;
621
+        }
622
 
623
-                for (f = rtl8168_proc_files; f->name0; f++) {
624
-                        if (!create_proc_read_entry(f->name, S_IFREG | S_IRUGO,
625
-                                                    dir, f->show, dev)) {
626
-                                printk("Unable to initialize "
627
-                                       "/proc/net/%s/%s/%s\n",
628
-                                       MODULENAME, dev->name, f->name);
629
-                                return;
630
-                        }
631
+        tp->proc_dir_test = dir;
632
+        for (f = rtl8168_test_proc_files; f->name0; f++) {
633
+                if (!create_proc_read_entry(f->name, S_IFREG | S_IRUGO,
634
+                                            dir, f->show, dev)) {
635
+                        printk("Unable to initialize "
636
+                               "/proc/net/%s/%s/%s/%s\n",
637
+                               MODULENAME, dev->name, R8168_PROC_TEST_DIR,
638
+                               f->name);
639
+                        return;
640
                 }
641
-#endif
642
         }
643
+#endif
644
 }
645
 
646
 static void rtl8168_proc_remove(struct net_device *dev)
647
@@ -2696,33 +2859,119 @@
648
         if (tp->proc_dir) {
649
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
650
                 remove_proc_subtree(dev->name, rtl8168_proc);
651
-                proc_init_num--;
652
-
653
 #else
654
                 const struct rtl8168_proc_file *f;
655
                 struct rtl8168_private *tp = netdev_priv(dev);
656
 
657
-                for (f = rtl8168_proc_files; f->name0; f++)
658
-                        remove_proc_entry(f->name, tp->proc_dir);
659
+                if (tp->proc_dir_debug) {
660
+                        for (f = rtl8168_debug_proc_files; f->name0; f++)
661
+                                remove_proc_entry(f->name, tp->proc_dir_debug);
662
+                        remove_proc_entry(R8168_PROC_DEBUG_DIR, tp->proc_dir);
663
+                }
664
+
665
+                if (tp->proc_dir_test) {
666
+                        for (f = rtl8168_test_proc_files; f->name0; f++)
667
+                                remove_proc_entry(f->name, tp->proc_dir_test);
668
+                        remove_proc_entry(R8168_PROC_TEST_DIR, tp->proc_dir);
669
+                }
670
 
671
                 remove_proc_entry(dev->name, rtl8168_proc);
672
-                proc_init_num--;
673
 #endif
674
+                proc_init_num--;
675
+
676
+                tp->proc_dir_debug = NULL;
677
+                tp->proc_dir_test = NULL;
678
                 tp->proc_dir = NULL;
679
         }
680
 }
681
 
682
 #endif //ENABLE_R8168_PROCFS
683
 
684
+#ifdef ENABLE_R8168_SYSFS
685
+/****************************************************************************
686
+*   -----------------------------SYSFS STUFF-------------------------
687
+*****************************************************************************
688
+*/
689
+static ssize_t testmode_show(struct device *dev,
690
+                             struct device_attribute *attr, char *buf)
691
+{
692
+        struct net_device *netdev = to_net_dev(dev);
693
+        struct rtl8168_private *tp = netdev_priv(netdev);
694
+
695
+        sprintf(buf, "%u\n", tp->testmode);
696
+
697
+        return strlen(buf);
698
+}
699
+
700
+static ssize_t testmode_store(struct device *dev,
701
+                              struct device_attribute *attr,
702
+                              const char *buf, size_t count)
703
+{
704
+        struct net_device *netdev = to_net_dev(dev);
705
+        struct rtl8168_private *tp = netdev_priv(netdev);
706
+        u32 testmode;
707
+
708
+        if (sscanf(buf, "%u\n", &testmode) != 1)
709
+                return -EINVAL;
710
+
711
+        if (tp->testmode != testmode) {
712
+                rtnl_lock();
713
+                tp->testmode = testmode;
714
+                rtnl_unlock();
715
+        }
716
+
717
+        return count;
718
+}
719
+
720
+static DEVICE_ATTR_RW(testmode);
721
+
722
+static struct attribute *rtk_adv_attrs = {
723
+        &dev_attr_testmode.attr,
724
+        NULL
725
+};
726
+
727
+static struct attribute_group rtk_adv_grp = {
728
+        .name = "rtl_adv",
729
+        .attrs = rtk_adv_attrs,
730
+};
731
+
732
+static void rtl8168_sysfs_init(struct net_device *dev)
733
+{
734
+        struct rtl8168_private *tp = netdev_priv(dev);
735
+        int ret;
736
+
737
+        /* init rtl_adv */
738
+#ifdef ENABLE_LIB_SUPPORT
739
+        tp->testmode = 0;
740
+#else
741
+        tp->testmode = 1;
742
+#endif //ENABLE_LIB_SUPPORT
743
+
744
+        ret = sysfs_create_group(&dev->dev.kobj, &rtk_adv_grp);
745
+        if (ret < 0)
746
+                netif_warn(tp, probe, dev, "create rtk_adv_grp fail\n");
747
+        else
748
+                set_bit(R8168_SYSFS_RTL_ADV, tp->sysfs_flag);
749
+}
750
+
751
+static void rtl8168_sysfs_remove(struct net_device *dev)
752
+{
753
+        struct rtl8168_private *tp = netdev_priv(dev);
754
+
755
+        if (test_and_clear_bit(R8168_SYSFS_RTL_ADV, tp->sysfs_flag))
756
+                sysfs_remove_group(&dev->dev.kobj, &rtk_adv_grp);
757
+}
758
+#endif //ENABLE_R8168_SYSFS
759
+
760
 static inline u16 map_phy_ocp_addr(u16 PageNum, u8 RegNum)
761
 {
762
         u16 OcpPageNum = 0;
763
         u8 OcpRegNum = 0;
764
         u16 OcpPhyAddress = 0;
765
 
766
-        if ( PageNum == 0 ) {
767
-                OcpPageNum = OCP_STD_PHY_BASE_PAGE + ( RegNum / 8 );
768
-                OcpRegNum = 0x10 + ( RegNum % 8 );
769
+        if (PageNum == 0) {
770
+                OcpPageNum = OCP_STD_PHY_BASE_PAGE + (RegNum / 8);
771
+                OcpRegNum = 0x10 + (RegNum % 8);
772
         } else {
773
                 OcpPageNum = PageNum;
774
                 OcpRegNum = RegNum;
775
@@ -2730,7 +2979,7 @@
776
 
777
         OcpPageNum <<= 4;
778
 
779
-        if ( OcpRegNum < 16 ) {
780
+        if (OcpRegNum < 16) {
781
                 OcpPhyAddress = 0;
782
         } else {
783
                 OcpRegNum -= 16;
784
@@ -2814,9 +3063,8 @@
785
 {
786
         int i;
787
 
788
-        if (RegAddr == 0x1F) {
789
+        if (RegAddr == 0x1F)
790
                 tp->cur_page = value;
791
-        }
792
 
793
         if (tp->mcfg == CFG_METHOD_11) {
794
                 RTL_W32(tp, OCPDR, OCPDR_Write |
795
@@ -2946,8 +3194,8 @@
796
         return mdio_real_direct_read_phy_ocp(tp, ocp_addr);
797
 }
798
 
799
-u32 mdio_real_read(struct rtl8168_private *tp,
800
-                   u32 RegAddr)
801
+static u32 mdio_real_read(struct rtl8168_private *tp,
802
+                          u32 RegAddr)
803
 {
804
         int i, value = 0;
805
 
806
@@ -3040,8 +3288,7 @@
807
         ClearAndSetEthPhyBit(tp,
808
                              addr,
809
                              mask,
810
-                             0
811
-                            );
812
+                             0);
813
 }
814
 
815
 void rtl8168_set_eth_phy_bit(struct rtl8168_private *tp, u8  addr, u16  mask)
816
@@ -3049,8 +3296,7 @@
817
         ClearAndSetEthPhyBit(tp,
818
                              addr,
819
                              0,
820
-                             mask
821
-                            );
822
+                             mask);
823
 }
824
 
825
 void rtl8168_mac_ocp_write(struct rtl8168_private *tp, u16 reg_addr, u16 value)
826
@@ -3130,8 +3376,7 @@
827
         rtl8168_clear_and_set_mcu_ocp_bit(tp,
828
                                           addr,
829
                                           mask,
830
-                                          0
831
-                                         );
832
+                                          0);
833
 }
834
 
835
 static void
836
@@ -3144,8 +3389,7 @@
837
         rtl8168_clear_and_set_mcu_ocp_bit(tp,
838
                                           addr,
839
                                           0,
840
-                                          mask
841
-                                         );
842
+                                          mask);
843
 }
844
 
845
 static u32 real_ocp_read(struct rtl8168_private *tp, u16 addr, u8 len)
846
@@ -3413,18 +3657,18 @@
847
                 u8 TmpUchar;
848
 
849
                 //Disable oob Tx
850
-                RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) & ~( BIT_0 ));
851
+                RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) & ~(BIT_0));
852
                 WaitCnt = 0;
853
 
854
                 //wait oob tx disable
855
                 do {
856
                         TmpUchar = RTL_CMAC_R8(tp, CMAC_IBISR0);
857
 
858
-                        if ( TmpUchar & ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE ) {
859
+                        if (TmpUchar & ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE) {
860
                                 break;
861
                         }
862
 
863
-                        udelay( 50 );
864
+                        udelay(50);
865
                         WaitCnt++;
866
                 } while(WaitCnt < 2000);
867
 
868
@@ -3438,9 +3682,8 @@
869
         if (!tp->DASH)
870
                 return;
871
 
872
-        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
873
+        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp))
874
                 RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) | BIT_0);
875
-        }
876
 }
877
 
878
 void rtl8168_dash2_disable_rx(struct rtl8168_private *tp)
879
@@ -3448,9 +3691,8 @@
880
         if (!tp->DASH)
881
                 return;
882
 
883
-        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
884
-                RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~( BIT_0 ));
885
-        }
886
+        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp))
887
+                RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~(BIT_0));
888
 }
889
 
890
 void rtl8168_dash2_enable_rx(struct rtl8168_private *tp)
891
@@ -3458,9 +3700,8 @@
892
         if (!tp->DASH)
893
                 return;
894
 
895
-        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
896
+        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp))
897
                 RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) | BIT_0);
898
-        }
899
 }
900
 
901
 static void rtl8168_dash2_disable_txrx(struct net_device *dev)
902
@@ -3468,8 +3709,8 @@
903
         struct rtl8168_private *tp = netdev_priv(dev);
904
 
905
         if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
906
-                rtl8168_dash2_disable_tx( tp );
907
-                rtl8168_dash2_disable_rx( tp );
908
+                rtl8168_dash2_disable_tx(tp);
909
+                rtl8168_dash2_disable_rx(tp);
910
         }
911
 }
912
 
913
@@ -3554,20 +3795,18 @@
914
 
915
 static void ClearPCIePhyBit(struct rtl8168_private *tp, u8 addr, u16 mask)
916
 {
917
-        ClearAndSetPCIePhyBit( tp,
918
-                               addr,
919
-                               mask,
920
-                               0
921
-                             );
922
+        ClearAndSetPCIePhyBit(tp,
923
+                              addr,
924
+                              mask,
925
+                              0);
926
 }
927
 
928
-static void SetPCIePhyBit( struct rtl8168_private *tp, u8 addr, u16 mask)
929
-{
930
-        ClearAndSetPCIePhyBit( tp,
931
-                               addr,
932
-                               0,
933
-                               mask
934
-                             );
935
+static void SetPCIePhyBit(struct rtl8168_private *tp, u8 addr, u16 mask)
936
+{
937
+        ClearAndSetPCIePhyBit(tp,
938
+                              addr,
939
+                              0,
940
+                              mask);
941
 }
942
 
943
 static u32
944
@@ -3589,9 +3828,8 @@
945
                 multi_fun_sel_bit = 0;
946
         }
947
 
948
-        if ( multi_fun_sel_bit > 7 ) {
949
+        if (multi_fun_sel_bit > 7)
950
                 return 0xffffffff;
951
-        }
952
 
953
         cmd |= multi_fun_sel_bit << 16;
954
 
955
@@ -3627,13 +3865,11 @@
956
             tp->mcfg != CFG_METHOD_26 && tp->mcfg != CFG_METHOD_27 &&
957
             tp->mcfg != CFG_METHOD_28 && tp->mcfg != CFG_METHOD_31 &&
958
             tp->mcfg != CFG_METHOD_32 && tp->mcfg != CFG_METHOD_33 &&
959
-            tp->mcfg != CFG_METHOD_34) {
960
+            tp->mcfg != CFG_METHOD_34)
961
                 multi_fun_sel_bit = 0;
962
-        }
963
 
964
-        if ( multi_fun_sel_bit > 7 ) {
965
+        if (multi_fun_sel_bit > 7)
966
                 return;
967
-        }
968
 
969
         cmd |= multi_fun_sel_bit << 16;
970
 
971
@@ -3733,7 +3969,7 @@
972
                 TmpUlong = rtl8168_csi_other_fun_read(tp, 0, RegAlignAddr);
973
                 TmpUlong &= ~(0xFF << (8*ShiftByte));
974
                 TmpUlong |= (value << (8*ShiftByte));
975
-                rtl8168_csi_other_fun_write( tp, 0, RegAlignAddr, TmpUlong );
976
+                rtl8168_csi_other_fun_write(tp, 0, RegAlignAddr, TmpUlong);
977
         } else {
978
                 struct pci_dev *pdev = tp->pci_dev;
979
 
980
@@ -4247,7 +4483,7 @@
981
         } else {
982
 
983
                 if (tp->mcfg == CFG_METHOD_13)
984
-                        RTL_W8(tp, TwiCmdReg, RTL_R8(tp, TwiCmdReg) | ( BIT_7 ));
985
+                        RTL_W8(tp, TwiCmdReg, RTL_R8(tp, TwiCmdReg) | (BIT_7));
986
 
987
                 rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START);
988
 
989
@@ -4275,7 +4511,7 @@
990
                 rtl8168_wait_dash_fw_ready(tp);
991
 
992
                 if (tp->mcfg == CFG_METHOD_13)
993
-                        RTL_W8(tp, TwiCmdReg, RTL_R8(tp, TwiCmdReg) & ~( BIT_7 ));
994
+                        RTL_W8(tp, TwiCmdReg, RTL_R8(tp, TwiCmdReg) & ~(BIT_7));
995
         }
996
 
997
         //change other device state to D3.
998
@@ -4352,31 +4588,6 @@
999
         rtl8168_clear_isr_by_vector(tp, message_id, val);
1000
 }
1001
 
1002
-#ifdef ENABLE_DASH_SUPPORT
1003
-
1004
-inline void
1005
-rtl8168_enable_dash2_interrupt(struct rtl8168_private *tp)
1006
-{
1007
-        if (!tp->DASH)
1008
-                return;
1009
-
1010
-        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
1011
-                RTL_CMAC_W8(tp, CMAC_IBIMR0, ( ISRIMR_DASH_TYPE2_ROK | ISRIMR_DASH_TYPE2_TOK | ISRIMR_DASH_TYPE2_TDU | ISRIMR_DASH_TYPE2_RDU | ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE ));
1012
-        }
1013
-}
1014
-
1015
-static inline void
1016
-rtl8168_disable_dash2_interrupt(struct rtl8168_private *tp)
1017
-{
1018
-        if (!tp->DASH)
1019
-                return;
1020
-
1021
-        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
1022
-                RTL_CMAC_W8(tp, CMAC_IBIMR0, 0);
1023
-        }
1024
-}
1025
-#endif
1026
-
1027
 static inline void
1028
 rtl8168_enable_interrupt(struct rtl8168_private *tp)
1029
 {
1030
@@ -4390,7 +4601,7 @@
1031
 {
1032
         int i;
1033
 
1034
-        for (i=1; i<rtl8168_tot_rx_rings(tp); i++)
1035
+        for (i=0; i<rtl8168_tot_rx_rings(tp); i++)
1036
                 rtl8168_enable_interrupt_by_vector(tp, i);
1037
 }
1038
 
1039
@@ -4408,7 +4619,7 @@
1040
 {
1041
         int i;
1042
 
1043
-        for (i=1; i<rtl8168_tot_rx_rings(tp); i++)
1044
+        for (i=0; i<rtl8168_tot_rx_rings(tp); i++)
1045
                 rtl8168_disable_interrupt_by_vector(tp, i);
1046
 }
1047
 
1048
@@ -4456,7 +4667,7 @@
1049
         if (tp->DASH) {
1050
                 if (tp->dash_printer_enabled) {
1051
                         rtl8168_clear_isr_by_vector(tp, 0,
1052
-                                                    rtl8168_get_hw_isr_by_vector(tp, 0) &
1053
+                                                    rtl8168_get_isr_by_vector(tp, 0) &
1054
                                                     ~(ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET));
1055
                 } else {
1056
                         if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
1057
@@ -4517,7 +4728,8 @@
1058
         case CFG_METHOD_12:
1059
         case CFG_METHOD_13:
1060
                 for (i = 0; i < 2000; i++) {
1061
-                        if (!(RTL_R8(tp, TxPoll) & NPQ)) break;
1062
+                        if (!(RTL_R8(tp, TxPoll) & NPQ))
1063
+                                break;
1064
                         udelay(100);
1065
                 }
1066
                 break;
1067
@@ -4572,11 +4784,14 @@
1068
                 }
1069
 
1070
                 for (i = 0; i < 5; i++) {
1071
-                        if ( rtl8168_ocp_read(tp, 0x034, 1) == 0)
1072
+                        if (rtl8168_ocp_read(tp, 0x034, 1) == 0)
1073
                                 break;
1074
                 }
1075
                 break;
1076
         }
1077
+
1078
+        /* reset rcr */
1079
+        RTL_W32(tp, RxConfig, (RX_DMA_BURST << RxCfgDMAShift));
1080
 }
1081
 
1082
 static void
1083
@@ -4718,7 +4933,7 @@
1084
                                 break;
1085
                 }
1086
 
1087
-                RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(AcceptErr | AcceptRunt | AcceptBroadcast | AcceptMulticast | AcceptMyPhys |  AcceptAllPhys));
1088
+                rtl8168_disable_rx_packet_filter(tp);
1089
 
1090
                 rx_len = rx_cmd & 0x3FFF;
1091
                 rx_len -= 4;
1092
@@ -4839,6 +5054,10 @@
1093
                 ring->dirty_tx = ring->cur_tx = 0;
1094
                 ring->index = i;
1095
                 ring->priv = tp;
1096
+                ring->netdev = tp->dev;
1097
+
1098
+                /* reset BQL for queue */
1099
+                netdev_tx_reset_queue(txring_txq(ring));
1100
         }
1101
 
1102
         for (i = 0; i < tp->HwSuppNumRxQueues; i++) {
1103
@@ -4846,6 +5065,7 @@
1104
                 ring->dirty_rx = ring->cur_rx = 0;
1105
                 ring->index = i;
1106
                 ring->priv = tp;
1107
+                ring->netdev = tp->dev;
1108
         }
1109
 
1110
 #ifdef ENABLE_LIB_SUPPORT
1111
@@ -5438,8 +5658,8 @@
1112
         case CFG_METHOD_36:
1113
         case CFG_METHOD_37:
1114
                 csi_tmp = rtl8168_eri_read(tp, 0x3F2, 2, ERIAR_ExGMAC);
1115
-                csi_tmp &= ~( BIT_8 | BIT_9  | BIT_10 | BIT_11  | BIT_12  | BIT_13  | BIT_14 | BIT_15 );
1116
-                csi_tmp |= ( BIT_9 | BIT_10 | BIT_13  | BIT_14 | BIT_15 );
1117
+                csi_tmp &= ~(BIT_8 | BIT_9  | BIT_10 | BIT_11  | BIT_12  | BIT_13  | BIT_14 | BIT_15);
1118
+                csi_tmp |= (BIT_9 | BIT_10 | BIT_13  | BIT_14 | BIT_15);
1119
                 rtl8168_eri_write(tp, 0x3F2, 2, csi_tmp, ERIAR_ExGMAC);
1120
                 csi_tmp = rtl8168_eri_read(tp, 0x3F5, 1, ERIAR_ExGMAC);
1121
                 csi_tmp |= BIT_6 | BIT_7;
1122
@@ -5722,7 +5942,7 @@
1123
         rtl8168_eri_write(tp, Q_NUM_CTRL_8168, 2, q_ctrl, ERIAR_ExGMAC);
1124
 }
1125
 
1126
-void
1127
+static void
1128
 rtl8168_set_rx_vlan_filter(struct rtl8168_private *tp)
1129
 {
1130
         int i;
1131
@@ -6286,14 +6506,14 @@
1132
         struct rtl8168_private *tp = netdev_priv(dev);
1133
         struct rtl8168_fw *rtl_fw = tp->rtl_fw;
1134
 
1135
-        strcpy(info->driver, MODULENAME);
1136
-        strcpy(info->version, RTL8168_VERSION);
1137
-        strncpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info) - 1);
1138
+        strscpy(info->driver, MODULENAME, sizeof(info->driver));
1139
+        strscpy(info->version, RTL8168_VERSION, sizeof(info->version));
1140
+        strscpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info));
1141
         info->regdump_len = R8168_REGS_DUMP_SIZE;
1142
         info->eedump_len = tp->eeprom_len;
1143
         BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version));
1144
         if (rtl_fw)
1145
-                strlcpy(info->fw_version, rtl_fw->version,
1146
+                strscpy(info->fw_version, rtl_fw->version,
1147
                         sizeof(info->fw_version));
1148
 }
1149
 
1150
@@ -6691,6 +6911,32 @@
1151
 
1152
 #endif
1153
 
1154
+static u8 rtl8168_get_mdi_status(struct rtl8168_private *tp)
1155
+{
1156
+        u32 val;
1157
+
1158
+        if (!tp->link_ok(tp->dev))
1159
+                return ETH_TP_MDI_INVALID;
1160
+
1161
+        switch (tp->mcfg) {
1162
+        case CFG_METHOD_1 ... CFG_METHOD_20:
1163
+                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1164
+                val = rtl8168_mdio_read(tp, 0x11);
1165
+                if (val & BIT_6)
1166
+                        return ETH_TP_MDI_X;
1167
+                else
1168
+                        return ETH_TP_MDI;
1169
+        default:
1170
+                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1171
+                val = rtl8168_mdio_read(tp, 0x1A);
1172
+                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1173
+                if (val & BIT_1)
1174
+                        return ETH_TP_MDI;
1175
+                else
1176
+                        return ETH_TP_MDI_X;
1177
+        };
1178
+}
1179
+
1180
 static void rtl8168_gset_xmii(struct net_device *dev,
1181
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
1182
                               struct ethtool_cmd *cmd
1183
@@ -6787,6 +7033,7 @@
1184
         cmd->speed = speed;
1185
         cmd->duplex = duplex;
1186
         cmd->port = PORT_TP;
1187
+        cmd->eth_tp_mdix = rtl8168_get_mdi_status(tp);
1188
 #else
1189
         ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
1190
                                                 supported);
1191
@@ -6798,6 +7045,7 @@
1192
         cmd->base.speed = speed;
1193
         cmd->base.duplex = duplex;
1194
         cmd->base.port = PORT_TP;
1195
+        cmd->base.eth_tp_mdix = rtl8168_get_mdi_status(tp);
1196
 #endif
1197
 }
1198
 
1199
@@ -7214,6 +7462,144 @@
1200
         }
1201
 }
1202
 
1203
+static bool rtl8168_is_adv_eee_enabled(struct rtl8168_private *tp)
1204
+{
1205
+        bool enabled = false;
1206
+
1207
+        switch (tp->mcfg) {
1208
+        //case CFG_METHOD_24:
1209
+        case CFG_METHOD_25:
1210
+        case CFG_METHOD_26:
1211
+        case CFG_METHOD_27:
1212
+        case CFG_METHOD_28:
1213
+        case CFG_METHOD_29:
1214
+        case CFG_METHOD_30:
1215
+        case CFG_METHOD_31:
1216
+        case CFG_METHOD_32:
1217
+        case CFG_METHOD_33:
1218
+        case CFG_METHOD_34:
1219
+        case CFG_METHOD_35:
1220
+        case CFG_METHOD_36:
1221
+                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1222
+                if (rtl8168_mdio_read(tp, 0x10) & BIT_15)
1223
+                        enabled = true;
1224
+                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1225
+                break;
1226
+        default:
1227
+                break;
1228
+        }
1229
+
1230
+        return enabled;
1231
+}
1232
+
1233
+static void rtl8168_disable_adv_eee(struct rtl8168_private *tp)
1234
+{
1235
+        bool lock_mutex;
1236
+        bool lock_phy;
1237
+        u16 data;
1238
+
1239
+        switch (tp->mcfg) {
1240
+        //case CFG_METHOD_24:
1241
+        case CFG_METHOD_25:
1242
+        case CFG_METHOD_26:
1243
+        case CFG_METHOD_27:
1244
+        case CFG_METHOD_28:
1245
+        case CFG_METHOD_29:
1246
+        case CFG_METHOD_30:
1247
+        case CFG_METHOD_31:
1248
+        case CFG_METHOD_32:
1249
+        case CFG_METHOD_33:
1250
+        case CFG_METHOD_34:
1251
+        case CFG_METHOD_35:
1252
+        case CFG_METHOD_36:
1253
+                break;
1254
+        default:
1255
+                return;
1256
+        }
1257
+
1258
+        switch (tp->mcfg) {
1259
+        case CFG_METHOD_23:
1260
+        case CFG_METHOD_27:
1261
+        case CFG_METHOD_28:
1262
+        case CFG_METHOD_31:
1263
+        case CFG_METHOD_32:
1264
+        case CFG_METHOD_33:
1265
+        case CFG_METHOD_34:
1266
+                lock_mutex = true;
1267
+                break;
1268
+        default:
1269
+                lock_mutex = false;
1270
+                break;
1271
+        }
1272
+
1273
+        if (lock_mutex)
1274
+                rtl8168_oob_mutex_lock(tp);
1275
+
1276
+        if (rtl8168_is_adv_eee_enabled(tp))
1277
+                lock_phy = true;
1278
+        else
1279
+                lock_phy = false;
1280
+
1281
+        if (lock_phy)
1282
+                rtl8168_set_phy_mcu_patch_request(tp);
1283
+
1284
+        switch (tp->mcfg) {
1285
+        case CFG_METHOD_25:
1286
+                rtl8168_eri_write(tp, 0x1EA, 1, 0x00, ERIAR_ExGMAC);
1287
+
1288
+                rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1289
+                data = rtl8168_mdio_read(tp, 0x16);
1290
+                data &= ~(BIT_1);
1291
+                rtl8168_mdio_write(tp, 0x16, data);
1292
+                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1293
+                break;
1294
+        case CFG_METHOD_26:
1295
+                data = rtl8168_mac_ocp_read(tp, 0xE052);
1296
+                data &= ~(BIT_0);
1297
+                rtl8168_mac_ocp_write(tp, 0xE052, data);
1298
+
1299
+                rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1300
+                data = rtl8168_mdio_read(tp, 0x16);
1301
+                data &= ~(BIT_1);
1302
+                rtl8168_mdio_write(tp, 0x16, data);
1303
+                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1304
+                break;
1305
+        case CFG_METHOD_27:
1306
+        case CFG_METHOD_28:
1307
+                data = rtl8168_mac_ocp_read(tp, 0xE052);
1308
+                data &= ~(BIT_0);
1309
+                rtl8168_mac_ocp_write(tp, 0xE052, data);
1310
+                break;
1311
+        case CFG_METHOD_29:
1312
+        case CFG_METHOD_30:
1313
+        case CFG_METHOD_31:
1314
+        case CFG_METHOD_32:
1315
+        case CFG_METHOD_33:
1316
+        case CFG_METHOD_34:
1317
+        case CFG_METHOD_35:
1318
+        case CFG_METHOD_36:
1319
+                data = rtl8168_mac_ocp_read(tp, 0xE052);
1320
+                data &= ~(BIT_0);
1321
+                rtl8168_mac_ocp_write(tp, 0xE052, data);
1322
+
1323
+                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1324
+                data = rtl8168_mdio_read(tp, 0x10) & ~(BIT_15);
1325
+                rtl8168_mdio_write(tp, 0x10, data);
1326
+
1327
+                rtl8168_mdio_write(tp, 0x1F, 0x0A44);
1328
+                data = rtl8168_mdio_read(tp, 0x11) & ~(BIT_12 | BIT_13 | BIT_14);
1329
+                rtl8168_mdio_write(tp, 0x11, data);
1330
+                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1331
+                break;
1332
+        }
1333
+
1334
+        if (lock_phy)
1335
+                rtl8168_clear_phy_mcu_patch_request(tp);
1336
+
1337
+        if (lock_mutex)
1338
+                rtl8168_oob_mutex_unlock(tp);
1339
+}
1340
+
1341
 static int rtl8168_enable_eee(struct rtl8168_private *tp)
1342
 {
1343
         int ret;
1344
@@ -7351,154 +7737,7 @@
1345
         }
1346
 
1347
         /*Advanced EEE*/
1348
-        switch (tp->mcfg) {
1349
-        case CFG_METHOD_23:
1350
-        case CFG_METHOD_27:
1351
-        case CFG_METHOD_28:
1352
-        case CFG_METHOD_31:
1353
-        case CFG_METHOD_32:
1354
-        case CFG_METHOD_33:
1355
-        case CFG_METHOD_34:
1356
-                rtl8168_oob_mutex_lock(tp);
1357
-                break;
1358
-        }
1359
-
1360
-        switch (tp->mcfg) {
1361
-        case CFG_METHOD_24:
1362
-        case CFG_METHOD_25:
1363
-        case CFG_METHOD_26:
1364
-        case CFG_METHOD_29:
1365
-        case CFG_METHOD_30:
1366
-        case CFG_METHOD_31:
1367
-        case CFG_METHOD_32:
1368
-        case CFG_METHOD_33:
1369
-        case CFG_METHOD_34:
1370
-        case CFG_METHOD_35:
1371
-        case CFG_METHOD_36:
1372
-                rtl8168_set_phy_mcu_patch_request(tp);
1373
-                break;
1374
-        }
1375
-
1376
-        switch (tp->mcfg) {
1377
-        case CFG_METHOD_25:
1378
-                rtl8168_eri_write(tp, 0x1EA, 1, 0xFA, ERIAR_ExGMAC);
1379
-
1380
-                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1381
-                data = rtl8168_mdio_read(tp, 0x10);
1382
-                if (data & BIT_10) {
1383
-                        rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1384
-                        data = rtl8168_mdio_read(tp, 0x16);
1385
-                        data &= ~(BIT_1);
1386
-                        rtl8168_mdio_write(tp, 0x16, data);
1387
-                } else {
1388
-                        rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1389
-                        data = rtl8168_mdio_read(tp, 0x16);
1390
-                        data |= BIT_1;
1391
-                        rtl8168_mdio_write(tp, 0x16, data);
1392
-                }
1393
-                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1394
-                break;
1395
-        case CFG_METHOD_26:
1396
-                data = rtl8168_mac_ocp_read(tp, 0xE052);
1397
-                data |= BIT_0;
1398
-                rtl8168_mac_ocp_write(tp, 0xE052, data);
1399
-                data = rtl8168_mac_ocp_read(tp, 0xE056);
1400
-                data &= 0xFF0F;
1401
-                data |= (BIT_4 | BIT_5 | BIT_6);
1402
-                rtl8168_mac_ocp_write(tp, 0xE056, data);
1403
-
1404
-                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1405
-                data = rtl8168_mdio_read(tp, 0x10);
1406
-                if (data & BIT_10) {
1407
-                        rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1408
-                        data = rtl8168_mdio_read(tp, 0x16);
1409
-                        data &= ~(BIT_1);
1410
-                        rtl8168_mdio_write(tp, 0x16, data);
1411
-                } else {
1412
-                        rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1413
-                        data = rtl8168_mdio_read(tp, 0x16);
1414
-                        data |= BIT_1;
1415
-                        rtl8168_mdio_write(tp, 0x16, data);
1416
-                }
1417
-                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1418
-                break;
1419
-        case CFG_METHOD_27:
1420
-        case CFG_METHOD_28:
1421
-                data = rtl8168_mac_ocp_read(tp, 0xE052);
1422
-                data &= ~BIT_0;
1423
-                rtl8168_mac_ocp_write(tp, 0xE052, data);
1424
-                data = rtl8168_mac_ocp_read(tp, 0xE056);
1425
-                data &= 0xFF0F;
1426
-                data |= (BIT_4 | BIT_5 | BIT_6);
1427
-                rtl8168_mac_ocp_write(tp, 0xE056, data);
1428
-                break;
1429
-        case CFG_METHOD_29:
1430
-        case CFG_METHOD_30:
1431
-        case CFG_METHOD_35:
1432
-        case CFG_METHOD_36:
1433
-                data = rtl8168_mac_ocp_read(tp, 0xE052);
1434
-                data &= ~(BIT_0);
1435
-                rtl8168_mac_ocp_write(tp, 0xE052, data);
1436
-
1437
-                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1438
-                data = rtl8168_mdio_read(tp, 0x10) | BIT_15;
1439
-                rtl8168_mdio_write(tp, 0x10, data);
1440
-
1441
-                rtl8168_mdio_write(tp, 0x1F, 0x0A44);
1442
-                data = rtl8168_mdio_read(tp, 0x11) | BIT_13 | BIT_14;
1443
-                data &= ~(BIT_12);
1444
-                rtl8168_mdio_write(tp, 0x11, data);
1445
-                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1446
-                break;
1447
-        case CFG_METHOD_31:
1448
-        case CFG_METHOD_32:
1449
-        case CFG_METHOD_33:
1450
-        case CFG_METHOD_34:
1451
-                data = rtl8168_mac_ocp_read(tp, 0xE052);
1452
-                data &= ~(BIT_0);
1453
-                if (tp->HwPkgDet == 0x0F)
1454
-                        data |= BIT_0;
1455
-                rtl8168_mac_ocp_write(tp, 0xE052, data);
1456
-
1457
-                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1458
-                data = rtl8168_mdio_read(tp, 0x10) | BIT_15;
1459
-                rtl8168_mdio_write(tp, 0x10, data);
1460
-
1461
-                rtl8168_mdio_write(tp, 0x1F, 0x0A44);
1462
-                data = rtl8168_mdio_read(tp, 0x11) | BIT_13 | BIT_14;
1463
-                data &= ~(BIT_12);
1464
-                rtl8168_mdio_write(tp, 0x11, data);
1465
-                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1466
-                break;
1467
-        }
1468
-
1469
-        switch (tp->mcfg) {
1470
-        case CFG_METHOD_24:
1471
-        case CFG_METHOD_25:
1472
-        case CFG_METHOD_26:
1473
-        case CFG_METHOD_29:
1474
-        case CFG_METHOD_30:
1475
-        case CFG_METHOD_31:
1476
-        case CFG_METHOD_32:
1477
-        case CFG_METHOD_33:
1478
-        case CFG_METHOD_34:
1479
-        case CFG_METHOD_35:
1480
-        case CFG_METHOD_36:
1481
-                rtl8168_clear_phy_mcu_patch_request(tp);
1482
-                break;
1483
-        }
1484
-
1485
-        switch (tp->mcfg) {
1486
-        case CFG_METHOD_23:
1487
-        case CFG_METHOD_27:
1488
-        case CFG_METHOD_28:
1489
-        case CFG_METHOD_31:
1490
-        case CFG_METHOD_32:
1491
-        case CFG_METHOD_33:
1492
-        case CFG_METHOD_34:
1493
-                rtl8168_oob_mutex_unlock(tp);
1494
-                break;
1495
-        }
1496
+        rtl8168_disable_adv_eee(tp);
1497
 
1498
         return ret;
1499
 }
1500
@@ -7638,111 +7877,7 @@
1501
         }
1502
 
1503
         /*Advanced EEE*/
1504
-        switch (tp->mcfg) {
1505
-        case CFG_METHOD_23:
1506
-        case CFG_METHOD_27:
1507
-        case CFG_METHOD_28:
1508
-        case CFG_METHOD_31:
1509
-        case CFG_METHOD_32:
1510
-        case CFG_METHOD_33:
1511
-        case CFG_METHOD_34:
1512
-                rtl8168_oob_mutex_lock(tp);
1513
-                break;
1514
-        }
1515
-
1516
-        switch (tp->mcfg) {
1517
-        case CFG_METHOD_24:
1518
-        case CFG_METHOD_25:
1519
-        case CFG_METHOD_26:
1520
-        case CFG_METHOD_29:
1521
-        case CFG_METHOD_30:
1522
-        case CFG_METHOD_31:
1523
-        case CFG_METHOD_32:
1524
-        case CFG_METHOD_33:
1525
-        case CFG_METHOD_34:
1526
-        case CFG_METHOD_35:
1527
-        case CFG_METHOD_36:
1528
-                rtl8168_set_phy_mcu_patch_request(tp);
1529
-                break;
1530
-        }
1531
-
1532
-        switch (tp->mcfg) {
1533
-        case CFG_METHOD_25:
1534
-                rtl8168_eri_write(tp, 0x1EA, 1, 0x00, ERIAR_ExGMAC);
1535
-
1536
-                rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1537
-                data = rtl8168_mdio_read(tp, 0x16);
1538
-                data &= ~(BIT_1);
1539
-                rtl8168_mdio_write(tp, 0x16, data);
1540
-                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1541
-                break;
1542
-        case CFG_METHOD_26:
1543
-                data = rtl8168_mac_ocp_read(tp, 0xE052);
1544
-                data &= ~(BIT_0);
1545
-                rtl8168_mac_ocp_write(tp, 0xE052, data);
1546
-
1547
-                rtl8168_mdio_write(tp, 0x1F, 0x0A42);
1548
-                data = rtl8168_mdio_read(tp, 0x16);
1549
-                data &= ~(BIT_1);
1550
-                rtl8168_mdio_write(tp, 0x16, data);
1551
-                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1552
-                break;
1553
-        case CFG_METHOD_27:
1554
-        case CFG_METHOD_28:
1555
-                data = rtl8168_mac_ocp_read(tp, 0xE052);
1556
-                data &= ~(BIT_0);
1557
-                rtl8168_mac_ocp_write(tp, 0xE052, data);
1558
-                break;
1559
-        case CFG_METHOD_29:
1560
-        case CFG_METHOD_30:
1561
-        case CFG_METHOD_31:
1562
-        case CFG_METHOD_32:
1563
-        case CFG_METHOD_33:
1564
-        case CFG_METHOD_34:
1565
-        case CFG_METHOD_35:
1566
-        case CFG_METHOD_36:
1567
-                data = rtl8168_mac_ocp_read(tp, 0xE052);
1568
-                data &= ~(BIT_0);
1569
-                rtl8168_mac_ocp_write(tp, 0xE052, data);
1570
-
1571
-                rtl8168_mdio_write(tp, 0x1F, 0x0A43);
1572
-                data = rtl8168_mdio_read(tp, 0x10) & ~(BIT_15);
1573
-                rtl8168_mdio_write(tp, 0x10, data);
1574
-
1575
-                rtl8168_mdio_write(tp, 0x1F, 0x0A44);
1576
-                data = rtl8168_mdio_read(tp, 0x11) & ~(BIT_12 | BIT_13 | BIT_14);
1577
-                rtl8168_mdio_write(tp, 0x11, data);
1578
-                rtl8168_mdio_write(tp, 0x1F, 0x0000);
1579
-                break;
1580
-        }
1581
-
1582
-        switch (tp->mcfg) {
1583
-        case CFG_METHOD_24:
1584
-        case CFG_METHOD_25:
1585
-        case CFG_METHOD_26:
1586
-        case CFG_METHOD_29:
1587
-        case CFG_METHOD_30:
1588
-        case CFG_METHOD_31:
1589
-        case CFG_METHOD_32:
1590
-        case CFG_METHOD_33:
1591
-        case CFG_METHOD_34:
1592
-        case CFG_METHOD_35:
1593
-        case CFG_METHOD_36:
1594
-                rtl8168_clear_phy_mcu_patch_request(tp);
1595
-                break;
1596
-        }
1597
-
1598
-        switch (tp->mcfg) {
1599
-        case CFG_METHOD_23:
1600
-        case CFG_METHOD_27:
1601
-        case CFG_METHOD_28:
1602
-        case CFG_METHOD_31:
1603
-        case CFG_METHOD_32:
1604
-        case CFG_METHOD_33:
1605
-        case CFG_METHOD_34:
1606
-                rtl8168_oob_mutex_unlock(tp);
1607
-                break;
1608
-        }
1609
+        rtl8168_disable_adv_eee(tp);
1610
 
1611
         return ret;
1612
 }
1613
@@ -7912,6 +8047,19 @@
1614
 }
1615
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
1616
 
1617
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
1618
+static void rtl8168_get_channels(struct net_device *dev,
1619
+                                 struct ethtool_channels *channel)
1620
+{
1621
+        struct rtl8168_private *tp = netdev_priv(dev);
1622
+
1623
+        channel->max_rx = tp->HwSuppNumRxQueues;
1624
+        channel->max_tx = tp->HwSuppNumTxQueues;
1625
+        channel->rx_count = tp->num_rx_rings;
1626
+        channel->tx_count = tp->num_tx_rings;
1627
+}
1628
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */
1629
+
1630
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
1631
 static const struct ethtool_ops rtl8168_ethtool_ops = {
1632
         .get_drvinfo        = rtl8168_get_drvinfo,
1633
@@ -7978,6 +8126,9 @@
1634
         .get_eee = rtl_ethtool_get_eee,
1635
         .set_eee = rtl_ethtool_set_eee,
1636
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
1637
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
1638
+        .get_channels      = rtl8168_get_channels,
1639
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */
1640
         .nway_reset = rtl_nway_reset,
1641
 };
1642
 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
1643
@@ -8358,7 +8509,7 @@
1644
 rtl8168_tally_counter_clear(struct rtl8168_private *tp)
1645
 {
1646
         if (tp->mcfg == CFG_METHOD_1 || tp->mcfg == CFG_METHOD_2 ||
1647
-            tp->mcfg == CFG_METHOD_3 )
1648
+            tp->mcfg == CFG_METHOD_3)
1649
                 return;
1650
 
1651
         if (!tp->tally_paddr)
1652
@@ -8658,17 +8809,15 @@
1653
 void
1654
 rtl8168_enable_now_is_oob(struct rtl8168_private *tp)
1655
 {
1656
-        if ( tp->HwSuppNowIsOobVer == 1 ) {
1657
+        if (tp->HwSuppNowIsOobVer == 1)
1658
                 RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) | Now_is_oob);
1659
-        }
1660
 }
1661
 
1662
 void
1663
 rtl8168_disable_now_is_oob(struct rtl8168_private *tp)
1664
 {
1665
-        if ( tp->HwSuppNowIsOobVer == 1 ) {
1666
+        if (tp->HwSuppNowIsOobVer == 1)
1667
                 RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) & ~Now_is_oob);
1668
-        }
1669
 }
1670
 
1671
 static void
1672
@@ -8695,11 +8844,9 @@
1673
 
1674
         rtl8168_disable_rx_packet_filter(tp);
1675
 
1676
-        if (HW_SUPP_SERDES_PHY(tp)) {
1677
-                if (tp->HwSuppSerDesPhyVer == 1) {
1678
+        if (HW_SUPP_SERDES_PHY(tp))
1679
+                if (tp->HwSuppSerDesPhyVer == 1)
1680
                         rtl8168_switch_to_sgmii_mode(tp);
1681
-                }
1682
-        }
1683
 
1684
         if (HW_DASH_SUPPORT_DASH(tp)) {
1685
                 rtl8168_driver_start(tp);
1686
@@ -8896,220 +9043,220 @@
1687
 
1688
         rtl8168_hw_disable_mac_mcu_bps(dev);
1689
 
1690
-        rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
1691
-        rtl8168_mac_ocp_write( tp, 0xF802, 0xE01B );
1692
-        rtl8168_mac_ocp_write( tp, 0xF804, 0xE022 );
1693
-        rtl8168_mac_ocp_write( tp, 0xF806, 0xE094 );
1694
-        rtl8168_mac_ocp_write( tp, 0xF808, 0xE097 );
1695
-        rtl8168_mac_ocp_write( tp, 0xF80A, 0xE09A );
1696
-        rtl8168_mac_ocp_write( tp, 0xF80C, 0xE0B3 );
1697
-        rtl8168_mac_ocp_write( tp, 0xF80E, 0xE0BA );
1698
-        rtl8168_mac_ocp_write( tp, 0xF810, 0x49D2 );
1699
-        rtl8168_mac_ocp_write( tp, 0xF812, 0xF10D );
1700
-        rtl8168_mac_ocp_write( tp, 0xF814, 0x766C );
1701
-        rtl8168_mac_ocp_write( tp, 0xF816, 0x49E2 );
1702
-        rtl8168_mac_ocp_write( tp, 0xF818, 0xF00A );
1703
-        rtl8168_mac_ocp_write( tp, 0xF81A, 0x1EC0 );
1704
-        rtl8168_mac_ocp_write( tp, 0xF81C, 0x8EE1 );
1705
-        rtl8168_mac_ocp_write( tp, 0xF81E, 0xC60A );
1706
-        rtl8168_mac_ocp_write( tp, 0xF820, 0x77C0 );
1707
-        rtl8168_mac_ocp_write( tp, 0xF822, 0x4870 );
1708
-        rtl8168_mac_ocp_write( tp, 0xF824, 0x9FC0 );
1709
-        rtl8168_mac_ocp_write( tp, 0xF826, 0x1EA0 );
1710
-        rtl8168_mac_ocp_write( tp, 0xF828, 0xC707 );
1711
-        rtl8168_mac_ocp_write( tp, 0xF82A, 0x8EE1 );
1712
-        rtl8168_mac_ocp_write( tp, 0xF82C, 0x9D6C );
1713
-        rtl8168_mac_ocp_write( tp, 0xF82E, 0xC603 );
1714
-        rtl8168_mac_ocp_write( tp, 0xF830, 0xBE00 );
1715
-        rtl8168_mac_ocp_write( tp, 0xF832, 0xB416 );
1716
-        rtl8168_mac_ocp_write( tp, 0xF834, 0x0076 );
1717
-        rtl8168_mac_ocp_write( tp, 0xF836, 0xE86C );
1718
-        rtl8168_mac_ocp_write( tp, 0xF838, 0xC406 );
1719
-        rtl8168_mac_ocp_write( tp, 0xF83A, 0x7580 );
1720
-        rtl8168_mac_ocp_write( tp, 0xF83C, 0x4852 );
1721
-        rtl8168_mac_ocp_write( tp, 0xF83E, 0x8D80 );
1722
-        rtl8168_mac_ocp_write( tp, 0xF840, 0xC403 );
1723
-        rtl8168_mac_ocp_write( tp, 0xF842, 0xBC00 );
1724
-        rtl8168_mac_ocp_write( tp, 0xF844, 0xD3E0 );
1725
-        rtl8168_mac_ocp_write( tp, 0xF846, 0x02C8 );
1726
-        rtl8168_mac_ocp_write( tp, 0xF848, 0x8918 );
1727
-        rtl8168_mac_ocp_write( tp, 0xF84A, 0xE815 );
1728
-        rtl8168_mac_ocp_write( tp, 0xF84C, 0x1100 );
1729
-        rtl8168_mac_ocp_write( tp, 0xF84E, 0xF011 );
1730
-        rtl8168_mac_ocp_write( tp, 0xF850, 0xE812 );
1731
-        rtl8168_mac_ocp_write( tp, 0xF852, 0x4990 );
1732
-        rtl8168_mac_ocp_write( tp, 0xF854, 0xF002 );
1733
-        rtl8168_mac_ocp_write( tp, 0xF856, 0xE817 );
1734
-        rtl8168_mac_ocp_write( tp, 0xF858, 0xE80E );
1735
-        rtl8168_mac_ocp_write( tp, 0xF85A, 0x4992 );
1736
-        rtl8168_mac_ocp_write( tp, 0xF85C, 0xF002 );
1737
-        rtl8168_mac_ocp_write( tp, 0xF85E, 0xE80E );
1738
-        rtl8168_mac_ocp_write( tp, 0xF860, 0xE80A );
1739
-        rtl8168_mac_ocp_write( tp, 0xF862, 0x4993 );
1740
-        rtl8168_mac_ocp_write( tp, 0xF864, 0xF002 );
1741
-        rtl8168_mac_ocp_write( tp, 0xF866, 0xE818 );
1742
-        rtl8168_mac_ocp_write( tp, 0xF868, 0xE806 );
1743
-        rtl8168_mac_ocp_write( tp, 0xF86A, 0x4991 );
1744
-        rtl8168_mac_ocp_write( tp, 0xF86C, 0xF002 );
1745
-        rtl8168_mac_ocp_write( tp, 0xF86E, 0xE838 );
1746
-        rtl8168_mac_ocp_write( tp, 0xF870, 0xC25E );
1747
-        rtl8168_mac_ocp_write( tp, 0xF872, 0xBA00 );
1748
-        rtl8168_mac_ocp_write( tp, 0xF874, 0xC056 );
1749
-        rtl8168_mac_ocp_write( tp, 0xF876, 0x7100 );
1750
-        rtl8168_mac_ocp_write( tp, 0xF878, 0xFF80 );
1751
-        rtl8168_mac_ocp_write( tp, 0xF87A, 0x7100 );
1752
-        rtl8168_mac_ocp_write( tp, 0xF87C, 0x4892 );
1753
-        rtl8168_mac_ocp_write( tp, 0xF87E, 0x4813 );
1754
-        rtl8168_mac_ocp_write( tp, 0xF880, 0x8900 );
1755
-        rtl8168_mac_ocp_write( tp, 0xF882, 0xE00A );
1756
-        rtl8168_mac_ocp_write( tp, 0xF884, 0x7100 );
1757
-        rtl8168_mac_ocp_write( tp, 0xF886, 0x4890 );
1758
-        rtl8168_mac_ocp_write( tp, 0xF888, 0x4813 );
1759
-        rtl8168_mac_ocp_write( tp, 0xF88A, 0x8900 );
1760
-        rtl8168_mac_ocp_write( tp, 0xF88C, 0xC74B );
1761
-        rtl8168_mac_ocp_write( tp, 0xF88E, 0x74F8 );
1762
-        rtl8168_mac_ocp_write( tp, 0xF890, 0x48C2 );
1763
-        rtl8168_mac_ocp_write( tp, 0xF892, 0x4841 );
1764
-        rtl8168_mac_ocp_write( tp, 0xF894, 0x8CF8 );
1765
-        rtl8168_mac_ocp_write( tp, 0xF896, 0xC746 );
1766
-        rtl8168_mac_ocp_write( tp, 0xF898, 0x74FC );
1767
-        rtl8168_mac_ocp_write( tp, 0xF89A, 0x49C0 );
1768
-        rtl8168_mac_ocp_write( tp, 0xF89C, 0xF120 );
1769
-        rtl8168_mac_ocp_write( tp, 0xF89E, 0x49C1 );
1770
-        rtl8168_mac_ocp_write( tp, 0xF8A0, 0xF11E );
1771
-        rtl8168_mac_ocp_write( tp, 0xF8A2, 0x74F8 );
1772
-        rtl8168_mac_ocp_write( tp, 0xF8A4, 0x49C0 );
1773
-        rtl8168_mac_ocp_write( tp, 0xF8A6, 0xF01B );
1774
-        rtl8168_mac_ocp_write( tp, 0xF8A8, 0x49C6 );
1775
-        rtl8168_mac_ocp_write( tp, 0xF8AA, 0xF119 );
1776
-        rtl8168_mac_ocp_write( tp, 0xF8AC, 0x74F8 );
1777
-        rtl8168_mac_ocp_write( tp, 0xF8AE, 0x49C4 );
1778
-        rtl8168_mac_ocp_write( tp, 0xF8B0, 0xF013 );
1779
-        rtl8168_mac_ocp_write( tp, 0xF8B2, 0xC536 );
1780
-        rtl8168_mac_ocp_write( tp, 0xF8B4, 0x74B0 );
1781
-        rtl8168_mac_ocp_write( tp, 0xF8B6, 0x49C1 );
1782
-        rtl8168_mac_ocp_write( tp, 0xF8B8, 0xF1FD );
1783
-        rtl8168_mac_ocp_write( tp, 0xF8BA, 0xC537 );
1784
-        rtl8168_mac_ocp_write( tp, 0xF8BC, 0xC434 );
1785
-        rtl8168_mac_ocp_write( tp, 0xF8BE, 0x9CA0 );
1786
-        rtl8168_mac_ocp_write( tp, 0xF8C0, 0xC435 );
1787
-        rtl8168_mac_ocp_write( tp, 0xF8C2, 0x1C13 );
1788
-        rtl8168_mac_ocp_write( tp, 0xF8C4, 0x484F );
1789
-        rtl8168_mac_ocp_write( tp, 0xF8C6, 0x9CA2 );
1790
-        rtl8168_mac_ocp_write( tp, 0xF8C8, 0xC52B );
1791
-        rtl8168_mac_ocp_write( tp, 0xF8CA, 0x74B0 );
1792
-        rtl8168_mac_ocp_write( tp, 0xF8CC, 0x49C1 );
1793
-        rtl8168_mac_ocp_write( tp, 0xF8CE, 0xF1FD );
1794
-        rtl8168_mac_ocp_write( tp, 0xF8D0, 0x74F8 );
1795
-        rtl8168_mac_ocp_write( tp, 0xF8D2, 0x48C4 );
1796
-        rtl8168_mac_ocp_write( tp, 0xF8D4, 0x8CF8 );
1797
-        rtl8168_mac_ocp_write( tp, 0xF8D6, 0x7100 );
1798
-        rtl8168_mac_ocp_write( tp, 0xF8D8, 0x4893 );
1799
-        rtl8168_mac_ocp_write( tp, 0xF8DA, 0x8900 );
1800
-        rtl8168_mac_ocp_write( tp, 0xF8DC, 0xFF80 );
1801
-        rtl8168_mac_ocp_write( tp, 0xF8DE, 0xC520 );
1802
-        rtl8168_mac_ocp_write( tp, 0xF8E0, 0x74B0 );
1803
-        rtl8168_mac_ocp_write( tp, 0xF8E2, 0x49C1 );
1804
-        rtl8168_mac_ocp_write( tp, 0xF8E4, 0xF11C );
1805
-        rtl8168_mac_ocp_write( tp, 0xF8E6, 0xC71E );
1806
-        rtl8168_mac_ocp_write( tp, 0xF8E8, 0x74FC );
1807
-        rtl8168_mac_ocp_write( tp, 0xF8EA, 0x49C1 );
1808
-        rtl8168_mac_ocp_write( tp, 0xF8EC, 0xF118 );
1809
-        rtl8168_mac_ocp_write( tp, 0xF8EE, 0x49C0 );
1810
-        rtl8168_mac_ocp_write( tp, 0xF8F0, 0xF116 );
1811
-        rtl8168_mac_ocp_write( tp, 0xF8F2, 0x74F8 );
1812
-        rtl8168_mac_ocp_write( tp, 0xF8F4, 0x49C0 );
1813
-        rtl8168_mac_ocp_write( tp, 0xF8F6, 0xF013 );
1814
-        rtl8168_mac_ocp_write( tp, 0xF8F8, 0x48C3 );
1815
-        rtl8168_mac_ocp_write( tp, 0xF8FA, 0x8CF8 );
1816
-        rtl8168_mac_ocp_write( tp, 0xF8FC, 0xC516 );
1817
-        rtl8168_mac_ocp_write( tp, 0xF8FE, 0x74A2 );
1818
-        rtl8168_mac_ocp_write( tp, 0xF900, 0x49CE );
1819
-        rtl8168_mac_ocp_write( tp, 0xF902, 0xF1FE );
1820
-        rtl8168_mac_ocp_write( tp, 0xF904, 0xC411 );
1821
-        rtl8168_mac_ocp_write( tp, 0xF906, 0x9CA0 );
1822
-        rtl8168_mac_ocp_write( tp, 0xF908, 0xC411 );
1823
-        rtl8168_mac_ocp_write( tp, 0xF90A, 0x1C13 );
1824
-        rtl8168_mac_ocp_write( tp, 0xF90C, 0x484F );
1825
-        rtl8168_mac_ocp_write( tp, 0xF90E, 0x9CA2 );
1826
-        rtl8168_mac_ocp_write( tp, 0xF910, 0x74A2 );
1827
-        rtl8168_mac_ocp_write( tp, 0xF912, 0x49CF );
1828
-        rtl8168_mac_ocp_write( tp, 0xF914, 0xF1FE );
1829
-        rtl8168_mac_ocp_write( tp, 0xF916, 0x7100 );
1830
-        rtl8168_mac_ocp_write( tp, 0xF918, 0x4891 );
1831
-        rtl8168_mac_ocp_write( tp, 0xF91A, 0x8900 );
1832
-        rtl8168_mac_ocp_write( tp, 0xF91C, 0xFF80 );
1833
-        rtl8168_mac_ocp_write( tp, 0xF91E, 0xE400 );
1834
-        rtl8168_mac_ocp_write( tp, 0xF920, 0xD3E0 );
1835
-        rtl8168_mac_ocp_write( tp, 0xF922, 0xE000 );
1836
-        rtl8168_mac_ocp_write( tp, 0xF924, 0x0481 );
1837
-        rtl8168_mac_ocp_write( tp, 0xF926, 0x0C81 );
1838
-        rtl8168_mac_ocp_write( tp, 0xF928, 0xDE20 );
1839
-        rtl8168_mac_ocp_write( tp, 0xF92A, 0x0000 );
1840
-        rtl8168_mac_ocp_write( tp, 0xF92C, 0x0992 );
1841
-        rtl8168_mac_ocp_write( tp, 0xF92E, 0x1B76 );
1842
-        rtl8168_mac_ocp_write( tp, 0xF930, 0xC602 );
1843
-        rtl8168_mac_ocp_write( tp, 0xF932, 0xBE00 );
1844
-        rtl8168_mac_ocp_write( tp, 0xF934, 0x059C );
1845
-        rtl8168_mac_ocp_write( tp, 0xF936, 0x1B76 );
1846
-        rtl8168_mac_ocp_write( tp, 0xF938, 0xC602 );
1847
-        rtl8168_mac_ocp_write( tp, 0xF93A, 0xBE00 );
1848
-        rtl8168_mac_ocp_write( tp, 0xF93C, 0x065A );
1849
-        rtl8168_mac_ocp_write( tp, 0xF93E, 0xB400 );
1850
-        rtl8168_mac_ocp_write( tp, 0xF940, 0x18DE );
1851
-        rtl8168_mac_ocp_write( tp, 0xF942, 0x2008 );
1852
-        rtl8168_mac_ocp_write( tp, 0xF944, 0x4001 );
1853
-        rtl8168_mac_ocp_write( tp, 0xF946, 0xF10F );
1854
-        rtl8168_mac_ocp_write( tp, 0xF948, 0x7342 );
1855
-        rtl8168_mac_ocp_write( tp, 0xF94A, 0x1880 );
1856
-        rtl8168_mac_ocp_write( tp, 0xF94C, 0x2008 );
1857
-        rtl8168_mac_ocp_write( tp, 0xF94E, 0x0009 );
1858
-        rtl8168_mac_ocp_write( tp, 0xF950, 0x4018 );
1859
-        rtl8168_mac_ocp_write( tp, 0xF952, 0xF109 );
1860
-        rtl8168_mac_ocp_write( tp, 0xF954, 0x7340 );
1861
-        rtl8168_mac_ocp_write( tp, 0xF956, 0x25BC );
1862
-        rtl8168_mac_ocp_write( tp, 0xF958, 0x130F );
1863
-        rtl8168_mac_ocp_write( tp, 0xF95A, 0xF105 );
1864
-        rtl8168_mac_ocp_write( tp, 0xF95C, 0xC00A );
1865
-        rtl8168_mac_ocp_write( tp, 0xF95E, 0x7300 );
1866
-        rtl8168_mac_ocp_write( tp, 0xF960, 0x4831 );
1867
-        rtl8168_mac_ocp_write( tp, 0xF962, 0x9B00 );
1868
-        rtl8168_mac_ocp_write( tp, 0xF964, 0xB000 );
1869
-        rtl8168_mac_ocp_write( tp, 0xF966, 0x7340 );
1870
-        rtl8168_mac_ocp_write( tp, 0xF968, 0x8320 );
1871
-        rtl8168_mac_ocp_write( tp, 0xF96A, 0xC302 );
1872
-        rtl8168_mac_ocp_write( tp, 0xF96C, 0xBB00 );
1873
-        rtl8168_mac_ocp_write( tp, 0xF96E, 0x0C12 );
1874
-        rtl8168_mac_ocp_write( tp, 0xF970, 0xE860 );
1875
-        rtl8168_mac_ocp_write( tp, 0xF972, 0xC406 );
1876
-        rtl8168_mac_ocp_write( tp, 0xF974, 0x7580 );
1877
-        rtl8168_mac_ocp_write( tp, 0xF976, 0x4851 );
1878
-        rtl8168_mac_ocp_write( tp, 0xF978, 0x8D80 );
1879
-        rtl8168_mac_ocp_write( tp, 0xF97A, 0xC403 );
1880
-        rtl8168_mac_ocp_write( tp, 0xF97C, 0xBC00 );
1881
-        rtl8168_mac_ocp_write( tp, 0xF97E, 0xD3E0 );
1882
-        rtl8168_mac_ocp_write( tp, 0xF980, 0x02C8 );
1883
-        rtl8168_mac_ocp_write( tp, 0xF982, 0xC406 );
1884
-        rtl8168_mac_ocp_write( tp, 0xF984, 0x7580 );
1885
-        rtl8168_mac_ocp_write( tp, 0xF986, 0x4850 );
1886
-        rtl8168_mac_ocp_write( tp, 0xF988, 0x8D80 );
1887
-        rtl8168_mac_ocp_write( tp, 0xF98A, 0xC403 );
1888
-        rtl8168_mac_ocp_write( tp, 0xF98C, 0xBC00 );
1889
-        rtl8168_mac_ocp_write( tp, 0xF98E, 0xD3E0 );
1890
-        rtl8168_mac_ocp_write( tp, 0xF990, 0x0298 );
1891
-
1892
-        rtl8168_mac_ocp_write( tp, 0xDE30, 0x0080 );
1893
-
1894
-        rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
1895
-
1896
-        rtl8168_mac_ocp_write( tp, 0xFC28, 0x0075 );
1897
-        rtl8168_mac_ocp_write( tp, 0xFC2A, 0x02B1 );
1898
-        rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0991 );
1899
-        rtl8168_mac_ocp_write( tp, 0xFC2E, 0x059B );
1900
-        rtl8168_mac_ocp_write( tp, 0xFC30, 0x0659 );
1901
-        rtl8168_mac_ocp_write( tp, 0xFC32, 0x0000 );
1902
-        rtl8168_mac_ocp_write( tp, 0xFC34, 0x02C7 );
1903
-        rtl8168_mac_ocp_write( tp, 0xFC36, 0x0279 );
1904
+        rtl8168_mac_ocp_write(tp, 0xF800, 0xE008);
1905
+        rtl8168_mac_ocp_write(tp, 0xF802, 0xE01B);
1906
+        rtl8168_mac_ocp_write(tp, 0xF804, 0xE022);
1907
+        rtl8168_mac_ocp_write(tp, 0xF806, 0xE094);
1908
+        rtl8168_mac_ocp_write(tp, 0xF808, 0xE097);
1909
+        rtl8168_mac_ocp_write(tp, 0xF80A, 0xE09A);
1910
+        rtl8168_mac_ocp_write(tp, 0xF80C, 0xE0B3);
1911
+        rtl8168_mac_ocp_write(tp, 0xF80E, 0xE0BA);
1912
+        rtl8168_mac_ocp_write(tp, 0xF810, 0x49D2);
1913
+        rtl8168_mac_ocp_write(tp, 0xF812, 0xF10D);
1914
+        rtl8168_mac_ocp_write(tp, 0xF814, 0x766C);
1915
+        rtl8168_mac_ocp_write(tp, 0xF816, 0x49E2);
1916
+        rtl8168_mac_ocp_write(tp, 0xF818, 0xF00A);
1917
+        rtl8168_mac_ocp_write(tp, 0xF81A, 0x1EC0);
1918
+        rtl8168_mac_ocp_write(tp, 0xF81C, 0x8EE1);
1919
+        rtl8168_mac_ocp_write(tp, 0xF81E, 0xC60A);
1920
+        rtl8168_mac_ocp_write(tp, 0xF820, 0x77C0);
1921
+        rtl8168_mac_ocp_write(tp, 0xF822, 0x4870);
1922
+        rtl8168_mac_ocp_write(tp, 0xF824, 0x9FC0);
1923
+        rtl8168_mac_ocp_write(tp, 0xF826, 0x1EA0);
1924
+        rtl8168_mac_ocp_write(tp, 0xF828, 0xC707);
1925
+        rtl8168_mac_ocp_write(tp, 0xF82A, 0x8EE1);
1926
+        rtl8168_mac_ocp_write(tp, 0xF82C, 0x9D6C);
1927
+        rtl8168_mac_ocp_write(tp, 0xF82E, 0xC603);
1928
+        rtl8168_mac_ocp_write(tp, 0xF830, 0xBE00);
1929
+        rtl8168_mac_ocp_write(tp, 0xF832, 0xB416);
1930
+        rtl8168_mac_ocp_write(tp, 0xF834, 0x0076);
1931
+        rtl8168_mac_ocp_write(tp, 0xF836, 0xE86C);
1932
+        rtl8168_mac_ocp_write(tp, 0xF838, 0xC406);
1933
+        rtl8168_mac_ocp_write(tp, 0xF83A, 0x7580);
1934
+        rtl8168_mac_ocp_write(tp, 0xF83C, 0x4852);
1935
+        rtl8168_mac_ocp_write(tp, 0xF83E, 0x8D80);
1936
+        rtl8168_mac_ocp_write(tp, 0xF840, 0xC403);
1937
+        rtl8168_mac_ocp_write(tp, 0xF842, 0xBC00);
1938
+        rtl8168_mac_ocp_write(tp, 0xF844, 0xD3E0);
1939
+        rtl8168_mac_ocp_write(tp, 0xF846, 0x02C8);
1940
+        rtl8168_mac_ocp_write(tp, 0xF848, 0x8918);
1941
+        rtl8168_mac_ocp_write(tp, 0xF84A, 0xE815);
1942
+        rtl8168_mac_ocp_write(tp, 0xF84C, 0x1100);
1943
+        rtl8168_mac_ocp_write(tp, 0xF84E, 0xF011);
1944
+        rtl8168_mac_ocp_write(tp, 0xF850, 0xE812);
1945
+        rtl8168_mac_ocp_write(tp, 0xF852, 0x4990);
1946
+        rtl8168_mac_ocp_write(tp, 0xF854, 0xF002);
1947
+        rtl8168_mac_ocp_write(tp, 0xF856, 0xE817);
1948
+        rtl8168_mac_ocp_write(tp, 0xF858, 0xE80E);
1949
+        rtl8168_mac_ocp_write(tp, 0xF85A, 0x4992);
1950
+        rtl8168_mac_ocp_write(tp, 0xF85C, 0xF002);
1951
+        rtl8168_mac_ocp_write(tp, 0xF85E, 0xE80E);
1952
+        rtl8168_mac_ocp_write(tp, 0xF860, 0xE80A);
1953
+        rtl8168_mac_ocp_write(tp, 0xF862, 0x4993);
1954
+        rtl8168_mac_ocp_write(tp, 0xF864, 0xF002);
1955
+        rtl8168_mac_ocp_write(tp, 0xF866, 0xE818);
1956
+        rtl8168_mac_ocp_write(tp, 0xF868, 0xE806);
1957
+        rtl8168_mac_ocp_write(tp, 0xF86A, 0x4991);
1958
+        rtl8168_mac_ocp_write(tp, 0xF86C, 0xF002);
1959
+        rtl8168_mac_ocp_write(tp, 0xF86E, 0xE838);
1960
+        rtl8168_mac_ocp_write(tp, 0xF870, 0xC25E);
1961
+        rtl8168_mac_ocp_write(tp, 0xF872, 0xBA00);
1962
+        rtl8168_mac_ocp_write(tp, 0xF874, 0xC056);
1963
+        rtl8168_mac_ocp_write(tp, 0xF876, 0x7100);
1964
+        rtl8168_mac_ocp_write(tp, 0xF878, 0xFF80);
1965
+        rtl8168_mac_ocp_write(tp, 0xF87A, 0x7100);
1966
+        rtl8168_mac_ocp_write(tp, 0xF87C, 0x4892);
1967
+        rtl8168_mac_ocp_write(tp, 0xF87E, 0x4813);
1968
+        rtl8168_mac_ocp_write(tp, 0xF880, 0x8900);
1969
+        rtl8168_mac_ocp_write(tp, 0xF882, 0xE00A);
1970
+        rtl8168_mac_ocp_write(tp, 0xF884, 0x7100);
1971
+        rtl8168_mac_ocp_write(tp, 0xF886, 0x4890);
1972
+        rtl8168_mac_ocp_write(tp, 0xF888, 0x4813);
1973
+        rtl8168_mac_ocp_write(tp, 0xF88A, 0x8900);
1974
+        rtl8168_mac_ocp_write(tp, 0xF88C, 0xC74B);
1975
+        rtl8168_mac_ocp_write(tp, 0xF88E, 0x74F8);
1976
+        rtl8168_mac_ocp_write(tp, 0xF890, 0x48C2);
1977
+        rtl8168_mac_ocp_write(tp, 0xF892, 0x4841);
1978
+        rtl8168_mac_ocp_write(tp, 0xF894, 0x8CF8);
1979
+        rtl8168_mac_ocp_write(tp, 0xF896, 0xC746);
1980
+        rtl8168_mac_ocp_write(tp, 0xF898, 0x74FC);
1981
+        rtl8168_mac_ocp_write(tp, 0xF89A, 0x49C0);
1982
+        rtl8168_mac_ocp_write(tp, 0xF89C, 0xF120);
1983
+        rtl8168_mac_ocp_write(tp, 0xF89E, 0x49C1);
1984
+        rtl8168_mac_ocp_write(tp, 0xF8A0, 0xF11E);
1985
+        rtl8168_mac_ocp_write(tp, 0xF8A2, 0x74F8);
1986
+        rtl8168_mac_ocp_write(tp, 0xF8A4, 0x49C0);
1987
+        rtl8168_mac_ocp_write(tp, 0xF8A6, 0xF01B);
1988
+        rtl8168_mac_ocp_write(tp, 0xF8A8, 0x49C6);
1989
+        rtl8168_mac_ocp_write(tp, 0xF8AA, 0xF119);
1990
+        rtl8168_mac_ocp_write(tp, 0xF8AC, 0x74F8);
1991
+        rtl8168_mac_ocp_write(tp, 0xF8AE, 0x49C4);
1992
+        rtl8168_mac_ocp_write(tp, 0xF8B0, 0xF013);
1993
+        rtl8168_mac_ocp_write(tp, 0xF8B2, 0xC536);
1994
+        rtl8168_mac_ocp_write(tp, 0xF8B4, 0x74B0);
1995
+        rtl8168_mac_ocp_write(tp, 0xF8B6, 0x49C1);
1996
+        rtl8168_mac_ocp_write(tp, 0xF8B8, 0xF1FD);
1997
+        rtl8168_mac_ocp_write(tp, 0xF8BA, 0xC537);
1998
+        rtl8168_mac_ocp_write(tp, 0xF8BC, 0xC434);
1999
+        rtl8168_mac_ocp_write(tp, 0xF8BE, 0x9CA0);
2000
+        rtl8168_mac_ocp_write(tp, 0xF8C0, 0xC435);
2001
+        rtl8168_mac_ocp_write(tp, 0xF8C2, 0x1C13);
2002
+        rtl8168_mac_ocp_write(tp, 0xF8C4, 0x484F);
2003
+        rtl8168_mac_ocp_write(tp, 0xF8C6, 0x9CA2);
2004
+        rtl8168_mac_ocp_write(tp, 0xF8C8, 0xC52B);
2005
+        rtl8168_mac_ocp_write(tp, 0xF8CA, 0x74B0);
2006
+        rtl8168_mac_ocp_write(tp, 0xF8CC, 0x49C1);
2007
+        rtl8168_mac_ocp_write(tp, 0xF8CE, 0xF1FD);
2008
+        rtl8168_mac_ocp_write(tp, 0xF8D0, 0x74F8);
2009
+        rtl8168_mac_ocp_write(tp, 0xF8D2, 0x48C4);
2010
+        rtl8168_mac_ocp_write(tp, 0xF8D4, 0x8CF8);
2011
+        rtl8168_mac_ocp_write(tp, 0xF8D6, 0x7100);
2012
+        rtl8168_mac_ocp_write(tp, 0xF8D8, 0x4893);
2013
+        rtl8168_mac_ocp_write(tp, 0xF8DA, 0x8900);
2014
+        rtl8168_mac_ocp_write(tp, 0xF8DC, 0xFF80);
2015
+        rtl8168_mac_ocp_write(tp, 0xF8DE, 0xC520);
2016
+        rtl8168_mac_ocp_write(tp, 0xF8E0, 0x74B0);
2017
+        rtl8168_mac_ocp_write(tp, 0xF8E2, 0x49C1);
2018
+        rtl8168_mac_ocp_write(tp, 0xF8E4, 0xF11C);
2019
+        rtl8168_mac_ocp_write(tp, 0xF8E6, 0xC71E);
2020
+        rtl8168_mac_ocp_write(tp, 0xF8E8, 0x74FC);
2021
+        rtl8168_mac_ocp_write(tp, 0xF8EA, 0x49C1);
2022
+        rtl8168_mac_ocp_write(tp, 0xF8EC, 0xF118);
2023
+        rtl8168_mac_ocp_write(tp, 0xF8EE, 0x49C0);
2024
+        rtl8168_mac_ocp_write(tp, 0xF8F0, 0xF116);
2025
+        rtl8168_mac_ocp_write(tp, 0xF8F2, 0x74F8);
2026
+        rtl8168_mac_ocp_write(tp, 0xF8F4, 0x49C0);
2027
+        rtl8168_mac_ocp_write(tp, 0xF8F6, 0xF013);
2028
+        rtl8168_mac_ocp_write(tp, 0xF8F8, 0x48C3);
2029
+        rtl8168_mac_ocp_write(tp, 0xF8FA, 0x8CF8);
2030
+        rtl8168_mac_ocp_write(tp, 0xF8FC, 0xC516);
2031
+        rtl8168_mac_ocp_write(tp, 0xF8FE, 0x74A2);
2032
+        rtl8168_mac_ocp_write(tp, 0xF900, 0x49CE);
2033
+        rtl8168_mac_ocp_write(tp, 0xF902, 0xF1FE);
2034
+        rtl8168_mac_ocp_write(tp, 0xF904, 0xC411);
2035
+        rtl8168_mac_ocp_write(tp, 0xF906, 0x9CA0);
2036
+        rtl8168_mac_ocp_write(tp, 0xF908, 0xC411);
2037
+        rtl8168_mac_ocp_write(tp, 0xF90A, 0x1C13);
2038
+        rtl8168_mac_ocp_write(tp, 0xF90C, 0x484F);
2039
+        rtl8168_mac_ocp_write(tp, 0xF90E, 0x9CA2);
2040
+        rtl8168_mac_ocp_write(tp, 0xF910, 0x74A2);
2041
+        rtl8168_mac_ocp_write(tp, 0xF912, 0x49CF);
2042
+        rtl8168_mac_ocp_write(tp, 0xF914, 0xF1FE);
2043
+        rtl8168_mac_ocp_write(tp, 0xF916, 0x7100);
2044
+        rtl8168_mac_ocp_write(tp, 0xF918, 0x4891);
2045
+        rtl8168_mac_ocp_write(tp, 0xF91A, 0x8900);
2046
+        rtl8168_mac_ocp_write(tp, 0xF91C, 0xFF80);
2047
+        rtl8168_mac_ocp_write(tp, 0xF91E, 0xE400);
2048
+        rtl8168_mac_ocp_write(tp, 0xF920, 0xD3E0);
2049
+        rtl8168_mac_ocp_write(tp, 0xF922, 0xE000);
2050
+        rtl8168_mac_ocp_write(tp, 0xF924, 0x0481);
2051
+        rtl8168_mac_ocp_write(tp, 0xF926, 0x0C81);
2052
+        rtl8168_mac_ocp_write(tp, 0xF928, 0xDE20);
2053
+        rtl8168_mac_ocp_write(tp, 0xF92A, 0x0000);
2054
+        rtl8168_mac_ocp_write(tp, 0xF92C, 0x0992);
2055
+        rtl8168_mac_ocp_write(tp, 0xF92E, 0x1B76);
2056
+        rtl8168_mac_ocp_write(tp, 0xF930, 0xC602);
2057
+        rtl8168_mac_ocp_write(tp, 0xF932, 0xBE00);
2058
+        rtl8168_mac_ocp_write(tp, 0xF934, 0x059C);
2059
+        rtl8168_mac_ocp_write(tp, 0xF936, 0x1B76);
2060
+        rtl8168_mac_ocp_write(tp, 0xF938, 0xC602);
2061
+        rtl8168_mac_ocp_write(tp, 0xF93A, 0xBE00);
2062
+        rtl8168_mac_ocp_write(tp, 0xF93C, 0x065A);
2063
+        rtl8168_mac_ocp_write(tp, 0xF93E, 0xB400);
2064
+        rtl8168_mac_ocp_write(tp, 0xF940, 0x18DE);
2065
+        rtl8168_mac_ocp_write(tp, 0xF942, 0x2008);
2066
+        rtl8168_mac_ocp_write(tp, 0xF944, 0x4001);
2067
+        rtl8168_mac_ocp_write(tp, 0xF946, 0xF10F);
2068
+        rtl8168_mac_ocp_write(tp, 0xF948, 0x7342);
2069
+        rtl8168_mac_ocp_write(tp, 0xF94A, 0x1880);
2070
+        rtl8168_mac_ocp_write(tp, 0xF94C, 0x2008);
2071
+        rtl8168_mac_ocp_write(tp, 0xF94E, 0x0009);
2072
+        rtl8168_mac_ocp_write(tp, 0xF950, 0x4018);
2073
+        rtl8168_mac_ocp_write(tp, 0xF952, 0xF109);
2074
+        rtl8168_mac_ocp_write(tp, 0xF954, 0x7340);
2075
+        rtl8168_mac_ocp_write(tp, 0xF956, 0x25BC);
2076
+        rtl8168_mac_ocp_write(tp, 0xF958, 0x130F);
2077
+        rtl8168_mac_ocp_write(tp, 0xF95A, 0xF105);
2078
+        rtl8168_mac_ocp_write(tp, 0xF95C, 0xC00A);
2079
+        rtl8168_mac_ocp_write(tp, 0xF95E, 0x7300);
2080
+        rtl8168_mac_ocp_write(tp, 0xF960, 0x4831);
2081
+        rtl8168_mac_ocp_write(tp, 0xF962, 0x9B00);
2082
+        rtl8168_mac_ocp_write(tp, 0xF964, 0xB000);
2083
+        rtl8168_mac_ocp_write(tp, 0xF966, 0x7340);
2084
+        rtl8168_mac_ocp_write(tp, 0xF968, 0x8320);
2085
+        rtl8168_mac_ocp_write(tp, 0xF96A, 0xC302);
2086
+        rtl8168_mac_ocp_write(tp, 0xF96C, 0xBB00);
2087
+        rtl8168_mac_ocp_write(tp, 0xF96E, 0x0C12);
2088
+        rtl8168_mac_ocp_write(tp, 0xF970, 0xE860);
2089
+        rtl8168_mac_ocp_write(tp, 0xF972, 0xC406);
2090
+        rtl8168_mac_ocp_write(tp, 0xF974, 0x7580);
2091
+        rtl8168_mac_ocp_write(tp, 0xF976, 0x4851);
2092
+        rtl8168_mac_ocp_write(tp, 0xF978, 0x8D80);
2093
+        rtl8168_mac_ocp_write(tp, 0xF97A, 0xC403);
2094
+        rtl8168_mac_ocp_write(tp, 0xF97C, 0xBC00);
2095
+        rtl8168_mac_ocp_write(tp, 0xF97E, 0xD3E0);
2096
+        rtl8168_mac_ocp_write(tp, 0xF980, 0x02C8);
2097
+        rtl8168_mac_ocp_write(tp, 0xF982, 0xC406);
2098
+        rtl8168_mac_ocp_write(tp, 0xF984, 0x7580);
2099
+        rtl8168_mac_ocp_write(tp, 0xF986, 0x4850);
2100
+        rtl8168_mac_ocp_write(tp, 0xF988, 0x8D80);
2101
+        rtl8168_mac_ocp_write(tp, 0xF98A, 0xC403);
2102
+        rtl8168_mac_ocp_write(tp, 0xF98C, 0xBC00);
2103
+        rtl8168_mac_ocp_write(tp, 0xF98E, 0xD3E0);
2104
+        rtl8168_mac_ocp_write(tp, 0xF990, 0x0298);
2105
+
2106
+        rtl8168_mac_ocp_write(tp, 0xDE30, 0x0080);
2107
+
2108
+        rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
2109
+
2110
+        rtl8168_mac_ocp_write(tp, 0xFC28, 0x0075);
2111
+        rtl8168_mac_ocp_write(tp, 0xFC2A, 0x02B1);
2112
+        rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0991);
2113
+        rtl8168_mac_ocp_write(tp, 0xFC2E, 0x059B);
2114
+        rtl8168_mac_ocp_write(tp, 0xFC30, 0x0659);
2115
+        rtl8168_mac_ocp_write(tp, 0xFC32, 0x0000);
2116
+        rtl8168_mac_ocp_write(tp, 0xFC34, 0x02C7);
2117
+        rtl8168_mac_ocp_write(tp, 0xFC36, 0x0279);
2118
 }
2119
 
2120
 static void
2121
@@ -9119,127 +9266,127 @@
2122
 
2123
         rtl8168_hw_disable_mac_mcu_bps(dev);
2124
 
2125
-        rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
2126
-        rtl8168_mac_ocp_write( tp, 0xF802, 0xE011 );
2127
-        rtl8168_mac_ocp_write( tp, 0xF804, 0xE015 );
2128
-        rtl8168_mac_ocp_write( tp, 0xF806, 0xE018 );
2129
-        rtl8168_mac_ocp_write( tp, 0xF808, 0xE01B );
2130
-        rtl8168_mac_ocp_write( tp, 0xF80A, 0xE027 );
2131
-        rtl8168_mac_ocp_write( tp, 0xF80C, 0xE043 );
2132
-        rtl8168_mac_ocp_write( tp, 0xF80E, 0xE065 );
2133
-        rtl8168_mac_ocp_write( tp, 0xF810, 0x49E2 );
2134
-        rtl8168_mac_ocp_write( tp, 0xF812, 0xF005 );
2135
-        rtl8168_mac_ocp_write( tp, 0xF814, 0x49EA );
2136
-        rtl8168_mac_ocp_write( tp, 0xF816, 0xF003 );
2137
-        rtl8168_mac_ocp_write( tp, 0xF818, 0xC404 );
2138
-        rtl8168_mac_ocp_write( tp, 0xF81A, 0xBC00 );
2139
-        rtl8168_mac_ocp_write( tp, 0xF81C, 0xC403 );
2140
-        rtl8168_mac_ocp_write( tp, 0xF81E, 0xBC00 );
2141
-        rtl8168_mac_ocp_write( tp, 0xF820, 0x0496 );
2142
-        rtl8168_mac_ocp_write( tp, 0xF822, 0x051A );
2143
-        rtl8168_mac_ocp_write( tp, 0xF824, 0x1D01 );
2144
-        rtl8168_mac_ocp_write( tp, 0xF826, 0x8DE8 );
2145
-        rtl8168_mac_ocp_write( tp, 0xF828, 0xC602 );
2146
-        rtl8168_mac_ocp_write( tp, 0xF82A, 0xBE00 );
2147
-        rtl8168_mac_ocp_write( tp, 0xF82C, 0x0206 );
2148
-        rtl8168_mac_ocp_write( tp, 0xF82E, 0x1B76 );
2149
-        rtl8168_mac_ocp_write( tp, 0xF830, 0xC202 );
2150
-        rtl8168_mac_ocp_write( tp, 0xF832, 0xBA00 );
2151
-        rtl8168_mac_ocp_write( tp, 0xF834, 0x058A );
2152
-        rtl8168_mac_ocp_write( tp, 0xF836, 0x1B76 );
2153
-        rtl8168_mac_ocp_write( tp, 0xF838, 0xC602 );
2154
-        rtl8168_mac_ocp_write( tp, 0xF83A, 0xBE00 );
2155
-        rtl8168_mac_ocp_write( tp, 0xF83C, 0x0648 );
2156
-        rtl8168_mac_ocp_write( tp, 0xF83E, 0x74E6 );
2157
-        rtl8168_mac_ocp_write( tp, 0xF840, 0x1B78 );
2158
-        rtl8168_mac_ocp_write( tp, 0xF842, 0x46DC );
2159
-        rtl8168_mac_ocp_write( tp, 0xF844, 0x1300 );
2160
-        rtl8168_mac_ocp_write( tp, 0xF846, 0xF005 );
2161
-        rtl8168_mac_ocp_write( tp, 0xF848, 0x74F8 );
2162
-        rtl8168_mac_ocp_write( tp, 0xF84A, 0x48C3 );
2163
-        rtl8168_mac_ocp_write( tp, 0xF84C, 0x48C4 );
2164
-        rtl8168_mac_ocp_write( tp, 0xF84E, 0x8CF8 );
2165
-        rtl8168_mac_ocp_write( tp, 0xF850, 0x64E7 );
2166
-        rtl8168_mac_ocp_write( tp, 0xF852, 0xC302 );
2167
-        rtl8168_mac_ocp_write( tp, 0xF854, 0xBB00 );
2168
-        rtl8168_mac_ocp_write( tp, 0xF856, 0x068E );
2169
-        rtl8168_mac_ocp_write( tp, 0xF858, 0x74E4 );
2170
-        rtl8168_mac_ocp_write( tp, 0xF85A, 0x49C5 );
2171
-        rtl8168_mac_ocp_write( tp, 0xF85C, 0xF106 );
2172
-        rtl8168_mac_ocp_write( tp, 0xF85E, 0x49C6 );
2173
-        rtl8168_mac_ocp_write( tp, 0xF860, 0xF107 );
2174
-        rtl8168_mac_ocp_write( tp, 0xF862, 0x48C8 );
2175
-        rtl8168_mac_ocp_write( tp, 0xF864, 0x48C9 );
2176
-        rtl8168_mac_ocp_write( tp, 0xF866, 0xE011 );
2177
-        rtl8168_mac_ocp_write( tp, 0xF868, 0x48C9 );
2178
-        rtl8168_mac_ocp_write( tp, 0xF86A, 0x4848 );
2179
-        rtl8168_mac_ocp_write( tp, 0xF86C, 0xE00E );
2180
-        rtl8168_mac_ocp_write( tp, 0xF86E, 0x4848 );
2181
-        rtl8168_mac_ocp_write( tp, 0xF870, 0x49C7 );
2182
-        rtl8168_mac_ocp_write( tp, 0xF872, 0xF00A );
2183
-        rtl8168_mac_ocp_write( tp, 0xF874, 0x48C9 );
2184
-        rtl8168_mac_ocp_write( tp, 0xF876, 0xC60D );
2185
-        rtl8168_mac_ocp_write( tp, 0xF878, 0x1D1F );
2186
-        rtl8168_mac_ocp_write( tp, 0xF87A, 0x8DC2 );
2187
-        rtl8168_mac_ocp_write( tp, 0xF87C, 0x1D00 );
2188
-        rtl8168_mac_ocp_write( tp, 0xF87E, 0x8DC3 );
2189
-        rtl8168_mac_ocp_write( tp, 0xF880, 0x1D11 );
2190
-        rtl8168_mac_ocp_write( tp, 0xF882, 0x8DC0 );
2191
-        rtl8168_mac_ocp_write( tp, 0xF884, 0xE002 );
2192
-        rtl8168_mac_ocp_write( tp, 0xF886, 0x4849 );
2193
-        rtl8168_mac_ocp_write( tp, 0xF888, 0x94E5 );
2194
-        rtl8168_mac_ocp_write( tp, 0xF88A, 0xC602 );
2195
-        rtl8168_mac_ocp_write( tp, 0xF88C, 0xBE00 );
2196
-        rtl8168_mac_ocp_write( tp, 0xF88E, 0x0238 );
2197
-        rtl8168_mac_ocp_write( tp, 0xF890, 0xE434 );
2198
-        rtl8168_mac_ocp_write( tp, 0xF892, 0x49D9 );
2199
-        rtl8168_mac_ocp_write( tp, 0xF894, 0xF01B );
2200
-        rtl8168_mac_ocp_write( tp, 0xF896, 0xC31E );
2201
-        rtl8168_mac_ocp_write( tp, 0xF898, 0x7464 );
2202
-        rtl8168_mac_ocp_write( tp, 0xF89A, 0x49C4 );
2203
-        rtl8168_mac_ocp_write( tp, 0xF89C, 0xF114 );
2204
-        rtl8168_mac_ocp_write( tp, 0xF89E, 0xC31B );
2205
-        rtl8168_mac_ocp_write( tp, 0xF8A0, 0x6460 );
2206
-        rtl8168_mac_ocp_write( tp, 0xF8A2, 0x14FA );
2207
-        rtl8168_mac_ocp_write( tp, 0xF8A4, 0xFA02 );
2208
-        rtl8168_mac_ocp_write( tp, 0xF8A6, 0xE00F );
2209
-        rtl8168_mac_ocp_write( tp, 0xF8A8, 0xC317 );
2210
-        rtl8168_mac_ocp_write( tp, 0xF8AA, 0x7460 );
2211
-        rtl8168_mac_ocp_write( tp, 0xF8AC, 0x49C0 );
2212
-        rtl8168_mac_ocp_write( tp, 0xF8AE, 0xF10B );
2213
-        rtl8168_mac_ocp_write( tp, 0xF8B0, 0xC311 );
2214
-        rtl8168_mac_ocp_write( tp, 0xF8B2, 0x7462 );
2215
-        rtl8168_mac_ocp_write( tp, 0xF8B4, 0x48C1 );
2216
-        rtl8168_mac_ocp_write( tp, 0xF8B6, 0x9C62 );
2217
-        rtl8168_mac_ocp_write( tp, 0xF8B8, 0x4841 );
2218
-        rtl8168_mac_ocp_write( tp, 0xF8BA, 0x9C62 );
2219
-        rtl8168_mac_ocp_write( tp, 0xF8BC, 0xC30A );
2220
-        rtl8168_mac_ocp_write( tp, 0xF8BE, 0x1C04 );
2221
-        rtl8168_mac_ocp_write( tp, 0xF8C0, 0x8C60 );
2222
-        rtl8168_mac_ocp_write( tp, 0xF8C2, 0xE004 );
2223
-        rtl8168_mac_ocp_write( tp, 0xF8C4, 0x1C15 );
2224
-        rtl8168_mac_ocp_write( tp, 0xF8C6, 0xC305 );
2225
-        rtl8168_mac_ocp_write( tp, 0xF8C8, 0x8C60 );
2226
-        rtl8168_mac_ocp_write( tp, 0xF8CA, 0xC602 );
2227
-        rtl8168_mac_ocp_write( tp, 0xF8CC, 0xBE00 );
2228
-        rtl8168_mac_ocp_write( tp, 0xF8CE, 0x0374 );
2229
-        rtl8168_mac_ocp_write( tp, 0xF8D0, 0xE434 );
2230
-        rtl8168_mac_ocp_write( tp, 0xF8D2, 0xE030 );
2231
-        rtl8168_mac_ocp_write( tp, 0xF8D4, 0xE61C );
2232
-        rtl8168_mac_ocp_write( tp, 0xF8D6, 0xE906 );
2233
-        rtl8168_mac_ocp_write( tp, 0xF8D8, 0xC602 );
2234
-        rtl8168_mac_ocp_write( tp, 0xF8DA, 0xBE00 );
2235
-        rtl8168_mac_ocp_write( tp, 0xF8DC, 0x0000 );
2236
-
2237
-        rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
2238
-
2239
-        rtl8168_mac_ocp_write( tp, 0xFC28, 0x0493 );
2240
-        rtl8168_mac_ocp_write( tp, 0xFC2A, 0x0205 );
2241
-        rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0589 );
2242
-        rtl8168_mac_ocp_write( tp, 0xFC2E, 0x0647 );
2243
-        rtl8168_mac_ocp_write( tp, 0xFC30, 0x0000 );
2244
-        rtl8168_mac_ocp_write( tp, 0xFC32, 0x0215 );
2245
-        rtl8168_mac_ocp_write( tp, 0xFC34, 0x0285 );
2246
+        rtl8168_mac_ocp_write(tp, 0xF800, 0xE008);
2247
+        rtl8168_mac_ocp_write(tp, 0xF802, 0xE011);
2248
+        rtl8168_mac_ocp_write(tp, 0xF804, 0xE015);
2249
+        rtl8168_mac_ocp_write(tp, 0xF806, 0xE018);
2250
+        rtl8168_mac_ocp_write(tp, 0xF808, 0xE01B);
2251
+        rtl8168_mac_ocp_write(tp, 0xF80A, 0xE027);
2252
+        rtl8168_mac_ocp_write(tp, 0xF80C, 0xE043);
2253
+        rtl8168_mac_ocp_write(tp, 0xF80E, 0xE065);
2254
+        rtl8168_mac_ocp_write(tp, 0xF810, 0x49E2);
2255
+        rtl8168_mac_ocp_write(tp, 0xF812, 0xF005);
2256
+        rtl8168_mac_ocp_write(tp, 0xF814, 0x49EA);
2257
+        rtl8168_mac_ocp_write(tp, 0xF816, 0xF003);
2258
+        rtl8168_mac_ocp_write(tp, 0xF818, 0xC404);
2259
+        rtl8168_mac_ocp_write(tp, 0xF81A, 0xBC00);
2260
+        rtl8168_mac_ocp_write(tp, 0xF81C, 0xC403);
2261
+        rtl8168_mac_ocp_write(tp, 0xF81E, 0xBC00);
2262
+        rtl8168_mac_ocp_write(tp, 0xF820, 0x0496);
2263
+        rtl8168_mac_ocp_write(tp, 0xF822, 0x051A);
2264
+        rtl8168_mac_ocp_write(tp, 0xF824, 0x1D01);
2265
+        rtl8168_mac_ocp_write(tp, 0xF826, 0x8DE8);
2266
+        rtl8168_mac_ocp_write(tp, 0xF828, 0xC602);
2267
+        rtl8168_mac_ocp_write(tp, 0xF82A, 0xBE00);
2268
+        rtl8168_mac_ocp_write(tp, 0xF82C, 0x0206);
2269
+        rtl8168_mac_ocp_write(tp, 0xF82E, 0x1B76);
2270
+        rtl8168_mac_ocp_write(tp, 0xF830, 0xC202);
2271
+        rtl8168_mac_ocp_write(tp, 0xF832, 0xBA00);
2272
+        rtl8168_mac_ocp_write(tp, 0xF834, 0x058A);
2273
+        rtl8168_mac_ocp_write(tp, 0xF836, 0x1B76);
2274
+        rtl8168_mac_ocp_write(tp, 0xF838, 0xC602);
2275
+        rtl8168_mac_ocp_write(tp, 0xF83A, 0xBE00);
2276
+        rtl8168_mac_ocp_write(tp, 0xF83C, 0x0648);
2277
+        rtl8168_mac_ocp_write(tp, 0xF83E, 0x74E6);
2278
+        rtl8168_mac_ocp_write(tp, 0xF840, 0x1B78);
2279
+        rtl8168_mac_ocp_write(tp, 0xF842, 0x46DC);
2280
+        rtl8168_mac_ocp_write(tp, 0xF844, 0x1300);
2281
+        rtl8168_mac_ocp_write(tp, 0xF846, 0xF005);
2282
+        rtl8168_mac_ocp_write(tp, 0xF848, 0x74F8);
2283
+        rtl8168_mac_ocp_write(tp, 0xF84A, 0x48C3);
2284
+        rtl8168_mac_ocp_write(tp, 0xF84C, 0x48C4);
2285
+        rtl8168_mac_ocp_write(tp, 0xF84E, 0x8CF8);
2286
+        rtl8168_mac_ocp_write(tp, 0xF850, 0x64E7);
2287
+        rtl8168_mac_ocp_write(tp, 0xF852, 0xC302);
2288
+        rtl8168_mac_ocp_write(tp, 0xF854, 0xBB00);
2289
+        rtl8168_mac_ocp_write(tp, 0xF856, 0x068E);
2290
+        rtl8168_mac_ocp_write(tp, 0xF858, 0x74E4);
2291
+        rtl8168_mac_ocp_write(tp, 0xF85A, 0x49C5);
2292
+        rtl8168_mac_ocp_write(tp, 0xF85C, 0xF106);
2293
+        rtl8168_mac_ocp_write(tp, 0xF85E, 0x49C6);
2294
+        rtl8168_mac_ocp_write(tp, 0xF860, 0xF107);
2295
+        rtl8168_mac_ocp_write(tp, 0xF862, 0x48C8);
2296
+        rtl8168_mac_ocp_write(tp, 0xF864, 0x48C9);
2297
+        rtl8168_mac_ocp_write(tp, 0xF866, 0xE011);
2298
+        rtl8168_mac_ocp_write(tp, 0xF868, 0x48C9);
2299
+        rtl8168_mac_ocp_write(tp, 0xF86A, 0x4848);
2300
+        rtl8168_mac_ocp_write(tp, 0xF86C, 0xE00E);
2301
+        rtl8168_mac_ocp_write(tp, 0xF86E, 0x4848);
2302
+        rtl8168_mac_ocp_write(tp, 0xF870, 0x49C7);
2303
+        rtl8168_mac_ocp_write(tp, 0xF872, 0xF00A);
2304
+        rtl8168_mac_ocp_write(tp, 0xF874, 0x48C9);
2305
+        rtl8168_mac_ocp_write(tp, 0xF876, 0xC60D);
2306
+        rtl8168_mac_ocp_write(tp, 0xF878, 0x1D1F);
2307
+        rtl8168_mac_ocp_write(tp, 0xF87A, 0x8DC2);
2308
+        rtl8168_mac_ocp_write(tp, 0xF87C, 0x1D00);
2309
+        rtl8168_mac_ocp_write(tp, 0xF87E, 0x8DC3);
2310
+        rtl8168_mac_ocp_write(tp, 0xF880, 0x1D11);
2311
+        rtl8168_mac_ocp_write(tp, 0xF882, 0x8DC0);
2312
+        rtl8168_mac_ocp_write(tp, 0xF884, 0xE002);
2313
+        rtl8168_mac_ocp_write(tp, 0xF886, 0x4849);
2314
+        rtl8168_mac_ocp_write(tp, 0xF888, 0x94E5);
2315
+        rtl8168_mac_ocp_write(tp, 0xF88A, 0xC602);
2316
+        rtl8168_mac_ocp_write(tp, 0xF88C, 0xBE00);
2317
+        rtl8168_mac_ocp_write(tp, 0xF88E, 0x0238);
2318
+        rtl8168_mac_ocp_write(tp, 0xF890, 0xE434);
2319
+        rtl8168_mac_ocp_write(tp, 0xF892, 0x49D9);
2320
+        rtl8168_mac_ocp_write(tp, 0xF894, 0xF01B);
2321
+        rtl8168_mac_ocp_write(tp, 0xF896, 0xC31E);
2322
+        rtl8168_mac_ocp_write(tp, 0xF898, 0x7464);
2323
+        rtl8168_mac_ocp_write(tp, 0xF89A, 0x49C4);
2324
+        rtl8168_mac_ocp_write(tp, 0xF89C, 0xF114);
2325
+        rtl8168_mac_ocp_write(tp, 0xF89E, 0xC31B);
2326
+        rtl8168_mac_ocp_write(tp, 0xF8A0, 0x6460);
2327
+        rtl8168_mac_ocp_write(tp, 0xF8A2, 0x14FA);
2328
+        rtl8168_mac_ocp_write(tp, 0xF8A4, 0xFA02);
2329
+        rtl8168_mac_ocp_write(tp, 0xF8A6, 0xE00F);
2330
+        rtl8168_mac_ocp_write(tp, 0xF8A8, 0xC317);
2331
+        rtl8168_mac_ocp_write(tp, 0xF8AA, 0x7460);
2332
+        rtl8168_mac_ocp_write(tp, 0xF8AC, 0x49C0);
2333
+        rtl8168_mac_ocp_write(tp, 0xF8AE, 0xF10B);
2334
+        rtl8168_mac_ocp_write(tp, 0xF8B0, 0xC311);
2335
+        rtl8168_mac_ocp_write(tp, 0xF8B2, 0x7462);
2336
+        rtl8168_mac_ocp_write(tp, 0xF8B4, 0x48C1);
2337
+        rtl8168_mac_ocp_write(tp, 0xF8B6, 0x9C62);
2338
+        rtl8168_mac_ocp_write(tp, 0xF8B8, 0x4841);
2339
+        rtl8168_mac_ocp_write(tp, 0xF8BA, 0x9C62);
2340
+        rtl8168_mac_ocp_write(tp, 0xF8BC, 0xC30A);
2341
+        rtl8168_mac_ocp_write(tp, 0xF8BE, 0x1C04);
2342
+        rtl8168_mac_ocp_write(tp, 0xF8C0, 0x8C60);
2343
+        rtl8168_mac_ocp_write(tp, 0xF8C2, 0xE004);
2344
+        rtl8168_mac_ocp_write(tp, 0xF8C4, 0x1C15);
2345
+        rtl8168_mac_ocp_write(tp, 0xF8C6, 0xC305);
2346
+        rtl8168_mac_ocp_write(tp, 0xF8C8, 0x8C60);
2347
+        rtl8168_mac_ocp_write(tp, 0xF8CA, 0xC602);
2348
+        rtl8168_mac_ocp_write(tp, 0xF8CC, 0xBE00);
2349
+        rtl8168_mac_ocp_write(tp, 0xF8CE, 0x0374);
2350
+        rtl8168_mac_ocp_write(tp, 0xF8D0, 0xE434);
2351
+        rtl8168_mac_ocp_write(tp, 0xF8D2, 0xE030);
2352
+        rtl8168_mac_ocp_write(tp, 0xF8D4, 0xE61C);
2353
+        rtl8168_mac_ocp_write(tp, 0xF8D6, 0xE906);
2354
+        rtl8168_mac_ocp_write(tp, 0xF8D8, 0xC602);
2355
+        rtl8168_mac_ocp_write(tp, 0xF8DA, 0xBE00);
2356
+        rtl8168_mac_ocp_write(tp, 0xF8DC, 0x0000);
2357
+
2358
+        rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
2359
+
2360
+        rtl8168_mac_ocp_write(tp, 0xFC28, 0x0493);
2361
+        rtl8168_mac_ocp_write(tp, 0xFC2A, 0x0205);
2362
+        rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0589);
2363
+        rtl8168_mac_ocp_write(tp, 0xFC2E, 0x0647);
2364
+        rtl8168_mac_ocp_write(tp, 0xFC30, 0x0000);
2365
+        rtl8168_mac_ocp_write(tp, 0xFC32, 0x0215);
2366
+        rtl8168_mac_ocp_write(tp, 0xFC34, 0x0285);
2367
 }
2368
 
2369
 static void
2370
@@ -9249,426 +9396,426 @@
2371
 
2372
         rtl8168_hw_disable_mac_mcu_bps(dev);
2373
 
2374
-        rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
2375
-        rtl8168_mac_ocp_write( tp, 0xF802, 0xE00A );
2376
-        rtl8168_mac_ocp_write( tp, 0xF804, 0xE00D );
2377
-        rtl8168_mac_ocp_write( tp, 0xF806, 0xE02F );
2378
-        rtl8168_mac_ocp_write( tp, 0xF808, 0xE031 );
2379
-        rtl8168_mac_ocp_write( tp, 0xF80A, 0xE038 );
2380
-        rtl8168_mac_ocp_write( tp, 0xF80C, 0xE03A );
2381
-        rtl8168_mac_ocp_write( tp, 0xF80E, 0xE051 );
2382
-        rtl8168_mac_ocp_write( tp, 0xF810, 0xC202 );
2383
-        rtl8168_mac_ocp_write( tp, 0xF812, 0xBA00 );
2384
-        rtl8168_mac_ocp_write( tp, 0xF814, 0x0DFC );
2385
-        rtl8168_mac_ocp_write( tp, 0xF816, 0x7444 );
2386
-        rtl8168_mac_ocp_write( tp, 0xF818, 0xC502 );
2387
-        rtl8168_mac_ocp_write( tp, 0xF81A, 0xBD00 );
2388
-        rtl8168_mac_ocp_write( tp, 0xF81C, 0x0A30 );
2389
-        rtl8168_mac_ocp_write( tp, 0xF81E, 0x49D9 );
2390
-        rtl8168_mac_ocp_write( tp, 0xF820, 0xF019 );
2391
-        rtl8168_mac_ocp_write( tp, 0xF822, 0xC520 );
2392
-        rtl8168_mac_ocp_write( tp, 0xF824, 0x64A5 );
2393
-        rtl8168_mac_ocp_write( tp, 0xF826, 0x1400 );
2394
-        rtl8168_mac_ocp_write( tp, 0xF828, 0xF007 );
2395
-        rtl8168_mac_ocp_write( tp, 0xF82A, 0x0C01 );
2396
-        rtl8168_mac_ocp_write( tp, 0xF82C, 0x8CA5 );
2397
-        rtl8168_mac_ocp_write( tp, 0xF82E, 0x1C15 );
2398
-        rtl8168_mac_ocp_write( tp, 0xF830, 0xC515 );
2399
-        rtl8168_mac_ocp_write( tp, 0xF832, 0x9CA0 );
2400
-        rtl8168_mac_ocp_write( tp, 0xF834, 0xE00F );
2401
-        rtl8168_mac_ocp_write( tp, 0xF836, 0xC513 );
2402
-        rtl8168_mac_ocp_write( tp, 0xF838, 0x74A0 );
2403
-        rtl8168_mac_ocp_write( tp, 0xF83A, 0x48C8 );
2404
-        rtl8168_mac_ocp_write( tp, 0xF83C, 0x48CA );
2405
-        rtl8168_mac_ocp_write( tp, 0xF83E, 0x9CA0 );
2406
-        rtl8168_mac_ocp_write( tp, 0xF840, 0xC510 );
2407
-        rtl8168_mac_ocp_write( tp, 0xF842, 0x1B00 );
2408
-        rtl8168_mac_ocp_write( tp, 0xF844, 0x9BA0 );
2409
-        rtl8168_mac_ocp_write( tp, 0xF846, 0x1B1C );
2410
-        rtl8168_mac_ocp_write( tp, 0xF848, 0x483F );
2411
-        rtl8168_mac_ocp_write( tp, 0xF84A, 0x9BA2 );
2412
-        rtl8168_mac_ocp_write( tp, 0xF84C, 0x1B04 );
2413
-        rtl8168_mac_ocp_write( tp, 0xF84E, 0xC506 );
2414
-        rtl8168_mac_ocp_write( tp, 0xF850, 0x9BA0 );
2415
-        rtl8168_mac_ocp_write( tp, 0xF852, 0xC603 );
2416
-        rtl8168_mac_ocp_write( tp, 0xF854, 0xBE00 );
2417
-        rtl8168_mac_ocp_write( tp, 0xF856, 0x0298 );
2418
-        rtl8168_mac_ocp_write( tp, 0xF858, 0x03DE );
2419
-        rtl8168_mac_ocp_write( tp, 0xF85A, 0xE434 );
2420
-        rtl8168_mac_ocp_write( tp, 0xF85C, 0xE096 );
2421
-        rtl8168_mac_ocp_write( tp, 0xF85E, 0xE860 );
2422
-        rtl8168_mac_ocp_write( tp, 0xF860, 0xDE20 );
2423
-        rtl8168_mac_ocp_write( tp, 0xF862, 0xD3C0 );
2424
-        rtl8168_mac_ocp_write( tp, 0xF864, 0xC602 );
2425
-        rtl8168_mac_ocp_write( tp, 0xF866, 0xBE00 );
2426
-        rtl8168_mac_ocp_write( tp, 0xF868, 0x0A64 );
2427
-        rtl8168_mac_ocp_write( tp, 0xF86A, 0xC707 );
2428
-        rtl8168_mac_ocp_write( tp, 0xF86C, 0x1D00 );
2429
-        rtl8168_mac_ocp_write( tp, 0xF86E, 0x8DE2 );
2430
-        rtl8168_mac_ocp_write( tp, 0xF870, 0x48C1 );
2431
-        rtl8168_mac_ocp_write( tp, 0xF872, 0xC502 );
2432
-        rtl8168_mac_ocp_write( tp, 0xF874, 0xBD00 );
2433
-        rtl8168_mac_ocp_write( tp, 0xF876, 0x00AA );
2434
-        rtl8168_mac_ocp_write( tp, 0xF878, 0xE0C0 );
2435
-        rtl8168_mac_ocp_write( tp, 0xF87A, 0xC502 );
2436
-        rtl8168_mac_ocp_write( tp, 0xF87C, 0xBD00 );
2437
-        rtl8168_mac_ocp_write( tp, 0xF87E, 0x0132 );
2438
-        rtl8168_mac_ocp_write( tp, 0xF880, 0xC50C );
2439
-        rtl8168_mac_ocp_write( tp, 0xF882, 0x74A2 );
2440
-        rtl8168_mac_ocp_write( tp, 0xF884, 0x49CE );
2441
-        rtl8168_mac_ocp_write( tp, 0xF886, 0xF1FE );
2442
-        rtl8168_mac_ocp_write( tp, 0xF888, 0x1C00 );
2443
-        rtl8168_mac_ocp_write( tp, 0xF88A, 0x9EA0 );
2444
-        rtl8168_mac_ocp_write( tp, 0xF88C, 0x1C1C );
2445
-        rtl8168_mac_ocp_write( tp, 0xF88E, 0x484F );
2446
-        rtl8168_mac_ocp_write( tp, 0xF890, 0x9CA2 );
2447
-        rtl8168_mac_ocp_write( tp, 0xF892, 0xC402 );
2448
-        rtl8168_mac_ocp_write( tp, 0xF894, 0xBC00 );
2449
-        rtl8168_mac_ocp_write( tp, 0xF896, 0x0AFA );
2450
-        rtl8168_mac_ocp_write( tp, 0xF898, 0xDE20 );
2451
-        rtl8168_mac_ocp_write( tp, 0xF89A, 0xE000 );
2452
-        rtl8168_mac_ocp_write( tp, 0xF89C, 0xE092 );
2453
-        rtl8168_mac_ocp_write( tp, 0xF89E, 0xE430 );
2454
-        rtl8168_mac_ocp_write( tp, 0xF8A0, 0xDE20 );
2455
-        rtl8168_mac_ocp_write( tp, 0xF8A2, 0xE0C0 );
2456
-        rtl8168_mac_ocp_write( tp, 0xF8A4, 0xE860 );
2457
-        rtl8168_mac_ocp_write( tp, 0xF8A6, 0xE84C );
2458
-        rtl8168_mac_ocp_write( tp, 0xF8A8, 0xB400 );
2459
-        rtl8168_mac_ocp_write( tp, 0xF8AA, 0xB430 );
2460
-        rtl8168_mac_ocp_write( tp, 0xF8AC, 0xE410 );
2461
-        rtl8168_mac_ocp_write( tp, 0xF8AE, 0xC0AE );
2462
-        rtl8168_mac_ocp_write( tp, 0xF8B0, 0xB407 );
2463
-        rtl8168_mac_ocp_write( tp, 0xF8B2, 0xB406 );
2464
-        rtl8168_mac_ocp_write( tp, 0xF8B4, 0xB405 );
2465
-        rtl8168_mac_ocp_write( tp, 0xF8B6, 0xB404 );
2466
-        rtl8168_mac_ocp_write( tp, 0xF8B8, 0xB403 );
2467
-        rtl8168_mac_ocp_write( tp, 0xF8BA, 0xB402 );
2468
-        rtl8168_mac_ocp_write( tp, 0xF8BC, 0xB401 );
2469
-        rtl8168_mac_ocp_write( tp, 0xF8BE, 0xC7EE );
2470
-        rtl8168_mac_ocp_write( tp, 0xF8C0, 0x76F4 );
2471
-        rtl8168_mac_ocp_write( tp, 0xF8C2, 0xC2ED );
2472
-        rtl8168_mac_ocp_write( tp, 0xF8C4, 0xC3ED );
2473
-        rtl8168_mac_ocp_write( tp, 0xF8C6, 0xC1EF );
2474
-        rtl8168_mac_ocp_write( tp, 0xF8C8, 0xC5F3 );
2475
-        rtl8168_mac_ocp_write( tp, 0xF8CA, 0x74A0 );
2476
-        rtl8168_mac_ocp_write( tp, 0xF8CC, 0x49CD );
2477
-        rtl8168_mac_ocp_write( tp, 0xF8CE, 0xF001 );
2478
-        rtl8168_mac_ocp_write( tp, 0xF8D0, 0xC5EE );
2479
-        rtl8168_mac_ocp_write( tp, 0xF8D2, 0x74A0 );
2480
-        rtl8168_mac_ocp_write( tp, 0xF8D4, 0x49C1 );
2481
-        rtl8168_mac_ocp_write( tp, 0xF8D6, 0xF105 );
2482
-        rtl8168_mac_ocp_write( tp, 0xF8D8, 0xC5E4 );
2483
-        rtl8168_mac_ocp_write( tp, 0xF8DA, 0x74A2 );
2484
-        rtl8168_mac_ocp_write( tp, 0xF8DC, 0x49CE );
2485
-        rtl8168_mac_ocp_write( tp, 0xF8DE, 0xF00B );
2486
-        rtl8168_mac_ocp_write( tp, 0xF8E0, 0x7444 );
2487
-        rtl8168_mac_ocp_write( tp, 0xF8E2, 0x484B );
2488
-        rtl8168_mac_ocp_write( tp, 0xF8E4, 0x9C44 );
2489
-        rtl8168_mac_ocp_write( tp, 0xF8E6, 0x1C10 );
2490
-        rtl8168_mac_ocp_write( tp, 0xF8E8, 0x9C62 );
2491
-        rtl8168_mac_ocp_write( tp, 0xF8EA, 0x1C11 );
2492
-        rtl8168_mac_ocp_write( tp, 0xF8EC, 0x8C60 );
2493
-        rtl8168_mac_ocp_write( tp, 0xF8EE, 0x1C00 );
2494
-        rtl8168_mac_ocp_write( tp, 0xF8F0, 0x9CF6 );
2495
-        rtl8168_mac_ocp_write( tp, 0xF8F2, 0xE0EC );
2496
-        rtl8168_mac_ocp_write( tp, 0xF8F4, 0x49E7 );
2497
-        rtl8168_mac_ocp_write( tp, 0xF8F6, 0xF016 );
2498
-        rtl8168_mac_ocp_write( tp, 0xF8F8, 0x1D80 );
2499
-        rtl8168_mac_ocp_write( tp, 0xF8FA, 0x8DF4 );
2500
-        rtl8168_mac_ocp_write( tp, 0xF8FC, 0x74F8 );
2501
-        rtl8168_mac_ocp_write( tp, 0xF8FE, 0x4843 );
2502
-        rtl8168_mac_ocp_write( tp, 0xF900, 0x8CF8 );
2503
-        rtl8168_mac_ocp_write( tp, 0xF902, 0x74F8 );
2504
-        rtl8168_mac_ocp_write( tp, 0xF904, 0x74F8 );
2505
-        rtl8168_mac_ocp_write( tp, 0xF906, 0x7444 );
2506
-        rtl8168_mac_ocp_write( tp, 0xF908, 0x48C8 );
2507
-        rtl8168_mac_ocp_write( tp, 0xF90A, 0x48C9 );
2508
-        rtl8168_mac_ocp_write( tp, 0xF90C, 0x48CA );
2509
-        rtl8168_mac_ocp_write( tp, 0xF90E, 0x9C44 );
2510
-        rtl8168_mac_ocp_write( tp, 0xF910, 0x74F8 );
2511
-        rtl8168_mac_ocp_write( tp, 0xF912, 0x4844 );
2512
-        rtl8168_mac_ocp_write( tp, 0xF914, 0x8CF8 );
2513
-        rtl8168_mac_ocp_write( tp, 0xF916, 0x1E01 );
2514
-        rtl8168_mac_ocp_write( tp, 0xF918, 0xE8DB );
2515
-        rtl8168_mac_ocp_write( tp, 0xF91A, 0x7420 );
2516
-        rtl8168_mac_ocp_write( tp, 0xF91C, 0x48C1 );
2517
-        rtl8168_mac_ocp_write( tp, 0xF91E, 0x9C20 );
2518
-        rtl8168_mac_ocp_write( tp, 0xF920, 0xE0D5 );
2519
-        rtl8168_mac_ocp_write( tp, 0xF922, 0x49E6 );
2520
-        rtl8168_mac_ocp_write( tp, 0xF924, 0xF02A );
2521
-        rtl8168_mac_ocp_write( tp, 0xF926, 0x1D40 );
2522
-        rtl8168_mac_ocp_write( tp, 0xF928, 0x8DF4 );
2523
-        rtl8168_mac_ocp_write( tp, 0xF92A, 0x74FC );
2524
-        rtl8168_mac_ocp_write( tp, 0xF92C, 0x49C0 );
2525
-        rtl8168_mac_ocp_write( tp, 0xF92E, 0xF124 );
2526
-        rtl8168_mac_ocp_write( tp, 0xF930, 0x49C1 );
2527
-        rtl8168_mac_ocp_write( tp, 0xF932, 0xF122 );
2528
-        rtl8168_mac_ocp_write( tp, 0xF934, 0x74F8 );
2529
-        rtl8168_mac_ocp_write( tp, 0xF936, 0x49C0 );
2530
-        rtl8168_mac_ocp_write( tp, 0xF938, 0xF01F );
2531
-        rtl8168_mac_ocp_write( tp, 0xF93A, 0xE8D3 );
2532
-        rtl8168_mac_ocp_write( tp, 0xF93C, 0x48C4 );
2533
-        rtl8168_mac_ocp_write( tp, 0xF93E, 0x8CF8 );
2534
-        rtl8168_mac_ocp_write( tp, 0xF940, 0x1E00 );
2535
-        rtl8168_mac_ocp_write( tp, 0xF942, 0xE8C6 );
2536
-        rtl8168_mac_ocp_write( tp, 0xF944, 0xC5B1 );
2537
-        rtl8168_mac_ocp_write( tp, 0xF946, 0x74A0 );
2538
-        rtl8168_mac_ocp_write( tp, 0xF948, 0x49C3 );
2539
-        rtl8168_mac_ocp_write( tp, 0xF94A, 0xF016 );
2540
-        rtl8168_mac_ocp_write( tp, 0xF94C, 0xC5AF );
2541
-        rtl8168_mac_ocp_write( tp, 0xF94E, 0x74A4 );
2542
-        rtl8168_mac_ocp_write( tp, 0xF950, 0x49C2 );
2543
-        rtl8168_mac_ocp_write( tp, 0xF952, 0xF005 );
2544
-        rtl8168_mac_ocp_write( tp, 0xF954, 0xC5AA );
2545
-        rtl8168_mac_ocp_write( tp, 0xF956, 0x74B2 );
2546
-        rtl8168_mac_ocp_write( tp, 0xF958, 0x49C9 );
2547
-        rtl8168_mac_ocp_write( tp, 0xF95A, 0xF10E );
2548
-        rtl8168_mac_ocp_write( tp, 0xF95C, 0xC5A6 );
2549
-        rtl8168_mac_ocp_write( tp, 0xF95E, 0x74A8 );
2550
-        rtl8168_mac_ocp_write( tp, 0xF960, 0x4845 );
2551
-        rtl8168_mac_ocp_write( tp, 0xF962, 0x4846 );
2552
-        rtl8168_mac_ocp_write( tp, 0xF964, 0x4847 );
2553
-        rtl8168_mac_ocp_write( tp, 0xF966, 0x4848 );
2554
-        rtl8168_mac_ocp_write( tp, 0xF968, 0x9CA8 );
2555
-        rtl8168_mac_ocp_write( tp, 0xF96A, 0x74B2 );
2556
-        rtl8168_mac_ocp_write( tp, 0xF96C, 0x4849 );
2557
-        rtl8168_mac_ocp_write( tp, 0xF96E, 0x9CB2 );
2558
-        rtl8168_mac_ocp_write( tp, 0xF970, 0x74A0 );
2559
-        rtl8168_mac_ocp_write( tp, 0xF972, 0x484F );
2560
-        rtl8168_mac_ocp_write( tp, 0xF974, 0x9CA0 );
2561
-        rtl8168_mac_ocp_write( tp, 0xF976, 0xE0AA );
2562
-        rtl8168_mac_ocp_write( tp, 0xF978, 0x49E4 );
2563
-        rtl8168_mac_ocp_write( tp, 0xF97A, 0xF018 );
2564
-        rtl8168_mac_ocp_write( tp, 0xF97C, 0x1D10 );
2565
-        rtl8168_mac_ocp_write( tp, 0xF97E, 0x8DF4 );
2566
-        rtl8168_mac_ocp_write( tp, 0xF980, 0x74F8 );
2567
-        rtl8168_mac_ocp_write( tp, 0xF982, 0x74F8 );
2568
-        rtl8168_mac_ocp_write( tp, 0xF984, 0x74F8 );
2569
-        rtl8168_mac_ocp_write( tp, 0xF986, 0x4843 );
2570
-        rtl8168_mac_ocp_write( tp, 0xF988, 0x8CF8 );
2571
-        rtl8168_mac_ocp_write( tp, 0xF98A, 0x74F8 );
2572
-        rtl8168_mac_ocp_write( tp, 0xF98C, 0x74F8 );
2573
-        rtl8168_mac_ocp_write( tp, 0xF98E, 0x74F8 );
2574
-        rtl8168_mac_ocp_write( tp, 0xF990, 0x4844 );
2575
-        rtl8168_mac_ocp_write( tp, 0xF992, 0x4842 );
2576
-        rtl8168_mac_ocp_write( tp, 0xF994, 0x4841 );
2577
-        rtl8168_mac_ocp_write( tp, 0xF996, 0x8CF8 );
2578
-        rtl8168_mac_ocp_write( tp, 0xF998, 0x1E01 );
2579
-        rtl8168_mac_ocp_write( tp, 0xF99A, 0xE89A );
2580
-        rtl8168_mac_ocp_write( tp, 0xF99C, 0x7420 );
2581
-        rtl8168_mac_ocp_write( tp, 0xF99E, 0x4841 );
2582
-        rtl8168_mac_ocp_write( tp, 0xF9A0, 0x9C20 );
2583
-        rtl8168_mac_ocp_write( tp, 0xF9A2, 0x7444 );
2584
-        rtl8168_mac_ocp_write( tp, 0xF9A4, 0x4848 );
2585
-        rtl8168_mac_ocp_write( tp, 0xF9A6, 0x9C44 );
2586
-        rtl8168_mac_ocp_write( tp, 0xF9A8, 0xE091 );
2587
-        rtl8168_mac_ocp_write( tp, 0xF9AA, 0x49E5 );
2588
-        rtl8168_mac_ocp_write( tp, 0xF9AC, 0xF03E );
2589
-        rtl8168_mac_ocp_write( tp, 0xF9AE, 0x1D20 );
2590
-        rtl8168_mac_ocp_write( tp, 0xF9B0, 0x8DF4 );
2591
-        rtl8168_mac_ocp_write( tp, 0xF9B2, 0x74F8 );
2592
-        rtl8168_mac_ocp_write( tp, 0xF9B4, 0x48C2 );
2593
-        rtl8168_mac_ocp_write( tp, 0xF9B6, 0x4841 );
2594
-        rtl8168_mac_ocp_write( tp, 0xF9B8, 0x8CF8 );
2595
-        rtl8168_mac_ocp_write( tp, 0xF9BA, 0x1E01 );
2596
-        rtl8168_mac_ocp_write( tp, 0xF9BC, 0x7444 );
2597
-        rtl8168_mac_ocp_write( tp, 0xF9BE, 0x49CA );
2598
-        rtl8168_mac_ocp_write( tp, 0xF9C0, 0xF103 );
2599
-        rtl8168_mac_ocp_write( tp, 0xF9C2, 0x49C2 );
2600
-        rtl8168_mac_ocp_write( tp, 0xF9C4, 0xF00C );
2601
-        rtl8168_mac_ocp_write( tp, 0xF9C6, 0x49C1 );
2602
-        rtl8168_mac_ocp_write( tp, 0xF9C8, 0xF004 );
2603
-        rtl8168_mac_ocp_write( tp, 0xF9CA, 0x6447 );
2604
-        rtl8168_mac_ocp_write( tp, 0xF9CC, 0x2244 );
2605
-        rtl8168_mac_ocp_write( tp, 0xF9CE, 0xE002 );
2606
-        rtl8168_mac_ocp_write( tp, 0xF9D0, 0x1C01 );
2607
-        rtl8168_mac_ocp_write( tp, 0xF9D2, 0x9C62 );
2608
-        rtl8168_mac_ocp_write( tp, 0xF9D4, 0x1C11 );
2609
-        rtl8168_mac_ocp_write( tp, 0xF9D6, 0x8C60 );
2610
-        rtl8168_mac_ocp_write( tp, 0xF9D8, 0x1C00 );
2611
-        rtl8168_mac_ocp_write( tp, 0xF9DA, 0x9CF6 );
2612
-        rtl8168_mac_ocp_write( tp, 0xF9DC, 0x7444 );
2613
-        rtl8168_mac_ocp_write( tp, 0xF9DE, 0x49C8 );
2614
-        rtl8168_mac_ocp_write( tp, 0xF9E0, 0xF01D );
2615
-        rtl8168_mac_ocp_write( tp, 0xF9E2, 0x74FC );
2616
-        rtl8168_mac_ocp_write( tp, 0xF9E4, 0x49C0 );
2617
-        rtl8168_mac_ocp_write( tp, 0xF9E6, 0xF11A );
2618
-        rtl8168_mac_ocp_write( tp, 0xF9E8, 0x49C1 );
2619
-        rtl8168_mac_ocp_write( tp, 0xF9EA, 0xF118 );
2620
-        rtl8168_mac_ocp_write( tp, 0xF9EC, 0x74F8 );
2621
-        rtl8168_mac_ocp_write( tp, 0xF9EE, 0x49C0 );
2622
-        rtl8168_mac_ocp_write( tp, 0xF9F0, 0xF015 );
2623
-        rtl8168_mac_ocp_write( tp, 0xF9F2, 0x49C6 );
2624
-        rtl8168_mac_ocp_write( tp, 0xF9F4, 0xF113 );
2625
-        rtl8168_mac_ocp_write( tp, 0xF9F6, 0xE875 );
2626
-        rtl8168_mac_ocp_write( tp, 0xF9F8, 0x48C4 );
2627
-        rtl8168_mac_ocp_write( tp, 0xF9FA, 0x8CF8 );
2628
-        rtl8168_mac_ocp_write( tp, 0xF9FC, 0x7420 );
2629
-        rtl8168_mac_ocp_write( tp, 0xF9FE, 0x48C1 );
2630
-        rtl8168_mac_ocp_write( tp, 0xFA00, 0x9C20 );
2631
-        rtl8168_mac_ocp_write( tp, 0xFA02, 0xC50A );
2632
-        rtl8168_mac_ocp_write( tp, 0xFA04, 0x74A2 );
2633
-        rtl8168_mac_ocp_write( tp, 0xFA06, 0x8CA5 );
2634
-        rtl8168_mac_ocp_write( tp, 0xFA08, 0x74A0 );
2635
-        rtl8168_mac_ocp_write( tp, 0xFA0A, 0xC505 );
2636
-        rtl8168_mac_ocp_write( tp, 0xFA0C, 0x9CA2 );
2637
-        rtl8168_mac_ocp_write( tp, 0xFA0E, 0x1C11 );
2638
-        rtl8168_mac_ocp_write( tp, 0xFA10, 0x9CA0 );
2639
-        rtl8168_mac_ocp_write( tp, 0xFA12, 0xE00A );
2640
-        rtl8168_mac_ocp_write( tp, 0xFA14, 0xE434 );
2641
-        rtl8168_mac_ocp_write( tp, 0xFA16, 0xD3C0 );
2642
-        rtl8168_mac_ocp_write( tp, 0xFA18, 0xDC00 );
2643
-        rtl8168_mac_ocp_write( tp, 0xFA1A, 0x7444 );
2644
-        rtl8168_mac_ocp_write( tp, 0xFA1C, 0x49CA );
2645
-        rtl8168_mac_ocp_write( tp, 0xFA1E, 0xF004 );
2646
-        rtl8168_mac_ocp_write( tp, 0xFA20, 0x48CA );
2647
-        rtl8168_mac_ocp_write( tp, 0xFA22, 0x9C44 );
2648
-        rtl8168_mac_ocp_write( tp, 0xFA24, 0xE855 );
2649
-        rtl8168_mac_ocp_write( tp, 0xFA26, 0xE052 );
2650
-        rtl8168_mac_ocp_write( tp, 0xFA28, 0x49E8 );
2651
-        rtl8168_mac_ocp_write( tp, 0xFA2A, 0xF024 );
2652
-        rtl8168_mac_ocp_write( tp, 0xFA2C, 0x1D01 );
2653
-        rtl8168_mac_ocp_write( tp, 0xFA2E, 0x8DF5 );
2654
-        rtl8168_mac_ocp_write( tp, 0xFA30, 0x7440 );
2655
-        rtl8168_mac_ocp_write( tp, 0xFA32, 0x49C0 );
2656
-        rtl8168_mac_ocp_write( tp, 0xFA34, 0xF11E );
2657
-        rtl8168_mac_ocp_write( tp, 0xFA36, 0x7444 );
2658
-        rtl8168_mac_ocp_write( tp, 0xFA38, 0x49C8 );
2659
-        rtl8168_mac_ocp_write( tp, 0xFA3A, 0xF01B );
2660
-        rtl8168_mac_ocp_write( tp, 0xFA3C, 0x49CA );
2661
-        rtl8168_mac_ocp_write( tp, 0xFA3E, 0xF119 );
2662
-        rtl8168_mac_ocp_write( tp, 0xFA40, 0xC5EC );
2663
-        rtl8168_mac_ocp_write( tp, 0xFA42, 0x76A4 );
2664
-        rtl8168_mac_ocp_write( tp, 0xFA44, 0x49E3 );
2665
-        rtl8168_mac_ocp_write( tp, 0xFA46, 0xF015 );
2666
-        rtl8168_mac_ocp_write( tp, 0xFA48, 0x49C0 );
2667
-        rtl8168_mac_ocp_write( tp, 0xFA4A, 0xF103 );
2668
-        rtl8168_mac_ocp_write( tp, 0xFA4C, 0x49C1 );
2669
-        rtl8168_mac_ocp_write( tp, 0xFA4E, 0xF011 );
2670
-        rtl8168_mac_ocp_write( tp, 0xFA50, 0x4849 );
2671
-        rtl8168_mac_ocp_write( tp, 0xFA52, 0x9C44 );
2672
-        rtl8168_mac_ocp_write( tp, 0xFA54, 0x1C00 );
2673
-        rtl8168_mac_ocp_write( tp, 0xFA56, 0x9CF6 );
2674
-        rtl8168_mac_ocp_write( tp, 0xFA58, 0x7444 );
2675
-        rtl8168_mac_ocp_write( tp, 0xFA5A, 0x49C1 );
2676
-        rtl8168_mac_ocp_write( tp, 0xFA5C, 0xF004 );
2677
-        rtl8168_mac_ocp_write( tp, 0xFA5E, 0x6446 );
2678
-        rtl8168_mac_ocp_write( tp, 0xFA60, 0x1E07 );
2679
-        rtl8168_mac_ocp_write( tp, 0xFA62, 0xE003 );
2680
-        rtl8168_mac_ocp_write( tp, 0xFA64, 0x1C01 );
2681
-        rtl8168_mac_ocp_write( tp, 0xFA66, 0x1E03 );
2682
-        rtl8168_mac_ocp_write( tp, 0xFA68, 0x9C62 );
2683
-        rtl8168_mac_ocp_write( tp, 0xFA6A, 0x1C11 );
2684
-        rtl8168_mac_ocp_write( tp, 0xFA6C, 0x8C60 );
2685
-        rtl8168_mac_ocp_write( tp, 0xFA6E, 0xE830 );
2686
-        rtl8168_mac_ocp_write( tp, 0xFA70, 0xE02D );
2687
-        rtl8168_mac_ocp_write( tp, 0xFA72, 0x49E9 );
2688
-        rtl8168_mac_ocp_write( tp, 0xFA74, 0xF004 );
2689
-        rtl8168_mac_ocp_write( tp, 0xFA76, 0x1D02 );
2690
-        rtl8168_mac_ocp_write( tp, 0xFA78, 0x8DF5 );
2691
-        rtl8168_mac_ocp_write( tp, 0xFA7A, 0xE79C );
2692
-        rtl8168_mac_ocp_write( tp, 0xFA7C, 0x49E3 );
2693
-        rtl8168_mac_ocp_write( tp, 0xFA7E, 0xF006 );
2694
-        rtl8168_mac_ocp_write( tp, 0xFA80, 0x1D08 );
2695
-        rtl8168_mac_ocp_write( tp, 0xFA82, 0x8DF4 );
2696
-        rtl8168_mac_ocp_write( tp, 0xFA84, 0x74F8 );
2697
-        rtl8168_mac_ocp_write( tp, 0xFA86, 0x74F8 );
2698
-        rtl8168_mac_ocp_write( tp, 0xFA88, 0xE73A );
2699
-        rtl8168_mac_ocp_write( tp, 0xFA8A, 0x49E1 );
2700
-        rtl8168_mac_ocp_write( tp, 0xFA8C, 0xF007 );
2701
-        rtl8168_mac_ocp_write( tp, 0xFA8E, 0x1D02 );
2702
-        rtl8168_mac_ocp_write( tp, 0xFA90, 0x8DF4 );
2703
-        rtl8168_mac_ocp_write( tp, 0xFA92, 0x1E01 );
2704
-        rtl8168_mac_ocp_write( tp, 0xFA94, 0xE7A7 );
2705
-        rtl8168_mac_ocp_write( tp, 0xFA96, 0xDE20 );
2706
-        rtl8168_mac_ocp_write( tp, 0xFA98, 0xE410 );
2707
-        rtl8168_mac_ocp_write( tp, 0xFA9A, 0x49E0 );
2708
-        rtl8168_mac_ocp_write( tp, 0xFA9C, 0xF017 );
2709
-        rtl8168_mac_ocp_write( tp, 0xFA9E, 0x1D01 );
2710
-        rtl8168_mac_ocp_write( tp, 0xFAA0, 0x8DF4 );
2711
-        rtl8168_mac_ocp_write( tp, 0xFAA2, 0xC5FA );
2712
-        rtl8168_mac_ocp_write( tp, 0xFAA4, 0x1C00 );
2713
-        rtl8168_mac_ocp_write( tp, 0xFAA6, 0x8CA0 );
2714
-        rtl8168_mac_ocp_write( tp, 0xFAA8, 0x1C1B );
2715
-        rtl8168_mac_ocp_write( tp, 0xFAAA, 0x9CA2 );
2716
-        rtl8168_mac_ocp_write( tp, 0xFAAC, 0x74A2 );
2717
-        rtl8168_mac_ocp_write( tp, 0xFAAE, 0x49CF );
2718
-        rtl8168_mac_ocp_write( tp, 0xFAB0, 0xF0FE );
2719
-        rtl8168_mac_ocp_write( tp, 0xFAB2, 0xC5F3 );
2720
-        rtl8168_mac_ocp_write( tp, 0xFAB4, 0x74A0 );
2721
-        rtl8168_mac_ocp_write( tp, 0xFAB6, 0x4849 );
2722
-        rtl8168_mac_ocp_write( tp, 0xFAB8, 0x9CA0 );
2723
-        rtl8168_mac_ocp_write( tp, 0xFABA, 0x74F8 );
2724
-        rtl8168_mac_ocp_write( tp, 0xFABC, 0x49C0 );
2725
-        rtl8168_mac_ocp_write( tp, 0xFABE, 0xF006 );
2726
-        rtl8168_mac_ocp_write( tp, 0xFAC0, 0x48C3 );
2727
-        rtl8168_mac_ocp_write( tp, 0xFAC2, 0x8CF8 );
2728
-        rtl8168_mac_ocp_write( tp, 0xFAC4, 0xE820 );
2729
-        rtl8168_mac_ocp_write( tp, 0xFAC6, 0x74F8 );
2730
-        rtl8168_mac_ocp_write( tp, 0xFAC8, 0x74F8 );
2731
-        rtl8168_mac_ocp_write( tp, 0xFACA, 0xC432 );
2732
-        rtl8168_mac_ocp_write( tp, 0xFACC, 0xBC00 );
2733
-        rtl8168_mac_ocp_write( tp, 0xFACE, 0xC5E4 );
2734
-        rtl8168_mac_ocp_write( tp, 0xFAD0, 0x74A2 );
2735
-        rtl8168_mac_ocp_write( tp, 0xFAD2, 0x49CE );
2736
-        rtl8168_mac_ocp_write( tp, 0xFAD4, 0xF1FE );
2737
-        rtl8168_mac_ocp_write( tp, 0xFAD6, 0x9EA0 );
2738
-        rtl8168_mac_ocp_write( tp, 0xFAD8, 0x1C1C );
2739
-        rtl8168_mac_ocp_write( tp, 0xFADA, 0x484F );
2740
-        rtl8168_mac_ocp_write( tp, 0xFADC, 0x9CA2 );
2741
-        rtl8168_mac_ocp_write( tp, 0xFADE, 0xFF80 );
2742
-        rtl8168_mac_ocp_write( tp, 0xFAE0, 0xB404 );
2743
-        rtl8168_mac_ocp_write( tp, 0xFAE2, 0xB405 );
2744
-        rtl8168_mac_ocp_write( tp, 0xFAE4, 0xC5D9 );
2745
-        rtl8168_mac_ocp_write( tp, 0xFAE6, 0x74A2 );
2746
-        rtl8168_mac_ocp_write( tp, 0xFAE8, 0x49CE );
2747
-        rtl8168_mac_ocp_write( tp, 0xFAEA, 0xF1FE );
2748
-        rtl8168_mac_ocp_write( tp, 0xFAEC, 0xC41F );
2749
-        rtl8168_mac_ocp_write( tp, 0xFAEE, 0x9CA0 );
2750
-        rtl8168_mac_ocp_write( tp, 0xFAF0, 0xC41C );
2751
-        rtl8168_mac_ocp_write( tp, 0xFAF2, 0x1C13 );
2752
-        rtl8168_mac_ocp_write( tp, 0xFAF4, 0x484F );
2753
-        rtl8168_mac_ocp_write( tp, 0xFAF6, 0x9CA2 );
2754
-        rtl8168_mac_ocp_write( tp, 0xFAF8, 0x74A2 );
2755
-        rtl8168_mac_ocp_write( tp, 0xFAFA, 0x49CF );
2756
-        rtl8168_mac_ocp_write( tp, 0xFAFC, 0xF1FE );
2757
-        rtl8168_mac_ocp_write( tp, 0xFAFE, 0xB005 );
2758
-        rtl8168_mac_ocp_write( tp, 0xFB00, 0xB004 );
2759
-        rtl8168_mac_ocp_write( tp, 0xFB02, 0xFF80 );
2760
-        rtl8168_mac_ocp_write( tp, 0xFB04, 0xB404 );
2761
-        rtl8168_mac_ocp_write( tp, 0xFB06, 0xB405 );
2762
-        rtl8168_mac_ocp_write( tp, 0xFB08, 0xC5C7 );
2763
-        rtl8168_mac_ocp_write( tp, 0xFB0A, 0x74A2 );
2764
-        rtl8168_mac_ocp_write( tp, 0xFB0C, 0x49CE );
2765
-        rtl8168_mac_ocp_write( tp, 0xFB0E, 0xF1FE );
2766
-        rtl8168_mac_ocp_write( tp, 0xFB10, 0xC40E );
2767
-        rtl8168_mac_ocp_write( tp, 0xFB12, 0x9CA0 );
2768
-        rtl8168_mac_ocp_write( tp, 0xFB14, 0xC40A );
2769
-        rtl8168_mac_ocp_write( tp, 0xFB16, 0x1C13 );
2770
-        rtl8168_mac_ocp_write( tp, 0xFB18, 0x484F );
2771
-        rtl8168_mac_ocp_write( tp, 0xFB1A, 0x9CA2 );
2772
-        rtl8168_mac_ocp_write( tp, 0xFB1C, 0x74A2 );
2773
-        rtl8168_mac_ocp_write( tp, 0xFB1E, 0x49CF );
2774
-        rtl8168_mac_ocp_write( tp, 0xFB20, 0xF1FE );
2775
-        rtl8168_mac_ocp_write( tp, 0xFB22, 0xB005 );
2776
-        rtl8168_mac_ocp_write( tp, 0xFB24, 0xB004 );
2777
-        rtl8168_mac_ocp_write( tp, 0xFB26, 0xFF80 );
2778
-        rtl8168_mac_ocp_write( tp, 0xFB28, 0x0000 );
2779
-        rtl8168_mac_ocp_write( tp, 0xFB2A, 0x0481 );
2780
-        rtl8168_mac_ocp_write( tp, 0xFB2C, 0x0C81 );
2781
-        rtl8168_mac_ocp_write( tp, 0xFB2E, 0x0AE0 );
2782
-
2783
-
2784
-        rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
2785
-
2786
-        rtl8168_mac_ocp_write( tp, 0xFC28, 0x0000 );
2787
-        rtl8168_mac_ocp_write( tp, 0xFC2A, 0x0000 );
2788
-        rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0297 );
2789
-        rtl8168_mac_ocp_write( tp, 0xFC2E, 0x0000 );
2790
-        rtl8168_mac_ocp_write( tp, 0xFC30, 0x00A9 );
2791
-        rtl8168_mac_ocp_write( tp, 0xFC32, 0x012D );
2792
-        rtl8168_mac_ocp_write( tp, 0xFC34, 0x0000 );
2793
-        rtl8168_mac_ocp_write( tp, 0xFC36, 0x08DF );
2794
+        rtl8168_mac_ocp_write(tp, 0xF800, 0xE008);
2795
+        rtl8168_mac_ocp_write(tp, 0xF802, 0xE00A);
2796
+        rtl8168_mac_ocp_write(tp, 0xF804, 0xE00D);
2797
+        rtl8168_mac_ocp_write(tp, 0xF806, 0xE02F);
2798
+        rtl8168_mac_ocp_write(tp, 0xF808, 0xE031);
2799
+        rtl8168_mac_ocp_write(tp, 0xF80A, 0xE038);
2800
+        rtl8168_mac_ocp_write(tp, 0xF80C, 0xE03A);
2801
+        rtl8168_mac_ocp_write(tp, 0xF80E, 0xE051);
2802
+        rtl8168_mac_ocp_write(tp, 0xF810, 0xC202);
2803
+        rtl8168_mac_ocp_write(tp, 0xF812, 0xBA00);
2804
+        rtl8168_mac_ocp_write(tp, 0xF814, 0x0DFC);
2805
+        rtl8168_mac_ocp_write(tp, 0xF816, 0x7444);
2806
+        rtl8168_mac_ocp_write(tp, 0xF818, 0xC502);
2807
+        rtl8168_mac_ocp_write(tp, 0xF81A, 0xBD00);
2808
+        rtl8168_mac_ocp_write(tp, 0xF81C, 0x0A30);
2809
+        rtl8168_mac_ocp_write(tp, 0xF81E, 0x49D9);
2810
+        rtl8168_mac_ocp_write(tp, 0xF820, 0xF019);
2811
+        rtl8168_mac_ocp_write(tp, 0xF822, 0xC520);
2812
+        rtl8168_mac_ocp_write(tp, 0xF824, 0x64A5);
2813
+        rtl8168_mac_ocp_write(tp, 0xF826, 0x1400);
2814
+        rtl8168_mac_ocp_write(tp, 0xF828, 0xF007);
2815
+        rtl8168_mac_ocp_write(tp, 0xF82A, 0x0C01);
2816
+        rtl8168_mac_ocp_write(tp, 0xF82C, 0x8CA5);
2817
+        rtl8168_mac_ocp_write(tp, 0xF82E, 0x1C15);
2818
+        rtl8168_mac_ocp_write(tp, 0xF830, 0xC515);
2819
+        rtl8168_mac_ocp_write(tp, 0xF832, 0x9CA0);
2820
+        rtl8168_mac_ocp_write(tp, 0xF834, 0xE00F);
2821
+        rtl8168_mac_ocp_write(tp, 0xF836, 0xC513);
2822
+        rtl8168_mac_ocp_write(tp, 0xF838, 0x74A0);
2823
+        rtl8168_mac_ocp_write(tp, 0xF83A, 0x48C8);
2824
+        rtl8168_mac_ocp_write(tp, 0xF83C, 0x48CA);
2825
+        rtl8168_mac_ocp_write(tp, 0xF83E, 0x9CA0);
2826
+        rtl8168_mac_ocp_write(tp, 0xF840, 0xC510);
2827
+        rtl8168_mac_ocp_write(tp, 0xF842, 0x1B00);
2828
+        rtl8168_mac_ocp_write(tp, 0xF844, 0x9BA0);
2829
+        rtl8168_mac_ocp_write(tp, 0xF846, 0x1B1C);
2830
+        rtl8168_mac_ocp_write(tp, 0xF848, 0x483F);
2831
+        rtl8168_mac_ocp_write(tp, 0xF84A, 0x9BA2);
2832
+        rtl8168_mac_ocp_write(tp, 0xF84C, 0x1B04);
2833
+        rtl8168_mac_ocp_write(tp, 0xF84E, 0xC506);
2834
+        rtl8168_mac_ocp_write(tp, 0xF850, 0x9BA0);
2835
+        rtl8168_mac_ocp_write(tp, 0xF852, 0xC603);
2836
+        rtl8168_mac_ocp_write(tp, 0xF854, 0xBE00);
2837
+        rtl8168_mac_ocp_write(tp, 0xF856, 0x0298);
2838
+        rtl8168_mac_ocp_write(tp, 0xF858, 0x03DE);
2839
+        rtl8168_mac_ocp_write(tp, 0xF85A, 0xE434);
2840
+        rtl8168_mac_ocp_write(tp, 0xF85C, 0xE096);
2841
+        rtl8168_mac_ocp_write(tp, 0xF85E, 0xE860);
2842
+        rtl8168_mac_ocp_write(tp, 0xF860, 0xDE20);
2843
+        rtl8168_mac_ocp_write(tp, 0xF862, 0xD3C0);
2844
+        rtl8168_mac_ocp_write(tp, 0xF864, 0xC602);
2845
+        rtl8168_mac_ocp_write(tp, 0xF866, 0xBE00);
2846
+        rtl8168_mac_ocp_write(tp, 0xF868, 0x0A64);
2847
+        rtl8168_mac_ocp_write(tp, 0xF86A, 0xC707);
2848
+        rtl8168_mac_ocp_write(tp, 0xF86C, 0x1D00);
2849
+        rtl8168_mac_ocp_write(tp, 0xF86E, 0x8DE2);
2850
+        rtl8168_mac_ocp_write(tp, 0xF870, 0x48C1);
2851
+        rtl8168_mac_ocp_write(tp, 0xF872, 0xC502);
2852
+        rtl8168_mac_ocp_write(tp, 0xF874, 0xBD00);
2853
+        rtl8168_mac_ocp_write(tp, 0xF876, 0x00AA);
2854
+        rtl8168_mac_ocp_write(tp, 0xF878, 0xE0C0);
2855
+        rtl8168_mac_ocp_write(tp, 0xF87A, 0xC502);
2856
+        rtl8168_mac_ocp_write(tp, 0xF87C, 0xBD00);
2857
+        rtl8168_mac_ocp_write(tp, 0xF87E, 0x0132);
2858
+        rtl8168_mac_ocp_write(tp, 0xF880, 0xC50C);
2859
+        rtl8168_mac_ocp_write(tp, 0xF882, 0x74A2);
2860
+        rtl8168_mac_ocp_write(tp, 0xF884, 0x49CE);
2861
+        rtl8168_mac_ocp_write(tp, 0xF886, 0xF1FE);
2862
+        rtl8168_mac_ocp_write(tp, 0xF888, 0x1C00);
2863
+        rtl8168_mac_ocp_write(tp, 0xF88A, 0x9EA0);
2864
+        rtl8168_mac_ocp_write(tp, 0xF88C, 0x1C1C);
2865
+        rtl8168_mac_ocp_write(tp, 0xF88E, 0x484F);
2866
+        rtl8168_mac_ocp_write(tp, 0xF890, 0x9CA2);
2867
+        rtl8168_mac_ocp_write(tp, 0xF892, 0xC402);
2868
+        rtl8168_mac_ocp_write(tp, 0xF894, 0xBC00);
2869
+        rtl8168_mac_ocp_write(tp, 0xF896, 0x0AFA);
2870
+        rtl8168_mac_ocp_write(tp, 0xF898, 0xDE20);
2871
+        rtl8168_mac_ocp_write(tp, 0xF89A, 0xE000);
2872
+        rtl8168_mac_ocp_write(tp, 0xF89C, 0xE092);
2873
+        rtl8168_mac_ocp_write(tp, 0xF89E, 0xE430);
2874
+        rtl8168_mac_ocp_write(tp, 0xF8A0, 0xDE20);
2875
+        rtl8168_mac_ocp_write(tp, 0xF8A2, 0xE0C0);
2876
+        rtl8168_mac_ocp_write(tp, 0xF8A4, 0xE860);
2877
+        rtl8168_mac_ocp_write(tp, 0xF8A6, 0xE84C);
2878
+        rtl8168_mac_ocp_write(tp, 0xF8A8, 0xB400);
2879
+        rtl8168_mac_ocp_write(tp, 0xF8AA, 0xB430);
2880
+        rtl8168_mac_ocp_write(tp, 0xF8AC, 0xE410);
2881
+        rtl8168_mac_ocp_write(tp, 0xF8AE, 0xC0AE);
2882
+        rtl8168_mac_ocp_write(tp, 0xF8B0, 0xB407);
2883
+        rtl8168_mac_ocp_write(tp, 0xF8B2, 0xB406);
2884
+        rtl8168_mac_ocp_write(tp, 0xF8B4, 0xB405);
2885
+        rtl8168_mac_ocp_write(tp, 0xF8B6, 0xB404);
2886
+        rtl8168_mac_ocp_write(tp, 0xF8B8, 0xB403);
2887
+        rtl8168_mac_ocp_write(tp, 0xF8BA, 0xB402);
2888
+        rtl8168_mac_ocp_write(tp, 0xF8BC, 0xB401);
2889
+        rtl8168_mac_ocp_write(tp, 0xF8BE, 0xC7EE);
2890
+        rtl8168_mac_ocp_write(tp, 0xF8C0, 0x76F4);
2891
+        rtl8168_mac_ocp_write(tp, 0xF8C2, 0xC2ED);
2892
+        rtl8168_mac_ocp_write(tp, 0xF8C4, 0xC3ED);
2893
+        rtl8168_mac_ocp_write(tp, 0xF8C6, 0xC1EF);
2894
+        rtl8168_mac_ocp_write(tp, 0xF8C8, 0xC5F3);
2895
+        rtl8168_mac_ocp_write(tp, 0xF8CA, 0x74A0);
2896
+        rtl8168_mac_ocp_write(tp, 0xF8CC, 0x49CD);
2897
+        rtl8168_mac_ocp_write(tp, 0xF8CE, 0xF001);
2898
+        rtl8168_mac_ocp_write(tp, 0xF8D0, 0xC5EE);
2899
+        rtl8168_mac_ocp_write(tp, 0xF8D2, 0x74A0);
2900
+        rtl8168_mac_ocp_write(tp, 0xF8D4, 0x49C1);
2901
+        rtl8168_mac_ocp_write(tp, 0xF8D6, 0xF105);
2902
+        rtl8168_mac_ocp_write(tp, 0xF8D8, 0xC5E4);
2903
+        rtl8168_mac_ocp_write(tp, 0xF8DA, 0x74A2);
2904
+        rtl8168_mac_ocp_write(tp, 0xF8DC, 0x49CE);
2905
+        rtl8168_mac_ocp_write(tp, 0xF8DE, 0xF00B);
2906
+        rtl8168_mac_ocp_write(tp, 0xF8E0, 0x7444);
2907
+        rtl8168_mac_ocp_write(tp, 0xF8E2, 0x484B);
2908
+        rtl8168_mac_ocp_write(tp, 0xF8E4, 0x9C44);
2909
+        rtl8168_mac_ocp_write(tp, 0xF8E6, 0x1C10);
2910
+        rtl8168_mac_ocp_write(tp, 0xF8E8, 0x9C62);
2911
+        rtl8168_mac_ocp_write(tp, 0xF8EA, 0x1C11);
2912
+        rtl8168_mac_ocp_write(tp, 0xF8EC, 0x8C60);
2913
+        rtl8168_mac_ocp_write(tp, 0xF8EE, 0x1C00);
2914
+        rtl8168_mac_ocp_write(tp, 0xF8F0, 0x9CF6);
2915
+        rtl8168_mac_ocp_write(tp, 0xF8F2, 0xE0EC);
2916
+        rtl8168_mac_ocp_write(tp, 0xF8F4, 0x49E7);
2917
+        rtl8168_mac_ocp_write(tp, 0xF8F6, 0xF016);
2918
+        rtl8168_mac_ocp_write(tp, 0xF8F8, 0x1D80);
2919
+        rtl8168_mac_ocp_write(tp, 0xF8FA, 0x8DF4);
2920
+        rtl8168_mac_ocp_write(tp, 0xF8FC, 0x74F8);
2921
+        rtl8168_mac_ocp_write(tp, 0xF8FE, 0x4843);
2922
+        rtl8168_mac_ocp_write(tp, 0xF900, 0x8CF8);
2923
+        rtl8168_mac_ocp_write(tp, 0xF902, 0x74F8);
2924
+        rtl8168_mac_ocp_write(tp, 0xF904, 0x74F8);
2925
+        rtl8168_mac_ocp_write(tp, 0xF906, 0x7444);
2926
+        rtl8168_mac_ocp_write(tp, 0xF908, 0x48C8);
2927
+        rtl8168_mac_ocp_write(tp, 0xF90A, 0x48C9);
2928
+        rtl8168_mac_ocp_write(tp, 0xF90C, 0x48CA);
2929
+        rtl8168_mac_ocp_write(tp, 0xF90E, 0x9C44);
2930
+        rtl8168_mac_ocp_write(tp, 0xF910, 0x74F8);
2931
+        rtl8168_mac_ocp_write(tp, 0xF912, 0x4844);
2932
+        rtl8168_mac_ocp_write(tp, 0xF914, 0x8CF8);
2933
+        rtl8168_mac_ocp_write(tp, 0xF916, 0x1E01);
2934
+        rtl8168_mac_ocp_write(tp, 0xF918, 0xE8DB);
2935
+        rtl8168_mac_ocp_write(tp, 0xF91A, 0x7420);
2936
+        rtl8168_mac_ocp_write(tp, 0xF91C, 0x48C1);
2937
+        rtl8168_mac_ocp_write(tp, 0xF91E, 0x9C20);
2938
+        rtl8168_mac_ocp_write(tp, 0xF920, 0xE0D5);
2939
+        rtl8168_mac_ocp_write(tp, 0xF922, 0x49E6);
2940
+        rtl8168_mac_ocp_write(tp, 0xF924, 0xF02A);
2941
+        rtl8168_mac_ocp_write(tp, 0xF926, 0x1D40);
2942
+        rtl8168_mac_ocp_write(tp, 0xF928, 0x8DF4);
2943
+        rtl8168_mac_ocp_write(tp, 0xF92A, 0x74FC);
2944
+        rtl8168_mac_ocp_write(tp, 0xF92C, 0x49C0);
2945
+        rtl8168_mac_ocp_write(tp, 0xF92E, 0xF124);
2946
+        rtl8168_mac_ocp_write(tp, 0xF930, 0x49C1);
2947
+        rtl8168_mac_ocp_write(tp, 0xF932, 0xF122);
2948
+        rtl8168_mac_ocp_write(tp, 0xF934, 0x74F8);
2949
+        rtl8168_mac_ocp_write(tp, 0xF936, 0x49C0);
2950
+        rtl8168_mac_ocp_write(tp, 0xF938, 0xF01F);
2951
+        rtl8168_mac_ocp_write(tp, 0xF93A, 0xE8D3);
2952
+        rtl8168_mac_ocp_write(tp, 0xF93C, 0x48C4);
2953
+        rtl8168_mac_ocp_write(tp, 0xF93E, 0x8CF8);
2954
+        rtl8168_mac_ocp_write(tp, 0xF940, 0x1E00);
2955
+        rtl8168_mac_ocp_write(tp, 0xF942, 0xE8C6);
2956
+        rtl8168_mac_ocp_write(tp, 0xF944, 0xC5B1);
2957
+        rtl8168_mac_ocp_write(tp, 0xF946, 0x74A0);
2958
+        rtl8168_mac_ocp_write(tp, 0xF948, 0x49C3);
2959
+        rtl8168_mac_ocp_write(tp, 0xF94A, 0xF016);
2960
+        rtl8168_mac_ocp_write(tp, 0xF94C, 0xC5AF);
2961
+        rtl8168_mac_ocp_write(tp, 0xF94E, 0x74A4);
2962
+        rtl8168_mac_ocp_write(tp, 0xF950, 0x49C2);
2963
+        rtl8168_mac_ocp_write(tp, 0xF952, 0xF005);
2964
+        rtl8168_mac_ocp_write(tp, 0xF954, 0xC5AA);
2965
+        rtl8168_mac_ocp_write(tp, 0xF956, 0x74B2);
2966
+        rtl8168_mac_ocp_write(tp, 0xF958, 0x49C9);
2967
+        rtl8168_mac_ocp_write(tp, 0xF95A, 0xF10E);
2968
+        rtl8168_mac_ocp_write(tp, 0xF95C, 0xC5A6);
2969
+        rtl8168_mac_ocp_write(tp, 0xF95E, 0x74A8);
2970
+        rtl8168_mac_ocp_write(tp, 0xF960, 0x4845);
2971
+        rtl8168_mac_ocp_write(tp, 0xF962, 0x4846);
2972
+        rtl8168_mac_ocp_write(tp, 0xF964, 0x4847);
2973
+        rtl8168_mac_ocp_write(tp, 0xF966, 0x4848);
2974
+        rtl8168_mac_ocp_write(tp, 0xF968, 0x9CA8);
2975
+        rtl8168_mac_ocp_write(tp, 0xF96A, 0x74B2);
2976
+        rtl8168_mac_ocp_write(tp, 0xF96C, 0x4849);
2977
+        rtl8168_mac_ocp_write(tp, 0xF96E, 0x9CB2);
2978
+        rtl8168_mac_ocp_write(tp, 0xF970, 0x74A0);
2979
+        rtl8168_mac_ocp_write(tp, 0xF972, 0x484F);
2980
+        rtl8168_mac_ocp_write(tp, 0xF974, 0x9CA0);
2981
+        rtl8168_mac_ocp_write(tp, 0xF976, 0xE0AA);
2982
+        rtl8168_mac_ocp_write(tp, 0xF978, 0x49E4);
2983
+        rtl8168_mac_ocp_write(tp, 0xF97A, 0xF018);
2984
+        rtl8168_mac_ocp_write(tp, 0xF97C, 0x1D10);
2985
+        rtl8168_mac_ocp_write(tp, 0xF97E, 0x8DF4);
2986
+        rtl8168_mac_ocp_write(tp, 0xF980, 0x74F8);
2987
+        rtl8168_mac_ocp_write(tp, 0xF982, 0x74F8);
2988
+        rtl8168_mac_ocp_write(tp, 0xF984, 0x74F8);
2989
+        rtl8168_mac_ocp_write(tp, 0xF986, 0x4843);
2990
+        rtl8168_mac_ocp_write(tp, 0xF988, 0x8CF8);
2991
+        rtl8168_mac_ocp_write(tp, 0xF98A, 0x74F8);
2992
+        rtl8168_mac_ocp_write(tp, 0xF98C, 0x74F8);
2993
+        rtl8168_mac_ocp_write(tp, 0xF98E, 0x74F8);
2994
+        rtl8168_mac_ocp_write(tp, 0xF990, 0x4844);
2995
+        rtl8168_mac_ocp_write(tp, 0xF992, 0x4842);
2996
+        rtl8168_mac_ocp_write(tp, 0xF994, 0x4841);
2997
+        rtl8168_mac_ocp_write(tp, 0xF996, 0x8CF8);
2998
+        rtl8168_mac_ocp_write(tp, 0xF998, 0x1E01);
2999
+        rtl8168_mac_ocp_write(tp, 0xF99A, 0xE89A);
3000
+        rtl8168_mac_ocp_write(tp, 0xF99C, 0x7420);
3001
+        rtl8168_mac_ocp_write(tp, 0xF99E, 0x4841);
3002
+        rtl8168_mac_ocp_write(tp, 0xF9A0, 0x9C20);
3003
+        rtl8168_mac_ocp_write(tp, 0xF9A2, 0x7444);
3004
+        rtl8168_mac_ocp_write(tp, 0xF9A4, 0x4848);
3005
+        rtl8168_mac_ocp_write(tp, 0xF9A6, 0x9C44);
3006
+        rtl8168_mac_ocp_write(tp, 0xF9A8, 0xE091);
3007
+        rtl8168_mac_ocp_write(tp, 0xF9AA, 0x49E5);
3008
+        rtl8168_mac_ocp_write(tp, 0xF9AC, 0xF03E);
3009
+        rtl8168_mac_ocp_write(tp, 0xF9AE, 0x1D20);
3010
+        rtl8168_mac_ocp_write(tp, 0xF9B0, 0x8DF4);
3011
+        rtl8168_mac_ocp_write(tp, 0xF9B2, 0x74F8);
3012
+        rtl8168_mac_ocp_write(tp, 0xF9B4, 0x48C2);
3013
+        rtl8168_mac_ocp_write(tp, 0xF9B6, 0x4841);
3014
+        rtl8168_mac_ocp_write(tp, 0xF9B8, 0x8CF8);
3015
+        rtl8168_mac_ocp_write(tp, 0xF9BA, 0x1E01);
3016
+        rtl8168_mac_ocp_write(tp, 0xF9BC, 0x7444);
3017
+        rtl8168_mac_ocp_write(tp, 0xF9BE, 0x49CA);
3018
+        rtl8168_mac_ocp_write(tp, 0xF9C0, 0xF103);
3019
+        rtl8168_mac_ocp_write(tp, 0xF9C2, 0x49C2);
3020
+        rtl8168_mac_ocp_write(tp, 0xF9C4, 0xF00C);
3021
+        rtl8168_mac_ocp_write(tp, 0xF9C6, 0x49C1);
3022
+        rtl8168_mac_ocp_write(tp, 0xF9C8, 0xF004);
3023
+        rtl8168_mac_ocp_write(tp, 0xF9CA, 0x6447);
3024
+        rtl8168_mac_ocp_write(tp, 0xF9CC, 0x2244);
3025
+        rtl8168_mac_ocp_write(tp, 0xF9CE, 0xE002);
3026
+        rtl8168_mac_ocp_write(tp, 0xF9D0, 0x1C01);
3027
+        rtl8168_mac_ocp_write(tp, 0xF9D2, 0x9C62);
3028
+        rtl8168_mac_ocp_write(tp, 0xF9D4, 0x1C11);
3029
+        rtl8168_mac_ocp_write(tp, 0xF9D6, 0x8C60);
3030
+        rtl8168_mac_ocp_write(tp, 0xF9D8, 0x1C00);
3031
+        rtl8168_mac_ocp_write(tp, 0xF9DA, 0x9CF6);
3032
+        rtl8168_mac_ocp_write(tp, 0xF9DC, 0x7444);
3033
+        rtl8168_mac_ocp_write(tp, 0xF9DE, 0x49C8);
3034
+        rtl8168_mac_ocp_write(tp, 0xF9E0, 0xF01D);
3035
+        rtl8168_mac_ocp_write(tp, 0xF9E2, 0x74FC);
3036
+        rtl8168_mac_ocp_write(tp, 0xF9E4, 0x49C0);
3037
+        rtl8168_mac_ocp_write(tp, 0xF9E6, 0xF11A);
3038
+        rtl8168_mac_ocp_write(tp, 0xF9E8, 0x49C1);
3039
+        rtl8168_mac_ocp_write(tp, 0xF9EA, 0xF118);
3040
+        rtl8168_mac_ocp_write(tp, 0xF9EC, 0x74F8);
3041
+        rtl8168_mac_ocp_write(tp, 0xF9EE, 0x49C0);
3042
+        rtl8168_mac_ocp_write(tp, 0xF9F0, 0xF015);
3043
+        rtl8168_mac_ocp_write(tp, 0xF9F2, 0x49C6);
3044
+        rtl8168_mac_ocp_write(tp, 0xF9F4, 0xF113);
3045
+        rtl8168_mac_ocp_write(tp, 0xF9F6, 0xE875);
3046
+        rtl8168_mac_ocp_write(tp, 0xF9F8, 0x48C4);
3047
+        rtl8168_mac_ocp_write(tp, 0xF9FA, 0x8CF8);
3048
+        rtl8168_mac_ocp_write(tp, 0xF9FC, 0x7420);
3049
+        rtl8168_mac_ocp_write(tp, 0xF9FE, 0x48C1);
3050
+        rtl8168_mac_ocp_write(tp, 0xFA00, 0x9C20);
3051
+        rtl8168_mac_ocp_write(tp, 0xFA02, 0xC50A);
3052
+        rtl8168_mac_ocp_write(tp, 0xFA04, 0x74A2);
3053
+        rtl8168_mac_ocp_write(tp, 0xFA06, 0x8CA5);
3054
+        rtl8168_mac_ocp_write(tp, 0xFA08, 0x74A0);
3055
+        rtl8168_mac_ocp_write(tp, 0xFA0A, 0xC505);
3056
+        rtl8168_mac_ocp_write(tp, 0xFA0C, 0x9CA2);
3057
+        rtl8168_mac_ocp_write(tp, 0xFA0E, 0x1C11);
3058
+        rtl8168_mac_ocp_write(tp, 0xFA10, 0x9CA0);
3059
+        rtl8168_mac_ocp_write(tp, 0xFA12, 0xE00A);
3060
+        rtl8168_mac_ocp_write(tp, 0xFA14, 0xE434);
3061
+        rtl8168_mac_ocp_write(tp, 0xFA16, 0xD3C0);
3062
+        rtl8168_mac_ocp_write(tp, 0xFA18, 0xDC00);
3063
+        rtl8168_mac_ocp_write(tp, 0xFA1A, 0x7444);
3064
+        rtl8168_mac_ocp_write(tp, 0xFA1C, 0x49CA);
3065
+        rtl8168_mac_ocp_write(tp, 0xFA1E, 0xF004);
3066
+        rtl8168_mac_ocp_write(tp, 0xFA20, 0x48CA);
3067
+        rtl8168_mac_ocp_write(tp, 0xFA22, 0x9C44);
3068
+        rtl8168_mac_ocp_write(tp, 0xFA24, 0xE855);
3069
+        rtl8168_mac_ocp_write(tp, 0xFA26, 0xE052);
3070
+        rtl8168_mac_ocp_write(tp, 0xFA28, 0x49E8);
3071
+        rtl8168_mac_ocp_write(tp, 0xFA2A, 0xF024);
3072
+        rtl8168_mac_ocp_write(tp, 0xFA2C, 0x1D01);
3073
+        rtl8168_mac_ocp_write(tp, 0xFA2E, 0x8DF5);
3074
+        rtl8168_mac_ocp_write(tp, 0xFA30, 0x7440);
3075
+        rtl8168_mac_ocp_write(tp, 0xFA32, 0x49C0);
3076
+        rtl8168_mac_ocp_write(tp, 0xFA34, 0xF11E);
3077
+        rtl8168_mac_ocp_write(tp, 0xFA36, 0x7444);
3078
+        rtl8168_mac_ocp_write(tp, 0xFA38, 0x49C8);
3079
+        rtl8168_mac_ocp_write(tp, 0xFA3A, 0xF01B);
3080
+        rtl8168_mac_ocp_write(tp, 0xFA3C, 0x49CA);
3081
+        rtl8168_mac_ocp_write(tp, 0xFA3E, 0xF119);
3082
+        rtl8168_mac_ocp_write(tp, 0xFA40, 0xC5EC);
3083
+        rtl8168_mac_ocp_write(tp, 0xFA42, 0x76A4);
3084
+        rtl8168_mac_ocp_write(tp, 0xFA44, 0x49E3);
3085
+        rtl8168_mac_ocp_write(tp, 0xFA46, 0xF015);
3086
+        rtl8168_mac_ocp_write(tp, 0xFA48, 0x49C0);
3087
+        rtl8168_mac_ocp_write(tp, 0xFA4A, 0xF103);
3088
+        rtl8168_mac_ocp_write(tp, 0xFA4C, 0x49C1);
3089
+        rtl8168_mac_ocp_write(tp, 0xFA4E, 0xF011);
3090
+        rtl8168_mac_ocp_write(tp, 0xFA50, 0x4849);
3091
+        rtl8168_mac_ocp_write(tp, 0xFA52, 0x9C44);
3092
+        rtl8168_mac_ocp_write(tp, 0xFA54, 0x1C00);
3093
+        rtl8168_mac_ocp_write(tp, 0xFA56, 0x9CF6);
3094
+        rtl8168_mac_ocp_write(tp, 0xFA58, 0x7444);
3095
+        rtl8168_mac_ocp_write(tp, 0xFA5A, 0x49C1);
3096
+        rtl8168_mac_ocp_write(tp, 0xFA5C, 0xF004);
3097
+        rtl8168_mac_ocp_write(tp, 0xFA5E, 0x6446);
3098
+        rtl8168_mac_ocp_write(tp, 0xFA60, 0x1E07);
3099
+        rtl8168_mac_ocp_write(tp, 0xFA62, 0xE003);
3100
+        rtl8168_mac_ocp_write(tp, 0xFA64, 0x1C01);
3101
+        rtl8168_mac_ocp_write(tp, 0xFA66, 0x1E03);
3102
+        rtl8168_mac_ocp_write(tp, 0xFA68, 0x9C62);
3103
+        rtl8168_mac_ocp_write(tp, 0xFA6A, 0x1C11);
3104
+        rtl8168_mac_ocp_write(tp, 0xFA6C, 0x8C60);
3105
+        rtl8168_mac_ocp_write(tp, 0xFA6E, 0xE830);
3106
+        rtl8168_mac_ocp_write(tp, 0xFA70, 0xE02D);
3107
+        rtl8168_mac_ocp_write(tp, 0xFA72, 0x49E9);
3108
+        rtl8168_mac_ocp_write(tp, 0xFA74, 0xF004);
3109
+        rtl8168_mac_ocp_write(tp, 0xFA76, 0x1D02);
3110
+        rtl8168_mac_ocp_write(tp, 0xFA78, 0x8DF5);
3111
+        rtl8168_mac_ocp_write(tp, 0xFA7A, 0xE79C);
3112
+        rtl8168_mac_ocp_write(tp, 0xFA7C, 0x49E3);
3113
+        rtl8168_mac_ocp_write(tp, 0xFA7E, 0xF006);
3114
+        rtl8168_mac_ocp_write(tp, 0xFA80, 0x1D08);
3115
+        rtl8168_mac_ocp_write(tp, 0xFA82, 0x8DF4);
3116
+        rtl8168_mac_ocp_write(tp, 0xFA84, 0x74F8);
3117
+        rtl8168_mac_ocp_write(tp, 0xFA86, 0x74F8);
3118
+        rtl8168_mac_ocp_write(tp, 0xFA88, 0xE73A);
3119
+        rtl8168_mac_ocp_write(tp, 0xFA8A, 0x49E1);
3120
+        rtl8168_mac_ocp_write(tp, 0xFA8C, 0xF007);
3121
+        rtl8168_mac_ocp_write(tp, 0xFA8E, 0x1D02);
3122
+        rtl8168_mac_ocp_write(tp, 0xFA90, 0x8DF4);
3123
+        rtl8168_mac_ocp_write(tp, 0xFA92, 0x1E01);
3124
+        rtl8168_mac_ocp_write(tp, 0xFA94, 0xE7A7);
3125
+        rtl8168_mac_ocp_write(tp, 0xFA96, 0xDE20);
3126
+        rtl8168_mac_ocp_write(tp, 0xFA98, 0xE410);
3127
+        rtl8168_mac_ocp_write(tp, 0xFA9A, 0x49E0);
3128
+        rtl8168_mac_ocp_write(tp, 0xFA9C, 0xF017);
3129
+        rtl8168_mac_ocp_write(tp, 0xFA9E, 0x1D01);
3130
+        rtl8168_mac_ocp_write(tp, 0xFAA0, 0x8DF4);
3131
+        rtl8168_mac_ocp_write(tp, 0xFAA2, 0xC5FA);
3132
+        rtl8168_mac_ocp_write(tp, 0xFAA4, 0x1C00);
3133
+        rtl8168_mac_ocp_write(tp, 0xFAA6, 0x8CA0);
3134
+        rtl8168_mac_ocp_write(tp, 0xFAA8, 0x1C1B);
3135
+        rtl8168_mac_ocp_write(tp, 0xFAAA, 0x9CA2);
3136
+        rtl8168_mac_ocp_write(tp, 0xFAAC, 0x74A2);
3137
+        rtl8168_mac_ocp_write(tp, 0xFAAE, 0x49CF);
3138
+        rtl8168_mac_ocp_write(tp, 0xFAB0, 0xF0FE);
3139
+        rtl8168_mac_ocp_write(tp, 0xFAB2, 0xC5F3);
3140
+        rtl8168_mac_ocp_write(tp, 0xFAB4, 0x74A0);
3141
+        rtl8168_mac_ocp_write(tp, 0xFAB6, 0x4849);
3142
+        rtl8168_mac_ocp_write(tp, 0xFAB8, 0x9CA0);
3143
+        rtl8168_mac_ocp_write(tp, 0xFABA, 0x74F8);
3144
+        rtl8168_mac_ocp_write(tp, 0xFABC, 0x49C0);
3145
+        rtl8168_mac_ocp_write(tp, 0xFABE, 0xF006);
3146
+        rtl8168_mac_ocp_write(tp, 0xFAC0, 0x48C3);
3147
+        rtl8168_mac_ocp_write(tp, 0xFAC2, 0x8CF8);
3148
+        rtl8168_mac_ocp_write(tp, 0xFAC4, 0xE820);
3149
+        rtl8168_mac_ocp_write(tp, 0xFAC6, 0x74F8);
3150
+        rtl8168_mac_ocp_write(tp, 0xFAC8, 0x74F8);
3151
+        rtl8168_mac_ocp_write(tp, 0xFACA, 0xC432);
3152
+        rtl8168_mac_ocp_write(tp, 0xFACC, 0xBC00);
3153
+        rtl8168_mac_ocp_write(tp, 0xFACE, 0xC5E4);
3154
+        rtl8168_mac_ocp_write(tp, 0xFAD0, 0x74A2);
3155
+        rtl8168_mac_ocp_write(tp, 0xFAD2, 0x49CE);
3156
+        rtl8168_mac_ocp_write(tp, 0xFAD4, 0xF1FE);
3157
+        rtl8168_mac_ocp_write(tp, 0xFAD6, 0x9EA0);
3158
+        rtl8168_mac_ocp_write(tp, 0xFAD8, 0x1C1C);
3159
+        rtl8168_mac_ocp_write(tp, 0xFADA, 0x484F);
3160
+        rtl8168_mac_ocp_write(tp, 0xFADC, 0x9CA2);
3161
+        rtl8168_mac_ocp_write(tp, 0xFADE, 0xFF80);
3162
+        rtl8168_mac_ocp_write(tp, 0xFAE0, 0xB404);
3163
+        rtl8168_mac_ocp_write(tp, 0xFAE2, 0xB405);
3164
+        rtl8168_mac_ocp_write(tp, 0xFAE4, 0xC5D9);
3165
+        rtl8168_mac_ocp_write(tp, 0xFAE6, 0x74A2);
3166
+        rtl8168_mac_ocp_write(tp, 0xFAE8, 0x49CE);
3167
+        rtl8168_mac_ocp_write(tp, 0xFAEA, 0xF1FE);
3168
+        rtl8168_mac_ocp_write(tp, 0xFAEC, 0xC41F);
3169
+        rtl8168_mac_ocp_write(tp, 0xFAEE, 0x9CA0);
3170
+        rtl8168_mac_ocp_write(tp, 0xFAF0, 0xC41C);
3171
+        rtl8168_mac_ocp_write(tp, 0xFAF2, 0x1C13);
3172
+        rtl8168_mac_ocp_write(tp, 0xFAF4, 0x484F);
3173
+        rtl8168_mac_ocp_write(tp, 0xFAF6, 0x9CA2);
3174
+        rtl8168_mac_ocp_write(tp, 0xFAF8, 0x74A2);
3175
+        rtl8168_mac_ocp_write(tp, 0xFAFA, 0x49CF);
3176
+        rtl8168_mac_ocp_write(tp, 0xFAFC, 0xF1FE);
3177
+        rtl8168_mac_ocp_write(tp, 0xFAFE, 0xB005);
3178
+        rtl8168_mac_ocp_write(tp, 0xFB00, 0xB004);
3179
+        rtl8168_mac_ocp_write(tp, 0xFB02, 0xFF80);
3180
+        rtl8168_mac_ocp_write(tp, 0xFB04, 0xB404);
3181
+        rtl8168_mac_ocp_write(tp, 0xFB06, 0xB405);
3182
+        rtl8168_mac_ocp_write(tp, 0xFB08, 0xC5C7);
3183
+        rtl8168_mac_ocp_write(tp, 0xFB0A, 0x74A2);
3184
+        rtl8168_mac_ocp_write(tp, 0xFB0C, 0x49CE);
3185
+        rtl8168_mac_ocp_write(tp, 0xFB0E, 0xF1FE);
3186
+        rtl8168_mac_ocp_write(tp, 0xFB10, 0xC40E);
3187
+        rtl8168_mac_ocp_write(tp, 0xFB12, 0x9CA0);
3188
+        rtl8168_mac_ocp_write(tp, 0xFB14, 0xC40A);
3189
+        rtl8168_mac_ocp_write(tp, 0xFB16, 0x1C13);
3190
+        rtl8168_mac_ocp_write(tp, 0xFB18, 0x484F);
3191
+        rtl8168_mac_ocp_write(tp, 0xFB1A, 0x9CA2);
3192
+        rtl8168_mac_ocp_write(tp, 0xFB1C, 0x74A2);
3193
+        rtl8168_mac_ocp_write(tp, 0xFB1E, 0x49CF);
3194
+        rtl8168_mac_ocp_write(tp, 0xFB20, 0xF1FE);
3195
+        rtl8168_mac_ocp_write(tp, 0xFB22, 0xB005);
3196
+        rtl8168_mac_ocp_write(tp, 0xFB24, 0xB004);
3197
+        rtl8168_mac_ocp_write(tp, 0xFB26, 0xFF80);
3198
+        rtl8168_mac_ocp_write(tp, 0xFB28, 0x0000);
3199
+        rtl8168_mac_ocp_write(tp, 0xFB2A, 0x0481);
3200
+        rtl8168_mac_ocp_write(tp, 0xFB2C, 0x0C81);
3201
+        rtl8168_mac_ocp_write(tp, 0xFB2E, 0x0AE0);
3202
+
3203
+
3204
+        rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3205
+
3206
+        rtl8168_mac_ocp_write(tp, 0xFC28, 0x0000);
3207
+        rtl8168_mac_ocp_write(tp, 0xFC2A, 0x0000);
3208
+        rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0297);
3209
+        rtl8168_mac_ocp_write(tp, 0xFC2E, 0x0000);
3210
+        rtl8168_mac_ocp_write(tp, 0xFC30, 0x00A9);
3211
+        rtl8168_mac_ocp_write(tp, 0xFC32, 0x012D);
3212
+        rtl8168_mac_ocp_write(tp, 0xFC34, 0x0000);
3213
+        rtl8168_mac_ocp_write(tp, 0xFC36, 0x08DF);
3214
 }
3215
 
3216
 static void
3217
@@ -9678,127 +9825,127 @@
3218
 
3219
         rtl8168_hw_disable_mac_mcu_bps(dev);
3220
 
3221
-        rtl8168_mac_ocp_write( tp, 0xF800, 0xE008 );
3222
-        rtl8168_mac_ocp_write( tp, 0xF802, 0xE00A );
3223
-        rtl8168_mac_ocp_write( tp, 0xF804, 0xE00C );
3224
-        rtl8168_mac_ocp_write( tp, 0xF806, 0xE00E );
3225
-        rtl8168_mac_ocp_write( tp, 0xF808, 0xE027 );
3226
-        rtl8168_mac_ocp_write( tp, 0xF80A, 0xE04F );
3227
-        rtl8168_mac_ocp_write( tp, 0xF80C, 0xE05E );
3228
-        rtl8168_mac_ocp_write( tp, 0xF80E, 0xE065 );
3229
-        rtl8168_mac_ocp_write( tp, 0xF810, 0xC602 );
3230
-        rtl8168_mac_ocp_write( tp, 0xF812, 0xBE00 );
3231
-        rtl8168_mac_ocp_write( tp, 0xF814, 0x0000 );
3232
-        rtl8168_mac_ocp_write( tp, 0xF816, 0xC502 );
3233
-        rtl8168_mac_ocp_write( tp, 0xF818, 0xBD00 );
3234
-        rtl8168_mac_ocp_write( tp, 0xF81A, 0x074C );
3235
-        rtl8168_mac_ocp_write( tp, 0xF81C, 0xC302 );
3236
-        rtl8168_mac_ocp_write( tp, 0xF81E, 0xBB00 );
3237
-        rtl8168_mac_ocp_write( tp, 0xF820, 0x080A );
3238
-        rtl8168_mac_ocp_write( tp, 0xF822, 0x6420 );
3239
-        rtl8168_mac_ocp_write( tp, 0xF824, 0x48C2 );
3240
-        rtl8168_mac_ocp_write( tp, 0xF826, 0x8C20 );
3241
-        rtl8168_mac_ocp_write( tp, 0xF828, 0xC516 );
3242
-        rtl8168_mac_ocp_write( tp, 0xF82A, 0x64A4 );
3243
-        rtl8168_mac_ocp_write( tp, 0xF82C, 0x49C0 );
3244
-        rtl8168_mac_ocp_write( tp, 0xF82E, 0xF009 );
3245
-        rtl8168_mac_ocp_write( tp, 0xF830, 0x74A2 );
3246
-        rtl8168_mac_ocp_write( tp, 0xF832, 0x8CA5 );
3247
-        rtl8168_mac_ocp_write( tp, 0xF834, 0x74A0 );
3248
-        rtl8168_mac_ocp_write( tp, 0xF836, 0xC50E );
3249
-        rtl8168_mac_ocp_write( tp, 0xF838, 0x9CA2 );
3250
-        rtl8168_mac_ocp_write( tp, 0xF83A, 0x1C11 );
3251
-        rtl8168_mac_ocp_write( tp, 0xF83C, 0x9CA0 );
3252
-        rtl8168_mac_ocp_write( tp, 0xF83E, 0xE006 );
3253
-        rtl8168_mac_ocp_write( tp, 0xF840, 0x74F8 );
3254
-        rtl8168_mac_ocp_write( tp, 0xF842, 0x48C4 );
3255
-        rtl8168_mac_ocp_write( tp, 0xF844, 0x8CF8 );
3256
-        rtl8168_mac_ocp_write( tp, 0xF846, 0xC404 );
3257
-        rtl8168_mac_ocp_write( tp, 0xF848, 0xBC00 );
3258
-        rtl8168_mac_ocp_write( tp, 0xF84A, 0xC403 );
3259
-        rtl8168_mac_ocp_write( tp, 0xF84C, 0xBC00 );
3260
-        rtl8168_mac_ocp_write( tp, 0xF84E, 0x0BF2 );
3261
-        rtl8168_mac_ocp_write( tp, 0xF850, 0x0C0A );
3262
-        rtl8168_mac_ocp_write( tp, 0xF852, 0xE434 );
3263
-        rtl8168_mac_ocp_write( tp, 0xF854, 0xD3C0 );
3264
-        rtl8168_mac_ocp_write( tp, 0xF856, 0x49D9 );
3265
-        rtl8168_mac_ocp_write( tp, 0xF858, 0xF01F );
3266
-        rtl8168_mac_ocp_write( tp, 0xF85A, 0xC526 );
3267
-        rtl8168_mac_ocp_write( tp, 0xF85C, 0x64A5 );
3268
-        rtl8168_mac_ocp_write( tp, 0xF85E, 0x1400 );
3269
-        rtl8168_mac_ocp_write( tp, 0xF860, 0xF007 );
3270
-        rtl8168_mac_ocp_write( tp, 0xF862, 0x0C01 );
3271
-        rtl8168_mac_ocp_write( tp, 0xF864, 0x8CA5 );
3272
-        rtl8168_mac_ocp_write( tp, 0xF866, 0x1C15 );
3273
-        rtl8168_mac_ocp_write( tp, 0xF868, 0xC51B );
3274
-        rtl8168_mac_ocp_write( tp, 0xF86A, 0x9CA0 );
3275
-        rtl8168_mac_ocp_write( tp, 0xF86C, 0xE013 );
3276
-        rtl8168_mac_ocp_write( tp, 0xF86E, 0xC519 );
3277
-        rtl8168_mac_ocp_write( tp, 0xF870, 0x74A0 );
3278
-        rtl8168_mac_ocp_write( tp, 0xF872, 0x48C4 );
3279
-        rtl8168_mac_ocp_write( tp, 0xF874, 0x8CA0 );
3280
-        rtl8168_mac_ocp_write( tp, 0xF876, 0xC516 );
3281
-        rtl8168_mac_ocp_write( tp, 0xF878, 0x74A4 );
3282
-        rtl8168_mac_ocp_write( tp, 0xF87A, 0x48C8 );
3283
-        rtl8168_mac_ocp_write( tp, 0xF87C, 0x48CA );
3284
-        rtl8168_mac_ocp_write( tp, 0xF87E, 0x9CA4 );
3285
-        rtl8168_mac_ocp_write( tp, 0xF880, 0xC512 );
3286
-        rtl8168_mac_ocp_write( tp, 0xF882, 0x1B00 );
3287
-        rtl8168_mac_ocp_write( tp, 0xF884, 0x9BA0 );
3288
-        rtl8168_mac_ocp_write( tp, 0xF886, 0x1B1C );
3289
-        rtl8168_mac_ocp_write( tp, 0xF888, 0x483F );
3290
-        rtl8168_mac_ocp_write( tp, 0xF88A, 0x9BA2 );
3291
-        rtl8168_mac_ocp_write( tp, 0xF88C, 0x1B04 );
3292
-        rtl8168_mac_ocp_write( tp, 0xF88E, 0xC508 );
3293
-        rtl8168_mac_ocp_write( tp, 0xF890, 0x9BA0 );
3294
-        rtl8168_mac_ocp_write( tp, 0xF892, 0xC505 );
3295
-        rtl8168_mac_ocp_write( tp, 0xF894, 0xBD00 );
3296
-        rtl8168_mac_ocp_write( tp, 0xF896, 0xC502 );
3297
-        rtl8168_mac_ocp_write( tp, 0xF898, 0xBD00 );
3298
-        rtl8168_mac_ocp_write( tp, 0xF89A, 0x0300 );
3299
-        rtl8168_mac_ocp_write( tp, 0xF89C, 0x051E );
3300
-        rtl8168_mac_ocp_write( tp, 0xF89E, 0xE434 );
3301
-        rtl8168_mac_ocp_write( tp, 0xF8A0, 0xE018 );
3302
-        rtl8168_mac_ocp_write( tp, 0xF8A2, 0xE092 );
3303
-        rtl8168_mac_ocp_write( tp, 0xF8A4, 0xDE20 );
3304
-        rtl8168_mac_ocp_write( tp, 0xF8A6, 0xD3C0 );
3305
-        rtl8168_mac_ocp_write( tp, 0xF8A8, 0xC50F );
3306
-        rtl8168_mac_ocp_write( tp, 0xF8AA, 0x76A4 );
3307
-        rtl8168_mac_ocp_write( tp, 0xF8AC, 0x49E3 );
3308
-        rtl8168_mac_ocp_write( tp, 0xF8AE, 0xF007 );
3309
-        rtl8168_mac_ocp_write( tp, 0xF8B0, 0x49C0 );
3310
-        rtl8168_mac_ocp_write( tp, 0xF8B2, 0xF103 );
3311
-        rtl8168_mac_ocp_write( tp, 0xF8B4, 0xC607 );
3312
-        rtl8168_mac_ocp_write( tp, 0xF8B6, 0xBE00 );
3313
-        rtl8168_mac_ocp_write( tp, 0xF8B8, 0xC606 );
3314
-        rtl8168_mac_ocp_write( tp, 0xF8BA, 0xBE00 );
3315
-        rtl8168_mac_ocp_write( tp, 0xF8BC, 0xC602 );
3316
-        rtl8168_mac_ocp_write( tp, 0xF8BE, 0xBE00 );
3317
-        rtl8168_mac_ocp_write( tp, 0xF8C0, 0x0C4C );
3318
-        rtl8168_mac_ocp_write( tp, 0xF8C2, 0x0C28 );
3319
-        rtl8168_mac_ocp_write( tp, 0xF8C4, 0x0C2C );
3320
-        rtl8168_mac_ocp_write( tp, 0xF8C6, 0xDC00 );
3321
-        rtl8168_mac_ocp_write( tp, 0xF8C8, 0xC707 );
3322
-        rtl8168_mac_ocp_write( tp, 0xF8CA, 0x1D00 );
3323
-        rtl8168_mac_ocp_write( tp, 0xF8CC, 0x8DE2 );
3324
-        rtl8168_mac_ocp_write( tp, 0xF8CE, 0x48C1 );
3325
-        rtl8168_mac_ocp_write( tp, 0xF8D0, 0xC502 );
3326
-        rtl8168_mac_ocp_write( tp, 0xF8D2, 0xBD00 );
3327
-        rtl8168_mac_ocp_write( tp, 0xF8D4, 0x00AA );
3328
-        rtl8168_mac_ocp_write( tp, 0xF8D6, 0xE0C0 );
3329
-        rtl8168_mac_ocp_write( tp, 0xF8D8, 0xC502 );
3330
-        rtl8168_mac_ocp_write( tp, 0xF8DA, 0xBD00 );
3331
-        rtl8168_mac_ocp_write( tp, 0xF8DC, 0x0132 );
3332
-
3333
-        rtl8168_mac_ocp_write( tp, 0xFC26, 0x8000 );
3334
-
3335
-        rtl8168_mac_ocp_write( tp, 0xFC2A, 0x0743 );
3336
-        rtl8168_mac_ocp_write( tp, 0xFC2C, 0x0801 );
3337
-        rtl8168_mac_ocp_write( tp, 0xFC2E, 0x0BE9 );
3338
-        rtl8168_mac_ocp_write( tp, 0xFC30, 0x02FD );
3339
-        rtl8168_mac_ocp_write( tp, 0xFC32, 0x0C25 );
3340
-        rtl8168_mac_ocp_write( tp, 0xFC34, 0x00A9 );
3341
-        rtl8168_mac_ocp_write( tp, 0xFC36, 0x012D );
3342
+        rtl8168_mac_ocp_write(tp, 0xF800, 0xE008);
3343
+        rtl8168_mac_ocp_write(tp, 0xF802, 0xE00A);
3344
+        rtl8168_mac_ocp_write(tp, 0xF804, 0xE00C);
3345
+        rtl8168_mac_ocp_write(tp, 0xF806, 0xE00E);
3346
+        rtl8168_mac_ocp_write(tp, 0xF808, 0xE027);
3347
+        rtl8168_mac_ocp_write(tp, 0xF80A, 0xE04F);
3348
+        rtl8168_mac_ocp_write(tp, 0xF80C, 0xE05E);
3349
+        rtl8168_mac_ocp_write(tp, 0xF80E, 0xE065);
3350
+        rtl8168_mac_ocp_write(tp, 0xF810, 0xC602);
3351
+        rtl8168_mac_ocp_write(tp, 0xF812, 0xBE00);
3352
+        rtl8168_mac_ocp_write(tp, 0xF814, 0x0000);
3353
+        rtl8168_mac_ocp_write(tp, 0xF816, 0xC502);
3354
+        rtl8168_mac_ocp_write(tp, 0xF818, 0xBD00);
3355
+        rtl8168_mac_ocp_write(tp, 0xF81A, 0x074C);
3356
+        rtl8168_mac_ocp_write(tp, 0xF81C, 0xC302);
3357
+        rtl8168_mac_ocp_write(tp, 0xF81E, 0xBB00);
3358
+        rtl8168_mac_ocp_write(tp, 0xF820, 0x080A);
3359
+        rtl8168_mac_ocp_write(tp, 0xF822, 0x6420);
3360
+        rtl8168_mac_ocp_write(tp, 0xF824, 0x48C2);
3361
+        rtl8168_mac_ocp_write(tp, 0xF826, 0x8C20);
3362
+        rtl8168_mac_ocp_write(tp, 0xF828, 0xC516);
3363
+        rtl8168_mac_ocp_write(tp, 0xF82A, 0x64A4);
3364
+        rtl8168_mac_ocp_write(tp, 0xF82C, 0x49C0);
3365
+        rtl8168_mac_ocp_write(tp, 0xF82E, 0xF009);
3366
+        rtl8168_mac_ocp_write(tp, 0xF830, 0x74A2);
3367
+        rtl8168_mac_ocp_write(tp, 0xF832, 0x8CA5);
3368
+        rtl8168_mac_ocp_write(tp, 0xF834, 0x74A0);
3369
+        rtl8168_mac_ocp_write(tp, 0xF836, 0xC50E);
3370
+        rtl8168_mac_ocp_write(tp, 0xF838, 0x9CA2);
3371
+        rtl8168_mac_ocp_write(tp, 0xF83A, 0x1C11);
3372
+        rtl8168_mac_ocp_write(tp, 0xF83C, 0x9CA0);
3373
+        rtl8168_mac_ocp_write(tp, 0xF83E, 0xE006);
3374
+        rtl8168_mac_ocp_write(tp, 0xF840, 0x74F8);
3375
+        rtl8168_mac_ocp_write(tp, 0xF842, 0x48C4);
3376
+        rtl8168_mac_ocp_write(tp, 0xF844, 0x8CF8);
3377
+        rtl8168_mac_ocp_write(tp, 0xF846, 0xC404);
3378
+        rtl8168_mac_ocp_write(tp, 0xF848, 0xBC00);
3379
+        rtl8168_mac_ocp_write(tp, 0xF84A, 0xC403);
3380
+        rtl8168_mac_ocp_write(tp, 0xF84C, 0xBC00);
3381
+        rtl8168_mac_ocp_write(tp, 0xF84E, 0x0BF2);
3382
+        rtl8168_mac_ocp_write(tp, 0xF850, 0x0C0A);
3383
+        rtl8168_mac_ocp_write(tp, 0xF852, 0xE434);
3384
+        rtl8168_mac_ocp_write(tp, 0xF854, 0xD3C0);
3385
+        rtl8168_mac_ocp_write(tp, 0xF856, 0x49D9);
3386
+        rtl8168_mac_ocp_write(tp, 0xF858, 0xF01F);
3387
+        rtl8168_mac_ocp_write(tp, 0xF85A, 0xC526);
3388
+        rtl8168_mac_ocp_write(tp, 0xF85C, 0x64A5);
3389
+        rtl8168_mac_ocp_write(tp, 0xF85E, 0x1400);
3390
+        rtl8168_mac_ocp_write(tp, 0xF860, 0xF007);
3391
+        rtl8168_mac_ocp_write(tp, 0xF862, 0x0C01);
3392
+        rtl8168_mac_ocp_write(tp, 0xF864, 0x8CA5);
3393
+        rtl8168_mac_ocp_write(tp, 0xF866, 0x1C15);
3394
+        rtl8168_mac_ocp_write(tp, 0xF868, 0xC51B);
3395
+        rtl8168_mac_ocp_write(tp, 0xF86A, 0x9CA0);
3396
+        rtl8168_mac_ocp_write(tp, 0xF86C, 0xE013);
3397
+        rtl8168_mac_ocp_write(tp, 0xF86E, 0xC519);
3398
+        rtl8168_mac_ocp_write(tp, 0xF870, 0x74A0);
3399
+        rtl8168_mac_ocp_write(tp, 0xF872, 0x48C4);
3400
+        rtl8168_mac_ocp_write(tp, 0xF874, 0x8CA0);
3401
+        rtl8168_mac_ocp_write(tp, 0xF876, 0xC516);
3402
+        rtl8168_mac_ocp_write(tp, 0xF878, 0x74A4);
3403
+        rtl8168_mac_ocp_write(tp, 0xF87A, 0x48C8);
3404
+        rtl8168_mac_ocp_write(tp, 0xF87C, 0x48CA);
3405
+        rtl8168_mac_ocp_write(tp, 0xF87E, 0x9CA4);
3406
+        rtl8168_mac_ocp_write(tp, 0xF880, 0xC512);
3407
+        rtl8168_mac_ocp_write(tp, 0xF882, 0x1B00);
3408
+        rtl8168_mac_ocp_write(tp, 0xF884, 0x9BA0);
3409
+        rtl8168_mac_ocp_write(tp, 0xF886, 0x1B1C);
3410
+        rtl8168_mac_ocp_write(tp, 0xF888, 0x483F);
3411
+        rtl8168_mac_ocp_write(tp, 0xF88A, 0x9BA2);
3412
+        rtl8168_mac_ocp_write(tp, 0xF88C, 0x1B04);
3413
+        rtl8168_mac_ocp_write(tp, 0xF88E, 0xC508);
3414
+        rtl8168_mac_ocp_write(tp, 0xF890, 0x9BA0);
3415
+        rtl8168_mac_ocp_write(tp, 0xF892, 0xC505);
3416
+        rtl8168_mac_ocp_write(tp, 0xF894, 0xBD00);
3417
+        rtl8168_mac_ocp_write(tp, 0xF896, 0xC502);
3418
+        rtl8168_mac_ocp_write(tp, 0xF898, 0xBD00);
3419
+        rtl8168_mac_ocp_write(tp, 0xF89A, 0x0300);
3420
+        rtl8168_mac_ocp_write(tp, 0xF89C, 0x051E);
3421
+        rtl8168_mac_ocp_write(tp, 0xF89E, 0xE434);
3422
+        rtl8168_mac_ocp_write(tp, 0xF8A0, 0xE018);
3423
+        rtl8168_mac_ocp_write(tp, 0xF8A2, 0xE092);
3424
+        rtl8168_mac_ocp_write(tp, 0xF8A4, 0xDE20);
3425
+        rtl8168_mac_ocp_write(tp, 0xF8A6, 0xD3C0);
3426
+        rtl8168_mac_ocp_write(tp, 0xF8A8, 0xC50F);
3427
+        rtl8168_mac_ocp_write(tp, 0xF8AA, 0x76A4);
3428
+        rtl8168_mac_ocp_write(tp, 0xF8AC, 0x49E3);
3429
+        rtl8168_mac_ocp_write(tp, 0xF8AE, 0xF007);
3430
+        rtl8168_mac_ocp_write(tp, 0xF8B0, 0x49C0);
3431
+        rtl8168_mac_ocp_write(tp, 0xF8B2, 0xF103);
3432
+        rtl8168_mac_ocp_write(tp, 0xF8B4, 0xC607);
3433
+        rtl8168_mac_ocp_write(tp, 0xF8B6, 0xBE00);
3434
+        rtl8168_mac_ocp_write(tp, 0xF8B8, 0xC606);
3435
+        rtl8168_mac_ocp_write(tp, 0xF8BA, 0xBE00);
3436
+        rtl8168_mac_ocp_write(tp, 0xF8BC, 0xC602);
3437
+        rtl8168_mac_ocp_write(tp, 0xF8BE, 0xBE00);
3438
+        rtl8168_mac_ocp_write(tp, 0xF8C0, 0x0C4C);
3439
+        rtl8168_mac_ocp_write(tp, 0xF8C2, 0x0C28);
3440
+        rtl8168_mac_ocp_write(tp, 0xF8C4, 0x0C2C);
3441
+        rtl8168_mac_ocp_write(tp, 0xF8C6, 0xDC00);
3442
+        rtl8168_mac_ocp_write(tp, 0xF8C8, 0xC707);
3443
+        rtl8168_mac_ocp_write(tp, 0xF8CA, 0x1D00);
3444
+        rtl8168_mac_ocp_write(tp, 0xF8CC, 0x8DE2);
3445
+        rtl8168_mac_ocp_write(tp, 0xF8CE, 0x48C1);
3446
+        rtl8168_mac_ocp_write(tp, 0xF8D0, 0xC502);
3447
+        rtl8168_mac_ocp_write(tp, 0xF8D2, 0xBD00);
3448
+        rtl8168_mac_ocp_write(tp, 0xF8D4, 0x00AA);
3449
+        rtl8168_mac_ocp_write(tp, 0xF8D6, 0xE0C0);
3450
+        rtl8168_mac_ocp_write(tp, 0xF8D8, 0xC502);
3451
+        rtl8168_mac_ocp_write(tp, 0xF8DA, 0xBD00);
3452
+        rtl8168_mac_ocp_write(tp, 0xF8DC, 0x0132);
3453
+
3454
+        rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3455
+
3456
+        rtl8168_mac_ocp_write(tp, 0xFC2A, 0x0743);
3457
+        rtl8168_mac_ocp_write(tp, 0xFC2C, 0x0801);
3458
+        rtl8168_mac_ocp_write(tp, 0xFC2E, 0x0BE9);
3459
+        rtl8168_mac_ocp_write(tp, 0xFC30, 0x02FD);
3460
+        rtl8168_mac_ocp_write(tp, 0xFC32, 0x0C25);
3461
+        rtl8168_mac_ocp_write(tp, 0xFC34, 0x00A9);
3462
+        rtl8168_mac_ocp_write(tp, 0xFC36, 0x012D);
3463
 }
3464
 
3465
 static void
3466
@@ -9838,9 +9985,8 @@
3467
 
3468
         rtl8168_hw_disable_mac_mcu_bps(dev);
3469
 
3470
-        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168ep_1); i++) {
3471
+        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168ep_1); i++)
3472
                 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168ep_1i);
3473
-        }
3474
 
3475
         rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3476
 
3477
@@ -9881,9 +10027,8 @@
3478
 
3479
         rtl8168_hw_disable_mac_mcu_bps(dev);
3480
 
3481
-        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168ep_2); i++) {
3482
+        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168ep_2); i++)
3483
                 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168ep_2i);
3484
-        }
3485
 
3486
         rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3487
 
3488
@@ -9924,9 +10069,8 @@
3489
 
3490
         rtl8168_hw_disable_mac_mcu_bps(dev);
3491
 
3492
-        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168h_1); i++) {
3493
+        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168h_1); i++)
3494
                 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168h_1i);
3495
-        }
3496
 
3497
         rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3498
 
3499
@@ -10008,9 +10152,8 @@
3500
 
3501
         rtl8168_hw_disable_mac_mcu_bps(dev);
3502
 
3503
-        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168h_3); i++) {
3504
+        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168h_3); i++)
3505
                 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168h_3i);
3506
-        }
3507
 
3508
         rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3509
 
3510
@@ -10074,9 +10217,8 @@
3511
                         0x4830, 0x4837, 0xC502, 0xBD00, 0x0A86
3512
                 };
3513
 
3514
-                for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_1_1); i++) {
3515
+                for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_1_1); i++)
3516
                         rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_1_1i);
3517
-                }
3518
 
3519
                 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3520
 
3521
@@ -10135,9 +10277,8 @@
3522
                         0x0000
3523
                 };
3524
 
3525
-                for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_1_2); i++) {
3526
+                for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_1_2); i++)
3527
                         rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_1_2i);
3528
-                }
3529
 
3530
                 rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3531
 
3532
@@ -10176,9 +10317,8 @@
3533
 
3534
         rtl8168_hw_disable_mac_mcu_bps(dev);
3535
 
3536
-        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_8116as_2); i++) {
3537
+        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_8116as_2); i++)
3538
                 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_8116as_2i);
3539
-        }
3540
 
3541
         rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3542
 
3543
@@ -10212,9 +10352,8 @@
3544
 
3545
         rtl8168_hw_disable_mac_mcu_bps(dev);
3546
 
3547
-        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_2); i++) {
3548
+        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_2); i++)
3549
                 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_2i);
3550
-        }
3551
 
3552
         rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3553
 
3554
@@ -10263,9 +10402,8 @@
3555
 
3556
         rtl8168_hw_disable_mac_mcu_bps(dev);
3557
 
3558
-        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_3); i++) {
3559
+        for (i = 0; i < ARRAY_SIZE(mcu_patch_code_8168fp_3); i++)
3560
                 rtl8168_mac_ocp_write(tp, 0xF800 + i * 2, mcu_patch_code_8168fp_3i);
3561
-        }
3562
 
3563
         rtl8168_mac_ocp_write(tp, 0xFC26, 0x8000);
3564
 
3565
@@ -10342,7 +10480,7 @@
3566
         }
3567
 }
3568
 
3569
-void rtl8168_apply_firmware(struct rtl8168_private *tp)
3570
+static void rtl8168_apply_firmware(struct rtl8168_private *tp)
3571
 {
3572
         /* TODO: release firmware if rtl_fw_write_firmware signals failure. */
3573
         if (tp->rtl_fw) {
3574
@@ -10378,7 +10516,7 @@
3575
 
3576
         //Disable UPS
3577
         if (HW_SUPPORT_UPS_MODE(tp))
3578
-                rtl8168_mac_ocp_write(tp, 0xD400, rtl8168_mac_ocp_read( tp, 0xD400) & ~(BIT_0));
3579
+                rtl8168_mac_ocp_write(tp, 0xD400, rtl8168_mac_ocp_read(tp, 0xD400) & ~(BIT_0));
3580
 
3581
         //Disable DMA Aggregation
3582
         switch (tp->mcfg) {
3583
@@ -10391,9 +10529,9 @@
3584
         case CFG_METHOD_35:
3585
         case CFG_METHOD_36:
3586
         case CFG_METHOD_37:
3587
-                rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read( tp, 0xE63E) & ~(BIT_3 | BIT_2 | BIT_1));
3588
-                rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read( tp, 0xE63E) | (BIT_0));
3589
-                rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read( tp, 0xE63E) & ~(BIT_0));
3590
+                rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read(tp, 0xE63E) & ~(BIT_3 | BIT_2 | BIT_1));
3591
+                rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read(tp, 0xE63E) | (BIT_0));
3592
+                rtl8168_mac_ocp_write(tp, 0xE63E, rtl8168_mac_ocp_read(tp, 0xE63E) & ~(BIT_0));
3593
                 rtl8168_mac_ocp_write(tp, 0xC094, 0x0);
3594
                 rtl8168_mac_ocp_write(tp, 0xC09E, 0x0);
3595
                 break;
3596
@@ -10447,7 +10585,7 @@
3597
         case CFG_METHOD_23:
3598
         case CFG_METHOD_24:
3599
                 csi_tmp = rtl8168_eri_read(tp, 0x1AB, 1, ERIAR_ExGMAC);
3600
-                csi_tmp |= ( BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7 );
3601
+                csi_tmp |= (BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7);
3602
                 rtl8168_eri_write(tp, 0x1AB, 1, csi_tmp, ERIAR_ExGMAC);
3603
                 break;
3604
         }
3605
@@ -10501,8 +10639,7 @@
3606
                 ClearAndSetPCIePhyBit(tp,
3607
                                       0x03,
3608
                                       BIT_10,
3609
-                                      BIT_5
3610
-                                     );
3611
+                                      BIT_5);
3612
 
3613
                 break;
3614
         case CFG_METHOD_9:
3615
@@ -10513,14 +10650,12 @@
3616
                         ClearAndSetPCIePhyBit(tp,
3617
                                               0x03,
3618
                                               0xFFB0,
3619
-                                              0x05B0
3620
-                                             );
3621
+                                              0x05B0);
3622
                 } else {
3623
                         ClearAndSetPCIePhyBit(tp,
3624
                                               0x03,
3625
                                               0xFFF0,
3626
-                                              0x05F0
3627
-                                             );
3628
+                                              0x05F0);
3629
                 }
3630
                 rtl8168_ephy_write(tp, 0x06, 0xB271);
3631
                 rtl8168_ephy_write(tp, 0x07, 0xCE00);
3632
@@ -10533,8 +10668,7 @@
3633
                 ClearAndSetPCIePhyBit(tp,
3634
                                       0x03,
3635
                                       0xFFF0,
3636
-                                      0x01B0
3637
-                                     );
3638
+                                      0x01B0);
3639
                 rtl8168_ephy_write(tp, 0x1A, 0x0546);
3640
                 rtl8168_ephy_write(tp, 0x1C, 0x80C4);
3641
                 rtl8168_ephy_write(tp, 0x1D, 0x78E5);
3642
@@ -10733,11 +10867,10 @@
3643
                 break;
3644
         case CFG_METHOD_26:
3645
                 ClearPCIePhyBit(tp, 0x00, BIT_3);
3646
-                ClearAndSetPCIePhyBit( tp,
3647
-                                       0x0C,
3648
-                                       (BIT_13 | BIT_12 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_4),
3649
-                                       (BIT_5 | BIT_11)
3650
-                                     );
3651
+                ClearAndSetPCIePhyBit(tp,
3652
+                                      0x0C,
3653
+                                      (BIT_13 | BIT_12 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_4),
3654
+                                      (BIT_5 | BIT_11));
3655
                 SetPCIePhyBit(tp, 0x1E, BIT_0);
3656
                 ClearPCIePhyBit(tp, 0x19, BIT_15);
3657
 
3658
@@ -10781,8 +10914,7 @@
3659
                 ClearAndSetPCIePhyBit(tp,
3660
                                       0x0C,
3661
                                       BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_8 | BIT_7 | BIT_6 | BIT_5,
3662
-                                      BIT_9 | BIT_4
3663
-                                     );
3664
+                                      BIT_9 | BIT_4);
3665
 
3666
                 break;
3667
         case CFG_METHOD_29:
3668
@@ -10807,13 +10939,11 @@
3669
                 ClearAndSetPCIePhyBit(tp,
3670
                                       0x19,
3671
                                       BIT_6,
3672
-                                      (BIT_12| BIT_8)
3673
-                                     );
3674
+                                      (BIT_12| BIT_8));
3675
                 ClearAndSetPCIePhyBit(tp,
3676
                                       0x59,
3677
                                       BIT_6,
3678
-                                      (BIT_12| BIT_8)
3679
-                                     );
3680
+                                      (BIT_12| BIT_8));
3681
 
3682
                 ClearPCIePhyBit(tp, 0x0C, BIT_4);
3683
                 ClearPCIePhyBit(tp, 0x4C, BIT_4);
3684
@@ -11001,7 +11131,7 @@
3685
 
3686
         tp->hw_ram_code_ver = rtl8168_get_hw_phy_mcu_code_ver(tp);
3687
 
3688
-        if ( tp->hw_ram_code_ver == tp->sw_ram_code_ver) {
3689
+        if (tp->hw_ram_code_ver == tp->sw_ram_code_ver) {
3690
                 ram_code_ver_match = 1;
3691
                 tp->HwHasWrRamCodeToMicroP = TRUE;
3692
         }
3693
@@ -24904,8 +25034,7 @@
3694
                 ClearAndSetEthPhyBit(tp,
3695
                                      0x11,
3696
                                      BIT_13,
3697
-                                     BIT_14
3698
-                                    );
3699
+                                     BIT_14);
3700
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3701
 
3702
                 if (aspm) {
3703
@@ -25089,124 +25218,110 @@
3704
         } else if (tp->mcfg == CFG_METHOD_29) {
3705
                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3706
                 rtl8168_mdio_write(tp, 0x13, 0x809b);
3707
-                ClearAndSetEthPhyBit( tp,
3708
-                                      0x14,
3709
-                                      0xF800 ,
3710
-                                      0x8000
3711
-                                    );
3712
+                ClearAndSetEthPhyBit(tp,
3713
+                                     0x14,
3714
+                                     0xF800 ,
3715
+                                     0x8000);
3716
                 rtl8168_mdio_write(tp, 0x13, 0x80A2);
3717
-                ClearAndSetEthPhyBit( tp,
3718
-                                      0x14,
3719
-                                      0xFF00 ,
3720
-                                      0x8000
3721
-                                    );
3722
+                ClearAndSetEthPhyBit(tp,
3723
+                                     0x14,
3724
+                                     0xFF00 ,
3725
+                                     0x8000);
3726
                 rtl8168_mdio_write(tp, 0x13, 0x80A4);
3727
-                ClearAndSetEthPhyBit( tp,
3728
-                                      0x14,
3729
-                                      0xFF00 ,
3730
-                                      0x8500
3731
-                                    );
3732
+                ClearAndSetEthPhyBit(tp,
3733
+                                     0x14,
3734
+                                     0xFF00 ,
3735
+                                     0x8500);
3736
                 rtl8168_mdio_write(tp, 0x13, 0x809C);
3737
-                ClearAndSetEthPhyBit( tp,
3738
-                                      0x14,
3739
-                                      0xFF00 ,
3740
-                                      0xbd00
3741
-                                    );
3742
+                ClearAndSetEthPhyBit(tp,
3743
+                                     0x14,
3744
+                                     0xFF00 ,
3745
+                                     0xbd00);
3746
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3747
 
3748
                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3749
                 rtl8168_mdio_write(tp, 0x13, 0x80AD);
3750
-                ClearAndSetEthPhyBit( tp,
3751
-                                      0x14,
3752
-                                      0xF800 ,
3753
-                                      0x7000
3754
-                                    );
3755
+                ClearAndSetEthPhyBit(tp,
3756
+                                     0x14,
3757
+                                     0xF800 ,
3758
+                                     0x7000);
3759
                 rtl8168_mdio_write(tp, 0x13, 0x80B4);
3760
-                ClearAndSetEthPhyBit( tp,
3761
-                                      0x14,
3762
-                                      0xFF00 ,
3763
-                                      0x5000
3764
-                                    );
3765
+                ClearAndSetEthPhyBit(tp,
3766
+                                     0x14,
3767
+                                     0xFF00 ,
3768
+                                     0x5000);
3769
                 rtl8168_mdio_write(tp, 0x13, 0x80AC);
3770
-                ClearAndSetEthPhyBit( tp,
3771
-                                      0x14,
3772
-                                      0xFF00 ,
3773
-                                      0x4000
3774
-                                    );
3775
+                ClearAndSetEthPhyBit(tp,
3776
+                                     0x14,
3777
+                                     0xFF00 ,
3778
+                                     0x4000);
3779
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3780
 
3781
                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3782
                 rtl8168_mdio_write(tp, 0x13, 0x808E);
3783
-                ClearAndSetEthPhyBit( tp,
3784
-                                      0x14,
3785
-                                      0xFF00 ,
3786
-                                      0x1200
3787
-                                    );
3788
+                ClearAndSetEthPhyBit(tp,
3789
+                                     0x14,
3790
+                                     0xFF00 ,
3791
+                                     0x1200);
3792
                 rtl8168_mdio_write(tp, 0x13, 0x8090);
3793
-                ClearAndSetEthPhyBit( tp,
3794
-                                      0x14,
3795
-                                      0xFF00 ,
3796
-                                      0xE500
3797
-                                    );
3798
+                ClearAndSetEthPhyBit(tp,
3799
+                                     0x14,
3800
+                                     0xFF00 ,
3801
+                                     0xE500);
3802
                 rtl8168_mdio_write(tp, 0x13, 0x8092);
3803
-                ClearAndSetEthPhyBit( tp,
3804
-                                      0x14,
3805
-                                      0xFF00 ,
3806
-                                      0x9F00
3807
-                                    );
3808
+                ClearAndSetEthPhyBit(tp,
3809
+                                     0x14,
3810
+                                     0xFF00 ,
3811
+                                     0x9F00);
3812
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3813
 
3814
                 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
3815
                         u16 dout_tapbin;
3816
 
3817
                         dout_tapbin = 0x0000;
3818
-                        rtl8168_mdio_write( tp, 0x1F, 0x0A46 );
3819
-                        gphy_val = rtl8168_mdio_read( tp, 0x13 );
3820
+                        rtl8168_mdio_write(tp, 0x1F, 0x0A46);
3821
+                        gphy_val = rtl8168_mdio_read(tp, 0x13);
3822
                         gphy_val &= (BIT_1|BIT_0);
3823
                         gphy_val <<= 2;
3824
                         dout_tapbin |= gphy_val;
3825
 
3826
-                        gphy_val = rtl8168_mdio_read( tp, 0x12 );
3827
+                        gphy_val = rtl8168_mdio_read(tp, 0x12);
3828
                         gphy_val &= (BIT_15|BIT_14);
3829
                         gphy_val >>= 14;
3830
                         dout_tapbin |= gphy_val;
3831
 
3832
-                        dout_tapbin = ~( dout_tapbin^BIT_3 );
3833
+                        dout_tapbin = ~(dout_tapbin^BIT_3);
3834
                         dout_tapbin <<= 12;
3835
                         dout_tapbin &= 0xF000;
3836
 
3837
-                        rtl8168_mdio_write( tp, 0x1F, 0x0A43 );
3838
+                        rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3839
 
3840
-                        rtl8168_mdio_write( tp, 0x13, 0x827A );
3841
-                        ClearAndSetEthPhyBit( tp,
3842
-                                              0x14,
3843
-                                              BIT_15|BIT_14|BIT_13|BIT_12,
3844
-                                              dout_tapbin
3845
-                                            );
3846
-
3847
-
3848
-                        rtl8168_mdio_write( tp, 0x13, 0x827B );
3849
-                        ClearAndSetEthPhyBit( tp,
3850
-                                              0x14,
3851
-                                              BIT_15|BIT_14|BIT_13|BIT_12,
3852
-                                              dout_tapbin
3853
-                                            );
3854
-
3855
-
3856
-                        rtl8168_mdio_write( tp, 0x13, 0x827C );
3857
-                        ClearAndSetEthPhyBit( tp,
3858
-                                              0x14,
3859
-                                              BIT_15|BIT_14|BIT_13|BIT_12,
3860
-                                              dout_tapbin
3861
-                                            );
3862
-
3863
-
3864
-                        rtl8168_mdio_write( tp, 0x13, 0x827D );
3865
-                        ClearAndSetEthPhyBit( tp,
3866
-                                              0x14,
3867
-                                              BIT_15|BIT_14|BIT_13|BIT_12,
3868
-                                              dout_tapbin
3869
-                                            );
3870
+                        rtl8168_mdio_write(tp, 0x13, 0x827A);
3871
+                        ClearAndSetEthPhyBit(tp,
3872
+                                             0x14,
3873
+                                             BIT_15|BIT_14|BIT_13|BIT_12,
3874
+                                             dout_tapbin);
3875
+
3876
+
3877
+                        rtl8168_mdio_write(tp, 0x13, 0x827B);
3878
+                        ClearAndSetEthPhyBit(tp,
3879
+                                             0x14,
3880
+                                             BIT_15|BIT_14|BIT_13|BIT_12,
3881
+                                             dout_tapbin);
3882
+
3883
+
3884
+                        rtl8168_mdio_write(tp, 0x13, 0x827C);
3885
+                        ClearAndSetEthPhyBit(tp,
3886
+                                             0x14,
3887
+                                             BIT_15|BIT_14|BIT_13|BIT_12,
3888
+                                             dout_tapbin);
3889
+
3890
+
3891
+                        rtl8168_mdio_write(tp, 0x13, 0x827D);
3892
+                        ClearAndSetEthPhyBit(tp,
3893
+                                             0x14,
3894
+                                             BIT_15|BIT_14|BIT_13|BIT_12,
3895
+                                             dout_tapbin);
3896
 
3897
                         rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3898
                         rtl8168_mdio_write(tp, 0x13, 0x8011);
3899
@@ -25216,49 +25331,48 @@
3900
                 }
3901
 
3902
                 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
3903
-                rtl8168_set_eth_phy_bit( tp, 0x11, BIT_11 );
3904
+                rtl8168_set_eth_phy_bit(tp, 0x11, BIT_11);
3905
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3906
 
3907
 
3908
                 rtl8168_mdio_write(tp, 0x1F, 0x0BCA);
3909
-                ClearAndSetEthPhyBit( tp,
3910
-                                      0x17,
3911
-                                      (BIT_13 | BIT_12) ,
3912
-                                      BIT_14
3913
-                                    );
3914
+                ClearAndSetEthPhyBit(tp,
3915
+                                     0x17,
3916
+                                     (BIT_13 | BIT_12) ,
3917
+                                     BIT_14);
3918
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3919
 
3920
                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3921
                 rtl8168_mdio_write(tp, 0x13, 0x803F);
3922
-                rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
3923
+                rtl8168_clear_eth_phy_bit(tp, 0x14, (BIT_13 | BIT_12));
3924
                 rtl8168_mdio_write(tp, 0x13, 0x8047);
3925
-                rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
3926
+                rtl8168_clear_eth_phy_bit(tp, 0x14, (BIT_13 | BIT_12));
3927
                 rtl8168_mdio_write(tp, 0x13, 0x804F);
3928
-                rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
3929
+                rtl8168_clear_eth_phy_bit(tp, 0x14, (BIT_13 | BIT_12));
3930
                 rtl8168_mdio_write(tp, 0x13, 0x8057);
3931
-                rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
3932
+                rtl8168_clear_eth_phy_bit(tp, 0x14, (BIT_13 | BIT_12));
3933
                 rtl8168_mdio_write(tp, 0x13, 0x805F);
3934
-                rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
3935
-                rtl8168_mdio_write(tp, 0x13, 0x8067 );
3936
-                rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
3937
-                rtl8168_mdio_write(tp, 0x13, 0x806F );
3938
-                rtl8168_clear_eth_phy_bit( tp, 0x14, (BIT_13 | BIT_12));
3939
+                rtl8168_clear_eth_phy_bit(tp, 0x14, (BIT_13 | BIT_12));
3940
+                rtl8168_mdio_write(tp, 0x13, 0x8067);
3941
+                rtl8168_clear_eth_phy_bit(tp, 0x14, (BIT_13 | BIT_12));
3942
+                rtl8168_mdio_write(tp, 0x13, 0x806F);
3943
+                rtl8168_clear_eth_phy_bit(tp, 0x14, (BIT_13 | BIT_12));
3944
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3945
 
3946
                 if (aspm) {
3947
                         if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
3948
                                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3949
-                                rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
3950
+                                rtl8168_set_eth_phy_bit(tp, 0x10, BIT_2);
3951
                                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3952
                         }
3953
                 }
3954
         } else if (tp->mcfg == CFG_METHOD_30 || tp->mcfg == CFG_METHOD_37) {
3955
                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3956
                 rtl8168_mdio_write(tp, 0x13, 0x808A);
3957
-                ClearAndSetEthPhyBit( tp,
3958
-                                      0x14,
3959
-                                      BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0,
3960
-                                      0x0A );
3961
+                ClearAndSetEthPhyBit(tp,
3962
+                                     0x14,
3963
+                                     BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0,
3964
+                                     0x0A);
3965
 
3966
                 if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
3967
                         rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3968
@@ -25269,7 +25383,7 @@
3969
                 }
3970
 
3971
                 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
3972
-                rtl8168_set_eth_phy_bit( tp, 0x11, BIT_11 );
3973
+                rtl8168_set_eth_phy_bit(tp, 0x11, BIT_11);
3974
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3975
 
3976
                 if (tp->RequireAdcBiasPatch) {
3977
@@ -25282,10 +25396,10 @@
3978
                         u16 rlen;
3979
 
3980
                         rtl8168_mdio_write(tp, 0x1F, 0x0BCD);
3981
-                        gphy_val = rtl8168_mdio_read( tp, 0x16 );
3982
+                        gphy_val = rtl8168_mdio_read(tp, 0x16);
3983
                         gphy_val &= 0x000F;
3984
 
3985
-                        if ( gphy_val > 3 ) {
3986
+                        if (gphy_val > 3) {
3987
                                 rlen = gphy_val - 3;
3988
                         } else {
3989
                                 rlen = 0;
3990
@@ -25334,7 +25448,7 @@
3991
                 if (aspm) {
3992
                         if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
3993
                                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
3994
-                                rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
3995
+                                rtl8168_set_eth_phy_bit(tp, 0x10, BIT_2);
3996
                                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
3997
                         }
3998
                 }
3999
@@ -25342,133 +25456,112 @@
4000
                    tp->mcfg == CFG_METHOD_33 ||  tp->mcfg == CFG_METHOD_34) {
4001
                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
4002
                 rtl8168_mdio_write(tp, 0x13, 0x808E);
4003
-                ClearAndSetEthPhyBit( tp,
4004
-                                      0x14,
4005
-                                      0xFF00 ,
4006
-                                      0x4800
4007
-                                    );
4008
+                ClearAndSetEthPhyBit(tp,
4009
+                                     0x14,
4010
+                                     0xFF00 ,
4011
+                                     0x4800);
4012
                 rtl8168_mdio_write(tp, 0x13, 0x8090);
4013
-                ClearAndSetEthPhyBit( tp,
4014
-                                      0x14,
4015
-                                      0xFF00 ,
4016
-                                      0xCC00
4017
-                                    );
4018
+                ClearAndSetEthPhyBit(tp,
4019
+                                     0x14,
4020
+                                     0xFF00 ,
4021
+                                     0xCC00);
4022
                 rtl8168_mdio_write(tp, 0x13, 0x8092);
4023
-                ClearAndSetEthPhyBit( tp,
4024
-                                      0x14,
4025
-                                      0xFF00 ,
4026
-                                      0xB000
4027
-                                    );
4028
+                ClearAndSetEthPhyBit(tp,
4029
+                                     0x14,
4030
+                                     0xFF00 ,
4031
+                                     0xB000);
4032
                 rtl8168_mdio_write(tp, 0x13, 0x8088);
4033
-                ClearAndSetEthPhyBit( tp,
4034
-                                      0x14,
4035
-                                      0xFF00 ,
4036
-                                      0x6000
4037
-                                    );
4038
+                ClearAndSetEthPhyBit(tp,
4039
+                                     0x14,
4040
+                                     0xFF00 ,
4041
+                                     0x6000);
4042
                 rtl8168_mdio_write(tp, 0x13, 0x808B);
4043
-                ClearAndSetEthPhyBit( tp,
4044
-                                      0x14,
4045
-                                      0x3F00 ,
4046
-                                      0x0B00
4047
-                                    );
4048
+                ClearAndSetEthPhyBit(tp,
4049
+                                     0x14,
4050
+                                     0x3F00 ,
4051
+                                     0x0B00);
4052
                 rtl8168_mdio_write(tp, 0x13, 0x808D);
4053
-                ClearAndSetEthPhyBit( tp,
4054
-                                      0x14,
4055
-                                      0x1F00 ,
4056
-                                      0x0600
4057
-                                    );
4058
+                ClearAndSetEthPhyBit(tp,
4059
+                                     0x14,
4060
+                                     0x1F00 ,
4061
+                                     0x0600);
4062
                 rtl8168_mdio_write(tp, 0x13, 0x808C);
4063
-                ClearAndSetEthPhyBit( tp,
4064
-                                      0x14,
4065
-                                      0xFF00 ,
4066
-                                      0xB000
4067
-                                    );
4068
+                ClearAndSetEthPhyBit(tp,
4069
+                                     0x14,
4070
+                                     0xFF00 ,
4071
+                                     0xB000);
4072
 
4073
                 rtl8168_mdio_write(tp, 0x13, 0x80A0);
4074
-                ClearAndSetEthPhyBit( tp,
4075
-                                      0x14,
4076
-                                      0xFF00 ,
4077
-                                      0x2800
4078
-                                    );
4079
+                ClearAndSetEthPhyBit(tp,
4080
+                                     0x14,
4081
+                                     0xFF00 ,
4082
+                                     0x2800);
4083
                 rtl8168_mdio_write(tp, 0x13, 0x80A2);
4084
-                ClearAndSetEthPhyBit( tp,
4085
-                                      0x14,
4086
-                                      0xFF00 ,
4087
-                                      0x5000
4088
-                                    );
4089
+                ClearAndSetEthPhyBit(tp,
4090
+                                     0x14,
4091
+                                     0xFF00 ,
4092
+                                     0x5000);
4093
                 rtl8168_mdio_write(tp, 0x13, 0x809B);
4094
-                ClearAndSetEthPhyBit( tp,
4095
-                                      0x14,
4096
-                                      0xF800 ,
4097
-                                      0xB000
4098
-                                    );
4099
+                ClearAndSetEthPhyBit(tp,
4100
+                                     0x14,
4101
+                                     0xF800 ,
4102
+                                     0xB000);
4103
                 rtl8168_mdio_write(tp, 0x13, 0x809A);
4104
-                ClearAndSetEthPhyBit( tp,
4105
-                                      0x14,
4106
-                                      0xFF00 ,
4107
-                                      0x4B00
4108
-                                    );
4109
+                ClearAndSetEthPhyBit(tp,
4110
+                                     0x14,
4111
+                                     0xFF00 ,
4112
+                                     0x4B00);
4113
                 rtl8168_mdio_write(tp, 0x13, 0x809D);
4114
-                ClearAndSetEthPhyBit( tp,
4115
-                                      0x14,
4116
-                                      0x3F00 ,
4117
-                                      0x0800
4118
-                                    );
4119
+                ClearAndSetEthPhyBit(tp,
4120
+                                     0x14,
4121
+                                     0x3F00 ,
4122
+                                     0x0800);
4123
                 rtl8168_mdio_write(tp, 0x13, 0x80A1);
4124
-                ClearAndSetEthPhyBit( tp,
4125
-                                      0x14,
4126
-                                      0xFF00 ,
4127
-                                      0x7000
4128
-                                    );
4129
+                ClearAndSetEthPhyBit(tp,
4130
+                                     0x14,
4131
+                                     0xFF00 ,
4132
+                                     0x7000);
4133
                 rtl8168_mdio_write(tp, 0x13, 0x809F);
4134
-                ClearAndSetEthPhyBit( tp,
4135
-                                      0x14,
4136
-                                      0x1F00 ,
4137
-                                      0x0300
4138
-                                    );
4139
+                ClearAndSetEthPhyBit(tp,
4140
+                                     0x14,
4141
+                                     0x1F00 ,
4142
+                                     0x0300);
4143
                 rtl8168_mdio_write(tp, 0x13, 0x809E);
4144
-                ClearAndSetEthPhyBit( tp,
4145
-                                      0x14,
4146
-                                      0xFF00 ,
4147
-                                      0x8800
4148
-                                    );
4149
+                ClearAndSetEthPhyBit(tp,
4150
+                                     0x14,
4151
+                                     0xFF00 ,
4152
+                                     0x8800);
4153
 
4154
                 rtl8168_mdio_write(tp, 0x13, 0x80B2);
4155
-                ClearAndSetEthPhyBit( tp,
4156
-                                      0x14,
4157
-                                      0xFF00 ,
4158
-                                      0x2200
4159
-                                    );
4160
+                ClearAndSetEthPhyBit(tp,
4161
+                                     0x14,
4162
+                                     0xFF00 ,
4163
+                                     0x2200);
4164
                 rtl8168_mdio_write(tp, 0x13, 0x80AD);
4165
-                ClearAndSetEthPhyBit( tp,
4166
-                                      0x14,
4167
-                                      0xF800 ,
4168
-                                      0x9800
4169
-                                    );
4170
+                ClearAndSetEthPhyBit(tp,
4171
+                                     0x14,
4172
+                                     0xF800 ,
4173
+                                     0x9800);
4174
                 rtl8168_mdio_write(tp, 0x13, 0x80AF);
4175
-                ClearAndSetEthPhyBit( tp,
4176
-                                      0x14,
4177
-                                      0x3F00 ,
4178
-                                      0x0800
4179
-                                    );
4180
+                ClearAndSetEthPhyBit(tp,
4181
+                                     0x14,
4182
+                                     0x3F00 ,
4183
+                                     0x0800);
4184
                 rtl8168_mdio_write(tp, 0x13, 0x80B3);
4185
-                ClearAndSetEthPhyBit( tp,
4186
-                                      0x14,
4187
-                                      0xFF00 ,
4188
-                                      0x6F00
4189
-                                    );
4190
+                ClearAndSetEthPhyBit(tp,
4191
+                                     0x14,
4192
+                                     0xFF00 ,
4193
+                                     0x6F00);
4194
                 rtl8168_mdio_write(tp, 0x13, 0x80B1);
4195
-                ClearAndSetEthPhyBit( tp,
4196
-                                      0x14,
4197
-                                      0x1F00 ,
4198
-                                      0x0300
4199
-                                    );
4200
+                ClearAndSetEthPhyBit(tp,
4201
+                                     0x14,
4202
+                                     0x1F00 ,
4203
+                                     0x0300);
4204
                 rtl8168_mdio_write(tp, 0x13, 0x80B0);
4205
-                ClearAndSetEthPhyBit( tp,
4206
-                                      0x14,
4207
-                                      0xFF00 ,
4208
-                                      0x9300
4209
-                                    );
4210
+                ClearAndSetEthPhyBit(tp,
4211
+                                     0x14,
4212
+                                     0xFF00 ,
4213
+                                     0x9300);
4214
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4215
 
4216
                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
4217
@@ -25489,7 +25582,7 @@
4218
                         if (!HW_SUPP_SERDES_PHY(tp) &&
4219
                             HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
4220
                                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
4221
-                                rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
4222
+                                rtl8168_set_eth_phy_bit(tp, 0x10, BIT_2);
4223
                                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4224
                         }
4225
                 }
4226
@@ -25612,7 +25705,7 @@
4227
                 if (aspm) {
4228
                         if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
4229
                                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
4230
-                                rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
4231
+                                rtl8168_set_eth_phy_bit(tp, 0x10, BIT_2);
4232
                                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4233
                         }
4234
                 }
4235
@@ -25630,7 +25723,7 @@
4236
                 if (aspm) {
4237
                         if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) {
4238
                                 rtl8168_mdio_write(tp, 0x1F, 0x0A43);
4239
-                                rtl8168_set_eth_phy_bit( tp, 0x10, BIT_2 );
4240
+                                rtl8168_set_eth_phy_bit(tp, 0x10, BIT_2);
4241
                                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4242
                         }
4243
                 }
4244
@@ -25662,7 +25755,7 @@
4245
                    tp->mcfg == CFG_METHOD_35 || tp->mcfg == CFG_METHOD_36) {
4246
                 //enable EthPhyPPSW
4247
                 rtl8168_mdio_write(tp, 0x1F, 0x0A44);
4248
-                rtl8168_set_eth_phy_bit( tp, 0x11, BIT_7 );
4249
+                rtl8168_set_eth_phy_bit(tp, 0x11, BIT_7);
4250
                 rtl8168_mdio_write(tp, 0x1F, 0x0000);
4251
         }
4252
 
4253
@@ -26095,11 +26188,11 @@
4254
 #ifdef ENABLE_DASH_SUPPORT
4255
         if (tp->DASH) {
4256
                 if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
4257
-                        tp->timer_intr_mask |= ( ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
4258
-                        tp->intr_mask |= ( ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
4259
+                        tp->timer_intr_mask |= (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
4260
+                        tp->intr_mask |= (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
4261
                 } else {
4262
-                        tp->timer_intr_mask |= ( ISRIMR_DP_DASH_OK | ISRIMR_DP_HOST_OK | ISRIMR_DP_REQSYS_OK );
4263
-                        tp->intr_mask |= ( ISRIMR_DP_DASH_OK | ISRIMR_DP_HOST_OK | ISRIMR_DP_REQSYS_OK );
4264
+                        tp->timer_intr_mask |= (ISRIMR_DP_DASH_OK | ISRIMR_DP_HOST_OK | ISRIMR_DP_REQSYS_OK);
4265
+                        tp->intr_mask |= (ISRIMR_DP_DASH_OK | ISRIMR_DP_HOST_OK | ISRIMR_DP_REQSYS_OK);
4266
                 }
4267
         }
4268
 #endif
4269
@@ -26215,18 +26308,18 @@
4270
                 u16 ioffset_p3, ioffset_p2, ioffset_p1, ioffset_p0;
4271
                 u16 TmpUshort;
4272
 
4273
-                rtl8168_mac_ocp_write( tp, 0xDD02, 0x807D);
4274
-                TmpUshort = rtl8168_mac_ocp_read( tp, 0xDD02 );
4275
-                ioffset_p3 = ( (TmpUshort & BIT_7) >>7 );
4276
+                rtl8168_mac_ocp_write(tp, 0xDD02, 0x807D);
4277
+                TmpUshort = rtl8168_mac_ocp_read(tp, 0xDD02);
4278
+                ioffset_p3 = ((TmpUshort & BIT_7) >>7);
4279
                 ioffset_p3 <<= 3;
4280
-                TmpUshort = rtl8168_mac_ocp_read( tp, 0xDD00 );
4281
+                TmpUshort = rtl8168_mac_ocp_read(tp, 0xDD00);
4282
 
4283
                 ioffset_p3 |= ((TmpUshort & (BIT_15 | BIT_14 | BIT_13))>>13);
4284
 
4285
                 ioffset_p2 = ((TmpUshort & (BIT_12|BIT_11|BIT_10|BIT_9))>>9);
4286
                 ioffset_p1 = ((TmpUshort & (BIT_8|BIT_7|BIT_6|BIT_5))>>5);
4287
 
4288
-                ioffset_p0 = ( (TmpUshort & BIT_4) >>4 );
4289
+                ioffset_p0 = ((TmpUshort & BIT_4) >>4);
4290
                 ioffset_p0 <<= 3;
4291
                 ioffset_p0 |= (TmpUshort & (BIT_2| BIT_1 | BIT_0));
4292
 
4293
@@ -27661,7 +27754,7 @@
4294
         case CFG_METHOD_23:
4295
         case CFG_METHOD_24:
4296
                 csi_tmp = rtl8168_eri_read(tp, 0x1AB, 1, ERIAR_ExGMAC);
4297
-                csi_tmp &= ~( BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7 );
4298
+                csi_tmp &= ~(BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7);
4299
                 rtl8168_eri_write(tp, 0x1AB, 1, csi_tmp, ERIAR_ExGMAC);
4300
                 break;
4301
         }
4302
@@ -28084,7 +28177,8 @@
4303
 }
4304
 */
4305
 
4306
-int rtl8168_enable_msix(struct rtl8168_private *tp)
4307
+#ifndef ENABLE_RSS_SUPPORT
4308
+static int rtl8168_enable_msix(struct rtl8168_private *tp)
4309
 {
4310
         int i, nvecs = 0;
4311
         struct msix_entry msix_entR8168_MAX_MSIX_VEC;
4312
@@ -28111,6 +28205,7 @@
4313
 out:
4314
         return nvecs;
4315
 }
4316
+#endif /* !ENABLE_RSS_SUPPORT */
4317
 
4318
 /* Cfg9346_Unlock assumed. */
4319
 static int rtl8168_try_msi(struct rtl8168_private *tp)
4320
@@ -28534,6 +28629,8 @@
4321
 
4322
         netif_carrier_off(dev);
4323
 
4324
+        rtl8168_sysfs_init(dev);
4325
+
4326
         printk("%s", GPL_CLAIM);
4327
 
4328
 out:
4329
@@ -28576,6 +28673,10 @@
4330
         if (HW_DASH_SUPPORT_DASH(tp))
4331
                 rtl8168_driver_stop(tp);
4332
 
4333
+#ifdef ENABLE_R8168_SYSFS
4334
+        rtl8168_sysfs_remove(dev);
4335
+#endif //ENABLE_R8168_SYSFS
4336
+
4337
         unregister_netdev(dev);
4338
         rtl8168_disable_msi(pdev, tp);
4339
 #ifdef ENABLE_R8168_PROCFS
4340
@@ -28894,31 +28995,25 @@
4341
 {
4342
         struct rtl8168_private *tp = netdev_priv(dev);
4343
 
4344
+        if (!(tp->mcfg == CFG_METHOD_5) || (tp->mcfg == CFG_METHOD_6))
4345
+                return;
4346
+
4347
         switch (dev_state) {
4348
         case DSM_MAC_INIT:
4349
-                if ((tp->mcfg == CFG_METHOD_5) || (tp->mcfg == CFG_METHOD_6)) {
4350
-                        if (RTL_R8(tp, MACDBG) & 0x80)
4351
-                                RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) | GPIO_en);
4352
-                        else
4353
-                                RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) & ~GPIO_en);
4354
-                }
4355
-
4356
+                if (RTL_R8(tp, MACDBG) & 0x80)
4357
+                        RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) | GPIO_en);
4358
+                else
4359
+                        RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) & ~GPIO_en);
4360
                 break;
4361
         case DSM_NIC_GOTO_D3:
4362
         case DSM_IF_DOWN:
4363
-                if ((tp->mcfg == CFG_METHOD_5) || (tp->mcfg == CFG_METHOD_6)) {
4364
-                        if (RTL_R8(tp, MACDBG) & 0x80)
4365
-                                RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) & ~GPIO_en);
4366
-                }
4367
+                if (RTL_R8(tp, MACDBG) & 0x80)
4368
+                        RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) & ~GPIO_en);
4369
                 break;
4370
-
4371
         case DSM_NIC_RESUME_D3:
4372
         case DSM_IF_UP:
4373
-                if ((tp->mcfg == CFG_METHOD_5) || (tp->mcfg == CFG_METHOD_6)) {
4374
-                        if (RTL_R8(tp, MACDBG) & 0x80)
4375
-                                RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) | GPIO_en);
4376
-                }
4377
-
4378
+                if (RTL_R8(tp, MACDBG) & 0x80)
4379
+                        RTL_W8(tp, GPIO, RTL_R8(tp, GPIO) | GPIO_en);
4380
                 break;
4381
         }
4382
 }
4383
@@ -28984,9 +29079,8 @@
4384
                         AcceptBroadcast | AcceptMulticast | AcceptMyPhys |
4385
                         AcceptAllPhys;
4386
                 mc_filter1 = mc_filter0 = 0xffffffff;
4387
-        } else if ((netdev_mc_count(dev) > multicast_filter_limit)
4388
-                   || (dev->flags & IFF_ALLMULTI)) {
4389
-                /* Too many to filter perfectly -- accept all multicasts. */
4390
+        } else if (dev->flags & IFF_ALLMULTI) {
4391
+                /* accept all multicasts. */
4392
                 rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
4393
                 mc_filter1 = mc_filter0 = 0xffffffff;
4394
         } else {
4395
@@ -30523,9 +30617,18 @@
4396
 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
4397
 }
4398
 
4399
+void rtl8168_schedule_dash_work(struct rtl8168_private *tp)
4400
+{
4401
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
4402
+        set_bit(R8168_FLAG_TASK_DASH_CHECK_PENDING, tp->task_flags);
4403
+        schedule_delayed_work(&tp->dash_task, RTL8168_DASH_TIMEOUT);
4404
+#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
4405
+}
4406
+
4407
 #define rtl8168_cancel_schedule_reset_work(a)
4408
 #define rtl8168_cancel_schedule_esd_work(a)
4409
 #define rtl8168_cancel_schedule_linkchg_work(a)
4410
+#define rtl8168_cancel_schedule_dash_work(a)
4411
 
4412
 #else
4413
 static void rtl8168_schedule_reset_work(struct rtl8168_private *tp)
4414
@@ -30538,7 +30641,8 @@
4415
 {
4416
         struct work_struct *work = &tp->reset_task.work;
4417
 
4418
-        if (!work->func) return;
4419
+        if (!work->func)
4420
+                return;
4421
 
4422
         cancel_delayed_work_sync(&tp->reset_task);
4423
 }
4424
@@ -30553,7 +30657,8 @@
4425
 {
4426
         struct work_struct *work = &tp->esd_task.work;
4427
 
4428
-        if (!work->func) return;
4429
+        if (!work->func)
4430
+                return;
4431
 
4432
         cancel_delayed_work_sync(&tp->esd_task);
4433
 }
4434
@@ -30568,10 +30673,27 @@
4435
 {
4436
         struct work_struct *work = &tp->linkchg_task.work;
4437
 
4438
-        if (!work->func) return;
4439
+        if (!work->func)
4440
+                return;
4441
 
4442
         cancel_delayed_work_sync(&tp->linkchg_task);
4443
 }
4444
+
4445
+void rtl8168_schedule_dash_work(struct rtl8168_private *tp)
4446
+{
4447
+        set_bit(R8168_FLAG_TASK_DASH_CHECK_PENDING, tp->task_flags);
4448
+        schedule_delayed_work(&tp->dash_task, RTL8168_DASH_TIMEOUT);
4449
+}
4450
+
4451
+static void rtl8168_cancel_schedule_dash_work(struct rtl8168_private *tp)
4452
+{
4453
+        struct work_struct *work = &tp->dash_task.work;
4454
+
4455
+        if (!work->func)
4456
+                return;
4457
+
4458
+        cancel_delayed_work_sync(&tp->dash_task);
4459
+}
4460
 #endif
4461
 
4462
 static void rtl8168_init_all_schedule_work(struct rtl8168_private *tp)
4463
@@ -30580,10 +30702,12 @@
4464
         INIT_WORK(&tp->reset_task, rtl8168_reset_task, dev);
4465
         INIT_WORK(&tp->esd_task, rtl8168_esd_task, dev);
4466
         INIT_WORK(&tp->linkchg_task, rtl8168_linkchg_task, dev);
4467
+        INIT_WORK(&tp->dash_task, rtl8168_dash_task, dev);
4468
 #else
4469
         INIT_DELAYED_WORK(&tp->reset_task, rtl8168_reset_task);
4470
         INIT_DELAYED_WORK(&tp->esd_task, rtl8168_esd_task);
4471
         INIT_DELAYED_WORK(&tp->linkchg_task, rtl8168_linkchg_task);
4472
+        INIT_DELAYED_WORK(&tp->dash_task, rtl8168_dash_task);
4473
 #endif
4474
 }
4475
 
4476
@@ -30592,6 +30716,7 @@
4477
         rtl8168_cancel_schedule_reset_work(tp);
4478
         rtl8168_cancel_schedule_esd_work(tp);
4479
         rtl8168_cancel_schedule_linkchg_work(tp);
4480
+        rtl8168_cancel_schedule_dash_work(tp);
4481
 }
4482
 
4483
 static void
4484
@@ -30640,14 +30765,6 @@
4485
 #endif //CONFIG_R8168_NAPI
4486
 }
4487
 
4488
-static int rtl8168_rx_nostuck(struct rtl8168_private *tp)
4489
-{
4490
-        int i, ret = 1;
4491
-        for (i = 0; i < tp->num_rx_rings; i++)
4492
-                ret &= (tp->rx_ringi.dirty_rx == tp->rx_ringi.cur_rx);
4493
-        return ret;
4494
-}
4495
-
4496
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
4497
 static void rtl8168_reset_task(void *_data)
4498
 {
4499
@@ -30660,7 +30777,6 @@
4500
                 container_of(work, struct rtl8168_private, reset_task.work);
4501
         struct net_device *dev = tp->dev;
4502
 #endif
4503
-        u32 budget = ~(u32)0;
4504
         int i;
4505
 
4506
         rtnl_lock();
4507
@@ -30670,37 +30786,26 @@
4508
             !test_and_clear_bit(R8168_FLAG_TASK_RESET_PENDING, tp->task_flags))
4509
                 goto out_unlock;
4510
 
4511
-        rtl8168_wait_for_quiescence(dev);
4512
-
4513
-        for (i = 0; i < tp->num_rx_rings; i++) {
4514
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
4515
-                rtl8168_rx_interrupt(dev, tp, &tp->rx_ringi, &budget);
4516
-#else
4517
-                rtl8168_rx_interrupt(dev, tp, &tp->rx_ringi, budget);
4518
-#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
4519
-        }
4520
+        netdev_err(dev, "Device reseting!\n");
4521
 
4522
         netif_carrier_off(dev);
4523
         netif_tx_disable(dev);
4524
+        _rtl8168_wait_for_quiescence(dev);
4525
         rtl8168_hw_reset(dev);
4526
 
4527
         rtl8168_tx_clear(tp);
4528
 
4529
-        if (rtl8168_rx_nostuck(tp)) {
4530
-                rtl8168_rx_clear(tp);
4531
-                rtl8168_init_ring(dev);
4532
-                rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
4533
-        } else {
4534
-                if (unlikely(net_ratelimit())) {
4535
-                        struct rtl8168_private *tp = netdev_priv(dev);
4536
+        rtl8168_init_ring_indexes(tp);
4537
 
4538
-                        if (netif_msg_intr(tp)) {
4539
-                                printk(PFX KERN_EMERG
4540
-                                       "%s: Rx buffers shortage\n", dev->name);
4541
-                        }
4542
-                }
4543
-                rtl8168_schedule_reset_work(tp);
4544
-        }
4545
+        rtl8168_tx_desc_init(tp);
4546
+        for (i = 0; i < tp->num_rx_desc; i++)
4547
+                rtl8168_mark_to_asic(tp->RxDescArray + i, tp->rx_buf_sz);
4548
+
4549
+#ifdef CONFIG_R8168_NAPI
4550
+        rtl8168_enable_napi(tp);
4551
+#endif //CONFIG_R8168_NAPI
4552
+
4553
+        rtl8168_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising);
4554
 
4555
 out_unlock:
4556
         rtnl_unlock();
4557
@@ -30760,6 +30865,33 @@
4558
         rtnl_unlock();
4559
 }
4560
 
4561
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
4562
+static void rtl8168_dash_task(void *_data)
4563
+{
4564
+        struct net_device *dev = _data;
4565
+        //struct rtl8168_private *tp = netdev_priv(dev);
4566
+#else
4567
+static void rtl8168_dash_task(struct work_struct *work)
4568
+{
4569
+        struct rtl8168_private *tp =
4570
+                container_of(work, struct rtl8168_private, dash_task.work);
4571
+        struct net_device *dev = tp->dev;
4572
+#endif
4573
+        rtnl_lock();
4574
+
4575
+        if (!netif_running(dev) ||
4576
+            test_bit(R8168_FLAG_DOWN, tp->task_flags) ||
4577
+            !test_and_clear_bit(R8168_FLAG_TASK_DASH_CHECK_PENDING, tp->task_flags))
4578
+                goto out_unlock;
4579
+
4580
+#ifdef ENABLE_DASH_SUPPORT
4581
+        HandleDashInterrupt(dev);
4582
+#endif
4583
+
4584
+out_unlock:
4585
+        rtnl_unlock();
4586
+}
4587
+
4588
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
4589
 static void
4590
 rtl8168_tx_timeout(struct net_device *dev, unsigned int txqueue)
4591
@@ -30770,6 +30902,8 @@
4592
 {
4593
         struct rtl8168_private *tp = netdev_priv(dev);
4594
 
4595
+        netdev_err(dev, "Transmit timeout reset Device!\n");
4596
+
4597
         /* Let's wait a bit while any (async) irq lands on */
4598
         rtl8168_schedule_reset_work(tp);
4599
 }
4600
@@ -30827,10 +30961,8 @@
4601
 
4602
                 /* anti gcc 2.95.3 bugware (sic) */
4603
                 status = rtl8168_get_txd_opts1(ring, opts0, len, entry);
4604
-                if (cur_frag == (nr_frags - 1)) {
4605
-                        ring->tx_skbentry.skb = skb;
4606
+                if (cur_frag == (nr_frags - 1))
4607
                         status |= LastFrag;
4608
-                }
4609
 
4610
                 txd->addr = cpu_to_le64(mapping);
4611
 
4612
@@ -30967,45 +31099,6 @@
4613
 }
4614
 
4615
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
4616
-/* r8169_csum_workaround()
4617
- * The hw limits the value the transport offset. When the offset is out of the
4618
- * range, calculate the checksum by sw.
4619
- */
4620
-static void r8168_csum_workaround(struct rtl8168_private *tp,
4621
-                                  struct sk_buff *skb)
4622
-{
4623
-        if (skb_shinfo(skb)->gso_size) {
4624
-                netdev_features_t features = tp->dev->features;
4625
-                struct sk_buff *segs, *nskb;
4626
-
4627
-                features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
4628
-                segs = skb_gso_segment(skb, features);
4629
-                if (IS_ERR(segs) || !segs)
4630
-                        goto drop;
4631
-
4632
-                do {
4633
-                        nskb = segs;
4634
-                        segs = segs->next;
4635
-                        nskb->next = NULL;
4636
-                        rtl8168_start_xmit(nskb, tp->dev);
4637
-                } while (segs);
4638
-
4639
-                dev_consume_skb_any(skb);
4640
-        } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
4641
-                if (skb_checksum_help(skb) < 0)
4642
-                        goto drop;
4643
-
4644
-                rtl8168_start_xmit(skb, tp->dev);
4645
-        } else {
4646
-                struct net_device_stats *stats;
4647
-
4648
-drop:
4649
-                stats = &tp->dev->stats;
4650
-                stats->tx_dropped++;
4651
-                dev_kfree_skb_any(skb);
4652
-        }
4653
-}
4654
-
4655
 /* msdn_giant_send_check()
4656
  * According to the document of microsoft, the TCP Pseudo Header excludes the
4657
  * packet length for IPv6 TCP large packets.
4658
@@ -31045,6 +31138,10 @@
4659
                    struct net_device *dev)
4660
 {
4661
         struct rtl8168_private *tp = netdev_priv(dev);
4662
+        unsigned int   bytecount;
4663
+        unsigned short gso_segs;
4664
+        struct ring_info *last;
4665
+        unsigned int last_entry;
4666
         unsigned int entry;
4667
         struct TxDesc *txd;
4668
         dma_addr_t mapping;
4669
@@ -31082,6 +31179,9 @@
4670
                 goto err_stop;
4671
         }
4672
 
4673
+        bytecount = skb->len;
4674
+        gso_segs = 1;
4675
+
4676
         opts0 = DescOwn;
4677
         opts1 = rtl8168_tx_vlan_tag(tp, skb);
4678
 
4679
@@ -31096,6 +31196,23 @@
4680
 
4681
                 /* TCP Segmentation Offload (or TCP Large Send) */
4682
                 if (mss) {
4683
+                        union {
4684
+                                struct iphdr *v4;
4685
+                                struct ipv6hdr *v6;
4686
+                                unsigned char *hdr;
4687
+                        } ip;
4688
+                        union {
4689
+                                struct tcphdr *tcp;
4690
+                                struct udphdr *udp;
4691
+                                unsigned char *hdr;
4692
+                        } l4;
4693
+                        u32 l4_offset, hdr_len;
4694
+
4695
+                        ip.hdr = skb_network_header(skb);
4696
+                        l4.hdr = skb_checksum_start(skb);
4697
+
4698
+                        l4_offset = skb_transport_offset(skb);
4699
+                        assert((l4_offset%2) == 0);
4700
                         if ((tp->mcfg == CFG_METHOD_1) ||
4701
                             (tp->mcfg == CFG_METHOD_2) ||
4702
                             (tp->mcfg == CFG_METHOD_3)) {
4703
@@ -31104,23 +31221,21 @@
4704
                         } else {
4705
                                 switch (get_protocol(skb)) {
4706
                                 case __constant_htons(ETH_P_IP):
4707
-                                        if (skb_transport_offset(skb) <= GTTCPHO_MAX) {
4708
+                                        if (l4_offset <= GTTCPHO_MAX) {
4709
                                                 opts0 |= GiantSendv4;
4710
-                                                opts0 |= skb_transport_offset(skb) << GTTCPHO_SHIFT;
4711
+                                                opts0 |= l4_offset << GTTCPHO_SHIFT;
4712
                                                 opts1 |= min(mss, MSS_MAX) << 18;
4713
                                                 large_send = 1;
4714
                                         }
4715
                                         break;
4716
                                 case __constant_htons(ETH_P_IPV6):
4717
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
4718
-                                        if (msdn_giant_send_check(skb)) {
4719
-                                                r8168_csum_workaround(tp, skb);
4720
-                                                goto out;
4721
-                                        }
4722
+                                        if (msdn_giant_send_check(skb))
4723
+                                                goto err_dma_0;
4724
 #endif
4725
-                                        if (skb_transport_offset(skb) <= GTTCPHO_MAX) {
4726
+                                        if (l4_offset <= GTTCPHO_MAX) {
4727
                                                 opts0 |= GiantSendv6;
4728
-                                                opts0 |= skb_transport_offset(skb) << GTTCPHO_SHIFT;
4729
+                                                opts0 |= l4_offset << GTTCPHO_SHIFT;
4730
                                                 opts1 |= min(mss, MSS_MAX) << 18;
4731
                                                 large_send = 1;
4732
                                         }
4733
@@ -31134,6 +31249,12 @@
4734
 
4735
                         if (large_send == 0)
4736
                                 goto err_dma_0;
4737
+
4738
+                        /* compute length of segmentation header */
4739
+                        hdr_len = (l4.tcp->doff * 4) + l4_offset;
4740
+                        /* update gso size and bytecount with header size */
4741
+                        gso_segs = skb_shinfo(skb)->gso_segs;
4742
+                        bytecount += (gso_segs - 1) * hdr_len;
4743
                 }
4744
         }
4745
 #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
4746
@@ -31151,9 +31272,6 @@
4747
                 opts0 |= FirstFrag;
4748
         } else {
4749
                 len = skb->len;
4750
-
4751
-                ring->tx_skbentry.skb = skb;
4752
-
4753
                 opts0 |= FirstFrag | LastFrag;
4754
         }
4755
 
4756
@@ -31164,12 +31282,23 @@
4757
                         netif_err(tp, drv, dev, "Failed to map TX DMA!\n");
4758
                 goto err_dma_1;
4759
         }
4760
+        /* set first fragment's length */
4761
         ring->tx_skbentry.len = len;
4762
+
4763
+        /* set skb to last fragment */
4764
+        last_entry = (entry + frags) % ring->num_tx_desc;
4765
+        last = &ring->tx_skblast_entry;
4766
+        last->skb = skb;
4767
+        last->gso_segs = gso_segs;
4768
+        last->bytecount = bytecount;
4769
+
4770
         txd->addr = cpu_to_le64(mapping);
4771
         txd->opts2 = cpu_to_le32(opts1);
4772
         wmb();
4773
         txd->opts1 = cpu_to_le32(opts0);
4774
 
4775
+        netdev_tx_sent_queue(txring_txq(ring), bytecount);
4776
+
4777
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
4778
         dev->trans_start = jiffies;
4779
 #else
4780
@@ -31190,7 +31319,8 @@
4781
                 netif_stop_subqueue(dev, queue_mapping);
4782
         }
4783
 
4784
-        rtl8168_doorbell(ring);    /* set polling bit */
4785
+        if (netif_xmit_stopped(txring_txq(ring)) || !netdev_xmit_more())
4786
+                rtl8168_doorbell(ring);    /* set polling bit */
4787
 
4788
         if (unlikely(stop_queue)) {
4789
                 /* Sync with rtl_tx:
4790
@@ -31208,7 +31338,6 @@
4791
 out:
4792
         return ret;
4793
 err_dma_1:
4794
-        ring->tx_skbentry.skb = NULL;
4795
         rtl8168_tx_clear_range(tp, ring, ring->cur_tx + 1, frags);
4796
 err_dma_0:
4797
         RTLDEV->stats.tx_dropped++;
4798
@@ -31223,8 +31352,9 @@
4799
 }
4800
 
4801
 static void
4802
-rtl8168_tx_interrupt(struct rtl8168_tx_ring *ring)
4803
+rtl8168_tx_interrupt(struct rtl8168_tx_ring *ring, int budget)
4804
 {
4805
+        unsigned int total_bytes = 0, total_packets = 0;
4806
         struct rtl8168_private *tp = ring->priv;
4807
         struct net_device *dev = tp->dev;
4808
         unsigned int dirty_tx, tx_left;
4809
@@ -31246,7 +31376,6 @@
4810
         while (tx_left > 0) {
4811
                 unsigned int entry = dirty_tx % ring->num_tx_desc;
4812
                 struct ring_info *tx_skb = ring->tx_skb + entry;
4813
-                u32 len = tx_skb->len;
4814
                 u32 status;
4815
 
4816
                 rmb();
4817
@@ -31254,25 +31383,30 @@
4818
                 if (status & DescOwn)
4819
                         break;
4820
 
4821
-                RTLDEV->stats.tx_bytes += len;
4822
-                RTLDEV->stats.tx_packets++;
4823
-
4824
                 rtl8168_unmap_tx_skb(tp->pci_dev,
4825
                                      tx_skb,
4826
                                      ring->TxDescArray + entry);
4827
 
4828
-                if (tx_skb->skb!=NULL) {
4829
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
4830
-                        dev_consume_skb_any(tx_skb->skb);
4831
-#else
4832
-                        dev_kfree_skb_any(tx_skb->skb);
4833
-#endif
4834
+                if (tx_skb->skb != NULL) {
4835
+                        /* update the statistics for this packet */
4836
+                        total_bytes += tx_skb->bytecount;
4837
+                        total_packets += tx_skb->gso_segs;
4838
+
4839
+                        RTL_NAPI_CONSUME_SKB_ANY(tx_skb->skb, budget);
4840
                         tx_skb->skb = NULL;
4841
                 }
4842
                 dirty_tx++;
4843
                 tx_left--;
4844
         }
4845
 
4846
+        if (total_packets) {
4847
+                netdev_tx_completed_queue(txring_txq(ring),
4848
+                                          total_packets, total_bytes);
4849
+
4850
+                RTLDEV->stats.tx_bytes += total_bytes;
4851
+                RTLDEV->stats.tx_packets += total_packets;
4852
+        }
4853
+
4854
         tp->dynamic_aspm_packet_count -= tx_left;
4855
 
4856
         if (ring->dirty_tx != dirty_tx) {
4857
@@ -31289,12 +31423,12 @@
4858
 }
4859
 
4860
 static void
4861
-rtl8168_tx_all_interrupt(struct rtl8168_private *tp)
4862
+rtl8168_tx_all_interrupt(struct rtl8168_private *tp, int budget)
4863
 {
4864
         int i;
4865
 
4866
         for (i = 0; i < rtl8168_tot_tx_rings(tp); i++)
4867
-                rtl8168_tx_interrupt(&tp->tx_ringi);
4868
+                rtl8168_tx_interrupt(&tp->tx_ringi, budget);
4869
 }
4870
 
4871
 static inline int
4872
@@ -31406,7 +31540,7 @@
4873
                 goto rx_out;
4874
 
4875
 #ifdef ENABLE_LIB_SUPPORT
4876
-        if (ring->index > 0) {
4877
+        if (tp->num_rx_rings == 0 && ring->index == 0) {
4878
                 rtl8168_lib_rx_interrupt(tp);
4879
                 goto rx_out;
4880
         }
4881
@@ -31595,37 +31729,8 @@
4882
                 }
4883
 
4884
 #ifdef ENABLE_DASH_SUPPORT
4885
-                if ( tp->DASH ) {
4886
-                        if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
4887
-                                u8 DashIntType2Status;
4888
-
4889
-                                if (status & ISRIMR_DASH_INTR_CMAC_RESET)
4890
-                                        tp->CmacResetIntr = TRUE;
4891
-
4892
-                                DashIntType2Status = RTL_CMAC_R8(tp, CMAC_IBISR0);
4893
-                                if (DashIntType2Status & ISRIMR_DASH_TYPE2_ROK) {
4894
-                                        tp->RcvFwDashOkEvt = TRUE;
4895
-                                }
4896
-                                if (DashIntType2Status & ISRIMR_DASH_TYPE2_TOK) {
4897
-                                        tp->SendFwHostOkEvt = TRUE;
4898
-                                }
4899
-                                if (DashIntType2Status & ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE) {
4900
-                                        tp->DashFwDisableRx = TRUE;
4901
-                                }
4902
-
4903
-                                RTL_CMAC_W8(tp, CMAC_IBISR0, DashIntType2Status);
4904
-                        } else {
4905
-                                if (status & ISRIMR_DP_REQSYS_OK) {
4906
-                                        tp->RcvFwReqSysOkEvt = TRUE;
4907
-                                }
4908
-                                if (status & ISRIMR_DP_DASH_OK) {
4909
-                                        tp->RcvFwDashOkEvt = TRUE;
4910
-                                }
4911
-                                if (status & ISRIMR_DP_HOST_OK) {
4912
-                                        tp->SendFwHostOkEvt = TRUE;
4913
-                                }
4914
-                        }
4915
-                }
4916
+                if (CheckDashInterrupt(dev, status))
4917
+                        rtl8168_schedule_dash_work(tp);
4918
 #endif
4919
 
4920
 #ifdef CONFIG_R8168_NAPI
4921
@@ -31658,7 +31763,7 @@
4922
                             (other_q_status & other_q_intr_mask))
4923
                                 tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT;
4924
 
4925
-                        rtl8168_tx_all_interrupt(tp);
4926
+                        rtl8168_tx_all_interrupt(tp, budget);
4927
 
4928
                         for (i = 0; i < max_rx_queue; i++) {
4929
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
4930
@@ -31668,14 +31773,6 @@
4931
 #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
4932
                         }
4933
 
4934
-#ifdef ENABLE_DASH_SUPPORT
4935
-                        if ( tp->DASH ) {
4936
-                                struct net_device *dev = tp->dev;
4937
-
4938
-                                HandleDashInterrupt(dev);
4939
-                        }
4940
-#endif
4941
-
4942
                         rtl8168_switch_to_timer_interrupt(tp);
4943
                 } else {
4944
                         tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT;
4945
@@ -31712,9 +31809,15 @@
4946
                  * Skip its interrupt here or its queue will be initialized
4947
                  * incorrectly.
4948
                  */
4949
-                if (message_id >= tp->num_rx_rings)
4950
+                if (message_id >= tp->num_hw_tot_en_rx_rings)
4951
                         break;
4952
 
4953
+#ifdef ENABLE_DASH_SUPPORT
4954
+                if (message_id == 0 &&
4955
+                    CheckDashInterrupt(dev, rtl8168_get_isr_by_vector(tp, 0)))
4956
+                        rtl8168_schedule_dash_work(tp);
4957
+#endif
4958
+
4959
 #ifdef CONFIG_R8168_NAPI
4960
                 if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &r8168napi->napi))) {
4961
                         rtl8168_disable_interrupt_by_vector(tp, message_id);
4962
@@ -31724,10 +31827,14 @@
4963
                                dev->name, message_id);
4964
                 rtl8168_self_clear_isr_by_vector(tp, message_id);
4965
 #else
4966
+                rtl8168_disable_interrupt_by_vector(tp, message_id);
4967
+
4968
+                rtl8168_self_clear_isr_by_vector(tp, message_id);
4969
+
4970
                 if (message_id == 0)
4971
-                        rtl8168_tx_all_interrupt(tp);
4972
+                        rtl8168_tx_all_interrupt(tp, budget);
4973
 
4974
-                if (message_id < tp->num_rx_rings) {
4975
+                if (message_id < tp->num_hw_tot_en_rx_rings) {
4976
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
4977
                         rtl8168_rx_interrupt(dev, tp, &tp->rx_ringmessage_id, &budget);
4978
 #else
4979
@@ -31755,10 +31862,10 @@
4980
         int i;
4981
 
4982
         if (message_id == 0)
4983
-                rtl8168_tx_all_interrupt(tp);
4984
+                rtl8168_tx_all_interrupt(tp, budget);
4985
 
4986
         if (all_rx_q)
4987
-                for (i = 0; i < tp->num_rx_rings; i++)
4988
+                for (i = 0; i < tp->num_hw_tot_en_rx_rings; i++)
4989
                         work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ringi, budget);
4990
         else
4991
                 work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ringmessage_id, budget);
4992
@@ -31766,16 +31873,6 @@
4993
         RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget);
4994
 
4995
         if (work_done < work_to_do) {
4996
-#ifdef ENABLE_DASH_SUPPORT
4997
-                if (message_id == 0) {
4998
-                        if ( tp->DASH ) {
4999
-                                struct net_device *dev = tp->dev;
5000
-
5001
-                                HandleDashInterrupt(dev);
5002
-                        }
5003
-                }
5004
-#endif
5005
-
5006
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
5007
                 if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE)
5008
                         return RTL_NAPI_RETURN_VALUE;
5009
@@ -31874,8 +31971,6 @@
5010
 
5011
         _rtl8168_wait_for_quiescence(dev);
5012
 
5013
-        rtl8168_dsm(dev, DSM_IF_DOWN);
5014
-
5015
         rtl8168_hw_reset(dev);
5016
 
5017
         rtl8168_tx_clear(tp);
5018
@@ -31888,7 +31983,8 @@
5019
         int i;
5020
 
5021
         for (i = 0; i < tp->num_tx_rings; i++)
5022
-                if (tp->tx_ringi.TxDescArray) return 0;
5023
+                if (tp->tx_ringi.TxDescArray)
5024
+                        return 0;
5025
 
5026
         if (tp->RxDescArray)
5027
                 return 0;
5028
@@ -31922,6 +32018,8 @@
5029
                 rtl8168_powerdown_pll(dev);
5030
         }
5031
 
5032
+        rtl8168_dsm(dev, DSM_IF_DOWN);
5033
+
5034
         return 0;
5035
 }
5036
 
5037
@@ -32090,9 +32188,8 @@
5038
         rtl8168_rar_set(tp, dev->dev_addr);
5039
 
5040
         if (!netif_running(dev)) {
5041
-                if (HW_DASH_SUPPORT_DASH(tp)) {
5042
+                if (HW_DASH_SUPPORT_DASH(tp))
5043
                         rtl8168_driver_start(tp);
5044
-                }
5045
                 goto out_unlock;
5046
         }
5047
 
5048
r8168-8.052.01.tar.gz/src/r8168_realwow.h -> r8168-8.053.00.tar.gz/src/r8168_realwow.h Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/r8168_rss.c -> r8168-8.053.00.tar.gz/src/r8168_rss.c Changed
152
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
@@ -57,13 +57,13 @@
11
         switch (cmd->flow_type) {
12
         case TCP_V4_FLOW:
13
                 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
14
-        /* fallthrough */
15
+                fallthrough;
16
         case IPV4_FLOW:
17
                 cmd->data |= RXH_IP_SRC | RXH_IP_DST;
18
                 break;
19
         case TCP_V6_FLOW:
20
                 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
21
-        /* fallthrough */
22
+                fallthrough;
23
         case IPV6_FLOW:
24
                 cmd->data |= RXH_IP_SRC | RXH_IP_DST;
25
                 break;
26
@@ -258,28 +258,6 @@
27
                 indiri = tp->rss_indir_tbli;
28
 }
29
 
30
-int rtl8168_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
31
-                     u8 *hfunc)
32
-{
33
-        struct rtl8168_private *tp = netdev_priv(dev);
34
-
35
-        netif_info(tp, drv, tp->dev, "rss get rxfh\n");
36
-
37
-        if (!(dev->features & NETIF_F_RXHASH))
38
-                return -EOPNOTSUPP;
39
-
40
-        if (hfunc)
41
-                *hfunc = ETH_RSS_HASH_TOP;
42
-
43
-        if (indir)
44
-                rtl8168_get_reta(tp, indir);
45
-
46
-        if (key)
47
-                memcpy(key, tp->rss_key, RTL8168_RSS_KEY_SIZE);
48
-
49
-        return 0;
50
-}
51
-
52
 static u32 rtl8168_rss_key_reg(struct rtl8168_private *tp)
53
 {
54
         return RSS_KEY_8168;
55
@@ -330,6 +308,88 @@
56
                 rtl8168_eri_write(tp, rss_key_reg + i, 4, *rss_key++, ERIAR_ExGMAC);
57
 }
58
 
59
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
60
+int rtl8168_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh)
61
+{
62
+        struct rtl8168_private *tp = netdev_priv(dev);
63
+
64
+        netif_info(tp, drv, tp->dev, "rss get rxfh\n");
65
+
66
+        if (!(dev->features & NETIF_F_RXHASH))
67
+                return -EOPNOTSUPP;
68
+
69
+        rxfh->hfunc = ETH_RSS_HASH_TOP;
70
+
71
+        if (rxfh->indir)
72
+                rtl8168_get_reta(tp, rxfh->indir);
73
+
74
+        if (rxfh->key)
75
+                memcpy(rxfh->key, tp->rss_key, RTL8168_RSS_KEY_SIZE);
76
+
77
+        return 0;
78
+}
79
+
80
+int rtl8168_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
81
+                     struct netlink_ext_ack *extack)
82
+{
83
+        struct rtl8168_private *tp = netdev_priv(dev);
84
+        u32 reta_entries = rtl8168_rss_indir_tbl_entries(tp);
85
+        int i;
86
+
87
+        netif_info(tp, drv, tp->dev, "rss set rxfh\n");
88
+
89
+        /* We require at least one supported parameter to be changed and no
90
+         * change in any of the unsupported parameters
91
+         */
92
+        if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc != ETH_RSS_HASH_TOP)
93
+                return -EOPNOTSUPP;
94
+
95
+        /* Fill out the redirection table */
96
+        if (rxfh->indir) {
97
+                int max_queues = tp->num_rx_rings;
98
+
99
+                /* Verify user input. */
100
+                for (i = 0; i < reta_entries; i++)
101
+                        if (rxfh->indiri >= max_queues)
102
+                                return -EINVAL;
103
+
104
+                for (i = 0; i < reta_entries; i++)
105
+                        tp->rss_indir_tbli = rxfh->indiri;
106
+        }
107
+
108
+        /* Fill out the rss hash key */
109
+        if (rxfh->key)
110
+                memcpy(tp->rss_key, rxfh->key, RTL8168_RSS_KEY_SIZE);
111
+
112
+        rtl8168_store_reta(tp);
113
+
114
+        rtl8168_store_rss_key(tp);
115
+
116
+        return 0;
117
+}
118
+#else
119
+int rtl8168_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
120
+                     u8 *hfunc)
121
+{
122
+        struct rtl8168_private *tp = netdev_priv(dev);
123
+
124
+        netif_info(tp, drv, tp->dev, "rss get rxfh\n");
125
+
126
+        if (!(dev->features & NETIF_F_RXHASH))
127
+                return -EOPNOTSUPP;
128
+
129
+        if (hfunc)
130
+                *hfunc = ETH_RSS_HASH_TOP;
131
+
132
+        if (indir)
133
+                rtl8168_get_reta(tp, indir);
134
+
135
+        if (key)
136
+                memcpy(key, tp->rss_key, RTL8168_RSS_KEY_SIZE);
137
+
138
+        return 0;
139
+}
140
+
141
 int rtl8168_set_rxfh(struct net_device *dev, const u32 *indir,
142
                      const u8 *key, const u8 hfunc)
143
 {
144
@@ -368,6 +428,7 @@
145
 
146
         return 0;
147
 }
148
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */
149
 
150
 static u32 rtl8168_get_rx_desc_hash(struct rtl8168_private *tp,
151
                                     struct RxDescV2 *desc)
152
r8168-8.052.01.tar.gz/src/r8168_rss.h -> r8168-8.053.00.tar.gz/src/r8168_rss.h Changed
27
 
1
@@ -5,7 +5,7 @@
2
 # r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
@@ -50,10 +50,16 @@
11
 int rtl8168_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd);
12
 u32 rtl8168_get_rxfh_key_size(struct net_device *netdev);
13
 u32 rtl8168_rss_indir_size(struct net_device *netdev);
14
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
15
+int rtl8168_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh);
16
+int rtl8168_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
17
+                     struct netlink_ext_ack *extack);
18
+#else
19
 int rtl8168_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
20
                      u8 *hfunc);
21
 int rtl8168_set_rxfh(struct net_device *netdev, const u32 *indir,
22
                      const u8 *key, const u8 hfunc);
23
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */
24
 void rtl8168_rx_hash(struct rtl8168_private *tp,
25
                      struct RxDescV2 *desc,
26
                      struct sk_buff *skb);
27
r8168-8.052.01.tar.gz/src/rtl_eeprom.c -> r8168-8.053.00.tar.gz/src/rtl_eeprom.c Changed
51
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
@@ -93,7 +93,7 @@
11
         rtl8168_lower_clock(tp, &x);
12
 }
13
 
14
-int rtl8168_eeprom_cmd_done(struct rtl8168_private *tp)
15
+static int rtl8168_eeprom_cmd_done(struct rtl8168_private *tp)
16
 {
17
         u8 x;
18
         int i;
19
@@ -157,9 +157,8 @@
20
         int addr_sz = 6;
21
         int w_dummy_addr = 4;
22
 
23
-        if(tp->eeprom_type == EEPROM_TYPE_NONE) {
24
-                return ;
25
-        }
26
+        if(tp->eeprom_type == EEPROM_TYPE_NONE)
27
+                return;
28
 
29
         if (tp->eeprom_type==EEPROM_TYPE_93C46) {
30
                 addr_sz = 6;
31
@@ -178,17 +177,15 @@
32
 
33
         rtl8168_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3);
34
         rtl8168_shift_out_bits(tp, reg, addr_sz);
35
-        if (rtl8168_eeprom_cmd_done(tp) < 0) {
36
+        if (rtl8168_eeprom_cmd_done(tp) < 0)
37
                 return;
38
-        }
39
         rtl8168_stand_by(tp);
40
 
41
         rtl8168_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3);
42
         rtl8168_shift_out_bits(tp, reg, addr_sz);
43
         rtl8168_shift_out_bits(tp, data, 16);
44
-        if (rtl8168_eeprom_cmd_done(tp) < 0) {
45
+        if (rtl8168_eeprom_cmd_done(tp) < 0)
46
                 return;
47
-        }
48
         rtl8168_stand_by(tp);
49
 
50
         rtl8168_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5);
51
r8168-8.052.01.tar.gz/src/rtl_eeprom.h -> r8168-8.053.00.tar.gz/src/rtl_eeprom.h Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/rtltool.c -> r8168-8.053.00.tar.gz/src/rtltool.c Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
r8168-8.052.01.tar.gz/src/rtltool.h -> r8168-8.053.00.tar.gz/src/rtltool.h Changed
10
 
1
@@ -5,7 +5,7 @@
2
 # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
3
 # controllers with PCI-Express interface.
4
 #
5
-# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved.
6
+# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
7
 #
8
 # This program is free software; you can redistribute it and/or modify it
9
 # under the terms of the GNU General Public License as published by the Free
10
Refresh
============================ rpmlint session starts ============================
rpmlint: 2.6.1
configuration:
/opt/testing/lib64/python3.13/rpmlint/configdefaults.toml
/opt/testing/share/rpmlint/cron-whitelist.toml
/opt/testing/share/rpmlint/dbus-services.toml
/opt/testing/share/rpmlint/device-files-whitelist.toml
/opt/testing/share/rpmlint/licenses.toml
/opt/testing/share/rpmlint/opensuse.toml
/opt/testing/share/rpmlint/pam-modules.toml
/opt/testing/share/rpmlint/permissions-whitelist.toml
/opt/testing/share/rpmlint/pie-executables.toml
/opt/testing/share/rpmlint/polkit-rules-whitelist.toml
/opt/testing/share/rpmlint/scoring.toml
/opt/testing/share/rpmlint/security.toml
/opt/testing/share/rpmlint/sudoers-whitelist.toml
/opt/testing/share/rpmlint/sysctl-whitelist.toml
/opt/testing/share/rpmlint/systemd-tmpfiles.toml
/opt/testing/share/rpmlint/users-groups.toml
/opt/testing/share/rpmlint/world-writable-whitelist.toml
/opt/testing/share/rpmlint/zypper-plugins.toml
checks: 41, packages: 3

r8168-kmp-default.x86_64: E: suse-zypp-packageand packageand(kernel-default:r8168)
The 'packageand(package1:package2)' syntax is obsolete, please use boolean
dependencies like: 'Supplements: (package1 and package2)'

r8168.spec: W: no-%check-section
The spec file does not contain an %check section. Please check if the package
has a testsuite and what it takes to enable the testsuite as part of the
package build. If it is not possible to run it in the build environment
(OBS/koji) or no testsuite exists, then please ignore this warning. You should
not insert an empty %check section.

Check time report (&gt;1% &amp; &gt;0.1s):
Check                            Duration (in s)   Fraction (in %)  Checked files
ExtractRpm                                   0.3              86.9
TOTAL                                        0.4             100.0

3 packages and 0 specfiles checked; 1 errors, 1 warnings, 15 filtered, 1 badness; has taken 0.4 s
Request History
bitstreamout's avatar

bitstreamout created request 10 months ago

- Update to new version r8168-8.053.00
- Remove patches now upstream
* r8168-gcc14.patch
- Port patches
* r8168-kernel_version.patch
* r8168-support-dev0x8136.patch
* r8168-support-linux-5.19.patch
- Add patch r8168-support-ethtool_keee.patch
* Port struct ethtool_eee to new kernel struct ethtool_eee
and hopefully this works


bitstreamout's avatar

bitstreamout accepted request 10 months ago

Let's do it