@@ -18,11 +18,13 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
1818
1919--- a/src/r8126.h
2020+++ b/src/r8126.h
21- @@ -1740 ,6 +1740,8 @@ enum RTL8126_register_content {
21+ @@ -1756 ,6 +1756,10 @@ enum RTL8126_register_content {
2222 LinkStatus = 0x02,
2323 FullDup = 0x01,
2424
2525+ #define RTL8126_FULL_DUPLEX_MASK (_5000bpsF | _2500bpsF | _1000bpsF | FullDup)
26+ + #define RTL8126_SPEED_1000_MASK (_1000bpsF | _1000bpsL | _2500bpsL)
27+ + #define RTL8126_SPEED_2500_MASK (_2500bpsF | _5000bpsL)
2628+
2729 /* DBG_reg */
2830 Fix_Nak_1 = (1 << 4),
@@ -37,11 +39,11 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
3739 #include <linux/netdevice.h>
3840 #include <linux/etherdevice.h>
3941 #include <linux/delay.h>
40- @@ -4744 ,6 +4745 ,40 @@ rtl8126_link_down_patch(struct net_devic
42+ @@ -4661 ,6 +4662 ,40 @@ rtl8126_link_down_patch(struct net_devic
4143 #endif
4244 }
4345
44- + static unsigned int rtl8126_phy_duplex(u16 status)
46+ + static unsigned int rtl8126_phy_duplex(u32 status)
4547+ {
4648+ unsigned int duplex = DUPLEX_UNKNOWN;
4749+
@@ -55,16 +57,16 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
5557+ return duplex;
5658+ }
5759+
58- + static int rtl8126_phy_speed(u16 status)
60+ + static int rtl8126_phy_speed(u32 status)
5961+ {
6062+ int speed = SPEED_UNKNOWN;
6163+
6264+ if (status & LinkStatus) {
6365+ if (status & _5000bpsF)
6466+ speed = SPEED_5000;
65- + else if (status & _2500bpsF )
67+ + else if (status & RTL8126_SPEED_2500_MASK )
6668+ speed = SPEED_2500;
67- + else if (status & _1000bpsF )
69+ + else if (status & RTL8126_SPEED_1000_MASK )
6870+ speed = SPEED_1000;
6971+ else if (status & _100bps)
7072+ speed = SPEED_100;
@@ -78,14 +80,14 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
7880 static void
7981 _rtl8126_check_link_status(struct net_device *dev, unsigned int link_state)
8082 {
81- @@ -4756 ,11 +4791 ,18 @@ _rtl8126_check_link_status(struct net_de
83+ @@ -4673 ,11 +4708 ,18 @@ _rtl8126_check_link_status(struct net_de
8284 if (link_state == R8126_LINK_STATE_ON) {
8385 rtl8126_link_on_patch(dev);
8486
8587- if (netif_msg_ifup(tp))
8688- printk(KERN_INFO PFX "%s: link up\n", dev->name);
8789+ if (netif_msg_ifup(tp)) {
88- + const u16 phy_status = RTL_R16 (tp, PHYstatus);
90+ + const u32 phy_status = RTL_R32 (tp, PHYstatus);
8991+ const unsigned int phy_duplex = rtl8126_phy_duplex(phy_status);
9092+ const int phy_speed = rtl8126_phy_speed(phy_status);
9193+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
0 commit comments