Skip to content

Commit 13c9020

Browse files
committed
Merge branch 'bnxt_en-bug-fixes'
Michael Chan says: ==================== bnxt_en: Bug fixes Thie first patch fixes a crash during PCIe AER when the bnxt_re RoCE driver is loaded. The second patch is a refactor patch needed by patch 3. Patch 3 fixes a packet drop issue if queue restart is done on a ring belonging to a non-default RSS context. Patch 2 and 3 are version 2 that has addressed the v1 issue by reducing the scope of the traffic disruptions: https://lore.kernel.org/netdev/CACKFLi=P9xYHVF4h2Ovjd-8DaoyzFAHnY6Y6H+1b7eGq+BQZzA@mail.gmail.com/ ==================== Link: https://patch.msgid.link/20250613231841.377988-1-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 68a4abb + 5dacc94 commit 13c9020

2 files changed

Lines changed: 84 additions & 27 deletions

File tree

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

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

10783+
static bool bnxt_vnic_has_rx_ring(struct bnxt *bp, struct bnxt_vnic_info *vnic,
10784+
int rxr_id)
10785+
{
10786+
u16 tbl_size = bnxt_get_rxfh_indir_size(bp->dev);
10787+
int i, vnic_rx;
10788+
10789+
/* Ntuple VNIC always has all the rx rings. Any change of ring id
10790+
* must be updated because a future filter may use it.
10791+
*/
10792+
if (vnic->flags & BNXT_VNIC_NTUPLE_FLAG)
10793+
return true;
10794+
10795+
for (i = 0; i < tbl_size; i++) {
10796+
if (vnic->flags & BNXT_VNIC_RSSCTX_FLAG)
10797+
vnic_rx = ethtool_rxfh_context_indir(vnic->rss_ctx)[i];
10798+
else
10799+
vnic_rx = bp->rss_indir_tbl[i];
10800+
10801+
if (rxr_id == vnic_rx)
10802+
return true;
10803+
}
10804+
10805+
return false;
10806+
}
10807+
10808+
static int bnxt_set_vnic_mru_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic,
10809+
u16 mru, int rxr_id)
10810+
{
10811+
int rc;
10812+
10813+
if (!bnxt_vnic_has_rx_ring(bp, vnic, rxr_id))
10814+
return 0;
10815+
10816+
if (mru) {
10817+
rc = bnxt_hwrm_vnic_set_rss_p5(bp, vnic, true);
10818+
if (rc) {
10819+
netdev_err(bp->dev, "hwrm vnic %d set rss failure rc: %d\n",
10820+
vnic->vnic_id, rc);
10821+
return rc;
10822+
}
10823+
}
10824+
vnic->mru = mru;
10825+
bnxt_hwrm_vnic_update(bp, vnic,
10826+
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
10827+
10828+
return 0;
10829+
}
10830+
10831+
static int bnxt_set_rss_ctx_vnic_mru(struct bnxt *bp, u16 mru, int rxr_id)
10832+
{
10833+
struct ethtool_rxfh_context *ctx;
10834+
unsigned long context;
10835+
int rc;
10836+
10837+
xa_for_each(&bp->dev->ethtool->rss_ctx, context, ctx) {
10838+
struct bnxt_rss_ctx *rss_ctx = ethtool_rxfh_context_priv(ctx);
10839+
struct bnxt_vnic_info *vnic = &rss_ctx->vnic;
10840+
10841+
rc = bnxt_set_vnic_mru_p5(bp, vnic, mru, rxr_id);
10842+
if (rc)
10843+
return rc;
10844+
}
10845+
10846+
return 0;
10847+
}
10848+
1078310849
static void bnxt_hwrm_realloc_rss_ctx_vnic(struct bnxt *bp)
1078410850
{
1078510851
bool set_tpa = !!(bp->flags & BNXT_FLAG_TPA);
@@ -15927,6 +15993,7 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1592715993
struct bnxt_vnic_info *vnic;
1592815994
struct bnxt_napi *bnapi;
1592915995
int i, rc;
15996+
u16 mru;
1593015997

1593115998
rxr = &bp->rx_ring[idx];
1593215999
clone = qmem;
@@ -15977,21 +16044,15 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1597716044
napi_enable_locked(&bnapi->napi);
1597816045
bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons);
1597916046

16047+
mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN;
1598016048
for (i = 0; i < bp->nr_vnics; i++) {
1598116049
vnic = &bp->vnic_info[i];
1598216050

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);
16051+
rc = bnxt_set_vnic_mru_p5(bp, vnic, mru, idx);
16052+
if (rc)
1598716053
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);
1599216054
}
15993-
15994-
return 0;
16055+
return bnxt_set_rss_ctx_vnic_mru(bp, mru, idx);
1599516056

1599616057
err_reset:
1599716058
netdev_err(bp->dev, "Unexpected HWRM error during queue start rc: %d\n",
@@ -16013,10 +16074,10 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
1601316074

1601416075
for (i = 0; i < bp->nr_vnics; i++) {
1601516076
vnic = &bp->vnic_info[i];
16016-
vnic->mru = 0;
16017-
bnxt_hwrm_vnic_update(bp, vnic,
16018-
VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
16077+
16078+
bnxt_set_vnic_mru_p5(bp, vnic, 0, idx);
1601916079
}
16080+
bnxt_set_rss_ctx_vnic_mru(bp, 0, idx);
1602016081
/* Make sure NAPI sees that the VNIC is disabled */
1602116082
synchronize_net();
1602216083
rxr = &bp->rx_ring[idx];

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,9 @@ void bnxt_ulp_stop(struct bnxt *bp)
231231
return;
232232

233233
mutex_lock(&edev->en_dev_lock);
234-
if (!bnxt_ulp_registered(edev)) {
235-
mutex_unlock(&edev->en_dev_lock);
236-
return;
237-
}
234+
if (!bnxt_ulp_registered(edev) ||
235+
(edev->flags & BNXT_EN_FLAG_ULP_STOPPED))
236+
goto ulp_stop_exit;
238237

239238
edev->flags |= BNXT_EN_FLAG_ULP_STOPPED;
240239
if (aux_priv) {
@@ -250,6 +249,7 @@ void bnxt_ulp_stop(struct bnxt *bp)
250249
adrv->suspend(adev, pm);
251250
}
252251
}
252+
ulp_stop_exit:
253253
mutex_unlock(&edev->en_dev_lock);
254254
}
255255

@@ -258,19 +258,13 @@ void bnxt_ulp_start(struct bnxt *bp, int err)
258258
struct bnxt_aux_priv *aux_priv = bp->aux_priv;
259259
struct bnxt_en_dev *edev = bp->edev;
260260

261-
if (!edev)
262-
return;
263-
264-
edev->flags &= ~BNXT_EN_FLAG_ULP_STOPPED;
265-
266-
if (err)
261+
if (!edev || err)
267262
return;
268263

269264
mutex_lock(&edev->en_dev_lock);
270-
if (!bnxt_ulp_registered(edev)) {
271-
mutex_unlock(&edev->en_dev_lock);
272-
return;
273-
}
265+
if (!bnxt_ulp_registered(edev) ||
266+
!(edev->flags & BNXT_EN_FLAG_ULP_STOPPED))
267+
goto ulp_start_exit;
274268

275269
if (edev->ulp_tbl->msix_requested)
276270
bnxt_fill_msix_vecs(bp, edev->msix_entries);
@@ -287,6 +281,8 @@ void bnxt_ulp_start(struct bnxt *bp, int err)
287281
adrv->resume(adev);
288282
}
289283
}
284+
ulp_start_exit:
285+
edev->flags &= ~BNXT_EN_FLAG_ULP_STOPPED;
290286
mutex_unlock(&edev->en_dev_lock);
291287
}
292288

0 commit comments

Comments
 (0)