Commit fc12d276 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

nvme: remove remaining __attribute__((packed))



These strucutres had the packed attribute to make sure their size
changed whenever a new field was added at the end for ABI compatibility.
However, all of them have a corresponding *_get_opts() function, which
will will out the new fields, even if the code using it was unaware of
them when it was compiled.  For the same reason, their size can be
obtained with a regular sizeof(), and not SPDK_SIZEOF().

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I658ce6619ed92015b6c61d8460abd192be368496
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18532


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent a74fcd0b
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -283,8 +283,8 @@ struct spdk_nvme_ctrlr_opts {
	 * Set the IP protocol type of service value for RDMA transport. Default is 0, which means that the TOS will not be set.
	 */
	uint8_t transport_tos;
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_ctrlr_opts) == 818, "Incorrect size");
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_ctrlr_opts) == 824, "Incorrect size");

/**
 * NVMe acceleration operation callback.
@@ -1597,7 +1597,7 @@ struct spdk_nvme_io_qpair_opts {

	/* Hole at bytes 66-71. */
	uint8_t reserved66[6];
} __attribute__((packed));
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_io_qpair_opts) == 72, "Incorrect size");

/**
@@ -4198,14 +4198,17 @@ struct spdk_nvme_transport_opts {
	 */
	uint32_t rdma_srq_size;

	/* Hole at bytes 4-7. */
	uint8_t reserved4[4];

	/**
	 * The size of spdk_nvme_transport_opts according to the caller of this library is used for ABI
	 * compatibility.  The library uses this field to know how many fields in this
	 * structure are valid. And the library will populate any remaining fields with default values.
	 */
	size_t opts_size;
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_transport_opts) == 12, "Incorrect size");
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_transport_opts) == 16, "Incorrect size");

/**
 * Get the current NVMe transport options.
+2 −2
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 10
SO_MINOR := 1
SO_VER := 11
SO_MINOR := 0

C_SRCS = nvme_ctrlr_cmd.c nvme_ctrlr.c nvme_fabric.c nvme_ns_cmd.c \
	nvme_ns.c nvme_pcie_common.c nvme_pcie.c nvme_qpair.c nvme.c \
+1 −1
Original line number Diff line number Diff line
@@ -821,7 +821,7 @@ spdk_nvme_transport_get_opts(struct spdk_nvme_transport_opts *opts, size_t opts_

	/* Do not remove this statement, you should always update this statement when you adding a new field,
	 * and do not forget to add the SET_FIELD statement for your added field. */
	SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_transport_opts) == 12, "Incorrect size");
	SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_transport_opts) == 16, "Incorrect size");

#undef SET_FIELD
}