net/mlx4_core: Fix mpt_entry initialization in mlx4_mr_rereg_mem_write()
[cascardo/linux.git] / drivers / net / ethernet / mellanox / mlx4 / resource_tracker.c
index 3e93879..486e3d2 100644 (file)
@@ -2541,7 +2541,7 @@ int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave,
        /* Make sure that the PD bits related to the slave id are zeros. */
        pd = mr_get_pd(inbox->buf);
        pd_slave = (pd >> 17) & 0x7f;
-       if (pd_slave != 0 && pd_slave != slave) {
+       if (pd_slave != 0 && --pd_slave != slave) {
                err = -EPERM;
                goto ex_abort;
        }
@@ -2944,6 +2944,9 @@ static int verify_qp_parameters(struct mlx4_dev *dev,
        qp_type = (be32_to_cpu(qp_ctx->flags) >> 16) & 0xff;
        optpar  = be32_to_cpu(*(__be32 *) inbox->buf);
 
+       if (slave != mlx4_master_func_num(dev))
+               qp_ctx->params2 &= ~MLX4_QP_BIT_FPP;
+
        switch (qp_type) {
        case MLX4_QP_ST_RC:
        case MLX4_QP_ST_XRC:
@@ -4677,7 +4680,6 @@ static void rem_slave_eqs(struct mlx4_dev *dev, int slave)
        int state;
        LIST_HEAD(tlist);
        int eqn;
-       struct mlx4_cmd_mailbox *mailbox;
 
        err = move_all_busy(dev, slave, RES_EQ);
        if (err)
@@ -4703,20 +4705,13 @@ static void rem_slave_eqs(struct mlx4_dev *dev, int slave)
                                        break;
 
                                case RES_EQ_HW:
-                                       mailbox = mlx4_alloc_cmd_mailbox(dev);
-                                       if (IS_ERR(mailbox)) {
-                                               cond_resched();
-                                               continue;
-                                       }
-                                       err = mlx4_cmd_box(dev, slave, 0,
-                                                          eqn & 0xff, 0,
-                                                          MLX4_CMD_HW2SW_EQ,
-                                                          MLX4_CMD_TIME_CLASS_A,
-                                                          MLX4_CMD_NATIVE);
+                                       err = mlx4_cmd(dev, slave, eqn & 0xff,
+                                                      1, MLX4_CMD_HW2SW_EQ,
+                                                      MLX4_CMD_TIME_CLASS_A,
+                                                      MLX4_CMD_NATIVE);
                                        if (err)
                                                mlx4_dbg(dev, "rem_slave_eqs: failed to move slave %d eqs %d to SW ownership\n",
                                                         slave, eqn);
-                                       mlx4_free_cmd_mailbox(dev, mailbox);
                                        atomic_dec(&eq->mtt->ref_count);
                                        state = RES_EQ_RESERVED;
                                        break;