Projects
Essentials
r8168
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 18
View file
r8168.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Tue Aug 24 13:01:21 UTC 2021 - Luigi Baldoni <aloisio@gmx.com> + +- Update to version 8.049.02 + +------------------------------------------------------------------- Thu Jan 21 15:49:06 UTC 2021 - Werner Fink <werner@suse.de> - Now we change to github for basic download
View file
r8168.spec
Changed
@@ -1,7 +1,7 @@ # # spec file for package r8168 # -# Copyright (c) 2019 Packman Team <packman@links2linux.de> +# Copyright (c) 2021 Packman Team <packman@links2linux.de> # Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ #!BuildIgnore: enough-build-resources Name: r8168 -Version: 8.048.03 +Version: 8.049.02 Release: 0 Summary: Device driver for RealTek Gigabit Ethernet controllers License: GPL-2.0-or-later
View file
r8168-8.048.03.tar.gz/Makefile -> r8168-8.049.02.tar.gz/Makefile
Changed
@@ -1,9 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-only ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2019 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/autorun.sh -> r8168-8.049.02.tar.gz/autorun.sh
Changed
@@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only # invoke insmod with all arguments we got # and use a pathname, as insmod doesn't look in . by default
View file
r8168-8.048.03.tar.gz/src/Makefile -> r8168-8.049.02.tar.gz/src/Makefile
Changed
@@ -1,9 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-only ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2019 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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 @@ -40,6 +41,8 @@ ENABLE_S5_KEEP_CURR_MAC = n ENABLE_EEE = y ENABLE_S0_MAGIC_PACKET = n +CONFIG_DYNAMIC_ASPM = y +ENABLE_USE_FIRMWARE_FILE = n ifneq ($(KERNELRELEASE),) obj-m := r8168.o @@ -83,6 +86,13 @@ ifeq ($(ENABLE_S0_MAGIC_PACKET), y) EXTRA_CFLAGS += -DENABLE_S0_MAGIC_PACKET endif + ifeq ($(CONFIG_DYNAMIC_ASPM), y) + EXTRA_CFLAGS += -DCONFIG_DYNAMIC_ASPM + endif + ifeq ($(ENABLE_USE_FIRMWARE_FILE), y) + r8168-objs += r8168_firmware.o + EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE + endif else BASEDIR := /lib/modules/$(shell uname -r) KERNELDIR ?= $(BASEDIR)/build
View file
r8168-8.048.03.tar.gz/src/Makefile_linux24x -> r8168-8.049.02.tar.gz/src/Makefile_linux24x
Changed
@@ -1,9 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-only ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2019 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/src/r8168.h -> r8168-8.049.02.tar.gz/src/r8168.h
Changed
@@ -1,10 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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 @@ -36,6 +37,10 @@ #include "r8168_realwow.h" #include "r8168_fiber.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) +typedef int netdev_tx_t; +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) #define skb_transport_offset(skb) (skb->h.raw - skb->data) #endif @@ -335,12 +340,12 @@ #define DASH_SUFFIX "" #endif -#define RTL8168_VERSION "8.048.03" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX +#define RTL8168_VERSION "8.049.02" NAPI_SUFFIX FIBER_SUFFIX REALWOW_SUFFIX DASH_SUFFIX #define MODULENAME "r8168" #define PFX MODULENAME ": " #define GPL_CLAIM "\ -r8168 Copyright (C) 2020 Realtek NIC software team <nicfae@realtek.com> \n \ +r8168 Copyright (C) 2021 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" @@ -430,6 +435,8 @@ #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 + #define NODE_ADDRESS_SIZE 6 #define SHORT_PACKET_PADDING_BUF_SIZE 256 @@ -492,6 +499,10 @@ #define ADVERTISE_1000HALF 0x100 #endif +#ifndef ETH_MIN_MTU +#define ETH_MIN_MTU 68 +#endif + /*****************************************************************************/ //#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) @@ -1173,6 +1184,7 @@ PMEnable = (1 << 0), /* Power Management Enable */ /* Config2 register */ + ClkReqEn = (1 << 7), /* Clock Request Enable */ PMSTS_En = (1 << 5), /* Config3 register */ @@ -1194,6 +1206,7 @@ UWF = (1 << 4), /* Accept Unicast wakeup frame */ LanWake = (1 << 1), /* LanWake enable/disable */ PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ + ASPM_en = (1 << 0), /* ASPM enable */ /* CPlusCmd */ EnableBist = (1 << 15), @@ -1554,9 +1567,6 @@ u8 UseSwPaddingShortPkt; - void *ShortPacketEmptyBuffer; - dma_addr_t ShortPacketEmptyBufferPhy; - u8 RequireAdcBiasPatch; u16 AdcBiasPatchIoffset; @@ -1575,20 +1585,34 @@ u8 HwSuppPhyOcpVer; + u8 HwSuppAspmClkIntrLock; + u16 NicCustLedValue; + u8 HwSuppUpsVer; + u8 HwSuppMagicPktVer; u8 HwSuppCheckPhyDisableModeVer; u8 random_mac; - u8 HwSuppGigaForceMode; - + u16 phy_reg_aner; u16 phy_reg_anlpar; + u16 phy_reg_gbsr; u32 HwPcieSNOffset; + u8 HwSuppEsdVer; + u8 TestPhyOcpReg; + u16 BackupPhyFuseDout_15_0; + u16 BackupPhyFuseDout_47_32; + u16 BackupPhyFuseDout_63_48; + + const char *fw_name; + struct rtl8168_fw *rtl_fw; + u32 ocp_base; + //Dash+++++++++++++++++ u8 HwSuppDashVer; u8 DASH; @@ -1618,37 +1642,29 @@ u8 DashFwDisableRx; - void *UnalignedSendToFwBufferVa; void *SendToFwBuffer ; - u64 SendToFwBufferPhy ; + dma_addr_t SendToFwBufferPhy ; u8 SendingToFw; - dma_addr_t UnalignedSendToFwBufferPa; PTX_DASH_SEND_FW_DESC TxDashSendFwDesc; - u64 TxDashSendFwDescPhy; - u8 *UnalignedTxDashSendFwDescVa; + dma_addr_t TxDashSendFwDescPhy; u32 SizeOfTxDashSendFwDescMemAlloc; u32 SizeOfTxDashSendFwDesc ; u32 NumTxDashSendFwDesc ; u32 CurrNumTxDashSendFwDesc ; u32 LastSendNumTxDashSendFwDesc ; - dma_addr_t UnalignedTxDashSendFwDescPa; u32 NumRecvFromFwBuffer ; u32 SizeOfRecvFromFwBuffer ; u32 SizeOfRecvFromFwBufferMemAlloc ; void *RecvFromFwBuffer ; - u64 RecvFromFwBufferPhy ; + dma_addr_t RecvFromFwBufferPhy ; - void *UnalignedRecvFromFwBufferVa; - dma_addr_t UnalignedRecvFromFwBufferPa; PRX_DASH_FROM_FW_DESC RxDashRecvFwDesc; - u64 RxDashRecvFwDescPhy; - u8 *UnalignedRxDashRecvFwDescVa; + dma_addr_t RxDashRecvFwDescPhy; u32 SizeOfRxDashRecvFwDescMemAlloc; u32 SizeOfRxDashRecvFwDesc ; u32 NumRxDashRecvFwDesc ; u32 CurrNumRxDashRecvFwDesc ; - dma_addr_t UnalignedRxDashRecvFwDescPa; u8 DashReqRegValue; u16 HostReqValue; @@ -1681,6 +1697,8 @@ u32 eee_adv_t; u8 eee_enabled; + u32 dynamic_aspm_packet_count; + #ifdef ENABLE_R8168_PROCFS //Procfs support struct proc_dir_entry *proc_dir; @@ -1773,10 +1791,14 @@ #define HW_PATCH_SOC_LAN (BIT_0) #define HW_PATCH_SAMSUNG_LAN_DONGLE (BIT_2) -void rtl8168_mdio_write(struct rtl8168_private *tp, u32 RegAddr, u32 value); +#define HW_PHY_STATUS_INI 1 +#define HW_PHY_STATUS_EXT_INI 2 +#define HW_PHY_STATUS_LAN_ON 3 + +void rtl8168_mdio_write(struct rtl8168_private *tp, u16 RegAddr, u16 value); void rtl8168_mdio_prot_write(struct rtl8168_private *tp, u32 RegAddr, u32 value); void rtl8168_mdio_prot_direct_write_phy_ocp(struct rtl8168_private *tp, u32 RegAddr, u32 value); -u32 rtl8168_mdio_read(struct rtl8168_private *tp, u32 RegAddr); +u32 rtl8168_mdio_read(struct rtl8168_private *tp, u16 RegAddr); u32 rtl8168_mdio_prot_read(struct rtl8168_private *tp, u32 RegAddr); u32 rtl8168_mdio_prot_direct_read_phy_ocp(struct rtl8168_private *tp, u32 RegAddr); void rtl8168_ephy_write(struct rtl8168_private *tp, int RegAddr, int value); @@ -1789,7 +1811,6 @@ void rtl8168_init_ring_indexes(struct rtl8168_private *tp); int rtl8168_eri_write(struct rtl8168_private *tp, int addr, int len, u32 value, int type); void rtl8168_oob_mutex_lock(struct rtl8168_private *tp); -u32 rtl8168_mdio_read(struct rtl8168_private *tp, u32 RegAddr); u32 rtl8168_ocp_read(struct rtl8168_private *tp, u16 addr, u8 len); u32 rtl8168_ocp_read_with_oob_base_address(struct rtl8168_private *tp, u16 addr, u8 len, u32 base_address); u32 rtl8168_ocp_write_with_oob_base_address(struct rtl8168_private *tp, u16 addr, u8 len, u32 value, u32 base_address); @@ -1811,6 +1832,7 @@ #define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M) ((_M)->HwSuppCheckPhyDisableModeVer > 0 )
View file
r8168-8.048.03.tar.gz/src/r8168_asf.c -> r8168-8.049.02.tar.gz/src/r8168_asf.c
Changed
@@ -1,10 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-only /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/src/r8168_asf.h -> r8168-8.049.02.tar.gz/src/r8168_asf.h
Changed
@@ -1,10 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/src/r8168_dash.h -> r8168-8.049.02.tar.gz/src/r8168_dash.h
Changed
@@ -1,10 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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 @@ -114,25 +115,23 @@ }; typedef struct _RX_DASH_FROM_FW_DESC { - u16 length; - u8 statusLowByte; - u8 statusHighByte; - u32 resv; - u64 BufferAddress; + __le16 length; + __le16 status; + __le32 resv; + __le64 BufferAddress; } RX_DASH_FROM_FW_DESC, *PRX_DASH_FROM_FW_DESC; typedef struct _TX_DASH_SEND_FW_DESC { - u16 length; - u8 statusLowByte; - u8 statusHighByte; - u32 resv; - u64 BufferAddress; + __le16 length; + __le16 status; + __le32 resv; + __le64 BufferAddress; } TX_DASH_SEND_FW_DESC, *PTX_DASH_SEND_FW_DESC; typedef struct _OSOOBHdr { - u32 len; + __le32 len; u8 type; u8 flag; u8 hostReqV; @@ -177,12 +176,11 @@ #define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2) #define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3) -#define RECV_FROM_FW_BUF_SIZE (1520) -#define SEND_TO_FW_BUF_SIZE (1520) +#define RECV_FROM_FW_BUF_SIZE (2048) +#define SEND_TO_FW_BUF_SIZE (2048) #define RX_DASH_FROM_FW_OWN BIT_15 #define TX_DASH_SEND_FW_OWN BIT_15 -#define TX_DASH_SEND_FW_OWN_HIGHBYTE BIT_7 #define TXS_CC3_0 (BIT_0|BIT_1|BIT_2|BIT_3) #define TXS_EXC BIT_4
View file
r8168-8.048.03.tar.gz/src/r8168_fiber.h -> r8168-8.049.02.tar.gz/src/r8168_fiber.h
Changed
@@ -1,10 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.049.02.tar.gz/src/r8168_firmware.c
Added
@@ -0,0 +1,264 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +################################################################################ +# +# 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. +# +# 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 +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see <http://www.gnu.org/licenses/>. +# +# Author: +# Realtek NIC software team <nicfae@realtek.com> +# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan +# +################################################################################ +*/ + +/************************************************************************************ + * This product is covered by one or more of the following patents: + * US6,570,884, US6,115,776, and US6,327,625. + ***********************************************************************************/ + +#include <linux/version.h> +#include <linux/delay.h> +#include <linux/firmware.h> + +#include "r8168_firmware.h" + +enum rtl_fw_opcode { + PHY_READ = 0x0, + PHY_DATA_OR = 0x1, + PHY_DATA_AND = 0x2, + PHY_BJMPN = 0x3, + PHY_MDIO_CHG = 0x4, + PHY_CLEAR_READCOUNT = 0x7, + PHY_WRITE = 0x8, + PHY_READCOUNT_EQ_SKIP = 0x9, + PHY_COMP_EQ_SKIPN = 0xa, + PHY_COMP_NEQ_SKIPN = 0xb, + PHY_WRITE_PREVIOUS = 0xc, + PHY_SKIPN = 0xd, + PHY_DELAY_MS = 0xe, +}; + +struct fw_info { + u32 magic; + char version[RTL8168_VER_SIZE]; + __le32 fw_start; + __le32 fw_len; + u8 chksum; +} __packed; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0) +#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) +#endif +#define FW_OPCODE_SIZE sizeof_field(struct rtl8168_fw_phy_action, code[0]) + +static bool rtl8168_fw_format_ok(struct rtl8168_fw *rtl_fw) +{ + const struct firmware *fw = rtl_fw->fw; + struct fw_info *fw_info = (struct fw_info *)fw->data; + struct rtl8168_fw_phy_action *pa = &rtl_fw->phy_action; + + if (fw->size < FW_OPCODE_SIZE) + return false; + + if (!fw_info->magic) { + size_t i, size, start; + u8 checksum = 0; + + if (fw->size < sizeof(*fw_info)) + return false; + + for (i = 0; i < fw->size; i++) + checksum += fw->data[i]; + if (checksum != 0) + return false; + + start = le32_to_cpu(fw_info->fw_start); + if (start > fw->size) + return false; + + size = le32_to_cpu(fw_info->fw_len); + if (size > (fw->size - start) / FW_OPCODE_SIZE) + return false; + + strscpy(rtl_fw->version, fw_info->version, RTL8168_VER_SIZE); + + pa->code = (__le32 *)(fw->data + start); + pa->size = size; + } else { + if (fw->size % FW_OPCODE_SIZE) + return false; + + strscpy(rtl_fw->version, rtl_fw->fw_name, RTL8168_VER_SIZE); + + pa->code = (__le32 *)fw->data; + pa->size = fw->size / FW_OPCODE_SIZE; + } + + return true; +} + +static bool rtl8168_fw_data_ok(struct rtl8168_fw *rtl_fw) +{ + struct rtl8168_fw_phy_action *pa = &rtl_fw->phy_action; + size_t index; + + for (index = 0; index < pa->size; index++) { + u32 action = le32_to_cpu(pa->code[index]); + u32 val = action & 0x0000ffff; + u32 regno = (action & 0x0fff0000) >> 16; + + switch (action >> 28) { + case PHY_READ: + case PHY_DATA_OR: + case PHY_DATA_AND: + case PHY_CLEAR_READCOUNT: + case PHY_WRITE: + case PHY_WRITE_PREVIOUS: + case PHY_DELAY_MS: + break; + + case PHY_MDIO_CHG: + if (val > 1) + goto out; + break; + + case PHY_BJMPN: + if (regno > index) + goto out; + break; + case PHY_READCOUNT_EQ_SKIP: + if (index + 2 >= pa->size) + goto out; + break; + case PHY_COMP_EQ_SKIPN: + case PHY_COMP_NEQ_SKIPN: + case PHY_SKIPN: + if (index + 1 + regno >= pa->size) + goto out; + break; + + default: + dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action); + return false; + } + } + + return true; +out: + dev_err(rtl_fw->dev, "Out of range of firmware\n"); + return false; +} + +void rtl8168_fw_write_firmware(struct rtl8168_private *tp, struct rtl8168_fw *rtl_fw) +{ + struct rtl8168_fw_phy_action *pa = &rtl_fw->phy_action; + rtl8168_fw_write_t fw_write = rtl_fw->phy_write; + rtl8168_fw_read_t fw_read = rtl_fw->phy_read; + int predata = 0, count = 0; + size_t index; + + for (index = 0; index < pa->size; index++) { + u32 action = le32_to_cpu(pa->code[index]); + u32 data = action & 0x0000ffff; + u32 regno = (action & 0x0fff0000) >> 16; + enum rtl_fw_opcode opcode = action >> 28; + + if (!action) + break; + + switch (opcode) { + case PHY_READ: + predata = fw_read(tp, regno); + count++; + break; + case PHY_DATA_OR: + predata |= data; + break; + case PHY_DATA_AND: + predata &= data; + break; + case PHY_BJMPN: + index -= (regno + 1); + break; + case PHY_MDIO_CHG:
View file
r8168-8.049.02.tar.gz/src/r8168_firmware.h
Added
@@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +################################################################################ +# +# 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. +# +# 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 +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see <http://www.gnu.org/licenses/>. +# +# Author: +# Realtek NIC software team <nicfae@realtek.com> +# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan +# +################################################################################ +*/ + +/************************************************************************************ + * This product is covered by one or more of the following patents: + * US6,570,884, US6,115,776, and US6,327,625. + ***********************************************************************************/ + +#ifndef _LINUX_RTL8168_FIRMWARE_H +#define _LINUX_RTL8168_FIRMWARE_H + +#include <linux/device.h> +#include <linux/firmware.h> + +struct rtl8168_private; +typedef void (*rtl8168_fw_write_t)(struct rtl8168_private *tp, u16 reg, u16 val); +typedef u32 (*rtl8168_fw_read_t)(struct rtl8168_private *tp, u16 reg); + +#define RTL8168_VER_SIZE 32 + +struct rtl8168_fw { + rtl8168_fw_write_t phy_write; + rtl8168_fw_read_t phy_read; + rtl8168_fw_write_t mac_mcu_write; + rtl8168_fw_read_t mac_mcu_read; + const struct firmware *fw; + const char *fw_name; + struct device *dev; + + char version[RTL8168_VER_SIZE]; + + struct rtl8168_fw_phy_action { + __le32 *code; + size_t size; + } phy_action; +}; + +int rtl8168_fw_request_firmware(struct rtl8168_fw *rtl_fw); +void rtl8168_fw_release_firmware(struct rtl8168_fw *rtl_fw); +void rtl8168_fw_write_firmware(struct rtl8168_private *tp, struct rtl8168_fw *rtl_fw); + +#endif /* _LINUX_RTL8168_FIRMWARE_H */
View file
r8168-8.048.03.tar.gz/src/r8168_n.c -> r8168-8.049.02.tar.gz/src/r8168_n.c
Changed
@@ -1,10 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-only /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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 @@ -87,16 +88,78 @@ #include "r8168_asf.h" #include "rtl_eeprom.h" #include "rtltool.h" +#include "r8168_firmware.h" #ifdef ENABLE_R8168_PROCFS #include <linux/proc_fs.h> #include <linux/seq_file.h> #endif +#define FIRMWARE_8168D_1 "rtl_nic/rtl8168d-1.fw" +#define FIRMWARE_8168D_2 "rtl_nic/rtl8168d-2.fw" +#define FIRMWARE_8168E_1 "rtl_nic/rtl8168e-1.fw" +#define FIRMWARE_8168E_2 "rtl_nic/rtl8168e-2.fw" +#define FIRMWARE_8168E_3 "rtl_nic/rtl8168e-3.fw" +#define FIRMWARE_8168E_4 "rtl_nic/rtl8168e-4.fw" +#define FIRMWARE_8168F_1 "rtl_nic/rtl8168f-1.fw" +#define FIRMWARE_8168F_2 "rtl_nic/rtl8168f-2.fw" +#define FIRMWARE_8411_1 "rtl_nic/rtl8411-1.fw" +#define FIRMWARE_8411_2 "rtl_nic/rtl8411-2.fw" +#define FIRMWARE_8168G_2 "rtl_nic/rtl8168g-2.fw" +#define FIRMWARE_8168G_3 "rtl_nic/rtl8168g-3.fw" +#define FIRMWARE_8168EP_1 "rtl_nic/rtl8168ep-1.fw" +#define FIRMWARE_8168EP_2 "rtl_nic/rtl8168ep-2.fw" +#define FIRMWARE_8168EP_3 "rtl_nic/rtl8168ep-3.fw" +#define FIRMWARE_8168H_1 "rtl_nic/rtl8168h-1.fw" +#define FIRMWARE_8168H_2 "rtl_nic/rtl8168h-2.fw" +#define FIRMWARE_8168FP_3 "rtl_nic/rtl8168fp-3.fw" +#define FIRMWARE_8168FP_4 "rtl_nic/rtl8168fp-4.fw" + /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). The RTL chips use a 64 element hash table based on the Ethernet CRC. */ static const int multicast_filter_limit = 32; +static const struct { + const char *name; + const char *fw_name; +} rtl_chip_fw_infos[] = { + /* PCI-E devices. */ + [CFG_METHOD_1] = {"RTL8168B/8111", }, + [CFG_METHOD_2] = {"RTL8168B/8111", }, + [CFG_METHOD_3] = {"RTL8168B/8111", }, + [CFG_METHOD_4] = {"RTL8168C/8111C", }, + [CFG_METHOD_5] = {"RTL8168C/8111C", }, + [CFG_METHOD_6] = {"RTL8168C/8111C", }, + [CFG_METHOD_7] = {"RTL8168CP/8111CP", }, + [CFG_METHOD_8] = {"RTL8168CP/8111CP", }, + [CFG_METHOD_9] = {"RTL8168D/8111D", FIRMWARE_8168D_1}, + [CFG_METHOD_10] = {"RTL8168D/8111D", FIRMWARE_8168D_2}, + [CFG_METHOD_11] = {"RTL8168DP/8111DP", }, + [CFG_METHOD_12] = {"RTL8168DP/8111DP", }, + [CFG_METHOD_13] = {"RTL8168DP/8111DP", }, + [CFG_METHOD_14] = {"RTL8168E/8111E", FIRMWARE_8168E_1}, + [CFG_METHOD_15] = {"RTL8168E/8111E", FIRMWARE_8168E_2}, + [CFG_METHOD_16] = {"RTL8168E-VL/8111E-VL", FIRMWARE_8168E_3}, + [CFG_METHOD_17] = {"RTL8168E-VL/8111E-VL", FIRMWARE_8168E_4}, + [CFG_METHOD_18] = {"RTL8168F/8111F", FIRMWARE_8168F_1}, + [CFG_METHOD_19] = {"RTL8168F/8111F", FIRMWARE_8168F_2}, + [CFG_METHOD_20] = {"RTL8411", FIRMWARE_8411_1}, + [CFG_METHOD_21] = {"RTL8168G/8111G", FIRMWARE_8168G_2}, + [CFG_METHOD_22] = {"RTL8168G/8111G", }, + [CFG_METHOD_23] = {"RTL8168EP/8111EP", FIRMWARE_8168EP_1}, + [CFG_METHOD_24] = {"RTL8168GU/8111GU", }, + [CFG_METHOD_25] = {"RTL8168GU/8111GU", FIRMWARE_8168G_3}, + [CFG_METHOD_26] = {"8411B", FIRMWARE_8411_2}, + [CFG_METHOD_27] = {"RTL8168EP/8111EP", FIRMWARE_8168EP_2}, + [CFG_METHOD_28] = {"RTL8168EP/8111EP", FIRMWARE_8168EP_3}, + [CFG_METHOD_29] = {"RTL8168H/8111H", FIRMWARE_8168H_1}, + [CFG_METHOD_30] = {"RTL8168H/8111H", FIRMWARE_8168H_2}, + [CFG_METHOD_31] = {"RTL8168FP/8111FP", }, + [CFG_METHOD_32] = {"RTL8168FP/8111FP", FIRMWARE_8168FP_3}, + [CFG_METHOD_33] = {"RTL8168FP/8111FP", FIRMWARE_8168FP_4}, + [CFG_METHOD_DEFAULT] = {"Unknown", }, +}; + #define _R(NAME,MAC,RCR,MASK, JumFrameSz) \ { .name = NAME, .mcfg = MAC, .RCR_Cfg = RCR, .RxConfigMask = MASK, .jumbo_frame_sz = JumFrameSz } @@ -331,6 +394,7 @@ static int rx_copybreak = 0; static int use_dac = 1; static int timer_count = 0x2600; +static int dynamic_aspm_packet_threshold = 10; static struct { u32 msg_enable; @@ -350,6 +414,11 @@ #else static int aspm = 0; #endif +#ifdef CONFIG_DYNAMIC_ASPM +static int dynamic_aspm = 1; +#else +static int dynamic_aspm = 0; +#endif #ifdef ENABLE_S5WOL static int s5wol = 1; #else @@ -394,6 +463,9 @@ module_param(aspm, int, 0); MODULE_PARM_DESC(aspm, "Enable ASPM."); +module_param(dynamic_aspm, int, 0); +MODULE_PARM_DESC(aspm, "Enable Software Dynamic ASPM."); + module_param(s5wol, int, 0); MODULE_PARM_DESC(s5wol, "Enable Shutdown Wake On Lan."); @@ -418,12 +490,36 @@ module_param(s0_magic_packet, int, 0); MODULE_PARM_DESC(s0_magic_packet, "Enable S0 Magic Packet."); +module_param(dynamic_aspm_packet_threshold, int, 0); +MODULE_PARM_DESC(dynamic_aspm_packet_threshold, "Dynamic ASPM packet threshold."); + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) module_param_named(debug, debug.msg_enable, int, 0); MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); #endif//LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) MODULE_LICENSE("GPL"); +#ifdef ENABLE_USE_FIRMWARE_FILE +MODULE_FIRMWARE(FIRMWARE_8168D_1); +MODULE_FIRMWARE(FIRMWARE_8168D_2); +MODULE_FIRMWARE(FIRMWARE_8168E_1); +MODULE_FIRMWARE(FIRMWARE_8168E_2); +MODULE_FIRMWARE(FIRMWARE_8168E_3); +MODULE_FIRMWARE(FIRMWARE_8168E_4); +MODULE_FIRMWARE(FIRMWARE_8168F_1); +MODULE_FIRMWARE(FIRMWARE_8168F_2); +MODULE_FIRMWARE(FIRMWARE_8411_1); +MODULE_FIRMWARE(FIRMWARE_8411_2); +MODULE_FIRMWARE(FIRMWARE_8168G_2); +MODULE_FIRMWARE(FIRMWARE_8168G_3); +MODULE_FIRMWARE(FIRMWARE_8168EP_1); +MODULE_FIRMWARE(FIRMWARE_8168EP_2); +MODULE_FIRMWARE(FIRMWARE_8168EP_3); +MODULE_FIRMWARE(FIRMWARE_8168H_1); +MODULE_FIRMWARE(FIRMWARE_8168H_2); +MODULE_FIRMWARE(FIRMWARE_8168FP_3); +MODULE_FIRMWARE(FIRMWARE_8168FP_4); +#endif MODULE_VERSION(RTL8168_VERSION); @@ -444,7 +540,7 @@ static void rtl8168_rx_clear(struct rtl8168_private *tp); static int rtl8168_open(struct net_device *dev); -static int rtl8168_start_xmit(struct sk_buff *skb, struct net_device *dev); +static netdev_tx_t rtl8168_start_xmit(struct sk_buff *skb, struct net_device *dev); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) static irqreturn_t rtl8168_interrupt(int irq, void *dev_instance, struct pt_regs *regs); #else @@ -472,6 +568,8 @@ static void rtl8168_tx_desc_init(struct rtl8168_private *tp); static void rtl8168_rx_desc_init(struct rtl8168_private *tp); +static u16 rtl8168_get_hw_phy_mcu_code_ver(struct rtl8168_private *tp); + static void rtl8168_hw_reset(struct net_device *dev); static void rtl8168_phy_power_up(struct net_device *dev); @@ -485,6 +583,17 @@ static int rtl8168_poll(napi_ptr napi, napi_budget budget); #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8168_reset_task(void *_data); +#else +static void rtl8168_reset_task(struct work_struct *work); +#endif + +static inline struct device *tp_to_dev(struct rtl8168_private *tp) +{ + return &tp->pci_dev->dev; +} + #if ((LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) && \ LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,00))) void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst, @@ -809,7 +918,7 @@ u64 rx_broadcast; u32 rx_multicast; u16 tx_aborted; - u16 tx_underun;
View file
r8168-8.048.03.tar.gz/src/r8168_realwow.h -> r8168-8.049.02.tar.gz/src/r8168_realwow.h
Changed
@@ -1,10 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/src/rtl_eeprom.c -> r8168-8.049.02.tar.gz/src/rtl_eeprom.c
Changed
@@ -1,10 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-only /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/src/rtl_eeprom.h -> r8168-8.049.02.tar.gz/src/rtl_eeprom.h
Changed
@@ -1,10 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/src/rtltool.c -> r8168-8.049.02.tar.gz/src/rtltool.c
Changed
@@ -1,10 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-only /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
View file
r8168-8.048.03.tar.gz/src/rtltool.h -> r8168-8.049.02.tar.gz/src/rtltool.h
Changed
@@ -1,10 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* ################################################################################ # # r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved. +# Copyright(c) 2021 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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.