[ofa-general] [PATCH] IB/mthca: change token on command timeout

Michael S. Tsirkin mst at dev.mellanox.co.il
Tue Mar 27 07:56:01 PDT 2007


Command token is currently only updated on command
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 *is* eventually completed.

Signed-off-by: Michael S. Tsirkin <mst at dev.mellanox.co.il>

---

Untested yet, but looks fine, doesn't it?

diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index 7131446..26c42a1 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -355,9 +355,6 @@ void mthca_cmd_event(struct mthca_dev *dev,
 	context->result    = 0;
 	context->status    = status;
 	context->out_param = out_param;
-
-	context->token += dev->cmd.token_mask + 1;
-
 	complete(&context->done);
 }
 
@@ -379,6 +376,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);
 

-- 
MST



More information about the general mailing list