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

Michael S. Tsirkin mst at dev.mellanox.co.il
Thu Jul 19 04:28:49 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>

---

This patch is in OFED 1.2, so I think we want it for 2.6.23 too.

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

-- 
MST



More information about the general mailing list