Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-08-19 14:03:03 +08:00
commit a91fd349fc
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
13 changed files with 421 additions and 21 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=r8101
PKG_VERSION:=1.039.00
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8101/releases/download/$(PKG_VERSION)
@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8101
SUBMENU:=Network Devices
TITLE:=Realtek RTL8101 PCI Fast Ethernet driver
DEPENDS:=@PCI_SUPPORT
DEPENDS:=@PCI_SUPPORT +kmod-libphy
FILES:=$(PKG_BUILD_DIR)/src/r8101.ko
AUTOLOAD:=$(call AutoProbe,r8101)
PROVIDES:=kmod-r8169

View File

@ -0,0 +1,100 @@
From ec0de750e20073b23c91b67f4bc3ab71c50f0eed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
Date: Sat, 17 Aug 2024 21:19:54 +0200
Subject: [PATCH] r8101: print link speed and duplex mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Like other Ethernet drivers, print link speed and duplex mode
when the interface is up. Formatting output at the same time.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
src/r8101.h | 2 ++
src/r8101_n.c | 42 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 41 insertions(+), 3 deletions(-)
--- a/src/r8101.h
+++ b/src/r8101.h
@@ -1162,6 +1162,8 @@ enum RTL8101_register_content {
LinkStatus = 0x02,
FullDup = 0x01,
+#define RTL8101_FULL_DUPLEX_MASK (FullDup)
+
/* ResetCounterCommand */
CounterReset = 0x1,
/* DumpCounterCommand */
--- a/src/r8101_n.c
+++ b/src/r8101_n.c
@@ -39,6 +39,7 @@ This driver is modified from r8169.c in
#include <linux/module.h>
#include <linux/version.h>
#include <linux/pci.h>
+#include <linux/phy.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
@@ -2838,6 +2839,34 @@ rtl8101_issue_offset_99_event(struct rtl
}
}
+static unsigned int rtl8101_phy_duplex(u8 status)
+{
+ unsigned int duplex = DUPLEX_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & RTL8101_FULL_DUPLEX_MASK)
+ duplex = DUPLEX_FULL;
+ else
+ duplex = DUPLEX_HALF;
+ }
+
+ return duplex;
+}
+
+static int rtl8101_phy_speed(u8 status)
+{
+ int speed = SPEED_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & _100bps)
+ speed = SPEED_100;
+ else if (status & _10bps)
+ speed = SPEED_10;
+ }
+
+ return speed;
+}
+
static void
rtl8101_check_link_status(struct net_device *dev)
{
@@ -2913,8 +2942,15 @@ rtl8101_check_link_status(struct net_dev
tp->phy_reg_aner = rtl8101_mdio_read(tp, MII_EXPANSION);
tp->phy_reg_anlpar = rtl8101_mdio_read(tp, MII_LPA);
- if (netif_msg_ifup(tp))
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
+ if (netif_msg_ifup(tp)) {
+ const u8 phy_status = RTL_R8(tp, PHYstatus);
+ const unsigned int phy_duplex = rtl8101_phy_duplex(phy_status);
+ const int phy_speed = rtl8101_phy_speed(phy_status);
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
+ dev->name,
+ phy_speed_to_str(phy_speed),
+ phy_duplex_to_str(phy_duplex));
+ }
} else {
if (tp->mcfg == CFG_METHOD_11 || tp->mcfg == CFG_METHOD_12 ||
tp->mcfg == CFG_METHOD_13) {
@@ -2925,7 +2961,7 @@ rtl8101_check_link_status(struct net_dev
rtl8101_mdio_write(tp, 0x1F, 0x0000);
}
if (netif_msg_ifdown(tp))
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
tp->phy_reg_aner = 0;
tp->phy_reg_anlpar = 0;

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=r8125
PKG_VERSION:=9.013.02
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION)
@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8125
SUBMENU:=Network Devices
TITLE:=Realtek RTL8125 PCI 2.5 Gigabit Ethernet driver
DEPENDS:=@PCI_SUPPORT
DEPENDS:=@PCI_SUPPORT +kmod-libphy
FILES:=$(PKG_BUILD_DIR)/src/r8125.ko
AUTOLOAD:=$(call AutoProbe,r8125)
PROVIDES:=kmod-r8169 kmod-r8125-rss

View File

@ -0,0 +1,100 @@
From e351ac87bc3135e8555587e0bf80efb248ade0b7 Mon Sep 17 00:00:00 2001
From: Chukun Pan <amadeus@jmu.edu.cn>
Date: Sun, 4 Aug 2024 21:16:23 +0800
Subject: [PATCH] r8125: print link speed and duplex mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Like other Ethernet drivers, print link speed and duplex mode
when the interface is up. Formatting output at the same time.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
src/r8125.h | 2 ++
src/r8125_n.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 45 insertions(+), 3 deletions(-)
--- a/src/r8125.h
+++ b/src/r8125.h
@@ -1563,6 +1563,8 @@ enum RTL8125_register_content {
LinkStatus = 0x02,
FullDup = 0x01,
+#define RTL8125_FULL_DUPLEX_MASK (_2500bpsF | _1000bpsF | FullDup)
+
/* DBG_reg */
Fix_Nak_1 = (1 << 4),
Fix_Nak_2 = (1 << 3),
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -39,6 +39,7 @@
#include <linux/module.h>
#include <linux/version.h>
#include <linux/pci.h>
+#include <linux/phy.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
@@ -5112,6 +5113,38 @@ rtl8125_link_down_patch(struct net_devic
#endif
}
+static unsigned int rtl8125_phy_duplex(u16 status)
+{
+ unsigned int duplex = DUPLEX_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & RTL8125_FULL_DUPLEX_MASK)
+ duplex = DUPLEX_FULL;
+ else
+ duplex = DUPLEX_HALF;
+ }
+
+ return duplex;
+}
+
+static int rtl8125_phy_speed(u16 status)
+{
+ int speed = SPEED_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & _2500bpsF)
+ speed = SPEED_2500;
+ else if (status & _1000bpsF)
+ speed = SPEED_1000;
+ else if (status & _100bps)
+ speed = SPEED_100;
+ else if (status & _10bps)
+ speed = SPEED_10;
+ }
+
+ return speed;
+}
+
static void
_rtl8125_check_link_status(struct net_device *dev)
{
@@ -5120,11 +5153,18 @@ _rtl8125_check_link_status(struct net_de
if (tp->link_ok(dev)) {
rtl8125_link_on_patch(dev);
- if (netif_msg_ifup(tp))
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
+ if (netif_msg_ifup(tp)) {
+ const u16 phy_status = RTL_R16(tp, PHYstatus);
+ const unsigned int phy_duplex = rtl8125_phy_duplex(phy_status);
+ const int phy_speed = rtl8125_phy_speed(phy_status);
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
+ dev->name,
+ phy_speed_to_str(phy_speed),
+ phy_duplex_to_str(phy_duplex));
+ }
} else {
if (netif_msg_ifdown(tp))
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
rtl8125_link_down_patch(dev);
}

View File

@ -1,6 +1,6 @@
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -43,6 +43,7 @@
@@ -44,6 +44,7 @@
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/mii.h>
@ -8,7 +8,7 @@
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -13626,6 +13627,25 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
@@ -13666,6 +13667,25 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4);
}
@ -34,7 +34,7 @@
static void
rtl8125_init_software_variable(struct net_device *dev)
{
@@ -14260,6 +14280,8 @@ rtl8125_init_software_variable(struct ne
@@ -14300,6 +14320,8 @@ rtl8125_init_software_variable(struct ne
else if (tp->InitRxDescType == RX_DESC_RING_TYPE_4)
tp->rtl8125_rx_config &= ~EnableRxDescV4_1;

View File

@ -1,6 +1,6 @@
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -15305,6 +15305,7 @@ rtl8125_init_board(struct pci_dev *pdev,
@@ -15345,6 +15345,7 @@ rtl8125_init_board(struct pci_dev *pdev,
void __iomem *ioaddr;
struct net_device *dev;
struct rtl8125_private *tp;
@ -8,7 +8,7 @@
int rc = -ENOMEM, i, pm_cap;
assert(ioaddr_out != NULL);
@@ -15319,6 +15320,9 @@ rtl8125_init_board(struct pci_dev *pdev,
@@ -15359,6 +15360,9 @@ rtl8125_init_board(struct pci_dev *pdev,
goto err_out;
}

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=r8126
PKG_VERSION:=10.013.00
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8126/releases/download/$(PKG_VERSION)
@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8126
SUBMENU:=Network Devices
TITLE:=Realtek RTL8126 PCI 5 Gigabit Ethernet driver
DEPENDS:=@PCI_SUPPORT
DEPENDS:=@PCI_SUPPORT +kmod-libphy
FILES:=$(PKG_BUILD_DIR)/src/r8126.ko
AUTOLOAD:=$(call AutoProbe,r8126)
PROVIDES:=kmod-r8169 kmod-r8126-rss

View File

@ -0,0 +1,102 @@
From 5ca1d47e065c0318774a946ffdf76010c78cc164 Mon Sep 17 00:00:00 2001
From: Chukun Pan <amadeus@jmu.edu.cn>
Date: Sat, 10 Aug 2024 20:16:32 +0800
Subject: [PATCH] r8126: print link speed and duplex mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Like other Ethernet drivers, print link speed and duplex mode
when the interface is up. Formatting output at the same time.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
src/r8126.h | 2 ++
src/r8126_n.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 47 insertions(+), 3 deletions(-)
--- a/src/r8126.h
+++ b/src/r8126.h
@@ -1561,6 +1561,8 @@ enum RTL8126_register_content {
LinkStatus = 0x02,
FullDup = 0x01,
+#define RTL8126_FULL_DUPLEX_MASK (_5000bpsF | _2500bpsF | _1000bpsF | FullDup)
+
/* DBG_reg */
Fix_Nak_1 = (1 << 4),
Fix_Nak_2 = (1 << 3),
--- a/src/r8126_n.c
+++ b/src/r8126_n.c
@@ -39,6 +39,7 @@
#include <linux/module.h>
#include <linux/version.h>
#include <linux/pci.h>
+#include <linux/phy.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
@@ -4740,6 +4741,40 @@ rtl8126_link_down_patch(struct net_devic
#endif
}
+static unsigned int rtl8126_phy_duplex(u16 status)
+{
+ unsigned int duplex = DUPLEX_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & RTL8126_FULL_DUPLEX_MASK)
+ duplex = DUPLEX_FULL;
+ else
+ duplex = DUPLEX_HALF;
+ }
+
+ return duplex;
+}
+
+static int rtl8126_phy_speed(u16 status)
+{
+ int speed = SPEED_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & _5000bpsF)
+ speed = SPEED_5000;
+ else if (status & _2500bpsF)
+ speed = SPEED_2500;
+ else if (status & _1000bpsF)
+ speed = SPEED_1000;
+ else if (status & _100bps)
+ speed = SPEED_100;
+ else if (status & _10bps)
+ speed = SPEED_10;
+ }
+
+ return speed;
+}
+
static void
_rtl8126_check_link_status(struct net_device *dev)
{
@@ -4748,11 +4783,18 @@ _rtl8126_check_link_status(struct net_de
if (tp->link_ok(dev)) {
rtl8126_link_on_patch(dev);
- if (netif_msg_ifup(tp))
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
+ if (netif_msg_ifup(tp)) {
+ const u16 phy_status = RTL_R16(tp, PHYstatus);
+ const unsigned int phy_duplex = rtl8126_phy_duplex(phy_status);
+ const int phy_speed = rtl8126_phy_speed(phy_status);
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
+ dev->name,
+ phy_speed_to_str(phy_speed),
+ phy_duplex_to_str(phy_duplex));
+ }
} else {
if (netif_msg_ifdown(tp))
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
rtl8126_link_down_patch(dev);
}

View File

@ -1,6 +1,6 @@
--- a/src/r8126_n.c
+++ b/src/r8126_n.c
@@ -43,6 +43,7 @@
@@ -44,6 +44,7 @@
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/mii.h>
@ -8,7 +8,7 @@
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -11610,6 +11611,25 @@ rtl8126_setup_mqs_reg(struct rtl8126_pri
@@ -11652,6 +11653,25 @@ rtl8126_setup_mqs_reg(struct rtl8126_pri
}
}
@ -34,7 +34,7 @@
static void
rtl8126_init_software_variable(struct net_device *dev)
{
@@ -11982,6 +12002,8 @@ rtl8126_init_software_variable(struct ne
@@ -12024,6 +12044,8 @@ rtl8126_init_software_variable(struct ne
if (tp->InitRxDescType == RX_DESC_RING_TYPE_3)
tp->rtl8126_rx_config |= EnableRxDescV3;

View File

@ -1,6 +1,6 @@
--- a/src/r8126_n.c
+++ b/src/r8126_n.c
@@ -13016,6 +13016,7 @@ rtl8126_init_board(struct pci_dev *pdev,
@@ -13058,6 +13058,7 @@ rtl8126_init_board(struct pci_dev *pdev,
void __iomem *ioaddr;
struct net_device *dev;
struct rtl8126_private *tp;
@ -8,7 +8,7 @@
int rc = -ENOMEM, i, pm_cap;
assert(ioaddr_out != NULL);
@@ -13030,6 +13031,9 @@ rtl8126_init_board(struct pci_dev *pdev,
@@ -13072,6 +13073,9 @@ rtl8126_init_board(struct pci_dev *pdev,
goto err_out;
}

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=r8168
PKG_VERSION:=8.053.00
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8168/releases/download/$(PKG_VERSION)
@ -18,7 +18,7 @@ include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8168
SUBMENU:=Network Devices
TITLE:=Realtek RTL8168 PCI Gigabit Ethernet driver
DEPENDS:=@PCI_SUPPORT
DEPENDS:=@PCI_SUPPORT +kmod-libphy
FILES:=$(PKG_BUILD_DIR)/src/r8168.ko
AUTOLOAD:=$(call AutoProbe,r8168)
PROVIDES:=kmod-r8169

View File

@ -0,0 +1,98 @@
From 0078930e0c374d327cd3281e5e2f7ff97b40b335 Mon Sep 17 00:00:00 2001
From: Chukun Pan <amadeus@jmu.edu.cn>
Date: Sun, 4 Aug 2024 16:15:12 +0800
Subject: [PATCH] r8168: print link speed and duplex mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Like other Ethernet drivers, print link speed and duplex mode
when the interface is up. Formatting output at the same time.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
---
src/r8168.h | 2 ++
src/r8168_n.c | 44 +++++++++++++++++++++++++++++++++++++++++---
2 files changed, 43 insertions(+), 3 deletions(-)
--- a/src/r8168.h
+++ b/src/r8168.h
@@ -1385,6 +1385,8 @@ enum RTL8168_register_content {
LinkStatus = 0x02,
FullDup = 0x01,
+#define RTL8168_FULL_DUPLEX_MASK (_1000bpsF | FullDup)
+
/* DBG_reg */
Fix_Nak_1 = (1 << 4),
Fix_Nak_2 = (1 << 3),
--- a/src/r8168_n.c
+++ b/src/r8168_n.c
@@ -43,6 +43,7 @@
#include <linux/module.h>
#include <linux/version.h>
#include <linux/pci.h>
+#include <linux/phy.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
@@ -5373,6 +5374,36 @@ rtl8168_link_down_patch(struct net_devic
#endif
}
+static unsigned int rtl8168_phy_duplex(u8 status)
+{
+ unsigned int duplex = DUPLEX_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & RTL8168_FULL_DUPLEX_MASK)
+ duplex = DUPLEX_FULL;
+ else
+ duplex = DUPLEX_HALF;
+ }
+
+ return duplex;
+}
+
+static int rtl8168_phy_speed(u8 status)
+{
+ int speed = SPEED_UNKNOWN;
+
+ if (status & LinkStatus) {
+ if (status & _1000bpsF)
+ speed = SPEED_1000;
+ else if (status & _100bps)
+ speed = SPEED_100;
+ else if (status & _10bps)
+ speed = SPEED_10;
+ }
+
+ return speed;
+}
+
static void
rtl8168_check_link_status(struct net_device *dev)
{
@@ -5392,11 +5423,18 @@ rtl8168_check_link_status(struct net_dev
if (link_status_on) {
rtl8168_link_on_patch(dev);
- if (netif_msg_ifup(tp))
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
+ if (netif_msg_ifup(tp)) {
+ const u8 phy_status = RTL_R8(tp, PHYstatus);
+ const unsigned int phy_duplex = rtl8168_phy_duplex(phy_status);
+ const int phy_speed = rtl8168_phy_speed(phy_status);
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
+ dev->name,
+ phy_speed_to_str(phy_speed),
+ phy_duplex_to_str(phy_duplex));
+ }
} else {
if (netif_msg_ifdown(tp))
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
rtl8168_link_down_patch(dev);
}

View File

@ -1,6 +1,6 @@
--- a/src/r8168_n.c
+++ b/src/r8168_n.c
@@ -47,6 +47,7 @@
@@ -48,6 +48,7 @@
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/mii.h>
@ -8,7 +8,7 @@
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -25945,6 +25946,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri
@@ -25983,6 +25984,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri
tp->imr_reg[3] = IntrMask3;
}
@ -31,7 +31,7 @@
static void
rtl8168_init_software_variable(struct net_device *dev)
{
@@ -26640,6 +26657,8 @@ err1:
@@ -26678,6 +26695,8 @@ err1:
if (tp->InitRxDescType == RX_DESC_RING_TYPE_2)
tp->RxDescLength = RX_DESC_LEN_TYPE_2;