Skip to content

Commit e11baae

Browse files
pavanchebbikuba-moo
authored andcommitted
bnxt_en: Add a helper function to configure MRU and RSS
Add a new helper function that will configure MRU and RSS table of a VNIC. This will be useful when we configure both on a VNIC when resetting an RX ring. This function will be used again in the next bug fix patch where we have to reconfigure VNICs for RSS contexts. Suggested-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: David Wei <dw@davidwei.uk> Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20250613231841.377988-3-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1e9ac33 commit e11baae

1 file changed

Lines changed: 26 additions & 11 deletions

File tree

  • drivers/net/ethernet/broadcom/bnxt

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

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10780,6 +10780,26 @@ void bnxt_del_one_rss_ctx(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx,
1078010780
bp->num_rss_ctx--;
1078110781
}
1078210782

10783+
static int bnxt_set_vnic_mru_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic,
10784+
u16 mru)
10785+
{
10786+
int rc;
10787+
10788+
if (mru) {
10789+
rc = bnxt_hwrm_vnic_set_rss_p5(bp, vnic, true);
10790+
if (rc) {
10791+
netdev_err(bp->dev, "hwrm vnic %d set rss failure rc: %d\n",
10792+
vnic->vnic_id, rc);
10793+
return rc;
10794+
}
10795+
}
10796+
vnic->mru = mru;
10797+
bnxt_hwrm_vnic_update(bp, vnic,
10798+
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
10799+
10800+
return 0;
10801+
}
10802+
1078310803
static void bnxt_hwrm_realloc_rss_ctx_vnic(struct bnxt *bp)
1078410804
{
1078510805
bool set_tpa = !!(bp->flags & BNXT_FLAG_TPA);
@@ -15927,6 +15947,7 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1592715947
struct bnxt_vnic_info *vnic;
1592815948
struct bnxt_napi *bnapi;
1592915949
int i, rc;
15950+
u16 mru;
1593015951

1593115952
rxr = &bp->rx_ring[idx];
1593215953
clone = qmem;
@@ -15977,18 +15998,13 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1597715998
napi_enable_locked(&bnapi->napi);
1597815999
bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons);
1597916000

16001+
mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN;
1598016002
for (i = 0; i < bp->nr_vnics; i++) {
1598116003
vnic = &bp->vnic_info[i];
1598216004

15983-
rc = bnxt_hwrm_vnic_set_rss_p5(bp, vnic, true);
15984-
if (rc) {
15985-
netdev_err(bp->dev, "hwrm vnic %d set rss failure rc: %d\n",
15986-
vnic->vnic_id, rc);
16005+
rc = bnxt_set_vnic_mru_p5(bp, vnic, mru);
16006+
if (rc)
1598716007
return rc;
15988-
}
15989-
vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN;
15990-
bnxt_hwrm_vnic_update(bp, vnic,
15991-
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
1599216008
}
1599316009

1599416010
return 0;
@@ -16013,9 +16029,8 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
1601316029

1601416030
for (i = 0; i < bp->nr_vnics; i++) {
1601516031
vnic = &bp->vnic_info[i];
16016-
vnic->mru = 0;
16017-
bnxt_hwrm_vnic_update(bp, vnic,
16018-
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
16032+
16033+
bnxt_set_vnic_mru_p5(bp, vnic, 0);
1601916034
}
1602016035
/* Make sure NAPI sees that the VNIC is disabled */
1602116036
synchronize_net();

0 commit comments

Comments
 (0)