Commit 8999f448 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: move BB SGL adjustment into rdma.c



The RDMA read and write commands can determine the desired length based
on the nvmf_request length field.

Change-Id: I97b63289556e7de3c19c5a17ecbacbbbdfc10425
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 5248414d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -311,6 +311,9 @@ nvmf_post_rdma_read(struct spdk_nvmf_conn *conn,
	}
	conn->rdma.pending_rdma_read_count++;

	/* temporarily adjust SGE to only copy what the host is prepared to send. */
	rx_desc->bb_sgl.length = req->length;

	nvmf_ibv_send_wr_init(&wr, req, &rx_desc->bb_sgl, (uint64_t)tx_desc,
			      IBV_WR_RDMA_READ, IBV_SEND_SIGNALED);

@@ -336,6 +339,9 @@ nvmf_post_rdma_write(struct spdk_nvmf_conn *conn,
		return -1;
	}

	/* temporarily adjust SGE to only copy what the host is prepared to receive. */
	rx_desc->bb_sgl.length = req->length;

	nvmf_ibv_send_wr_init(&wr, req, &rx_desc->bb_sgl, (uint64_t)tx_desc,
			      IBV_WR_RDMA_WRITE, 0);

+0 −9
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ int
spdk_nvmf_request_complete(struct nvmf_request *req)
{
	struct nvme_qp_tx_desc *tx_desc = req->tx_desc;
	struct nvme_qp_rx_desc *rx_desc = req->rx_desc;
	struct spdk_nvme_cpl *response;
	int ret;

@@ -61,10 +60,6 @@ spdk_nvmf_request_complete(struct nvmf_request *req)
	if (response->status.sc == SPDK_NVME_SC_SUCCESS &&
	    req->xfer == SPDK_NVME_DATA_CONTROLLER_TO_HOST) {
		/* data to be copied to host via memory RDMA */

		/* temporarily adjust SGE to only copy what the host is prepared to receive. */
		rx_desc->bb_sgl.length = req->length;

		ret = nvmf_post_rdma_write(tx_desc->conn, tx_desc);
		if (ret) {
			SPDK_ERRLOG("Unable to post rdma write tx descriptor\n");
@@ -742,10 +737,6 @@ spdk_nvmf_request_prep_data(struct nvmf_request *req)
		if (xfer == SPDK_NVME_DATA_HOST_TO_CONTROLLER) {
			if (sgl->generic.type == SPDK_NVME_SGL_TYPE_KEYED_DATA_BLOCK) {
				SPDK_TRACELOG(SPDK_TRACE_RDMA, "Issuing RDMA Read to get host data\n");

				/* temporarily adjust SGE to only copy what the host is prepared to send. */
				rx_desc->bb_sgl.length = req->length;

				ret = nvmf_post_rdma_read(conn, tx_desc);
				if (ret) {
					SPDK_ERRLOG("Unable to post rdma read tx descriptor\n");