Lines Matching refs:dev

43 void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)  in mlx4_srq_event()  argument
45 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; in mlx4_srq_event()
49 srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1)); in mlx4_srq_event()
54 mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn); in mlx4_srq_event()
64 static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, in mlx4_SW2HW_SRQ() argument
67 return mlx4_cmd(dev, mailbox->dma, srq_num, 0, in mlx4_SW2HW_SRQ()
72 static int mlx4_HW2SW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, in mlx4_HW2SW_SRQ() argument
75 return mlx4_cmd_box(dev, 0, mailbox ? mailbox->dma : 0, srq_num, in mlx4_HW2SW_SRQ()
80 static int mlx4_ARM_SRQ(struct mlx4_dev *dev, int srq_num, int limit_watermark) in mlx4_ARM_SRQ() argument
82 return mlx4_cmd(dev, limit_watermark, srq_num, 0, MLX4_CMD_ARM_SRQ, in mlx4_ARM_SRQ()
86 static int mlx4_QUERY_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, in mlx4_QUERY_SRQ() argument
89 return mlx4_cmd_box(dev, 0, mailbox->dma, srq_num, 0, MLX4_CMD_QUERY_SRQ, in mlx4_QUERY_SRQ()
93 int __mlx4_srq_alloc_icm(struct mlx4_dev *dev, int *srqn) in __mlx4_srq_alloc_icm() argument
95 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; in __mlx4_srq_alloc_icm()
103 err = mlx4_table_get(dev, &srq_table->table, *srqn); in __mlx4_srq_alloc_icm()
107 err = mlx4_table_get(dev, &srq_table->cmpt_table, *srqn); in __mlx4_srq_alloc_icm()
113 mlx4_table_put(dev, &srq_table->table, *srqn); in __mlx4_srq_alloc_icm()
120 static int mlx4_srq_alloc_icm(struct mlx4_dev *dev, int *srqn) in mlx4_srq_alloc_icm() argument
125 if (mlx4_is_mfunc(dev)) { in mlx4_srq_alloc_icm()
126 err = mlx4_cmd_imm(dev, 0, &out_param, RES_SRQ, in mlx4_srq_alloc_icm()
135 return __mlx4_srq_alloc_icm(dev, srqn); in mlx4_srq_alloc_icm()
138 void __mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn) in __mlx4_srq_free_icm() argument
140 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; in __mlx4_srq_free_icm()
142 mlx4_table_put(dev, &srq_table->cmpt_table, srqn); in __mlx4_srq_free_icm()
143 mlx4_table_put(dev, &srq_table->table, srqn); in __mlx4_srq_free_icm()
147 static void mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn) in mlx4_srq_free_icm() argument
151 if (mlx4_is_mfunc(dev)) { in mlx4_srq_free_icm()
153 if (mlx4_cmd(dev, in_param, RES_SRQ, RES_OP_RESERVE_AND_MAP, in mlx4_srq_free_icm()
156 mlx4_warn(dev, "Failed freeing cq:%d\n", srqn); in mlx4_srq_free_icm()
159 __mlx4_srq_free_icm(dev, srqn); in mlx4_srq_free_icm()
162 int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcd, in mlx4_srq_alloc() argument
165 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; in mlx4_srq_alloc()
171 err = mlx4_srq_alloc_icm(dev, &srq->srqn); in mlx4_srq_alloc()
181 mailbox = mlx4_alloc_cmd_mailbox(dev); in mlx4_srq_alloc()
195 mtt_addr = mlx4_mtt_addr(dev, mtt); in mlx4_srq_alloc()
201 err = mlx4_SW2HW_SRQ(dev, mailbox, srq->srqn); in mlx4_srq_alloc()
202 mlx4_free_cmd_mailbox(dev, mailbox); in mlx4_srq_alloc()
217 mlx4_srq_free_icm(dev, srq->srqn); in mlx4_srq_alloc()
222 void mlx4_srq_free(struct mlx4_dev *dev, struct mlx4_srq *srq) in mlx4_srq_free() argument
224 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; in mlx4_srq_free()
227 err = mlx4_HW2SW_SRQ(dev, NULL, srq->srqn); in mlx4_srq_free()
229 mlx4_warn(dev, "HW2SW_SRQ failed (%d) for SRQN %06x\n", err, srq->srqn); in mlx4_srq_free()
239 mlx4_srq_free_icm(dev, srq->srqn); in mlx4_srq_free()
243 int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark) in mlx4_srq_arm() argument
245 return mlx4_ARM_SRQ(dev, srq->srqn, limit_watermark); in mlx4_srq_arm()
249 int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_watermark) in mlx4_srq_query() argument
255 mailbox = mlx4_alloc_cmd_mailbox(dev); in mlx4_srq_query()
261 err = mlx4_QUERY_SRQ(dev, mailbox, srq->srqn); in mlx4_srq_query()
267 mlx4_free_cmd_mailbox(dev, mailbox); in mlx4_srq_query()
272 int mlx4_init_srq_table(struct mlx4_dev *dev) in mlx4_init_srq_table() argument
274 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; in mlx4_init_srq_table()
278 if (mlx4_is_slave(dev)) in mlx4_init_srq_table()
281 return mlx4_bitmap_init(&srq_table->bitmap, dev->caps.num_srqs, in mlx4_init_srq_table()
282 dev->caps.num_srqs - 1, dev->caps.reserved_srqs, 0); in mlx4_init_srq_table()
285 void mlx4_cleanup_srq_table(struct mlx4_dev *dev) in mlx4_cleanup_srq_table() argument
287 if (mlx4_is_slave(dev)) in mlx4_cleanup_srq_table()
289 mlx4_bitmap_cleanup(&mlx4_priv(dev)->srq_table.bitmap); in mlx4_cleanup_srq_table()
292 struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn) in mlx4_srq_lookup() argument
294 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; in mlx4_srq_lookup()
299 srqn & (dev->caps.num_srqs - 1)); in mlx4_srq_lookup()