From nobody Thu Nov 21 17:00:16 2024 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 336D4157E78; Wed, 20 Nov 2024 07:57:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732089440; cv=none; b=he9dQU8C2HcQsf29uaM0VWzxnKiGIXan1EId10I3lIdHyd9XagyemOWbze+c02NNIAE9vjG6fDrUA3XoSxszAB7BZm8/uZbinPWIDmXaXVmV/CVHG8V33LIf5NORrjLvRb76TJQmpDGhVfr5lR6e0+++it9jM+q4lzFmozZ1mWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732089440; c=relaxed/simple; bh=jupBb4ye504kRCeeubDO/UeYQKREE72u1jkJWZkacUA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mSwWQ/S5aAjtDdD4omQJa9u5dvTTLecCh0RYC0iLeGarWYUUeiuL5bYu6boRH3Dc6CqWXD8pZ0M3KeYhpXVXenQehGNLKjQgP4xpUMZ9pfYSPvc7nZwdgswtUfQmc7q9WE1GMjgqad2uQ71NPvPnz9pUnbQiBhBu1kAsm31Bi3o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=AKmePGHX; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="AKmePGHX" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AK7uuhqF3745295, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1732089417; bh=jupBb4ye504kRCeeubDO/UeYQKREE72u1jkJWZkacUA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=AKmePGHX8BwitOciXwoMVm7i3lz+kQa6sAmUnHi/YJvVAQd/WgCZBLl1kJj1dctd0 CMQ7AD0DaVvUE926w7o/Ja4mmaJjjjaMNRn4rfePvLBtCNcPL5p72HzBm9/xecrvep OYHoyTdgGc0qflCG8xiQnO84nb51azyRzPtG7wWtu2ukm3cSPe5TgY0VW5D99Dsm2b hOyyEB/toJ2rkcI/Y+ThQ0QvsXzKsLiEkcSE0Kj3ugeipXEnF1uPuhIsSOfj/ykHlr c4grwyY/zgGlGwrRDi4MzZiEMoN/sklcmvuM5f0y9WDJNz6rSRnTKDH2FqdYEPgEKN 8R33EnlROcCwg== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AK7uuhqF3745295 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Nov 2024 15:56:57 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 20 Nov 2024 15:56:57 +0800 Received: from RTDOMAIN (172.21.210.74) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 20 Nov 2024 15:56:56 +0800 From: Justin Lai To: CC: , , , , , , , , , , Justin Lai Subject: [PATCH net v5 1/3] rtase: Refactor the rtase_check_mac_version_valid() function Date: Wed, 20 Nov 2024 15:56:22 +0800 Message-ID: <20241120075624.499464-2-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241120075624.499464-1-justinlai0215@realtek.com> References: <20241120075624.499464-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) Content-Type: text/plain; charset="utf-8" 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 --- 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/ether= net/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 =20 -#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 =20 #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; }; =20 #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 =3D RTASE_MAX_JUMBO_SIZE; } =20 -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 =3D rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK; - bool known_ver =3D false; + int ret =3D -ENODEV; =20 - switch (hw_ver) { - case 0x00800000: - case 0x04000000: - case 0x04800000: - known_ver =3D true; + tp->hw_ver =3D 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 =3D 0; break; } =20 - return known_ver; + return ret; } =20 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 =3D pdev; =20 /* 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 =3D rtase_check_mac_version_valid(tp); + if (ret !=3D 0) { + dev_err(&pdev->dev, + "unknown chip version: 0x%08x, contact rtase maintainers (see MAINTAINE= RS file)\n", + tp->hw_ver); + } =20 rtase_init_software_variable(pdev, tp); rtase_init_hardware(tp); --=20 2.34.1 From nobody Thu Nov 21 17:00:16 2024 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1744015443D; Wed, 20 Nov 2024 07:58:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732089487; cv=none; b=o+vf7K/zQXy7ns+SZjrORI4zKJJUXLyDtlgnYXqE83y/vgKvBWorHN08kVAU/l849ifmyhY3Ks2UbrOVILQCKwzOGJrT5nXe1nADHURwhQ0beBWdrVNCyKbuvPSE/FnIeLh9tE79kTBkZOusXwubMPv319NSkKaVGvIdXttOWzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732089487; c=relaxed/simple; bh=mm7FzS9gPhW5aWv9K33rVKxnf7HrcfiG+2JMikIm6JQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SK9+oh4MYkf8noveErEUFjptxjK7tZmR8n3yBu0NIzUdS8NAXgHTdqU8KNlSpCPbkzeJ/fsaMdE62umBfB0sevUCeC8zkbAvVbjGgU3sVAYHRMQNUfcHPfVSo9hwuT0UB7AECJWg6vAXCRDuLWfr7ZKJG5zPai6IKYl7/F10gN8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=Rj5AtPnL; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="Rj5AtPnL" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AK7vZKU13745829, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1732089455; bh=mm7FzS9gPhW5aWv9K33rVKxnf7HrcfiG+2JMikIm6JQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=Rj5AtPnLMcQ/Fusd9PewL4lgue2Ip8entqQVkkBpL8EGbLyZqqCF0s2YdW9muGEbU m5ZpECM8rxWG2eChB39PoSANk2uY2YaDczHxV3QhJJgjVw7m3PblXDALSAoQoabLDx q1jdjd8vzjWQ09SzPOm0zSuPkZqSgjqmF8xP+C6/PKSRR8mHNAp0CPnUtauPNrCB3b JVOKHvYsPbZXgQ+tRqEmsEEOvJVtKXkBR3fb6WxNFb/sRAlsY316zQa7VPQJYrKQMz txoYkVyRe3Ynxk1S8XJe6VUOQxEFiQ6j8Dt2gBiQHgcrFOEbnWRHndcDzP2krvRJLV sewWlcqki4zuQ== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AK7vZKU13745829 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Nov 2024 15:57:35 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 20 Nov 2024 15:57:35 +0800 Received: from RTDOMAIN (172.21.210.74) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 20 Nov 2024 15:57:35 +0800 From: Justin Lai To: CC: , , , , , , , , , , Justin Lai Subject: [PATCH net v5 2/3] rtase: Correct the speed for RTL907XD-V1 Date: Wed, 20 Nov 2024 15:56:23 +0800 Message-ID: <20241120075624.499464-3-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241120075624.499464-1-justinlai0215@realtek.com> References: <20241120075624.499464-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: RTEXH36506.realtek.com.tw (172.21.6.27) To RTEXMBS04.realtek.com.tw (172.21.6.97) Content-Type: text/plain; charset="utf-8" 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 --- 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 *de= v, struct ethtool_link_ksettings *cmd) { u32 supported =3D SUPPORTED_MII | SUPPORTED_Pause | SUPPORTED_Asym_Pause; + const struct rtase_private *tp =3D netdev_priv(dev); =20 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, supported); - cmd->base.speed =3D SPEED_5000; + + switch (tp->hw_ver) { + case RTASE_HW_VER_906X_7XA: + case RTASE_HW_VER_906X_7XC: + cmd->base.speed =3D SPEED_5000; + break; + case RTASE_HW_VER_907XD_V1: + cmd->base.speed =3D SPEED_10000; + break; + } + cmd->base.duplex =3D DUPLEX_FULL; cmd->base.port =3D PORT_MII; cmd->base.autoneg =3D AUTONEG_DISABLE; --=20 2.34.1 From nobody Thu Nov 21 17:00:16 2024 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44EAA158D94; Wed, 20 Nov 2024 07:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732089576; cv=none; b=g4cENjJFcqE8s3pvU9pjul0kX8s8amN2/w2/GwOjky02npxvfZqr0Gd1XM1Clf8OmjzzvDZ3b0y6lgKxYPnBm6GQVkZywkViVXKtiORf4bv9ATWXhBHhs06pxbIJeNA+8a2w+RHKXr95BIvXwl1qtgI/lYdG6dsck3sHssep0DU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732089576; c=relaxed/simple; bh=WZikTQU/J9NItKRvbptX00Xfqlo3hfyd59uhzM1JNGc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BemFqaH5L08r2BKknIslmpLiId4sUIjMMjWnL4mwpgT8Iw7/6u39ToM/v1prAVfr4fPAcG0quv7IXriM2tZh7CoefZ75b9s2mDtZUD9N+mPikSuzT/YO+TjGbMQg1ieFv2wZzKJrZ3DjXR+0ZmKF27ZoRTWkgJc/sHkIHEgqyRk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=VEoWoCKH; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="VEoWoCKH" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AK7x77a93745991, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1732089547; bh=WZikTQU/J9NItKRvbptX00Xfqlo3hfyd59uhzM1JNGc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=VEoWoCKH2AF9TXqTRt6N3cMKjgPegPcxBzH6ECMRtfOu8KTTEUZtm6Ud/49zkO9IK ObenNaCPs6cFoolyRSoI/xL0W2BeLGCDWeW03SNPTNrF7ZnAfYNLFQICXUv+vgpaqX NHaOcwCbUbZn4n9gC+hDNG4UzoEdF/7fIK+zTFzwTPtdKbeQKxmySWNFrZ8KrEJ+HZ Yr9kHWoMRHAcmYYdxAJPYvikBufz11I6DHZEZZkA9uWiQXaM+9II9XszrAz7GJnV2B 76aOUHMBUhJWmLV1PMBp7Whdzw0VXnEdxkwTtXP20Vafz6+odOSG+d8GhAuSb2pkFf 5QOd/G80qv5ag== Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AK7x77a93745991 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Nov 2024 15:59:07 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 20 Nov 2024 15:59:07 +0800 Received: from RTDOMAIN (172.21.210.74) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 20 Nov 2024 15:59:06 +0800 From: Justin Lai To: CC: , , , , , , , , , , Justin Lai Subject: [PATCH net v5 3/3] rtase: Corrects error handling of the rtase_check_mac_version_valid() Date: Wed, 20 Nov 2024 15:56:24 +0800 Message-ID: <20241120075624.499464-4-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241120075624.499464-1-justinlai0215@realtek.com> References: <20241120075624.499464-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) Content-Type: text/plain; charset="utf-8" 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 --- 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 MAINTAINE= RS file)\n", tp->hw_ver); + goto err_out_release_board; } =20 rtase_init_software_variable(pdev, tp); @@ -2196,6 +2197,7 @@ static int rtase_init_one(struct pci_dev *pdev, netif_napi_del(&ivec->napi); } =20 +err_out_release_board: rtase_release_board(pdev, dev, ioaddr); =20 return ret; --=20 2.34.1