Skip to content

Commit 8c97ab5

Browse files
sumang-mrvldavem330
authored andcommitted
octeontx2-pf: Fix graceful exit during PFC configuration failure
During PFC configuration failure the code was not handling a graceful exit. This patch fixes the same and add proper code for a graceful exit. Fixes: 99c969a ("octeontx2-pf: Add egress PFC support") Signed-off-by: Suman Ghosh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 738b54b commit 8c97ab5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,10 @@ static int otx2_dcbnl_ieee_getpfc(struct net_device *dev, struct ieee_pfc *pfc)
399399
static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc)
400400
{
401401
struct otx2_nic *pfvf = netdev_priv(dev);
402+
u8 old_pfc_en;
402403
int err;
403404

404-
/* Save PFC configuration to interface */
405+
old_pfc_en = pfvf->pfc_en;
405406
pfvf->pfc_en = pfc->pfc_en;
406407

407408
if (pfvf->hw.tx_queues >= NIX_PF_PFC_PRIO_MAX)
@@ -411,20 +412,30 @@ static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc)
411412
* supported by the tx queue configuration
412413
*/
413414
err = otx2_check_pfc_config(pfvf);
414-
if (err)
415+
if (err) {
416+
pfvf->pfc_en = old_pfc_en;
415417
return err;
418+
}
416419

417420
process_pfc:
418421
err = otx2_config_priority_flow_ctrl(pfvf);
419-
if (err)
422+
if (err) {
423+
pfvf->pfc_en = old_pfc_en;
420424
return err;
425+
}
421426

422427
/* Request Per channel Bpids */
423428
if (pfc->pfc_en)
424429
otx2_nix_config_bp(pfvf, true);
425430

426431
err = otx2_pfc_txschq_update(pfvf);
427432
if (err) {
433+
if (pfc->pfc_en)
434+
otx2_nix_config_bp(pfvf, false);
435+
436+
otx2_pfc_txschq_stop(pfvf);
437+
pfvf->pfc_en = old_pfc_en;
438+
otx2_config_priority_flow_ctrl(pfvf);
428439
dev_err(pfvf->dev, "%s failed to update TX schedulers\n", __func__);
429440
return err;
430441
}

0 commit comments

Comments
 (0)