Commit e431ba2e authored by Vincent Fu's avatar Vincent Fu Committed by Tomasz Zawadzki
Browse files

nvme/pcie: add disable_pcie_sgl_merge option



Currently SPDK always merges physically contiguous SGL elements for the
PCIe transport. Add an option to disable this. This is useful for
testing.

Change-Id: I2ba7949e8175681a846af6718372269439344243
Signed-off-by: default avatarVincent Fu <vincent.fu@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24194


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 89fd1730
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1662,8 +1662,15 @@ struct spdk_nvme_io_qpair_opts {
	 */
	bool async_mode;

	/* Hole at bytes 66-71. */
	uint8_t reserved66[6];
	/**
	 * This flag if set to true disables the merging of physically
	 * contiguous SGL elements. Default mode is set to false to allow
	 * merging of physically contiguous SGL elements.
	 */
	bool disable_pcie_sgl_merge;

	/* Hole at bytes 67-71. */
	uint8_t reserved67[5];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_io_qpair_opts) == 72, "Incorrect size");

+4 −2
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair,
	if (opts) {
		pqpair->sq_vaddr = opts->sq.vaddr;
		pqpair->cq_vaddr = opts->cq.vaddr;
		pqpair->flags.disable_pcie_sgl_merge = opts->disable_pcie_sgl_merge;
		sq_paddr = opts->sq.paddr;
		cq_paddr = opts->cq.paddr;
	}
@@ -1386,6 +1387,7 @@ nvme_pcie_qpair_build_hw_sgl_request(struct spdk_nvme_qpair *qpair, struct nvme_
	uint32_t remaining_transfer_len, remaining_user_sge_len, length;
	struct spdk_nvme_sgl_descriptor *sgl;
	uint32_t nseg = 0;
	struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);

	/*
	 * Build scattered payloads.
@@ -1464,8 +1466,8 @@ nvme_pcie_qpair_build_hw_sgl_request(struct spdk_nvme_qpair *qpair, struct nvme_
			remaining_user_sge_len -= length;
			virt_addr = (uint8_t *)virt_addr + length;

			if (nseg > 0 && phys_addr ==
			    (*(sgl - 1)).address + (*(sgl - 1)).unkeyed.length) {
			if (!pqpair->flags.disable_pcie_sgl_merge && nseg > 0 &&
			    phys_addr == (*(sgl - 1)).address + (*(sgl - 1)).unkeyed.length) {
				/* extend previous entry */
				(*(sgl - 1)).unkeyed.length += length;
				continue;
+3 −0
Original line number Diff line number Diff line
@@ -162,6 +162,9 @@ struct nvme_pcie_qpair {
		uint8_t has_shadow_doorbell	: 1;
		uint8_t has_pending_vtophys_failures : 1;
		uint8_t defer_destruction	: 1;

		/* Disable merging of physically contiguous SGL entries */
		uint8_t disable_pcie_sgl_merge	: 1;
	} flags;

	/*
+6 −0
Original line number Diff line number Diff line
@@ -149,6 +149,12 @@ function confirm_abi_deps() {
			label = Added opts.disable_command_passthru field
			name = spdk_nvmf_transport
			soname_regexp = ^libspdk_nvmf\\.so\\.18\\.*$
		[suppress_type]
			label = Added disable_pcie_sgl_merge field
			name = spdk_nvme_io_qpair_opts
			soname_regexp = ^libspdk_nvme\\.so\\.13\\.*$
			has_data_member_regexp = ^reserved66$
			has_data_member_inserted_between = {528, end}
	EOF

	for object in "$libdir"/libspdk_*.so; do