]> err.no Git - linux-2.6/blobdiff - drivers/net/mlx4/cmd.c
Merge branches 'release', 'bugzilla-8570', 'bugzilla-9966', 'bugzilla-9998', 'bugzill...
[linux-2.6] / drivers / net / mlx4 / cmd.c
index c1f81a993f5da3ab5ff21fb06fed712f682dbad6..db49051b97b168b7a004e52c865bef94311ce56a 100644 (file)
@@ -95,7 +95,7 @@ enum {
 };
 
 enum {
-       GO_BIT_TIMEOUT          = 10000
+       GO_BIT_TIMEOUT_MSECS    = 10000
 };
 
 struct mlx4_cmd_context {
@@ -155,7 +155,7 @@ static int mlx4_cmd_post(struct mlx4_dev *dev, u64 in_param, u64 out_param,
 
        end = jiffies;
        if (event)
-               end += HZ * 10;
+               end += msecs_to_jiffies(GO_BIT_TIMEOUT_MSECS);
 
        while (cmd_pending(dev)) {
                if (time_after_eq(jiffies, end))
@@ -184,6 +184,13 @@ static int mlx4_cmd_post(struct mlx4_dev *dev, u64 in_param, u64 out_param,
                                               (event ? (1 << HCR_E_BIT) : 0)   |
                                               (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;
@@ -246,8 +253,6 @@ void mlx4_cmd_event(struct mlx4_dev *dev, u16 token, u8 status, u64 out_param)
        context->result    = mlx4_status_to_errno(status);
        context->out_param = out_param;
 
-       context->token += priv->cmd.token_mask + 1;
-
        complete(&context->done);
 }
 
@@ -264,6 +269,7 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
        spin_lock(&cmd->context_lock);
        BUG_ON(cmd->free_head < 0);
        context = &cmd->context[cmd->free_head];
+       context->token += cmd->token_mask + 1;
        cmd->free_head = context->next;
        spin_unlock(&cmd->context_lock);