3 # check if tunable tcp backoff is available/wanted
5 AC_DEFUN([LN_CONFIG_BACKOFF], [
6 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
7 AC_ARG_ENABLE([backoff],
8 AS_HELP_STRING([--disable-backoff],
9 [disable socknal tunable backoff]),
10 [], [enable_backoff="yes"])
11 AC_MSG_RESULT([$enable_backoff])
12 AS_IF([test "x$enable_backoff" = xyes], [
13 AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
14 AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
16 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
17 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
18 [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
19 [tunable backoff TCP in ms])])
24 ]) # LN_CONFIG_BACKOFF
31 # fail to build if libyaml is not installed
33 AC_DEFUN([LN_CONFIG_DLC], [
34 AS_IF([test "x$enable_dist" = xno], [
35 AC_CHECK_LIB([yaml], [yaml_parser_initialize],
37 [AC_MSG_ERROR([YAML development libraries not not installed])],
45 # If current OFED installed (assume with "ofed_info") and devel
46 # headers are not found, error because we assume OFED infiniband
47 # driver needs to be used and we must configure/build with it.
48 # Current OFED headers detection mechanism allow for non-standard
49 # prefix but relies on "ofed_info" command and on "%prefix/openib"
50 # link (both are ok for 1.5.x and 3.x versions), and should work
51 # for both source and DKMS builds.
53 AC_DEFUN([LN_CONFIG_O2IB], [
54 AC_MSG_CHECKING([whether to use Compat RDMA])
56 AS_HELP_STRING([--with-o2ib=[yes|no|<path>]],
57 [build o2iblnd against path]),
58 [], [with_o2ib="yes"])
61 yes) AS_IF([which ofed_info 2>/dev/null], [
62 AS_IF([test x$uses_dpkg = xyes], [
63 LIST_ALL_PKG="dpkg -l | awk '{print \[$]2}'"
64 LSPKG="dpkg --listfiles"
66 LIST_ALL_PKG="rpm -qa"
70 O2IBPKG="mlnx-ofed-kernel-dkms"
71 O2IBPKG+="|mlnx-ofed-kernel-modules"
72 O2IBPKG+="|mlnx-ofa_kernel-devel"
73 O2IBPKG+="|compat-rdma-devel"
74 O2IBPKG+="|kernel-ib-devel"
75 O2IBPKG+="|ofa_kernel-devel"
78 O2IBDIR+="|/ofa_kernel/default"
81 O2IBDIR_PATH=$(eval $LIST_ALL_PKG |
82 egrep -w "$O2IBPKG" | xargs $LSPKG |
83 egrep "${O2IBDIR}$" | head -n1)
85 if test -n "$O2IBDIR_PATH"; then
86 O2IBPATHS=$(find $O2IBDIR_PATH -name rdma_cm.h |
87 sed -e 's/\/include\/rdma\/rdma_cm.h//')
90 AS_IF([test -z "$O2IBPATHS"], [
92 You seem to have an OFED installed but have not installed it's devel package.
93 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
94 Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
97 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
99 It appears that you have multiple OFED versions installed.
100 If you still want to build Lustre for your OFED I/B stack, you need to install a single version with its devel headers RPM.
101 Instead, if you want to build Lustre for your in-kernel I/B stack rather than your installed external OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
104 if test -e $O2IBPATHS/${LINUXRELEASE}; then
105 O2IBPATHS=$O2IBPATHS/${LINUXRELEASE}
106 elif test -e $O2IBPATHS/default; then
107 O2IBPATHS=$O2IBPATHS/default
111 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
117 *) O2IBPATHS=$with_o2ib
118 ENABLEO2IB="withpath"
123 AS_IF([test $ENABLEO2IB = "no"], [
125 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
126 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
129 for O2IBPATH in $O2IBPATHS; do
130 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
131 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
132 -f ${O2IBPATH}/include/rdma/ib_verbs.h \)], [
137 if ! $o2ib_found; then
140 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
141 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
142 *) AC_MSG_ERROR([internal error]) ;;
146 compatrdma_found=false
147 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
149 compatrdma_found=true
150 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
151 EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
152 if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
153 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
158 if ! $compatrdma_found; then
159 if test -f "$O2IBPATH/config.mk"; then
160 . "$O2IBPATH/config.mk"
161 elif test -f "$O2IBPATH/ofed_patch.mk"; then
162 . "$O2IBPATH/ofed_patch.mk"
164 elif test -z "$COMPAT_AUTOCONF"; then
166 if test "x$RHEL_KERNEL" = xyes; then
167 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
168 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
169 while test "$I" -ge 0; do
170 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
173 elif test "x$SUSE_KERNEL" = xyes; then
174 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
175 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
179 AC_MSG_CHECKING([whether to use any OFED backport headers])
180 if test -n "$BACKPORT_INCLUDES"; then
182 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
183 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
189 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
190 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include -I$O2IBPATH/include/uapi"
191 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
192 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
193 openib_gen2_support, [
194 #ifdef HAVE_COMPAT_RDMA
196 #undef PACKAGE_TARNAME
197 #undef PACKAGE_VERSION
198 #undef PACKAGE_STRING
199 #undef PACKAGE_BUGREPORT
201 #include <linux/compat-2.6.h>
203 #include <linux/version.h>
204 #include <linux/pci.h>
205 #include <linux/gfp.h>
206 #include <rdma/rdma_cm.h>
207 #include <rdma/ib_cm.h>
208 #include <rdma/ib_verbs.h>
210 struct rdma_cm_id *cm_idi __attribute__ ((unused));
211 struct rdma_conn_param conn_param __attribute__ ((unused));
212 struct ib_device_attr device_attr __attribute__ ((unused));
213 struct ib_qp_attr qp_attr __attribute__ ((unused));
214 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
215 rdma_destroy_id(NULL);
220 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
221 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
222 *) AC_MSG_ERROR([internal error]) ;;
225 # we know at this point that the found OFED source is good
227 if test -f $O2IBPATH/Module.symvers; then
228 O2IB_SYMVER=$O2IBPATH/Module.symvers
229 elif test "x$SUSE_KERNEL" = "xyes"; then
230 O2IB_SYMVER=$(find ${O2IBPATH}* -name Module.symvers)
231 # Select only the current 'flavor' if there is more than 1
232 NUM_AVAIL=$(find ${O2IBPATH}* -name Module.symvers | wc -l)
233 if test ${NUM_AVAIL} -gt 1; then
234 PREFER=$(basename ${LINUX_OBJ})
235 for F in $(find ${O2IBPATH}-obj -name Module.symvers)
237 maybe=$(echo $F | grep "/${PREFER}")
238 if test "x$maybe" != "x"; then
243 elif test -f $LINUX_OBJ/Module.symvers; then
244 # Debian symvers is in the arch tree
245 O2IB_SYMVER=$LINUX_OBJ/Module.symvers
247 if test -n "$O2IB_SYMVER"; then
248 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
249 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
250 AC_SUBST(EXTRA_SYMBOLS)
252 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
255 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
256 linux_kthread_worker, [
257 #ifdef HAVE_COMPAT_RDMA
259 #undef PACKAGE_TARNAME
260 #undef PACKAGE_VERSION
261 #undef PACKAGE_STRING
262 #undef PACKAGE_BUGREPORT
264 #include <linux/compat-2.6.h>
266 #include <linux/kthread.h>
268 struct kthread_work *kth_wrk = NULL;
269 flush_kthread_work(kth_wrk);
271 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
272 if test -z "$COMPAT_AUTOCONF"; then
273 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
276 EXTRA_CHECK_INCLUDE=""
279 AC_SUBST(EXTRA_OFED_CONFIG)
280 AC_SUBST(EXTRA_OFED_INCLUDE)
285 AS_IF([test $ENABLEO2IB != "no"], [
286 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
287 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
289 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
290 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
291 rdma_create_id_4args, [
292 #ifdef HAVE_COMPAT_RDMA
294 #undef PACKAGE_TARNAME
295 #undef PACKAGE_VERSION
296 #undef PACKAGE_STRING
297 #undef PACKAGE_BUGREPORT
299 #include <linux/compat-2.6.h>
301 #include <rdma/rdma_cm.h>
303 rdma_create_id(NULL, NULL, 0, 0);
305 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
306 [rdma_create_id wants 4 args])
309 # 4.4 added network namespace parameter for rdma_create_id()
310 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
311 rdma_create_id_5args, [
312 #ifdef HAVE_COMPAT_RDMA
314 #undef PACKAGE_TARNAME
315 #undef PACKAGE_VERSION
316 #undef PACKAGE_STRING
317 #undef PACKAGE_BUGREPORT
319 #include <linux/compat-2.6.h>
321 #include <rdma/rdma_cm.h>
323 rdma_create_id(NULL, NULL, NULL, 0, 0);
325 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
326 [rdma_create_id wants 5 args])
329 # 4.2 introduced struct ib_cq_init_attr which is used
330 # by ib_create_cq(). Note some OFED stacks only keep
331 # their headers in sync with latest kernels but not
332 # the functionality which means for infiniband testing
333 # we need to always test functionality testings.
334 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
336 #ifdef HAVE_COMPAT_RDMA
338 #undef PACKAGE_TARNAME
339 #undef PACKAGE_VERSION
340 #undef PACKAGE_STRING
341 #undef PACKAGE_BUGREPORT
343 #include <linux/compat-2.6.h>
345 #include <rdma/ib_verbs.h>
347 struct ib_cq_init_attr cq_attr;
349 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
351 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
352 [struct ib_cq_init_attr is used by ib_create_cq])
355 # 4.3 removed ib_alloc_fast_reg_mr()
356 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
357 ib_alloc_fast_reg_mr, [
358 #ifdef HAVE_COMPAT_RDMA
360 #undef PACKAGE_TARNAME
361 #undef PACKAGE_VERSION
362 #undef PACKAGE_STRING
363 #undef PACKAGE_BUGREPORT
365 #include <linux/compat-2.6.h>
367 #include <rdma/ib_verbs.h>
369 ib_alloc_fast_reg_mr(NULL, 0);
371 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
372 [ib_alloc_fast_reg_mr is defined])
375 # 4.9 must stop using ib_get_dma_mr and the global MR
376 # We then have to use FMR/Fastreg for all RDMA.
377 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
379 #ifdef HAVE_COMPAT_RDMA
381 #undef PACKAGE_TARNAME
382 #undef PACKAGE_VERSION
383 #undef PACKAGE_STRING
384 #undef PACKAGE_BUGREPORT
386 #include <linux/compat-2.6.h>
388 #include <rdma/ib_verbs.h>
390 ib_get_dma_mr(NULL, 0);
392 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
393 [ib_get_dma_mr is defined])
396 # In v4.4 Linux kernel,
397 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
398 # split up struct ib_send_wr so that all non-trivial verbs
399 # use their own structure which embedds struct ib_send_wr.
400 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
402 #ifdef HAVE_COMPAT_RDMA
404 #undef PACKAGE_TARNAME
405 #undef PACKAGE_VERSION
406 #undef PACKAGE_STRING
407 #undef PACKAGE_BUGREPORT
409 #include <linux/compat-2.6.h>
411 #include <rdma/ib_verbs.h>
413 struct ib_rdma_wr *wr __attribute__ ((unused));
417 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
418 [struct ib_rdma_wr is defined])
421 # new fast registration API introduced in 4.4
422 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
423 ib_map_mr_sg_4args, [
424 #ifdef HAVE_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/ib_verbs.h>
435 ib_map_mr_sg(NULL, NULL, 0, 0);
437 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
438 [ib_map_mr_sg exists])
441 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
442 # in kernel 4.7 (and RHEL 7.3)
443 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
444 ib_map_mr_sg_5args, [
445 #ifdef HAVE_COMPAT_RDMA
447 #undef PACKAGE_TARNAME
448 #undef PACKAGE_VERSION
449 #undef PACKAGE_STRING
450 #undef PACKAGE_BUGREPORT
452 #include <linux/compat-2.6.h>
454 #include <rdma/ib_verbs.h>
456 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
458 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
459 [ib_map_mr_sg exists])
460 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
461 [ib_map_mr_sg has 5 arguments])
464 # ib_query_device() removed in 4.5
465 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
467 #ifdef HAVE_COMPAT_RDMA
469 #undef PACKAGE_TARNAME
470 #undef PACKAGE_VERSION
471 #undef PACKAGE_STRING
472 #undef PACKAGE_BUGREPORT
474 #include <linux/compat-2.6.h>
476 #include <rdma/ib_verbs.h>
478 struct ib_device dev;
479 struct ib_device_attr dev_attr = {};
480 dev.attrs = dev_attr;
482 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
483 [struct ib_device.attrs is defined])
486 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
487 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
488 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
490 #ifdef HAVE_COMPAT_RDMA
492 #undef PACKAGE_TARNAME
493 #undef PACKAGE_VERSION
494 #undef PACKAGE_STRING
495 #undef PACKAGE_BUGREPORT
497 #include <linux/compat-2.6.h>
499 #include <rdma/ib_verbs.h>
501 ib_alloc_pd(NULL, 0);
503 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
504 [ib_alloc_pd has 2 arguments])
507 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
509 #ifdef HAVE_COMPAT_RDMA
511 #undef PACKAGE_TARNAME
512 #undef PACKAGE_VERSION
513 #undef PACKAGE_STRING
514 #undef PACKAGE_BUGREPORT
516 #include <linux/compat-2.6.h>
518 #include <rdma/ib_verbs.h>
520 (void)ib_inc_rkey(0);
522 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
523 [function ib_inc_rkey exist])
526 # In MOFED 4.6, the second and third parameters for
527 # ib_post_send() and ib_post_recv() are declared with
529 tmp_flags="$EXTRA_KCFLAGS"
530 EXTRA_KCFLAGS="-Werror"
531 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
532 ib_post_send_recv_const, [
533 #ifdef HAVE_COMPAT_RDMA
535 #undef PACKAGE_TARNAME
536 #undef PACKAGE_VERSION
537 #undef PACKAGE_STRING
538 #undef PACKAGE_BUGREPORT
540 #include <linux/compat-2.6.h>
542 #include <rdma/ib_verbs.h>
544 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
545 (const struct ib_send_wr **)NULL);
547 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
548 [ib_post_send and ib_post_recv have const parameters])
550 EXTRA_KCFLAGS="$tmp_flags"
553 LN_IB_DEVICE_OPS_EXISTS
555 LN_IB_SG_DMA_ADDRESS_EXISTS
557 # A reason argument was added to rdma_reject() in Linux 5.8,
558 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
559 LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
561 #ifdef HAVE_COMPAT_RDMA
563 #undef PACKAGE_TARNAME
564 #undef PACKAGE_VERSION
565 #undef PACKAGE_STRING
566 #undef PACKAGE_BUGREPORT
568 #include <linux/compat-2.6.h>
570 #include <rdma/ib_verbs.h>
571 #include <rdma/ib_cm.h>
572 #include <rdma/rdma_cm.h>
574 rdma_reject(NULL, NULL, 0, 0);
576 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
577 [rdma_reject has 4 arguments])
580 # The FMR pool API was removed in Linux 5.8,
581 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
582 LB_CHECK_COMPILE([if FMR pools API available],
584 #include <rdma/ib_verbs.h>
586 struct ib_fmr fmr = {};
588 AC_DEFINE(HAVE_FMR_POOL_API, 1,
589 [FMR pool API is available])
592 # rdma_connect_locked() was added in Linux 5.10,
593 # commit 071ba4cc559de47160761b9500b72e8fa09d923d
594 # and in MOFED-5.2-2. rdma_connect_locked() must
595 # be called instead of rdma_connect() in
596 # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
597 LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
598 rdma_connect_locked, [
599 #include <rdma/rdma_cm.h>
601 rdma_connect_locked(NULL, NULL);
603 AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
604 [rdma_connect_locked is defined])
607 # ethtool_link_settings was added in Linux 4.6
608 LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
609 ethtool_link_settings, [
610 #include <linux/ethtool.h>
612 struct ethtool_link_ksettings cmd;
614 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
615 [ethtool_link_settings is defined])
618 EXTRA_CHECK_INCLUDE=""
619 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
620 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
621 ]) # ENABLEO2IB != "no"
627 # check whether to use the Gemini Network Interface lnd
629 AC_DEFUN([LN_CONFIG_GNILND], [
630 AC_MSG_CHECKING([whether to enable GNI lnd])
632 AS_HELP_STRING([--enable-gni],
634 [], [enable_gni="no"])
635 AC_MSG_RESULT([$enable_gni])
637 AS_IF([test "x$enable_gni" = xyes], [
638 # GNICPPFLAGS was set in spec file
639 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
640 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
641 LB_CHECK_COMPILE([if GNI kernel headers are present],
643 #include <linux/types.h>
646 gni_cdm_handle_t kgni_domain;
649 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
650 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
655 AC_MSG_ERROR([cannot compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
657 # at this point, we have gnilnd basic support,
658 # now check for extra features
659 LB_CHECK_COMPILE([to use RCA in gnilnd],
661 #include <linux/types.h>
663 #include <krca_lib.h>
665 gni_cdm_handle_t kgni_domain;
667 krca_ticket_t ticket = KRCA_NULL_TICKET;
669 __u32 nid = 0, nic_addr;
670 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
671 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
672 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
673 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
676 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
678 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
680 AC_SUBST(GNICPPFLAGS)
682 ]) # LN_CONFIG_GNILND
687 # check whether to use the kfabric Network Interface lnd
689 AC_DEFUN([LN_CONFIG_KFILND], [
691 AC_HELP_STRING([--with-kfi=<path>], [Kfabric build path for kfilnd]),
693 AC_CHECK_FILE([$with_kfi/Module.symvers],
695 # KFICPPFLAGS was set in spec file
696 KFICPPFLAGS="-I$with_kfi/include"
697 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
698 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $KFICPPFLAGS"
699 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $with_kfi/Module.symvers"
700 LB_CHECK_COMPILE([if kfabric headers are present], KFI_header,
702 #include <kfi_endpoint.h>
704 struct kfi_info *hints;
705 hints = kfi_allocinfo();
708 AC_MSG_NOTICE([adding $with_kfi/Module.symvers to Symbol Path])
709 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $with_kfi/Module.symvers"
711 AC_MSG_ERROR([can't compile kfilnd with given KFICPPFLAGS: $KFICPPFLAGS])
714 AC_MSG_ERROR(["$with_kfi/Module.symvers does not exist"])
717 AC_SUBST(KFICPPFLAGS)
719 AC_SUBST(EXTRA_SYMBOLS)
720 ]) # LN_CONFIG_KFILND
722 # LN_CONFIG_STRSCPY_EXISTS
724 # If strscpy exists, prefer it over strlcpy
726 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
727 tmp_flags="$EXTRA_KCFLAGS"
728 EXTRA_KCFLAGS="-Werror"
729 LB_CHECK_COMPILE([kernel strscpy is available],
731 #include <linux/string.h>
733 strscpy((char *)NULL, (const char *)NULL, 0);
735 AC_DEFINE(HAVE_STRSCPY, 1,
736 [kernel strscpy is available])
738 EXTRA_KCFLAGS="$tmp_flags"
739 ]) # LN_CONFIG_STRSCPY_EXISTS
741 # LN_CONFIG_SOCK_CREATE_KERN
743 # 4.x sock_create_kern() added a first parameter as 'struct net *'
746 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
747 tmp_flags="$EXTRA_KCFLAGS"
748 EXTRA_KCFLAGS="-Werror"
749 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
750 sock_create_kern_net, [
751 #include <linux/net.h>
752 #include <net/net_namespace.h>
754 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
756 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
757 [sock_create_kern use net as first parameter])
759 EXTRA_KCFLAGS="$tmp_flags"
760 ]) # LN_CONFIG_SOCK_CREATE_KERN
763 # LN_CONFIG_SK_DATA_READY
765 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
767 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
768 tmp_flags="$EXTRA_KCFLAGS"
769 EXTRA_KCFLAGS="-Werror"
770 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
772 #include <linux/net.h>
773 #include <net/sock.h>
775 ((struct sock *)0)->sk_data_ready(NULL);
777 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
778 [sk_data_ready uses only one argument])
780 EXTRA_KCFLAGS="$tmp_flags"
781 ]) # LN_CONFIG_SK_DATA_READY
784 # LN_EXPORT_KMAP_TO_PAGE
786 # 3.10 Export kmap_to_page
788 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
789 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
790 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
791 [kmap_to_page is exported by the kernel])])
792 ]) # LN_EXPORT_KMAP_TO_PAG
795 # LN_HAVE_HYPERVISOR_IS_TYPE
797 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
798 # x86/paravirt: Provide a way to check for hypervisors
800 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
801 tmp_flags="$EXTRA_KCFLAGS"
802 EXTRA_KCFLAGS="-Werror"
803 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
804 hypervisor_is_type_exists, [
805 #include <asm/hypervisor.h>
807 (void)hypervisor_is_type(X86_HYPER_NATIVE);
809 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
810 [hypervisor_is_type function exists])
812 EXTRA_KCFLAGS="$tmp_flags"
813 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
816 # LN_HAVE_ORACLE_OFED_EXTENSIONS
820 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
821 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
823 #include <rdma/ib_fmr_pool.h>
825 struct ib_fmr_pool_param param = {
830 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
831 [if Oracle OFED Extensions are enabled])
833 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
836 # LN_CONFIG_SOCK_GETNAME
838 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
839 # does not take the length *int argument and returns the length
841 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
842 tmp_flags="$EXTRA_KCFLAGS"
843 EXTRA_KCFLAGS="-Werror"
844 LB_CHECK_COMPILE([if 'getname' has two args],
845 kern_sock_getname_2args, [
846 #include <linux/net.h>
848 kernel_getsockname(NULL, NULL);
850 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
851 ['getname' has two args])
853 EXTRA_KCFLAGS="$tmp_flags"
854 ]) # LN_CONFIG_SOCK_GETNAME
857 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
859 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
860 # and kernel 4.18.0-193.el8:
861 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
862 # and removed for_ifa and endfor_ifa.
863 # Use the _rntl variant as the current locking is rtnl.
865 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
866 tmp_flags="$EXTRA_KCFLAGS"
867 EXTRA_KCFLAGS="-Werror"
868 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
869 in_dev_for_each_ifa_rtnl_test, [
870 #include <linux/inetdevice.h>
872 const struct in_ifaddr *ifa = NULL;
873 struct in_device *in_dev = NULL;
875 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
877 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
878 ['in_dev_for_each_ifa_rtnl' is defined])
880 EXTRA_KCFLAGS="$tmp_flags"
881 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
884 # LN_IB_DEVICE_OPS_EXISTS
886 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
887 # RDMA/core: Introduce ib_device_ops
888 # ... introduces the ib_device_ops structure that defines all the
889 # InfiniBand device operations in one place ...
891 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
892 tmp_flags="$EXTRA_KCFLAGS"
893 EXTRA_KCFLAGS="-Werror"
894 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
895 ib_device_ops_test, [
896 #include <rdma/ib_verbs.h>
898 int x = offsetof(struct ib_device_ops, unmap_fmr);
902 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
903 [if struct ib_device_ops is defined])
905 EXTRA_KCFLAGS="$tmp_flags"
906 ]) # LN_IB_DEVICE_OPS_EXISTS
909 # LN_IB_SG_DMA_ADDRESS_EXISTS
911 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
912 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
913 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
915 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
916 tmp_flags="$EXTRA_KCFLAGS"
917 EXTRA_KCFLAGS="-Werror"
918 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
919 ib_sg_dma_address_test, [
920 #include <rdma/ib_verbs.h>
922 u64 x = ib_sg_dma_address(NULL, NULL);
926 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
927 [if ib_sg_dma_address wrapper exists])
929 EXTRA_KCFLAGS="$tmp_flags"
930 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
936 AC_DEFUN([LN_USR_RDMA], [
937 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
938 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
939 #include <rdma/rdma_user_cm.h>
942 int x = (int)RDMA_PS_TCP;
946 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
947 [RDMA_PS_TCP exists])
952 AC_DEFUN([LN_PROG_LINUX_SRC], [])
953 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
958 # LNet linux kernel checks
960 AC_DEFUN([LN_PROG_LINUX], [
961 AC_MSG_NOTICE([LNet kernel checks
962 ==============================================================================])
967 LN_CONFIG_STRSCPY_EXISTS
970 LN_EXPORT_KMAP_TO_PAGE
972 LN_CONFIG_SK_DATA_READY
974 LN_CONFIG_SOCK_CREATE_KERN
976 LN_HAVE_HYPERVISOR_IS_TYPE
977 LN_HAVE_ORACLE_OFED_EXTENSIONS
979 LN_CONFIG_SOCK_GETNAME
980 # 5.3 and 4.18.0-193.el8
981 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
987 # default paths for installed files
989 AC_DEFUN([LN_PATH_DEFAULTS], [
990 ]) # LN_PATH_DEFAULTS
995 # other configure checks
997 AC_DEFUN([LN_CONFIGURE], [
998 AC_MSG_NOTICE([LNet core checks
999 ==============================================================================])
1002 AS_HELP_STRING([--with-cuda=path],
1003 [Use a CUDA sources.]),
1004 [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
1005 [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
1009 AS_HELP_STRING([--with-gds=path],
1010 [Use a gds sources.]),
1011 [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
1012 [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
1015 AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
1016 LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
1018 AC_MSG_RESULT([CUDA path is $CUDA_PATH])
1021 [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
1024 LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
1026 LB_CHECK_FILE([$GDS_PATH/config-host.h], [
1027 AC_MSG_RESULT([GDS path is $GDS_PATH])
1029 AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
1034 AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
1038 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
1039 AS_IF([test "x$enable_dist" = xno], [
1040 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
1043 AC_CHECK_LIB([nl-3], [nla_get_s32], [
1044 AC_DEFINE(HAVE_NLA_GET_S32, 1,
1045 [libnl3 supports nla_get_s32])
1049 AC_CHECK_LIB([nl-3], [nla_get_s64], [
1050 AC_DEFINE(HAVE_NLA_GET_S64, 1,
1051 [libnl3 supports nla_get_s64])
1058 AC_DEFUN([LN_USR_NLMSGERR], [
1059 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
1060 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1061 #include <linux/netlink.h>
1064 int x = (int)NLMSGERR_ATTR_MAX;
1068 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
1069 ['enum nlmsgerr_attrs' exists])
1071 ]) # LN_USR_NLMGSERR
1073 # lnet/utils/portals.c
1074 AC_CHECK_HEADERS([netdb.h])
1075 AC_CHECK_FUNCS([gethostbyname])
1077 # lnet/utils/wirecheck.c
1078 AC_CHECK_FUNCS([strnlen])
1080 # -------- Check for required packages --------------
1082 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1083 AC_ARG_ENABLE(efence,
1084 AS_HELP_STRING([--enable-efence],
1085 [use efence library]),
1086 [], [enable_efence="no"])
1087 AC_MSG_RESULT([$enable_efence])
1090 AS_IF([test "$enable_efence" = yes], [
1091 LIBEFENCE="-lefence"
1092 AC_DEFINE(HAVE_LIBEFENCE, 1,
1093 [libefence support is requested])
1105 # AM_CONDITIONAL defines for lnet
1107 AC_DEFUN([LN_CONDITIONALS], [
1108 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1109 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1110 AM_CONDITIONAL(BUILD_KFILND, test x$KFILND = "xkfilnd")
1111 ]) # LN_CONDITIONALS
1116 # files that should be generated with AC_OUTPUT
1118 AC_DEFUN([LN_CONFIG_FILES], [
1122 lnet/autoconf/Makefile
1124 lnet/include/Makefile
1125 lnet/include/lnet/Makefile
1126 lnet/include/uapi/linux/lnet/Makefile
1128 lnet/klnds/autoMakefile
1129 lnet/klnds/o2iblnd/Makefile
1130 lnet/klnds/o2iblnd/autoMakefile
1131 lnet/klnds/gnilnd/Makefile
1132 lnet/klnds/gnilnd/autoMakefile
1133 lnet/klnds/socklnd/Makefile
1134 lnet/klnds/socklnd/autoMakefile
1135 lnet/klnds/kfilnd/Makefile
1136 lnet/klnds/kfilnd/autoMakefile
1138 lnet/lnet/autoMakefile
1139 lnet/selftest/Makefile
1140 lnet/selftest/autoMakefile
1142 lnet/utils/lnetconfig/Makefile
1144 ]) # LN_CONFIG_FILES