Lines Matching refs:srq

84 	struct mlx5_core_srq *srq;  in mlx5_cmd_get_srq()  local
87 srq = xa_load(&table->array, srqn); in mlx5_cmd_get_srq()
88 if (srq) in mlx5_cmd_get_srq()
89 refcount_inc(&srq->common.refcount); in mlx5_cmd_get_srq()
92 return srq; in mlx5_cmd_get_srq()
114 static int create_srq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in create_srq_cmd() argument
157 srq->srqn = MLX5_GET(create_srq_out, create_out, srqn); in create_srq_cmd()
158 srq->uid = in->uid; in create_srq_cmd()
164 static int destroy_srq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq) in destroy_srq_cmd() argument
169 MLX5_SET(destroy_srq_in, in, srqn, srq->srqn); in destroy_srq_cmd()
170 MLX5_SET(destroy_srq_in, in, uid, srq->uid); in destroy_srq_cmd()
175 static int arm_srq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in arm_srq_cmd() argument
182 MLX5_SET(arm_rq_in, in, srq_number, srq->srqn); in arm_srq_cmd()
184 MLX5_SET(arm_rq_in, in, uid, srq->uid); in arm_srq_cmd()
189 static int query_srq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in query_srq_cmd() argument
202 MLX5_SET(query_srq_in, in, srqn, srq->srqn); in query_srq_cmd()
217 struct mlx5_core_srq *srq, in create_xrc_srq_cmd() argument
263 srq->srqn = MLX5_GET(create_xrc_srq_out, create_out, xrc_srqn); in create_xrc_srq_cmd()
264 srq->uid = in->uid; in create_xrc_srq_cmd()
271 struct mlx5_core_srq *srq) in destroy_xrc_srq_cmd() argument
276 MLX5_SET(destroy_xrc_srq_in, in, xrc_srqn, srq->srqn); in destroy_xrc_srq_cmd()
277 MLX5_SET(destroy_xrc_srq_in, in, uid, srq->uid); in destroy_xrc_srq_cmd()
282 static int arm_xrc_srq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in arm_xrc_srq_cmd() argument
290 MLX5_SET(arm_xrc_srq_in, in, xrc_srqn, srq->srqn); in arm_xrc_srq_cmd()
292 MLX5_SET(arm_xrc_srq_in, in, uid, srq->uid); in arm_xrc_srq_cmd()
298 struct mlx5_core_srq *srq, in query_xrc_srq_cmd() argument
311 MLX5_SET(query_xrc_srq_in, in, xrc_srqn, srq->srqn); in query_xrc_srq_cmd()
328 static int create_rmp_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in create_rmp_cmd() argument
376 srq->srqn = MLX5_GET(create_rmp_out, create_out, rmpn); in create_rmp_cmd()
377 srq->uid = in->uid; in create_rmp_cmd()
386 static int destroy_rmp_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq) in destroy_rmp_cmd() argument
391 MLX5_SET(destroy_rmp_in, in, rmpn, srq->srqn); in destroy_rmp_cmd()
392 MLX5_SET(destroy_rmp_in, in, uid, srq->uid); in destroy_rmp_cmd()
396 static int arm_rmp_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in arm_rmp_cmd() argument
423 MLX5_SET(modify_rmp_in, in, rmpn, srq->srqn); in arm_rmp_cmd()
424 MLX5_SET(modify_rmp_in, in, uid, srq->uid); in arm_rmp_cmd()
438 static int query_rmp_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in query_rmp_cmd() argument
459 MLX5_SET(query_rmp_in, rmp_in, rmpn, srq->srqn); in query_rmp_cmd()
475 static int create_xrq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in create_xrq_cmd() argument
528 srq->srqn = MLX5_GET(create_xrq_out, create_out, xrqn); in create_xrq_cmd()
529 srq->uid = in->uid; in create_xrq_cmd()
535 static int destroy_xrq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq) in destroy_xrq_cmd() argument
540 MLX5_SET(destroy_xrq_in, in, xrqn, srq->srqn); in destroy_xrq_cmd()
541 MLX5_SET(destroy_xrq_in, in, uid, srq->uid); in destroy_xrq_cmd()
547 struct mlx5_core_srq *srq, in arm_xrq_cmd() argument
554 MLX5_SET(arm_rq_in, in, srq_number, srq->srqn); in arm_xrq_cmd()
556 MLX5_SET(arm_rq_in, in, uid, srq->uid); in arm_xrq_cmd()
561 static int query_xrq_cmd(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in query_xrq_cmd() argument
575 MLX5_SET(query_xrq_in, in, xrqn, srq->srqn); in query_xrq_cmd()
600 static int create_srq_split(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in create_srq_split() argument
604 return create_srq_cmd(dev, srq, in); in create_srq_split()
605 switch (srq->common.res) { in create_srq_split()
607 return create_xrc_srq_cmd(dev, srq, in); in create_srq_split()
609 return create_xrq_cmd(dev, srq, in); in create_srq_split()
611 return create_rmp_cmd(dev, srq, in); in create_srq_split()
615 static int destroy_srq_split(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq) in destroy_srq_split() argument
618 return destroy_srq_cmd(dev, srq); in destroy_srq_split()
619 switch (srq->common.res) { in destroy_srq_split()
621 return destroy_xrc_srq_cmd(dev, srq); in destroy_srq_split()
623 return destroy_xrq_cmd(dev, srq); in destroy_srq_split()
625 return destroy_rmp_cmd(dev, srq); in destroy_srq_split()
629 int mlx5_cmd_create_srq(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in mlx5_cmd_create_srq() argument
637 srq->common.res = MLX5_RES_XSRQ; in mlx5_cmd_create_srq()
640 srq->common.res = MLX5_RES_XRQ; in mlx5_cmd_create_srq()
643 srq->common.res = MLX5_RES_SRQ; in mlx5_cmd_create_srq()
646 err = create_srq_split(dev, srq, in); in mlx5_cmd_create_srq()
650 refcount_set(&srq->common.refcount, 1); in mlx5_cmd_create_srq()
651 init_completion(&srq->common.free); in mlx5_cmd_create_srq()
653 err = xa_err(xa_store_irq(&table->array, srq->srqn, srq, GFP_KERNEL)); in mlx5_cmd_create_srq()
660 destroy_srq_split(dev, srq); in mlx5_cmd_create_srq()
665 int mlx5_cmd_destroy_srq(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq) in mlx5_cmd_destroy_srq() argument
672 tmp = xa_cmpxchg_irq(&table->array, srq->srqn, srq, XA_ZERO_ENTRY, 0); in mlx5_cmd_destroy_srq()
673 if (WARN_ON(tmp != srq)) in mlx5_cmd_destroy_srq()
676 err = destroy_srq_split(dev, srq); in mlx5_cmd_destroy_srq()
683 xa_cmpxchg_irq(&table->array, srq->srqn, XA_ZERO_ENTRY, srq, 0); in mlx5_cmd_destroy_srq()
686 xa_erase_irq(&table->array, srq->srqn); in mlx5_cmd_destroy_srq()
688 mlx5_core_res_put(&srq->common); in mlx5_cmd_destroy_srq()
689 wait_for_completion(&srq->common.free); in mlx5_cmd_destroy_srq()
693 int mlx5_cmd_query_srq(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in mlx5_cmd_query_srq() argument
697 return query_srq_cmd(dev, srq, out); in mlx5_cmd_query_srq()
698 switch (srq->common.res) { in mlx5_cmd_query_srq()
700 return query_xrc_srq_cmd(dev, srq, out); in mlx5_cmd_query_srq()
702 return query_xrq_cmd(dev, srq, out); in mlx5_cmd_query_srq()
704 return query_rmp_cmd(dev, srq, out); in mlx5_cmd_query_srq()
708 int mlx5_cmd_arm_srq(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, in mlx5_cmd_arm_srq() argument
712 return arm_srq_cmd(dev, srq, lwm, is_srq); in mlx5_cmd_arm_srq()
713 switch (srq->common.res) { in mlx5_cmd_arm_srq()
715 return arm_xrc_srq_cmd(dev, srq, lwm); in mlx5_cmd_arm_srq()
717 return arm_xrq_cmd(dev, srq, lwm); in mlx5_cmd_arm_srq()
719 return arm_rmp_cmd(dev, srq, lwm); in mlx5_cmd_arm_srq()
727 struct mlx5_core_srq *srq; in srq_event_notifier() local
741 srq = xa_load(&table->array, srqn); in srq_event_notifier()
742 if (srq) in srq_event_notifier()
743 refcount_inc(&srq->common.refcount); in srq_event_notifier()
746 if (!srq) in srq_event_notifier()
749 srq->event(srq, eqe->type); in srq_event_notifier()
751 mlx5_core_res_put(&srq->common); in srq_event_notifier()