public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Raju Rangoju <Raju.Rangoju@amd•com>
To: <thomas.lendacky@amd•com>, <Shyam-sundar.S-k@amd•com>,
	<davem@davemloft•net>, <kuba@kernel•org>
Cc: <netdev@vger•kernel.org>, <rrangoju@amd•com>,
	Raju Rangoju <Raju.Rangoju@amd•com>
Subject: [PATCH net 3/3] amd-xgbe: fix the SFP compliance codes check for DAC cables
Date: Thu, 6 Oct 2022 19:24:40 +0530	[thread overview]
Message-ID: <20221006135440.3680563-4-Raju.Rangoju@amd.com> (raw)
In-Reply-To: <20221006135440.3680563-1-Raju.Rangoju@amd.com>

The current XGBE code assumes that offset 3 and 6 of EEPROM SFP DAC
(passive) cables are NULL. It also assumes the offset 12 is in the
range 0x64 to 0x68. However, some of the cables (the 5 meter and 7 meter
molex passive cables have non-zero data at offset 3 and 6, also a value
0x78 at offset 12. So, fix the sfp compliance codes check to ignore
those offsets. Also extend the macro XGBE_SFP_BASE_BR_10GBE range to 0x78.

Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd•com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 23fbd89a29df..0387e691be68 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -238,7 +238,7 @@ enum xgbe_sfp_speed {
 #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_SFP_BASE_BR_10GBE_MAX		0x78
 
 #define XGBE_SFP_BASE_CU_CABLE_LEN		18
 
@@ -1151,7 +1151,10 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
 	}
 
 	/* Determine the type of SFP */
-	if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR)
+	if (phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE &&
+	    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)
 		phy_data->sfp_base = XGBE_SFP_BASE_10000_SR;
 	else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_LR)
 		phy_data->sfp_base = XGBE_SFP_BASE_10000_LR;
@@ -1167,9 +1170,6 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
 		phy_data->sfp_base = XGBE_SFP_BASE_1000_CX;
 	else if (sfp_base[XGBE_SFP_BASE_1GBE_CC] & XGBE_SFP_BASE_1GBE_CC_T)
 		phy_data->sfp_base = XGBE_SFP_BASE_1000_T;
-	else if ((phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE) &&
-		 xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000))
-		phy_data->sfp_base = XGBE_SFP_BASE_10000_CR;
 
 	switch (phy_data->sfp_base) {
 	case XGBE_SFP_BASE_1000_T:
-- 
2.25.1


  parent reply	other threads:[~2022-10-06 13:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 13:54 [PATCH net 0/3] amd-xgbe: Miscellaneous fixes Raju Rangoju
2022-10-06 13:54 ` [PATCH net 1/3] amd-xgbe: Yellow carp devices do not need rrc Raju Rangoju
2022-10-06 14:32   ` Tom Lendacky
2022-10-07  0:26     ` Jakub Kicinski
2022-10-08 18:27       ` Raju Rangoju
2022-10-06 13:54 ` [PATCH net 2/3] amd-xgbe: enable PLL_CTL for fixed PHY modes only Raju Rangoju
2022-10-06 14:47   ` Tom Lendacky
2022-10-06 17:23     ` Raju Rangoju
2022-10-06 13:54 ` Raju Rangoju [this message]
2022-10-06 15:00   ` [PATCH net 3/3] amd-xgbe: fix the SFP compliance codes check for DAC cables Tom Lendacky
     [not found]     ` <9a8552c2-0a23-ea1d-9d1c-56b7a6c75487@amd.com>
2022-10-06 19:04       ` Tom Lendacky
     [not found]         ` <77d8ea25-3557-cd6f-f732-20a046b29661@amd.com>
2022-10-07 14:27           ` Tom Lendacky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221006135440.3680563-4-Raju.Rangoju@amd.com \
    --to=raju.rangoju@amd$(echo .)com \
    --cc=Shyam-sundar.S-k@amd$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rrangoju@amd$(echo .)com \
    --cc=thomas.lendacky@amd$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox