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 06/11] net/sfc/base: support improvements to bandwidth calculations
Date: Mon, 24 Sep 2018 14:50:25 +0100	[thread overview]
Message-ID: <1537797030-26548-7-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>

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

  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 ` Andrew Rybchenko [this message]
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

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