]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/ethernet/mellanox/mlx4/cmd.c
drivers: Remove explicit invocations of mmiowb()
[linux.git] / drivers / net / ethernet / mellanox / mlx4 / cmd.c
index c19e74e6ac94d9b5d647d38284050af2b2e4bef0..c678344d22a2cd0a924a77701b54da70b5e0f682 100644 (file)
@@ -281,7 +281,6 @@ static int mlx4_comm_cmd_post(struct mlx4_dev *dev, u8 cmd, u16 param)
        val = param | (cmd << 16) | (priv->cmd.comm_toggle << 31);
        __raw_writel((__force u32) cpu_to_be32(val),
                     &priv->mfunc.comm->slave_write);
-       mmiowb();
        mutex_unlock(&dev->persist->device_state_mutex);
        return 0;
 }
@@ -496,12 +495,6 @@ static int mlx4_cmd_post(struct mlx4_dev *dev, u64 in_param, u64 out_param,
                                               (op_modifier << HCR_OPMOD_SHIFT) |
                                               op), hcr + 6);
 
-       /*
-        * Make sure that our HCR writes don't get mixed in with
-        * writes from another CPU starting a FW command.
-        */
-       mmiowb();
-
        cmd->toggle = cmd->toggle ^ 1;
 
        ret = 0;
@@ -2206,7 +2199,6 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
        }
        __raw_writel((__force u32) cpu_to_be32(reply),
                     &priv->mfunc.comm[slave].slave_read);
-       mmiowb();
 
        return;
 
@@ -2410,7 +2402,6 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
                                     &priv->mfunc.comm[i].slave_write);
                        __raw_writel((__force u32) 0,
                                     &priv->mfunc.comm[i].slave_read);
-                       mmiowb();
                        for (port = 1; port <= MLX4_MAX_PORTS; port++) {
                                struct mlx4_vport_state *admin_vport;
                                struct mlx4_vport_state *oper_vport;
@@ -2576,10 +2567,6 @@ void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev)
                slave_read |= (u32)COMM_CHAN_EVENT_INTERNAL_ERR;
                __raw_writel((__force u32)cpu_to_be32(slave_read),
                             &priv->mfunc.comm[slave].slave_read);
-               /* Make sure that our comm channel write doesn't
-                * get mixed in with writes from another CPU.
-                */
-               mmiowb();
        }
 }
 
@@ -2645,6 +2632,8 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
        if (!priv->cmd.context)
                return -ENOMEM;
 
+       if (mlx4_is_mfunc(dev))
+               mutex_lock(&priv->cmd.slave_cmd_mutex);
        down_write(&priv->cmd.switch_sem);
        for (i = 0; i < priv->cmd.max_cmds; ++i) {
                priv->cmd.context[i].token = i;
@@ -2670,6 +2659,8 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
        down(&priv->cmd.poll_sem);
        priv->cmd.use_events = 1;
        up_write(&priv->cmd.switch_sem);
+       if (mlx4_is_mfunc(dev))
+               mutex_unlock(&priv->cmd.slave_cmd_mutex);
 
        return err;
 }
@@ -2682,6 +2673,8 @@ void mlx4_cmd_use_polling(struct mlx4_dev *dev)
        struct mlx4_priv *priv = mlx4_priv(dev);
        int i;
 
+       if (mlx4_is_mfunc(dev))
+               mutex_lock(&priv->cmd.slave_cmd_mutex);
        down_write(&priv->cmd.switch_sem);
        priv->cmd.use_events = 0;
 
@@ -2689,9 +2682,12 @@ void mlx4_cmd_use_polling(struct mlx4_dev *dev)
                down(&priv->cmd.event_sem);
 
        kfree(priv->cmd.context);
+       priv->cmd.context = NULL;
 
        up(&priv->cmd.poll_sem);
        up_write(&priv->cmd.switch_sem);
+       if (mlx4_is_mfunc(dev))
+               mutex_unlock(&priv->cmd.slave_cmd_mutex);
 }
 
 struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)