r8125: update to 9.013.02

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-04-26 16:28:57 +02:00
parent 3ef36b7514
commit 9a3f472139
16 changed files with 5136 additions and 5884 deletions

View File

@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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
@ -41,7 +41,7 @@ ENABLE_S5_KEEP_CURR_MAC = n
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 = n 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 = n

View File

@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

153
r8125.h
View File

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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
@ -47,6 +47,10 @@
#include "r8125_lib.h" #include "r8125_lib.h"
#endif #endif
#ifndef fallthrough
#define fallthrough
#endif
#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)
@ -89,11 +93,13 @@ static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
unsigned int bytes) unsigned int bytes)
{} {
}
static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
unsigned int pkts, unsigned int pkts,
unsigned int bytes) unsigned int bytes)
{} {
}
static inline void netdev_tx_reset_queue(struct netdev_queue *q) {} static inline void netdev_tx_reset_queue(struct netdev_queue *q) {}
#endif #endif
@ -380,6 +386,10 @@ do { \
#define MDIO_EEE_1000T 0x0004 #define MDIO_EEE_1000T 0x0004
#endif #endif
#ifndef MDIO_EEE_2_5GT
#define MDIO_EEE_2_5GT 0x0001
#endif
#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=rtl8125_netpoll #define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8125_netpoll
@ -464,19 +474,19 @@ do { \
#define RSS_SUFFIX "" #define RSS_SUFFIX ""
#endif #endif
#define RTL8125_VERSION "9.012.04" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX #define RTL8125_VERSION "9.013.02" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX
#define MODULENAME "r8125" #define MODULENAME "r8125"
#define PFX MODULENAME ": " #define PFX MODULENAME ": "
#define GPL_CLAIM "\ #define GPL_CLAIM "\
r8125 Copyright (C) 2023 Realtek NIC software team <nicfae@realtek.com> \n \ r8125 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"
#ifdef RTL8125_DEBUG #ifdef RTL8125_DEBUG
#define assert(expr) \ #define assert(expr) \
if(!(expr)) { \ if(!(expr)) { \
printk( "Assertion failed! %s,%s,%s,line=%d\n", \ printk("Assertion failed! %s,%s,%s,line=%d\n", \
#expr,__FILE__,__FUNCTION__,__LINE__); \ #expr,__FILE__,__FUNCTION__,__LINE__); \
} }
#define dprintk(fmt, args...) do { printk(PFX fmt, ## args); } while (0) #define dprintk(fmt, args...) do { printk(PFX fmt, ## args); } while (0)
@ -516,6 +526,7 @@ This is free software, and you are welcome to redistribute it under certain cond
#define Reserved2_data 7 #define Reserved2_data 7
#define RX_DMA_BURST_unlimited 7 /* Maximum PCI burst, '7' is unlimited */ #define RX_DMA_BURST_unlimited 7 /* Maximum PCI burst, '7' is unlimited */
#define RX_DMA_BURST_512 5 #define RX_DMA_BURST_512 5
#define RX_DMA_BURST_256 4
#define TX_DMA_BURST_unlimited 7 #define TX_DMA_BURST_unlimited 7
#define TX_DMA_BURST_1024 6 #define TX_DMA_BURST_1024 6
#define TX_DMA_BURST_512 5 #define TX_DMA_BURST_512 5
@ -553,7 +564,10 @@ This is free software, and you are welcome to redistribute it under certain cond
#define R8125_MAX_MSIX_VEC_8125A 4 #define R8125_MAX_MSIX_VEC_8125A 4
#define R8125_MAX_MSIX_VEC_8125B 32 #define R8125_MAX_MSIX_VEC_8125B 32
#define R8125_MAX_MSIX_VEC_8125D 32
#define R8125_MIN_MSIX_VEC_8125B 22 #define R8125_MIN_MSIX_VEC_8125B 22
#define R8125_MIN_MSIX_VEC_8125BP 31
#define R8125_MIN_MSIX_VEC_8125D 20
#define R8125_MAX_MSIX_VEC 32 #define R8125_MAX_MSIX_VEC 32
#define R8125_MAX_RX_QUEUES_VEC_V3 (16) #define R8125_MAX_RX_QUEUES_VEC_V3 (16)
@ -662,7 +676,6 @@ 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_ADVERTISE_2500FULL 0x80 #define RTK_ADVERTISE_2500FULL 0x80
#define RTK_ADVERTISE_5000FULL 0x100 #define RTK_ADVERTISE_5000FULL 0x100
@ -692,7 +705,6 @@ This is free software, and you are welcome to redistribute it under certain cond
#define D0_SPEED_UP_SPEED_DISABLE 0 #define D0_SPEED_UP_SPEED_DISABLE 0
#define D0_SPEED_UP_SPEED_1000 1 #define D0_SPEED_UP_SPEED_1000 1
#define D0_SPEED_UP_SPEED_2500 2 #define D0_SPEED_UP_SPEED_2500 2
#define D0_SPEED_UP_SPEED_5000 3
#define RTL8125_MAC_MCU_PAGE_SIZE 256 //256 words #define RTL8125_MAC_MCU_PAGE_SIZE 256 //256 words
@ -703,16 +715,12 @@ This is free software, and you are welcome to redistribute it under certain cond
#define READ_ONCE(var) (*((volatile typeof(var) *)(&(var)))) #define READ_ONCE(var) (*((volatile typeof(var) *)(&(var))))
#endif #endif
#ifndef SPEED_5000
#define SPEED_5000 5000
#endif
/*****************************************************************************/ /*****************************************************************************/
//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) //#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)
#if (( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) ) || \ #if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)) || \
(( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) && \ ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && \
( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) ))) (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3))))
/* copied from linux kernel 2.6.20 include/linux/netdev.h */ /* copied from linux kernel 2.6.20 include/linux/netdev.h */
#define NETDEV_ALIGN 32 #define NETDEV_ALIGN 32
#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
@ -848,7 +856,7 @@ extern void __chk_io_ptr(void __iomem *);
/*****************************************************************************/ /*****************************************************************************/
/* 2.5.28 => 2.4.23 */ /* 2.5.28 => 2.4.23 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28))
static inline void _kc_synchronize_irq(void) static inline void _kc_synchronize_irq(void)
{ {
@ -869,12 +877,12 @@ static inline void _kc_synchronize_irq(void)
/*****************************************************************************/ /*****************************************************************************/
/* 2.6.4 => 2.6.0 */ /* 2.6.4 => 2.6.0 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4))
#define MODULE_VERSION(_version) MODULE_INFO(version, _version) #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
#endif /* 2.6.4 => 2.6.0 */ #endif /* 2.6.4 => 2.6.0 */
/*****************************************************************************/ /*****************************************************************************/
/* 2.6.0 => 2.5.28 */ /* 2.6.0 => 2.5.28 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
#define MODULE_INFO(version, _version) #define MODULE_INFO(version, _version)
#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT #ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
#define CONFIG_E1000_DISABLE_PACKET_SPLIT 1 #define CONFIG_E1000_DISABLE_PACKET_SPLIT 1
@ -905,13 +913,13 @@ static inline int _kc_pci_dma_mapping_error(dma_addr_t dma_addr)
/*****************************************************************************/ /*****************************************************************************/
/* 2.4.22 => 2.4.17 */ /* 2.4.22 => 2.4.17 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22))
#define pci_name(x) ((x)->slot_name) #define pci_name(x) ((x)->slot_name)
#endif /* 2.4.22 => 2.4.17 */ #endif /* 2.4.22 => 2.4.17 */
/*****************************************************************************/ /*****************************************************************************/
/* 2.6.5 => 2.6.0 */ /* 2.6.5 => 2.6.0 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) ) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5))
#define pci_dma_sync_single_for_cpu pci_dma_sync_single #define pci_dma_sync_single_for_cpu pci_dma_sync_single
#define pci_dma_sync_single_for_device pci_dma_sync_single_for_cpu #define pci_dma_sync_single_for_device pci_dma_sync_single_for_cpu
#endif /* 2.6.5 => 2.6.0 */ #endif /* 2.6.5 => 2.6.0 */
@ -1357,6 +1365,13 @@ enum RTL8125_registers {
IMR_V2_SET_REG_8125 = 0x0D0C, IMR_V2_SET_REG_8125 = 0x0D0C,
TDU_STA_8125 = 0x0D08, TDU_STA_8125 = 0x0D08,
RDU_STA_8125 = 0x0D0A, RDU_STA_8125 = 0x0D0A,
IMR_V4_L2_CLEAR_REG_8125 = 0x0D10,
IMR_V4_L2_SET_REG_8125 = 0x0D18,
ISR_V4_L2_8125 = 0x0D14,
SW_TAIL_PTR0_8125BP = 0x0D30,
SW_TAIL_PTR1_8125BP = 0x0D38,
HW_CLO_PTR0_8125BP = 0x0D34,
HW_CLO_PTR1_8125BP = 0x0D3C,
DOUBLE_VLAN_CONFIG = 0x1000, DOUBLE_VLAN_CONFIG = 0x1000,
TX_NEW_CTRL = 0x203E, TX_NEW_CTRL = 0x203E,
TNPDS_Q1_LOW_8125 = 0x2100, TNPDS_Q1_LOW_8125 = 0x2100,
@ -1399,6 +1414,11 @@ enum RTL8125_registers {
TCAM_VALID_ADDR_V2 = 0xB000, TCAM_VALID_ADDR_V2 = 0xB000,
TCAM_MAC_ADDR_V2 = 0x00, TCAM_MAC_ADDR_V2 = 0x00,
TCAM_VLAN_TAG_V2 = 0x03, TCAM_VLAN_TAG_V2 = 0x03,
//ipc2
IB2SOC_SET = 0x0010,
IB2SOC_DATA = 0x0014,
IB2SOC_CMD = 0x0018,
IB2SOC_IMR = 0x001C,
}; };
enum RTL8125_register_content { enum RTL8125_register_content {
@ -1428,6 +1448,10 @@ enum RTL8125_register_content {
RxRUNT_V3 = (1 << 19), RxRUNT_V3 = (1 << 19),
RxCRC_V3 = (1 << 17), RxCRC_V3 = (1 << 17),
RxRES_V4 = (1 << 22),
RxRUNT_V4 = (1 << 21),
RxCRC_V4 = (1 << 20),
/* ChipCmdBits */ /* ChipCmdBits */
StopReq = 0x80, StopReq = 0x80,
CmdReset = 0x10, CmdReset = 0x10,
@ -1462,6 +1486,7 @@ enum RTL8125_register_content {
Reserved2_shift = 13, Reserved2_shift = 13,
RxCfgDMAShift = 8, RxCfgDMAShift = 8,
EnableRxDescV3 = (1 << 24), EnableRxDescV3 = (1 << 24),
EnableRxDescV4_1 = (1 << 24),
EnableOuterVlan = (1 << 23), EnableOuterVlan = (1 << 23),
EnableInnerVlan = (1 << 22), EnableInnerVlan = (1 << 22),
RxCfg_128_int_en = (1 << 15), RxCfg_128_int_en = (1 << 15),
@ -1469,6 +1494,7 @@ enum RTL8125_register_content {
RxCfg_half_refetch = (1 << 13), RxCfg_half_refetch = (1 << 13),
RxCfg_pause_slot_en = (1 << 11), RxCfg_pause_slot_en = (1 << 11),
RxCfg_9356SEL = (1 << 6), RxCfg_9356SEL = (1 << 6),
EnableRxDescV4_0 = (1 << 1), //not in rcr
/* TxConfigBits */ /* TxConfigBits */
TxInterFrameGapShift = 24, TxInterFrameGapShift = 24,
@ -1637,11 +1663,20 @@ enum RTL8125_register_content {
INT_CFG0_TIMEOUT0_BYPASS_8125 = (1 << 1), INT_CFG0_TIMEOUT0_BYPASS_8125 = (1 << 1),
INT_CFG0_MITIGATION_BYPASS_8125 = (1 << 2), INT_CFG0_MITIGATION_BYPASS_8125 = (1 << 2),
INT_CFG0_RDU_BYPASS_8126 = (1 << 4), INT_CFG0_RDU_BYPASS_8126 = (1 << 4),
INT_CFG0_MSIX_ENTRY_NUM_MODE = (1 << 5),
ISRIMR_V2_ROK_Q0 = (1 << 0), ISRIMR_V2_ROK_Q0 = (1 << 0),
ISRIMR_TOK_Q0 = (1 << 16), ISRIMR_TOK_Q0 = (1 << 16),
ISRIMR_TOK_Q1 = (1 << 18), ISRIMR_TOK_Q1 = (1 << 18),
ISRIMR_V2_LINKCHG = (1 << 21), ISRIMR_V2_LINKCHG = (1 << 21),
ISRIMR_V4_ROK_Q0 = (1 << 0),
ISRIMR_V4_LINKCHG = (1 << 29),
ISRIMR_V5_ROK_Q0 = (1 << 0),
ISRIMR_V5_TOK_Q0 = (1 << 16),
ISRIMR_V5_TOK_Q1 = (1 << 17),
ISRIMR_V5_LINKCHG = (1 << 18),
/* Magic Number */ /* Magic Number */
RTL8125_MAGIC_NUMBER = 0x0badbadbadbadbadull, RTL8125_MAGIC_NUMBER = 0x0badbadbadbadbadull,
}; };
@ -1657,6 +1692,11 @@ enum _DescStatusBit {
FirstFrag_V3 = (1 << 25), /* First segment of a packet */ FirstFrag_V3 = (1 << 25), /* First segment of a packet */
LastFrag_V3 = (1 << 24), /* Final segment of a packet */ LastFrag_V3 = (1 << 24), /* Final segment of a packet */
DescOwn_V4 = (DescOwn), /* Descriptor is owned by NIC */
RingEnd_V4 = (RingEnd), /* End of descriptor ring */
FirstFrag_V4 = (FirstFrag), /* First segment of a packet */
LastFrag_V4 = (LastFrag), /* Final segment of a packet */
/* Tx private */ /* Tx private */
/*------ offset 0 of tx descriptor ------*/ /*------ offset 0 of tx descriptor ------*/
LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */ LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */
@ -1715,7 +1755,7 @@ enum _DescStatusBit {
RxIPF_v3 = (1 << 26), /* IP checksum failed */ RxIPF_v3 = (1 << 26), /* IP checksum failed */
RxUDPF_v3 = (1 << 25), /* UDP/IP checksum failed */ RxUDPF_v3 = (1 << 25), /* UDP/IP checksum failed */
RxTCPF_v3 = (1 << 24), /* TCP/IP checksum failed */ RxTCPF_v3 = (1 << 24), /* TCP/IP checksum failed */
RxSCTPF_v3 = (1 << 23), /* TCP/IP checksum failed */ RxSCTPF_v3 = (1 << 23), /* SCTP checksum failed */
RxVlanTag_v3 = (RxVlanTag), /* VLAN tag available */ RxVlanTag_v3 = (RxVlanTag), /* VLAN tag available */
/*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/
@ -1728,6 +1768,23 @@ enum _DescStatusBit {
RxV6F_v3 = (RxV6F), RxV6F_v3 = (RxV6F),
RxV4F_v3 = (RxV4F), RxV4F_v3 = (RxV4F),
/*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/ /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/
RxIPF_v4 = (1 << 17), /* IP checksum failed */
RxUDPF_v4 = (1 << 16), /* UDP/IP checksum failed */
RxTCPF_v4 = (1 << 15), /* TCP/IP checksum failed */
RxSCTPF_v4 = (1 << 19), /* SCTP checksum failed */
RxVlanTag_v4 = (RxVlanTag), /* VLAN tag available */
/*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/
RxUDPT_v4 = (1 << 19),
RxTCPT_v4 = (1 << 18),
RxSCTP_v4 = (1 << 19),
/*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only end @@@@@@*/
/*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only begin @@@@@@*/
RxV6F_v4 = (RxV6F),
RxV4F_v4 = (RxV4F),
/*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/
}; };
enum features { enum features {
@ -1796,6 +1853,7 @@ enum efuse {
}; };
#define RsvdMask 0x3fffc000 #define RsvdMask 0x3fffc000
#define RsvdMaskV3 0x3fff8000 #define RsvdMaskV3 0x3fff8000
#define RsvdMaskV4 RsvdMaskV3
struct TxDesc { struct TxDesc {
u32 opts1; u32 opts1;
@ -1862,6 +1920,23 @@ struct RxDescV3 {
}; };
}; };
struct RxDescV4 {
union {
u64 addr;
struct {
u32 rsv1: 27;
u32 RSSInfo: 5;
u32 RSSResult;
} RxDescNormalDDWord1;
};
struct {
u32 opts2;
u32 opts1;
} RxDescNormalDDWord2;
};
enum rxdesc_type { enum rxdesc_type {
RXDESC_TYPE_NORMAL=0, RXDESC_TYPE_NORMAL=0,
RXDESC_TYPE_NEXT, RXDESC_TYPE_NEXT,
@ -1875,12 +1950,14 @@ enum rx_desc_ring_type {
RX_DESC_RING_TYPE_1, RX_DESC_RING_TYPE_1,
RX_DESC_RING_TYPE_2, RX_DESC_RING_TYPE_2,
RX_DESC_RING_TYPE_3, RX_DESC_RING_TYPE_3,
RX_DESC_RING_TYPE_4,
RX_DESC_RING_TYPE_MAX RX_DESC_RING_TYPE_MAX
}; };
enum rx_desc_len { enum rx_desc_len {
RX_DESC_LEN_TYPE_1 = (sizeof(struct RxDesc)), RX_DESC_LEN_TYPE_1 = (sizeof(struct RxDesc)),
RX_DESC_LEN_TYPE_3 = (sizeof(struct RxDescV3)) RX_DESC_LEN_TYPE_3 = (sizeof(struct RxDescV3)),
RX_DESC_LEN_TYPE_4 = (sizeof(struct RxDescV4))
}; };
struct ring_info { struct ring_info {
@ -2351,6 +2428,8 @@ struct rtl8125_private {
u8 RequiredSecLanDonglePatch; u8 RequiredSecLanDonglePatch;
u8 RequiredPfmPatch;
u8 RequirePhyMdiSwapPatch; u8 RequirePhyMdiSwapPatch;
u8 RequireLSOPatch; u8 RequireLSOPatch;
@ -2404,6 +2483,8 @@ struct rtl8125_private {
u8 DASH; u8 DASH;
u8 dash_printer_enabled; u8 dash_printer_enabled;
u8 HwPkgDet; u8 HwPkgDet;
u8 HwSuppOcpChannelVer;
u8 AllowAccessDashOcp;
void __iomem *mapped_cmac_ioaddr; /* mapped cmac memory map physical address */ void __iomem *mapped_cmac_ioaddr; /* mapped cmac memory map physical address */
void __iomem *cmac_ioaddr; /* cmac memory map physical address */ void __iomem *cmac_ioaddr; /* cmac memory map physical address */
@ -2501,6 +2582,7 @@ struct rtl8125_private {
DECLARE_BITMAP(sysfs_flag, R8125_SYSFS_FLAG_MAX); DECLARE_BITMAP(sysfs_flag, R8125_SYSFS_FLAG_MAX);
u32 testmode; u32 testmode;
#endif #endif
u8 HwSuppRxDescType;
u8 InitRxDescType; u8 InitRxDescType;
u16 RxDescLength; //V1 16 Byte V2 32 Bytes u16 RxDescLength; //V1 16 Byte V2 32 Bytes
@ -2613,6 +2695,7 @@ enum mcfg {
CFG_METHOD_8, CFG_METHOD_8,
CFG_METHOD_9, CFG_METHOD_9,
CFG_METHOD_10, CFG_METHOD_10,
CFG_METHOD_11,
CFG_METHOD_DEFAULT, CFG_METHOD_DEFAULT,
CFG_METHOD_MAX CFG_METHOD_MAX
}; };
@ -2646,10 +2729,11 @@ enum mcfg {
#define NIC_RAMCODE_VERSION_CFG_METHOD_2 (0x0b11) #define NIC_RAMCODE_VERSION_CFG_METHOD_2 (0x0b11)
#define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0b33) #define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0b33)
#define NIC_RAMCODE_VERSION_CFG_METHOD_4 (0x0b17) #define NIC_RAMCODE_VERSION_CFG_METHOD_4 (0x0b17)
#define NIC_RAMCODE_VERSION_CFG_METHOD_5 (0x0b74) #define NIC_RAMCODE_VERSION_CFG_METHOD_5 (0x0b99)
#define NIC_RAMCODE_VERSION_CFG_METHOD_8 (0x0023) #define NIC_RAMCODE_VERSION_CFG_METHOD_8 (0x0013)
#define NIC_RAMCODE_VERSION_CFG_METHOD_9 (0x0033) #define NIC_RAMCODE_VERSION_CFG_METHOD_9 (0x0001)
#define NIC_RAMCODE_VERSION_CFG_METHOD_10 (0x0001) #define NIC_RAMCODE_VERSION_CFG_METHOD_10 (0x0007)
#define NIC_RAMCODE_VERSION_CFG_METHOD_11 (0x0001)
//hwoptimize //hwoptimize
#define HW_PATCH_SOC_LAN (BIT_0) #define HW_PATCH_SOC_LAN (BIT_0)
@ -2690,17 +2774,25 @@ void rtl8125_dash2_disable_rx(struct rtl8125_private *tp);
void rtl8125_dash2_enable_rx(struct rtl8125_private *tp); void rtl8125_dash2_enable_rx(struct rtl8125_private *tp);
void rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev); void rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev);
void rtl8125_mark_to_asic(struct rtl8125_private *tp, struct RxDesc *desc, u32 rx_buf_sz); void rtl8125_mark_to_asic(struct rtl8125_private *tp, struct RxDesc *desc, u32 rx_buf_sz);
void rtl8125_mark_as_last_descriptor(struct rtl8125_private *tp, struct RxDesc *desc);
static inline void static inline void
rtl8125_make_unusable_by_asic(struct rtl8125_private *tp, rtl8125_make_unusable_by_asic(struct rtl8125_private *tp,
struct RxDesc *desc) struct RxDesc *desc)
{ {
if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { switch (tp->InitRxDescType) {
case RX_DESC_RING_TYPE_3:
((struct RxDescV3 *)desc)->addr = RTL8125_MAGIC_NUMBER; ((struct RxDescV3 *)desc)->addr = RTL8125_MAGIC_NUMBER;
((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV3); ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV3);
} else { break;
case RX_DESC_RING_TYPE_4:
((struct RxDescV4 *)desc)->addr = RTL8125_MAGIC_NUMBER;
((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV4);
break;
default:
desc->addr = RTL8125_MAGIC_NUMBER; desc->addr = RTL8125_MAGIC_NUMBER;
desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
break;
} }
} }
@ -2746,7 +2838,7 @@ static inline void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { }
static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { } static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { }
#endif #endif
#define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M) ((_M)->HwSuppCheckPhyDisableModeVer > 0 ) #define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M) ((_M)->HwSuppCheckPhyDisableModeVer > 0)
#define HW_HAS_WRITE_PHY_MCU_RAM_CODE(_M) (((_M)->HwHasWrRamCodeToMicroP == TRUE) ? 1 : 0) #define HW_HAS_WRITE_PHY_MCU_RAM_CODE(_M) (((_M)->HwHasWrRamCodeToMicroP == TRUE) ? 1 : 0)
#define HW_SUPPORT_D0_SPEED_UP(_M) ((_M)->HwSuppD0SpeedUpVer > 0) #define HW_SUPPORT_D0_SPEED_UP(_M) ((_M)->HwSuppD0SpeedUpVer > 0)
#define HW_SUPPORT_MAC_MCU(_M) ((_M)->HwSuppMacMcuVer > 0) #define HW_SUPPORT_MAC_MCU(_M) ((_M)->HwSuppMacMcuVer > 0)
@ -2754,7 +2846,6 @@ static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { }
#define HW_SUPP_PHY_LINK_SPEED_GIGA(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 1000) #define HW_SUPP_PHY_LINK_SPEED_GIGA(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 1000)
#define HW_SUPP_PHY_LINK_SPEED_2500M(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 2500) #define HW_SUPP_PHY_LINK_SPEED_2500M(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 2500)
#define HW_SUPP_PHY_LINK_SPEED_5000M(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 5000)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
#define netdev_mc_count(dev) ((dev)->mc_count) #define netdev_mc_count(dev) ((dev)->mc_count)

View File

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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
@ -164,6 +164,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,10 +176,16 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2;
#define OCP_REG_CONFIG0_DRV_WAIT_OOB BIT_8 #define OCP_REG_CONFIG0_DRV_WAIT_OOB BIT_8
#define OCP_REG_CONFIG0_TLSEN BIT_7 #define OCP_REG_CONFIG0_TLSEN BIT_7
#define HW_DASH_SUPPORT_DASH(_M) ((_M)->HwSuppDashVer > 0 ) #define HW_DASH_SUPPORT_DASH(_M) ((_M)->HwSuppDashVer > 0)
#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_TYPE_4(_M) ((_M)->HwSuppDashVer == 4)
#define HW_DASH_SUPPORT_CMAC(_M) (HW_DASH_SUPPORT_TYPE_2(_M) || HW_DASH_SUPPORT_TYPE_3(_M))
#define HW_DASH_SUPPORT_IPC2(_M) (HW_DASH_SUPPORT_TYPE_4(_M))
#define HW_DASH_SUPPORT_GET_FIRMWARE_VERSION(_M) (HW_DASH_SUPPORT_TYPE_2(_M) || \
HW_DASH_SUPPORT_TYPE_3(_M) || \
HW_DASH_SUPPORT_TYPE_4(_M))
#define RECV_FROM_FW_BUF_SIZE (1520) #define RECV_FROM_FW_BUF_SIZE (1520)
#define SEND_TO_FW_BUF_SIZE (1520) #define SEND_TO_FW_BUF_SIZE (1520)

View File

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

10434
r8125_n.c

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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
@ -60,21 +60,21 @@ static int rtl8125_get_rss_hash_opts(struct rtl8125_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 UDP_V4_FLOW: case UDP_V4_FLOW:
if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4) if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4)
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 UDP_V6_FLOW: case UDP_V6_FLOW:
if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6) if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6)
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;
@ -324,28 +324,6 @@ static void rtl8125_get_reta(struct rtl8125_private *tp, u32 *indir)
indir[i] = tp->rss_indir_tbl[i]; indir[i] = tp->rss_indir_tbl[i];
} }
int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
u8 *hfunc)
{
struct rtl8125_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)
rtl8125_get_reta(tp, indir);
if (key)
memcpy(key, tp->rss_key, RTL8125_RSS_KEY_SIZE);
return 0;
}
static u32 rtl8125_rss_key_reg(struct rtl8125_private *tp) static u32 rtl8125_rss_key_reg(struct rtl8125_private *tp)
{ {
return RSS_KEY_8125; return RSS_KEY_8125;
@ -386,6 +364,88 @@ static void rtl8125_store_rss_key(struct rtl8125_private *tp)
RTL_W32(tp, rss_key_reg + i, *rss_key++); RTL_W32(tp, rss_key_reg + i, *rss_key++);
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
int rtl8125_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh)
{
struct rtl8125_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)
rtl8125_get_reta(tp, rxfh->indir);
if (rxfh->key)
memcpy(rxfh->key, tp->rss_key, RTL8125_RSS_KEY_SIZE);
return 0;
}
int rtl8125_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{
struct rtl8125_private *tp = netdev_priv(dev);
int i;
u32 reta_entries = rtl8125_rss_indir_tbl_entries(tp);
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, RTL8125_RSS_KEY_SIZE);
rtl8125_store_reta(tp);
rtl8125_store_rss_key(tp);
return 0;
}
#else
int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
u8 *hfunc)
{
struct rtl8125_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)
rtl8125_get_reta(tp, indir);
if (key)
memcpy(key, tp->rss_key, RTL8125_RSS_KEY_SIZE);
return 0;
}
int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir, int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir,
const u8 *key, const u8 hfunc) const u8 *key, const u8 hfunc)
{ {
@ -424,11 +484,19 @@ int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir,
return 0; return 0;
} }
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */
static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp, static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp,
struct RxDescV3 *descv3) struct RxDesc *desc)
{ {
return le32_to_cpu(descv3->RxDescNormalDDWord2.RSSResult); switch (tp->InitRxDescType) {
case RX_DESC_RING_TYPE_3:
return le32_to_cpu(((struct RxDescV3 *)desc)->RxDescNormalDDWord2.RSSResult);
case RX_DESC_RING_TYPE_4:
return le32_to_cpu(((struct RxDescV4 *)desc)->RxDescNormalDDWord1.RSSResult);
default:
return 0;
}
} }
#define RXS_8125B_RSS_UDP BIT(9) #define RXS_8125B_RSS_UDP BIT(9)
@ -437,7 +505,14 @@ static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp,
#define RXS_8125_RSS_TCP BIT(13) #define RXS_8125_RSS_TCP BIT(13)
#define RTL8125_RXS_RSS_L3_TYPE_MASK (RXS_8125_RSS_IPV4 | RXS_8125_RSS_IPV6) #define RTL8125_RXS_RSS_L3_TYPE_MASK (RXS_8125_RSS_IPV4 | RXS_8125_RSS_IPV6)
#define RTL8125_RXS_RSS_L4_TYPE_MASK (RXS_8125_RSS_TCP | RXS_8125B_RSS_UDP) #define RTL8125_RXS_RSS_L4_TYPE_MASK (RXS_8125_RSS_TCP | RXS_8125B_RSS_UDP)
void rtl8125_rx_hash(struct rtl8125_private *tp,
#define RXS_8125B_RSS_UDP_V4 BIT(11)
#define RXS_8125_RSS_IPV4_V4 BIT(12)
#define RXS_8125_RSS_IPV6_V4 BIT(13)
#define RXS_8125_RSS_TCP_V4 BIT(14)
#define RTL8125_RXS_RSS_L3_TYPE_MASK_V4 (RXS_8125_RSS_IPV4_V4 | RXS_8125_RSS_IPV6_V4)
#define RTL8125_RXS_RSS_L4_TYPE_MASK_V4 (RXS_8125_RSS_TCP_V4 | RXS_8125B_RSS_UDP_V4)
static void rtl8125_rx_hash_v3(struct rtl8125_private *tp,
struct RxDescV3 *descv3, struct RxDescV3 *descv3,
struct sk_buff *skb) struct sk_buff *skb)
{ {
@ -451,11 +526,46 @@ void rtl8125_rx_hash(struct rtl8125_private *tp,
if (!(rss_header_info & RTL8125_RXS_RSS_L3_TYPE_MASK)) if (!(rss_header_info & RTL8125_RXS_RSS_L3_TYPE_MASK))
return; return;
skb_set_hash(skb, rtl8125_get_rx_desc_hash(tp, descv3), skb_set_hash(skb, rtl8125_get_rx_desc_hash(tp, (struct RxDesc *)descv3),
(RTL8125_RXS_RSS_L4_TYPE_MASK & rss_header_info) ? (RTL8125_RXS_RSS_L4_TYPE_MASK & rss_header_info) ?
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
} }
static void rtl8125_rx_hash_v4(struct rtl8125_private *tp,
struct RxDescV4 *descv4,
struct sk_buff *skb)
{
u16 rss_header_info;
if (!(tp->dev->features & NETIF_F_RXHASH))
return;
rss_header_info = le16_to_cpu(descv4->RxDescNormalDDWord1.RSSInfo);
if (!(rss_header_info & RTL8125_RXS_RSS_L3_TYPE_MASK_V4))
return;
skb_set_hash(skb, rtl8125_get_rx_desc_hash(tp, (struct RxDesc *)descv4),
(RTL8125_RXS_RSS_L4_TYPE_MASK_V4 & rss_header_info) ?
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
}
void rtl8125_rx_hash(struct rtl8125_private *tp,
struct RxDesc *desc,
struct sk_buff *skb)
{
switch (tp->InitRxDescType) {
case RX_DESC_RING_TYPE_3:
rtl8125_rx_hash_v3(tp, (struct RxDescV3 *)desc, skb);
break;
case RX_DESC_RING_TYPE_4:
rtl8125_rx_hash_v4(tp, (struct RxDescV4 *)desc, skb);
break;
default:
return;
}
}
void rtl8125_disable_rss(struct rtl8125_private *tp) void rtl8125_disable_rss(struct rtl8125_private *tp)
{ {
RTL_W32(tp, RSS_CTRL_8125, 0x00); RTL_W32(tp, RSS_CTRL_8125, 0x00);

View File

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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
@ -47,18 +47,25 @@ enum rtl8125_rss_flag {
}; };
struct rtl8125_private; struct rtl8125_private;
struct RxDesc;
int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
u32 *rule_locs); u32 *rule_locs);
int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd); int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd);
u32 rtl8125_get_rxfh_key_size(struct net_device *netdev); u32 rtl8125_get_rxfh_key_size(struct net_device *netdev);
u32 rtl8125_rss_indir_size(struct net_device *netdev); u32 rtl8125_rss_indir_size(struct net_device *netdev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
int rtl8125_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh);
int rtl8125_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack);
#else
int rtl8125_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, int rtl8125_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
u8 *hfunc); u8 *hfunc);
int rtl8125_set_rxfh(struct net_device *netdev, const u32 *indir, int rtl8125_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 rtl8125_rx_hash(struct rtl8125_private *tp, void rtl8125_rx_hash(struct rtl8125_private *tp,
struct RxDescV3 *descv3, struct RxDesc *desc,
struct sk_buff *skb); struct sk_buff *skb);
void _rtl8125_config_rss(struct rtl8125_private *tp); void _rtl8125_config_rss(struct rtl8125_private *tp);
void rtl8125_config_rss(struct rtl8125_private *tp); void rtl8125_config_rss(struct rtl8125_private *tp);

View File

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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 rtl8125_eeprom_cleanup(struct rtl8125_private *tp)
rtl8125_lower_clock(tp, &x); rtl8125_lower_clock(tp, &x);
} }
int rtl8125_eeprom_cmd_done(struct rtl8125_private *tp) static int rtl8125_eeprom_cmd_done(struct rtl8125_private *tp)
{ {
u8 x; u8 x;
int i; int i;
@ -123,9 +123,8 @@ u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg)
u8 x; u8 x;
u16 data; u16 data;
if(tp->eeprom_type == EEPROM_TYPE_NONE) { if(tp->eeprom_type == EEPROM_TYPE_NONE)
return -1; return -1;
}
if (tp->eeprom_type==EEPROM_TYPE_93C46) if (tp->eeprom_type==EEPROM_TYPE_93C46)
addr_sz = 6; addr_sz = 6;
@ -157,9 +156,8 @@ void rtl8125_eeprom_write_sc(struct rtl8125_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 +176,15 @@ void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data)
rtl8125_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3); rtl8125_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3);
rtl8125_shift_out_bits(tp, reg, addr_sz); rtl8125_shift_out_bits(tp, reg, addr_sz);
if (rtl8125_eeprom_cmd_done(tp) < 0) { if (rtl8125_eeprom_cmd_done(tp) < 0)
return; return;
}
rtl8125_stand_by(tp); rtl8125_stand_by(tp);
rtl8125_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3); rtl8125_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3);
rtl8125_shift_out_bits(tp, reg, addr_sz); rtl8125_shift_out_bits(tp, reg, addr_sz);
rtl8125_shift_out_bits(tp, data, 16); rtl8125_shift_out_bits(tp, data, 16);
if (rtl8125_eeprom_cmd_done(tp) < 0) { if (rtl8125_eeprom_cmd_done(tp) < 0)
return; return;
}
rtl8125_stand_by(tp); rtl8125_stand_by(tp);
rtl8125_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5); rtl8125_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5);
@ -207,7 +203,6 @@ void rtl8125_raise_clock(struct rtl8125_private *tp, u8 *x)
void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x) void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x)
{ {
*x = *x & ~Cfg9346_EESK; *x = *x & ~Cfg9346_EESK;
RTL_W8(tp, Cfg9346, *x); RTL_W8(tp, Cfg9346, *x);
udelay(RTL_CLOCK_RATE); udelay(RTL_CLOCK_RATE);

View File

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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

@ -2,10 +2,10 @@
/* /*
################################################################################ ################################################################################
# #
# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet # r8125 is the Linux device driver released for Realtek 2.5 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