Commit e7a23775 authored by Krzysztof Sprzaczkowski's avatar Krzysztof Sprzaczkowski Committed by Tomasz Zawadzki
Browse files

idxd: Fixed minor issues in comments



Formatted function descriptions, added missing dots
at the end of sentences, removed some unnecessary comments.

Change-Id: Idb1073a9f403b41be3e4bc817acd968e49bdaf82
Signed-off-by: default avatarKrzysztof Sprzaczkowski <krzysztof.sprzaczkowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22928


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent d8bf4182
Loading
Loading
Loading
Loading
+57 −57
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ struct spdk_idxd_io_channel;
struct spdk_idxd_device;

/**
 * Get the socket that this device is on
 * Get the socket that this device is on.
 *
 * \param idxd device to query
 * \return socket number.
@@ -94,7 +94,7 @@ typedef bool (*spdk_idxd_probe_cb)(void *cb_ctx, struct spdk_pci_device *dev);
 * \param cb_ctx Opaque value which will be passed back in cb_ctx parameter of
 *               the callbacks.
 * \param probe_cb callback to determine if the device being probe should be attached.
 * \param attach_cb will be called for devices for which probe_cb returned true
 * \param attach_cb will be called for devices for which probe_cb returned true.
 *                  once the IDXD controller has been attached to the userspace driver.
 *
 * \return 0 on success, -1 on failure.
@@ -125,10 +125,10 @@ int spdk_idxd_set_config(bool kernel_mode);
 * by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param diov Destination iovec
 * \param diovcnt Number of elements in diov
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param diov Destination iovec.
 * \param diovcnt Number of elements in diov.
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
 * \param cb_arg Opaque value which will be passed back as the arg parameter in
@@ -170,10 +170,10 @@ int spdk_idxd_submit_dualcast(struct spdk_idxd_io_channel *chan,
 * by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param siov1 First source iovec
 * \param siov1cnt Number of elements in siov1
 * \param siov2 Second source iovec
 * \param siov2cnt Number of elements in siov2
 * \param siov1 First source iovec.
 * \param siov1cnt Number of elements in siov1.
 * \param siov2 Second source iovec.
 * \param siov2cnt Number of elements in siov2.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
 * \param cb_arg Opaque value which will be passed back as the arg parameter in
@@ -193,8 +193,8 @@ int spdk_idxd_submit_compare(struct spdk_idxd_io_channel *chan,
 * by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param diov Destination iovec
 * \param diovcnt Number of elements in diov
 * \param diov Destination iovec.
 * \param diovcnt Number of elements in diov.
 * \param fill_pattern Repeating eight-byte pattern to use for memory fill.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
@@ -214,8 +214,8 @@ int spdk_idxd_submit_fill(struct spdk_idxd_io_channel *chan,
 * by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param seed Four byte CRC-32C seed value.
 * \param crc_dst Resulting calculation.
 * \param flags Flags, optional flags that can vary per operation.
@@ -237,10 +237,10 @@ int spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan,
 * submit by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param diov Destination iovec
 * \param diovcnt Number of elements in diov
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param diov Destination iovec.
 * \param diovcnt Number of elements in diov.
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param seed Four byte CRC-32C seed value.
 * \param crc_dst Resulting calculation.
 * \param flags Flags, optional flags that can vary per operation.
@@ -265,9 +265,9 @@ int spdk_idxd_submit_copy_crc32c(struct spdk_idxd_io_channel *chan,
 * \param chan IDXD channel to submit request.
 * \param dst Destination to write the compressed data to.
 * \param nbytes Length in bytes. The dst buffer should be large enough to hold the compressed data.
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param output_size The size of the compressed data
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param output_size The size of the compressed data.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
 * \param cb_arg Opaque value which will be passed back as the arg parameter in
@@ -289,8 +289,8 @@ int spdk_idxd_submit_compress(struct spdk_idxd_io_channel *chan,
 * \param chan IDXD channel to submit request.
 * \param diov Destination iovec. diov with diovcnt must be large enough to hold decompressed data.
 * \param diovcnt Number of elements in diov for decompress buffer.
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
 * \param cb_arg Opaque value which will be passed back as the arg parameter in
@@ -304,17 +304,17 @@ int spdk_idxd_submit_decompress(struct spdk_idxd_io_channel *chan,
				int flags, spdk_idxd_req_cb cb_fn, void *cb_arg);

/**
 * Build and submit a DIF check request
 * Build and submit a DIF check request.
 *
 * This function will build the DIF check descriptor and then immediately submit
 * by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param num_blocks Total number of blocks to process
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param num_blocks Total number of blocks to process.
 * \param ctx DIF context. Contains the DIF configuration values, including the reference
 *            Application Tag value and initial value of the Reference Tag to check
 *            Application Tag value and initial value of the Reference Tag to check.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
 * \param cb_arg Opaque value which will be passed back as the cb_arg parameter
@@ -328,19 +328,19 @@ int spdk_idxd_submit_dif_check(struct spdk_idxd_io_channel *chan,
			       spdk_idxd_req_cb cb_fn, void *cb_arg);

/**
 * Build and submit a DIF insert request
 * Build and submit a DIF insert request.
 *
 * This function will build the DIF insert descriptor and then immediately submit
 * by writing to the proper device portal.
 *
 * \param chan IDXD channel to submit request.
 * \param diov Destination iovec
 * \param diovcnt Number of elements in diov
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param num_blocks Total number of blocks to process
 * \param diov Destination iovec.
 * \param diovcnt Number of elements in diov.
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param num_blocks Total number of blocks to process.
 * \param ctx DIF context. Contains the DIF configuration values, including the reference
 *            Application Tag value and initial value of the Reference Tag to insert
 *            Application Tag value and initial value of the Reference Tag to insert.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
 * \param cb_arg Opaque value which will be passed back as the cb_arg parameter
@@ -355,7 +355,7 @@ int spdk_idxd_submit_dif_insert(struct spdk_idxd_io_channel *chan,
				spdk_idxd_req_cb cb_fn, void *cb_arg);

/**
 * Build and submit a DIF strip request
 * Build and submit a DIF strip request.
 *
 * This function will build the DIF strip descriptor and then immediately submit
 * by writing to the proper device portal. The transfer size must be a multiple
@@ -369,13 +369,13 @@ int spdk_idxd_submit_dif_insert(struct spdk_idxd_io_channel *chan,
 * excluding metadata size.
 *
 * \param chan IDXD channel to submit request.
 * \param diov Destination iovec
 * \param diovcnt Number of elements in diov
 * \param siov Source iovec
 * \param siovcnt Number of elements in siov
 * \param num_blocks Total number of blocks to process
 * \param diov Destination iovec.
 * \param diovcnt Number of elements in diov.
 * \param siov Source iovec.
 * \param siovcnt Number of elements in siov.
 * \param num_blocks Total number of blocks to process.
 * \param ctx DIF context. Contains the DIF configuration values, including the reference
 *            Application Tag value and initial value of the Reference Tag
 *            Application Tag value and initial value of the Reference Tag.
 * \param flags Flags, optional flags that can vary per operation.
 * \param cb_fn Callback function which will be called when the request is complete.
 * \param cb_arg Opaque value which will be passed back as the cb_arg parameter
+0 −10
Original line number Diff line number Diff line
@@ -1434,7 +1434,6 @@ idxd_validate_dif_common_params(const struct spdk_dif_ctx *ctx)
static inline int
idxd_validate_dif_check_params(const struct spdk_dif_ctx *ctx)
{
	/* Validate common parameters */
	int rc = idxd_validate_dif_common_params(ctx);
	if (rc) {
		return rc;
@@ -1475,25 +1474,21 @@ spdk_idxd_submit_dif_check(struct spdk_idxd_io_channel *chan,
	assert(chan != NULL);
	assert(siov != NULL);

	/* Validate DIF check parameters */
	rc = idxd_validate_dif_check_params(ctx);
	if (rc) {
		return rc;
	}

	/* Get DIF flags */
	rc = idxd_get_dif_flags(ctx, &dif_flags);
	if (rc) {
		return rc;
	}

	/* Get source DIF flags */
	rc = idxd_get_source_dif_flags(ctx, &src_dif_flags);
	if (rc) {
		return rc;
	}

	/* Get AppTag Mask */
	rc = idxd_get_app_tag_mask(ctx, &app_tag_mask);
	if (rc) {
		return rc;
@@ -1558,7 +1553,6 @@ error:
static inline int
idxd_validate_dif_insert_params(const struct spdk_dif_ctx *ctx)
{
	/* Validate common parameters */
	int rc = idxd_validate_dif_common_params(ctx);
	if (rc) {
		return rc;
@@ -1663,19 +1657,16 @@ spdk_idxd_submit_dif_insert(struct spdk_idxd_io_channel *chan,
	assert(chan != NULL);
	assert(siov != NULL);

	/* Validate DIF parameters */
	rc = idxd_validate_dif_insert_params(ctx);
	if (rc) {
		return rc;
	}

	/* Validate DIF iovec parameters */
	rc = idxd_validate_dif_insert_iovecs(ctx, diov, diovcnt, siov, siovcnt);
	if (rc) {
		return rc;
	}

	/* Set DIF flags */
	rc = idxd_get_dif_flags(ctx, &dif_flags);
	if (rc) {
		return rc;
@@ -1696,7 +1687,6 @@ spdk_idxd_submit_dif_insert(struct spdk_idxd_io_channel *chan,
		 * be split (must be multiple of the block size). The destination memory
		 * size needs to be same as the source memory size + metadata size */

		/* Validate the memory buffer alignment */
		rc = idxd_validate_dif_insert_buf_align(ctx, src_seg_len, dst_seg_len);
		if (rc) {
			goto error;
+9 −9
Original line number Diff line number Diff line
@@ -20,8 +20,8 @@ test_idxd_validate_dif_common_params(void)
	dif_opts.size = SPDK_SIZEOF(&dif_opts, dif_pi_format);
	dif_opts.dif_pi_format = SPDK_DIF_PI_FORMAT_16;

	/* Check all supported combinations of the block size and metadata size */
	/* ## supported: block-size = 512, metadata = 8 */
	/* Check all supported combinations of the data block size and metadata size */
	/* ## supported: data-block-size = 512, metadata = 8 */
	rc = spdk_dif_ctx_init(&dif_ctx,
			       DATA_BLOCK_SIZE_512 + METADATA_SIZE_8,
			       METADATA_SIZE_8,
@@ -35,7 +35,7 @@ test_idxd_validate_dif_common_params(void)
	rc = idxd_validate_dif_common_params(&dif_ctx);
	CU_ASSERT(rc == 0);

	/* ## supported: block-size = 512, metadata = 16 */
	/* ## supported: data-block-size = 512, metadata = 16 */
	rc = spdk_dif_ctx_init(&dif_ctx,
			       DATA_BLOCK_SIZE_512 + METADATA_SIZE_16,
			       METADATA_SIZE_16,
@@ -49,7 +49,7 @@ test_idxd_validate_dif_common_params(void)
	rc = idxd_validate_dif_common_params(&dif_ctx);
	CU_ASSERT(rc == 0);

	/* ## supported: block-size = 4096, metadata = 8 */
	/* ## supported: data-block-size = 4096, metadata = 8 */
	rc = spdk_dif_ctx_init(&dif_ctx,
			       DATA_BLOCK_SIZE_4096 + METADATA_SIZE_8,
			       METADATA_SIZE_8,
@@ -63,7 +63,7 @@ test_idxd_validate_dif_common_params(void)
	rc = idxd_validate_dif_common_params(&dif_ctx);
	CU_ASSERT(rc == 0);

	/* ## supported: block-size = 4096, metadata = 16 */
	/* ## supported: data-block-size = 4096, metadata = 16 */
	rc = spdk_dif_ctx_init(&dif_ctx,
			       DATA_BLOCK_SIZE_4096 + METADATA_SIZE_16,
			       METADATA_SIZE_16,
@@ -153,7 +153,7 @@ test_idxd_validate_dif_common_params(void)
	CU_ASSERT(rc == -EINVAL);

	/* Check for supported DIF block sizes */
	/* ## not-supported: block_size (without metadata) != 512,520,4096,4104 */
	/* ## not-supported: data block_size != 512,520,4096,4104 */
	rc = spdk_dif_ctx_init(&dif_ctx,
			       DATA_BLOCK_SIZE_512 + 10,
			       METADATA_SIZE_8,
@@ -312,7 +312,7 @@ test_idxd_validate_dif_check_buf_align(void)
	rc = idxd_validate_dif_check_buf_align(&dif_ctx, 4 * (512 + 8));
	CU_ASSERT(rc == 0);

	/* The memory buffer length is not a multiple of block size with metadata */
	/* The memory buffer length is not a multiple of block size */
	rc = idxd_validate_dif_check_buf_align(&dif_ctx, 4 * (512 + 8) + 10);
	CU_ASSERT(rc == -EINVAL);
}
@@ -342,11 +342,11 @@ test_idxd_validate_dif_insert_buf_align(void)
	rc = idxd_validate_dif_insert_buf_align(&dif_ctx, 4 * 512, 4 * 520);
	CU_ASSERT(rc == 0);

	/* The memory source buffer length is not a multiple of block size without metadata */
	/* The memory source buffer length is not a multiple of data block size */
	rc = idxd_validate_dif_insert_buf_align(&dif_ctx, 4 * 512 + 10, 4 * 520);
	CU_ASSERT(rc == -EINVAL);

	/* The memory destination buffer length is not a multiple of block size with metadata */
	/* The memory destination buffer length is not a multiple of block size */
	rc = idxd_validate_dif_insert_buf_align(&dif_ctx, 4 * 512, 4 * 520 + 10);
	CU_ASSERT(rc == -EINVAL);