Commit 30a5da5b authored by Jack Morgenstein's avatar Jack Morgenstein Committed by David S. Miller

net/mlx4_core: Fix HW2SW_EQ to conform to the firmware spec

The driver incorrectly assigned an out-mailbox to this command,
and used an opcode modifier = 0, which is a reserved value (it
should use opcode modifier = 1).
Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a031086
...@@ -1221,7 +1221,7 @@ static struct mlx4_cmd_info cmd_info[] = { ...@@ -1221,7 +1221,7 @@ static struct mlx4_cmd_info cmd_info[] = {
{ {
.opcode = MLX4_CMD_HW2SW_EQ, .opcode = MLX4_CMD_HW2SW_EQ,
.has_inbox = false, .has_inbox = false,
.has_outbox = true, .has_outbox = false,
.out_is_imm = false, .out_is_imm = false,
.encode_slave_id = true, .encode_slave_id = true,
.verify = NULL, .verify = NULL,
......
...@@ -868,12 +868,10 @@ static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, ...@@ -868,12 +868,10 @@ static int mlx4_SW2HW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
MLX4_CMD_WRAPPED); MLX4_CMD_WRAPPED);
} }
static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, static int mlx4_HW2SW_EQ(struct mlx4_dev *dev, int eq_num)
int eq_num)
{ {
return mlx4_cmd_box(dev, 0, mailbox->dma, eq_num, return mlx4_cmd(dev, 0, eq_num, 1, MLX4_CMD_HW2SW_EQ,
0, MLX4_CMD_HW2SW_EQ, MLX4_CMD_TIME_CLASS_A, MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
MLX4_CMD_WRAPPED);
} }
static int mlx4_num_eq_uar(struct mlx4_dev *dev) static int mlx4_num_eq_uar(struct mlx4_dev *dev)
...@@ -1046,7 +1044,6 @@ static void mlx4_free_eq(struct mlx4_dev *dev, ...@@ -1046,7 +1044,6 @@ static void mlx4_free_eq(struct mlx4_dev *dev,
struct mlx4_eq *eq) struct mlx4_eq *eq)
{ {
struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_cmd_mailbox *mailbox;
int err; int err;
int i; int i;
/* CX3 is capable of extending the CQE/EQE from 32 to 64 bytes, with /* CX3 is capable of extending the CQE/EQE from 32 to 64 bytes, with
...@@ -1054,24 +1051,10 @@ static void mlx4_free_eq(struct mlx4_dev *dev, ...@@ -1054,24 +1051,10 @@ static void mlx4_free_eq(struct mlx4_dev *dev,
*/ */
int npages = PAGE_ALIGN(dev->caps.eqe_size * eq->nent) / PAGE_SIZE; int npages = PAGE_ALIGN(dev->caps.eqe_size * eq->nent) / PAGE_SIZE;
mailbox = mlx4_alloc_cmd_mailbox(dev); err = mlx4_HW2SW_EQ(dev, eq->eqn);
if (IS_ERR(mailbox))
return;
err = mlx4_HW2SW_EQ(dev, mailbox, eq->eqn);
if (err) if (err)
mlx4_warn(dev, "HW2SW_EQ failed (%d)\n", err); mlx4_warn(dev, "HW2SW_EQ failed (%d)\n", err);
if (0) {
mlx4_dbg(dev, "Dumping EQ context %02x:\n", eq->eqn);
for (i = 0; i < sizeof (struct mlx4_eq_context) / 4; ++i) {
if (i % 4 == 0)
pr_cont("[%02x] ", i * 4);
pr_cont(" %08x", be32_to_cpup(mailbox->buf + i * 4));
if ((i + 1) % 4 == 0)
pr_cont("\n");
}
}
synchronize_irq(eq->irq); synchronize_irq(eq->irq);
tasklet_disable(&eq->tasklet_ctx.task); tasklet_disable(&eq->tasklet_ctx.task);
...@@ -1083,7 +1066,6 @@ static void mlx4_free_eq(struct mlx4_dev *dev, ...@@ -1083,7 +1066,6 @@ static void mlx4_free_eq(struct mlx4_dev *dev,
kfree(eq->page_list); kfree(eq->page_list);
mlx4_bitmap_free(&priv->eq_table.bitmap, eq->eqn, MLX4_USE_RR); mlx4_bitmap_free(&priv->eq_table.bitmap, eq->eqn, MLX4_USE_RR);
mlx4_free_cmd_mailbox(dev, mailbox);
} }
static void mlx4_free_irqs(struct mlx4_dev *dev) static void mlx4_free_irqs(struct mlx4_dev *dev)
......
...@@ -4677,7 +4677,6 @@ static void rem_slave_eqs(struct mlx4_dev *dev, int slave) ...@@ -4677,7 +4677,6 @@ static void rem_slave_eqs(struct mlx4_dev *dev, int slave)
int state; int state;
LIST_HEAD(tlist); LIST_HEAD(tlist);
int eqn; int eqn;
struct mlx4_cmd_mailbox *mailbox;
err = move_all_busy(dev, slave, RES_EQ); err = move_all_busy(dev, slave, RES_EQ);
if (err) if (err)
...@@ -4703,20 +4702,13 @@ static void rem_slave_eqs(struct mlx4_dev *dev, int slave) ...@@ -4703,20 +4702,13 @@ static void rem_slave_eqs(struct mlx4_dev *dev, int slave)
break; break;
case RES_EQ_HW: case RES_EQ_HW:
mailbox = mlx4_alloc_cmd_mailbox(dev); err = mlx4_cmd(dev, slave, eqn & 0xff,
if (IS_ERR(mailbox)) { 1, MLX4_CMD_HW2SW_EQ,
cond_resched();
continue;
}
err = mlx4_cmd_box(dev, slave, 0,
eqn & 0xff, 0,
MLX4_CMD_HW2SW_EQ,
MLX4_CMD_TIME_CLASS_A, MLX4_CMD_TIME_CLASS_A,
MLX4_CMD_NATIVE); MLX4_CMD_NATIVE);
if (err) if (err)
mlx4_dbg(dev, "rem_slave_eqs: failed to move slave %d eqs %d to SW ownership\n", mlx4_dbg(dev, "rem_slave_eqs: failed to move slave %d eqs %d to SW ownership\n",
slave, eqn); slave, eqn);
mlx4_free_cmd_mailbox(dev, mailbox);
atomic_dec(&eq->mtt->ref_count); atomic_dec(&eq->mtt->ref_count);
state = RES_EQ_RESERVED; state = RES_EQ_RESERVED;
break; break;
......
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