* [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds
@ 2024-11-20 7:56 Justin Lai
2024-11-20 7:56 ` [PATCH net v5 1/3] rtase: Refactor the rtase_check_mac_version_valid() function Justin Lai
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Justin Lai @ 2024-11-20 7:56 UTC (permalink / raw)
To: kuba
Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
horms, michal.kubiak, pkshih, larry.chiu, Justin Lai
This patch set mainly involves correcting switch hardware versions and
reported speeds.
Details are as follows:
1. Refactor the rtase_check_mac_version_valid() function.
2. Correct the speed for RTL907XD-V1
3. Corrects error handling of the rtase_check_mac_version_valid()
v1 -> v2:
- Add Fixes: tag.
- Add defines for hardware version id.
- Modify the error message for an invalid hardware version ID.
v2 -> v3:
- Remove the patch "Add support for RTL907XD-VA PCIe port".
v3 -> v4:
- Modify commit message to describe the main reason for the fix.
v4 -> v5
- Integrate the addition of defines for hardware version ID into the patch
"rtase: Refactor the rtase_check_mac_version_valid() function."
Justin Lai (3):
rtase: Refactor the rtase_check_mac_version_valid() function
rtase: Correct the speed for RTL907XD-V1
rtase: Corrects error handling of the rtase_check_mac_version_valid()
drivers/net/ethernet/realtek/rtase/rtase.h | 7 ++-
.../net/ethernet/realtek/rtase/rtase_main.c | 43 +++++++++++++------
2 files changed, 36 insertions(+), 14 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net v5 1/3] rtase: Refactor the rtase_check_mac_version_valid() function
2024-11-20 7:56 [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds Justin Lai
@ 2024-11-20 7:56 ` Justin Lai
2024-11-20 7:56 ` [PATCH net v5 2/3] rtase: Correct the speed for RTL907XD-V1 Justin Lai
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Justin Lai @ 2024-11-20 7:56 UTC (permalink / raw)
To: kuba
Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
horms, michal.kubiak, pkshih, larry.chiu, Justin Lai
Different hardware requires different configurations, but this distinction
was not made previously. Additionally, the error message was not clear
enough. Therefore, this patch will address the issues mentioned above.
Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module")
Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
drivers/net/ethernet/realtek/rtase/rtase.h | 7 ++++-
.../net/ethernet/realtek/rtase/rtase_main.c | 28 +++++++++++--------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h b/drivers/net/ethernet/realtek/rtase/rtase.h
index 583c33930f88..4a4434869b10 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase.h
+++ b/drivers/net/ethernet/realtek/rtase/rtase.h
@@ -9,7 +9,10 @@
#ifndef RTASE_H
#define RTASE_H
-#define RTASE_HW_VER_MASK 0x7C800000
+#define RTASE_HW_VER_MASK 0x7C800000
+#define RTASE_HW_VER_906X_7XA 0x00800000
+#define RTASE_HW_VER_906X_7XC 0x04000000
+#define RTASE_HW_VER_907XD_V1 0x04800000
#define RTASE_RX_DMA_BURST_256 4
#define RTASE_TX_DMA_BURST_UNLIMITED 7
@@ -327,6 +330,8 @@ struct rtase_private {
u16 int_nums;
u16 tx_int_mit;
u16 rx_int_mit;
+
+ u32 hw_ver;
};
#define RTASE_LSO_64K 64000
diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index f8777b7663d3..c2999e24904d 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -1972,20 +1972,21 @@ static void rtase_init_software_variable(struct pci_dev *pdev,
tp->dev->max_mtu = RTASE_MAX_JUMBO_SIZE;
}
-static bool rtase_check_mac_version_valid(struct rtase_private *tp)
+static int rtase_check_mac_version_valid(struct rtase_private *tp)
{
- u32 hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK;
- bool known_ver = false;
+ int ret = -ENODEV;
- switch (hw_ver) {
- case 0x00800000:
- case 0x04000000:
- case 0x04800000:
- known_ver = true;
+ tp->hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK;
+
+ switch (tp->hw_ver) {
+ case RTASE_HW_VER_906X_7XA:
+ case RTASE_HW_VER_906X_7XC:
+ case RTASE_HW_VER_907XD_V1:
+ ret = 0;
break;
}
- return known_ver;
+ return ret;
}
static int rtase_init_board(struct pci_dev *pdev, struct net_device **dev_out,
@@ -2105,9 +2106,12 @@ static int rtase_init_one(struct pci_dev *pdev,
tp->pdev = pdev;
/* identify chip attached to board */
- if (!rtase_check_mac_version_valid(tp))
- return dev_err_probe(&pdev->dev, -ENODEV,
- "unknown chip version, contact rtase maintainers (see MAINTAINERS file)\n");
+ ret = rtase_check_mac_version_valid(tp);
+ if (ret != 0) {
+ dev_err(&pdev->dev,
+ "unknown chip version: 0x%08x, contact rtase maintainers (see MAINTAINERS file)\n",
+ tp->hw_ver);
+ }
rtase_init_software_variable(pdev, tp);
rtase_init_hardware(tp);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net v5 2/3] rtase: Correct the speed for RTL907XD-V1
2024-11-20 7:56 [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds Justin Lai
2024-11-20 7:56 ` [PATCH net v5 1/3] rtase: Refactor the rtase_check_mac_version_valid() function Justin Lai
@ 2024-11-20 7:56 ` Justin Lai
2024-11-20 7:56 ` [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid() Justin Lai
2024-11-26 9:20 ` [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: Justin Lai @ 2024-11-20 7:56 UTC (permalink / raw)
To: kuba
Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
horms, michal.kubiak, pkshih, larry.chiu, Justin Lai
Previously, the reported speed was uniformly set to SPEED_5000, but the
RTL907XD-V1 actually operates at a speed of SPEED_10000. Therefore, this
patch makes the necessary correction.
Fixes: dd7f17c40fd1 ("rtase: Implement ethtool function")
Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
drivers/net/ethernet/realtek/rtase/rtase_main.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index c2999e24904d..7b433b290a97 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -1714,10 +1714,21 @@ static int rtase_get_settings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{
u32 supported = SUPPORTED_MII | SUPPORTED_Pause | SUPPORTED_Asym_Pause;
+ const struct rtase_private *tp = netdev_priv(dev);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
supported);
- cmd->base.speed = SPEED_5000;
+
+ switch (tp->hw_ver) {
+ case RTASE_HW_VER_906X_7XA:
+ case RTASE_HW_VER_906X_7XC:
+ cmd->base.speed = SPEED_5000;
+ break;
+ case RTASE_HW_VER_907XD_V1:
+ cmd->base.speed = SPEED_10000;
+ break;
+ }
+
cmd->base.duplex = DUPLEX_FULL;
cmd->base.port = PORT_MII;
cmd->base.autoneg = AUTONEG_DISABLE;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid()
2024-11-20 7:56 [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds Justin Lai
2024-11-20 7:56 ` [PATCH net v5 1/3] rtase: Refactor the rtase_check_mac_version_valid() function Justin Lai
2024-11-20 7:56 ` [PATCH net v5 2/3] rtase: Correct the speed for RTL907XD-V1 Justin Lai
@ 2024-11-20 7:56 ` Justin Lai
2024-11-26 9:12 ` Paolo Abeni
2024-11-26 9:20 ` [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds patchwork-bot+netdevbpf
3 siblings, 1 reply; 7+ messages in thread
From: Justin Lai @ 2024-11-20 7:56 UTC (permalink / raw)
To: kuba
Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
horms, michal.kubiak, pkshih, larry.chiu, Justin Lai
Previously, when the hardware version ID was determined to be invalid,
only an error message was printed without any further handling. Therefore,
this patch makes the necessary corrections to address this.
Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module")
Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
drivers/net/ethernet/realtek/rtase/rtase_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index 7b433b290a97..1bfe5ef40c52 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -2122,6 +2122,7 @@ static int rtase_init_one(struct pci_dev *pdev,
dev_err(&pdev->dev,
"unknown chip version: 0x%08x, contact rtase maintainers (see MAINTAINERS file)\n",
tp->hw_ver);
+ goto err_out_release_board;
}
rtase_init_software_variable(pdev, tp);
@@ -2196,6 +2197,7 @@ static int rtase_init_one(struct pci_dev *pdev,
netif_napi_del(&ivec->napi);
}
+err_out_release_board:
rtase_release_board(pdev, dev, ioaddr);
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid()
2024-11-20 7:56 ` [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid() Justin Lai
@ 2024-11-26 9:12 ` Paolo Abeni
2024-11-27 7:08 ` Justin Lai
0 siblings, 1 reply; 7+ messages in thread
From: Paolo Abeni @ 2024-11-26 9:12 UTC (permalink / raw)
To: Justin Lai, kuba
Cc: davem, edumazet, andrew+netdev, linux-kernel, netdev, horms,
michal.kubiak, pkshih, larry.chiu
On 11/20/24 08:56, Justin Lai wrote:
> Previously, when the hardware version ID was determined to be invalid,
> only an error message was printed without any further handling. Therefore,
> this patch makes the necessary corrections to address this.
>
> Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module")
> Signed-off-by: Justin Lai <justinlai0215@realtek.com>
Note that you should have retained the Acked-by tag provided by Andrew
on v3.
No need to repost, I'm applying the series, but please keep in mind for
the next submission.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds
2024-11-20 7:56 [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds Justin Lai
` (2 preceding siblings ...)
2024-11-20 7:56 ` [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid() Justin Lai
@ 2024-11-26 9:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-26 9:20 UTC (permalink / raw)
To: Justin Lai
Cc: kuba, davem, edumazet, pabeni, andrew+netdev, linux-kernel,
netdev, horms, michal.kubiak, pkshih, larry.chiu
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Wed, 20 Nov 2024 15:56:21 +0800 you wrote:
> This patch set mainly involves correcting switch hardware versions and
> reported speeds.
> Details are as follows:
> 1. Refactor the rtase_check_mac_version_valid() function.
> 2. Correct the speed for RTL907XD-V1
> 3. Corrects error handling of the rtase_check_mac_version_valid()
>
> [...]
Here is the summary with links:
- [net,v5,1/3] rtase: Refactor the rtase_check_mac_version_valid() function
https://git.kernel.org/netdev/net/c/a1f8609ff1f6
- [net,v5,2/3] rtase: Correct the speed for RTL907XD-V1
https://git.kernel.org/netdev/net/c/c1fc14c4df80
- [net,v5,3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid()
https://git.kernel.org/netdev/net/c/a01cfcfda5cc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid()
2024-11-26 9:12 ` Paolo Abeni
@ 2024-11-27 7:08 ` Justin Lai
0 siblings, 0 replies; 7+ messages in thread
From: Justin Lai @ 2024-11-27 7:08 UTC (permalink / raw)
To: Paolo Abeni, kuba@kernel.org
Cc: davem@davemloft.net, edumazet@google.com, andrew+netdev@lunn.ch,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
horms@kernel.org, michal.kubiak@intel.com, Ping-Ke Shih,
Larry Chiu
>
> On 11/20/24 08:56, Justin Lai wrote:
> > Previously, when the hardware version ID was determined to be invalid,
> > only an error message was printed without any further handling.
> > Therefore, this patch makes the necessary corrections to address this.
> >
> > Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this
> > module")
> > Signed-off-by: Justin Lai <justinlai0215@realtek.com>
>
> Note that you should have retained the Acked-by tag provided by Andrew on
> v3.
>
> No need to repost, I'm applying the series, but please keep in mind for the next
> submission.
>
> Thanks,
>
> Paolo
OK, I understand. Thanks for the review, I’ll follow this approach from
now on.
Justin
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-27 7:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 7:56 [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds Justin Lai
2024-11-20 7:56 ` [PATCH net v5 1/3] rtase: Refactor the rtase_check_mac_version_valid() function Justin Lai
2024-11-20 7:56 ` [PATCH net v5 2/3] rtase: Correct the speed for RTL907XD-V1 Justin Lai
2024-11-20 7:56 ` [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid() Justin Lai
2024-11-26 9:12 ` Paolo Abeni
2024-11-27 7:08 ` Justin Lai
2024-11-26 9:20 ` [PATCH net v5 0/3] Correcting switch hardware versions and reported speeds patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox