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 24/80] net/sfc/base: improve comments for EF10 ext port mapping
Date: Tue, 20 Feb 2018 07:33:42 +0000	[thread overview]
Message-ID: <1519112078-20113-25-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1519112078-20113-1-git-send-email-arybchenko@solarflare.com>

From: Richard Houldsworth <rhouldsworth@solarflare.com>

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

diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index a48f2ac..62d41d2 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -1261,26 +1261,58 @@ ef10_get_privilege_mask(
 
 
 /*
- * Table of mapping schemes from port number to the number of the external
- * connector on the board. The external numbering does not distinguish
- * off-board separated outputs such as from multi-headed cables.
+ * Table of mapping schemes from port number to external number.
  *
- * The count of adjacent port numbers that map to each external port
+ * Each port number ultimately corresponds to a connector: either as part of
+ * a cable assembly attached to a module inserted in an SFP+/QSFP+ cage on
+ * the board, or fixed to the board (e.g. 10GBASE-T magjack on SFN5121T
+ * "Salina"). In general:
+ *
+ * Port number (0-based)
+ *     |
+ *   port mapping (n:1)
+ *     |
+ *     v
+ * External port number (normally 1-based)
+ *     |
+ *   fixed (1:1) or cable assembly (1:m)
+ *     |
+ *     v
+ * Connector
+ *
+ * The external numbering refers to the cages or magjacks on the board,
+ * as visibly annotated on the board or back panel. This table describes
+ * how to determine which external cage/magjack corresponds to the port
+ * numbers used by the driver.
+ *
+ * The count of adjacent port numbers that map to each external number,
  * and the offset in the numbering, is determined by the chip family and
  * current port mode.
  *
  * For the Huntington family, the current port mode cannot be discovered,
+ * but a single mapping is used by all modes for a given chip variant,
  * so the mapping used is instead the last match in the table to the full
  * set of port modes to which the NIC can be configured. Therefore the
  * ordering of entries in the mapping table is significant.
  */
-static struct {
+static struct ef10_external_port_map_s {
 	efx_family_t	family;
 	uint32_t	modes_mask;
 	int32_t		count;
 	int32_t		offset;
 }	__ef10_external_port_mappings[] = {
-	/* Supported modes with 1 output per external port */
+	/*
+	 * Modes used by Huntington family controllers where each port
+	 * number maps to a separate cage.
+	 * SFN7x22F (Torino):
+	 *	port 0 -> cage 1
+	 *	port 1 -> cage 2
+	 * SFN7xx4F (Pavia):
+	 *	port 0 -> cage 1
+	 *	port 1 -> cage 2
+	 *	port 2 -> cage 3
+	 *	port 3 -> cage 4
+	 */
 	{
 		EFX_FAMILY_HUNTINGTON,
 		(1 << TLV_PORT_MODE_10G) |
@@ -1289,6 +1321,14 @@ static struct {
 		1,
 		1
 	},
+	/*
+	 * Modes that on Medford allocate each port number to a separate
+	 * cage.
+	 *	port 0 -> cage 1
+	 *	port 1 -> cage 2
+	 *	port 2 -> cage 3
+	 *	port 3 -> cage 4
+	 */
 	{
 		EFX_FAMILY_MEDFORD,
 		(1 << TLV_PORT_MODE_10G) |
@@ -1296,7 +1336,15 @@ static struct {
 		1,
 		1
 	},
-	/* Supported modes with 2 outputs per external port */
+	/*
+	 * Modes which for Huntington identify a chip variant where 2
+	 * adjacent port numbers map to each cage.
+	 * SFN7x42Q (Monza):
+	 *	port 0 -> cage 1
+	 *	port 1 -> cage 1
+	 *	port 2 -> cage 2
+	 *	port 3 -> cage 2
+	 */
 	{
 		EFX_FAMILY_HUNTINGTON,
 		(1 << TLV_PORT_MODE_40G) |
@@ -1306,6 +1354,14 @@ static struct {
 		2,
 		1
 	},
+	/*
+	 * Modes that on Medford allocate 2 adjacent port numbers to each
+	 * cage.
+	 *	port 0 -> cage 1
+	 *	port 1 -> cage 1
+	 *	port 2 -> cage 2
+	 *	port 3 -> cage 2
+	 */
 	{
 		EFX_FAMILY_MEDFORD,
 		(1 << TLV_PORT_MODE_40G) |
@@ -1316,7 +1372,14 @@ static struct {
 		2,
 		1
 	},
-	/* Supported modes with 4 outputs per external port */
+	/*
+	 * Modes that on Medford allocate 4 adjacent port numbers to each
+	 * connector, starting on cage 1.
+	 *	port 0 -> cage 1
+	 *	port 1 -> cage 1
+	 *	port 2 -> cage 1
+	 *	port 3 -> cage 1
+	 */
 	{
 		EFX_FAMILY_MEDFORD,
 		(1 << TLV_PORT_MODE_10G_10G_10G_10G_Q) |
@@ -1324,6 +1387,14 @@ static struct {
 		4,
 		1,
 	},
+	/*
+	 * Modes that on Medford allocate 4 adjacent port numbers to each
+	 * connector, starting on cage 2.
+	 *	port 0 -> cage 2
+	 *	port 1 -> cage 2
+	 *	port 2 -> cage 2
+	 *	port 3 -> cage 2
+	 */
 	{
 		EFX_FAMILY_MEDFORD,
 		(1 << TLV_PORT_MODE_10G_10G_10G_10G_Q2),
@@ -1348,7 +1419,7 @@ ef10_external_port_mapping(
 
 	if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, &current)) != 0) {
 		/*
-		 * No current port mode information
+		 * No current port mode information (i.e. Huntington)
 		 * - infer mapping from available modes
 		 */
 		if ((rc = efx_mcdi_get_port_modes(enp,
@@ -1365,18 +1436,23 @@ ef10_external_port_mapping(
 	}
 
 	/*
-	 * Infer the internal port -> external port mapping from
+	 * Infer the internal port -> external number mapping from
 	 * the possible port modes for this NIC.
 	 */
 	for (i = 0; i < EFX_ARRAY_SIZE(__ef10_external_port_mappings); ++i) {
-		if (__ef10_external_port_mappings[i].family !=
-		    enp->en_family)
+		struct ef10_external_port_map_s *eepmp =
+		    &__ef10_external_port_mappings[i];
+		if (eepmp->family != enp->en_family)
 			continue;
-		matches = (__ef10_external_port_mappings[i].modes_mask &
-		    port_modes);
+		matches = (eepmp->modes_mask & port_modes);
 		if (matches != 0) {
-			count = __ef10_external_port_mappings[i].count;
-			offset = __ef10_external_port_mappings[i].offset;
+			/*
+			 * Some modes match. For some Huntington boards
+			 * there will be multiple matches. The mapping on the
+			 * last match is used.
+			 */
+			count = eepmp->count;
+			offset = eepmp->offset;
 			port_modes &= ~matches;
 		}
 	}
-- 
2.7.4

  parent reply	other threads:[~2018-02-20  7:35 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20  7:33 [dpdk-dev] [PATCH 00/80] net/sfc/base: update base driver Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 01/80] net/sfc: add missing defines for SAL annotation Andrew Rybchenko
2018-03-05 20:47   ` Ferruh Yigit
2018-02-20  7:33 ` [dpdk-dev] [PATCH 02/80] net/sfc/base: regenerate files with genfwdef after ID update Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 03/80] net/sfc/base: update autogenerated headers from firmwaresrc Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 04/80] net/sfc/base: add 3.3V and 12.0V current sensors Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 05/80] net/sfc/base: add Medford2 PCI IDs Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 06/80] net/sfc/base: add efsys option for Medford2 Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 07/80] net/sfc/base: add Medford2 support to NIC module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 08/80] net/sfc/base: correct PIO buffer dimensions for Medford2 Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 09/80] net/sfc/base: move RxDP config get to EF10 NIC code Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 10/80] net/sfc/base: add Medford2 support to EV module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 11/80] net/sfc/base: add Medford2 support to FILTER module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 12/80] net/sfc/base: add Medford2 support to INTR module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 13/80] net/sfc/base: add Medford2 support to MAC module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 14/80] net/sfc/base: add Medford2 support to MCDI module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 15/80] net/sfc/base: add Medford2 support to PHY module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 16/80] net/sfc/base: add Medford2 support to Rx module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 17/80] net/sfc/base: add Medford2 support to Tx module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 18/80] net/sfc/base: add Medford2 support to NVRAM module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 19/80] net/sfc/base: add Medford2 support to SRAM module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 20/80] net/sfc/base: add Medford2 support to BOOTCFG module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 21/80] net/sfc/base: add Medford2 support to VPD module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 22/80] net/sfc/base: add Medford2 support to MON module Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 23/80] net/sfc/base: support runtime VI window size Andrew Rybchenko
2018-02-20  7:33 ` Andrew Rybchenko [this message]
2018-02-20  7:33 ` [dpdk-dev] [PATCH 25/80] net/sfc/base: add method to make checksum option descriptors Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 26/80] net/sfc/base: update hardware headers for Medford2 Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 27/80] net/sfc/base: refactoring eliminating code analysis warnings Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 28/80] net/sfc/base: fix too long line Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 29/80] net/sfc/base: update notes on interrupt testing on VFs Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 30/80] net/sfc/base: report memory BAR number Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 31/80] net/sfc/base: simplify loopback type checking Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 32/80] net/sfc/base: add support new link modes Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 33/80] net/sfc/base: add new loopback modes Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 34/80] net/sfc/base: add efsys macro to get memory region size Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 35/80] net/sfc/base: handle new speeds in linkchange events Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 36/80] net/sfc/base: refactor EF10 get datapath capabilities Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 37/80] net/sfc/base: retrieve number of MAC stats from NIC Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 38/80] net/sfc/base: improve robustness of MAC stats get via MCDI Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 39/80] net/sfc/base: use MAC stats DMA buffer size from caps Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 40/80] net/sfc/base: use MAC stats DMA buffer size when decoding Andrew Rybchenko
2018-02-20  7:33 ` [dpdk-dev] [PATCH 41/80] net/sfc/base: run mkconfig.py to add FEC MAC stats Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 42/80] net/sfc/base: decode Medford2 FEC stats if available Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 43/80] net/sfc/base: resolve code analysis warnings Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 44/80] net/sfc: size MAC stats DMA buffer to support Medford2 Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 45/80] net/sfc/base: remove MAC stats size define Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 46/80] net/sfc/base: use correct name for frame truncation event Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 47/80] net/sfc/base: add ef10 NIC board config method Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 48/80] net/sfc/base: move port config to ef10 NIC board config Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 49/80] net/sfc/base: move PF/VF " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 50/80] net/sfc/base: move MAC address config to ef10 NIC board cfg Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 51/80] net/sfc/base: move legacy board " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 52/80] net/sfc/base: move PHY/link " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 53/80] net/sfc/base: move datapath " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 54/80] net/sfc/base: move Rx config to ef10 NIC board config Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 55/80] net/sfc/base: move Tx " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 56/80] net/sfc/base: move limits " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 57/80] net/sfc/base: move vector " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 58/80] net/sfc/base: move privilege " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 59/80] net/sfc/base: move VI window size config to ef10 NIC board Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 60/80] net/sfc/base: remove obsolete comments Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 61/80] net/sfc/base: support FEC mode settings Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 62/80] net/sfc/base: support Medford2 event timer semantics Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 63/80] net/sfc/base: clarify port mode names and masks Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 64/80] net/sfc/base: group Medford external port mapping entries Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 65/80] net/sfc/base: add Medford2 support for external port numbers Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 66/80] net/sfc/base: add Medford2 support for licencing Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 67/80] net/sfc/base: add Medford2 support for tunnel encapsulations Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 68/80] net/sfc/base: provide a flag for controlling CTPIO mode Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 69/80] net/sfc/base: add 1.3V voltage and current sensors Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 70/80] net/sfc/base: document the event type for CTPIO sends Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 71/80] net/sfc/base: run genfwdef to update headers Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 72/80] net/sfc/base: add CTPIO statistics Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 73/80] net/sfc/base: add bit to indicate CTPIO availability Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 74/80] net/sfc/base: regenerate headers to pick up CTPIO stats Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 75/80] net/sfc/base: support " Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 76/80] net/sfc/base: add encapsulated TSOv2 capability Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 77/80] net/sfc/base: add outer IP ID parameter to TSOv2 descriptor Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 78/80] net/sfc/base: add firmware image layout option Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 79/80] net/sfc/base: add signed image layout support Andrew Rybchenko
2018-02-20  7:34 ` [dpdk-dev] [PATCH 80/80] net/sfc/base: sync MCDI headers and TLV layout Andrew Rybchenko

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=1519112078-20113-25-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).