Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Nov 2024 06:16:29 GMT
From:      Kevin Bowling <kbowling@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 15853a5fc954 - main - e1000: Improve igb(4) SFP support
Message-ID:  <202411070616.4A76GTjb016246@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=15853a5fc9548d9805a2ef22f24e2eb580198341

commit 15853a5fc9548d9805a2ef22f24e2eb580198341
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2024-11-07 06:02:10 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2024-11-07 06:10:14 +0000

    e1000: Improve igb(4) SFP support
    
    * Adds support for SFPs that are not correctly coded as an SFP
      transceiver. i.e. Coherent-Finisar FCLF8522P2BTL.
    * Configures multi-rate SFPs i.e. Coherent-Finisar FCLF8522P2BTL as
      SGMII so they can do 10/100/1000 auto-negotiation.
    * Adds support for 100BaseLX SGMII transceivers.
    * Some code cleanup and additional debugging.
    
    Reviewed by:    emaste, markj, Franco Fichtner <franco@opnsense.org>
    Tested by:      Natalino Picone <natalino.picone@nozominetworks.com>
    MFC after:      2 weeks
    Sponsored by:   Nozomi Networks
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D47337
---
 sys/dev/e1000/e1000_82575.c | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c
index a33aa9eb2903..47b8006314f8 100644
--- a/sys/dev/e1000/e1000_82575.c
+++ b/sys/dev/e1000/e1000_82575.c
@@ -1686,20 +1686,19 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw)
 			break;
 		}
 
-		/* do not change link mode for 100BaseFX */
-		if (dev_spec->eth_flags.e100_base_fx)
-			break;
-
 		/* change current link mode setting */
 		ctrl_ext &= ~E1000_CTRL_EXT_LINK_MODE_MASK;
 
-		if (hw->phy.media_type == e1000_media_type_copper)
+		if (dev_spec->sgmii_active)
 			ctrl_ext |= E1000_CTRL_EXT_LINK_MODE_SGMII;
 		else
 			ctrl_ext |= E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES;
 
 		E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
 
+		break;
+	default:
+		DEBUGOUT("e1000_get_media_type_82575 unknown link type\n");
 		break;
 	}
 
@@ -1750,24 +1749,27 @@ static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw)
 
 	/* Check if there is some SFP module plugged and powered */
 	if ((tranceiver_type == E1000_SFF_IDENTIFIER_SFP) ||
-	    (tranceiver_type == E1000_SFF_IDENTIFIER_SFF)) {
+	    (tranceiver_type == E1000_SFF_IDENTIFIER_SFF))
 		dev_spec->module_plugged = true;
-		if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) {
-			hw->phy.media_type = e1000_media_type_internal_serdes;
-		} else if (eth_flags->e100_base_fx) {
-			dev_spec->sgmii_active = true;
-			hw->phy.media_type = e1000_media_type_internal_serdes;
-		} else if (eth_flags->e1000_base_t) {
-			dev_spec->sgmii_active = true;
-			hw->phy.media_type = e1000_media_type_copper;
-		} else {
-			hw->phy.media_type = e1000_media_type_unknown;
-			DEBUGOUT("PHY module has not been recognized\n");
-			goto out;
-		}
+	else
+		DEBUGOUT("PHY module is not SFP/SFF %x\n", tranceiver_type);
+
+	if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) {
+		hw->phy.media_type = e1000_media_type_internal_serdes;
+		DEBUGOUT("PHY module is 1000_base_lxsx\n");
+	} else if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) {
+		dev_spec->sgmii_active = true;
+		hw->phy.media_type = e1000_media_type_internal_serdes;
+		DEBUGOUT("PHY module is 100_base_fxlx\n");
+	} else if (eth_flags->e1000_base_t) {
+		dev_spec->sgmii_active = true;
+		hw->phy.media_type = e1000_media_type_copper;
+		DEBUGOUT("PHY module is 1000_base_t\n");
 	} else {
 		hw->phy.media_type = e1000_media_type_unknown;
+		DEBUGOUT("PHY module has not been recognized\n");
 	}
+
 	ret_val = E1000_SUCCESS;
 out:
 	/* Restore I2C interface setting */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202411070616.4A76GTjb016246>