aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/srq.c
diff options
context:
space:
mode:
authorShlomo Pongratz <shlomop@mellanox.com>2013-04-10 10:26:47 -0400
committerRoland Dreier <roland@purestorage.com>2013-04-17 01:42:55 -0400
commit9f550553a470d3b05fc8bdced3a738d8ed5b8d8a (patch)
tree8fd3f2332afb1827cc701192cca1153e63962185 /drivers/net/ethernet/mellanox/mlx4/srq.c
parenteec9e29fc5e9b417649830ab76a3aa10b90d2e9f (diff)
mlx4_core: Implement SRQ object lookup from srqn
Expose a new API mlx4_srq_lookup() to retrive a SRQ based on its number. This API is needed in the mlx4_ib driver CQ polling logic, when a work completion is associated with a XRC TGT QP. Since a target QP may redirect to more than one XRC SRQ, the srq field in the QP has no usage and the real XRC SRQ need to be retrived using the information from the XRCETH IB header which is placed in the HW CQE. Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/srq.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/srq.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
index e329fe1f11b7..79fd269e2c54 100644
--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
@@ -298,3 +298,18 @@ void mlx4_cleanup_srq_table(struct mlx4_dev *dev)
298 return; 298 return;
299 mlx4_bitmap_cleanup(&mlx4_priv(dev)->srq_table.bitmap); 299 mlx4_bitmap_cleanup(&mlx4_priv(dev)->srq_table.bitmap);
300} 300}
301
302struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn)
303{
304 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
305 struct mlx4_srq *srq;
306 unsigned long flags;
307
308 spin_lock_irqsave(&srq_table->lock, flags);
309 srq = radix_tree_lookup(&srq_table->tree,
310 srqn & (dev->caps.num_srqs - 1));
311 spin_unlock_irqrestore(&srq_table->lock, flags);
312
313 return srq;
314}
315EXPORT_SYMBOL_GPL(mlx4_srq_lookup);