mirror of
https://github.com/AuxXxilium/r8126.git
synced 2024-11-23 15:01:02 +07:00
r8126: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
c15092717f
commit
9dc8dd88b4
2
Makefile
2
Makefile
@ -44,7 +44,7 @@ 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
|
||||||
|
4
r8126.h
4
r8126.h
@ -678,7 +678,7 @@ This is free software, and you are welcome to redistribute it under certain cond
|
|||||||
#ifndef ADVERTISED_2500baseX_Full
|
#ifndef ADVERTISED_2500baseX_Full
|
||||||
#define ADVERTISED_2500baseX_Full 0x8000
|
#define ADVERTISED_2500baseX_Full 0x8000
|
||||||
#endif
|
#endif
|
||||||
#define RTK_ADVERTISED_5000baseX_Full BIT(48)
|
#define RTK_ADVERTISED_5000baseX_Full BIT_ULL(48)
|
||||||
|
|
||||||
#define RTK_ADVERTISE_2500FULL 0x80
|
#define RTK_ADVERTISE_2500FULL 0x80
|
||||||
#define RTK_ADVERTISE_5000FULL 0x100
|
#define RTK_ADVERTISE_5000FULL 0x100
|
||||||
@ -1561,6 +1561,8 @@ enum RTL8126_register_content {
|
|||||||
LinkStatus = 0x02,
|
LinkStatus = 0x02,
|
||||||
FullDup = 0x01,
|
FullDup = 0x01,
|
||||||
|
|
||||||
|
#define RTL8126_FULL_DUPLEX_MASK (_5000bpsF | _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),
|
||||||
|
48
r8126_n.c
48
r8126_n.c
@ -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>
|
||||||
@ -4740,6 +4741,40 @@ rtl8126_link_down_patch(struct net_device *dev)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int rtl8126_phy_duplex(u16 status)
|
||||||
|
{
|
||||||
|
unsigned int duplex = DUPLEX_UNKNOWN;
|
||||||
|
|
||||||
|
if (status & LinkStatus) {
|
||||||
|
if (status & RTL8126_FULL_DUPLEX_MASK)
|
||||||
|
duplex = DUPLEX_FULL;
|
||||||
|
else
|
||||||
|
duplex = DUPLEX_HALF;
|
||||||
|
}
|
||||||
|
|
||||||
|
return duplex;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rtl8126_phy_speed(u16 status)
|
||||||
|
{
|
||||||
|
int speed = SPEED_UNKNOWN;
|
||||||
|
|
||||||
|
if (status & LinkStatus) {
|
||||||
|
if (status & _5000bpsF)
|
||||||
|
speed = SPEED_5000;
|
||||||
|
else 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
|
||||||
_rtl8126_check_link_status(struct net_device *dev)
|
_rtl8126_check_link_status(struct net_device *dev)
|
||||||
{
|
{
|
||||||
@ -4748,11 +4783,18 @@ _rtl8126_check_link_status(struct net_device *dev)
|
|||||||
if (tp->link_ok(dev)) {
|
if (tp->link_ok(dev)) {
|
||||||
rtl8126_link_on_patch(dev);
|
rtl8126_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 = rtl8126_phy_duplex(phy_status);
|
||||||
|
const int phy_speed = rtl8126_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);
|
||||||
|
|
||||||
rtl8126_link_down_patch(dev);
|
rtl8126_link_down_patch(dev);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ int rtl8126_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
|||||||
struct rtl8126_private *tp = netdev_priv(dev);
|
struct rtl8126_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;
|
||||||
|
Loading…
Reference in New Issue
Block a user