Commit 21db5074 authored by Ira Gusinsky's avatar Ira Gusinsky Committed by David S. Miller

net/mlx5_core: Avoid usage command work entry after writing command doorbell

Avoid usage of command work entry in cmd_work_handler since it can be released
by mlx5_cmd_invoke before the work handler returns to running.
Signed-off-by: default avatarIra Gusinsky <irenag@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarEli Cohen <eli@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 05e4ecd1
...@@ -515,10 +515,11 @@ static void cmd_work_handler(struct work_struct *work) ...@@ -515,10 +515,11 @@ static void cmd_work_handler(struct work_struct *work)
ent->ts1 = ktime_get_ns(); ent->ts1 = ktime_get_ns();
/* ring doorbell after the descriptor is valid */ /* ring doorbell after the descriptor is valid */
mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx);
wmb(); wmb();
iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell);
mlx5_core_dbg(dev, "write 0x%x to command doorbell\n", 1 << ent->idx);
mmiowb(); mmiowb();
/* if not in polling don't use ent after this point */
if (cmd->mode == CMD_MODE_POLLING) { if (cmd->mode == CMD_MODE_POLLING) {
poll_timeout(ent); poll_timeout(ent);
/* make sure we read the descriptor after ownership is SW */ /* make sure we read the descriptor after ownership is SW */
......
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