Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bf9715f authored by Moni Shoua's avatar Moni Shoua Committed by Roland Dreier
Browse files

IB/mlx4: Avoid executing gid task when device is being removed



When device is being removed (e.g during VPI port link type change
from ETH to IB), tasks for gid table changes should not be executed.

Flush the current queue of tasks and block further tasks from entering the queue.

Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent dba3ad2a
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -1390,6 +1390,9 @@ static void update_gids_task(struct work_struct *work)
	int err;
	int err;
	struct mlx4_dev	*dev = gw->dev->dev;
	struct mlx4_dev	*dev = gw->dev->dev;


	if (!gw->dev->ib_active)
		return;

	mailbox = mlx4_alloc_cmd_mailbox(dev);
	mailbox = mlx4_alloc_cmd_mailbox(dev);
	if (IS_ERR(mailbox)) {
	if (IS_ERR(mailbox)) {
		pr_warn("update gid table failed %ld\n", PTR_ERR(mailbox));
		pr_warn("update gid table failed %ld\n", PTR_ERR(mailbox));
@@ -1420,6 +1423,9 @@ static void reset_gids_task(struct work_struct *work)
	int err;
	int err;
	struct mlx4_dev	*dev = gw->dev->dev;
	struct mlx4_dev	*dev = gw->dev->dev;


	if (!gw->dev->ib_active)
		return;

	mailbox = mlx4_alloc_cmd_mailbox(dev);
	mailbox = mlx4_alloc_cmd_mailbox(dev);
	if (IS_ERR(mailbox)) {
	if (IS_ERR(mailbox)) {
		pr_warn("reset gid table failed\n");
		pr_warn("reset gid table failed\n");
@@ -2369,6 +2375,9 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr)
	struct mlx4_ib_dev *ibdev = ibdev_ptr;
	struct mlx4_ib_dev *ibdev = ibdev_ptr;
	int p;
	int p;


	ibdev->ib_active = false;
	flush_workqueue(wq);

	mlx4_ib_close_sriov(ibdev);
	mlx4_ib_close_sriov(ibdev);
	mlx4_ib_mad_cleanup(ibdev);
	mlx4_ib_mad_cleanup(ibdev);
	ib_unregister_device(&ibdev->ib_dev);
	ib_unregister_device(&ibdev->ib_dev);