drivers/infiniband/sw/rxe/rxe_srq.c

Source file repositories/reference/linux-study-clean/drivers/infiniband/sw/rxe/rxe_srq.c

File Facts

System
Linux kernel
Corpus path
drivers/infiniband/sw/rxe/rxe_srq.c
Extension
.c
Size
4457 bytes
Lines
195
Domain
Driver Families
Bucket
drivers/infiniband
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

sizeof(uresp->srq_num))) {
			rxe_queue_cleanup(q);
			return -EFAULT;
		}
	}

	srq->rq.queue = q;
	init->attr.max_wr = srq->rq.max_wr;

	return 0;

err_free:
	vfree(q->buf);
	kfree(q);
err_out:
	return err;
}

int rxe_srq_chk_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
		     struct ib_srq_attr *attr, enum ib_srq_attr_mask mask)
{
	if (srq->error) {
		rxe_dbg_srq(srq, "in error state\n");
		goto err1;
	}

	if (mask & IB_SRQ_MAX_WR) {
		if (attr->max_wr > rxe->attr.max_srq_wr) {
			rxe_dbg_srq(srq, "max_wr(%d) > max_srq_wr(%d)\n",
				attr->max_wr, rxe->attr.max_srq_wr);
			goto err1;
		}

		if (attr->max_wr <= 0) {
			rxe_dbg_srq(srq, "max_wr(%d) <= 0\n", attr->max_wr);
			goto err1;
		}

		if (srq->limit && (attr->max_wr < srq->limit)) {
			rxe_dbg_srq(srq, "max_wr (%d) < srq->limit (%d)\n",
				attr->max_wr, srq->limit);
			goto err1;
		}

		if (attr->max_wr < RXE_MIN_SRQ_WR)
			attr->max_wr = RXE_MIN_SRQ_WR;
	}

	if (mask & IB_SRQ_LIMIT) {
		if (attr->srq_limit > rxe->attr.max_srq_wr) {
			rxe_dbg_srq(srq, "srq_limit(%d) > max_srq_wr(%d)\n",
				attr->srq_limit, rxe->attr.max_srq_wr);
			goto err1;
		}

		if (attr->srq_limit > srq->rq.queue->buf->index_mask) {
			rxe_dbg_srq(srq, "srq_limit (%d) > cur limit(%d)\n",
				attr->srq_limit,
				srq->rq.queue->buf->index_mask);
			goto err1;
		}
	}

	return 0;

err1:
	return -EINVAL;
}

int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
		      struct ib_srq_attr *attr, enum ib_srq_attr_mask mask,
		      struct rxe_modify_srq_cmd *ucmd, struct ib_udata *udata)
{
	struct rxe_queue *q = srq->rq.queue;
	struct mminfo __user *mi = NULL;
	int wqe_size;
	int err;

	if (mask & IB_SRQ_MAX_WR) {
		/*
		 * This is completely screwed up, the response is supposed to
		 * be in the outbuf not like this.
		 */
		mi = u64_to_user_ptr(ucmd->mmap_info_addr);

		wqe_size = sizeof(struct rxe_recv_wqe) +
				srq->rq.max_sge*sizeof(struct ib_sge);

		err = rxe_queue_resize(q, &attr->max_wr, wqe_size,
				       udata, mi, &srq->rq.producer_lock,

Annotation

Implementation Notes