Commit 8d48071a authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

reduce: Add a check that driver supports SGL



Some compress drivers may not support SGL for in or
out buffers. Extend spdk_reduce_backing_dev with two
flags that will be used by reduce library to correctly
build iovs

Signed-off-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Change-Id: Icee9383364124888c2109894c959c06710d91250
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11968


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 6d9822c1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
 *
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 *   Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or without
 *   modification, are permitted provided that the following conditions
@@ -131,6 +132,8 @@ struct spdk_reduce_backing_dev {

	uint64_t	blockcnt;
	uint32_t	blocklen;
	bool		sgl_in;
	bool		sgl_out;
};

/**
+10 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 *
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 *   Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *   Copyright (c) 2021, 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or without
 *   modification, are permitted provided that the following conditions
@@ -1467,6 +1467,15 @@ comp_bdev_ch_create_cb(void *io_device, void *ctx_buf)
	pthread_mutex_unlock(&comp_bdev->reduce_lock);

	if (comp_bdev->device_qp != NULL) {
		uint64_t comp_feature_flags =
			comp_bdev->device_qp->device->cdev_info.capabilities[RTE_COMP_ALGO_DEFLATE].comp_feature_flags;

		if (comp_feature_flags & (RTE_COMP_FF_OOP_SGL_IN_SGL_OUT | RTE_COMP_FF_OOP_SGL_IN_LB_OUT)) {
			comp_bdev->backing_dev.sgl_in = true;
		}
		if (comp_feature_flags & (RTE_COMP_FF_OOP_SGL_IN_SGL_OUT | RTE_COMP_FF_OOP_LB_IN_SGL_OUT)) {
			comp_bdev->backing_dev.sgl_out = true;
		}
		return 0;
	} else {
		SPDK_ERRLOG("out of qpairs, cannot assign one to comp_bdev %p\n", comp_bdev);