Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291619
b: refs/heads/master
c: 58a3de0
h: refs/heads/master
i:
  291617: 2400a28
  291615: e96031c
v: v3
  • Loading branch information
Eugenia Emantayev authored and David S. Miller committed Mar 19, 2012
1 parent fe33211 commit 31e5fe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1c3ac4289a0e4d60cbd4787b4a91de4a0c785df1
refs/heads/master: 58a3de0592454c216c68427fa3c31a34823f5115
9 changes: 9 additions & 0 deletions trunk/drivers/net/ethernet/mellanox/mlx4/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ static int mlx4_comm_cmd_wait(struct mlx4_dev *dev, u8 op,
{
struct mlx4_cmd *cmd = &mlx4_priv(dev)->cmd;
struct mlx4_cmd_context *context;
unsigned long end;
int err = 0;

down(&cmd->event_sem);
Expand Down Expand Up @@ -268,6 +269,14 @@ static int mlx4_comm_cmd_wait(struct mlx4_dev *dev, u8 op,
}

out:
/* wait for comm channel ready
* this is necessary for prevention the race
* when switching between event to polling mode
*/
end = msecs_to_jiffies(timeout) + jiffies;
while (comm_pending(dev) && time_before(jiffies, end))
cond_resched();

spin_lock(&cmd->context_lock);
context->next = cmd->free_head;
cmd->free_head = context - cmd->context;
Expand Down

0 comments on commit 31e5fe7

Please sign in to comment.