Commit 52417a95 authored by Nitya Sunkad's avatar Nitya Sunkad Committed by David S. Miller

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: 40bc471d ("ionic: add tx/rx-push support with device Component Memory Buffers")
Fixes: 6f7d6f0f ("ionic: pull reset_queues into tx_timeout handler")
Signed-off-by: default avatarNitya Sunkad <nitya.sunkad@amd.com>
Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b1c936e9
...@@ -1817,6 +1817,7 @@ static int ionic_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -1817,6 +1817,7 @@ static int ionic_change_mtu(struct net_device *netdev, int new_mtu)
static void ionic_tx_timeout_work(struct work_struct *ws) static void ionic_tx_timeout_work(struct work_struct *ws)
{ {
struct ionic_lif *lif = container_of(ws, struct ionic_lif, tx_timeout_work); struct ionic_lif *lif = container_of(ws, struct ionic_lif, tx_timeout_work);
int err;
if (test_bit(IONIC_LIF_F_FW_RESET, lif->state)) if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
return; return;
...@@ -1829,8 +1830,11 @@ static void ionic_tx_timeout_work(struct work_struct *ws) ...@@ -1829,8 +1830,11 @@ static void ionic_tx_timeout_work(struct work_struct *ws)
mutex_lock(&lif->queue_lock); mutex_lock(&lif->queue_lock);
ionic_stop_queues_reconfig(lif); ionic_stop_queues_reconfig(lif);
ionic_start_queues_reconfig(lif); err = ionic_start_queues_reconfig(lif);
mutex_unlock(&lif->queue_lock); mutex_unlock(&lif->queue_lock);
if (err)
dev_err(lif->ionic->dev, "%s: Restarting queues failed\n", __func__);
} }
static void ionic_tx_timeout(struct net_device *netdev, unsigned int txqueue) 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, ...@@ -2800,17 +2804,22 @@ static int ionic_cmb_reconfig(struct ionic_lif *lif,
if (err) { if (err) {
dev_err(lif->ionic->dev, dev_err(lif->ionic->dev,
"CMB restore failed: %d\n", err); "CMB restore failed: %d\n", err);
goto errout; goto err_out;
} }
} }
ionic_start_queues_reconfig(lif); err = ionic_start_queues_reconfig(lif);
} else { if (err) {
dev_err(lif->ionic->dev,
"CMB reconfig failed: %d\n", err);
goto err_out;
}
}
err_out:
/* This was detached in ionic_stop_queues_reconfig() */ /* This was detached in ionic_stop_queues_reconfig() */
netif_device_attach(lif->netdev); netif_device_attach(lif->netdev);
}
errout:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment