netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, oss-drivers@netronome.com,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH net-next 12/13] nfp: use split in naming of PCIe PF ports
Date: Mon, 21 May 2018 22:12:54 -0700	[thread overview]
Message-ID: <20180522051255.9438-13-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20180522051255.9438-1-jakub.kicinski@netronome.com>

PCI PFs can host more than one logical endpoint.  In NFP terms
this means having more than one vNIC for PCIe PF.  The vNICs
are usually corresponding 1:1 to Ethernet ports.  In core NIC
we use the legacy idea of vNIC *being* the Ethernet port,
hence netdevs put pX(sY) in their phys_port_name, like Ethernet
ports would.  When ASIC ports are fully represented we need to
be able to name different PCIe PF ports, too.  Use a scheme
similar to Ethernet ports - pfXsY, for PCIe PF number X,
sub-port Y.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/abm/main.c | 2 ++
 drivers/net/ethernet/netronome/nfp/nfp_port.c | 6 +++++-
 drivers/net/ethernet/netronome/nfp/nfp_port.h | 4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/netronome/nfp/abm/main.c b/drivers/net/ethernet/netronome/nfp/abm/main.c
index 7afd24ce79a5..5a12bb20bced 100644
--- a/drivers/net/ethernet/netronome/nfp/abm/main.c
+++ b/drivers/net/ethernet/netronome/nfp/abm/main.c
@@ -109,6 +109,8 @@ nfp_abm_spawn_repr(struct nfp_app *app, struct nfp_abm_link *alink,
 			goto err_free_port;
 	} else {
 		port->pf_id = alink->abm->pf_id;
+		port->pf_split = app->pf->max_data_vnics > 1;
+		port->pf_split_id = alink->id;
 		port->vnic = alink->vnic->dp.ctrl_bar;
 	}
 
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c
index a17f1ace6988..9c1298114c70 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -181,7 +181,11 @@ nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
 				     eth_port->label_subport);
 		break;
 	case NFP_PORT_PF_PORT:
-		n = snprintf(name, len, "pf%d", port->pf_id);
+		if (!port->pf_split)
+			n = snprintf(name, len, "pf%d", port->pf_id);
+		else
+			n = snprintf(name, len, "pf%ds%d", port->pf_id,
+				     port->pf_split_id);
 		break;
 	case NFP_PORT_VF_PORT:
 		n = snprintf(name, len, "pf%dvf%d", port->pf_id, port->vf_id);
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index 1d9b2b47e27d..18666750456e 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -82,6 +82,8 @@ enum nfp_port_flags {
  * @eth_stats:	for %NFP_PORT_PHYS_PORT MAC stats if available
  * @pf_id:	for %NFP_PORT_PF_PORT, %NFP_PORT_VF_PORT ID of the PCI PF (0-3)
  * @vf_id:	for %NFP_PORT_VF_PORT ID of the PCI VF within @pf_id
+ * @pf_split:	for %NFP_PORT_PF_PORT %true if PCI PF has more than one vNIC
+ * @pf_split_id:for %NFP_PORT_PF_PORT ID of PCI PF vNIC (valid if @pf_split)
  * @vnic:	for %NFP_PORT_PF_PORT, %NFP_PORT_VF_PORT vNIC ctrl memory
  * @port_list:	entry on pf's list of ports
  */
@@ -108,6 +110,8 @@ struct nfp_port {
 		struct {
 			unsigned int pf_id;
 			unsigned int vf_id;
+			bool pf_split;
+			unsigned int pf_split_id;
 			u8 __iomem *vnic;
 		};
 	};
-- 
2.17.0

  parent reply	other threads:[~2018-05-22  5:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22  5:12 [PATCH net-next 00/13] nfp: abm: add basic support for advanced buffering NIC Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 01/13] nfp: move rtsym helpers to pf code Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 02/13] nfp: add support for per-PCI PF mailbox Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 03/13] nfp: add shared buffer configuration Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 04/13] nfp: core: allow 4-byte aligned accesses to Memory Units Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 05/13] nfp: abm: add initial active buffer management NIC skeleton Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 06/13] nfp: abm: create project-specific vNIC structure Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 07/13] nfp: add app pointer to port representors Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 08/13] devlink: don't take instance lock around eswitch mode set Jakub Kicinski
2018-05-22  8:41   ` Jiri Pirko
2018-05-22  5:12 ` [PATCH net-next 09/13] nfp: add devlink_eswitch_mode_set callback Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 10/13] nfp: abm: spawn port netdevs Jakub Kicinski
2018-05-22  5:12 ` [PATCH net-next 11/13] nfp: abm: force Ethternet port up Jakub Kicinski
2018-05-22  5:12 ` Jakub Kicinski [this message]
2018-05-22  5:12 ` [PATCH net-next 13/13] nfp: assign vNIC id as phys_port_name of vNICs which are not ports Jakub Kicinski
2018-05-22  6:32 ` [PATCH net-next 00/13] nfp: abm: add basic support for advanced buffering NIC Or Gerlitz
2018-05-22  7:56   ` Jakub Kicinski
2018-05-22 14:50     ` Or Gerlitz
2018-05-22 19:14       ` Jakub Kicinski
2018-05-23 18:28 ` David Miller

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=20180522051255.9438-13-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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).