r8125: update

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-11-02 20:43:40 +01:00
parent 9a3f472139
commit a5a0db0a09
4 changed files with 48 additions and 6 deletions

View File

@ -37,14 +37,14 @@ ENABLE_DASH_PRINTER_SUPPORT = n
CONFIG_DOWN_SPEED_100 = n CONFIG_DOWN_SPEED_100 = n
CONFIG_ASPM = y CONFIG_ASPM = y
ENABLE_S5WOL = y ENABLE_S5WOL = y
ENABLE_S5_KEEP_CURR_MAC = n ENABLE_S5_KEEP_CURR_MAC = y
ENABLE_EEE = y ENABLE_EEE = y
ENABLE_S0_MAGIC_PACKET = n ENABLE_S0_MAGIC_PACKET = n
ENABLE_TX_NO_CLOSE = y ENABLE_TX_NO_CLOSE = y
ENABLE_MULTIPLE_TX_QUEUE = y ENABLE_MULTIPLE_TX_QUEUE = y
ENABLE_PTP_SUPPORT = n ENABLE_PTP_SUPPORT = n
ENABLE_PTP_MASTER_MODE = n ENABLE_PTP_MASTER_MODE = n
ENABLE_RSS_SUPPORT = n ENABLE_RSS_SUPPORT = y
ENABLE_LIB_SUPPORT = n ENABLE_LIB_SUPPORT = n
ENABLE_USE_FIRMWARE_FILE = n ENABLE_USE_FIRMWARE_FILE = n
DISABLE_WOL_SUPPORT = n DISABLE_WOL_SUPPORT = n

View File

@ -1563,6 +1563,8 @@ enum RTL8125_register_content {
LinkStatus = 0x02, LinkStatus = 0x02,
FullDup = 0x01, FullDup = 0x01,
#define RTL8125_FULL_DUPLEX_MASK (_2500bpsF | _1000bpsF | FullDup)
/* DBG_reg */ /* DBG_reg */
Fix_Nak_1 = (1 << 4), Fix_Nak_1 = (1 << 4),
Fix_Nak_2 = (1 << 3), Fix_Nak_2 = (1 << 3),

View File

@ -39,6 +39,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/phy.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -5112,6 +5113,38 @@ rtl8125_link_down_patch(struct net_device *dev)
#endif #endif
} }
static unsigned int rtl8125_phy_duplex(u16 status)
{
unsigned int duplex = DUPLEX_UNKNOWN;
if (status & LinkStatus) {
if (status & RTL8125_FULL_DUPLEX_MASK)
duplex = DUPLEX_FULL;
else
duplex = DUPLEX_HALF;
}
return duplex;
}
static int rtl8125_phy_speed(u16 status)
{
int speed = SPEED_UNKNOWN;
if (status & LinkStatus) {
if (status & _2500bpsF)
speed = SPEED_2500;
else if (status & _1000bpsF)
speed = SPEED_1000;
else if (status & _100bps)
speed = SPEED_100;
else if (status & _10bps)
speed = SPEED_10;
}
return speed;
}
static void static void
_rtl8125_check_link_status(struct net_device *dev) _rtl8125_check_link_status(struct net_device *dev)
{ {
@ -5120,11 +5153,18 @@ _rtl8125_check_link_status(struct net_device *dev)
if (tp->link_ok(dev)) { if (tp->link_ok(dev)) {
rtl8125_link_on_patch(dev); rtl8125_link_on_patch(dev);
if (netif_msg_ifup(tp)) if (netif_msg_ifup(tp)) {
printk(KERN_INFO PFX "%s: link up\n", dev->name); const u16 phy_status = RTL_R16(tp, PHYstatus);
const unsigned int phy_duplex = rtl8125_phy_duplex(phy_status);
const int phy_speed = rtl8125_phy_speed(phy_status);
printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
dev->name,
phy_speed_to_str(phy_speed),
phy_duplex_to_str(phy_duplex));
}
} else { } else {
if (netif_msg_ifdown(tp)) if (netif_msg_ifdown(tp))
printk(KERN_INFO PFX "%s: link down\n", dev->name); printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
rtl8125_link_down_patch(dev); rtl8125_link_down_patch(dev);
} }

View File

@ -91,7 +91,7 @@ int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
struct rtl8125_private *tp = netdev_priv(dev); struct rtl8125_private *tp = netdev_priv(dev);
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
netif_info(tp, drv, tp->dev, "rss get rxnfc\n"); netif_dbg(tp, drv, tp->dev, "rss get rxnfc\n");
if (!(dev->features & NETIF_F_RXHASH)) if (!(dev->features & NETIF_F_RXHASH))
return ret; return ret;