bnxt_en: fix switchdev port naming for external-port-rep and vf-reps
authorSathya Perla <sathya.perla@broadcom.com>
Tue, 25 Jul 2017 17:28:41 +0000 (13:28 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jul 2017 19:48:19 +0000 (12:48 -0700)
Fix the phys_port_name for the external physical port to be in
"pA" format and that of VF-rep to be in "pCvfD" format as
suggested by Jakub Kicinski.

Fixes: c124a62ff2dd ("bnxt_en: add support for port_attr_get and get_phys_port_name")
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c

index 9835ddf1685bb08c09e6320606c775b0879b60e9..156fb374522baea2aebab5fc525c86a40cc7586e 100644 (file)
@@ -7552,11 +7552,7 @@ static int bnxt_get_phys_port_name(struct net_device *dev, char *buf,
        if (!BNXT_PF(bp))
                return -EOPNOTSUPP;
 
-       /* The switch-id that the pf belongs to is exported by
-        * the switchdev ndo. This name is just to distinguish from the
-        * vf-rep ports.
-        */
-       rc = snprintf(buf, len, "pf%d", bp->pf.port_id);
+       rc = snprintf(buf, len, "p%d", bp->pf.port_id);
 
        if (rc >= len)
                return -EOPNOTSUPP;
index c00352a4c1f0c6bd5bb70d39316f7f13bfda2e95..b05c5d0ee3f9ef732177d4c6785fddcc73cf301d 100644 (file)
@@ -141,9 +141,11 @@ static int bnxt_vf_rep_get_phys_port_name(struct net_device *dev, char *buf,
                                          size_t len)
 {
        struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
+       struct pci_dev *pf_pdev = vf_rep->bp->pdev;
        int rc;
 
-       rc = snprintf(buf, len, "vfr%d", vf_rep->vf_idx);
+       rc = snprintf(buf, len, "pf%dvf%d", PCI_FUNC(pf_pdev->devfn),
+                     vf_rep->vf_idx);
        if (rc >= len)
                return -EOPNOTSUPP;
        return 0;