Skip to content

Commit 52417a9

Browse files
nsunkaddavem330
authored andcommitted
ionic: Add missing err handling for queue reconfig
ionic_start_queues_reconfig returns an error code if txrx_init fails. Handle this error code in the relevant places. This fixes a corner case where the device could get left in a detached state if the CMB reconfig fails and the attempt to clean up the mess also fails. Note that calling netif_device_attach when the netdev is already attached does not lead to unexpected behavior. Change goto name "errout" to "err_out" to maintain consistency across goto statements. Fixes: 40bc471 ("ionic: add tx/rx-push support with device Component Memory Buffers") Fixes: 6f7d6f0 ("ionic: pull reset_queues into tx_timeout handler") Signed-off-by: Nitya Sunkad <nitya.sunkad@amd.com> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b1c936e commit 52417a9

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,7 @@ static int ionic_change_mtu(struct net_device *netdev, int new_mtu)
18171817
static void ionic_tx_timeout_work(struct work_struct *ws)
18181818
{
18191819
struct ionic_lif *lif = container_of(ws, struct ionic_lif, tx_timeout_work);
1820+
int err;
18201821

18211822
if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
18221823
return;
@@ -1829,8 +1830,11 @@ static void ionic_tx_timeout_work(struct work_struct *ws)
18291830

18301831
mutex_lock(&lif->queue_lock);
18311832
ionic_stop_queues_reconfig(lif);
1832-
ionic_start_queues_reconfig(lif);
1833+
err = ionic_start_queues_reconfig(lif);
18331834
mutex_unlock(&lif->queue_lock);
1835+
1836+
if (err)
1837+
dev_err(lif->ionic->dev, "%s: Restarting queues failed\n", __func__);
18341838
}
18351839

18361840
static void ionic_tx_timeout(struct net_device *netdev, unsigned int txqueue)
@@ -2800,17 +2804,22 @@ static int ionic_cmb_reconfig(struct ionic_lif *lif,
28002804
if (err) {
28012805
dev_err(lif->ionic->dev,
28022806
"CMB restore failed: %d\n", err);
2803-
goto errout;
2807+
goto err_out;
28042808
}
28052809
}
28062810

2807-
ionic_start_queues_reconfig(lif);
2808-
} else {
2809-
/* This was detached in ionic_stop_queues_reconfig() */
2810-
netif_device_attach(lif->netdev);
2811+
err = ionic_start_queues_reconfig(lif);
2812+
if (err) {
2813+
dev_err(lif->ionic->dev,
2814+
"CMB reconfig failed: %d\n", err);
2815+
goto err_out;
2816+
}
28112817
}
28122818

2813-
errout:
2819+
err_out:
2820+
/* This was detached in ionic_stop_queues_reconfig() */
2821+
netif_device_attach(lif->netdev);
2822+
28142823
return err;
28152824
}
28162825

0 commit comments

Comments
 (0)