[ofw] bugfix to enter RC4

Leonid Keller leonid at mellanox.co.il
Wed May 14 06:55:00 PDT 2008


Hi Stan,
 
I've added to the branch the following fix in order to manage to get the
RC4 train. :)
 
Please, review.
 
The patch adds protection for the search of CQ while completion event.
It really protects radix_tree_lookup() from radix_tree_insert(), because
the latter changes the tree.
When they run simultaneously, radix_tree_lookup can miss a really
existing CQ.
 
 
Index: E:/svn.openib/gen1/branches/WOF1-1/hw/mlx4/kernel/bus/net/cq.c
===================================================================
--- E:/svn.openib/gen1/branches/WOF1-1/hw/mlx4/kernel/bus/net/cq.c
(revision 1155)
+++ E:/svn.openib/gen1/branches/WOF1-1/hw/mlx4/kernel/bus/net/cq.c
(revision 1167)
@@ -51,9 +51,12 @@
 void mlx4_cq_completion(struct mlx4_dev *dev, u32 cqn)
 {
  struct mlx4_cq *cq;
+ struct mlx4_cq_table *cq_table = &mlx4_priv(dev)->cq_table;
 
- cq = radix_tree_lookup(&mlx4_priv(dev)->cq_table.tree,
-          cqn & (dev->caps.num_cqs - 1));
+ spin_lock_dpc(&cq_table->lock);
+ cq = radix_tree_lookup(&cq_table->tree, cqn & (dev->caps.num_cqs -
1));
+ spin_unlock_dpc(&cq_table->lock);
+
  if (!cq) {
   mlx4_warn(dev, "Completion event for bogus CQ %08x\n", cqn);
   return;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080514/8f9c7e89/attachment.html>


More information about the ofw mailing list