Skip to content

Commit

Permalink
Imported version 8.050.00
Browse files Browse the repository at this point in the history
  • Loading branch information
mtorromeo committed May 6, 2022
1 parent 7e743a9 commit 058c081
Show file tree
Hide file tree
Showing 16 changed files with 1,592 additions and 332 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down
6 changes: 5 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down Expand Up @@ -43,6 +43,7 @@ ENABLE_EEE = y
ENABLE_S0_MAGIC_PACKET = n
CONFIG_DYNAMIC_ASPM = y
ENABLE_USE_FIRMWARE_FILE = n
CONFIG_CTAP_SHORT_OFF = n

ifneq ($(KERNELRELEASE),)
obj-m := r8168.o
Expand Down Expand Up @@ -93,6 +94,9 @@ ifneq ($(KERNELRELEASE),)
r8168-objs += r8168_firmware.o
EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE
endif
ifeq ($(CONFIG_CTAP_SHORT_OFF), y)
EXTRA_CFLAGS += -DCONFIG_CTAP_SHORT_OFF
endif
else
BASEDIR := /lib/modules/$(shell uname -r)
KERNELDIR ?= $(BASEDIR)/build
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile_linux24x
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down
42 changes: 33 additions & 9 deletions src/r8168.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down Expand Up @@ -138,6 +138,10 @@ do { \
#endif
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
#define eth_random_addr(addr) random_ether_addr(addr)
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
#define netdev_features_t u32
Expand Down Expand Up @@ -340,12 +344,12 @@ do { \
#define DASH_SUFFIX ""
#endif

#define RTL8168_VERSION "8.049.02" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX
#define RTL8168_VERSION "8.050.00" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX
#define MODULENAME "r8168"
#define PFX MODULENAME ": "

#define GPL_CLAIM "\
r8168 Copyright (C) 2021 Realtek NIC software team <nicfae@realtek.com> \n \
r8168 Copyright (C) 2022 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 is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>. \n"

Expand Down Expand Up @@ -428,12 +432,16 @@ This is free software, and you are welcome to redistribute it under certain cond
#define RTL8168_LINK_TIMEOUT (1 * HZ)
#define RTL8168_ESD_TIMEOUT (2 * HZ)

#define NUM_TX_DESC 1024 /* Number of Tx descriptor registers */
#define NUM_RX_DESC 1024 /* Number of Rx 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 MIN_NUM_TX_DESC 32 /* Minimum number of Tx descriptor registers */
#define MIN_NUM_RX_DESC 32 /* Minimum number of Rx descriptor registers */

#define NUM_TX_DESC 256 /* Number of Tx descriptor registers */
#define NUM_RX_DESC 256 /* Number of Rx descriptor registers */

#define RX_BUF_SIZE 0x05F3 /* 0x05F3 = 1522bye + 1 */
#define R8168_TX_RING_BYTES (NUM_TX_DESC * sizeof(struct TxDesc))
#define R8168_RX_RING_BYTES (NUM_RX_DESC * sizeof(struct RxDesc))

#define OCP_STD_PHY_BASE 0xa400

Expand Down Expand Up @@ -1467,6 +1475,15 @@ struct pci_resource {
u32 pci_sn_h;
};

/* Flow Control Settings */
enum rtl8168_fc_mode {
rtl8168_fc_none = 0,
rtl8168_fc_rx_pause,
rtl8168_fc_tx_pause,
rtl8168_fc_full,
rtl8168_fc_default
};

struct rtl8168_private {
void __iomem *mmio_addr; /* memory map physical address */
struct pci_dev *pci_dev; /* Index of PCI device */
Expand All @@ -1490,12 +1507,14 @@ struct rtl8168_private {
u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
u32 dirty_rx;
u32 dirty_tx;
u32 num_rx_desc; /* Number of Rx descriptor registers */
u32 num_tx_desc; /* Number of Tx descriptor registers */
struct TxDesc *TxDescArray; /* 256-aligned Tx descriptor ring */
struct RxDesc *RxDescArray; /* 256-aligned Rx descriptor ring */
dma_addr_t TxPhyAddr;
dma_addr_t RxPhyAddr;
struct sk_buff *Rx_skbuff[NUM_RX_DESC]; /* Rx data buffers */
struct ring_info tx_skb[NUM_TX_DESC]; /* Tx data buffers */
struct sk_buff *Rx_skbuff[MAX_NUM_RX_DESC]; /* Rx data buffers */
struct ring_info tx_skb[MAX_NUM_TX_DESC]; /* Tx data buffers */
unsigned rx_buf_sz;
struct timer_list esd_timer;
struct timer_list link_timer;
Expand Down Expand Up @@ -1523,6 +1542,7 @@ struct rtl8168_private {
u8 duplex;
u32 speed;
u32 advertising;
enum rtl8168_fc_mode fcpause;
u16 eeprom_len;
u16 cur_page;
u32 bios_setting;
Expand Down Expand Up @@ -1606,6 +1626,7 @@ struct rtl8168_private {
u8 HwSuppEsdVer;
u8 TestPhyOcpReg;
u16 BackupPhyFuseDout_15_0;
u16 BackupPhyFuseDout_31_16;
u16 BackupPhyFuseDout_47_32;
u16 BackupPhyFuseDout_63_48;

Expand Down Expand Up @@ -1746,6 +1767,8 @@ enum mcfg {
CFG_METHOD_31,
CFG_METHOD_32,
CFG_METHOD_33,
CFG_METHOD_34,
CFG_METHOD_35,
CFG_METHOD_MAX,
CFG_METHOD_DEFAULT = 0xFF
};
Expand Down Expand Up @@ -1786,6 +1809,7 @@ enum mcfg {
#define NIC_RAMCODE_VERSION_CFG_METHOD_28 (0x0019)
#define NIC_RAMCODE_VERSION_CFG_METHOD_29 (0x0055)
#define NIC_RAMCODE_VERSION_CFG_METHOD_31 (0x0003)
#define NIC_RAMCODE_VERSION_CFG_METHOD_35 (0x0004)

//hwoptimize
#define HW_PATCH_SOC_LAN (BIT_0)
Expand Down
2 changes: 1 addition & 1 deletion src/r8168_asf.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/r8168_asf.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/r8168_dash.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down
28 changes: 15 additions & 13 deletions src/r8168_fiber.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down Expand Up @@ -44,24 +44,26 @@ enum {

enum {
FIBER_STAT_NOT_CHECKED = 0,
FIBER_STAT_CONNECT,
FIBER_STAT_CONNECT_EEPROM,
FIBER_STAT_DISCONNECT,
FIBER_STAT_CONNECT_GPO,
FIBER_STAT_MAX
};

#define HW_FIBER_MODE_ENABLED(_M) ((_M)->HwFiberModeVer > 0)
#define HW_FIBER_STATUS_CONNECTED(_M) (((_M)->HwFiberStat == FIBER_STAT_CONNECT_EEPROM) || ((_M)->HwFiberStat == FIBER_STAT_CONNECT_GPO))
#define HW_FIBER_STATUS_DISCONNECTED(_M) ((_M)->HwFiberStat == FIBER_STAT_DISCONNECT)

struct rtl8168_private;


void rtl8168_hw_init_fiber_nic(struct net_device *dev);
void rtl8168_hw_fiber_nic_d3_para(struct net_device *dev);
void rtl8168_hw_fiber_phy_config(struct net_device *dev);
void rtl8168_hw_switch_mdi_to_fiber(struct net_device *dev);
void rtl8168_hw_switch_mdi_to_nic(struct net_device *dev);
unsigned int rtl8168_hw_fiber_link_ok(struct net_device *dev);
void rtl8168_check_fiber_link_status(struct net_device *dev);
void rtl8168_check_hw_fiber_mode_support(struct net_device *dev);
void rtl8168_set_fiber_mode_software_variable(struct net_device *dev);

void rtl8168_hw_init_fiber_nic(struct rtl8168_private *tp);
void rtl8168_hw_fiber_nic_d3_para(struct rtl8168_private *tp);
void rtl8168_hw_fiber_phy_config(struct rtl8168_private *tp);
void rtl8168_hw_switch_mdi_to_fiber(struct rtl8168_private *tp);
void rtl8168_hw_switch_mdi_to_nic(struct rtl8168_private *tp);
unsigned int rtl8168_hw_fiber_link_ok(struct rtl8168_private *tp);
void rtl8168_check_fiber_link_status(struct rtl8168_private *tp);
void rtl8168_check_hw_fiber_mode_support(struct rtl8168_private *tp);
void rtl8168_set_fiber_mode_software_variable(struct rtl8168_private *tp);

#endif /* _LINUX_R8168_FIBER_H */
2 changes: 1 addition & 1 deletion src/r8168_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down
2 changes: 1 addition & 1 deletion src/r8168_firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# r8168 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved.
#
# 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
Expand Down
Loading

0 comments on commit 058c081

Please sign in to comment.