Skip to content

Commit 41d2dd4

Browse files
Edwin PeerPaolo Abeni
authored andcommitted
bnxt_en: refactor VNIC RSS update functions
Extract common code into a new function. This will avoid duplication in the next patch, which changes the update algorithm for both the P5 and legacy code paths. No functional changes. 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 b2140e9 commit 41d2dd4

File tree

1 file changed

+16
-18
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+16
-18
lines changed

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

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5250,7 +5250,7 @@ int bnxt_get_nr_rss_ctxs(struct bnxt *bp, int rx_rings)
52505250
return 1;
52515251
}
52525252

5253-
static void __bnxt_fill_hw_rss_tbl(struct bnxt *bp, struct bnxt_vnic_info *vnic)
5253+
static void bnxt_fill_hw_rss_tbl(struct bnxt *bp, struct bnxt_vnic_info *vnic)
52545254
{
52555255
bool no_rss = !(vnic->flags & BNXT_VNIC_RSS_FLAG);
52565256
u16 i, j;
@@ -5263,8 +5263,8 @@ static void __bnxt_fill_hw_rss_tbl(struct bnxt *bp, struct bnxt_vnic_info *vnic)
52635263
}
52645264
}
52655265

5266-
static void __bnxt_fill_hw_rss_tbl_p5(struct bnxt *bp,
5267-
struct bnxt_vnic_info *vnic)
5266+
static void bnxt_fill_hw_rss_tbl_p5(struct bnxt *bp,
5267+
struct bnxt_vnic_info *vnic)
52685268
{
52695269
__le16 *ring_tbl = vnic->rss_table;
52705270
struct bnxt_rx_ring_info *rxr;
@@ -5285,12 +5285,19 @@ static void __bnxt_fill_hw_rss_tbl_p5(struct bnxt *bp,
52855285
}
52865286
}
52875287

5288-
static void bnxt_fill_hw_rss_tbl(struct bnxt *bp, struct bnxt_vnic_info *vnic)
5288+
static void
5289+
__bnxt_hwrm_vnic_set_rss(struct bnxt *bp, struct hwrm_vnic_rss_cfg_input *req,
5290+
struct bnxt_vnic_info *vnic)
52895291
{
52905292
if (bp->flags & BNXT_FLAG_CHIP_P5)
5291-
__bnxt_fill_hw_rss_tbl_p5(bp, vnic);
5293+
bnxt_fill_hw_rss_tbl_p5(bp, vnic);
52925294
else
5293-
__bnxt_fill_hw_rss_tbl(bp, vnic);
5295+
bnxt_fill_hw_rss_tbl(bp, vnic);
5296+
5297+
req->hash_type = cpu_to_le32(bp->rss_hash_cfg);
5298+
req->hash_mode_flags = VNIC_RSS_CFG_REQ_HASH_MODE_FLAGS_DEFAULT;
5299+
req->ring_grp_tbl_addr = cpu_to_le64(vnic->rss_table_dma_addr);
5300+
req->hash_key_tbl_addr = cpu_to_le64(vnic->rss_hash_key_dma_addr);
52945301
}
52955302

52965303
static int bnxt_hwrm_vnic_set_rss(struct bnxt *bp, u16 vnic_id, bool set_rss)
@@ -5307,14 +5314,8 @@ static int bnxt_hwrm_vnic_set_rss(struct bnxt *bp, u16 vnic_id, bool set_rss)
53075314
if (rc)
53085315
return rc;
53095316

5310-
if (set_rss) {
5311-
bnxt_fill_hw_rss_tbl(bp, vnic);
5312-
req->hash_type = cpu_to_le32(bp->rss_hash_cfg);
5313-
req->hash_mode_flags = VNIC_RSS_CFG_REQ_HASH_MODE_FLAGS_DEFAULT;
5314-
req->ring_grp_tbl_addr = cpu_to_le64(vnic->rss_table_dma_addr);
5315-
req->hash_key_tbl_addr =
5316-
cpu_to_le64(vnic->rss_hash_key_dma_addr);
5317-
}
5317+
if (set_rss)
5318+
__bnxt_hwrm_vnic_set_rss(bp, req, vnic);
53185319
req->rss_ctx_idx = cpu_to_le16(vnic->fw_rss_cos_lb_ctx[0]);
53195320
return hwrm_req_send(bp, req);
53205321
}
@@ -5335,10 +5336,7 @@ static int bnxt_hwrm_vnic_set_rss_p5(struct bnxt *bp, u16 vnic_id, bool set_rss)
53355336
if (!set_rss)
53365337
return hwrm_req_send(bp, req);
53375338

5338-
bnxt_fill_hw_rss_tbl(bp, vnic);
5339-
req->hash_type = cpu_to_le32(bp->rss_hash_cfg);
5340-
req->hash_mode_flags = VNIC_RSS_CFG_REQ_HASH_MODE_FLAGS_DEFAULT;
5341-
req->hash_key_tbl_addr = cpu_to_le64(vnic->rss_hash_key_dma_addr);
5339+
__bnxt_hwrm_vnic_set_rss(bp, req, vnic);
53425340
ring_tbl_map = vnic->rss_table_dma_addr;
53435341
nr_ctxs = bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings);
53445342

0 commit comments

Comments
 (0)