Skip to content

Commit 98a4322

Browse files
Edwin PeerPaolo Abeni
authored andcommitted
bnxt_en: update RSS config using difference algorithm
Hardware is unable to realize all legal firmware interface state values for hash_type. For example, if 4-tuple TCP_IPV4 hash is enabled, 4-tuple UDP_IPV4 hash must also be enabled. By providing the bits the user intended to change instead of the possible illegal intermediate states, the firmware is able to make better compromises when deciding which bits to ignore. With this new mechansim, we can now report the actual configured hash back to the user. Add bnxt_hwrm_update_rss_hash_cfg() to report the actual hash after user configuration. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 41d2dd4 commit 98a4322

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5294,7 +5294,15 @@ __bnxt_hwrm_vnic_set_rss(struct bnxt *bp, struct hwrm_vnic_rss_cfg_input *req,
52945294
else
52955295
bnxt_fill_hw_rss_tbl(bp, vnic);
52965296

5297-
req->hash_type = cpu_to_le32(bp->rss_hash_cfg);
5297+
if (bp->rss_hash_delta) {
5298+
req->hash_type = cpu_to_le32(bp->rss_hash_delta);
5299+
if (bp->rss_hash_cfg & bp->rss_hash_delta)
5300+
req->flags |= VNIC_RSS_CFG_REQ_FLAGS_HASH_TYPE_INCLUDE;
5301+
else
5302+
req->flags |= VNIC_RSS_CFG_REQ_FLAGS_HASH_TYPE_EXCLUDE;
5303+
} else {
5304+
req->hash_type = cpu_to_le32(bp->rss_hash_cfg);
5305+
}
52985306
req->hash_mode_flags = VNIC_RSS_CFG_REQ_HASH_MODE_FLAGS_DEFAULT;
52995307
req->ring_grp_tbl_addr = cpu_to_le64(vnic->rss_table_dma_addr);
53005308
req->hash_key_tbl_addr = cpu_to_le64(vnic->rss_hash_key_dma_addr);
@@ -5355,6 +5363,25 @@ static int bnxt_hwrm_vnic_set_rss_p5(struct bnxt *bp, u16 vnic_id, bool set_rss)
53555363
return rc;
53565364
}
53575365

5366+
static void bnxt_hwrm_update_rss_hash_cfg(struct bnxt *bp)
5367+
{
5368+
struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
5369+
struct hwrm_vnic_rss_qcfg_output *resp;
5370+
struct hwrm_vnic_rss_qcfg_input *req;
5371+
5372+
if (hwrm_req_init(bp, req, HWRM_VNIC_RSS_QCFG))
5373+
return;
5374+
5375+
/* all contexts configured to same hash_type, zero always exists */
5376+
req->rss_ctx_idx = cpu_to_le16(vnic->fw_rss_cos_lb_ctx[0]);
5377+
resp = hwrm_req_hold(bp, req);
5378+
if (!hwrm_req_send(bp, req)) {
5379+
bp->rss_hash_cfg = le32_to_cpu(resp->hash_type) ?: bp->rss_hash_cfg;
5380+
bp->rss_hash_delta = 0;
5381+
}
5382+
hwrm_req_drop(bp, req);
5383+
}
5384+
53585385
static int bnxt_hwrm_vnic_set_hds(struct bnxt *bp, u16 vnic_id)
53595386
{
53605387
struct bnxt_vnic_info *vnic = &bp->vnic_info[vnic_id];
@@ -5612,6 +5639,8 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
56125639
(BNXT_CHIP_P5_THOR(bp) &&
56135640
!(bp->fw_cap & BNXT_FW_CAP_EXT_HW_STATS_SUPPORTED)))
56145641
bp->fw_cap |= BNXT_FW_CAP_VLAN_RX_STRIP;
5642+
if (flags & VNIC_QCAPS_RESP_FLAGS_RSS_HASH_TYPE_DELTA_CAP)
5643+
bp->fw_cap |= BNXT_FW_CAP_RSS_HASH_TYPE_DELTA;
56155644
bp->max_tpa_v2 = le16_to_cpu(resp->max_aggs_supported);
56165645
if (bp->max_tpa_v2) {
56175646
if (BNXT_CHIP_P5_THOR(bp))
@@ -8806,6 +8835,8 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
88068835
rc = bnxt_setup_vnic(bp, 0);
88078836
if (rc)
88088837
goto err_out;
8838+
if (bp->fw_cap & BNXT_FW_CAP_RSS_HASH_TYPE_DELTA)
8839+
bnxt_hwrm_update_rss_hash_cfg(bp);
88098840

88108841
if (bp->flags & BNXT_FLAG_RFS) {
88118842
rc = bnxt_alloc_rfs_vnics(bp);
@@ -12241,6 +12272,8 @@ static void bnxt_set_dflt_rss_hash_type(struct bnxt *bp)
1224112272
VNIC_RSS_CFG_REQ_HASH_TYPE_TCP_IPV4 |
1224212273
VNIC_RSS_CFG_REQ_HASH_TYPE_IPV6 |
1224312274
VNIC_RSS_CFG_REQ_HASH_TYPE_TCP_IPV6;
12275+
if (bp->fw_cap & BNXT_FW_CAP_RSS_HASH_TYPE_DELTA)
12276+
bp->rss_hash_delta = bp->rss_hash_cfg;
1224412277
if (BNXT_CHIP_P4_PLUS(bp) && bp->hwrm_spec_code >= 0x10501) {
1224512278
bp->flags |= BNXT_FLAG_UDP_RSS_CAP;
1224612279
bp->rss_hash_cfg |= VNIC_RSS_CFG_REQ_HASH_TYPE_UDP_IPV4 |

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,7 @@ struct bnxt {
19001900
u16 *rss_indir_tbl;
19011901
u16 rss_indir_tbl_entries;
19021902
u32 rss_hash_cfg;
1903+
u32 rss_hash_delta;
19031904

19041905
u16 max_mtu;
19051906
u8 max_tc;
@@ -1965,6 +1966,7 @@ struct bnxt {
19651966
#define BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V2 0x00010000
19661967
#define BNXT_FW_CAP_PCIE_STATS_SUPPORTED 0x00020000
19671968
#define BNXT_FW_CAP_EXT_STATS_SUPPORTED 0x00040000
1969+
#define BNXT_FW_CAP_RSS_HASH_TYPE_DELTA 0x00080000
19681970
#define BNXT_FW_CAP_ERR_RECOVER_RELOAD 0x00100000
19691971
#define BNXT_FW_CAP_HOT_RESET 0x00200000
19701972
#define BNXT_FW_CAP_PTP_RTC 0x00400000

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,8 @@ static int bnxt_srxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
12341234
if (bp->rss_hash_cfg == rss_hash_cfg)
12351235
return 0;
12361236

1237+
if (bp->fw_cap & BNXT_FW_CAP_RSS_HASH_TYPE_DELTA)
1238+
bp->rss_hash_delta = bp->rss_hash_cfg ^ rss_hash_cfg;
12371239
bp->rss_hash_cfg = rss_hash_cfg;
12381240
if (netif_running(bp->dev)) {
12391241
bnxt_close_nic(bp, false, false);

drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6768,6 +6768,53 @@ struct hwrm_vnic_rss_cfg_cmd_err {
67686768
u8 unused_0[7];
67696769
};
67706770

6771+
/* hwrm_vnic_rss_qcfg_input (size:192b/24B) */
6772+
struct hwrm_vnic_rss_qcfg_input {
6773+
__le16 req_type;
6774+
__le16 cmpl_ring;
6775+
__le16 seq_id;
6776+
__le16 target_id;
6777+
__le64 resp_addr;
6778+
__le16 rss_ctx_idx;
6779+
__le16 vnic_id;
6780+
u8 unused_0[4];
6781+
};
6782+
6783+
/* hwrm_vnic_rss_qcfg_output (size:512b/64B) */
6784+
struct hwrm_vnic_rss_qcfg_output {
6785+
__le16 error_code;
6786+
__le16 req_type;
6787+
__le16 seq_id;
6788+
__le16 resp_len;
6789+
__le32 hash_type;
6790+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_IPV4 0x1UL
6791+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_TCP_IPV4 0x2UL
6792+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_UDP_IPV4 0x4UL
6793+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_IPV6 0x8UL
6794+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_TCP_IPV6 0x10UL
6795+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_UDP_IPV6 0x20UL
6796+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_IPV6_FLOW_LABEL 0x40UL
6797+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_AH_SPI_IPV4 0x80UL
6798+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_ESP_SPI_IPV4 0x100UL
6799+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_AH_SPI_IPV6 0x200UL
6800+
#define VNIC_RSS_QCFG_RESP_HASH_TYPE_ESP_SPI_IPV6 0x400UL
6801+
u8 unused_0[4];
6802+
__le32 hash_key[10];
6803+
u8 hash_mode_flags;
6804+
#define VNIC_RSS_QCFG_RESP_HASH_MODE_FLAGS_DEFAULT 0x1UL
6805+
#define VNIC_RSS_QCFG_RESP_HASH_MODE_FLAGS_INNERMOST_4 0x2UL
6806+
#define VNIC_RSS_QCFG_RESP_HASH_MODE_FLAGS_INNERMOST_2 0x4UL
6807+
#define VNIC_RSS_QCFG_RESP_HASH_MODE_FLAGS_OUTERMOST_4 0x8UL
6808+
#define VNIC_RSS_QCFG_RESP_HASH_MODE_FLAGS_OUTERMOST_2 0x10UL
6809+
u8 ring_select_mode;
6810+
#define VNIC_RSS_QCFG_RESP_RING_SELECT_MODE_TOEPLITZ 0x0UL
6811+
#define VNIC_RSS_QCFG_RESP_RING_SELECT_MODE_XOR 0x1UL
6812+
#define VNIC_RSS_QCFG_RESP_RING_SELECT_MODE_TOEPLITZ_CHECKSUM 0x2UL
6813+
#define VNIC_RSS_QCFG_RESP_RING_SELECT_MODE_LAST VNIC_RSS_QCFG_RESP_RING_SELECT_MODE_TOEPLITZ_CHECKSUM
6814+
u8 unused_1[5];
6815+
u8 valid;
6816+
};
6817+
67716818
/* hwrm_vnic_plcmodes_cfg_input (size:320b/40B) */
67726819
struct hwrm_vnic_plcmodes_cfg_input {
67736820
__le16 req_type;

0 commit comments

Comments
 (0)