summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-07-25 21:48:20 +0200
committerDavid S. Miller <davem@davemloft.net>2017-07-25 21:48:20 +0200
commit34c8c10a766c8daf42293664f5c9ca5516fa3f41 (patch)
treead49fbd2ddb2214efd045008417397b9bd367821
parentMerge branch 'net-warnings' (diff)
parentbnxt_en: fix switchdev port naming for external-port-rep and vf-reps (diff)
downloadlinux-34c8c10a766c8daf42293664f5c9ca5516fa3f41.tar.xz
linux-34c8c10a766c8daf42293664f5c9ca5516fa3f41.zip
Merge branch 'bnxt_en-Fix-kbuild-errors-and-rename-phys_port_name'
Michael Chan says: ==================== bnxt_en: Fix kbuild errors and rename phys_port_name. Fix 2 more kbuild errors (the first one already fixed by DaveM), and rename the physical port name. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c6
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c10
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h30
3 files changed, 39 insertions, 7 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 9835ddf1685b..156fb374522b 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
index 83478e912ee5..b05c5d0ee3f9 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
@@ -16,6 +16,8 @@
#include "bnxt.h"
#include "bnxt_vfr.h"
+#ifdef CONFIG_BNXT_SRIOV
+
#define CFA_HANDLE_INVALID 0xffff
#define VF_IDX_INVALID 0xffff
@@ -139,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;
@@ -302,7 +306,7 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
dev->netdev_ops = &bnxt_vf_rep_netdev_ops;
dev->ethtool_ops = &bnxt_vf_rep_ethtool_ops;
- dev->switchdev_ops = &bnxt_vf_rep_switchdev_ops;
+ SWITCHDEV_SET_OPS(dev, &bnxt_vf_rep_switchdev_ops);
/* Just inherit all the featues of the parent PF as the VF-R
* uses the RX/TX rings of the parent PF
*/
@@ -487,3 +491,5 @@ void bnxt_dl_unregister(struct bnxt *bp)
devlink_unregister(dl);
devlink_free(dl);
}
+
+#endif
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h
index c6cd55afbb89..e55a3b693e20 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h
@@ -10,6 +10,8 @@
#ifndef BNXT_VFR_H
#define BNXT_VFR_H
+#ifdef CONFIG_BNXT_SRIOV
+
#define MAX_CFA_CODE 65536
/* Struct to hold housekeeping info needed by devlink interface */
@@ -39,4 +41,32 @@ void bnxt_vf_reps_open(struct bnxt *bp);
void bnxt_vf_rep_rx(struct bnxt *bp, struct sk_buff *skb);
struct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code);
+#else
+
+static inline int bnxt_dl_register(struct bnxt *bp)
+{
+ return 0;
+}
+
+static inline void bnxt_dl_unregister(struct bnxt *bp)
+{
+}
+
+static inline void bnxt_vf_reps_close(struct bnxt *bp)
+{
+}
+
+static inline void bnxt_vf_reps_open(struct bnxt *bp)
+{
+}
+
+static inline void bnxt_vf_rep_rx(struct bnxt *bp, struct sk_buff *skb)
+{
+}
+
+static inline struct net_device *bnxt_get_vf_rep(struct bnxt *bp, u16 cfa_code)
+{
+ return NULL;
+}
+#endif /* CONFIG_BNXT_SRIOV */
#endif /* BNXT_VFR_H */