1 # SPDX-License-Identifier: GPL-2.0
4 # This file is part of Lustre, http://www.lustre.org/
9 # check if tunable tcp backoff is available/wanted
11 AC_DEFUN([LN_CONFIG_BACKOFF], [
12 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
13 AC_ARG_ENABLE([backoff],
14 AS_HELP_STRING([--disable-backoff],
15 [disable socknal tunable backoff]),
16 [], [enable_backoff="yes"])
17 AC_MSG_RESULT([$enable_backoff])
18 AS_IF([test "x$enable_backoff" = xyes], [
19 AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
20 AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
22 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
23 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
24 [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
25 [tunable backoff TCP in ms])])
30 AC_SUBST(ENABLE_BACKOFF, yes)
32 AC_SUBST(ENABLE_BACKOFF, no)
35 ]) # LN_CONFIG_BACKOFF
42 # fail to build if libyaml is not installed
44 AC_DEFUN([LN_CONFIG_DLC], [
45 AS_IF([test "x$enable_dist" = xno], [
46 AC_CHECK_LIB([yaml], [yaml_parser_initialize],
48 [AC_MSG_ERROR([YAML development libraries not not installed])],
56 # If current OFED installed (assume with "ofed_info") and devel
57 # headers are not found, error because we assume OFED infiniband
58 # driver needs to be used and we must configure/build with it.
59 # Current OFED headers detection mechanism allow for non-standard
60 # prefix but relies on "ofed_info" command and on "%prefix/openib"
61 # link (both are ok for 1.5.x and 3.x versions), and should work
62 # for both source and DKMS builds.
64 AC_DEFUN([LN_CONFIG_O2IB], [
65 AC_ARG_ENABLE([multiple-lnds],
66 [AS_HELP_STRING([--enable-multiple-lnds],
67 [enable multiple lnds to build in-kernel and external o2iblnd])],
68 [AS_IF([test x$enable_multiple_lnds != xyes -a x$enable_multiple_lnds != xno],
69 [AC_MSG_ERROR([multiple-lnds valid options are "yes" or "no"])])],
70 [enable_multiple_lnds="no"])
71 ENABLE_MULTIPLE_LNDS="$enable_multiple_lnds"
73 AC_MSG_CHECKING([if external o2iblnd needs to use Compat RDMA])
75 AS_HELP_STRING([--with-o2ib=[yes|no|<path>]],
76 [build o2iblnd against path]),
77 [], [with_o2ib="yes"])
80 yes) INT_O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
81 BUILT_IN_KO2IBLND="yes"
82 # Use ofed_info to find external driver
83 AS_IF([which ofed_info 2>/dev/null], [
84 AS_IF([test x$uses_dpkg = xyes], [
85 LIST_ALL_PKG="dpkg -l | awk '{print \[$]2}'"
86 LSPKG="dpkg --listfiles"
88 LIST_ALL_PKG="rpm -qa"
92 O2IBPKG="mlnx-ofed-kernel-dkms"
93 O2IBPKG+="|mlnx-ofed-kernel-modules"
94 O2IBPKG+="|mlnx-ofa_kernel-devel"
95 O2IBPKG+="|compat-rdma-devel"
96 O2IBPKG+="|kernel-ib-devel"
97 O2IBPKG+="|ofa_kernel-devel"
100 O2IBDIR+="|/ofa_kernel/default"
103 O2IBDIR_PATH=$(eval $LIST_ALL_PKG |
104 egrep -w "$O2IBPKG" | xargs $LSPKG |
105 egrep "${O2IBDIR}$" | head -n1)
107 if test -n "$O2IBDIR_PATH"; then
108 EXT_O2IBPATHS=$(find $O2IBDIR_PATH -name rdma_cm.h |
109 grep -F -e "$(uname -r)" -e default |
110 sed -e 's/\/include\/rdma\/rdma_cm.h//')
113 # When ofed-scripts are installed and either the devel
114 # package is missing or multiple devel packages are
115 # installed. Give the user a warning
116 # The in-kernel ofed stack can be built .. so we can
119 EXTERNAL_KO2IBLND="yes"
120 AS_IF([test -z "$EXT_O2IBPATHS"], [
121 EXTERNAL_KO2IBLND="no"
123 * You seem to have an OFED installed but have not installed the associated
125 * If you still want to build Lustre for your External OFED I/B stack,
126 * you need to install its devel headers RPM.
127 * Only the kernel built-in I/B stack support will be built.
130 AS_IF([test $(echo $EXT_O2IBPATHS | wc -w) -ge 2], [
131 BUILT_IN_KO2IBLND="no"
133 * It appears that you have multiple OFED versions installed.
134 * If you still want to build Lustre for your External OFED I/B stack, you
135 * need to install a single version with the associated devel package.
136 * Only the kernel built-in I/B stack support will be built.
139 if test x$EXTERNAL_KO2IBLND != "xno" ; then
140 if test -e $EXT_O2IBPATHS/${LINUXRELEASE}; then
141 EXT_O2IBPATHS=$EXT_O2IBPATHS/${LINUXRELEASE}
142 elif test -e $EXT_O2IBPATHS/default; then
143 EXT_O2IBPATHS=$EXT_O2IBPATHS/default
150 EXTERNAL_KO2IBLND="no"
151 BUILT_IN_KO2IBLND="no"
153 *) ENABLEO2IB="withpath"
154 EXT_O2IBPATHS=$with_o2ib
155 EXTERNAL_KO2IBLND="yes"
156 INT_O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
157 BUILT_IN_KO2IBLND="yes"
161 AS_IF([test $ENABLEO2IB = "no"], [
163 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
164 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
168 # Verify in-kernel O2IB can be built (headers exist) ... or disable it.
170 for INT_O2IBPATH in $INT_O2IBPATHS; do
171 AS_IF([test \( -f ${INT_O2IBPATH}/include/rdma/rdma_cm.h -a \
172 -f ${INT_O2IBPATH}/include/rdma/ib_cm.h -a \
173 -f ${INT_O2IBPATH}/include/rdma/ib_verbs.h \)], [
178 if ! $int_o2ib_found; then
179 AC_MSG_WARN([kernel does not support in-kernel o2ib, it will not be built])
180 BUILT_IN_KO2IBLND="no"
183 # Verify external O2IB can be built (headers exist), or abort
185 for EXT_O2IBPATH in $EXT_O2IBPATHS; do
186 AS_IF([test \( -f ${EXT_O2IBPATH}/include/rdma/rdma_cm.h -a \
187 -f ${EXT_O2IBPATH}/include/rdma/ib_cm.h -a \
188 -f ${EXT_O2IBPATH}/include/rdma/ib_verbs.h \)], [
193 if ! $ext_o2ib_found; then
194 case $EXT_ENABLEO2IB in
195 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
197 Auto detection of external O2IB failed. Build of external o2ib disabled.])
198 EXTERNAL_KO2IBLND="no"
203 if test "x$EXTERNAL_KO2IBLND" != no ; then
204 # Additional checks for external O2IB
206 compatrdma_found=false
207 if test -f ${EXT_O2IBPATH}/include/linux/compat-2.6.h; then
209 compatrdma_found=true
210 AC_DEFINE(HAVE_OFED_COMPAT_RDMA, 1, [compat rdma found])
211 EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${EXT_O2IBPATH}/include/linux/compat-2.6.h"
212 if test -f "$EXT_O2IBPATH/include/linux/compat_autoconf.h"; then
213 COMPAT_AUTOCONF="$EXT_O2IBPATH/include/linux/compat_autoconf.h"
218 if ! $compatrdma_found; then
219 if test -f "$EXT_O2IBPATH/config.mk"; then
220 . "$EXT_O2IBPATH/config.mk"
221 elif test -f "$EXT_O2IBPATH/ofed_patch.mk"; then
222 . "$EXT_O2IBPATH/ofed_patch.mk"
224 elif test -z "$COMPAT_AUTOCONF"; then
226 if test "x$RHEL_KERNEL" = xyes; then
227 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
228 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
229 while test "$I" -ge 0; do
230 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
233 elif test "x$SUSE_KERNEL" = xyes; then
234 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
235 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
239 AC_MSG_CHECKING([whether to use any OFED backport headers])
240 if test -n "$BACKPORT_INCLUDES"; then
242 OFED_BACKPORT_PATH="$EXT_O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
243 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
249 EXT_O2IBPATH=$(readlink --canonicalize $EXT_O2IBPATH)
250 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$EXT_O2IBPATH/include"
251 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$EXT_O2IBPATH/include/uapi"
252 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
253 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
254 openib_gen2_support, [
255 #ifdef HAVE_OFED_COMPAT_RDMA
257 #undef PACKAGE_TARNAME
258 #undef PACKAGE_VERSION
259 #undef PACKAGE_STRING
260 #undef PACKAGE_BUGREPORT
262 #include <linux/compat-2.6.h>
264 #include <linux/version.h>
265 #include <linux/pci.h>
266 #include <linux/gfp.h>
267 #include <rdma/rdma_cm.h>
268 #include <rdma/ib_cm.h>
269 #include <rdma/ib_verbs.h>
271 struct rdma_cm_id *cm_idi __attribute__ ((unused));
272 struct rdma_conn_param conn_param __attribute__ ((unused));
273 struct ib_device_attr device_attr __attribute__ ((unused));
274 struct ib_qp_attr qp_attr __attribute__ ((unused));
275 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
277 rdma_destroy_id(NULL);
279 EXT_O2IBLND="o2iblnd"
282 "yes") AC_MSG_ERROR([cannot compile with OpenIB gen2 headers]) ;;
283 "withpath") AC_MSG_ERROR([cannot compile with OpenIB gen2 headers under $EXT_O2IBPATH]) ;;
284 *) AC_MSG_ERROR([internal error]) ;;
287 # we know that the found external OFED source+headers are good
290 if test -f $EXT_O2IBPATH/Module.symvers ; then
291 CHECK_SYMBOLS=$EXT_O2IBPATH/Module.symvers
293 if test -n "$CHECK_SYMBOLS"; then
294 if test ! "$CHECK_SYMBOLS" -ef "$LINUX_OBJ/Module.symvers"; then
295 AC_MSG_NOTICE([adding $CHECK_SYMBOLS to external o2ib symbols])
296 EXT_O2IB_SYMBOLS="${CHECK_SYMBOLS}"
298 EXTERNAL_KO2IBLND="no"
300 elif test "x$EXTERNAL_KO2IBLND" != "xno" ; then
302 * Module.symvers for external o2iblnd was not found.
303 * Expected: $EXT_O2IBPATH/Module.symvers
304 * ko2iblnd.ko for external OFED will not be built.
306 EXTERNAL_KO2IBLND="no"
310 # we suspect that the found in-kernel OFED source+headers are good
311 # the above compile test *could* be repeated with in-kernel paths ...
314 if test -f $INT_O2IBPATH/Module.symvers; then
315 CHECK_SYMBOLS=$INT_O2IBPATH/Module.symvers
316 elif test "x$SUSE_KERNEL" = "xyes"; then
317 CHECK_SYMBOLS=$(find ${INT_O2IBPATH}* -name Module.symvers)
318 # Select only the current 'flavor' if there is more than 1
319 NUM_AVAIL=$(find ${INT_O2IBPATH}* -name Module.symvers | wc -l)
320 if test ${NUM_AVAIL} -gt 1; then
321 PREFER=$(basename ${LINUX_OBJ})
322 for F in $(find ${O2IBPATH}-obj -name Module.symvers)
324 maybe=$(echo $F | grep "/${PREFER}")
325 if test "x$maybe" != "x"; then
330 elif test -f $LINUX_OBJ/Module.symvers; then
331 # Debian symvers is in the arch tree
332 CHECK_SYMBOLS=$LINUX_OBJ/Module.symvers
335 if test -n "$CHECK_SYMBOLS"; then
336 if test ! "$CHECK_SYMBOLS" -ef "$LINUX_OBJ/Module.symvers"; then
337 AC_MSG_NOTICE([adding $CHECK_SYMBOLS to o2ib in-kernel symbols])
338 INT_O2IB_SYMBOLS="${CHECK_SYMBOLS}"
341 AC_MSG_WARN([Module.symvers for in-kernel o2iblnd was not found, in-kernel ofed will not be built])
342 BUILT_IN_KO2IBLND="no"
345 if test "x$EXTERNAL_KO2IBLND" = "xno" -a "x$BUILT_IN_KO2IBLND" = "xno" ; then
346 AC_MSG_ERROR([No o2iblnd can be built])
347 elif test "x$ENABLE_MULTIPLE_LNDS" = "xno" -a \
348 "x$EXTERNAL_KO2IBLND" != "xno" -a "x$BUILT_IN_KO2IBLND" != "xno"; then
350 NOTE: --enable-multiple-lnds is needed to enable both o2iblnd drivers.
351 * Disabling in-kernel o2iblnd in favor of external o2iblnd driver.
352 * There can be only one in this configuration
354 BUILT_IN_KO2IBLND="no"
357 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
358 linux_kthread_worker, [
359 #ifdef HAVE_OFED_COMPAT_RDMA
361 #undef PACKAGE_TARNAME
362 #undef PACKAGE_VERSION
363 #undef PACKAGE_STRING
364 #undef PACKAGE_BUGREPORT
366 #include <linux/compat-2.6.h>
368 #include <linux/kthread.h>
370 struct kthread_work *kth_wrk = NULL;
371 flush_kthread_work(kth_wrk);
373 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
374 if test -z "$COMPAT_AUTOCONF"; then
375 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
378 EXTRA_CHECK_INCLUDE=""
380 AC_SUBST(EXTRA_OFED_CONFIG)
381 AC_SUBST(EXTRA_OFED_INCLUDE)
382 AC_SUBST(EXT_O2IBLND)
383 AC_SUBST(EXT_O2IB_SYMBOLS)
384 AC_SUBST(INT_O2IB_SYMBOLS)
386 # Passed down to deb packaging via autoMakefile.am
387 AC_SUBST(EXT_O2IBPATH)
389 AC_SUBST(ENABLE_MULTIPLE_LNDS)
391 AS_IF([test $ENABLEO2IB != "no"], [
392 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
393 if test ! $EXT_O2IBPATH -ef $LINUX_OBJ; then
394 EXTERNAL_KO2IBLND="yes"
397 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
398 AC_DEFUN([LN_SRC_O2IB_RDMA_CREATE_ID_4A], [
399 LB2_OFED_TEST_SRC([rdma_create_id_4args], [
400 #ifdef HAVE_OFED_COMPAT_RDMA
402 #undef PACKAGE_TARNAME
403 #undef PACKAGE_VERSION
404 #undef PACKAGE_STRING
405 #undef PACKAGE_BUGREPORT
407 #include <linux/compat-2.6.h>
409 #include <rdma/rdma_cm.h>
411 rdma_create_id(NULL, NULL, 0, 0);
412 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
414 AC_DEFUN([LN_O2IB_RDMA_CREATE_ID_4A], [
415 LB2_OFED_TEST_RESULTS(
416 ['rdma_create_id' wants four args],
417 [rdma_create_id_4args],
418 [HAVE_OFED_RDMA_CREATE_ID_4ARG])
421 # 4.4 added network namespace parameter for rdma_create_id()
422 AC_DEFUN([LN_SRC_O2IB_RDMA_CREATE_ID_5A], [
423 LB2_OFED_TEST_SRC([rdma_create_id_5args], [
424 #ifdef HAVE_OFED_COMPAT_RDMA
426 #undef PACKAGE_TARNAME
427 #undef PACKAGE_VERSION
428 #undef PACKAGE_STRING
429 #undef PACKAGE_BUGREPORT
431 #include <linux/compat-2.6.h>
433 #include <rdma/rdma_cm.h>
435 rdma_create_id(NULL, NULL, NULL, 0, 0);
436 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
438 AC_DEFUN([LN_O2IB_RDMA_CREATE_ID_5A], [
439 LB2_OFED_TEST_RESULTS(
440 ['rdma_create_id' wants five args],
441 [rdma_create_id_5args],
442 [HAVE_OFED_RDMA_CREATE_ID_5ARG])
445 # 4.2 introduced struct ib_cq_init_attr which is used
446 # by ib_create_cq(). Note some OFED stacks only keep
447 # their headers in sync with latest kernels but not
448 # the functionality which means for infiniband testing
449 # we need to always test functionality testings.
450 AC_DEFUN([LN_SRC_O2IB_IB_CQ_INIT_ATTR], [
451 LB2_OFED_TEST_SRC([ib_cq_init_attr], [
452 #ifdef HAVE_OFED_COMPAT_RDMA
454 #undef PACKAGE_TARNAME
455 #undef PACKAGE_VERSION
456 #undef PACKAGE_STRING
457 #undef PACKAGE_BUGREPORT
459 #include <linux/compat-2.6.h>
461 #include <rdma/ib_verbs.h>
463 struct ib_cq_init_attr cq_attr;
465 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
466 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
468 AC_DEFUN([LN_O2IB_IB_CQ_INIT_ATTR], [
469 LB2_OFED_TEST_RESULTS(
470 ['struct ib_cq_init_attr' is used by ib_create_cq],
472 [HAVE_OFED_IB_CQ_INIT_ATTR])
475 # 4.3 removed ib_alloc_fast_reg_mr()
476 AC_DEFUN([LN_SRC_O2IB_IB_ALLOC_FAST_REG_MR], [
477 LB2_OFED_TEST_SRC([ib_alloc_fast_reg_mr], [
478 #ifdef HAVE_OFED_COMPAT_RDMA
480 #undef PACKAGE_TARNAME
481 #undef PACKAGE_VERSION
482 #undef PACKAGE_STRING
483 #undef PACKAGE_BUGREPORT
485 #include <linux/compat-2.6.h>
487 #include <rdma/ib_verbs.h>
489 ib_alloc_fast_reg_mr(NULL, 0);
490 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
492 AC_DEFUN([LN_O2IB_IB_ALLOC_FAST_REG_MR], [
493 LB2_OFED_TEST_RESULTS(
494 ['ib_alloc_fast_reg_mr' exists],
495 [ib_alloc_fast_reg_mr],
496 [HAVE_OFED_IB_ALLOC_FAST_REG_MR])
499 # 4.9 must stop using ib_get_dma_mr and the global MR
500 # We then have to use FMR/Fastreg for all RDMA.
501 AC_DEFUN([LN_SRC_O2IB_IB_GET_DMA_MR], [
502 LB2_OFED_TEST_SRC([ib_get_dma_mr], [
503 #ifdef HAVE_OFED_COMPAT_RDMA
505 #undef PACKAGE_TARNAME
506 #undef PACKAGE_VERSION
507 #undef PACKAGE_STRING
508 #undef PACKAGE_BUGREPORT
510 #include <linux/compat-2.6.h>
512 #include <rdma/ib_verbs.h>
514 ib_get_dma_mr(NULL, 0);
515 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
517 AC_DEFUN([LN_O2IB_IB_GET_DMA_MR], [
518 LB2_OFED_TEST_RESULTS(
519 ['ib_get_dma_mr' exists],
521 [HAVE_OFED_IB_GET_DMA_MR])
524 # In v4.4 Linux kernel,
525 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
526 # split up struct ib_send_wr so that all non-trivial verbs
527 # use their own structure which embedds struct ib_send_wr.
528 AC_DEFUN([LN_SRC_O2IB_IB_RDMA_WR], [
529 LB2_OFED_TEST_SRC([ib_rdma_wr], [
530 #ifdef HAVE_OFED_COMPAT_RDMA
532 #undef PACKAGE_TARNAME
533 #undef PACKAGE_VERSION
534 #undef PACKAGE_STRING
535 #undef PACKAGE_BUGREPORT
537 #include <linux/compat-2.6.h>
539 #include <rdma/ib_verbs.h>
541 const struct ib_rdma_wr *wr __attribute__ ((unused));
544 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
546 AC_DEFUN([LN_O2IB_IB_RDMA_WR], [
547 LB2_OFED_TEST_RESULTS(
548 ['struct ib_rdma_wr' is defined],
550 [HAVE_OFED_IB_RDMA_WR])
553 # new fast registration API introduced in 4.4
554 AC_DEFUN([LN_SRC_O2IB_IB_MAP_MR_SG_4A], [
555 LB2_OFED_TEST_SRC([ib_map_mr_sg_4args], [
556 #ifdef HAVE_OFED_COMPAT_RDMA
558 #undef PACKAGE_TARNAME
559 #undef PACKAGE_VERSION
560 #undef PACKAGE_STRING
561 #undef PACKAGE_BUGREPORT
563 #include <linux/compat-2.6.h>
565 #include <rdma/ib_verbs.h>
567 ib_map_mr_sg(NULL, NULL, 0, 0);
568 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
570 # new fast registration API introduced in 4.4
571 AC_DEFUN([LN_O2IB_IB_MAP_MR_SG_4A], [
572 LB2_OFED_TEST_RESULTS(
573 ['ib_map_mr_sg' with 4 args exists],
574 [ib_map_mr_sg_4args],
575 [HAVE_OFED_IB_MAP_MR_SG])
578 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
579 # in kernel 4.7 (and RHEL 7.3)
580 AC_DEFUN([LN_SRC_O2IB_IB_MAP_MR_SG_5A], [
581 LB2_OFED_TEST_SRC([ib_map_mr_sg_5args], [
582 #ifdef HAVE_OFED_COMPAT_RDMA
584 #undef PACKAGE_TARNAME
585 #undef PACKAGE_VERSION
586 #undef PACKAGE_STRING
587 #undef PACKAGE_BUGREPORT
589 #include <linux/compat-2.6.h>
591 #include <rdma/ib_verbs.h>
593 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
594 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
596 AC_DEFUN([LN_O2IB_IB_MAP_MR_SG_5A], [
597 LB2_OFED_TEST_RESULTS(
598 [struct ib_reg_wr exists],
599 [ib_map_mr_sg_5args],
600 [HAVE_OFED_IB_MAP_MR_SG])
601 LB2_OFED_TEST_RESULTS(
602 ['ib_map_mr_sg()' with 5 args exists],
603 [ib_map_mr_sg_5args],
604 [HAVE_OFED_IB_MAP_MR_SG_5ARGS])
607 # ib_query_device() removed in 4.5
608 AC_DEFUN([LN_SRC_O2IB_IB_DEVICE_ATTRS], [
609 LB2_OFED_TEST_SRC([ib_device_attrs], [
610 #ifdef HAVE_OFED_COMPAT_RDMA
612 #undef PACKAGE_TARNAME
613 #undef PACKAGE_VERSION
614 #undef PACKAGE_STRING
615 #undef PACKAGE_BUGREPORT
617 #include <linux/compat-2.6.h>
619 #include <rdma/ib_verbs.h>
621 struct ib_device dev;
622 struct ib_device_attr dev_attr = {};
623 dev.attrs = dev_attr;
624 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
626 AC_DEFUN([LN_O2IB_IB_DEVICE_ATTRS], [
627 LB2_OFED_TEST_RESULTS(
628 ['struct ib_device' has member 'attrs'],
630 [HAVE_OFED_IB_DEVICE_ATTRS])
633 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
634 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
635 AC_DEFUN([LN_SRC_O2IB_IB_ALLOC_PD], [
636 LB2_OFED_TEST_SRC([ib_alloc_pd], [
637 #ifdef HAVE_OFED_COMPAT_RDMA
639 #undef PACKAGE_TARNAME
640 #undef PACKAGE_VERSION
641 #undef PACKAGE_STRING
642 #undef PACKAGE_BUGREPORT
644 #include <linux/compat-2.6.h>
646 #include <rdma/ib_verbs.h>
648 ib_alloc_pd(NULL, 0);
649 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
651 AC_DEFUN([LN_O2IB_IB_ALLOC_PD], [
652 LB2_OFED_TEST_RESULTS(
653 [2arg 'ib_alloc_pd' exists],
655 [HAVE_OFED_IB_ALLOC_PD_2ARGS])
658 AC_DEFUN([LN_SRC_O2IB_IB_INC_RKEY], [
659 LB2_OFED_TEST_SRC([ib_inc_rkey], [
660 #ifdef HAVE_OFED_COMPAT_RDMA
662 #undef PACKAGE_TARNAME
663 #undef PACKAGE_VERSION
664 #undef PACKAGE_STRING
665 #undef PACKAGE_BUGREPORT
667 #include <linux/compat-2.6.h>
669 #include <rdma/ib_verbs.h>
671 (void)ib_inc_rkey(0);
672 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
674 AC_DEFUN([LN_O2IB_IB_INC_RKEY], [
675 LB2_OFED_TEST_RESULTS(
676 [function 'ib_inc_rkey' is defined],
678 [HAVE_OFED_IB_INC_RKEY])
681 # In MOFED 4.6, the second and third parameters for
682 # ib_post_send() and ib_post_recv() are declared with
684 AC_DEFUN([LN_SRC_O2IB_IB_POST_SEND_CONST], [
685 LB2_OFED_TEST_SRC([ib_post_send_recv_const], [
686 #ifdef HAVE_OFED_COMPAT_RDMA
688 #undef PACKAGE_TARNAME
689 #undef PACKAGE_VERSION
690 #undef PACKAGE_STRING
691 #undef PACKAGE_BUGREPORT
693 #include <linux/compat-2.6.h>
695 #include <rdma/ib_verbs.h>
697 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
698 (const struct ib_send_wr **)NULL);
699 ],[-Werror],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
701 AC_DEFUN([LN_O2IB_IB_POST_SEND_CONST], [
702 LB2_OFED_TEST_RESULTS(
703 ['ib_post_send() and ib_post_recv()' have const parameters],
704 [ib_post_send_recv_const],
705 [HAVE_OFED_IB_POST_SEND_RECV_CONST])
708 # MOFED 5.5 fails with:
709 # ERROR: "ib_dma_virt_map_sg" [.../ko2iblnd.ko] undefined!
710 # See if we have a broken ib_dma_map_sg()
711 AC_DEFUN([LN_SRC_SANE_IB_DMA_MAP_SG], [
712 LB2_OFED_TEST_SRC([sane_ib_dma_map_sg], [
713 #ifdef HAVE_OFED_COMPAT_RDMA
715 #undef PACKAGE_TARNAME
716 #undef PACKAGE_VERSION
717 #undef PACKAGE_STRING
718 #undef PACKAGE_BUGREPORT
720 #include <linux/compat-2.6.h>
722 #include <rdma/ib_verbs.h>
724 ib_dma_map_sg((struct ib_device *)NULL,
725 (struct scatterlist *)NULL, 1, 0);
726 ],[-Werror],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
728 AC_DEFUN([LN_SANE_IB_DMA_MAP_SG], [
729 LB2_OFED_TEST_RESULTS(
730 [if ib_dma_map_sg() is sane],
731 [sane_ib_dma_map_sg],
732 [HAVE_OFED_IB_DMA_MAP_SG_SANE],[module])
736 # LN_IB_DEVICE_OPS_EXISTS
738 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
739 # RDMA/core: Introduce ib_device_ops
740 # ... introduces the ib_device_ops structure that defines all the
741 # InfiniBand device operations in one place ...
743 AC_DEFUN([LN_SRC_O2IB_IB_DEVICE_OPS_EXISTS], [
744 LB2_OFED_TEST_SRC([ib_device_ops_test], [
745 #include <rdma/ib_verbs.h>
747 int x = offsetof(struct ib_device_ops, unmap_fmr);
750 ],[-Werror],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
752 AC_DEFUN([LN_O2IB_IB_DEVICE_OPS_EXISTS], [
753 LB2_OFED_TEST_RESULTS(
754 [struct ib_device_ops is defined],
755 [ib_device_ops_test],
756 [HAVE_OFED_IB_DEVICE_OPS])
757 ]) # LN_IB_DEVICE_OPS_EXISTS
760 # LN_O2IB_IB_SG_DMA_ADDRESS_EXISTS
762 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
763 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
764 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
766 AC_DEFUN([LN_SRC_O2IB_IB_SG_DMA_ADDRESS_EXISTS], [
767 LB2_OFED_TEST_SRC([ib_sg_dma_address_test], [
768 #include <rdma/ib_verbs.h>
770 u64 x = ib_sg_dma_address(NULL, NULL);
773 ],[-Werror],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
775 AC_DEFUN([LN_O2IB_IB_SG_DMA_ADDRESS_EXISTS], [
776 LB2_OFED_TEST_RESULTS(
777 [ib_sg_dma_address wrapper exists],
778 [ib_sg_dma_address_test],
779 [HAVE_OFED_IB_SG_DMA_ADDRESS])
780 ]) # LN_O2IB_IB_SG_DMA_ADDRESS_EXISTS
783 # LN_O2IB_RDMA_REJECT
785 # A reason argument was added to rdma_reject() in Linux 5.8,
786 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
787 AC_DEFUN([LN_SRC_O2IB_RDMA_REJECT], [
788 LB2_OFED_TEST_SRC([rdma_reject], [
789 #ifdef HAVE_OFED_COMPAT_RDMA
791 #undef PACKAGE_TARNAME
792 #undef PACKAGE_VERSION
793 #undef PACKAGE_STRING
794 #undef PACKAGE_BUGREPORT
796 #include <linux/compat-2.6.h>
798 #include <rdma/ib_verbs.h>
799 #include <rdma/ib_cm.h>
800 #include <rdma/rdma_cm.h>
802 rdma_reject(NULL, NULL, 0, 0);
803 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
805 AC_DEFUN([LN_O2IB_RDMA_REJECT], [
806 LB2_OFED_TEST_RESULTS(
807 [4arg 'rdma_reject' exists],
809 [HAVE_OFED_RDMA_REJECT_4ARGS])
810 ]) # LN_O2IB_RDMA_REJECT
815 # The FMR pool API was removed in Linux 5.8,
816 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
817 AC_DEFUN([LN_SRC_O2IB_IB_FMR], [
818 LB2_OFED_TEST_SRC([ib_fmr], [
819 #include <rdma/ib_verbs.h>
821 struct ib_fmr fmr = {};
822 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
824 AC_DEFUN([LN_O2IB_IB_FMR], [
825 LB2_OFED_TEST_RESULTS(
826 [FMR pools API available],
828 [HAVE_OFED_FMR_POOL_API])
832 # LN_O2IB_RDMA_CONNECT_LOCKED
834 # rdma_connect_locked() was added in Linux 5.10,
835 # commit 071ba4cc559de47160761b9500b72e8fa09d923d
836 # and in MOFED-5.2-2. rdma_connect_locked() must
837 # be called instead of rdma_connect() in
838 # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
839 AC_DEFUN([LN_SRC_O2IB_RDMA_CONNECT_LOCKED], [
840 LB2_OFED_TEST_SRC([rdma_connect_locked], [
841 #include <rdma/rdma_cm.h>
843 rdma_connect_locked(NULL, NULL);
844 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
846 AC_DEFUN([LN_O2IB_RDMA_CONNECT_LOCKED], [
847 LB2_OFED_TEST_RESULTS(
848 ['rdma_connect_locked' exists],
849 [rdma_connect_locked],
850 [HAVE_OFED_RDMA_CONNECT_LOCKED])
851 ]) # LN_O2IB_RDMA_CONNECT_LOCKED
853 EXTRA_CHECK_INCLUDE=""
855 AC_DEFUN([LN_CONFIG_O2IB_SRC], [
856 LN_SRC_O2IB_RDMA_CREATE_ID_4A
857 LN_SRC_O2IB_RDMA_CREATE_ID_5A
858 LN_SRC_O2IB_IB_CQ_INIT_ATTR
859 LN_SRC_O2IB_IB_ALLOC_FAST_REG_MR
860 LN_SRC_O2IB_IB_GET_DMA_MR
861 LN_SRC_O2IB_IB_RDMA_WR
862 LN_SRC_O2IB_IB_MAP_MR_SG_4A
863 LN_SRC_O2IB_IB_MAP_MR_SG_5A
864 LN_SRC_O2IB_IB_DEVICE_ATTRS
865 LN_SRC_O2IB_IB_ALLOC_PD
866 LN_SRC_O2IB_IB_INC_RKEY
867 LN_SRC_O2IB_IB_POST_SEND_CONST
868 LN_SRC_SANE_IB_DMA_MAP_SG
869 LN_SRC_O2IB_IB_DEVICE_OPS_EXISTS
870 LN_SRC_O2IB_IB_SG_DMA_ADDRESS_EXISTS
871 LN_SRC_O2IB_RDMA_REJECT
873 LN_SRC_O2IB_RDMA_CONNECT_LOCKED
875 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [
876 LN_O2IB_RDMA_CREATE_ID_4A
877 LN_O2IB_RDMA_CREATE_ID_5A
878 LN_O2IB_IB_CQ_INIT_ATTR
879 LN_O2IB_IB_ALLOC_FAST_REG_MR
880 LN_O2IB_IB_GET_DMA_MR
882 LN_O2IB_IB_MAP_MR_SG_4A
883 LN_O2IB_IB_MAP_MR_SG_5A
884 LN_O2IB_IB_DEVICE_ATTRS
887 LN_O2IB_IB_POST_SEND_CONST
888 LN_SANE_IB_DMA_MAP_SG
889 LN_O2IB_IB_DEVICE_OPS_EXISTS
890 LN_O2IB_IB_SG_DMA_ADDRESS_EXISTS
893 LN_O2IB_RDMA_CONNECT_LOCKED
895 ]) # ENABLEO2IB != "no"
901 # check whether to use the Gemini Network Interface lnd
903 AC_DEFUN([LN_CONFIG_GNILND], [
904 AC_MSG_CHECKING([whether to enable GNI lnd])
906 AS_HELP_STRING([--enable-gni],
908 [], [enable_gni="no"])
909 AC_MSG_RESULT([$enable_gni])
911 AS_IF([test "x$enable_gni" = xyes], [
912 # GNICPPFLAGS was set in spec file
913 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
914 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
915 LB_CHECK_COMPILE([if GNI kernel headers are present],
917 #include <linux/types.h>
920 gni_cdm_handle_t kgni_domain;
923 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
924 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
929 AC_MSG_ERROR([cannot compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
931 # at this point, we have gnilnd basic support,
932 # now check for extra features
933 LB_CHECK_COMPILE([to use RCA in gnilnd],
935 #include <linux/types.h>
937 #include <krca_lib.h>
939 gni_cdm_handle_t kgni_domain;
941 krca_ticket_t ticket = KRCA_NULL_TICKET;
943 __u32 nid = 0, nic_addr;
944 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
945 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
946 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
947 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
950 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
952 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
954 AC_SUBST(ENABLE_GNI, yes)
956 AC_SUBST(ENABLE_GNI, no)
958 AC_SUBST(GNICPPFLAGS)
960 ]) # LN_CONFIG_GNILND
965 # check whether to use the kfabric Network Interface lnd
967 AC_DEFUN([LN_CONFIG_KFILND], [
969 AS_HELP_STRING([--with-kfi=<path>], [Kfabric build path for kfilnd]),
971 AC_CHECK_FILE([$with_kfi/Module.symvers],
973 # KFICPPFLAGS was set in spec file
974 KFICPPFLAGS="-I$with_kfi/include"
975 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
976 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $KFICPPFLAGS"
977 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $with_kfi/Module.symvers"
978 LB_CHECK_COMPILE([if kfabric headers are present], KFI_header,
980 #include <kfi_endpoint.h>
982 struct kfi_info *hints;
983 hints = kfi_allocinfo();
986 AC_MSG_NOTICE([adding $with_kfi/Module.symvers to Symbol Path])
987 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $with_kfi/Module.symvers"
989 AC_MSG_ERROR([cannot compile kfilnd with given KFICPPFLAGS: $KFICPPFLAGS])
992 AC_MSG_ERROR(["$with_kfi/Module.symvers does not exist"])
995 AC_DEFINE(HAVE_KFILND, 1, [support kfabric LND])
996 AC_SUBST(KFICPPFLAGS)
998 AC_SUBST(EXTRA_SYMBOLS)
999 ]) # LN_CONFIG_KFILND
1002 # LN_CONFIG_SOCK_CREATE_KERN
1004 # 4.x sock_create_kern() added a first parameter as 'struct net *'
1007 AC_DEFUN([LN_SRC_CONFIG_SOCK_CREATE_KERN], [
1008 LB2_LINUX_TEST_SRC([sock_create_kern_net], [
1009 #include <linux/net.h>
1010 #include <net/net_namespace.h>
1012 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
1015 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
1016 LB2_MSG_LINUX_TEST_RESULT([if 'sock_create_kern' first parameter is net],
1017 [sock_create_kern_net], [
1018 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
1019 [sock_create_kern use net as first parameter])
1021 ]) # LN_CONFIG_SOCK_CREATE_KERN
1024 # LN_CONFIG_SK_DATA_READY
1026 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
1028 AC_DEFUN([LN_SRC_CONFIG_SK_DATA_READY], [
1029 LB2_LINUX_TEST_SRC([sk_data_ready], [
1030 #include <linux/net.h>
1031 #include <net/sock.h>
1033 ((struct sock *)0)->sk_data_ready(NULL);
1036 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
1037 LB2_MSG_LINUX_TEST_RESULT([if 'sk_data_ready' takes only one argument],
1039 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
1040 [sk_data_ready uses only one argument])
1042 ]) # LN_CONFIG_SK_DATA_READY
1045 # LN_ETHTOOL_LINK_SETTINGS
1047 # ethtool_link_settings was added in Linux 4.6
1049 AC_DEFUN([LN_SRC_ETHTOOL_LINK_SETTINGS], [
1050 LB2_LINUX_TEST_SRC([ethtool_link_settings], [
1051 #include <linux/ethtool.h>
1053 struct ethtool_link_ksettings cmd;
1054 ],[],[$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE])
1056 AC_DEFUN([LN_ETHTOOL_LINK_SETTINGS], [
1057 LB2_MSG_LINUX_TEST_RESULT([if 'ethtool_link_settings' exists],
1058 [ethtool_link_settings], [
1059 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
1060 [ethtool_link_settings is defined])
1062 ]) # LN_ETHTOOL_LINK_SETTINGS
1065 # LN_HAVE_HYPERVISOR_IS_TYPE
1067 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
1068 # x86/paravirt: Provide a way to check for hypervisors
1070 AC_DEFUN([LN_SRC_HAVE_HYPERVISOR_IS_TYPE], [
1071 LB2_LINUX_TEST_SRC([hypervisor_is_type_exists], [
1072 #include <asm/hypervisor.h>
1074 (void)hypervisor_is_type(X86_HYPER_NATIVE);
1077 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
1078 LB2_MSG_LINUX_TEST_RESULT([if hypervisor_is_type function is available],
1079 [hypervisor_is_type_exists], [
1080 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
1081 [hypervisor_is_type function exists])
1083 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
1086 # LN_HAVE_ORACLE_OFED_EXTENSIONS
1090 AC_DEFUN([LN_SRC_HAVE_ORACLE_OFED_EXTENSIONS], [
1091 LB2_LINUX_TEST_SRC([oracle_ofed_ext], [
1092 #include <rdma/ib_fmr_pool.h>
1094 struct ib_fmr_pool_param param = {
1100 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
1101 LB2_MSG_LINUX_TEST_RESULT([if Oracle OFED Extensions are enabled],
1102 [oracle_ofed_ext], [
1103 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
1104 [if Oracle OFED Extensions are enabled])
1106 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
1109 # LN_CONFIG_SOCK_GETNAME
1111 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
1112 # does not take the length *int argument and returns the length
1114 AC_DEFUN([LN_SRC_CONFIG_SOCK_GETNAME], [
1115 LB2_LINUX_TEST_SRC([kern_sock_getname_2args], [
1116 #include <linux/net.h>
1118 kernel_getsockname(NULL, NULL);
1121 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
1122 LB2_MSG_LINUX_TEST_RESULT([if 'getname' has two args],
1123 [kern_sock_getname_2args], [
1124 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
1125 ['getname' has two args])
1127 ]) # LN_CONFIG_SOCK_GETNAME
1130 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
1132 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
1133 # and kernel 4.18.0-193.el8:
1134 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
1135 # and removed for_ifa and endfor_ifa.
1136 # Use the _rntl variant as the current locking is rtnl.
1138 AC_DEFUN([LN_SRC_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
1139 LB2_LINUX_TEST_SRC([in_dev_for_each_ifa_rtnl_test], [
1140 #include <linux/inetdevice.h>
1142 const struct in_ifaddr *ifa = NULL;
1143 struct in_device *in_dev = NULL;
1145 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
1148 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
1149 LB2_MSG_LINUX_TEST_RESULT([if 'in_dev_for_each_ifa_rtnl' is defined],
1150 [in_dev_for_each_ifa_rtnl_test], [
1151 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
1152 ['in_dev_for_each_ifa_rtnl' is defined])
1154 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
1160 AC_DEFUN([LN_USR_RDMA], [
1161 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
1162 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1163 #include <rdma/rdma_user_cm.h>
1166 int x = (int)RDMA_PS_TCP;
1170 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
1171 [RDMA_PS_TCP exists])
1175 AC_DEFUN([LN_PROG_LINUX_SRC], [
1178 LN_SRC_CONFIG_SK_DATA_READY
1180 LN_SRC_CONFIG_SOCK_CREATE_KERN
1182 LN_SRC_ETHTOOL_LINK_SETTINGS
1184 LN_SRC_HAVE_HYPERVISOR_IS_TYPE
1185 LN_SRC_HAVE_ORACLE_OFED_EXTENSIONS
1187 LN_SRC_CONFIG_SOCK_GETNAME
1188 # 5.3 and 4.18.0-193.el8
1189 LN_SRC_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
1192 AC_DEFUN([LN_PROG_LINUX_RESULTS], [
1193 LN_CONFIG_O2IB_RESULTS
1195 LN_CONFIG_SK_DATA_READY
1197 LN_CONFIG_SOCK_CREATE_KERN
1199 LN_ETHTOOL_LINK_SETTINGS
1201 LN_HAVE_HYPERVISOR_IS_TYPE
1202 LN_HAVE_ORACLE_OFED_EXTENSIONS
1204 LN_CONFIG_SOCK_GETNAME
1205 # 5.3 and 4.18.0-193.el8
1206 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
1212 # LNet linux kernel checks
1214 AC_DEFUN([LN_PROG_LINUX], [
1215 AC_MSG_NOTICE([LNet kernel checks
1216 ==============================================================================])
1227 # default paths for installed files
1229 AC_DEFUN([LN_PATH_DEFAULTS], [
1230 ]) # LN_PATH_DEFAULTS
1235 # other configure checks
1237 AC_DEFUN([LN_CONFIGURE], [
1238 AC_MSG_NOTICE([LNet core checks
1239 ==============================================================================])
1242 AS_HELP_STRING([--with-cuda=path],
1243 [Path to the CUDA sources. Set to 'no' to disable.]),
1244 [cudapath="$withval"],
1245 [cudapath1=`ls -d1 /usr/src/nvidia-*/nvidia/ 2>/dev/null | tail -1`])
1248 AS_HELP_STRING([--with-gds=path],
1249 [Path to the GDS sources. Set to 'no' to disable.]),
1250 [gdspath="$withval"],
1251 [gdspath1=`ls -d1 /usr/src/nvidia-fs*/ 2>/dev/null | tail -1`])
1253 AC_MSG_CHECKING([cuda source directory])
1254 AS_IF([test -z "${cudapath}"], [
1255 AS_IF([test -e "${cudapath1}/nv-p2p.h"], [
1256 cudapath=${cudapath1}
1258 cudapath="[Not found]"
1261 AC_MSG_RESULT([$cudapath])
1263 AC_MSG_CHECKING([gds source directory])
1264 AS_IF([test -z "${gdspath}"], [
1265 AS_IF([test -e "${gdspath1}/nvfs-dma.h"], [
1268 gdspath="[Not found]"
1271 AC_MSG_RESULT([$gdspath])
1273 AS_IF([test -e "${cudapath}" && test -e "${gdspath}"],[
1274 LB_CHECK_FILE([$cudapath/nv-p2p.h], [
1275 AC_MSG_RESULT([CUDA path is $cudapath])
1276 [CUDA_PATH=${cudapath}]
1279 AC_MSG_RESULT([CUDA sources not found: nv-p2p.h does not exist])
1282 LB_CHECK_FILE([$gdspath/nvfs-dma.h], [
1283 LB_CHECK_FILE([$gdspath/config-host.h], [
1284 AC_MSG_RESULT([GDS path is ${gdspath}])
1285 [GDS_PATH=${gdspath}]
1287 AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
1289 AC_MSG_RESULT([GDS sources not found: config-host.h does not exist])
1292 AC_MSG_RESULT([GDS sources not found: nvfs-dma.h does not exist])
1295 AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
1298 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
1299 AS_IF([test "x$PKGCONF" = "x"],
1300 [AC_MSG_ERROR([pkg-config package is required to configure Lustre])])
1302 AS_IF([test "x$enable_dist" = xno], [
1303 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
1306 AC_CHECK_LIB([nl-3], [nla_get_s32], [
1307 AC_DEFINE(HAVE_NLA_GET_S32, 1,
1308 [libnl3 supports nla_get_s32])
1312 AC_CHECK_LIB([nl-3], [nla_get_s64], [
1313 AC_DEFINE(HAVE_NLA_GET_S64, 1,
1314 [libnl3 supports nla_get_s64])
1321 AC_DEFUN([LN_USR_NLMSGERR], [
1322 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
1323 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1324 #include <linux/netlink.h>
1327 int x = (int)NLMSGERR_ATTR_MAX;
1331 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
1332 ['enum nlmsgerr_attrs' exists])
1334 ]) # LN_USR_NLMGSERR
1336 # lnet/utils/portals.c
1337 AC_CHECK_HEADERS([netdb.h])
1339 # lnet/utils/wirecheck.c
1340 AC_CHECK_FUNCS([strnlen])
1342 # -------- Check for required packages --------------
1344 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1345 AC_ARG_ENABLE(efence,
1346 AS_HELP_STRING([--enable-efence],
1347 [use efence library]),
1348 [], [enable_efence="no"])
1349 AC_MSG_RESULT([$enable_efence])
1352 AS_IF([test "$enable_efence" = yes], [
1353 LIBEFENCE="-lefence"
1354 AC_DEFINE(HAVE_LIBEFENCE, 1,
1355 [libefence support is requested])
1356 AC_SUBST(ENABLE_EFENCE, yes)
1358 AC_SUBST(ENABLE_EFENCE, no)
1370 # AM_CONDITIONAL defines for lnet
1372 AC_DEFUN([LN_CONDITIONALS], [
1373 AM_CONDITIONAL(EXTERNAL_KO2IBLND, test x$EXTERNAL_KO2IBLND = "xyes")
1374 AM_CONDITIONAL(BUILT_IN_KO2IBLND, test x$BUILT_IN_KO2IBLND = "xyes")
1375 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1376 AM_CONDITIONAL(BUILD_KFILND, test x$KFILND = "xkfilnd")
1377 ]) # LN_CONDITIONALS
1382 # files that should be generated with AC_OUTPUT
1384 AC_DEFUN([LN_CONFIG_FILES], [
1388 lnet/autoconf/Makefile
1390 lnet/include/Makefile
1391 lnet/include/lnet/Makefile
1392 lnet/include/uapi/linux/lnet/Makefile
1394 lnet/klnds/autoMakefile
1395 lnet/klnds/o2iblnd/Makefile
1396 lnet/klnds/o2iblnd/autoMakefile
1397 lnet/klnds/in-kernel-o2iblnd/Makefile
1398 lnet/klnds/in-kernel-o2iblnd/autoMakefile
1399 lnet/klnds/gnilnd/Makefile
1400 lnet/klnds/gnilnd/autoMakefile
1401 lnet/klnds/socklnd/Makefile
1402 lnet/klnds/socklnd/autoMakefile
1403 lnet/klnds/kfilnd/Makefile
1404 lnet/klnds/kfilnd/autoMakefile
1406 lnet/lnet/autoMakefile
1407 lnet/selftest/Makefile
1408 lnet/selftest/autoMakefile
1410 lnet/utils/lnetconfig/Makefile
1412 ]) # LN_CONFIG_FILES