Commit f029b824 authored by Jacek Kalwas's avatar Jacek Kalwas Committed by Tomasz Zawadzki
Browse files

util: add SPDK_IOV_ONE macro



Having that spdk_iov_one fn is marked deprecated. The issue with that
function is that it enforce iovcnt type which might not be of type int
but u32 or u8 etc. Having that compiler would complain when using the
function with other types than int.

It is a pre-work for layout optmz of nvmf request (iovcnt change there
from int to u8).

Change-Id: Id1534f4d3f60d35c58c26e4f4cf0d605ae11398a
Signed-off-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21433


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 796c1391
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -19,6 +19,13 @@ The tags can be matched with the level 4 headers below.

## Deprecation Notices

### util

#### `spdk_iov_one`

The function is deprecated and will be removed in 24.05 release. Please use `SPDK_IOV_ONE`
macro instead.

### nvmf

#### `spdk_nvmf_qpair_disconnect`
+6 −0
Original line number Diff line number Diff line
@@ -187,6 +187,12 @@ spdk_iov_memset(struct iovec *iovs, int iovcnt, int c);
void
spdk_iov_one(struct iovec *iov, int *iovcnt, void *buf, size_t buflen);

#define SPDK_IOV_ONE(piov, piovcnt, buf, buflen) do {	\
	(piov)->iov_base = (buf);			\
	(piov)->iov_len = (buflen);			\
	*(piovcnt) = 1;					\
} while (0)

/**
 * Copy the data described by the source iovec to the destination iovec.
 *
+2 −2
Original line number Diff line number Diff line
@@ -3014,7 +3014,7 @@ vfio_user_property_access(struct nvmf_vfio_user_ctrlr *vu_ctrlr,
		req->req.cmd->prop_get_cmd.fctype = SPDK_NVMF_FABRIC_COMMAND_PROPERTY_GET;
	}
	req->req.length = count;
	spdk_iov_one(req->req.iov, &req->req.iovcnt, buf, req->req.length);
	SPDK_IOV_ONE(req->req.iov, &req->req.iovcnt, buf, req->req.length);

	spdk_nvmf_request_exec_fabrics(&req->req);

@@ -5235,7 +5235,7 @@ nvmf_vfio_user_poll_group_add(struct spdk_nvmf_transport_poll_group *group,
		return -ENOMEM;
	}

	spdk_iov_one(req->iov, &req->iovcnt, data, req->length);
	SPDK_IOV_ONE(req->iov, &req->iovcnt, data, req->length);

	data->cntlid = ctrlr->cntlid;
	snprintf(data->subnqn, sizeof(data->subnqn), "%s",
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 */

#include "spdk/util.h"
#include "spdk/log.h"

void
spdk_iov_memset(struct iovec *iovs, int iovcnt, int c)
@@ -18,9 +19,13 @@ spdk_iov_memset(struct iovec *iovs, int iovcnt, int c)
	}
}

SPDK_LOG_DEPRECATION_REGISTER(spdk_iov_one, "spdk_iov_one", "v24.05", 0);

void
spdk_iov_one(struct iovec *iov, int *iovcnt, void *buf, size_t buflen)
{
	SPDK_LOG_DEPRECATED(spdk_iov_one);

	iov->iov_base = buf;
	iov->iov_len = buflen;
	*iovcnt = 1;
+8 −8
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ test_get_log_page(void)
	req.cmd = &cmd;
	req.rsp = &rsp;
	req.length = sizeof(data);
	spdk_iov_one(req.iov, &req.iovcnt, &data, req.length);
	SPDK_IOV_ONE(req.iov, &req.iovcnt, &data, req.length);

	/* Get Log Page - all valid */
	memset(&cmd, 0, sizeof(cmd));
@@ -486,7 +486,7 @@ test_connect(void)
	req.qpair = &qpair;
	req.xfer = SPDK_NVME_DATA_HOST_TO_CONTROLLER;
	req.length = sizeof(connect_data);
	spdk_iov_one(req.iov, &req.iovcnt, &connect_data, req.length);
	SPDK_IOV_ONE(req.iov, &req.iovcnt, &connect_data, req.length);
	req.cmd = &cmd;
	req.rsp = &rsp;

@@ -914,7 +914,7 @@ test_get_ns_id_desc_list(void)
	req.rsp = &rsp;
	req.xfer = SPDK_NVME_DATA_CONTROLLER_TO_HOST;
	req.length = sizeof(buf);
	spdk_iov_one(req.iov, &req.iovcnt, &buf, req.length);
	SPDK_IOV_ONE(req.iov, &req.iovcnt, &buf, req.length);

	memset(&cmd, 0, sizeof(cmd));
	cmd.nvme_cmd.opc = SPDK_NVME_OPC_IDENTIFY;
@@ -1829,7 +1829,7 @@ test_custom_admin_cmd(void)
	req.rsp = &rsp;
	req.xfer = SPDK_NVME_DATA_CONTROLLER_TO_HOST;
	req.length = sizeof(buf);
	spdk_iov_one(req.iov, &req.iovcnt, &buf, req.length);
	SPDK_IOV_ONE(req.iov, &req.iovcnt, &buf, req.length);

	memset(&cmd, 0, sizeof(cmd));
	cmd.nvme_cmd.opc = 0xc1;
@@ -2332,7 +2332,7 @@ test_rae(void)
		req[i].cmd = &cmd[i];
		req[i].rsp = &rsp[i];
		req[i].length = sizeof(data);
		spdk_iov_one(req[i].iov, &req[i].iovcnt, &data, req[i].length);
		SPDK_IOV_ONE(req[i].iov, &req[i].iovcnt, &data, req[i].length);

		cmd[i].nvme_cmd.opc = SPDK_NVME_OPC_GET_LOG_PAGE;
		cmd[i].nvme_cmd.cdw10_bits.get_log_page.lid =
@@ -2432,7 +2432,7 @@ test_nvmf_ctrlr_create_destruct(void)
	req.qpair = &qpair;
	req.xfer = SPDK_NVME_DATA_HOST_TO_CONTROLLER;
	req.length = sizeof(connect_data);
	spdk_iov_one(req.iov, &req.iovcnt, &connect_data, req.length);
	SPDK_IOV_ONE(req.iov, &req.iovcnt, &connect_data, req.length);
	req.cmd = &cmd;
	req.rsp = &rsp;

@@ -2970,7 +2970,7 @@ test_nvmf_ctrlr_get_features_host_behavior_support(void)

	/* Wrong structure length */
	req.length = sizeof(struct spdk_nvme_host_behavior) - 1;
	spdk_iov_one(req.iov, &req.iovcnt, &behavior, req.length);
	SPDK_IOV_ONE(req.iov, &req.iovcnt, &behavior, req.length);

	rc = nvmf_ctrlr_get_features_host_behavior_support(&req);
	CU_ASSERT(rc == SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE);
@@ -2979,7 +2979,7 @@ test_nvmf_ctrlr_get_features_host_behavior_support(void)

	/* Get Features Host Behavior Support Success */
	req.length = sizeof(struct spdk_nvme_host_behavior);
	spdk_iov_one(req.iov, &req.iovcnt, &behavior, req.length);
	SPDK_IOV_ONE(req.iov, &req.iovcnt, &behavior, req.length);

	ctrlr.acre_enabled = true;
	behavior.acre = false;
Loading