Commit af3d2ae1 authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller
Browse files

ionic: add queue lock around open and stop



Add the queue configuration lock to ionic_open() and
ionic_stop() so that they don't collide with other in parallel
queue configuration actions such as MTU changes as can be
demonstrated with a tight loop of ifup/change-mtu/ifdown.

Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 92c90dff
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2233,9 +2233,11 @@ static int ionic_open(struct net_device *netdev)
	if (test_and_clear_bit(IONIC_LIF_F_BROKEN, lif->state))
		netdev_info(netdev, "clearing broken state\n");

	mutex_lock(&lif->queue_lock);

	err = ionic_txrx_alloc(lif);
	if (err)
		return err;
		goto err_unlock;

	err = ionic_txrx_init(lif);
	if (err)
@@ -2256,12 +2258,15 @@ static int ionic_open(struct net_device *netdev)
			goto err_txrx_deinit;
	}

	mutex_unlock(&lif->queue_lock);
	return 0;

err_txrx_deinit:
	ionic_txrx_deinit(lif);
err_txrx_free:
	ionic_txrx_free(lif);
err_unlock:
	mutex_unlock(&lif->queue_lock);
	return err;
}

@@ -2281,9 +2286,11 @@ static int ionic_stop(struct net_device *netdev)
	if (test_bit(IONIC_LIF_F_FW_RESET, lif->state))
		return 0;

	mutex_lock(&lif->queue_lock);
	ionic_stop_queues(lif);
	ionic_txrx_deinit(lif);
	ionic_txrx_free(lif);
	mutex_unlock(&lif->queue_lock);

	return 0;
}