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>
This commit is contained in:
David S. Miller 2017-07-25 12:48:20 -07:00
commit 34c8c10a76
3 changed files with 39 additions and 7 deletions

View 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;

View File

@ -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

View File

@ -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 */