DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Richard Houldsworth <rhouldsworth@solarflare.com>
Subject: [dpdk-dev] [PATCH 10/11] net/sfc/base: use transceiver ID when reading info
Date: Mon, 24 Sep 2018 14:50:29 +0100	[thread overview]
Message-ID: <1537797030-26548-11-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1537797030-26548-1-git-send-email-arybchenko@solarflare.com>

From: Richard Houldsworth <rhouldsworth@solarflare.com>

In efx_mcdi_phy_module_get_info() probe the
transceiver identification byte rather than assume
the module matches the fixed port type.  This
supports scenarios such as a SFP mounted in a QSFP
port via a QSA module.

Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/efx_mcdi.c | 47 ++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 6 deletions(-)

diff --git a/drivers/net/sfc/base/efx_mcdi.c b/drivers/net/sfc/base/efx_mcdi.c
index f53be015b..c896aa0bf 100644
--- a/drivers/net/sfc/base/efx_mcdi.c
+++ b/drivers/net/sfc/base/efx_mcdi.c
@@ -2150,6 +2150,14 @@ efx_mcdi_get_workarounds(
  */
 #define	EFX_PHY_MEDIA_INFO_PAGE_SIZE		0x80
 
+/*
+ * Transceiver identifiers from SFF-8024 Table 4-1.
+ */
+#define	EFX_SFF_TRANSCEIVER_ID_SFP		0x03 /* SFP/SFP+/SFP28 */
+#define	EFX_SFF_TRANSCEIVER_ID_QSFP		0x0c /* QSFP */
+#define	EFX_SFF_TRANSCEIVER_ID_QSFP_PLUS	0x0d /* QSFP+ or later */
+#define	EFX_SFF_TRANSCEIVER_ID_QSFP28		0x11 /* QSFP28 or later */
+
 static	__checkReturn		efx_rc_t
 efx_mcdi_get_phy_media_info(
 	__in			efx_nic_t *enp,
@@ -2222,6 +2230,7 @@ efx_mcdi_phy_module_get_info(
 	efx_rc_t rc;
 	uint32_t mcdi_lower_page;
 	uint32_t mcdi_upper_page;
+	uint8_t id;
 
 	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
 
@@ -2235,6 +2244,26 @@ efx_mcdi_phy_module_get_info(
 	 */
 	switch (epp->ep_fixed_port_type) {
 	case EFX_PHY_MEDIA_SFP_PLUS:
+	case EFX_PHY_MEDIA_QSFP_PLUS:
+		/* Port type supports modules */
+		break;
+	default:
+		rc = ENOTSUP;
+		goto fail1;
+	}
+
+	/*
+	 * For all supported port types, MCDI page 0 offset 0 holds the
+	 * transceiver identifier. Probe to determine the data layout.
+	 * Definitions from SFF-8024 Table 4-1.
+	 */
+	rc = efx_mcdi_get_phy_media_info(enp,
+		    0, 0, sizeof(id), &id);
+	if (rc != 0)
+		goto fail2;
+
+	switch (id) {
+	case EFX_SFF_TRANSCEIVER_ID_SFP:
 		/*
 		 * In accordance with SFF-8472 Diagnostic Monitoring
 		 * Interface for Optical Transceivers section 4 Memory
@@ -2269,10 +2298,12 @@ efx_mcdi_phy_module_get_info(
 			break;
 		default:
 			rc = ENOTSUP;
-			goto fail1;
+			goto fail3;
 		}
 		break;
-	case EFX_PHY_MEDIA_QSFP_PLUS:
+	case EFX_SFF_TRANSCEIVER_ID_QSFP:
+	case EFX_SFF_TRANSCEIVER_ID_QSFP_PLUS:
+	case EFX_SFF_TRANSCEIVER_ID_QSFP28:
 		switch (dev_addr) {
 		case EFX_PHY_MEDIA_INFO_DEV_ADDR_QSFP:
 			/*
@@ -2288,12 +2319,12 @@ efx_mcdi_phy_module_get_info(
 			break;
 		default:
 			rc = ENOTSUP;
-			goto fail1;
+			goto fail3;
 		}
 		break;
 	default:
 		rc = ENOTSUP;
-		goto fail1;
+		goto fail3;
 	}
 
 	EFX_STATIC_ASSERT(EFX_PHY_MEDIA_INFO_PAGE_SIZE <= 0xFF);
@@ -2305,7 +2336,7 @@ efx_mcdi_phy_module_get_info(
 		rc = efx_mcdi_get_phy_media_info(enp,
 		    mcdi_lower_page, (uint8_t)offset, (uint8_t)read_len, data);
 		if (rc != 0)
-			goto fail2;
+			goto fail4;
 
 		data += read_len;
 		len -= read_len;
@@ -2322,11 +2353,15 @@ efx_mcdi_phy_module_get_info(
 		rc = efx_mcdi_get_phy_media_info(enp,
 		    mcdi_upper_page, (uint8_t)offset, (uint8_t)len, data);
 		if (rc != 0)
-			goto fail3;
+			goto fail5;
 	}
 
 	return (0);
 
+fail5:
+	EFSYS_PROBE(fail5);
+fail4:
+	EFSYS_PROBE(fail4);
 fail3:
 	EFSYS_PROBE(fail3);
 fail2:
-- 
2.17.1

  parent reply	other threads:[~2018-09-24 13:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 01/11] net/sfc/base: make last byte of module information available Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 02/11] net/sfc/base: expose PHY module device address constants Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 03/11] net/sfc/base: adjust PHY module info interface Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 04/11] net/sfc/base: update to current port mode terminology Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 05/11] net/sfc/base: add X2 port modes to bandwidth calculator Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 06/11] net/sfc/base: support improvements to bandwidth calculations Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 07/11] net/sfc/base: infer port mode bandwidth from max link speed Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 08/11] net/sfc/base: guard Rx scale code with corresponding option Andrew Rybchenko
2018-09-24 13:50 ` [dpdk-dev] [PATCH 09/11] net/sfc/base: add accessor to whole link status Andrew Rybchenko
2018-09-24 13:50 ` Andrew Rybchenko [this message]
2018-09-24 13:50 ` [dpdk-dev] [PATCH 11/11] net/sfc: add 50G and 100G XtremeScale X2 family adapters Andrew Rybchenko
2018-09-25 14:32 ` [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Ferruh Yigit

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=1537797030-26548-11-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=rhouldsworth@solarflare.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).