Skip to content

Commit 9f55055

Browse files
shlomopongratzrolandd
authored andcommitted
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>
1 parent eec9e29 commit 9f55055

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx4
  • include/linux/mlx4

‎drivers/net/ethernet/mellanox/mlx4/srq.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,18 @@ void mlx4_cleanup_srq_table(struct mlx4_dev *dev)
298298
return;
299299
mlx4_bitmap_cleanup(&mlx4_priv(dev)->srq_table.bitmap);
300300
}
301+
302+
struct 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+
}
315+
EXPORT_SYMBOL_GPL(mlx4_srq_lookup);

‎include/linux/mlx4/srq.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ struct mlx4_wqe_srq_next_seg {
3939
u32 reserved2[3];
4040
};
4141

42+
struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn);
43+
4244
#endif /* MLX4_SRQ_H */

0 commit comments

Comments
 (0)