netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v6 0/2] Fix AQR PMA capabilities
@ 2024-10-01 22:46 Abhishek Chauhan
  2024-10-01 22:46 ` [PATCH net v6 1/2] net: phy: aquantia: AQR115c fix up " Abhishek Chauhan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Abhishek Chauhan @ 2024-10-01 22:46 UTC (permalink / raw)
  To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
	Andrew Halaney, Russell King (Oracle), Andrew Lunn,
	Heiner Kallweit, Bartosz Golaszewski, linux-tegra@vger.kernel.org,
	Brad Griffis, Vladimir Oltean, Jon Hunter, Maxime Chevallier,
	Przemek Kitszel
  Cc: kernel

Patch 1:- 
AQR115c reports incorrect PMA capabilities which includes
10G/5G and also incorrectly disables capabilities like autoneg
and 10Mbps support.

AQR115c as per the Marvell databook supports speeds up to 2.5Gbps
with autonegotiation.

Patch 2:- 
Remove the use of phy_set_max_speed in phy driver as the
function is mainly used in MAC driver to set the max
speed.

Instead use get_features to fix up Phy PMA capabilities for
AQR111, AQR111B0, AQR114C and AQCS109


Abhishek Chauhan (2):
  net: phy: aquantia: AQR115c fix up PMA capabilities
  net: phy: aquantia: remove usage of phy_set_max_speed

 drivers/net/phy/aquantia/aquantia_main.c | 51 +++++++++++++++---------
 1 file changed, 33 insertions(+), 18 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net v6 1/2] net: phy: aquantia: AQR115c fix up PMA capabilities
  2024-10-01 22:46 [PATCH net v6 0/2] Fix AQR PMA capabilities Abhishek Chauhan
@ 2024-10-01 22:46 ` Abhishek Chauhan
  2024-10-01 22:46 ` [PATCH net v6 2/2] net: phy: aquantia: remove usage of phy_set_max_speed Abhishek Chauhan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Abhishek Chauhan @ 2024-10-01 22:46 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, Andrew Halaney, Russell King (Oracle),
	Andrew Lunn, Heiner Kallweit, Bartosz Golaszewski,
	linux-tegra@vger.kernel.org, Brad Griffis, Vladimir Oltean,
	Jon Hunter, Maxime Chevallier, Przemek Kitszel
  Cc: kernel

AQR115c reports incorrect PMA capabilities which includes
10G/5G and also incorrectly disables capabilities like autoneg
and 10Mbps support.

AQR115c as per the Marvell databook supports speeds up to 2.5Gbps
with autonegotiation.

Fixes: 0ebc581f8a4b ("net: phy: aquantia: add support for aqr115c")
Link: https://lore.kernel.org/all/20240913011635.1286027-1-quic_abchauha@quicinc.com/T/
Signed-off-by: Abhishek Chauhan <quic_abchauha@quicinc.com>
---
Changes since v5
1. Minor comments addressed such as having 
   unsigned long *supported = phydev->supported;
2. Updated comments as per Russell suggestion. 

Changes since v4
1. Forget about asking hardware for PMA capabilites.
2. Just set the Gbits features along with 2.5Gbps support 
   for AQR115c Phy chip. 

Changes since v3
1. remove setting of 2500baseX bit introduced as
   part of previous patches.
2. follow reverse xmas declaration of variables.
3. remove local mask introduced as part of
   previous patch and optimize the logic.

Changes since v2
1. seperate out the changes into two different patches. 
2. use phy_gbit_features instead of initializing each and 
   every link mode bits. 
3. write seperate functions for 2.5Gbps supported phy.
4. remove FIBRE bit which was introduced in patch 1.

Changes since v1 
1. remove usage of phy_set_max_speed in the aquantia driver code.
2. Introduce aqr_custom_get_feature which checks for the phy id and
   takes necessary actions based on max_speed supported by the phy.
3. remove aqr111_config_init as it is just a wrapper function. 
 drivers/net/phy/aquantia/aquantia_main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index e982e9ce44a5..86bb3b5bfc70 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -721,6 +721,19 @@ static int aqr113c_fill_interface_modes(struct phy_device *phydev)
 	return aqr107_fill_interface_modes(phydev);
 }
 
+static int aqr115c_get_features(struct phy_device *phydev)
+{
+	unsigned long *supported = phydev->supported;
+
+	/* PHY supports speeds up to 2.5G with autoneg. PMA capabilities
+	 * are not useful.
+	 */
+	linkmode_or(supported, supported, phy_gbit_features);
+	linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, supported);
+
+	return 0;
+}
+
 static int aqr113c_config_init(struct phy_device *phydev)
 {
 	int ret;
@@ -1036,6 +1049,7 @@ static struct phy_driver aqr_driver[] = {
 	.get_sset_count = aqr107_get_sset_count,
 	.get_strings    = aqr107_get_strings,
 	.get_stats      = aqr107_get_stats,
+	.get_features   = aqr115c_get_features,
 	.link_change_notify = aqr107_link_change_notify,
 	.led_brightness_set = aqr_phy_led_brightness_set,
 	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net v6 2/2] net: phy: aquantia: remove usage of phy_set_max_speed
  2024-10-01 22:46 [PATCH net v6 0/2] Fix AQR PMA capabilities Abhishek Chauhan
  2024-10-01 22:46 ` [PATCH net v6 1/2] net: phy: aquantia: AQR115c fix up " Abhishek Chauhan
@ 2024-10-01 22:46 ` Abhishek Chauhan
  2024-10-01 23:13 ` [PATCH net v6 0/2] Fix AQR PMA capabilities Russell King (Oracle)
  2024-10-03 23:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Abhishek Chauhan @ 2024-10-01 22:46 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, Andrew Halaney, Russell King (Oracle),
	Andrew Lunn, Heiner Kallweit, Bartosz Golaszewski,
	linux-tegra@vger.kernel.org, Brad Griffis, Vladimir Oltean,
	Jon Hunter, Maxime Chevallier, Przemek Kitszel
  Cc: kernel

Remove the use of phy_set_max_speed in phy driver as the
function is mainly used in MAC driver to set the max
speed.

Instead use get_features to fix up Phy PMA capabilities for
AQR111, AQR111B0, AQR114C and AQCS109

Fixes: 038ba1dc4e54 ("net: phy: aquantia: add AQR111 and AQR111B0 PHY ID")
Fixes: 0974f1f03b07 ("net: phy: aquantia: remove false 5G and 10G speed ability for AQCS109")
Fixes: c278ec644377 ("net: phy: aquantia: add support for AQR114C PHY ID")
Link: https://lore.kernel.org/all/20240913011635.1286027-1-quic_abchauha@quicinc.com/T/
Signed-off-by: Abhishek Chauhan <quic_abchauha@quicinc.com>
---
Changes since v5
1. Minor comments addressed to not exceed 80 columns. 

Changes since v4
1. Forget about asking hardware for PMA capabilites.
2. Just set the Gbits features along with 2.5Gbps support 
   for AQCS109 Phy chip. 
3. Just set the Gbits features along with 5Gbps support 
   for AQR111, AQR111B0 and AQR114C Phy chips. 
4. re-use aqr115c_get_features inside aqr111_get_features
   for further optimizations.


Changes since v3
1. remove setting of 2500baseX bit introduced as
   part of previous patches.
2. follow reverse xmas declaration of variables.
3. remove local mask introduced as part of
   previous patch and optimize the logic.

Changes since v2
1. seperate out the changes into two different patches. 
2. use phy_gbit_features instead of initializing each and 
   every link mode bits. 
3. write seperate functions for 2.5Gbps supported phy. 
4. remove FIBRE bit which was introduced in patch 1.

Changes since v1 
1. remove usage of phy_set_max_speed in the aquantia driver code.
2. Introduce aqr_custom_get_feature which checks for the phy id and
   takes necessary actions based on max_speed supported by the phy.
3. remove aqr111_config_init as it is just a wrapper function.

 drivers/net/phy/aquantia/aquantia_main.c | 37 ++++++++++++------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index 86bb3b5bfc70..819d87b280ac 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -527,12 +527,6 @@ static int aqcs109_config_init(struct phy_device *phydev)
 	if (!ret)
 		aqr107_chip_info(phydev);
 
-	/* AQCS109 belongs to a chip family partially supporting 10G and 5G.
-	 * PMA speed ability bits are the same for all members of the family,
-	 * AQCS109 however supports speeds up to 2.5G only.
-	 */
-	phy_set_max_speed(phydev, SPEED_2500);
-
 	return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
 }
 
@@ -734,6 +728,18 @@ static int aqr115c_get_features(struct phy_device *phydev)
 	return 0;
 }
 
+static int aqr111_get_features(struct phy_device *phydev)
+{
+	/* PHY supports speeds up to 5G with autoneg. PMA capabilities
+	 * are not useful.
+	 */
+	aqr115c_get_features(phydev);
+	linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
+			 phydev->supported);
+
+	return 0;
+}
+
 static int aqr113c_config_init(struct phy_device *phydev)
 {
 	int ret;
@@ -770,15 +776,6 @@ static int aqr107_probe(struct phy_device *phydev)
 	return aqr_hwmon_probe(phydev);
 }
 
-static int aqr111_config_init(struct phy_device *phydev)
-{
-	/* AQR111 reports supporting speed up to 10G,
-	 * however only speeds up to 5G are supported.
-	 */
-	phy_set_max_speed(phydev, SPEED_5000);
-
-	return aqr107_config_init(phydev);
-}
 
 static struct phy_driver aqr_driver[] = {
 {
@@ -856,6 +853,7 @@ static struct phy_driver aqr_driver[] = {
 	.get_sset_count	= aqr107_get_sset_count,
 	.get_strings	= aqr107_get_strings,
 	.get_stats	= aqr107_get_stats,
+	.get_features   = aqr115c_get_features,
 	.link_change_notify = aqr107_link_change_notify,
 	.led_brightness_set = aqr_phy_led_brightness_set,
 	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
@@ -868,7 +866,7 @@ static struct phy_driver aqr_driver[] = {
 	.name		= "Aquantia AQR111",
 	.probe		= aqr107_probe,
 	.get_rate_matching = aqr107_get_rate_matching,
-	.config_init	= aqr111_config_init,
+	.config_init	= aqr107_config_init,
 	.config_aneg    = aqr_config_aneg,
 	.config_intr	= aqr_config_intr,
 	.handle_interrupt = aqr_handle_interrupt,
@@ -880,6 +878,7 @@ static struct phy_driver aqr_driver[] = {
 	.get_sset_count	= aqr107_get_sset_count,
 	.get_strings	= aqr107_get_strings,
 	.get_stats	= aqr107_get_stats,
+	.get_features   = aqr111_get_features,
 	.link_change_notify = aqr107_link_change_notify,
 	.led_brightness_set = aqr_phy_led_brightness_set,
 	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
@@ -892,7 +891,7 @@ static struct phy_driver aqr_driver[] = {
 	.name		= "Aquantia AQR111B0",
 	.probe		= aqr107_probe,
 	.get_rate_matching = aqr107_get_rate_matching,
-	.config_init	= aqr111_config_init,
+	.config_init	= aqr107_config_init,
 	.config_aneg    = aqr_config_aneg,
 	.config_intr	= aqr_config_intr,
 	.handle_interrupt = aqr_handle_interrupt,
@@ -904,6 +903,7 @@ static struct phy_driver aqr_driver[] = {
 	.get_sset_count	= aqr107_get_sset_count,
 	.get_strings	= aqr107_get_strings,
 	.get_stats	= aqr107_get_stats,
+	.get_features   = aqr111_get_features,
 	.link_change_notify = aqr107_link_change_notify,
 	.led_brightness_set = aqr_phy_led_brightness_set,
 	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
@@ -1013,7 +1013,7 @@ static struct phy_driver aqr_driver[] = {
 	.name           = "Aquantia AQR114C",
 	.probe          = aqr107_probe,
 	.get_rate_matching = aqr107_get_rate_matching,
-	.config_init    = aqr111_config_init,
+	.config_init    = aqr107_config_init,
 	.config_aneg    = aqr_config_aneg,
 	.config_intr    = aqr_config_intr,
 	.handle_interrupt = aqr_handle_interrupt,
@@ -1025,6 +1025,7 @@ static struct phy_driver aqr_driver[] = {
 	.get_sset_count = aqr107_get_sset_count,
 	.get_strings    = aqr107_get_strings,
 	.get_stats      = aqr107_get_stats,
+	.get_features   = aqr111_get_features,
 	.link_change_notify = aqr107_link_change_notify,
 	.led_brightness_set = aqr_phy_led_brightness_set,
 	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net v6 0/2] Fix AQR PMA capabilities
  2024-10-01 22:46 [PATCH net v6 0/2] Fix AQR PMA capabilities Abhishek Chauhan
  2024-10-01 22:46 ` [PATCH net v6 1/2] net: phy: aquantia: AQR115c fix up " Abhishek Chauhan
  2024-10-01 22:46 ` [PATCH net v6 2/2] net: phy: aquantia: remove usage of phy_set_max_speed Abhishek Chauhan
@ 2024-10-01 23:13 ` Russell King (Oracle)
  2024-10-03 23:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2024-10-01 23:13 UTC (permalink / raw)
  To: Abhishek Chauhan
  Cc: Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
	Andrew Halaney, Andrew Lunn, Heiner Kallweit, Bartosz Golaszewski,
	linux-tegra@vger.kernel.org, Brad Griffis, Vladimir Oltean,
	Jon Hunter, Maxime Chevallier, Przemek Kitszel, kernel

On Tue, Oct 01, 2024 at 03:46:24PM -0700, Abhishek Chauhan wrote:
> Patch 1:- 
> AQR115c reports incorrect PMA capabilities which includes
> 10G/5G and also incorrectly disables capabilities like autoneg
> and 10Mbps support.
> 
> AQR115c as per the Marvell databook supports speeds up to 2.5Gbps
> with autonegotiation.
> 
> Patch 2:- 
> Remove the use of phy_set_max_speed in phy driver as the
> function is mainly used in MAC driver to set the max
> speed.
> 
> Instead use get_features to fix up Phy PMA capabilities for
> AQR111, AQR111B0, AQR114C and AQCS109

For both patches:

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net v6 0/2] Fix AQR PMA capabilities
  2024-10-01 22:46 [PATCH net v6 0/2] Fix AQR PMA capabilities Abhishek Chauhan
                   ` (2 preceding siblings ...)
  2024-10-01 23:13 ` [PATCH net v6 0/2] Fix AQR PMA capabilities Russell King (Oracle)
@ 2024-10-03 23:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-03 23:20 UTC (permalink / raw)
  To: Abhishek Chauhan
  Cc: edumazet, kuba, pabeni, netdev, linux-kernel, ahalaney, linux,
	andrew, hkallweit1, bartosz.golaszewski, linux-tegra, bgriffis,
	vladimir.oltean, jonathanh, maxime.chevallier, przemyslaw.kitszel,
	kernel

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  1 Oct 2024 15:46:24 -0700 you wrote:
> Patch 1:-
> AQR115c reports incorrect PMA capabilities which includes
> 10G/5G and also incorrectly disables capabilities like autoneg
> and 10Mbps support.
> 
> AQR115c as per the Marvell databook supports speeds up to 2.5Gbps
> with autonegotiation.
> 
> [...]

Here is the summary with links:
  - [net,v6,1/2] net: phy: aquantia: AQR115c fix up PMA capabilities
    https://git.kernel.org/netdev/net/c/17cbfcdd85f6
  - [net,v6,2/2] net: phy: aquantia: remove usage of phy_set_max_speed
    https://git.kernel.org/netdev/net/c/8f61d73306c6

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] 5+ messages in thread

end of thread, other threads:[~2024-10-03 23:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 22:46 [PATCH net v6 0/2] Fix AQR PMA capabilities Abhishek Chauhan
2024-10-01 22:46 ` [PATCH net v6 1/2] net: phy: aquantia: AQR115c fix up " Abhishek Chauhan
2024-10-01 22:46 ` [PATCH net v6 2/2] net: phy: aquantia: remove usage of phy_set_max_speed Abhishek Chauhan
2024-10-01 23:13 ` [PATCH net v6 0/2] Fix AQR PMA capabilities Russell King (Oracle)
2024-10-03 23:20 ` 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;
as well as URLs for NNTP newsgroup(s).