r8168: bump to 8.054.00

Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
sbwml 2024-10-17 17:18:18 +08:00
parent 663efde6fa
commit eebb76bced
8 changed files with 376 additions and 241 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8168 PKG_NAME:=r8168
PKG_VERSION:=8.053.00 PKG_VERSION:=8.054.00
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -8,7 +8,7 @@
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
@@ -25945,6 +25946,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri @@ -26059,6 +26060,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri
tp->imr_reg[3] = IntrMask3; tp->imr_reg[3] = IntrMask3;
} }
@ -31,7 +31,7 @@
static void static void
rtl8168_init_software_variable(struct net_device *dev) rtl8168_init_software_variable(struct net_device *dev)
{ {
@@ -26640,6 +26657,8 @@ err1: @@ -26754,6 +26771,8 @@ err1:
if (tp->InitRxDescType == RX_DESC_RING_TYPE_2) if (tp->InitRxDescType == RX_DESC_RING_TYPE_2)
tp->RxDescLength = RX_DESC_LEN_TYPE_2; tp->RxDescLength = RX_DESC_LEN_TYPE_2;

View File

@ -1,99 +0,0 @@
--- a/r8168_n.c
+++ b/r8168_n.c
@@ -7942,7 +7942,11 @@ rtl8168_device_lpi_t_to_ethtool_lpi_t(st
}
static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
+#else
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
+#endif
{
struct rtl8168_private *tp = netdev_priv(net);
struct ethtool_eee *eee = &tp->eee;
@@ -7976,9 +7980,15 @@ rtl_ethtool_get_eee(struct net_device *n
edata->eee_enabled = !!val;
edata->eee_active = !!(supported & adv & lp);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ ethtool_convert_legacy_u32_to_link_mode(edata->supported, supported);
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
+ ethtool_convert_legacy_u32_to_link_mode(edata->lp_advertised, lp);
+#else
edata->supported = supported;
edata->advertised = adv;
edata->lp_advertised = lp;
+#endif
edata->tx_lpi_enabled = edata->eee_enabled;
edata->tx_lpi_timer = tx_lpi_timer;
@@ -7986,11 +7996,19 @@ rtl_ethtool_get_eee(struct net_device *n
}
static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
+#else
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
+#endif
{
struct rtl8168_private *tp = netdev_priv(net);
struct ethtool_eee *eee = &tp->eee;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ u32 advertising, adv;
+#else
u32 advertising;
+#endif
int rc = 0;
if (!rtl8168_support_eee(tp))
@@ -8014,6 +8032,18 @@ rtl_ethtool_set_eee(struct net_device *n
}
advertising = tp->advertising;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ ethtool_convert_link_mode_to_legacy_u32(&adv, edata->advertised);
+ if (linkmode_empty(edata->advertised)) {
+ adv = advertising & eee->supported;
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
+ } else if (!linkmode_empty(edata->advertised) & ~advertising) {
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
+ adv, advertising);
+ rc = -EINVAL;
+ goto out;
+ }
+#else
if (!edata->advertised) {
edata->advertised = advertising & eee->supported;
} else if (edata->advertised & ~advertising) {
@@ -8022,15 +8052,29 @@ rtl_ethtool_set_eee(struct net_device *n
rc = -EINVAL;
goto out;
}
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ if (!linkmode_empty(edata->advertised) & ~eee->supported) {
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
+ adv, eee->supported);
+ rc = -EINVAL;
+ goto out;
+ }
+#else
if (edata->advertised & ~eee->supported) {
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
edata->advertised, eee->supported);
rc = -EINVAL;
goto out;
}
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
+ ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, edata->advertised);
+#else
eee->advertised = edata->advertised;
+#endif
eee->eee_enabled = edata->eee_enabled;
if (eee->eee_enabled)

View File

@ -53,6 +53,68 @@
#define fallthrough #define fallthrough
#endif #endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#define netif_xmit_stopped netif_tx_queue_stopped
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
#ifndef MDIO_AN_EEE_ADV_100TX
#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */
#endif
#ifndef MDIO_AN_EEE_ADV_1000T
#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */
#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */
#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */
#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */
#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */
#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
{
u32 adv = 0;
if (eee_adv & MDIO_EEE_100TX)
adv |= ADVERTISED_100baseT_Full;
if (eee_adv & MDIO_EEE_1000T)
adv |= ADVERTISED_1000baseT_Full;
if (eee_adv & MDIO_EEE_10GT)
adv |= ADVERTISED_10000baseT_Full;
if (eee_adv & MDIO_EEE_1000KX)
adv |= ADVERTISED_1000baseKX_Full;
if (eee_adv & MDIO_EEE_10GKX4)
adv |= ADVERTISED_10000baseKX4_Full;
if (eee_adv & MDIO_EEE_10GKR)
adv |= ADVERTISED_10000baseKR_Full;
return adv;
}
static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
{
u16 reg = 0;
if (adv & ADVERTISED_100baseT_Full)
reg |= MDIO_EEE_100TX;
if (adv & ADVERTISED_1000baseT_Full)
reg |= MDIO_EEE_1000T;
if (adv & ADVERTISED_10000baseT_Full)
reg |= MDIO_EEE_10GT;
if (adv & ADVERTISED_1000baseKX_Full)
reg |= MDIO_EEE_1000KX;
if (adv & ADVERTISED_10000baseKX4_Full)
reg |= MDIO_EEE_10GKX4;
if (adv & ADVERTISED_10000baseKR_Full)
reg |= MDIO_EEE_10GKR;
return reg;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
static inline static inline
ssize_t strscpy(char *dest, const char *src, size_t count) ssize_t strscpy(char *dest, const char *src, size_t count)
@ -238,7 +300,7 @@ do { \
#define ENABLE_R8168_PROCFS #define ENABLE_R8168_PROCFS
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
#define ENABLE_R8168_SYSFS #define ENABLE_R8168_SYSFS
#endif #endif
@ -349,6 +411,13 @@ do { \
#define MDIO_EEE_1000T 0x0004 #define MDIO_EEE_1000T 0x0004
#endif #endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0)
#define ethtool_keee ethtool_eee
#define rtl8168_ethtool_adv_to_mmd_eee_adv_cap1_t ethtool_adv_to_mmd_eee_adv_t
#else
#define rtl8168_ethtool_adv_to_mmd_eee_adv_cap1_t linkmode_to_mii_eee_cap1_t
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
#define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8168_netpoll #define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8168_netpoll
@ -431,7 +500,7 @@ do { \
#define RSS_SUFFIX "" #define RSS_SUFFIX ""
#endif #endif
#define RTL8168_VERSION "8.053.00" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX RSS_SUFFIX #define RTL8168_VERSION "8.054.00" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX RSS_SUFFIX
#define MODULENAME "r8168" #define MODULENAME "r8168"
#define PFX MODULENAME ": " #define PFX MODULENAME ": "
@ -613,6 +682,13 @@ This is free software, and you are welcome to redistribute it under certain cond
#define ETH_MIN_MTU 68 #define ETH_MIN_MTU 68
#endif #endif
#ifndef WRITE_ONCE
#define WRITE_ONCE(var, val) (*((volatile typeof(val) *)(&(var))) = (val))
#endif
#ifndef READ_ONCE
#define READ_ONCE(var) (*((volatile typeof(var) *)(&(var))))
#endif
/*****************************************************************************/ /*****************************************************************************/
//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) //#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)
@ -1179,10 +1255,17 @@ enum RTL8168_registers {
CounterAddrLow = 0x10, CounterAddrLow = 0x10,
CounterAddrHigh = 0x14, CounterAddrHigh = 0x14,
CustomLED = 0x18, CustomLED = 0x18,
#ifdef ENABLE_LIB_SUPPORT
TxDescStartAddrLow = 0x28,
TxDescStartAddrHigh = 0x2c,
TxHDescStartAddrLow = 0x20,
TxHDescStartAddrHigh = 0x24,
#else
TxDescStartAddrLow = 0x20, TxDescStartAddrLow = 0x20,
TxDescStartAddrHigh = 0x24, TxDescStartAddrHigh = 0x24,
TxHDescStartAddrLow = 0x28, TxHDescStartAddrLow = 0x28,
TxHDescStartAddrHigh = 0x2c, TxHDescStartAddrHigh = 0x2c,
#endif /* ENABLE_LIB_SUPPORT */
FLASH = 0x30, FLASH = 0x30,
ERSR = 0x36, ERSR = 0x36,
ChipCmd = 0x37, ChipCmd = 0x37,
@ -1891,6 +1974,20 @@ struct rtl8168_counters {
u16 tx_underrun; u16 tx_underrun;
}; };
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
struct ethtool_eee {
__u32 cmd;
__u32 supported;
__u32 advertised;
__u32 lp_advertised;
__u32 eee_active;
__u32 eee_enabled;
__u32 tx_lpi_enabled;
__u32 tx_lpi_timer;
__u32 reserved[2];
};
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
struct rtl8168_private { struct rtl8168_private {
void __iomem *mmio_addr; /* memory map physical address */ void __iomem *mmio_addr; /* memory map physical address */
struct pci_dev *pci_dev; /* Index of PCI device */ struct pci_dev *pci_dev; /* Index of PCI device */
@ -2143,7 +2240,7 @@ struct rtl8168_private {
//Realwow-------------- //Realwow--------------
#endif //ENABLE_REALWOW_SUPPORT #endif //ENABLE_REALWOW_SUPPORT
struct ethtool_eee eee; struct ethtool_keee eee;
u32 dynamic_aspm_packet_count; u32 dynamic_aspm_packet_count;
@ -2449,10 +2546,9 @@ rtl8168_enable_dash2_interrupt(struct rtl8168_private *tp)
if (!tp->DASH) if (!tp->DASH)
return; return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_CMAC(tp))
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)); 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));
} }
}
static inline void static inline void
rtl8168_disable_dash2_interrupt(struct rtl8168_private *tp) rtl8168_disable_dash2_interrupt(struct rtl8168_private *tp)
@ -2460,10 +2556,9 @@ rtl8168_disable_dash2_interrupt(struct rtl8168_private *tp)
if (!tp->DASH) if (!tp->DASH)
return; return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_CMAC(tp))
RTL_CMAC_W8(tp, CMAC_IBIMR0, 0); RTL_CMAC_W8(tp, CMAC_IBIMR0, 0);
} }
}
#endif #endif
static inline void static inline void

View File

@ -160,6 +160,7 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2;
#define OCP_REG_CR (0x36) #define OCP_REG_CR (0x36)
#define OCP_REG_DMEMSTA (0x38) #define OCP_REG_DMEMSTA (0x38)
#define OCP_REG_GPHYAR (0x60) #define OCP_REG_GPHYAR (0x60)
#define OCP_REG_FIRMWARE_MAJOR_VERSION (0x120)
#define OCP_REG_CONFIG0_DASHEN BIT_15 #define OCP_REG_CONFIG0_DASHEN BIT_15
@ -175,6 +176,9 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2;
#define HW_DASH_SUPPORT_TYPE_1(_M) ((_M)->HwSuppDashVer == 1) #define HW_DASH_SUPPORT_TYPE_1(_M) ((_M)->HwSuppDashVer == 1)
#define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2) #define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2)
#define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3) #define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3)
#define HW_DASH_SUPPORT_CMAC(_M) (HW_DASH_SUPPORT_TYPE_2(_M) || HW_DASH_SUPPORT_TYPE_3(_M))
#define HW_DASH_SUPPORT_GET_FIRMWARE_VERSION(_M) (HW_DASH_SUPPORT_TYPE_2(_M) || \
HW_DASH_SUPPORT_TYPE_3(_M))
#define RECV_FROM_FW_BUF_SIZE (2048) #define RECV_FROM_FW_BUF_SIZE (2048)
#define SEND_TO_FW_BUF_SIZE (2048) #define SEND_TO_FW_BUF_SIZE (2048)

View File

@ -1701,6 +1701,26 @@ static int proc_dump_tx_desc(struct seq_file *m, void *v)
rtnl_lock(); rtnl_lock();
#ifdef ENABLE_LIB_SUPPORT
(void)i;
if (tp->tx_ring[0].TxDescArray) {
struct rtl8168_tx_ring *ring = &tp->tx_ring[0];
seq_printf(m, "\ndump rtk tx desc:%d\n", ring->num_tx_desc);
_proc_dump_tx_desc(m, ring->TxDescArray,
ring->TxDescAllocSize,
ring->num_tx_desc);
}
if (tp->lib_tx_ring[1].desc_addr) {
struct rtl8168_ring *ring = &tp->lib_tx_ring[1];
seq_printf(m, "\ndump lib tx desc:%d\n", ring->ring_size);
_proc_dump_tx_desc(m, ring->desc_addr,
ring->desc_size,
ring->ring_size);
}
#else
for (i=0; i<tp->HwSuppNumTxQueues; i++) { for (i=0; i<tp->HwSuppNumTxQueues; i++) {
struct rtl8168_tx_ring *ring = &tp->tx_ring[i]; struct rtl8168_tx_ring *ring = &tp->tx_ring[i];
if (!ring->TxDescArray) if (!ring->TxDescArray)
@ -1710,17 +1730,6 @@ static int proc_dump_tx_desc(struct seq_file *m, void *v)
ring->TxDescAllocSize, ring->TxDescAllocSize,
ring->num_tx_desc); ring->num_tx_desc);
} }
#ifdef ENABLE_LIB_SUPPORT
for (i=0; i<tp->HwSuppNumTxQueues; i++) {
struct rtl8168_ring *ring = &tp->lib_tx_ring[i];
if (!ring->desc_addr)
continue;
seq_printf(m, "\ndump lib Q%d tx desc:%d\n", i, ring->ring_size);
_proc_dump_tx_desc(m, ring->desc_addr,
ring->desc_size,
ring->ring_size);
}
#endif //ENABLE_LIB_SUPPORT #endif //ENABLE_LIB_SUPPORT
rtnl_unlock(); rtnl_unlock();
@ -1883,7 +1892,6 @@ static int proc_get_driver_variable(char *page, char **start,
"num_tx_rings\t0x%x\n" "num_tx_rings\t0x%x\n"
"tot_rx_rings\t0x%x\n" "tot_rx_rings\t0x%x\n"
"tot_tx_rings\t0x%x\n" "tot_tx_rings\t0x%x\n"
"tot_rx_desc_rings\t0x%x\n"
"HwSuppNumTxQueues\t0x%x\n" "HwSuppNumTxQueues\t0x%x\n"
"HwSuppNumRxQueues\t0x%x\n" "HwSuppNumRxQueues\t0x%x\n"
"num_hw_tot_en_rx_rings\t0x%x\n" "num_hw_tot_en_rx_rings\t0x%x\n"
@ -2029,8 +2037,6 @@ static int proc_get_tally_counter(char *page, char **start,
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
struct rtl8168_counters *counters; struct rtl8168_counters *counters;
dma_addr_t paddr; dma_addr_t paddr;
u32 cmd;
u32 WaitCnt;
int len = 0; int len = 0;
len += snprintf(page + len, count - len, len += snprintf(page + len, count - len,
@ -2499,7 +2505,7 @@ void _proc_dump_tx_desc(char *page, int *page_len, int *count,
pdword[i]); pdword[i]);
} }
len += snprintf(page + len, count - len, "\n"); len += snprintf(page + len, *count - len, "\n");
*page_len = len; *page_len = len;
return; return;
@ -2511,7 +2517,6 @@ static int proc_dump_tx_desc(char *page, char **start,
{ {
int i; int i;
int len = 0; int len = 0;
u32 *pdword;
struct net_device *dev = data; struct net_device *dev = data;
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
struct rtl8168_tx_ring *ring = &tp->tx_ring[0]; struct rtl8168_tx_ring *ring = &tp->tx_ring[0];
@ -2521,13 +2526,13 @@ static int proc_dump_tx_desc(char *page, char **start,
rtnl_lock(); rtnl_lock();
for (i=0; i<tp->HwSuppNumTxQueues; i++) { #ifdef ENABLE_LIB_SUPPORT
struct rtl8168_tx_ring *ring = &tp->tx_ring[i]; (void)i;
if (!ring->TxDescArray) if (tp->tx_ring[0].TxDescArray) {
continue; struct rtl8168_tx_ring *ring = &tp->tx_ring[0];
len += snprintf(page + len, count - len, len += snprintf(page + len, count - len,
"\ndump Q%d tx desc:%d", "\ndump rtk tx desc:%d\n",
i,
ring->num_tx_desc); ring->num_tx_desc);
_proc_dump_tx_desc(page, &len, &count, _proc_dump_tx_desc(page, &len, &count,
ring->TxDescArray, ring->TxDescArray,
@ -2535,19 +2540,31 @@ static int proc_dump_tx_desc(char *page, char **start,
ring->num_tx_desc); ring->num_tx_desc);
} }
#ifdef ENABLE_LIB_SUPPORT if (tp->lib_tx_ring[1].desc_addr) {
for (i=0; i<tp->HwSuppNumTxQueues; i++) { struct rtl8168_ring *ring = &tp->lib_tx_ring[1];
struct rtl8168_ring *ring = &tp->lib_tx_ring[i];
if (!ring->desc_addr)
continue;
len += snprintf(page + len, count - len, len += snprintf(page + len, count - len,
"\ndump lib Q%d tx desc:%d", "\ndump lib tx desc:%d\n",
i,
ring->ring_size); ring->ring_size);
_proc_dump_tx_desc(page, &len, ring->desc_addr, _proc_dump_tx_desc(page, &len, &count,
ring->desc_addr,
ring->desc_size, ring->desc_size,
ring->ring_size); ring->ring_size);
} }
#else
for (i=0; i<tp->HwSuppNumTxQueues; i++) {
struct rtl8168_tx_ring *ring = &tp->tx_ring[i];
if (!ring->TxDescArray)
continue;
len += snprintf(page + len, count - len,
"\ndump Q%d tx desc:%d\n",
i,
ring->num_tx_desc);
_proc_dump_tx_desc(page, &len, &count,
ring->TxDescArray,
ring->TxDescAllocSize,
ring->num_tx_desc);
}
#endif //ENABLE_LIB_SUPPORT #endif //ENABLE_LIB_SUPPORT
rtnl_unlock(); rtnl_unlock();
@ -2559,58 +2576,6 @@ static int proc_dump_tx_desc(char *page, char **start,
return len; return len;
} }
static int proc_dump_tx_desc(char *page, char **start,
off_t offset, int count,
int *eof, void *data)
{
int i;
struct net_device *dev = m->private;
struct rtl8168_private *tp = netdev_priv(dev);
switch (tp->mcfg) {
case CFG_METHOD_1 ... CFG_METHOD_8:
return -EOPNOTSUPP;
default:
break;
}
rtnl_lock();
len += snprintf(page + len, count - len,
"\ndump MSI-X Table. Total Entry %d. \n",
R8168_MAX_MSIX_VEC);
for (i=0; i<R8168_MAX_MSIX_VEC; i++) {
len += snprintf(page + len, count - len,
"\n%04x ",
i);
len += snprintf(page + len, count - len,
"%08x ",
rtl8168_eri_read(tp, i*0x10, 4,
ERIAR_MSIX));
len += snprintf(page + len, count - len,
"%08x ",
rtl8168_eri_read(tp, i*0x10 + 4, 4,
ERIAR_MSIX));
len += snprintf(page + len, count - len,
"%08x ",
rtl8168_eri_read(tp, i*0x10 + 8, 4,
ERIAR_MSIX));
len += snprintf(page + len, count - len,
"%08x ",
rtl8168_eri_read(tp, i*0x10 + 12, 4,
ERIAR_MSIX));
}
rtnl_unlock();
len += snprintf(page + len, count - len, "\n");
*eof = 1;
return len;
}
static int proc_dump_msix_tbl(char *page, char **start, static int proc_dump_msix_tbl(char *page, char **start,
off_t offset, int count, off_t offset, int count,
int *eof, void *data) int *eof, void *data)
@ -3625,7 +3590,20 @@ void rtl8168_oob_notify(struct rtl8168_private *tp, u8 cmd)
rtl8168_ocp_write(tp, 0x30, 1, 0x01); rtl8168_ocp_write(tp, 0x30, 1, 0x01);
} }
static int rtl8168_check_dash(struct rtl8168_private *tp) static u32 rtl8168_get_dash_fw_ver(struct rtl8168_private *tp)
{
u32 ver = 0xffffffff;
if (!HW_DASH_SUPPORT_GET_FIRMWARE_VERSION(tp))
goto exit;
ver = rtl8168_ocp_read(tp, OCP_REG_FIRMWARE_MAJOR_VERSION, 4);
exit:
return ver;
}
static int _rtl8168_check_dash(struct rtl8168_private *tp)
{ {
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
if (rtl8168_ocp_read(tp, 0x128, 1) & BIT_0) if (rtl8168_ocp_read(tp, 0x128, 1) & BIT_0)
@ -3647,12 +3625,31 @@ static int rtl8168_check_dash(struct rtl8168_private *tp)
} }
} }
static int rtl8168_check_dash(struct rtl8168_private *tp)
{
int dash_enabled;
u32 fw_ver;
dash_enabled = _rtl8168_check_dash(tp);
if (!dash_enabled)
goto exit;
if (!HW_DASH_SUPPORT_GET_FIRMWARE_VERSION(tp))
goto exit;
fw_ver = rtl8168_get_dash_fw_ver(tp);
if (fw_ver == 0 || fw_ver == 0xffffffff)
dash_enabled = 0;
exit:
return dash_enabled;
}
void rtl8168_dash2_disable_tx(struct rtl8168_private *tp) void rtl8168_dash2_disable_tx(struct rtl8168_private *tp)
{ {
if (!tp->DASH) if (!tp->DASH)
return; return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_CMAC(tp)) {
u16 WaitCnt; u16 WaitCnt;
u8 TmpUchar; u8 TmpUchar;
@ -3682,7 +3679,7 @@ void rtl8168_dash2_enable_tx(struct rtl8168_private *tp)
if (!tp->DASH) if (!tp->DASH)
return; return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) if (HW_DASH_SUPPORT_CMAC(tp))
RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) | BIT_0); RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) | BIT_0);
} }
@ -3691,7 +3688,7 @@ void rtl8168_dash2_disable_rx(struct rtl8168_private *tp)
if (!tp->DASH) if (!tp->DASH)
return; return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) if (HW_DASH_SUPPORT_CMAC(tp))
RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~(BIT_0)); RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~(BIT_0));
} }
@ -3700,7 +3697,7 @@ void rtl8168_dash2_enable_rx(struct rtl8168_private *tp)
if (!tp->DASH) if (!tp->DASH)
return; return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) if (HW_DASH_SUPPORT_CMAC(tp))
RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) | BIT_0); RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) | BIT_0);
} }
@ -3708,7 +3705,7 @@ static void rtl8168_dash2_disable_txrx(struct net_device *dev)
{ {
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_CMAC(tp)) {
rtl8168_dash2_disable_tx(tp); rtl8168_dash2_disable_tx(tp);
rtl8168_dash2_disable_rx(tp); rtl8168_dash2_disable_rx(tp);
} }
@ -4670,10 +4667,9 @@ rtl8168_irq_mask_and_ack(struct rtl8168_private *tp)
rtl8168_get_isr_by_vector(tp, 0) & rtl8168_get_isr_by_vector(tp, 0) &
~(ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET)); ~(ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET));
} else { } else {
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_CMAC(tp))
RTL_CMAC_W8(tp, CMAC_IBISR0, RTL_CMAC_R8(tp, CMAC_IBISR0)); RTL_CMAC_W8(tp, CMAC_IBISR0, RTL_CMAC_R8(tp, CMAC_IBISR0));
} }
}
} else { } else {
rtl8168_self_clear_isr_by_vector(tp, 0); rtl8168_self_clear_isr_by_vector(tp, 0);
} }
@ -5215,7 +5211,7 @@ NICChkTypeEnableDashInterrupt(struct rtl8168_private *tp)
// //
// even disconnected, enable 3 dash interrupt mask bits for in-band/out-band communication // even disconnected, enable 3 dash interrupt mask bits for in-band/out-band communication
// //
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_CMAC(tp)) {
rtl8168_enable_dash2_interrupt(tp); rtl8168_enable_dash2_interrupt(tp);
RTL_W16(tp, tp->imr_reg[0], (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET)); RTL_W16(tp, tp->imr_reg[0], (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET));
} else { } else {
@ -6680,7 +6676,6 @@ rtl8168_set_settings(struct net_device *dev,
static u32 static u32
rtl8168_get_tx_csum(struct net_device *dev) rtl8168_get_tx_csum(struct net_device *dev)
{ {
struct rtl8168_private *tp = netdev_priv(dev);
u32 ret; u32 ret;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
@ -7605,8 +7600,8 @@ static int rtl8168_enable_eee(struct rtl8168_private *tp)
int ret; int ret;
u16 data; u16 data;
u32 csi_tmp; u32 csi_tmp;
struct ethtool_eee *eee = &tp->eee; struct ethtool_keee *eee = &tp->eee;
u16 eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(eee->advertised); u16 eee_adv_cap1_t = rtl8168_ethtool_adv_to_mmd_eee_adv_cap1_t(eee->advertised);
ret = 0; ret = 0;
switch (tp->mcfg) { switch (tp->mcfg) {
@ -7709,7 +7704,7 @@ static int rtl8168_enable_eee(struct rtl8168_private *tp)
data = rtl8168_mdio_read(tp, 0x11); data = rtl8168_mdio_read(tp, 0x11);
rtl8168_mdio_write(tp, 0x11, data | BIT_4); rtl8168_mdio_write(tp, 0x11, data | BIT_4);
rtl8168_mdio_write(tp, 0x1F, 0x0A5D); rtl8168_mdio_write(tp, 0x1F, 0x0A5D);
rtl8168_mdio_write(tp, 0x10, eee_adv_t); rtl8168_mdio_write(tp, 0x10, eee_adv_cap1_t);
rtl8168_mdio_write(tp, 0x1F, 0x0000); rtl8168_mdio_write(tp, 0x1F, 0x0000);
break; break;
@ -7940,6 +7935,127 @@ rtl8168_device_lpi_t_to_ethtool_lpi_t(struct rtl8168_private *tp , u32 lpi_timer
return to_us; return to_us;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
static void
rtl8168_adv_to_linkmode(unsigned long *mode, u64 adv)
{
linkmode_zero(mode);
if (adv & ADVERTISED_10baseT_Half)
linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, mode);
if (adv & ADVERTISED_10baseT_Full)
linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, mode);
if (adv & ADVERTISED_100baseT_Half)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, mode);
if (adv & ADVERTISED_100baseT_Full)
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, mode);
if (adv & ADVERTISED_1000baseT_Half)
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, mode);
if (adv & ADVERTISED_1000baseT_Full)
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, mode);
if (adv & ADVERTISED_2500baseX_Full)
linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, mode);
}
static int
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(common);
struct rtl8168_private *tp = netdev_priv(net);
struct ethtool_keee *eee = &tp->eee;
u32 tx_lpi_timer;
u16 val;
if (!rtl8168_support_eee(tp))
return -EOPNOTSUPP;
if (unlikely(tp->rtk_enable_diag))
return -EBUSY;
/* Get LP advertisement EEE */
rtl8168_mdio_write(tp, 0x1F, 0x0A5D);
val = rtl8168_mdio_read(tp, 0x11);
mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, val);;
/* Get EEE Tx LPI timer*/
tx_lpi_timer = rtl8168_device_lpi_t_to_ethtool_lpi_t(tp, eee->tx_lpi_timer);
val = rtl8168_eri_read(tp, 0x1B0, 2, ERIAR_ExGMAC);
val &= BIT_1 | BIT_0;
rtl8168_mdio_write(tp, 0x1F, 0x0000);
edata->eee_enabled = !!val;
linkmode_copy(edata->supported, eee->supported);
linkmode_copy(edata->advertised, eee->advertised);
edata->tx_lpi_enabled = edata->eee_enabled;
edata->tx_lpi_timer = tx_lpi_timer;
linkmode_and(common, edata->advertised, edata->lp_advertised);
edata->eee_active = !linkmode_empty(common);
return 0;
}
static int
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
__ETHTOOL_DECLARE_LINK_MODE_MASK(tmp);
struct rtl8168_private *tp = netdev_priv(net);
struct ethtool_keee *eee = &tp->eee;
int rc = 0;
if (!rtl8168_support_eee(tp))
return -EOPNOTSUPP;
if (HW_SUPP_SERDES_PHY(tp) ||
!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) ||
tp->DASH)
return -EOPNOTSUPP;
if (unlikely(tp->rtk_enable_diag)) {
dev_printk(KERN_WARNING, tp_to_dev(tp), "Diag Enabled\n");
rc = -EBUSY;
goto out;
}
if (tp->autoneg != AUTONEG_ENABLE) {
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE requires autoneg\n");
rc = -EINVAL;
goto out;
}
rtl8168_adv_to_linkmode(advertising, tp->advertising);
if (linkmode_empty(edata->advertised)) {
linkmode_and(edata->advertised, advertising, eee->supported);
} else if (linkmode_andnot(tmp, edata->advertised, advertising)) {
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised must be a subset of autoneg advertised speeds\n");
rc = -EINVAL;
goto out;
}
if (linkmode_andnot(tmp, edata->advertised, eee->supported)) {
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised must be a subset of support \n");
rc = -EINVAL;
goto out;
}
linkmode_copy(eee->advertised, edata->advertised);
eee->tx_lpi_enabled = edata->tx_lpi_enabled;
eee->tx_lpi_timer = edata->tx_lpi_timer;
eee->eee_enabled = edata->eee_enabled;
if (eee->eee_enabled)
rtl8168_enable_eee(tp);
else
rtl8168_disable_eee(tp);
rtl_nway_reset(net);
out:
return rc;
}
#else
static int static int
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
{ {
@ -8039,12 +8155,10 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
rtl_nway_reset(net); rtl_nway_reset(net);
return rc;
out: out:
return rc; return rc;
} }
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0) */
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
@ -26187,7 +26301,7 @@ err1:
#ifdef ENABLE_DASH_SUPPORT #ifdef ENABLE_DASH_SUPPORT
if (tp->DASH) { if (tp->DASH) {
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { if (HW_DASH_SUPPORT_CMAC(tp)) {
tp->timer_intr_mask |= (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET); tp->timer_intr_mask |= (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
tp->intr_mask |= (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET); tp->intr_mask |= (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET);
} else { } else {
@ -26660,12 +26774,19 @@ err1:
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
if (rtl8168_support_eee(tp)) { if (rtl8168_support_eee(tp)) {
struct ethtool_eee *eee = &tp->eee; struct ethtool_keee *eee = &tp->eee;
eee->eee_enabled = eee_enable; eee->eee_enabled = eee_enable;
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0)
eee->supported = SUPPORTED_100baseT_Full | eee->supported = SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Full; SUPPORTED_1000baseT_Full;
eee->advertised = mmd_eee_adv_to_ethtool_adv_t(MDIO_EEE_1000T | MDIO_EEE_100TX); eee->advertised = mmd_eee_adv_to_ethtool_adv_t(MDIO_EEE_1000T | MDIO_EEE_100TX);
#else
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, eee->supported);
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, eee->supported);
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, eee->advertised);
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, eee->advertised);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) */
eee->tx_lpi_enabled = eee_enable; eee->tx_lpi_enabled = eee_enable;
eee->tx_lpi_timer = dev->mtu + ETH_HLEN + 0x20; eee->tx_lpi_timer = dev->mtu + ETH_HLEN + 0x20;
} }
@ -28178,6 +28299,31 @@ rtl8168_link_timer(struct timer_list *t)
*/ */
#ifndef ENABLE_RSS_SUPPORT #ifndef ENABLE_RSS_SUPPORT
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
static int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
int minvec, int maxvec)
{
int nvec = maxvec;
int rc;
if (maxvec < minvec)
return -ERANGE;
do {
rc = pci_enable_msix(dev, entries, nvec);
if (rc < 0) {
return rc;
} else if (rc > 0) {
if (rc < minvec)
return -ENOSPC;
nvec = rc;
}
} while (rc);
return nvec;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) */
static int rtl8168_enable_msix(struct rtl8168_private *tp) static int rtl8168_enable_msix(struct rtl8168_private *tp)
{ {
int i, nvecs = 0; int i, nvecs = 0;
@ -28629,7 +28775,9 @@ rtl8168_init_one(struct pci_dev *pdev,
netif_carrier_off(dev); netif_carrier_off(dev);
#ifdef ENABLE_R8168_SYSFS
rtl8168_sysfs_init(dev); rtl8168_sysfs_init(dev);
#endif /* ENABLE_R8168_SYSFS */
printk("%s", GPL_CLAIM); printk("%s", GPL_CLAIM);
@ -29022,12 +29170,14 @@ static void
set_offset70F(struct rtl8168_private *tp, u8 setting) set_offset70F(struct rtl8168_private *tp, u8 setting)
{ {
u32 csi_tmp; u32 csi_tmp;
u32 temp = (u32)setting; u32 temp;
temp = temp << 24;
temp = setting & 0x3f;
temp <<= 24;
/*set PCI configuration space offset 0x70F to setting*/ /*set PCI configuration space offset 0x70F to setting*/
/*When the register offset of PCI configuration space larger than 0xff, use CSI to access it.*/ /*When the register offset of PCI configuration space larger than 0xff, use CSI to access it.*/
csi_tmp = rtl8168_csi_read(tp, 0x70c) & 0x00ffffff; csi_tmp = rtl8168_csi_read(tp, 0x70c) & 0xc0ffffff;
rtl8168_csi_write(tp, 0x70c, csi_tmp | temp); rtl8168_csi_write(tp, 0x70c, csi_tmp | temp);
} }
@ -29619,11 +29769,11 @@ rtl8168_hw_config(struct net_device *dev)
rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC);
#ifdef ENABLE_LIB_SUPPORT #ifdef ENABLE_LIB_SUPPORT
rtl8168_eri_write(tp, 0xCC, 1, 0x60, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xCC, 2, 0x60, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xD0, 1, 0x70, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xD0, 2, 0x70, ERIAR_ExGMAC);
#else #else
rtl8168_eri_write(tp, 0xCC, 1, 0x38, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xCC, 2, 0x38, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xD0, 1, 0x48, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xD0, 2, 0x48, ERIAR_ExGMAC);
#endif //ENABLE_LIB_SUPPORT #endif //ENABLE_LIB_SUPPORT
rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
@ -29761,8 +29911,8 @@ rtl8168_hw_config(struct net_device *dev)
set_offset79(tp, 0x50); set_offset79(tp, 0x50);
rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xCC, 1, 0x2F, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xCC, 2, 0x2F, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xD0, 1, 0x5F, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xD0, 2, 0x5F, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7); RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
@ -29836,8 +29986,8 @@ rtl8168_hw_config(struct net_device *dev)
set_offset79(tp, 0x50); set_offset79(tp, 0x50);
rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xC8, 4, 0x00080002, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xCC, 1, 0x2F, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xCC, 2, 0x2F, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xD0, 1, 0x5F, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xD0, 2, 0x5F, ERIAR_ExGMAC);
rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); rtl8168_eri_write(tp, 0xE8, 4, 0x00100006, ERIAR_ExGMAC);
RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7); RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | BIT_7);
@ -31867,9 +32017,11 @@ static int rtl8168_poll_vector(napi_ptr napi, napi_budget budget, bool all_rx_q)
if (all_rx_q) if (all_rx_q)
for (i = 0; i < tp->num_hw_tot_en_rx_rings; i++) for (i = 0; i < tp->num_hw_tot_en_rx_rings; i++)
work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ring[i], budget);
else else if (message_id < tp->num_rx_rings)
work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget);
work_done = min(work_done, work_to_do);
RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget);
if (work_done < work_to_do) { if (work_done < work_to_do) {
@ -31913,6 +32065,7 @@ static int rtl8168_poll_msix_rx(napi_ptr napi, napi_budget budget)
unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev);
unsigned int work_done = 0; unsigned int work_done = 0;
if (message_id < tp->num_rx_rings)
work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); work_done += rtl8168_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget);
RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget);

View File

@ -80,8 +80,6 @@ int rtl8168_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
netif_info(tp, drv, tp->dev, "rss get rxnfc\n");
if (!(dev->features & NETIF_F_RXHASH)) if (!(dev->features & NETIF_F_RXHASH))
return ret; return ret;
@ -136,8 +134,6 @@ static int rtl8168_set_rss_hash_opt(struct rtl8168_private *tp,
{ {
u32 rss_flags = tp->rss_flags; u32 rss_flags = tp->rss_flags;
netif_info(tp, drv, tp->dev, "rss set hash\n");
/* /*
* RSS does not support anything other than hashing * RSS does not support anything other than hashing
* to queues on src and dst IPs and ports * to queues on src and dst IPs and ports
@ -205,8 +201,6 @@ int rtl8168_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
netif_info(tp, drv, tp->dev, "rss set rxnfc\n");
if (!(dev->features & NETIF_F_RXHASH)) if (!(dev->features & NETIF_F_RXHASH))
return ret; return ret;
@ -230,8 +224,6 @@ u32 rtl8168_get_rxfh_key_size(struct net_device *dev)
{ {
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get key size\n");
if (!(dev->features & NETIF_F_RXHASH)) if (!(dev->features & NETIF_F_RXHASH))
return 0; return 0;
@ -242,8 +234,6 @@ u32 rtl8168_rss_indir_size(struct net_device *dev)
{ {
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get indir tbl size\n");
if (!(dev->features & NETIF_F_RXHASH)) if (!(dev->features & NETIF_F_RXHASH))
return 0; return 0;
@ -313,8 +303,6 @@ int rtl8168_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh)
{ {
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get rxfh\n");
if (!(dev->features & NETIF_F_RXHASH)) if (!(dev->features & NETIF_F_RXHASH))
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -336,8 +324,6 @@ int rtl8168_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
u32 reta_entries = rtl8168_rss_indir_tbl_entries(tp); u32 reta_entries = rtl8168_rss_indir_tbl_entries(tp);
int i; int i;
netif_info(tp, drv, tp->dev, "rss set rxfh\n");
/* We require at least one supported parameter to be changed and no /* We require at least one supported parameter to be changed and no
* change in any of the unsupported parameters * change in any of the unsupported parameters
*/ */
@ -373,8 +359,6 @@ int rtl8168_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
{ {
struct rtl8168_private *tp = netdev_priv(dev); struct rtl8168_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get rxfh\n");
if (!(dev->features & NETIF_F_RXHASH)) if (!(dev->features & NETIF_F_RXHASH))
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -397,8 +381,6 @@ int rtl8168_set_rxfh(struct net_device *dev, const u32 *indir,
u32 reta_entries = rtl8168_rss_indir_tbl_entries(tp); u32 reta_entries = rtl8168_rss_indir_tbl_entries(tp);
int i; int i;
netif_info(tp, drv, tp->dev, "rss set rxfh\n");
/* We require at least one supported parameter to be changed and no /* We require at least one supported parameter to be changed and no
* change in any of the unsupported parameters * change in any of the unsupported parameters
*/ */

View File

@ -2,7 +2,7 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # r8168 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.