bnxt_en: Fix kbuild errors and rename phys_port_name.
Michael Chan
maintainercover 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.
Sathya Perla (3):
bnxt_en: include bnxt_vfr.c code under CONFIG_BNXT_SRIOV switch
bnxt_en: use SWITCHDEV_SET_OPS() for setting vf_rep_switchdev_ops
bnxt_en: fix switchdev port naming for external-port-rep and vf-reps
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +----- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 10 +++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h | 30 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 1/3 bnxt_en: include bnxt_vfr.c code under CONFIG_BNXT_SRIOV switch
From: Sathya Perla <[email protected]>
And define empty functions in bnxt_vfr.h when CONFIG_BNXT_SRIOV is not defined.
This fixes build error when CONFIG_BNXT_SRIOV is switched off:
Quoted 2 lines
Quoted 2 lines
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:165:16: error: 'struct bnxt' has no member named 'sriov_lock'
--- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 4 ++++ drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h | 30 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +4 -0
@@ -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
@@ -487,3 +489,5 @@ void bnxt_dl_unregister(struct bnxt *bp)devlink_unregister (dl); devlink_free(dl); } + +#endif
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.h +30 -0
@@ -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 @@ static inline void bnxt_link_bp_to_dl(struct devlink *dl, 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 */
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 2/3 bnxt_en: use SWITCHDEV_SET_OPS() for setting vf_rep_switchdev_ops
In reply to Michael ChanFrom: Sathya Perla <[email protected]>
This fixes the build error:
‘struct net_device’ has no member named ‘switchdev_ops’
--- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +1 -1
@@ -304,7 +304,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 */
Signature · 1 line
1.8.3.1
Michael Chan
maintainerPATCH 3/3 bnxt_en: fix switchdev port naming for external-port-rep and vf-reps
In reply to Michael ChanFrom: Sathya Perla <[email protected]>
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.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +----- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -5
@@ -7556,11 +7556,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 ;
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +3 -1
@@ -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 ;
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Michael Chan <[email protected]>
Date: Tue, 25 Jul 2017 13:28:38 -0400
Quoted 2 lines
Fix 2 more kbuild errors (the first one already fixed by DaveM), and rename the physical port name.
Series applied, thanks for working to clear this all up.