37 #include <linux/export.h>
48 spin_lock(&srq_table->
lock);
54 spin_unlock(&srq_table->
lock);
57 mlx4_warn(dev,
"Async event for bogus SRQ %08x\n", srqn);
61 srq->
event(srq, event_type);
78 return mlx4_cmd_box(dev, 0, mailbox ? mailbox->
dma : 0, srq_num,
83 static int mlx4_ARM_SRQ(
struct mlx4_dev *
dev,
int srq_num,
int limit_watermark)
128 if (mlx4_is_mfunc(dev)) {
129 err = mlx4_cmd_imm(dev, 0, &out_param,
RES_SRQ,
134 *srqn = get_param_l(&out_param);
150 static void mlx4_srq_free_icm(
struct mlx4_dev *dev,
int srqn)
154 if (mlx4_is_mfunc(dev)) {
155 set_param_l(&in_param, srqn);
159 mlx4_warn(dev,
"Failed freeing cq:%d\n", srqn);
174 err = mlx4_srq_alloc_icm(dev, &srq->
srqn);
178 spin_lock_irq(&srq_table->
lock);
180 spin_unlock_irq(&srq_table->
lock);
185 if (IS_ERR(mailbox)) {
186 err = PTR_ERR(mailbox);
190 srq_context = mailbox->
buf;
191 memset(srq_context, 0,
sizeof *srq_context);
206 err = mlx4_SW2HW_SRQ(dev, mailbox, srq->
srqn);
212 init_completion(&srq->
free);
217 spin_lock_irq(&srq_table->
lock);
219 spin_unlock_irq(&srq_table->
lock);
222 mlx4_srq_free_icm(dev, srq->
srqn);
232 err = mlx4_HW2SW_SRQ(dev,
NULL, srq->
srqn);
234 mlx4_warn(dev,
"HW2SW_SRQ failed (%d) for SRQN %06x\n", err, srq->
srqn);
236 spin_lock_irq(&srq_table->
lock);
238 spin_unlock_irq(&srq_table->
lock);
244 mlx4_srq_free_icm(dev, srq->
srqn);
250 return mlx4_ARM_SRQ(dev, srq->
srqn, limit_watermark);
262 return PTR_ERR(mailbox);
264 srq_context = mailbox->
buf;
266 err = mlx4_QUERY_SRQ(dev, mailbox, srq->
srqn);
284 if (mlx4_is_slave(dev))
288 dev->
caps.num_srqs - 1, dev->
caps.reserved_srqs, 0);
297 if (mlx4_is_slave(dev))