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>
This commit is contained in:
committed by
Jakub Kicinski
parent
1e9ac33fa2
commit
e11baaea94
@@ -10780,6 +10780,26 @@ void bnxt_del_one_rss_ctx(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx,
|
||||
bp->num_rss_ctx--;
|
||||
}
|
||||
|
||||
static int bnxt_set_vnic_mru_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic,
|
||||
u16 mru)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (mru) {
|
||||
rc = bnxt_hwrm_vnic_set_rss_p5(bp, vnic, true);
|
||||
if (rc) {
|
||||
netdev_err(bp->dev, "hwrm vnic %d set rss failure rc: %d\n",
|
||||
vnic->vnic_id, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
vnic->mru = mru;
|
||||
bnxt_hwrm_vnic_update(bp, vnic,
|
||||
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bnxt_hwrm_realloc_rss_ctx_vnic(struct bnxt *bp)
|
||||
{
|
||||
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)
|
||||
struct bnxt_vnic_info *vnic;
|
||||
struct bnxt_napi *bnapi;
|
||||
int i, rc;
|
||||
u16 mru;
|
||||
|
||||
rxr = &bp->rx_ring[idx];
|
||||
clone = qmem;
|
||||
@@ -15977,18 +15998,13 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
|
||||
napi_enable_locked(&bnapi->napi);
|
||||
bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons);
|
||||
|
||||
mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN;
|
||||
for (i = 0; i < bp->nr_vnics; i++) {
|
||||
vnic = &bp->vnic_info[i];
|
||||
|
||||
rc = bnxt_hwrm_vnic_set_rss_p5(bp, vnic, true);
|
||||
if (rc) {
|
||||
netdev_err(bp->dev, "hwrm vnic %d set rss failure rc: %d\n",
|
||||
vnic->vnic_id, rc);
|
||||
rc = bnxt_set_vnic_mru_p5(bp, vnic, mru);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN;
|
||||
bnxt_hwrm_vnic_update(bp, vnic,
|
||||
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -16013,9 +16029,8 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
|
||||
|
||||
for (i = 0; i < bp->nr_vnics; i++) {
|
||||
vnic = &bp->vnic_info[i];
|
||||
vnic->mru = 0;
|
||||
bnxt_hwrm_vnic_update(bp, vnic,
|
||||
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
|
||||
|
||||
bnxt_set_vnic_mru_p5(bp, vnic, 0);
|
||||
}
|
||||
/* Make sure NAPI sees that the VNIC is disabled */
|
||||
synchronize_net();
|
||||
|
||||
Reference in New Issue
Block a user