iscsi-scst: Detect at compile time whether or not max_recv_sge is available

Signed-off-by: Sergey Gorenko <sergeygo@mellanox.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8399 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-05-31 01:21:49 +00:00
parent 4486fd014e
commit 506aac2508
4 changed files with 20 additions and 2 deletions
+6
View File
@@ -273,6 +273,12 @@ conftest/query_device_attr_arg/result-$(KVER).txt: \
echo "$(call run_conftest,query_device_attr_arg, \
-DIB_QUERY_DEVICE_HAS_ATTR_ARG)" >"$@"
conftest/dev_attr_max_recv_sge/result-$(KVER).txt: \
conftest/dev_attr_max_recv_sge/dev_attr_max_recv_sge.c \
conftest/dev_attr_max_recv_sge/Makefile
echo "$(call run_conftest,dev_attr_max_recv_sge, \
-DHAVE_DEV_ATTR_MAX_RECV_SGE)" >"$@"
conftest/query_gid/result-$(KVER).txt: \
conftest/query_gid/query_gid.c \
conftest/query_gid/Makefile
@@ -0,0 +1,3 @@
LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE)
obj-m += dev_attr_max_recv_sge.o
@@ -0,0 +1,10 @@
#include <linux/module.h>
#include <linux/stddef.h>
#include <rdma/ib_verbs.h>
static int modinit(void)
{
return offsetof(struct ib_device_attr, max_recv_sge);
}
module_init(modinit);
+1 -2
View File
@@ -1295,8 +1295,7 @@ static struct isert_connection *isert_conn_create(struct rdma_cm_id *cm_id,
* In mem-free devices, RC QPs can be created with a maximum of
* (max_sge - 3) entries only.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8)
#ifndef HAVE_DEV_ATTR_MAX_RECV_SGE
isert_conn->max_sge = isert_dev->device_attr.max_sge - 3;
#else
isert_conn->max_sge = isert_dev->device_attr.max_recv_sge - 3;