r8168: bump to 8.053.00

Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
sbwml 2024-05-27 01:15:35 +08:00
parent 7cc1685602
commit a0874ab757
19 changed files with 2182 additions and 1883 deletions

View File

@ -1,13 +1,13 @@
# #
# Download realtek r8168 linux driver from official site: # Download realtek r8168 linux driver from official site:
# [https://www.realtek.com/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software] # [https://www.realtek.com/Download/List?cate_id=584]
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8168 PKG_NAME:=r8168
PKG_VERSION:=8.052.01 PKG_VERSION:=8.053.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)
@ -17,7 +17,6 @@ include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8168 define KernelPackage/r8168
TITLE:=Driver for Realtek r8168 chipsets TITLE:=Driver for Realtek r8168 chipsets
SUBMENU:=Network Devices SUBMENU:=Network Devices
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
DEPENDS:=@PCI_SUPPORT DEPENDS:=@PCI_SUPPORT
FILES:= $(PKG_BUILD_DIR)/r8168.ko FILES:= $(PKG_BUILD_DIR)/r8168.ko
AUTOLOAD:=$(call AutoProbe,r8168) AUTOLOAD:=$(call AutoProbe,r8168)

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>
@@ -25852,6 +25853,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_private *tp) @@ -25945,6 +25946,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)
{ {
@@ -26547,6 +26564,8 @@ err1: @@ -26640,6 +26657,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

@ -4,7 +4,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -4,7 +4,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free
@ -49,6 +49,69 @@
#endif #endif
*/ */
#ifndef fallthrough
#define fallthrough
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
static inline
ssize_t strscpy(char *dest, const char *src, size_t count)
{
long res = 0;
if (count == 0)
return -E2BIG;
while (count) {
char c;
c = src[res];
dest[res] = c;
if (!c)
return res;
res++;
count--;
}
/* Hit buffer length without finding a NUL; force NUL-termination. */
if (res)
dest[res-1] = '\0';
return -E2BIG;
}
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0))
static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
return skb->head + skb->csum_start;
#else /* < 2.6.22 */
return skb_transport_header(skb);
#endif
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
unsigned int bytes)
{}
static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
unsigned int pkts,
unsigned int bytes)
{}
static inline void netdev_tx_reset_queue(struct netdev_queue *q) {}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0)
#define netdev_xmit_more() (0)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)
#define netif_testing_on(dev)
#define netif_testing_off(dev)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
typedef int netdev_tx_t; typedef int netdev_tx_t;
#endif #endif
@ -175,6 +238,10 @@ do { \
#define ENABLE_R8168_PROCFS #define ENABLE_R8168_PROCFS
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#define ENABLE_R8168_SYSFS
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
#define NETIF_F_HW_VLAN_RX NETIF_F_HW_VLAN_CTAG_RX #define NETIF_F_HW_VLAN_RX NETIF_F_HW_VLAN_CTAG_RX
#define NETIF_F_HW_VLAN_TX NETIF_F_HW_VLAN_CTAG_TX #define NETIF_F_HW_VLAN_TX NETIF_F_HW_VLAN_CTAG_TX
@ -364,12 +431,12 @@ do { \
#define RSS_SUFFIX "" #define RSS_SUFFIX ""
#endif #endif
#define RTL8168_VERSION "8.052.01" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX RSS_SUFFIX #define RTL8168_VERSION "8.053.00" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX RSS_SUFFIX
#define MODULENAME "r8168" #define MODULENAME "r8168"
#define PFX MODULENAME ": " #define PFX MODULENAME ": "
#define GPL_CLAIM "\ #define GPL_CLAIM "\
r8168 Copyright (C) 2023 Realtek NIC software team <nicfae@realtek.com> \n \ r8168 Copyright (C) 2024 Realtek NIC software team <nicfae@realtek.com> \n \
This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>. \n \ This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>. \n \
This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>. \n" This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>. \n"
@ -453,6 +520,7 @@ This is free software, and you are welcome to redistribute it under certain cond
#define RTL8168_TX_TIMEOUT (6 * HZ) #define RTL8168_TX_TIMEOUT (6 * HZ)
#define RTL8168_LINK_TIMEOUT (1 * HZ) #define RTL8168_LINK_TIMEOUT (1 * HZ)
#define RTL8168_ESD_TIMEOUT (2 * HZ) #define RTL8168_ESD_TIMEOUT (2 * HZ)
#define RTL8168_DASH_TIMEOUT (0)
#define MAX_NUM_TX_DESC 1024 /* Maximum number of Tx descriptor registers */ #define MAX_NUM_TX_DESC 1024 /* Maximum number of Tx descriptor registers */
#define MAX_NUM_RX_DESC 1024 /* Maximum number of Rx descriptor registers */ #define MAX_NUM_RX_DESC 1024 /* Maximum number of Rx descriptor registers */
@ -635,6 +703,23 @@ typedef int napi_budget;
#define RTL_NAPI_DEL(priv) netif_napi_del(&priv->napi) #define RTL_NAPI_DEL(priv) netif_napi_del(&priv->napi)
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
/*****************************************************************************/
#ifdef CONFIG_R8168_NAPI
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) napi_consume_skb(skb, budget)
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_consume_skb_any(skb);
#else
#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_kfree_skb_any(skb);
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
#else //CONFIG_R8168_NAPI
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_consume_skb_any(skb);
#else
#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_kfree_skb_any(skb);
#endif
#endif //CONFIG_R8168_NAPI
/*****************************************************************************/ /*****************************************************************************/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
#ifdef __CHECKER__ #ifdef __CHECKER__
@ -1487,7 +1572,7 @@ enum bits {
}; };
#define RTL8168_CP_NUM 4 #define RTL8168_CP_NUM 4
#define RTL8168_MAX_SUPPORT_cp_len 110 #define RTL8168_MAX_SUPPORT_CP_LEN 110
enum rtl8168_cp_status { enum rtl8168_cp_status {
rtl8168_cp_normal = 0, rtl8168_cp_normal = 0,
@ -1543,6 +1628,8 @@ enum rx_desc_len {
struct ring_info { struct ring_info {
struct sk_buff *skb; struct sk_buff *skb;
u32 len; u32 len;
unsigned int bytecount;
unsigned short gso_segs;
u8 __pad[sizeof(void *) - sizeof(u32)]; u8 __pad[sizeof(void *) - sizeof(u32)];
}; };
@ -1566,14 +1653,29 @@ struct pci_resource {
u32 pci_sn_h; u32 pci_sn_h;
}; };
enum r8168_dash_req_flag {
R8168_RCV_REQ_SYS_OK = 0,
R8168_RCV_REQ_DASH_OK,
R8168_SEND_REQ_HOST_OK,
R8168_CMAC_RESET,
R8168_CMAC_DISALE_RX_FLAG_MAX,
R8168_DASH_REQ_FLAG_MAX
};
enum r8168_flag { enum r8168_flag {
R8168_FLAG_DOWN = 0, R8168_FLAG_DOWN = 0,
R8168_FLAG_TASK_RESET_PENDING, R8168_FLAG_TASK_RESET_PENDING,
R8168_FLAG_TASK_ESD_CHECK_PENDING, R8168_FLAG_TASK_ESD_CHECK_PENDING,
R8168_FLAG_TASK_LINKCHG_CHECK_PENDING, R8168_FLAG_TASK_LINKCHG_CHECK_PENDING,
R8168_FLAG_TASK_DASH_CHECK_PENDING,
R8168_FLAG_MAX R8168_FLAG_MAX
}; };
enum r8168_sysfs_flag {
R8168_SYSFS_RTL_ADV = 0,
R8168_SYSFS_FLAG_MAX
};
/* Flow Control Settings */ /* Flow Control Settings */
enum rtl8168_fc_mode { enum rtl8168_fc_mode {
rtl8168_fc_none = 0, rtl8168_fc_none = 0,
@ -1585,6 +1687,7 @@ enum rtl8168_fc_mode {
struct rtl8168_tx_ring { struct rtl8168_tx_ring {
void* priv; void* priv;
struct net_device *netdev;
u32 index; u32 index;
u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
u32 dirty_tx; u32 dirty_tx;
@ -1600,6 +1703,7 @@ struct rtl8168_tx_ring {
struct rtl8168_rx_ring { struct rtl8168_rx_ring {
void* priv; void* priv;
struct net_device *netdev;
u32 index; u32 index;
u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
u32 dirty_rx; u32 dirty_rx;
@ -1880,10 +1984,12 @@ struct rtl8168_private {
struct work_struct reset_task; struct work_struct reset_task;
struct work_struct esd_task; struct work_struct esd_task;
struct work_struct linkchg_task; struct work_struct linkchg_task;
struct work_struct dash_task;
#else #else
struct delayed_work reset_task; struct delayed_work reset_task;
struct delayed_work esd_task; struct delayed_work esd_task;
struct delayed_work linkchg_task; struct delayed_work linkchg_task;
struct delayed_work dash_task;
#endif #endif
DECLARE_BITMAP(task_flags, R8168_FLAG_MAX); DECLARE_BITMAP(task_flags, R8168_FLAG_MAX);
unsigned features; unsigned features;
@ -1968,6 +2074,7 @@ struct rtl8168_private {
u8 dash_printer_enabled; u8 dash_printer_enabled;
u8 HwPkgDet; u8 HwPkgDet;
void __iomem *cmac_ioaddr; /* cmac memory map physical address */ void __iomem *cmac_ioaddr; /* cmac memory map physical address */
DECLARE_BITMAP(dash_req_flags, R8168_DASH_REQ_FLAG_MAX);
#ifdef ENABLE_DASH_SUPPORT #ifdef ENABLE_DASH_SUPPORT
u16 AfterRecvFromFwBufLen; u16 AfterRecvFromFwBufLen;
@ -1984,12 +2091,6 @@ struct rtl8168_private {
u32 OobReqComplete; u32 OobReqComplete;
u32 OobAckComplete; u32 OobAckComplete;
u8 RcvFwReqSysOkEvt;
u8 RcvFwDashOkEvt;
u8 SendFwHostOkEvt;
u8 DashFwDisableRx;
void *SendToFwBuffer; void *SendToFwBuffer;
dma_addr_t SendToFwBufferPhy; dma_addr_t SendToFwBufferPhy;
u8 SendingToFw; u8 SendingToFw;
@ -2049,6 +2150,13 @@ struct rtl8168_private {
#ifdef ENABLE_R8168_PROCFS #ifdef ENABLE_R8168_PROCFS
//Procfs support //Procfs support
struct proc_dir_entry *proc_dir; struct proc_dir_entry *proc_dir;
struct proc_dir_entry *proc_dir_debug;
struct proc_dir_entry *proc_dir_test;
#endif
#ifdef ENABLE_R8168_SYSFS
//sysfs support
DECLARE_BITMAP(sysfs_flag, R8168_SYSFS_FLAG_MAX);
u32 testmode;
#endif #endif
u8 HwSuppRxDescType; u8 HwSuppRxDescType;
u8 InitRxDescType; u8 InitRxDescType;
@ -2087,7 +2195,7 @@ rtl8168_num_lib_rx_rings(struct rtl8168_private *tp)
{ {
int count, i; int count, i;
for (count = 0, i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) for (count = 0, i = 1; i < tp->HwSuppNumRxQueues; i++)
if(tp->lib_rx_ring[i].enabled) if(tp->lib_rx_ring[i].enabled)
count++; count++;
@ -2118,7 +2226,7 @@ rtl8168_lib_rx_ring_released(struct rtl8168_private *tp)
int i; int i;
bool released = 0; bool released = 0;
for (i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) { for (i = 1; i < tp->HwSuppNumRxQueues; i++) {
struct rtl8168_ring *ring = &tp->lib_rx_ring[i]; struct rtl8168_ring *ring = &tp->lib_rx_ring[i];
if (ring->allocated) if (ring->allocated)
goto exit; goto exit;
@ -2169,6 +2277,11 @@ rtl8168_tot_rx_rings(struct rtl8168_private *tp)
return tp->num_rx_rings + rtl8168_num_lib_rx_rings(tp); return tp->num_rx_rings + rtl8168_num_lib_rx_rings(tp);
} }
static inline struct netdev_queue *txring_txq(const struct rtl8168_tx_ring *ring)
{
return netdev_get_tx_queue(ring->netdev, ring->index);
}
static inline bool static inline bool
rtl8168_lib_all_ring_released(struct rtl8168_private *tp) rtl8168_lib_all_ring_released(struct rtl8168_private *tp)
{ {
@ -2328,6 +2441,31 @@ rtl8168_get_rxdesc(struct rtl8168_private *tp, struct RxDesc *RxDescBase, u32 co
return (struct RxDesc*)desc; return (struct RxDesc*)desc;
} }
#ifdef ENABLE_DASH_SUPPORT
static inline void
rtl8168_enable_dash2_interrupt(struct rtl8168_private *tp)
{
if (!tp->DASH)
return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(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));
}
}
static inline void
rtl8168_disable_dash2_interrupt(struct rtl8168_private *tp)
{
if (!tp->DASH)
return;
if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) {
RTL_CMAC_W8(tp, CMAC_IBIMR0, 0);
}
}
#endif
static inline void static inline void
rtl8168_disable_interrupt_by_vector(struct rtl8168_private *tp, rtl8168_disable_interrupt_by_vector(struct rtl8168_private *tp,
u32 message_id) u32 message_id)

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free
@ -247,6 +247,7 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2;
#define RTL_CMAC_R32(tp, reg) ((unsigned long) readl (tp->cmac_ioaddr + (reg))) #define RTL_CMAC_R32(tp, reg) ((unsigned long) readl (tp->cmac_ioaddr + (reg)))
int rtl8168_dash_ioctl(struct net_device *dev, struct ifreq *ifr); int rtl8168_dash_ioctl(struct net_device *dev, struct ifreq *ifr);
bool CheckDashInterrupt(struct net_device *dev, u16 status);
void HandleDashInterrupt(struct net_device *dev); void HandleDashInterrupt(struct net_device *dev);
int AllocateDashShareMemory(struct net_device *dev); int AllocateDashShareMemory(struct net_device *dev);
void FreeAllocatedDashShareMemory(struct net_device *dev); void FreeAllocatedDashShareMemory(struct net_device *dev);

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 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) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free
@ -57,13 +57,13 @@ static int rtl8168_get_rss_hash_opts(struct rtl8168_private *tp,
switch (cmd->flow_type) { switch (cmd->flow_type) {
case TCP_V4_FLOW: case TCP_V4_FLOW:
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
/* fallthrough */ fallthrough;
case IPV4_FLOW: case IPV4_FLOW:
cmd->data |= RXH_IP_SRC | RXH_IP_DST; cmd->data |= RXH_IP_SRC | RXH_IP_DST;
break; break;
case TCP_V6_FLOW: case TCP_V6_FLOW:
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
/* fallthrough */ fallthrough;
case IPV6_FLOW: case IPV6_FLOW:
cmd->data |= RXH_IP_SRC | RXH_IP_DST; cmd->data |= RXH_IP_SRC | RXH_IP_DST;
break; break;
@ -258,28 +258,6 @@ static void rtl8168_get_reta(struct rtl8168_private *tp, u32 *indir)
indir[i] = tp->rss_indir_tbl[i]; indir[i] = tp->rss_indir_tbl[i];
} }
int rtl8168_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
u8 *hfunc)
{
struct rtl8168_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get rxfh\n");
if (!(dev->features & NETIF_F_RXHASH))
return -EOPNOTSUPP;
if (hfunc)
*hfunc = ETH_RSS_HASH_TOP;
if (indir)
rtl8168_get_reta(tp, indir);
if (key)
memcpy(key, tp->rss_key, RTL8168_RSS_KEY_SIZE);
return 0;
}
static u32 rtl8168_rss_key_reg(struct rtl8168_private *tp) static u32 rtl8168_rss_key_reg(struct rtl8168_private *tp)
{ {
return RSS_KEY_8168; return RSS_KEY_8168;
@ -330,6 +308,88 @@ static void rtl8168_store_rss_key(struct rtl8168_private *tp)
rtl8168_eri_write(tp, rss_key_reg + i, 4, *rss_key++, ERIAR_ExGMAC); rtl8168_eri_write(tp, rss_key_reg + i, 4, *rss_key++, ERIAR_ExGMAC);
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
int rtl8168_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh)
{
struct rtl8168_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get rxfh\n");
if (!(dev->features & NETIF_F_RXHASH))
return -EOPNOTSUPP;
rxfh->hfunc = ETH_RSS_HASH_TOP;
if (rxfh->indir)
rtl8168_get_reta(tp, rxfh->indir);
if (rxfh->key)
memcpy(rxfh->key, tp->rss_key, RTL8168_RSS_KEY_SIZE);
return 0;
}
int rtl8168_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{
struct rtl8168_private *tp = netdev_priv(dev);
u32 reta_entries = rtl8168_rss_indir_tbl_entries(tp);
int i;
netif_info(tp, drv, tp->dev, "rss set rxfh\n");
/* We require at least one supported parameter to be changed and no
* change in any of the unsupported parameters
*/
if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
/* Fill out the redirection table */
if (rxfh->indir) {
int max_queues = tp->num_rx_rings;
/* Verify user input. */
for (i = 0; i < reta_entries; i++)
if (rxfh->indir[i] >= max_queues)
return -EINVAL;
for (i = 0; i < reta_entries; i++)
tp->rss_indir_tbl[i] = rxfh->indir[i];
}
/* Fill out the rss hash key */
if (rxfh->key)
memcpy(tp->rss_key, rxfh->key, RTL8168_RSS_KEY_SIZE);
rtl8168_store_reta(tp);
rtl8168_store_rss_key(tp);
return 0;
}
#else
int rtl8168_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
u8 *hfunc)
{
struct rtl8168_private *tp = netdev_priv(dev);
netif_info(tp, drv, tp->dev, "rss get rxfh\n");
if (!(dev->features & NETIF_F_RXHASH))
return -EOPNOTSUPP;
if (hfunc)
*hfunc = ETH_RSS_HASH_TOP;
if (indir)
rtl8168_get_reta(tp, indir);
if (key)
memcpy(key, tp->rss_key, RTL8168_RSS_KEY_SIZE);
return 0;
}
int rtl8168_set_rxfh(struct net_device *dev, const u32 *indir, int rtl8168_set_rxfh(struct net_device *dev, const u32 *indir,
const u8 *key, const u8 hfunc) const u8 *key, const u8 hfunc)
{ {
@ -368,6 +428,7 @@ int rtl8168_set_rxfh(struct net_device *dev, const u32 *indir,
return 0; return 0;
} }
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */
static u32 rtl8168_get_rx_desc_hash(struct rtl8168_private *tp, static u32 rtl8168_get_rx_desc_hash(struct rtl8168_private *tp,
struct RxDescV2 *desc) struct RxDescV2 *desc)

View File

@ -5,7 +5,7 @@
# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free
@ -50,10 +50,16 @@ int rtl8168_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
int rtl8168_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd); int rtl8168_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd);
u32 rtl8168_get_rxfh_key_size(struct net_device *netdev); u32 rtl8168_get_rxfh_key_size(struct net_device *netdev);
u32 rtl8168_rss_indir_size(struct net_device *netdev); u32 rtl8168_rss_indir_size(struct net_device *netdev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
int rtl8168_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh);
int rtl8168_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack);
#else
int rtl8168_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, int rtl8168_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
u8 *hfunc); u8 *hfunc);
int rtl8168_set_rxfh(struct net_device *netdev, const u32 *indir, int rtl8168_set_rxfh(struct net_device *netdev, const u32 *indir,
const u8 *key, const u8 hfunc); const u8 *key, const u8 hfunc);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */
void rtl8168_rx_hash(struct rtl8168_private *tp, void rtl8168_rx_hash(struct rtl8168_private *tp,
struct RxDescV2 *desc, struct RxDescV2 *desc,
struct sk_buff *skb); struct sk_buff *skb);

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free
@ -93,7 +93,7 @@ void rtl8168_eeprom_cleanup(struct rtl8168_private *tp)
rtl8168_lower_clock(tp, &x); rtl8168_lower_clock(tp, &x);
} }
int rtl8168_eeprom_cmd_done(struct rtl8168_private *tp) static int rtl8168_eeprom_cmd_done(struct rtl8168_private *tp)
{ {
u8 x; u8 x;
int i; int i;
@ -157,9 +157,8 @@ void rtl8168_eeprom_write_sc(struct rtl8168_private *tp, u16 reg, u16 data)
int addr_sz = 6; int addr_sz = 6;
int w_dummy_addr = 4; int w_dummy_addr = 4;
if(tp->eeprom_type == EEPROM_TYPE_NONE) { if(tp->eeprom_type == EEPROM_TYPE_NONE)
return; return;
}
if (tp->eeprom_type==EEPROM_TYPE_93C46) { if (tp->eeprom_type==EEPROM_TYPE_93C46) {
addr_sz = 6; addr_sz = 6;
@ -178,17 +177,15 @@ void rtl8168_eeprom_write_sc(struct rtl8168_private *tp, u16 reg, u16 data)
rtl8168_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3); rtl8168_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3);
rtl8168_shift_out_bits(tp, reg, addr_sz); rtl8168_shift_out_bits(tp, reg, addr_sz);
if (rtl8168_eeprom_cmd_done(tp) < 0) { if (rtl8168_eeprom_cmd_done(tp) < 0)
return; return;
}
rtl8168_stand_by(tp); rtl8168_stand_by(tp);
rtl8168_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3); rtl8168_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3);
rtl8168_shift_out_bits(tp, reg, addr_sz); rtl8168_shift_out_bits(tp, reg, addr_sz);
rtl8168_shift_out_bits(tp, data, 16); rtl8168_shift_out_bits(tp, data, 16);
if (rtl8168_eeprom_cmd_done(tp) < 0) { if (rtl8168_eeprom_cmd_done(tp) < 0)
return; return;
}
rtl8168_stand_by(tp); rtl8168_stand_by(tp);
rtl8168_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5); rtl8168_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5);

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free

View File

@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface. # controllers with PCI-Express interface.
# #
# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. # Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free # under the terms of the GNU General Public License as published by the Free