IB/mthca: Change command token on timeout
authorMichael S. Tsirkin <mst@dev.mellanox.co.il>
Thu, 19 Jul 2007 11:28:49 +0000 (14:28 +0300)
committerRoland Dreier <rolandd@cisco.com>
Sat, 21 Jul 2007 04:19:43 +0000 (21:19 -0700)
The FW command token is currently only updated on a command completion
event. This means that on command timeout, the same token will be
reused for new command, which results in a mess if the timed out
command *does* eventually complete.

Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mthca/mthca_cmd.c

index f40558d7647539414e7350c24d1bfcf539f75263..acc95892713a02c9da6f479d519db43f4de49e16 100644 (file)
@@ -357,8 +357,6 @@ void mthca_cmd_event(struct mthca_dev *dev,
        context->status    = status;
        context->out_param = out_param;
 
-       context->token += dev->cmd.token_mask + 1;
-
        complete(&context->done);
 }
 
@@ -380,6 +378,7 @@ static int mthca_cmd_wait(struct mthca_dev *dev,
        spin_lock(&dev->cmd.context_lock);
        BUG_ON(dev->cmd.free_head < 0);
        context = &dev->cmd.context[dev->cmd.free_head];
+       context->token += dev->cmd.token_mask + 1;
        dev->cmd.free_head = context->next;
        spin_unlock(&dev->cmd.context_lock);