DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G
@ 2018-09-24 13:50 Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 01/11] net/sfc/base: make last byte of module information available Andrew Rybchenko
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev

Add base driver patches to support 50G and 100G XtremeScale X2
family adapters.

In this particular case it looks better to have separate patch which
updates documentation (as a cut line which summarizes the result).

There are few checkpatches.sh warnings due to coding style difference
in base driver.

Andrew Rybchenko (1):
  net/sfc: add 50G and 100G XtremeScale X2 family adapters

Richard Houldsworth (9):
  net/sfc/base: make last byte of module information available
  net/sfc/base: expose PHY module device address constants
  net/sfc/base: adjust PHY module info interface
  net/sfc/base: update to current port mode terminology
  net/sfc/base: add X2 port modes to bandwidth calculator
  net/sfc/base: support improvements to bandwidth calculations
  net/sfc/base: infer port mode bandwidth from max link speed
  net/sfc/base: add accessor to whole link status
  net/sfc/base: use transceiver ID when reading info

Tom Millington (1):
  net/sfc/base: guard Rx scale code with corresponding option

 doc/guides/nics/sfc_efx.rst         |   4 +
 drivers/net/sfc/base/ef10_impl.h    |  12 +--
 drivers/net/sfc/base/ef10_mac.c     |   6 +-
 drivers/net/sfc/base/ef10_nic.c     | 122 +++++++++++++++++++++-------
 drivers/net/sfc/base/ef10_phy.c     |  24 ++++--
 drivers/net/sfc/base/efx.h          |  48 ++++++++++-
 drivers/net/sfc/base/efx_impl.h     |   2 +-
 drivers/net/sfc/base/efx_mcdi.c     |  80 ++++++++++--------
 drivers/net/sfc/base/efx_mcdi.h     |   4 +-
 drivers/net/sfc/base/efx_phy.c      |  37 +++++++--
 drivers/net/sfc/base/hunt_nic.c     |  13 +--
 drivers/net/sfc/base/medford2_nic.c |  12 +--
 drivers/net/sfc/base/medford_nic.c  |  12 +--
 drivers/net/sfc/base/siena_nic.c    |   2 +
 14 files changed, 253 insertions(+), 125 deletions(-)

-- 
2.17.1

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

* [dpdk-dev] [PATCH 01/11] net/sfc/base: make last byte of module information available
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 02/11] net/sfc/base: expose PHY module device address constants Andrew Rybchenko
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth, stable

From: Richard Houldsworth <rhouldsworth@solarflare.com>

Adjust bounds so the interface supports reading
the last available byte of data.

Fixes: 19b64c6ac35f ("net/sfc/base: import libefx base")
Cc: stable@dpdk.org

Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/efx_phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sfc/base/efx_phy.c b/drivers/net/sfc/base/efx_phy.c
index 25059dfe1..e78d6efcb 100644
--- a/drivers/net/sfc/base/efx_phy.c
+++ b/drivers/net/sfc/base/efx_phy.c
@@ -297,7 +297,7 @@ efx_phy_module_get_info(
 	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
 	EFSYS_ASSERT(data != NULL);
 
-	if ((uint32_t)offset + len > 0xff) {
+	if ((uint32_t)offset + len > 0x100) {
 		rc = EINVAL;
 		goto fail1;
 	}
-- 
2.17.1

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

* [dpdk-dev] [PATCH 02/11] net/sfc/base: expose PHY module device address constants
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 03/11] net/sfc/base: adjust PHY module info interface Andrew Rybchenko
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

From: Richard Houldsworth <rhouldsworth@solarflare.com>

Rearrange so the valid addresses are visible to the caller.

Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/efx.h      | 21 +++++++++++++++++++++
 drivers/net/sfc/base/efx_mcdi.c | 21 ---------------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index fd68d69c7..9eefda6a5 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -1030,6 +1030,27 @@ efx_phy_media_type_get(
 	__in		efx_nic_t *enp,
 	__out		efx_phy_media_type_t *typep);
 
+/*
+ * 2-wire device address of the base information in accordance with SFF-8472
+ * Diagnostic Monitoring Interface for Optical Transceivers section
+ * 4 Memory Organization.
+ */
+#define	EFX_PHY_MEDIA_INFO_DEV_ADDR_SFP_BASE	0xA0
+
+/*
+ * 2-wire device address of the digital diagnostics monitoring interface
+ * in accordance with SFF-8472 Diagnostic Monitoring Interface for Optical
+ * Transceivers section 4 Memory Organization.
+ */
+#define	EFX_PHY_MEDIA_INFO_DEV_ADDR_SFP_DDM	0xA2
+
+/*
+ * Hard wired 2-wire device address for QSFP+ in accordance with SFF-8436
+ * QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER section 7.4 Device Addressing and
+ * Operation.
+ */
+#define	EFX_PHY_MEDIA_INFO_DEV_ADDR_QSFP	0xA0
+
 extern	__checkReturn		efx_rc_t
 efx_phy_module_get_info(
 	__in			efx_nic_t *enp,
diff --git a/drivers/net/sfc/base/efx_mcdi.c b/drivers/net/sfc/base/efx_mcdi.c
index c8d670c23..01cc64e2e 100644
--- a/drivers/net/sfc/base/efx_mcdi.c
+++ b/drivers/net/sfc/base/efx_mcdi.c
@@ -2210,27 +2210,6 @@ efx_mcdi_get_phy_media_info(
 	return (rc);
 }
 
-/*
- * 2-wire device address of the base information in accordance with SFF-8472
- * Diagnostic Monitoring Interface for Optical Transceivers section
- * 4 Memory Organization.
- */
-#define	EFX_PHY_MEDIA_INFO_DEV_ADDR_SFP_BASE	0xA0
-
-/*
- * 2-wire device address of the digital diagnostics monitoring interface
- * in accordance with SFF-8472 Diagnostic Monitoring Interface for Optical
- * Transceivers section 4 Memory Organization.
- */
-#define	EFX_PHY_MEDIA_INFO_DEV_ADDR_SFP_DDM	0xA2
-
-/*
- * Hard wired 2-wire device address for QSFP+ in accordance with SFF-8436
- * QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER section 7.4 Device Addressing and
- * Operation.
- */
-#define	EFX_PHY_MEDIA_INFO_DEV_ADDR_QSFP	0xA0
-
 	__checkReturn		efx_rc_t
 efx_mcdi_phy_module_get_info(
 	__in			efx_nic_t *enp,
-- 
2.17.1

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

* [dpdk-dev] [PATCH 03/11] net/sfc/base: adjust PHY module info interface
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 04/11] net/sfc/base: update to current port mode terminology Andrew Rybchenko
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

From: Richard Houldsworth <rhouldsworth@solarflare.com>

Adjust data types in interface to permit the complete
module information buffer to be obtained in a single
call.

Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/efx.h      | 10 ++++++++--
 drivers/net/sfc/base/efx_mcdi.c | 12 +++++++-----
 drivers/net/sfc/base/efx_mcdi.h |  4 ++--
 drivers/net/sfc/base/efx_phy.c  |  7 ++++---
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index 9eefda6a5..a8c3ae301 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -1051,12 +1051,18 @@ efx_phy_media_type_get(
  */
 #define	EFX_PHY_MEDIA_INFO_DEV_ADDR_QSFP	0xA0
 
+/*
+ * Maximum accessible data offset for PHY module information.
+ */
+#define	EFX_PHY_MEDIA_INFO_MAX_OFFSET		0x100
+
+
 extern	__checkReturn		efx_rc_t
 efx_phy_module_get_info(
 	__in			efx_nic_t *enp,
 	__in			uint8_t dev_addr,
-	__in			uint8_t offset,
-	__in			uint8_t len,
+	__in			size_t offset,
+	__in			size_t len,
 	__out_bcount(len)	uint8_t *data);
 
 #if EFSYS_OPT_PHY_STATS
diff --git a/drivers/net/sfc/base/efx_mcdi.c b/drivers/net/sfc/base/efx_mcdi.c
index 01cc64e2e..f53be015b 100644
--- a/drivers/net/sfc/base/efx_mcdi.c
+++ b/drivers/net/sfc/base/efx_mcdi.c
@@ -2214,8 +2214,8 @@ efx_mcdi_get_phy_media_info(
 efx_mcdi_phy_module_get_info(
 	__in			efx_nic_t *enp,
 	__in			uint8_t dev_addr,
-	__in			uint8_t offset,
-	__in			uint8_t len,
+	__in			size_t offset,
+	__in			size_t len,
 	__out_bcount(len)	uint8_t *data)
 {
 	efx_port_t *epp = &(enp->en_port);
@@ -2296,12 +2296,14 @@ efx_mcdi_phy_module_get_info(
 		goto fail1;
 	}
 
+	EFX_STATIC_ASSERT(EFX_PHY_MEDIA_INFO_PAGE_SIZE <= 0xFF);
+
 	if (offset < EFX_PHY_MEDIA_INFO_PAGE_SIZE) {
-		uint8_t read_len =
+		size_t read_len =
 		    MIN(len, EFX_PHY_MEDIA_INFO_PAGE_SIZE - offset);
 
 		rc = efx_mcdi_get_phy_media_info(enp,
-		    mcdi_lower_page, offset, read_len, data);
+		    mcdi_lower_page, (uint8_t)offset, (uint8_t)read_len, data);
 		if (rc != 0)
 			goto fail2;
 
@@ -2318,7 +2320,7 @@ efx_mcdi_phy_module_get_info(
 		EFSYS_ASSERT3U(offset, <, EFX_PHY_MEDIA_INFO_PAGE_SIZE);
 
 		rc = efx_mcdi_get_phy_media_info(enp,
-		    mcdi_upper_page, offset, len, data);
+		    mcdi_upper_page, (uint8_t)offset, (uint8_t)len, data);
 		if (rc != 0)
 			goto fail3;
 	}
diff --git a/drivers/net/sfc/base/efx_mcdi.h b/drivers/net/sfc/base/efx_mcdi.h
index 40072405e..ddf91c111 100644
--- a/drivers/net/sfc/base/efx_mcdi.h
+++ b/drivers/net/sfc/base/efx_mcdi.h
@@ -219,8 +219,8 @@ extern	__checkReturn	efx_rc_t
 efx_mcdi_phy_module_get_info(
 	__in			efx_nic_t *enp,
 	__in			uint8_t dev_addr,
-	__in			uint8_t offset,
-	__in			uint8_t len,
+	__in			size_t offset,
+	__in			size_t len,
 	__out_bcount(len)	uint8_t *data);
 
 #define	MCDI_IN(_emr, _type, _ofst)					\
diff --git a/drivers/net/sfc/base/efx_phy.c b/drivers/net/sfc/base/efx_phy.c
index e78d6efcb..63b89e6a4 100644
--- a/drivers/net/sfc/base/efx_phy.c
+++ b/drivers/net/sfc/base/efx_phy.c
@@ -288,8 +288,8 @@ efx_phy_media_type_get(
 efx_phy_module_get_info(
 	__in			efx_nic_t *enp,
 	__in			uint8_t dev_addr,
-	__in			uint8_t offset,
-	__in			uint8_t len,
+	__in			size_t offset,
+	__in			size_t len,
 	__out_bcount(len)	uint8_t *data)
 {
 	efx_rc_t rc;
@@ -297,7 +297,8 @@ efx_phy_module_get_info(
 	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
 	EFSYS_ASSERT(data != NULL);
 
-	if ((uint32_t)offset + len > 0x100) {
+	if ((offset > EFX_PHY_MEDIA_INFO_MAX_OFFSET) ||
+	    ((offset + len) > EFX_PHY_MEDIA_INFO_MAX_OFFSET)) {
 		rc = EINVAL;
 		goto fail1;
 	}
-- 
2.17.1

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

* [dpdk-dev] [PATCH 04/11] net/sfc/base: update to current port mode terminology
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (2 preceding siblings ...)
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 05/11] net/sfc/base: add X2 port modes to bandwidth calculator Andrew Rybchenko
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

From: Richard Houldsworth <rhouldsworth@solarflare.com>

>From Medford onwards, the newer constants enumerating
port modes should be used.

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

diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index b54cd3940..c3634e351 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -135,26 +135,29 @@ ef10_nic_get_port_mode_bandwidth(
 	efx_rc_t rc;
 
 	switch (port_mode) {
-	case TLV_PORT_MODE_10G:
+	case TLV_PORT_MODE_1x1_NA:			/* mode 0 */
 		bandwidth = 10000;
 		break;
-	case TLV_PORT_MODE_10G_10G:
+	case TLV_PORT_MODE_1x1_1x1:			/* mode 2 */
 		bandwidth = 10000 * 2;
 		break;
-	case TLV_PORT_MODE_10G_10G_10G_10G:
-	case TLV_PORT_MODE_10G_10G_10G_10G_Q:
-	case TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2:
-	case TLV_PORT_MODE_10G_10G_10G_10G_Q2:
+	case TLV_PORT_MODE_4x1_NA:			/* mode 4 */
+	case TLV_PORT_MODE_2x1_2x1:			/* mode 5 */
+	case TLV_PORT_MODE_NA_4x1:			/* mode 8 */
 		bandwidth = 10000 * 4;
 		break;
-	case TLV_PORT_MODE_40G:
+	/* Legacy Medford-only mode. Do not use (see bug63270) */
+	case TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2:	/* mode 9 */
+		bandwidth = 10000 * 4;
+		break;
+	case TLV_PORT_MODE_1x4_NA:			/* mode 1 */
 		bandwidth = 40000;
 		break;
-	case TLV_PORT_MODE_40G_40G:
+	case TLV_PORT_MODE_1x4_1x4:			/* mode 3 */
 		bandwidth = 40000 * 2;
 		break;
-	case TLV_PORT_MODE_40G_10G_10G:
-	case TLV_PORT_MODE_10G_10G_40G:
+	case TLV_PORT_MODE_1x4_2x1:			/* mode 6 */
+	case TLV_PORT_MODE_2x1_1x4:			/* mode 7 */
 		bandwidth = 40000 + (10000 * 2);
 		break;
 	default:
@@ -1468,8 +1471,8 @@ static struct ef10_external_port_map_s {
 	 */
 	{
 		EFX_FAMILY_MEDFORD,
-		(1U << TLV_PORT_MODE_10G) |			/* mode 0 */
-		(1U << TLV_PORT_MODE_10G_10G),			/* mode 2 */
+		(1U << TLV_PORT_MODE_1x1_NA) |			/* mode 0 */
+		(1U << TLV_PORT_MODE_1x1_1x1),			/* mode 2 */
 		1,	/* ports per cage */
 		1	/* first cage */
 	},
@@ -1483,10 +1486,10 @@ static struct ef10_external_port_map_s {
 	 */
 	{
 		EFX_FAMILY_MEDFORD,
-		(1U << TLV_PORT_MODE_40G) |			/* mode 1 */
-		(1U << TLV_PORT_MODE_40G_40G) |			/* mode 3 */
-		(1U << TLV_PORT_MODE_40G_10G_10G) |		/* mode 6 */
-		(1U << TLV_PORT_MODE_10G_10G_40G) |		/* mode 7 */
+		(1U << TLV_PORT_MODE_1x4_NA) |			/* mode 1 */
+		(1U << TLV_PORT_MODE_1x4_1x4) |			/* mode 3 */
+		(1U << TLV_PORT_MODE_1x4_2x1) |			/* mode 6 */
+		(1U << TLV_PORT_MODE_2x1_1x4) |			/* mode 7 */
 		/* Do not use 10G_10G_10G_10G_Q1_Q2 (see bug63270) */
 		(1U << TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2),	/* mode 9 */
 		2,	/* ports per cage */
@@ -1502,9 +1505,9 @@ static struct ef10_external_port_map_s {
 	 */
 	{
 		EFX_FAMILY_MEDFORD,
-		(1U << TLV_PORT_MODE_10G_10G_10G_10G_Q) |	/* mode 5 */
+		(1U << TLV_PORT_MODE_2x1_2x1) |			/* mode 5 */
 		/* Do not use 10G_10G_10G_10G_Q1 (see bug63270) */
-		(1U << TLV_PORT_MODE_10G_10G_10G_10G_Q1),	/* mode 4 */
+		(1U << TLV_PORT_MODE_4x1_NA),			/* mode 4 */
 		4,	/* ports per cage */
 		1	/* first cage */
 	},
@@ -1518,7 +1521,7 @@ static struct ef10_external_port_map_s {
 	 */
 	{
 		EFX_FAMILY_MEDFORD,
-		(1U << TLV_PORT_MODE_10G_10G_10G_10G_Q2),	/* mode 8 */
+		(1U << TLV_PORT_MODE_NA_4x1),			/* mode 8 */
 		4,	/* ports per cage */
 		2	/* first cage */
 	},
-- 
2.17.1

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

* [dpdk-dev] [PATCH 05/11] net/sfc/base: add X2 port modes to bandwidth calculator
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (3 preceding siblings ...)
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 06/11] net/sfc/base: support improvements to bandwidth calculations Andrew Rybchenko
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

From: Richard Houldsworth <rhouldsworth@solarflare.com>

Add cases for the new port modes supported by X2 NICs.
Lane bandwidth is calculated for pre-X2 cards so is an
underestimate for X2 in 25G/100G modes.

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

diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index c3634e351..1eea7c673 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -131,34 +131,59 @@ ef10_nic_get_port_mode_bandwidth(
 	__in		uint32_t port_mode,
 	__out		uint32_t *bandwidth_mbpsp)
 {
+	uint32_t single_lane = 10000;
+	uint32_t dual_lane   = 50000;
+	uint32_t quad_lane   = 40000;
 	uint32_t bandwidth;
 	efx_rc_t rc;
 
 	switch (port_mode) {
 	case TLV_PORT_MODE_1x1_NA:			/* mode 0 */
-		bandwidth = 10000;
+		bandwidth = single_lane;
+		break;
+	case TLV_PORT_MODE_1x2_NA:			/* mode 10 */
+	case TLV_PORT_MODE_NA_1x2:			/* mode 11 */
+		bandwidth = dual_lane;
 		break;
 	case TLV_PORT_MODE_1x1_1x1:			/* mode 2 */
-		bandwidth = 10000 * 2;
+		bandwidth = single_lane + single_lane;
 		break;
 	case TLV_PORT_MODE_4x1_NA:			/* mode 4 */
-	case TLV_PORT_MODE_2x1_2x1:			/* mode 5 */
 	case TLV_PORT_MODE_NA_4x1:			/* mode 8 */
-		bandwidth = 10000 * 4;
+		bandwidth = 4 * single_lane;
+		break;
+	case TLV_PORT_MODE_2x1_2x1:			/* mode 5 */
+		bandwidth = (2 * single_lane) + (2 * single_lane);
+		break;
+	case TLV_PORT_MODE_1x2_1x2:			/* mode 12 */
+		bandwidth = dual_lane + dual_lane;
+		break;
+	case TLV_PORT_MODE_1x2_2x1:			/* mode 17 */
+	case TLV_PORT_MODE_2x1_1x2:			/* mode 18 */
+		bandwidth = dual_lane + (2 * single_lane);
 		break;
 	/* Legacy Medford-only mode. Do not use (see bug63270) */
 	case TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2:	/* mode 9 */
-		bandwidth = 10000 * 4;
+		bandwidth = 4 * single_lane;
 		break;
 	case TLV_PORT_MODE_1x4_NA:			/* mode 1 */
-		bandwidth = 40000;
+	case TLV_PORT_MODE_NA_1x4:			/* mode 22 */
+		bandwidth = quad_lane;
 		break;
-	case TLV_PORT_MODE_1x4_1x4:			/* mode 3 */
-		bandwidth = 40000 * 2;
+	case TLV_PORT_MODE_2x2_NA:			/* mode 13 */
+	case TLV_PORT_MODE_NA_2x2:			/* mode 14 */
+		bandwidth = 2 * dual_lane;
 		break;
 	case TLV_PORT_MODE_1x4_2x1:			/* mode 6 */
 	case TLV_PORT_MODE_2x1_1x4:			/* mode 7 */
-		bandwidth = 40000 + (10000 * 2);
+		bandwidth = quad_lane + (2 * single_lane);
+		break;
+	case TLV_PORT_MODE_1x4_1x2:			/* mode 15 */
+	case TLV_PORT_MODE_1x2_1x4:			/* mode 16 */
+		bandwidth = quad_lane + dual_lane;
+		break;
+	case TLV_PORT_MODE_1x4_1x4:			/* mode 3 */
+		bandwidth = quad_lane + quad_lane;
 		break;
 	default:
 		rc = EINVAL;
-- 
2.17.1

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

* [dpdk-dev] [PATCH 06/11] net/sfc/base: support improvements to bandwidth calculations
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (4 preceding siblings ...)
  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 ` 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
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

From: Richard Houldsworth <rhouldsworth@solarflare.com>

Change the interface to ef10_nic_get_port_mode_bandwidth()
so more NIC information can be used to infer bandwidth
requirements. Huntington calculations separated out
completely.

Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_impl.h    |  2 +-
 drivers/net/sfc/base/ef10_nic.c     | 16 +++++++++++++---
 drivers/net/sfc/base/hunt_nic.c     | 13 +++----------
 drivers/net/sfc/base/medford2_nic.c | 12 +-----------
 drivers/net/sfc/base/medford_nic.c  | 12 +-----------
 5 files changed, 19 insertions(+), 36 deletions(-)

diff --git a/drivers/net/sfc/base/ef10_impl.h b/drivers/net/sfc/base/ef10_impl.h
index b72e7d256..e43e26e68 100644
--- a/drivers/net/sfc/base/ef10_impl.h
+++ b/drivers/net/sfc/base/ef10_impl.h
@@ -1174,7 +1174,7 @@ efx_mcdi_get_port_modes(
 
 extern	__checkReturn	efx_rc_t
 ef10_nic_get_port_mode_bandwidth(
-	__in		uint32_t port_mode,
+	__in		efx_nic_t *enp,
 	__out		uint32_t *bandwidth_mbpsp);
 
 extern	__checkReturn	efx_rc_t
diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index 1eea7c673..8cd76d690 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -128,16 +128,24 @@ efx_mcdi_get_port_modes(
 
 	__checkReturn	efx_rc_t
 ef10_nic_get_port_mode_bandwidth(
-	__in		uint32_t port_mode,
+	__in		efx_nic_t *enp,
 	__out		uint32_t *bandwidth_mbpsp)
 {
+	uint32_t port_modes;
+	uint32_t current_mode;
 	uint32_t single_lane = 10000;
 	uint32_t dual_lane   = 50000;
 	uint32_t quad_lane   = 40000;
 	uint32_t bandwidth;
 	efx_rc_t rc;
 
-	switch (port_mode) {
+	if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
+				    &current_mode, NULL)) != 0) {
+		/* No port mode info available. */
+		goto fail1;
+	}
+
+	switch (current_mode) {
 	case TLV_PORT_MODE_1x1_NA:			/* mode 0 */
 		bandwidth = single_lane;
 		break;
@@ -187,13 +195,15 @@ ef10_nic_get_port_mode_bandwidth(
 		break;
 	default:
 		rc = EINVAL;
-		goto fail1;
+		goto fail2;
 	}
 
 	*bandwidth_mbpsp = bandwidth;
 
 	return (0);
 
+fail2:
+	EFSYS_PROBE(fail2);
 fail1:
 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
diff --git a/drivers/net/sfc/base/hunt_nic.c b/drivers/net/sfc/base/hunt_nic.c
index 70c042f3f..ca30e90f7 100644
--- a/drivers/net/sfc/base/hunt_nic.c
+++ b/drivers/net/sfc/base/hunt_nic.c
@@ -20,7 +20,6 @@ hunt_nic_get_required_pcie_bandwidth(
 	__out		uint32_t *bandwidth_mbpsp)
 {
 	uint32_t port_modes;
-	uint32_t max_port_mode;
 	uint32_t bandwidth;
 	efx_rc_t rc;
 
@@ -47,17 +46,13 @@ hunt_nic_get_required_pcie_bandwidth(
 			goto fail1;
 	} else {
 		if (port_modes & (1U << TLV_PORT_MODE_40G)) {
-			max_port_mode = TLV_PORT_MODE_40G;
+			bandwidth = 40000;
 		} else if (port_modes & (1U << TLV_PORT_MODE_10G_10G_10G_10G)) {
-			max_port_mode = TLV_PORT_MODE_10G_10G_10G_10G;
+			bandwidth = 4 * 10000;
 		} else {
 			/* Assume two 10G ports */
-			max_port_mode = TLV_PORT_MODE_10G_10G;
+			bandwidth = 2 * 10000;
 		}
-
-		if ((rc = ef10_nic_get_port_mode_bandwidth(max_port_mode,
-							    &bandwidth)) != 0)
-			goto fail2;
 	}
 
 out:
@@ -65,8 +60,6 @@ hunt_nic_get_required_pcie_bandwidth(
 
 	return (0);
 
-fail2:
-	EFSYS_PROBE(fail2);
 fail1:
 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
diff --git a/drivers/net/sfc/base/medford2_nic.c b/drivers/net/sfc/base/medford2_nic.c
index 3efc35886..6bc1e87cc 100644
--- a/drivers/net/sfc/base/medford2_nic.c
+++ b/drivers/net/sfc/base/medford2_nic.c
@@ -15,25 +15,15 @@ medford2_nic_get_required_pcie_bandwidth(
 	__in		efx_nic_t *enp,
 	__out		uint32_t *bandwidth_mbpsp)
 {
-	uint32_t port_modes;
-	uint32_t current_mode;
 	uint32_t bandwidth;
 	efx_rc_t rc;
 
 	/* FIXME: support new Medford2 dynamic port modes */
 
-	if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
-				    &current_mode, NULL)) != 0) {
-		/* No port mode info available. */
-		bandwidth = 0;
-		goto out;
-	}
-
-	if ((rc = ef10_nic_get_port_mode_bandwidth(current_mode,
+	if ((rc = ef10_nic_get_port_mode_bandwidth(enp,
 						    &bandwidth)) != 0)
 		goto fail1;
 
-out:
 	*bandwidth_mbpsp = bandwidth;
 
 	return (0);
diff --git a/drivers/net/sfc/base/medford_nic.c b/drivers/net/sfc/base/medford_nic.c
index 4f1896343..bfe01ca93 100644
--- a/drivers/net/sfc/base/medford_nic.c
+++ b/drivers/net/sfc/base/medford_nic.c
@@ -15,23 +15,13 @@ medford_nic_get_required_pcie_bandwidth(
 	__in		efx_nic_t *enp,
 	__out		uint32_t *bandwidth_mbpsp)
 {
-	uint32_t port_modes;
-	uint32_t current_mode;
 	uint32_t bandwidth;
 	efx_rc_t rc;
 
-	if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
-				    &current_mode, NULL)) != 0) {
-		/* No port mode info available. */
-		bandwidth = 0;
-		goto out;
-	}
-
-	if ((rc = ef10_nic_get_port_mode_bandwidth(current_mode,
+	if ((rc = ef10_nic_get_port_mode_bandwidth(enp,
 						    &bandwidth)) != 0)
 		goto fail1;
 
-out:
 	*bandwidth_mbpsp = bandwidth;
 
 	return (0);
-- 
2.17.1

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

* [dpdk-dev] [PATCH 07/11] net/sfc/base: infer port mode bandwidth from max link speed
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (5 preceding siblings ...)
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 08/11] net/sfc/base: guard Rx scale code with corresponding option Andrew Rybchenko
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

From: Richard Houldsworth <rhouldsworth@solarflare.com>

Limit the port mode bandwidth calculations by the maximum
reported link speed. This system detects 25G vs 10G cards,
and 100G port modes vs 40G.

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

diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index 8cd76d690..c197ff957 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -133,9 +133,11 @@ ef10_nic_get_port_mode_bandwidth(
 {
 	uint32_t port_modes;
 	uint32_t current_mode;
-	uint32_t single_lane = 10000;
-	uint32_t dual_lane   = 50000;
-	uint32_t quad_lane   = 40000;
+	efx_port_t *epp = &(enp->en_port);
+
+	uint32_t single_lane;
+	uint32_t dual_lane;
+	uint32_t quad_lane;
 	uint32_t bandwidth;
 	efx_rc_t rc;
 
@@ -145,6 +147,21 @@ ef10_nic_get_port_mode_bandwidth(
 		goto fail1;
 	}
 
+	if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_25000FDX))
+		single_lane = 25000;
+	else
+		single_lane = 10000;
+
+	if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_50000FDX))
+		dual_lane = 50000;
+	else
+		dual_lane = 20000;
+
+	if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_100000FDX))
+		quad_lane = 100000;
+	else
+		quad_lane = 40000;
+
 	switch (current_mode) {
 	case TLV_PORT_MODE_1x1_NA:			/* mode 0 */
 		bandwidth = single_lane;
-- 
2.17.1

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

* [dpdk-dev] [PATCH 08/11] net/sfc/base: guard Rx scale code with corresponding option
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (6 preceding siblings ...)
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 09/11] net/sfc/base: add accessor to whole link status Andrew Rybchenko
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Tom Millington

From: Tom Millington <tmillington@solarflare.com>

Previously only some of the code was guarded by this which caused
a build error when EFSYS_OPT_RX_SCALE is 0 (e.g. in manftest).

Signed-off-by: Tom Millington <tmillington@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_nic.c  | 7 +++++++
 drivers/net/sfc/base/efx.h       | 2 ++
 drivers/net/sfc/base/siena_nic.c | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index c197ff957..1b3d60682 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -1086,11 +1086,13 @@ ef10_get_datapath_caps(
 	}
 	encp->enc_rx_prefix_size = 14;
 
+#if EFSYS_OPT_RX_SCALE
 	/* Check if the firmware supports additional RSS modes */
 	if (CAP_FLAGS1(req, ADDITIONAL_RSS_MODES))
 		encp->enc_rx_scale_additional_modes_supported = B_TRUE;
 	else
 		encp->enc_rx_scale_additional_modes_supported = B_FALSE;
+#endif /* EFSYS_OPT_RX_SCALE */
 
 	/* Check if the firmware supports TSO */
 	if (CAP_FLAGS1(req, TX_TSO))
@@ -1296,6 +1298,7 @@ ef10_get_datapath_caps(
 	else
 		encp->enc_hlb_counters = B_FALSE;
 
+#if EFSYS_OPT_RX_SCALE
 	if (CAP_FLAGS1(req, RX_RSS_LIMITED)) {
 		/* Only one exclusive RSS context is available per port. */
 		encp->enc_rx_scale_max_exclusive_contexts = 1;
@@ -1345,6 +1348,8 @@ ef10_get_datapath_caps(
 		 */
 		encp->enc_rx_scale_l4_hash_supported = B_TRUE;
 	}
+#endif /* EFSYS_OPT_RX_SCALE */
+
 	/* Check if the firmware supports "FLAG" and "MARK" filter actions */
 	if (CAP_FLAGS2(req, FILTER_ACTION_FLAG))
 		encp->enc_filter_action_flag_supported = B_TRUE;
@@ -1368,8 +1373,10 @@ ef10_get_datapath_caps(
 
 	return (0);
 
+#if EFSYS_OPT_RX_SCALE
 fail5:
 	EFSYS_PROBE(fail5);
+#endif /* EFSYS_OPT_RX_SCALE */
 fail4:
 	EFSYS_PROBE(fail4);
 fail3:
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index a8c3ae301..246708f9c 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -1281,6 +1281,7 @@ typedef struct efx_nic_cfg_s {
 	uint32_t		enc_rx_prefix_size;
 	uint32_t		enc_rx_buf_align_start;
 	uint32_t		enc_rx_buf_align_end;
+#if EFSYS_OPT_RX_SCALE
 	uint32_t		enc_rx_scale_max_exclusive_contexts;
 	/*
 	 * Mask of supported hash algorithms.
@@ -1293,6 +1294,7 @@ typedef struct efx_nic_cfg_s {
 	 */
 	boolean_t		enc_rx_scale_l4_hash_supported;
 	boolean_t		enc_rx_scale_additional_modes_supported;
+#endif /* EFSYS_OPT_RX_SCALE */
 #if EFSYS_OPT_LOOPBACK
 	efx_qword_t		enc_loopback_types[EFX_LINK_NMODES];
 #endif	/* EFSYS_OPT_LOOPBACK */
diff --git a/drivers/net/sfc/base/siena_nic.c b/drivers/net/sfc/base/siena_nic.c
index 8a58986e8..fca17171b 100644
--- a/drivers/net/sfc/base/siena_nic.c
+++ b/drivers/net/sfc/base/siena_nic.c
@@ -114,6 +114,7 @@ siena_board_cfg(
 	/* Alignment for WPTR updates */
 	encp->enc_rx_push_align = 1;
 
+#if EFSYS_OPT_RX_SCALE
 	/* There is one RSS context per function */
 	encp->enc_rx_scale_max_exclusive_contexts = 1;
 
@@ -128,6 +129,7 @@ siena_board_cfg(
 
 	/* There is no support for additional RSS modes */
 	encp->enc_rx_scale_additional_modes_supported = B_FALSE;
+#endif /* EFSYS_OPT_RX_SCALE */
 
 	encp->enc_tx_dma_desc_size_max = EFX_MASK32(FSF_AZ_TX_KER_BYTE_COUNT);
 	/* Fragments must not span 4k boundaries. */
-- 
2.17.1

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

* [dpdk-dev] [PATCH 09/11] net/sfc/base: add accessor to whole link status
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (7 preceding siblings ...)
  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 ` Andrew Rybchenko
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 10/11] net/sfc/base: use transceiver ID when reading info Andrew Rybchenko
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

From: Richard Houldsworth <rhouldsworth@solarflare.com>

Add a function which makes an MCDI GET_LINK request and
packages up the results. Currently, the get-link function
is triggered from several entry points which then pass
on or store selected parts of the data. When the driver
needs to obtain the current link state, it is more
efficient to do this in a single call.

Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_impl.h | 10 +++-------
 drivers/net/sfc/base/ef10_mac.c  |  6 +++---
 drivers/net/sfc/base/ef10_nic.c  |  4 ++--
 drivers/net/sfc/base/ef10_phy.c  | 24 ++++++++++++++++--------
 drivers/net/sfc/base/efx.h       | 15 +++++++++++++++
 drivers/net/sfc/base/efx_impl.h  |  2 +-
 drivers/net/sfc/base/efx_phy.c   | 30 ++++++++++++++++++++++++++----
 7 files changed, 66 insertions(+), 25 deletions(-)

diff --git a/drivers/net/sfc/base/ef10_impl.h b/drivers/net/sfc/base/ef10_impl.h
index e43e26e68..f971063a1 100644
--- a/drivers/net/sfc/base/ef10_impl.h
+++ b/drivers/net/sfc/base/ef10_impl.h
@@ -593,11 +593,7 @@ ef10_nvram_buffer_finish(
 /* PHY */
 
 typedef struct ef10_link_state_s {
-	uint32_t		els_adv_cap_mask;
-	uint32_t		els_lp_cap_mask;
-	unsigned int		els_fcntl;
-	efx_phy_fec_type_t	els_fec;
-	efx_link_mode_t		els_link_mode;
+	efx_phy_link_state_t	epls;
 #if EFSYS_OPT_LOOPBACK
 	efx_loopback_type_t	els_loopback;
 #endif
@@ -634,9 +630,9 @@ ef10_phy_oui_get(
 	__out		uint32_t *ouip);
 
 extern	__checkReturn	efx_rc_t
-ef10_phy_fec_type_get(
+ef10_phy_link_state_get(
 	__in		efx_nic_t *enp,
-	__out		efx_phy_fec_type_t *fecp);
+	__out		efx_phy_link_state_t *eplsp);
 
 #if EFSYS_OPT_PHY_STATS
 
diff --git a/drivers/net/sfc/base/ef10_mac.c b/drivers/net/sfc/base/ef10_mac.c
index ab73828f1..9f10f6f79 100644
--- a/drivers/net/sfc/base/ef10_mac.c
+++ b/drivers/net/sfc/base/ef10_mac.c
@@ -22,10 +22,10 @@ ef10_mac_poll(
 	if ((rc = ef10_phy_get_link(enp, &els)) != 0)
 		goto fail1;
 
-	epp->ep_adv_cap_mask = els.els_adv_cap_mask;
-	epp->ep_fcntl = els.els_fcntl;
+	epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask;
+	epp->ep_fcntl = els.epls.epls_fcntl;
 
-	*link_modep = els.els_link_mode;
+	*link_modep = els.epls.epls_link_mode;
 
 	return (0);
 
diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index 1b3d60682..50e23b7d4 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -1852,8 +1852,8 @@ ef10_nic_board_cfg(
 	/* Obtain the default PHY advertised capabilities */
 	if ((rc = ef10_phy_get_link(enp, &els)) != 0)
 		goto fail7;
-	epp->ep_default_adv_cap_mask = els.els_adv_cap_mask;
-	epp->ep_adv_cap_mask = els.els_adv_cap_mask;
+	epp->ep_default_adv_cap_mask = els.epls.epls_adv_cap_mask;
+	epp->ep_adv_cap_mask = els.epls.epls_adv_cap_mask;
 
 	/* Check capabilities of running datapath firmware */
 	if ((rc = ef10_get_datapath_caps(enp)) != 0)
diff --git a/drivers/net/sfc/base/ef10_phy.c b/drivers/net/sfc/base/ef10_phy.c
index ec3600e96..84ccdde5d 100644
--- a/drivers/net/sfc/base/ef10_phy.c
+++ b/drivers/net/sfc/base/ef10_phy.c
@@ -286,9 +286,9 @@ ef10_phy_get_link(
 	}
 
 	mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_CAP),
-			    &elsp->els_adv_cap_mask);
+			    &elsp->epls.epls_adv_cap_mask);
 	mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_LP_CAP),
-			    &elsp->els_lp_cap_mask);
+			    &elsp->epls.epls_lp_cap_mask);
 
 	if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_V2_LEN)
 		fec = MC_CMD_FEC_NONE;
@@ -298,8 +298,16 @@ ef10_phy_get_link(
 	mcdi_phy_decode_link_mode(enp, MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS),
 			    MCDI_OUT_DWORD(req, GET_LINK_OUT_LINK_SPEED),
 			    MCDI_OUT_DWORD(req, GET_LINK_OUT_FCNTL),
-			    fec, &elsp->els_link_mode,
-			    &elsp->els_fcntl, &elsp->els_fec);
+			    fec, &elsp->epls.epls_link_mode,
+			    &elsp->epls.epls_fcntl, &elsp->epls.epls_fec);
+
+	if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_V2_LEN) {
+		elsp->epls.epls_ld_cap_mask = 0;
+	} else {
+		mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_V2_LD_CAP),
+				    &elsp->epls.epls_ld_cap_mask);
+	}
+
 
 #if EFSYS_OPT_LOOPBACK
 	/*
@@ -543,18 +551,18 @@ ef10_phy_oui_get(
 }
 
 	__checkReturn	efx_rc_t
-ef10_phy_fec_type_get(
+ef10_phy_link_state_get(
 	__in		efx_nic_t *enp,
-	__out		efx_phy_fec_type_t  *fecp)
+	__out		efx_phy_link_state_t  *eplsp)
 {
 	efx_rc_t rc;
 	ef10_link_state_t els;
 
-	/* Obtain the active FEC type */
+	/* Obtain the active link state */
 	if ((rc = ef10_phy_get_link(enp, &els)) != 0)
 		goto fail1;
 
-	*fecp = els.els_fec;
+	*eplsp = els.epls;
 
 	return (0);
 
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index 246708f9c..8e10e8934 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -3257,6 +3257,21 @@ efx_phy_fec_type_get(
 	__in		efx_nic_t *enp,
 	__out		efx_phy_fec_type_t *typep);
 
+typedef struct efx_phy_link_state_s {
+	uint32_t		epls_adv_cap_mask;
+	uint32_t		epls_lp_cap_mask;
+	uint32_t		epls_ld_cap_mask;
+	unsigned int		epls_fcntl;
+	efx_phy_fec_type_t	epls_fec;
+	efx_link_mode_t		epls_link_mode;
+} efx_phy_link_state_t;
+
+extern	__checkReturn	efx_rc_t
+efx_phy_link_state_get(
+	__in		efx_nic_t *enp,
+	__out		efx_phy_link_state_t  *eplsp);
+
+
 #ifdef	__cplusplus
 }
 #endif
diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h
index 9f44d2f64..bad23f819 100644
--- a/drivers/net/sfc/base/efx_impl.h
+++ b/drivers/net/sfc/base/efx_impl.h
@@ -224,7 +224,7 @@ typedef struct efx_phy_ops_s {
 	efx_rc_t	(*epo_reconfigure)(efx_nic_t *);
 	efx_rc_t	(*epo_verify)(efx_nic_t *);
 	efx_rc_t	(*epo_oui_get)(efx_nic_t *, uint32_t *);
-	efx_rc_t	(*epo_fec_type_get)(efx_nic_t *, efx_phy_fec_type_t *);
+	efx_rc_t	(*epo_link_state_get)(efx_nic_t *, efx_phy_link_state_t *);
 #if EFSYS_OPT_PHY_STATS
 	efx_rc_t	(*epo_stats_update)(efx_nic_t *, efsys_mem_t *,
 					    uint32_t *);
diff --git a/drivers/net/sfc/base/efx_phy.c b/drivers/net/sfc/base/efx_phy.c
index 63b89e6a4..36a7bbd3d 100644
--- a/drivers/net/sfc/base/efx_phy.c
+++ b/drivers/net/sfc/base/efx_phy.c
@@ -15,7 +15,7 @@ static const efx_phy_ops_t	__efx_phy_siena_ops = {
 	siena_phy_reconfigure,		/* epo_reconfigure */
 	siena_phy_verify,		/* epo_verify */
 	siena_phy_oui_get,		/* epo_oui_get */
-	NULL,				/* epo_fec_type_get */
+	NULL,				/* epo_link_state_get */
 #if EFSYS_OPT_PHY_STATS
 	siena_phy_stats_update,		/* epo_stats_update */
 #endif	/* EFSYS_OPT_PHY_STATS */
@@ -35,7 +35,7 @@ static const efx_phy_ops_t	__efx_phy_ef10_ops = {
 	ef10_phy_reconfigure,		/* epo_reconfigure */
 	ef10_phy_verify,		/* epo_verify */
 	ef10_phy_oui_get,		/* epo_oui_get */
-	ef10_phy_fec_type_get,		/* epo_fec_type_get */
+	ef10_phy_link_state_get,	/* epo_link_state_get */
 #if EFSYS_OPT_PHY_STATS
 	ef10_phy_stats_update,		/* epo_stats_update */
 #endif	/* EFSYS_OPT_PHY_STATS */
@@ -321,19 +321,41 @@ efx_phy_module_get_info(
 efx_phy_fec_type_get(
 	__in		efx_nic_t *enp,
 	__out		efx_phy_fec_type_t *typep)
+{
+	efx_rc_t rc;
+	efx_phy_link_state_t epls;
+
+	if ((rc = efx_phy_link_state_get(enp, &epls)) != 0)
+		goto fail1;
+
+	*typep = epls.epls_fec;
+
+	return (0);
+
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+	return (rc);
+}
+
+	__checkReturn		efx_rc_t
+efx_phy_link_state_get(
+	__in		efx_nic_t *enp,
+	__out		efx_phy_link_state_t *eplsp)
 {
 	efx_port_t *epp = &(enp->en_port);
 	const efx_phy_ops_t *epop = epp->ep_epop;
 	efx_rc_t rc;
 
 	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
 
-	if (epop->epo_fec_type_get == NULL) {
+	if (epop->epo_link_state_get == NULL) {
 		rc = ENOTSUP;
 		goto fail1;
 	}
 
-	if ((rc = epop->epo_fec_type_get(enp, typep)) != 0)
+	if ((rc = epop->epo_link_state_get(enp, eplsp)) != 0)
 		goto fail2;
 
 	return (0);
-- 
2.17.1

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

* [dpdk-dev] [PATCH 10/11] net/sfc/base: use transceiver ID when reading info
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (8 preceding siblings ...)
  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
  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
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev; +Cc: Richard Houldsworth

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

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

* [dpdk-dev] [PATCH 11/11] net/sfc: add 50G and 100G XtremeScale X2 family adapters
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (9 preceding siblings ...)
  2018-09-24 13:50 ` [dpdk-dev] [PATCH 10/11] net/sfc/base: use transceiver ID when reading info Andrew Rybchenko
@ 2018-09-24 13:50 ` Andrew Rybchenko
  2018-09-25 14:32 ` [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Ferruh Yigit
  11 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2018-09-24 13:50 UTC (permalink / raw)
  To: dev

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/nics/sfc_efx.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 63939ec83..425e669ed 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -240,6 +240,10 @@ Supported NICs
 
    - Solarflare X2522 Dual Port SFP28 10/25GbE Adapter
 
+   - Solarflare X2541 Single Port QSFP28 10/25G/100G Adapter
+
+   - Solarflare X2542 Dual Port QSFP28 10/25G/100G Adapter
+
 - Solarflare Flareon [Ultra] Server Adapters:
 
    - Solarflare SFN8522 Dual Port SFP+ Server Adapter
-- 
2.17.1

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

* Re: [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G
  2018-09-24 13:50 [dpdk-dev] [PATCH 00/11] net/sfc: update base driver to support 50G and 100G Andrew Rybchenko
                   ` (10 preceding siblings ...)
  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 ` Ferruh Yigit
  11 siblings, 0 replies; 13+ messages in thread
From: Ferruh Yigit @ 2018-09-25 14:32 UTC (permalink / raw)
  To: Andrew Rybchenko, dev

On 9/24/2018 2:50 PM, Andrew Rybchenko wrote:
> Add base driver patches to support 50G and 100G XtremeScale X2
> family adapters.
> 
> In this particular case it looks better to have separate patch which
> updates documentation (as a cut line which summarizes the result).
> 
> There are few checkpatches.sh warnings due to coding style difference
> in base driver.
> 
> Andrew Rybchenko (1):
>   net/sfc: add 50G and 100G XtremeScale X2 family adapters
> 
> Richard Houldsworth (9):
>   net/sfc/base: make last byte of module information available
>   net/sfc/base: expose PHY module device address constants
>   net/sfc/base: adjust PHY module info interface
>   net/sfc/base: update to current port mode terminology
>   net/sfc/base: add X2 port modes to bandwidth calculator
>   net/sfc/base: support improvements to bandwidth calculations
>   net/sfc/base: infer port mode bandwidth from max link speed
>   net/sfc/base: add accessor to whole link status
>   net/sfc/base: use transceiver ID when reading info
> 
> Tom Millington (1):
>   net/sfc/base: guard Rx scale code with corresponding option

Series applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2018-09-25 14:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dpdk-dev] [PATCH 10/11] net/sfc/base: use transceiver ID when reading info Andrew Rybchenko
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

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).