linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] AMD XGBE active/passive cable fixes
@ 2022-12-08 16:22 Tom Lendacky
  2022-12-08 16:22 ` [PATCH net 1/2] net: amd-xgbe: Fix logic around active and passive cables Tom Lendacky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Lendacky @ 2022-12-08 16:22 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shyam Sundar S K

This series fixes some issues related to active and passive cables and
consists of two patches:

- Provide proper recognition of active cables.

- Only check for a minimum supported speed for passive cables.

Tom Lendacky (2):
  net: amd-xgbe: Fix logic around active and passive cables
  net: amd-xgbe: Check only the minimum speed for active/passive cables

 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 23 +++++++--------------
 1 file changed, 8 insertions(+), 15 deletions(-)

-- 
2.38.1


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

* [PATCH net 1/2] net: amd-xgbe: Fix logic around active and passive cables
  2022-12-08 16:22 [PATCH net 0/2] AMD XGBE active/passive cable fixes Tom Lendacky
@ 2022-12-08 16:22 ` Tom Lendacky
  2022-12-08 16:22 ` [PATCH net 2/2] net: amd-xgbe: Check only the minimum speed for active/passive cables Tom Lendacky
  2022-12-12 10:10 ` [PATCH net 0/2] AMD XGBE active/passive cable fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Lendacky @ 2022-12-08 16:22 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shyam Sundar S K

SFP+ active and passive cables are copper cables with fixed SFP+ end
connectors. Due to a misinterpretation of this, SFP+ active cables could
end up not being recognized, causing the driver to fail to establish a
connection.

Introduce a new enum in SFP+ cable types, XGBE_SFP_CABLE_FIBER, that is
the default cable type, and handle active and passive cables when they are
specifically detected.

Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 4064c3e3dd49..868a768f424c 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -189,6 +189,7 @@ enum xgbe_sfp_cable {
 	XGBE_SFP_CABLE_UNKNOWN = 0,
 	XGBE_SFP_CABLE_ACTIVE,
 	XGBE_SFP_CABLE_PASSIVE,
+	XGBE_SFP_CABLE_FIBER,
 };
 
 enum xgbe_sfp_base {
@@ -1149,16 +1150,18 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
 	phy_data->sfp_tx_fault = xgbe_phy_check_sfp_tx_fault(phy_data);
 	phy_data->sfp_rx_los = xgbe_phy_check_sfp_rx_los(phy_data);
 
-	/* Assume ACTIVE cable unless told it is PASSIVE */
+	/* Assume FIBER cable unless told otherwise */
 	if (sfp_base[XGBE_SFP_BASE_CABLE] & XGBE_SFP_BASE_CABLE_PASSIVE) {
 		phy_data->sfp_cable = XGBE_SFP_CABLE_PASSIVE;
 		phy_data->sfp_cable_len = sfp_base[XGBE_SFP_BASE_CU_CABLE_LEN];
-	} else {
+	} else if (sfp_base[XGBE_SFP_BASE_CABLE] & XGBE_SFP_BASE_CABLE_ACTIVE) {
 		phy_data->sfp_cable = XGBE_SFP_CABLE_ACTIVE;
+	} else {
+		phy_data->sfp_cable = XGBE_SFP_CABLE_FIBER;
 	}
 
 	/* Determine the type of SFP */
-	if (phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE &&
+	if (phy_data->sfp_cable != XGBE_SFP_CABLE_FIBER &&
 	    xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000))
 		phy_data->sfp_base = XGBE_SFP_BASE_10000_CR;
 	else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR)
-- 
2.38.1


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

* [PATCH net 2/2] net: amd-xgbe: Check only the minimum speed for active/passive cables
  2022-12-08 16:22 [PATCH net 0/2] AMD XGBE active/passive cable fixes Tom Lendacky
  2022-12-08 16:22 ` [PATCH net 1/2] net: amd-xgbe: Fix logic around active and passive cables Tom Lendacky
@ 2022-12-08 16:22 ` Tom Lendacky
  2022-12-12 10:10 ` [PATCH net 0/2] AMD XGBE active/passive cable fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Lendacky @ 2022-12-08 16:22 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shyam Sundar S K

There are cables that exist that can support speeds in excess of 10GbE.
The driver, however, restricts the EEPROM advertised nominal bitrate to
a specific range, which can prevent usage of cables that can support,
for example, up to 25GbE.

Rather than checking that an active or passive cable supports a specific
range, only check for a minimum supported speed.

Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 868a768f424c..c731a04731f8 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -237,10 +237,7 @@ enum xgbe_sfp_speed {
 
 #define XGBE_SFP_BASE_BR			12
 #define XGBE_SFP_BASE_BR_1GBE_MIN		0x0a
-#define XGBE_SFP_BASE_BR_1GBE_MAX		0x0d
 #define XGBE_SFP_BASE_BR_10GBE_MIN		0x64
-#define XGBE_SFP_BASE_BR_10GBE_MAX		0x68
-#define XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX	0x78
 
 #define XGBE_SFP_BASE_CU_CABLE_LEN		18
 
@@ -827,29 +824,22 @@ static void xgbe_phy_sfp_phy_settings(struct xgbe_prv_data *pdata)
 static bool xgbe_phy_sfp_bit_rate(struct xgbe_sfp_eeprom *sfp_eeprom,
 				  enum xgbe_sfp_speed sfp_speed)
 {
-	u8 *sfp_base, min, max;
+	u8 *sfp_base, min;
 
 	sfp_base = sfp_eeprom->base;
 
 	switch (sfp_speed) {
 	case XGBE_SFP_SPEED_1000:
 		min = XGBE_SFP_BASE_BR_1GBE_MIN;
-		max = XGBE_SFP_BASE_BR_1GBE_MAX;
 		break;
 	case XGBE_SFP_SPEED_10000:
 		min = XGBE_SFP_BASE_BR_10GBE_MIN;
-		if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME],
-			   XGBE_MOLEX_VENDOR, XGBE_SFP_BASE_VENDOR_NAME_LEN) == 0)
-			max = XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX;
-		else
-			max = XGBE_SFP_BASE_BR_10GBE_MAX;
 		break;
 	default:
 		return false;
 	}
 
-	return ((sfp_base[XGBE_SFP_BASE_BR] >= min) &&
-		(sfp_base[XGBE_SFP_BASE_BR] <= max));
+	return sfp_base[XGBE_SFP_BASE_BR] >= min;
 }
 
 static void xgbe_phy_free_phy_device(struct xgbe_prv_data *pdata)
-- 
2.38.1


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

* Re: [PATCH net 0/2] AMD XGBE active/passive cable fixes
  2022-12-08 16:22 [PATCH net 0/2] AMD XGBE active/passive cable fixes Tom Lendacky
  2022-12-08 16:22 ` [PATCH net 1/2] net: amd-xgbe: Fix logic around active and passive cables Tom Lendacky
  2022-12-08 16:22 ` [PATCH net 2/2] net: amd-xgbe: Check only the minimum speed for active/passive cables Tom Lendacky
@ 2022-12-12 10:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-12 10:10 UTC (permalink / raw)
  To: Tom Lendacky
  Cc: netdev, linux-kernel, davem, edumazet, kuba, pabeni, Shyam-sundar.S-k

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 8 Dec 2022 10:22:23 -0600 you wrote:
> This series fixes some issues related to active and passive cables and
> consists of two patches:
> 
> - Provide proper recognition of active cables.
> 
> - Only check for a minimum supported speed for passive cables.
> 
> [...]

Here is the summary with links:
  - [net,1/2] net: amd-xgbe: Fix logic around active and passive cables
    https://git.kernel.org/netdev/net/c/4998006c73af
  - [net,2/2] net: amd-xgbe: Check only the minimum speed for active/passive cables
    https://git.kernel.org/netdev/net/c/f8ab263d4d48

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

end of thread, other threads:[~2022-12-12 10:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 16:22 [PATCH net 0/2] AMD XGBE active/passive cable fixes Tom Lendacky
2022-12-08 16:22 ` [PATCH net 1/2] net: amd-xgbe: Fix logic around active and passive cables Tom Lendacky
2022-12-08 16:22 ` [PATCH net 2/2] net: amd-xgbe: Check only the minimum speed for active/passive cables Tom Lendacky
2022-12-12 10:10 ` [PATCH net 0/2] AMD XGBE active/passive cable fixes 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).