Commit 66846b7d authored by David S. Miller's avatar David S. Miller

Merge branch 'bnxt_en-Driver-update-for-net-next'

Michael Chan says:

====================
bnxt_en: Driver update for net-next.

This patchset implements ethtool -X to setup user-defined RSS indirection
table.  The new infrastructure also allows the proper logical ring index
to be used to populate the RSS indirection when queried by ethtool -x.
Prior to these patches, we were incorrectly populating the output of
ethtool -x with internal ring IDs which would make no sense to the user.

The last 2 patches add some cleanups to the VLAN acceleration logic
and check the firmware capabilities before allowing VLAN acceleration
offloads.

v4: Move bnxt_get_rxfh_indir_size() fix to a new patch #2.
    Modify patch #7 to revert RSS map to default only when necessary.

v3: Use ALIGN() in patch 5.
    Add warning messages in patch 6.

v2: Some RSS indirection table changes requested by Jakub Kicinski.
====================
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e80a07b2 1da63ddd
This diff is collapsed.
...@@ -1017,6 +1017,15 @@ struct bnxt_vnic_info { ...@@ -1017,6 +1017,15 @@ struct bnxt_vnic_info {
__le16 *rss_table; __le16 *rss_table;
dma_addr_t rss_hash_key_dma_addr; dma_addr_t rss_hash_key_dma_addr;
u64 *rss_hash_key; u64 *rss_hash_key;
int rss_table_size;
#define BNXT_RSS_TABLE_ENTRIES_P5 64
#define BNXT_RSS_TABLE_SIZE_P5 (BNXT_RSS_TABLE_ENTRIES_P5 * 4)
#define BNXT_RSS_TABLE_MAX_TBL_P5 8
#define BNXT_MAX_RSS_TABLE_SIZE_P5 \
(BNXT_RSS_TABLE_SIZE_P5 * BNXT_RSS_TABLE_MAX_TBL_P5)
#define BNXT_MAX_RSS_TABLE_ENTRIES_P5 \
(BNXT_RSS_TABLE_ENTRIES_P5 * BNXT_RSS_TABLE_MAX_TBL_P5)
u32 rx_mask; u32 rx_mask;
u8 *mc_list; u8 *mc_list;
...@@ -1648,6 +1657,8 @@ struct bnxt { ...@@ -1648,6 +1657,8 @@ struct bnxt {
struct bnxt_ring_grp_info *grp_info; struct bnxt_ring_grp_info *grp_info;
struct bnxt_vnic_info *vnic_info; struct bnxt_vnic_info *vnic_info;
int nr_vnics; int nr_vnics;
u16 *rss_indir_tbl;
u16 rss_indir_tbl_entries;
u32 rss_hash_cfg; u32 rss_hash_cfg;
u16 max_mtu; u16 max_mtu;
...@@ -1705,6 +1716,9 @@ struct bnxt { ...@@ -1705,6 +1716,9 @@ struct bnxt {
#define BNXT_FW_CAP_ERR_RECOVER_RELOAD 0x00100000 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD 0x00100000
#define BNXT_FW_CAP_HOT_RESET 0x00200000 #define BNXT_FW_CAP_HOT_RESET 0x00200000
#define BNXT_FW_CAP_SHARED_PORT_CFG 0x00400000 #define BNXT_FW_CAP_SHARED_PORT_CFG 0x00400000
#define BNXT_FW_CAP_VLAN_RX_STRIP 0x01000000
#define BNXT_FW_CAP_VLAN_TX_INSERT 0x02000000
#define BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED 0x04000000
#define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM) #define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
u32 hwrm_spec_code; u32 hwrm_spec_code;
...@@ -1895,6 +1909,11 @@ struct bnxt { ...@@ -1895,6 +1909,11 @@ struct bnxt {
#define BNXT_PCIE_STATS_OFFSET(counter) \ #define BNXT_PCIE_STATS_OFFSET(counter) \
(offsetof(struct pcie_ctx_hw_stats, counter) / 8) (offsetof(struct pcie_ctx_hw_stats, counter) / 8)
#define BNXT_HW_FEATURE_VLAN_ALL_RX \
(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)
#define BNXT_HW_FEATURE_VLAN_ALL_TX \
(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX)
#define I2C_DEV_ADDR_A0 0xa0 #define I2C_DEV_ADDR_A0 0xa0
#define I2C_DEV_ADDR_A2 0xa2 #define I2C_DEV_ADDR_A2 0xa2
#define SFF_DIAG_SUPPORT_OFFSET 0x5c #define SFF_DIAG_SUPPORT_OFFSET 0x5c
...@@ -2028,6 +2047,7 @@ int hwrm_send_message(struct bnxt *, void *, u32, int); ...@@ -2028,6 +2047,7 @@ int hwrm_send_message(struct bnxt *, void *, u32, int);
int hwrm_send_message_silent(struct bnxt *, void *, u32, int); int hwrm_send_message_silent(struct bnxt *, void *, u32, int);
int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap, int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap,
int bmap_size, bool async_only); int bmap_size, bool async_only);
int bnxt_get_nr_rss_ctxs(struct bnxt *bp, int rx_rings);
int bnxt_hwrm_vnic_cfg(struct bnxt *bp, u16 vnic_id); int bnxt_hwrm_vnic_cfg(struct bnxt *bp, u16 vnic_id);
int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings); int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings);
int bnxt_nq_rings_in_use(struct bnxt *bp); int bnxt_nq_rings_in_use(struct bnxt *bp);
......
...@@ -926,6 +926,13 @@ static int bnxt_set_channels(struct net_device *dev, ...@@ -926,6 +926,13 @@ static int bnxt_set_channels(struct net_device *dev,
return rc; return rc;
} }
if (bnxt_get_nr_rss_ctxs(bp, req_rx_rings) !=
bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) &&
(dev->priv_flags & IFF_RXFH_CONFIGURED)) {
netdev_warn(dev, "RSS table size change required, RSS table entries must be default to proceed\n");
return -EINVAL;
}
if (netif_running(dev)) { if (netif_running(dev)) {
if (BNXT_PF(bp)) { if (BNXT_PF(bp)) {
/* TODO CHIMP_FW: Send message to all VF's /* TODO CHIMP_FW: Send message to all VF's
...@@ -1273,8 +1280,12 @@ static int bnxt_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) ...@@ -1273,8 +1280,12 @@ static int bnxt_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
return rc; return rc;
} }
static u32 bnxt_get_rxfh_indir_size(struct net_device *dev) u32 bnxt_get_rxfh_indir_size(struct net_device *dev)
{ {
struct bnxt *bp = netdev_priv(dev);
if (bp->flags & BNXT_FLAG_CHIP_P5)
return ALIGN(bp->rx_nr_rings, BNXT_RSS_TABLE_ENTRIES_P5);
return HW_HASH_INDEX_SIZE; return HW_HASH_INDEX_SIZE;
} }
...@@ -1288,7 +1299,7 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, ...@@ -1288,7 +1299,7 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
{ {
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
struct bnxt_vnic_info *vnic; struct bnxt_vnic_info *vnic;
int i = 0; u32 i, tbl_size;
if (hfunc) if (hfunc)
*hfunc = ETH_RSS_HASH_TOP; *hfunc = ETH_RSS_HASH_TOP;
...@@ -1297,9 +1308,10 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, ...@@ -1297,9 +1308,10 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
return 0; return 0;
vnic = &bp->vnic_info[0]; vnic = &bp->vnic_info[0];
if (indir && vnic->rss_table) { if (indir && bp->rss_indir_tbl) {
for (i = 0; i < HW_HASH_INDEX_SIZE; i++) tbl_size = bnxt_get_rxfh_indir_size(dev);
indir[i] = le16_to_cpu(vnic->rss_table[i]); for (i = 0; i < tbl_size; i++)
indir[i] = bp->rss_indir_tbl[i];
} }
if (key && vnic->rss_hash_key) if (key && vnic->rss_hash_key)
...@@ -1308,6 +1320,35 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, ...@@ -1308,6 +1320,35 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
return 0; return 0;
} }
static int bnxt_set_rxfh(struct net_device *dev, const u32 *indir,
const u8 *key, const u8 hfunc)
{
struct bnxt *bp = netdev_priv(dev);
int rc = 0;
if (hfunc && hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
if (key)
return -EOPNOTSUPP;
if (indir) {
u32 i, pad, tbl_size = bnxt_get_rxfh_indir_size(dev);
for (i = 0; i < tbl_size; i++)
bp->rss_indir_tbl[i] = indir[i];
pad = bp->rss_indir_tbl_entries - tbl_size;
if (pad)
memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16));
}
if (netif_running(bp->dev)) {
bnxt_close_nic(bp, false, false);
rc = bnxt_open_nic(bp, false, false);
}
return rc;
}
static void bnxt_get_drvinfo(struct net_device *dev, static void bnxt_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
...@@ -3614,6 +3655,7 @@ const struct ethtool_ops bnxt_ethtool_ops = { ...@@ -3614,6 +3655,7 @@ const struct ethtool_ops bnxt_ethtool_ops = {
.get_rxfh_indir_size = bnxt_get_rxfh_indir_size, .get_rxfh_indir_size = bnxt_get_rxfh_indir_size,
.get_rxfh_key_size = bnxt_get_rxfh_key_size, .get_rxfh_key_size = bnxt_get_rxfh_key_size,
.get_rxfh = bnxt_get_rxfh, .get_rxfh = bnxt_get_rxfh,
.set_rxfh = bnxt_set_rxfh,
.flash_device = bnxt_flash_device, .flash_device = bnxt_flash_device,
.get_eeprom_len = bnxt_get_eeprom_len, .get_eeprom_len = bnxt_get_eeprom_len,
.get_eeprom = bnxt_get_eeprom, .get_eeprom = bnxt_get_eeprom,
......
...@@ -86,6 +86,7 @@ struct hwrm_dbg_cmn_output { ...@@ -86,6 +86,7 @@ struct hwrm_dbg_cmn_output {
extern const struct ethtool_ops bnxt_ethtool_ops; extern const struct ethtool_ops bnxt_ethtool_ops;
u32 bnxt_get_rxfh_indir_size(struct net_device *dev);
u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8); u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);
u32 bnxt_fw_to_ethtool_speed(u16); u32 bnxt_fw_to_ethtool_speed(u16);
u16 bnxt_get_fw_auto_link_speeds(u32); u16 bnxt_get_fw_auto_link_speeds(u32);
......
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