From 8d48071a3ea9e4003f2d0d750c7d770079e5f4ac Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Tue, 15 Mar 2022 17:09:50 +0400 Subject: [PATCH] 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: Alexey Marchuk Change-Id: Icee9383364124888c2109894c959c06710d91250 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11968 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- include/spdk/reduce.h | 3 +++ module/bdev/compress/vbdev_compress.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/spdk/reduce.h b/include/spdk/reduce.h index f67c484fb..03c996294 100644 --- a/include/spdk/reduce.h +++ b/include/spdk/reduce.h @@ -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; }; /** diff --git a/module/bdev/compress/vbdev_compress.c b/module/bdev/compress/vbdev_compress.c index 2cf73445e..607fbd3d4 100644 --- a/module/bdev/compress/vbdev_compress.c +++ b/module/bdev/compress/vbdev_compress.c @@ -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);