nfp: remove phys_port_name on flower's vNIC

.ndo_get_phys_port_name was recently extended to support multi-vNIC
FWs.  These are firmwares which can have more than one vNIC per PF
without associated port (e.g. Adaptive Buffer Management FW), therefore
we need a way of distinguishing the vNICs.  Unfortunately, it's too
late to make flower use the same naming.  Flower users may depend on
.ndo_get_phys_port_name returning -EOPNOTSUPP, for example the name
udev gave the PF vNIC was just the bare PCI device-based name before
the change, and will have 'nn0' appended after.

To ensure flower's vNIC doesn't have phys_port_name attribute, add
a flag to vNIC struct and set it in flower code.  New projects will
not set the flag adhere to the naming scheme from the start.

Fixes: 51c1df83e3 ("nfp: assign vNIC id as phys_port_name of vNICs which are not ports")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2018-06-11 21:33:37 -07:00 committed by David S. Miller
parent 29f534c4bb
commit fe06a64e0d
3 changed files with 6 additions and 1 deletions

View File

@ -455,6 +455,7 @@ static int nfp_flower_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
eth_hw_addr_random(nn->dp.netdev); eth_hw_addr_random(nn->dp.netdev);
netif_keep_dst(nn->dp.netdev); netif_keep_dst(nn->dp.netdev);
nn->vnic_no_name = true;
return 0; return 0;

View File

@ -590,6 +590,8 @@ struct nfp_net_dp {
* @vnic_list: Entry on device vNIC list * @vnic_list: Entry on device vNIC list
* @pdev: Backpointer to PCI device * @pdev: Backpointer to PCI device
* @app: APP handle if available * @app: APP handle if available
* @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return
* -EOPNOTSUPP to keep backwards compatibility (set by app)
* @port: Pointer to nfp_port structure if vNIC is a port * @port: Pointer to nfp_port structure if vNIC is a port
* @app_priv: APP private data for this vNIC * @app_priv: APP private data for this vNIC
*/ */
@ -663,6 +665,8 @@ struct nfp_net {
struct pci_dev *pdev; struct pci_dev *pdev;
struct nfp_app *app; struct nfp_app *app;
bool vnic_no_name;
struct nfp_port *port; struct nfp_port *port;
void *app_priv; void *app_priv;

View File

@ -3286,7 +3286,7 @@ nfp_net_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
if (nn->port) if (nn->port)
return nfp_port_get_phys_port_name(netdev, name, len); return nfp_port_get_phys_port_name(netdev, name, len);
if (nn->dp.is_vf) if (nn->dp.is_vf || nn->vnic_no_name)
return -EOPNOTSUPP; return -EOPNOTSUPP;
n = snprintf(name, len, "n%d", nn->id); n = snprintf(name, len, "n%d", nn->id);