Commit c9a82421 authored by David S. Miller's avatar David S. Miller

Merge branch 'bnxt_en-next'

Michael Chan says:

====================
bnxt_en: Updates for net-next.

First, we upgrade the firmware interface spec.  Due to a change in
the toolchains, the auto-generated bnxt_hsi.h does not match the
old bnxt_hsi.h and the patch is really big.  This should be just
one-time.  Going forward, changes should be incremental.

The next 10 patches implement a new scheme for the PF and VF drivers
to allocate and reserve resources.  The new scheme is more flexible
and allows dynamic and asymmetric distribution of resources, whereas
the old scheme is static and even distribution.

The last few patches add cacheline size setting, a couple of PCI IDs,
better management of VF MAC address, and a better parent switchdev ID
for dual-port devices.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ee81098e dd4ea1da
This diff is collapsed.
/* Broadcom NetXtreme-C/E network driver. /* Broadcom NetXtreme-C/E network driver.
* *
* Copyright (c) 2014-2016 Broadcom Corporation * Copyright (c) 2014-2016 Broadcom Corporation
* Copyright (c) 2016-2017 Broadcom Limited * Copyright (c) 2016-2018 Broadcom Limited
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#define BNXT_H #define BNXT_H
#define DRV_MODULE_NAME "bnxt_en" #define DRV_MODULE_NAME "bnxt_en"
#define DRV_MODULE_VERSION "1.8.0" #define DRV_MODULE_VERSION "1.9.0"
#define DRV_VER_MAJ 1 #define DRV_VER_MAJ 1
#define DRV_VER_MIN 8 #define DRV_VER_MIN 9
#define DRV_VER_UPD 0 #define DRV_VER_UPD 0
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -776,19 +776,38 @@ struct bnxt_vnic_info { ...@@ -776,19 +776,38 @@ struct bnxt_vnic_info {
#define BNXT_VNIC_RFS_NEW_RSS_FLAG 0x10 #define BNXT_VNIC_RFS_NEW_RSS_FLAG 0x10
}; };
#if defined(CONFIG_BNXT_SRIOV) struct bnxt_hw_resc {
struct bnxt_vf_info { u16 min_rsscos_ctxs;
u16 fw_fid;
u8 mac_addr[ETH_ALEN];
u16 max_rsscos_ctxs; u16 max_rsscos_ctxs;
u16 min_cp_rings;
u16 max_cp_rings; u16 max_cp_rings;
u16 resv_cp_rings;
u16 min_tx_rings;
u16 max_tx_rings; u16 max_tx_rings;
u16 resv_tx_rings;
u16 min_rx_rings;
u16 max_rx_rings; u16 max_rx_rings;
u16 resv_rx_rings;
u16 min_hw_ring_grps;
u16 max_hw_ring_grps; u16 max_hw_ring_grps;
u16 resv_hw_ring_grps;
u16 min_l2_ctxs;
u16 max_l2_ctxs; u16 max_l2_ctxs;
u16 max_irqs; u16 min_vnics;
u16 max_vnics; u16 max_vnics;
u16 resv_vnics;
u16 min_stat_ctxs;
u16 max_stat_ctxs; u16 max_stat_ctxs;
u16 max_irqs;
};
#if defined(CONFIG_BNXT_SRIOV)
struct bnxt_vf_info {
u16 fw_fid;
u8 mac_addr[ETH_ALEN]; /* PF assigned MAC Address */
u8 vf_mac_addr[ETH_ALEN]; /* VF assigned MAC address, only
* stored by PF.
*/
u16 vlan; u16 vlan;
u32 flags; u32 flags;
#define BNXT_VF_QOS 0x1 #define BNXT_VF_QOS 0x1
...@@ -809,15 +828,6 @@ struct bnxt_pf_info { ...@@ -809,15 +828,6 @@ struct bnxt_pf_info {
u16 fw_fid; u16 fw_fid;
u16 port_id; u16 port_id;
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u16 max_rsscos_ctxs;
u16 max_cp_rings;
u16 max_tx_rings; /* HW assigned max tx rings for this PF */
u16 max_rx_rings; /* HW assigned max rx rings for this PF */
u16 max_hw_ring_grps;
u16 max_irqs;
u16 max_l2_ctxs;
u16 max_vnics;
u16 max_stat_ctxs;
u32 first_vf_id; u32 first_vf_id;
u16 active_vfs; u16 active_vfs;
u16 max_vfs; u16 max_vfs;
...@@ -829,6 +839,9 @@ struct bnxt_pf_info { ...@@ -829,6 +839,9 @@ struct bnxt_pf_info {
u32 max_rx_wm_flows; u32 max_rx_wm_flows;
unsigned long *vf_event_bmap; unsigned long *vf_event_bmap;
u16 hwrm_cmd_req_pages; u16 hwrm_cmd_req_pages;
u8 vf_resv_strategy;
#define BNXT_VF_RESV_STRATEGY_MAXIMAL 0
#define BNXT_VF_RESV_STRATEGY_MINIMAL 1
void *hwrm_cmd_req_addr[4]; void *hwrm_cmd_req_addr[4];
dma_addr_t hwrm_cmd_req_dma_addr[4]; dma_addr_t hwrm_cmd_req_dma_addr[4];
struct bnxt_vf_info *vf; struct bnxt_vf_info *vf;
...@@ -1137,6 +1150,7 @@ struct bnxt { ...@@ -1137,6 +1150,7 @@ struct bnxt {
#define BNXT_FLAG_FW_DCBX_AGENT 0x800000 #define BNXT_FLAG_FW_DCBX_AGENT 0x800000
#define BNXT_FLAG_CHIP_NITRO_A0 0x1000000 #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000
#define BNXT_FLAG_DIM 0x2000000 #define BNXT_FLAG_DIM 0x2000000
#define BNXT_FLAG_NEW_RM 0x8000000
#define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA | \ #define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA | \
BNXT_FLAG_RFS | \ BNXT_FLAG_RFS | \
...@@ -1196,7 +1210,6 @@ struct bnxt { ...@@ -1196,7 +1210,6 @@ struct bnxt {
int tx_nr_rings; int tx_nr_rings;
int tx_nr_rings_per_tc; int tx_nr_rings_per_tc;
int tx_nr_rings_xdp; int tx_nr_rings_xdp;
int tx_reserved_rings;
int tx_wake_thresh; int tx_wake_thresh;
int tx_push_thresh; int tx_push_thresh;
...@@ -1308,6 +1321,7 @@ struct bnxt { ...@@ -1308,6 +1321,7 @@ struct bnxt {
#define BNXT_LINK_SPEED_CHNG_SP_EVENT 14 #define BNXT_LINK_SPEED_CHNG_SP_EVENT 14
#define BNXT_FLOW_STATS_SP_EVENT 15 #define BNXT_FLOW_STATS_SP_EVENT 15
struct bnxt_hw_resc hw_resc;
struct bnxt_pf_info pf; struct bnxt_pf_info pf;
#ifdef CONFIG_BNXT_SRIOV #ifdef CONFIG_BNXT_SRIOV
int nr_vfs; int nr_vfs;
...@@ -1357,6 +1371,7 @@ struct bnxt { ...@@ -1357,6 +1371,7 @@ struct bnxt {
enum devlink_eswitch_mode eswitch_mode; enum devlink_eswitch_mode eswitch_mode;
struct bnxt_vf_rep **vf_reps; /* array of vf-rep ptrs */ struct bnxt_vf_rep **vf_reps; /* array of vf-rep ptrs */
u16 *cfa_code_map; /* cfa_code -> vf_idx map */ u16 *cfa_code_map; /* cfa_code -> vf_idx map */
u8 switch_id[8];
struct bnxt_tc_info *tc_info; struct bnxt_tc_info *tc_info;
}; };
...@@ -1432,7 +1447,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, ...@@ -1432,7 +1447,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
int tx_xdp); int tx_xdp);
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc); int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
int bnxt_get_max_rings(struct bnxt *, int *, int *, bool); int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
void bnxt_restore_pf_fw_resources(struct bnxt *bp); int bnxt_restore_pf_fw_resources(struct bnxt *bp);
int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr); int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr);
void bnxt_dim_work(struct work_struct *work); void bnxt_dim_work(struct work_struct *work);
int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi); int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi);
......
...@@ -43,7 +43,7 @@ static u16 bnxt_flow_get_dst_fid(struct bnxt *pf_bp, struct net_device *dev) ...@@ -43,7 +43,7 @@ static u16 bnxt_flow_get_dst_fid(struct bnxt *pf_bp, struct net_device *dev)
} }
/* Is dev a VF-rep? */ /* Is dev a VF-rep? */
if (dev != pf_bp->dev) if (bnxt_dev_is_vf_rep(dev))
return bnxt_vf_rep_get_fid(dev); return bnxt_vf_rep_get_fid(dev);
bp = netdev_priv(dev); bp = netdev_priv(dev);
......
...@@ -241,6 +241,11 @@ static const struct net_device_ops bnxt_vf_rep_netdev_ops = { ...@@ -241,6 +241,11 @@ static const struct net_device_ops bnxt_vf_rep_netdev_ops = {
.ndo_get_phys_port_name = bnxt_vf_rep_get_phys_port_name .ndo_get_phys_port_name = bnxt_vf_rep_get_phys_port_name
}; };
bool bnxt_dev_is_vf_rep(struct net_device *dev)
{
return dev->netdev_ops == &bnxt_vf_rep_netdev_ops;
}
/* Called when the parent PF interface is closed: /* Called when the parent PF interface is closed:
* As the mode transition from SWITCHDEV to LEGACY * As the mode transition from SWITCHDEV to LEGACY
* happens under the rtnl_lock() this routine is safe * happens under the rtnl_lock() this routine is safe
...@@ -376,6 +381,26 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, ...@@ -376,6 +381,26 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
ether_addr_copy(dev->dev_addr, dev->perm_addr); ether_addr_copy(dev->dev_addr, dev->perm_addr);
} }
static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
{
struct pci_dev *pdev = bp->pdev;
int pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_DSN);
u32 dw;
if (!pos) {
netdev_info(bp->dev, "Unable do read adapter's DSN");
return -EOPNOTSUPP;
}
/* DSN (two dw) is at an offset of 4 from the cap pos */
pos += 4;
pci_read_config_dword(pdev, pos, &dw);
put_unaligned_le32(dw, &dsn[0]);
pci_read_config_dword(pdev, pos + 4, &dw);
put_unaligned_le32(dw, &dsn[4]);
return 0;
}
static int bnxt_vf_reps_create(struct bnxt *bp) static int bnxt_vf_reps_create(struct bnxt *bp)
{ {
u16 *cfa_code_map = NULL, num_vfs = pci_num_vf(bp->pdev); u16 *cfa_code_map = NULL, num_vfs = pci_num_vf(bp->pdev);
...@@ -440,6 +465,11 @@ static int bnxt_vf_reps_create(struct bnxt *bp) ...@@ -440,6 +465,11 @@ static int bnxt_vf_reps_create(struct bnxt *bp)
} }
} }
/* Read the adapter's DSN to use as the eswitch switch_id */
rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
if (rc)
goto err;
/* publish cfa_code_map only after all VF-reps have been initialized */ /* publish cfa_code_map only after all VF-reps have been initialized */
bp->cfa_code_map = cfa_code_map; bp->cfa_code_map = cfa_code_map;
bp->eswitch_mode = DEVLINK_ESWITCH_MODE_SWITCHDEV; bp->eswitch_mode = DEVLINK_ESWITCH_MODE_SWITCHDEV;
......
...@@ -28,6 +28,7 @@ static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev) ...@@ -28,6 +28,7 @@ static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev)
return bp->pf.vf[vf_rep->vf_idx].fw_fid; return bp->pf.vf[vf_rep->vf_idx].fw_fid;
} }
bool bnxt_dev_is_vf_rep(struct net_device *dev);
int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode); int bnxt_dl_eswitch_mode_get(struct devlink *devlink, u16 *mode);
int bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode); int bnxt_dl_eswitch_mode_set(struct devlink *devlink, u16 mode);
...@@ -54,5 +55,10 @@ static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev) ...@@ -54,5 +55,10 @@ static inline u16 bnxt_vf_rep_get_fid(struct net_device *dev)
{ {
return 0; return 0;
} }
static inline bool bnxt_dev_is_vf_rep(struct net_device *dev)
{
return false;
}
#endif /* CONFIG_BNXT_SRIOV */ #endif /* CONFIG_BNXT_SRIOV */
#endif /* BNXT_VFR_H */ #endif /* BNXT_VFR_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment