nfp: use split in naming of PCIe PF ports
authorJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 22 May 2018 05:12:54 +0000 (22:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 May 2018 18:26:19 +0000 (14:26 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/abm/main.c
drivers/net/ethernet/netronome/nfp/nfp_port.c
drivers/net/ethernet/netronome/nfp/nfp_port.h

index 7afd24ce79a558f44589b4ebf34c3d7e4a477653..5a12bb20bcedcc93bbcc086ec0a406e52ce3e579 100644 (file)
@@ -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;
        }
 
index a17f1ace6988815688ec2aa66380c8eef111c338..9c1298114c70f801bced625870a4688e3eeda501 100644 (file)
@@ -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);
index 1d9b2b47e27dba698955d31556066c08ac7a2a34..18666750456e359b1f6c9103ccff54a3a41e498a 100644 (file)
@@ -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;
                };
        };