Lines Matching refs:dev
42 void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
44 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
49 srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1));
56 mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn);
66 static int mlx4_SW2HW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
69 return mlx4_cmd(dev, mailbox->dma, srq_num, 0,
74 static int mlx4_HW2SW_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
77 return mlx4_cmd_box(dev, 0, mailbox ? mailbox->dma : 0, srq_num,
82 static int mlx4_ARM_SRQ(struct mlx4_dev *dev, int srq_num, int limit_watermark)
84 return mlx4_cmd(dev, limit_watermark, srq_num, 0, MLX4_CMD_ARM_SRQ,
88 static int mlx4_QUERY_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox,
91 return mlx4_cmd_box(dev, 0, mailbox->dma, srq_num, 0, MLX4_CMD_QUERY_SRQ,
95 int __mlx4_srq_alloc_icm(struct mlx4_dev *dev, int *srqn)
97 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
105 err = mlx4_table_get(dev, &srq_table->table, *srqn);
109 err = mlx4_table_get(dev, &srq_table->cmpt_table, *srqn);
115 mlx4_table_put(dev, &srq_table->table, *srqn);
122 static int mlx4_srq_alloc_icm(struct mlx4_dev *dev, int *srqn)
127 if (mlx4_is_mfunc(dev)) {
128 err = mlx4_cmd_imm(dev, 0, &out_param, RES_SRQ,
137 return __mlx4_srq_alloc_icm(dev, srqn);
140 void __mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn)
142 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
144 mlx4_table_put(dev, &srq_table->cmpt_table, srqn);
145 mlx4_table_put(dev, &srq_table->table, srqn);
149 static void mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn)
153 if (mlx4_is_mfunc(dev)) {
155 if (mlx4_cmd(dev, in_param, RES_SRQ, RES_OP_RESERVE_AND_MAP,
158 mlx4_warn(dev, "Failed freeing cq:%d\n", srqn);
161 __mlx4_srq_free_icm(dev, srqn);
164 int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcd,
167 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
173 err = mlx4_srq_alloc_icm(dev, &srq->srqn);
183 mailbox = mlx4_alloc_cmd_mailbox(dev);
199 mtt_addr = mlx4_mtt_addr(dev, mtt);
205 err = mlx4_SW2HW_SRQ(dev, mailbox, srq->srqn);
206 mlx4_free_cmd_mailbox(dev, mailbox);
221 mlx4_srq_free_icm(dev, srq->srqn);
226 void mlx4_srq_free(struct mlx4_dev *dev, struct mlx4_srq *srq)
228 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
231 err = mlx4_HW2SW_SRQ(dev, NULL, srq->srqn);
233 mlx4_warn(dev, "HW2SW_SRQ failed (%d) for SRQN %06x\n", err, srq->srqn);
243 mlx4_srq_free_icm(dev, srq->srqn);
247 int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark)
249 return mlx4_ARM_SRQ(dev, srq->srqn, limit_watermark);
253 int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_watermark)
259 mailbox = mlx4_alloc_cmd_mailbox(dev);
265 err = mlx4_QUERY_SRQ(dev, mailbox, srq->srqn);
271 mlx4_free_cmd_mailbox(dev, mailbox);
276 int mlx4_init_srq_table(struct mlx4_dev *dev)
278 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
283 if (mlx4_is_slave(dev))
286 err = mlx4_bitmap_init(&srq_table->bitmap, dev->caps.num_srqs,
287 dev->caps.num_srqs - 1, dev->caps.reserved_srqs, 0);
294 void mlx4_cleanup_srq_table(struct mlx4_dev *dev)
296 if (mlx4_is_slave(dev))
298 mlx4_bitmap_cleanup(&mlx4_priv(dev)->srq_table.bitmap);
301 struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn)
303 struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
309 srqn & (dev->caps.num_srqs - 1));