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 OFED_INFO="ofed_info | awk '{print \[$]2}'"
64 LSPKG="dpkg --listfiles"
69 O2IBPATHS=$(eval $OFED_INFO |
70 egrep -w 'mlnx-ofed-kernel-dkms|mlnx-ofa_kernel-devel|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' |
71 xargs $LSPKG | grep -v 'ofa_kernel-' | grep rdma_cm.h | sed 's/\/include\/rdma\/rdma_cm.h//')
72 AS_IF([test -z "$O2IBPATHS"], [
74 You seem to have an OFED installed but have not installed it's devel package.
75 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
76 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.
79 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
81 It appears that you have multiple OFED versions installed.
82 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.
83 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.
86 if test -e $O2IBPATHS/${LINUXRELEASE}; then
87 O2IBPATHS=$O2IBPATHS/${LINUXRELEASE}
88 elif test -e $O2IBPATHS/default; then
89 O2IBPATHS=$O2IBPATHS/default
93 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
99 *) O2IBPATHS=$with_o2ib
100 ENABLEO2IB="withpath"
105 AS_IF([test $ENABLEO2IB = "no"], [
107 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
108 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
111 for O2IBPATH in $O2IBPATHS; do
112 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
113 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
114 -f ${O2IBPATH}/include/rdma/ib_verbs.h \)], [
119 if ! $o2ib_found; then
122 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
123 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
124 *) AC_MSG_ERROR([internal error]) ;;
128 compatrdma_found=false
129 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
131 compatrdma_found=true
132 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
133 EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
134 if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
135 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
140 if ! $compatrdma_found; then
141 if test -f "$O2IBPATH/config.mk"; then
142 . "$O2IBPATH/config.mk"
143 elif test -f "$O2IBPATH/ofed_patch.mk"; then
144 . "$O2IBPATH/ofed_patch.mk"
146 elif test -z "$COMPAT_AUTOCONF"; then
148 if test "x$RHEL_KERNEL" = xyes; then
149 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
150 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
151 while test "$I" -ge 0; do
152 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
155 elif test "x$SUSE_KERNEL" = xyes; then
156 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
157 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
161 AC_MSG_CHECKING([whether to use any OFED backport headers])
162 if test -n "$BACKPORT_INCLUDES"; then
164 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
165 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
171 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
172 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include -I$O2IBPATH/include/uapi"
173 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
174 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
175 openib_gen2_support, [
176 #ifdef HAVE_COMPAT_RDMA
178 #undef PACKAGE_TARNAME
179 #undef PACKAGE_VERSION
180 #undef PACKAGE_STRING
181 #undef PACKAGE_BUGREPORT
183 #include <linux/compat-2.6.h>
185 #include <linux/version.h>
186 #include <linux/pci.h>
187 #include <linux/gfp.h>
188 #include <rdma/rdma_cm.h>
189 #include <rdma/ib_cm.h>
190 #include <rdma/ib_verbs.h>
192 struct rdma_cm_id *cm_idi __attribute__ ((unused));
193 struct rdma_conn_param conn_param __attribute__ ((unused));
194 struct ib_device_attr device_attr __attribute__ ((unused));
195 struct ib_qp_attr qp_attr __attribute__ ((unused));
196 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
197 rdma_destroy_id(NULL);
202 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
203 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
204 *) AC_MSG_ERROR([internal error]) ;;
207 # we know at this point that the found OFED source is good
209 if test -f $O2IBPATH/Module.symvers; then
210 O2IB_SYMVER=$O2IBPATH/Module.symvers
211 elif test "x$SUSE_KERNEL" = "xyes"; then
212 O2IB_SYMVER=$(find ${O2IBPATH}* -name Module.symvers)
213 # Select only the current 'flavor' if there is more than 1
214 NUM_AVAIL=$(find ${O2IBPATH}* -name Module.symvers | wc -l)
215 if test ${NUM_AVAIL} -gt 1; then
216 PREFER=$(basename ${LINUX_OBJ})
217 for F in $(find ${O2IBPATH}-obj -name Module.symvers)
219 maybe=$(echo $F | grep "/${PREFER}")
220 if test "x$maybe" != "x"; then
225 elif test -f $LINUX_OBJ/Module.symvers; then
226 # Debian symvers is in the arch tree
227 O2IB_SYMVER=$LINUX_OBJ/Module.symvers
229 if test -n "$O2IB_SYMVER"; then
230 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
231 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
232 AC_SUBST(EXTRA_SYMBOLS)
234 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
237 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
238 linux_kthread_worker, [
239 #ifdef HAVE_COMPAT_RDMA
241 #undef PACKAGE_TARNAME
242 #undef PACKAGE_VERSION
243 #undef PACKAGE_STRING
244 #undef PACKAGE_BUGREPORT
246 #include <linux/compat-2.6.h>
248 #include <linux/kthread.h>
250 struct kthread_work *kth_wrk = NULL;
251 flush_kthread_work(kth_wrk);
253 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
254 if test -z "$COMPAT_AUTOCONF"; then
255 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
258 EXTRA_CHECK_INCLUDE=""
261 AC_SUBST(EXTRA_OFED_CONFIG)
262 AC_SUBST(EXTRA_OFED_INCLUDE)
267 AS_IF([test $ENABLEO2IB != "no"], [
268 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
269 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
271 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
272 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
273 rdma_create_id_4args, [
274 #ifdef HAVE_COMPAT_RDMA
276 #undef PACKAGE_TARNAME
277 #undef PACKAGE_VERSION
278 #undef PACKAGE_STRING
279 #undef PACKAGE_BUGREPORT
281 #include <linux/compat-2.6.h>
283 #include <rdma/rdma_cm.h>
285 rdma_create_id(NULL, NULL, 0, 0);
287 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
288 [rdma_create_id wants 4 args])
291 # 4.4 added network namespace parameter for rdma_create_id()
292 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
293 rdma_create_id_5args, [
294 #ifdef HAVE_COMPAT_RDMA
296 #undef PACKAGE_TARNAME
297 #undef PACKAGE_VERSION
298 #undef PACKAGE_STRING
299 #undef PACKAGE_BUGREPORT
301 #include <linux/compat-2.6.h>
303 #include <rdma/rdma_cm.h>
305 rdma_create_id(NULL, NULL, NULL, 0, 0);
307 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
308 [rdma_create_id wants 5 args])
311 # 4.2 introduced struct ib_cq_init_attr which is used
312 # by ib_create_cq(). Note some OFED stacks only keep
313 # their headers in sync with latest kernels but not
314 # the functionality which means for infiniband testing
315 # we need to always test functionality testings.
316 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
318 #ifdef HAVE_COMPAT_RDMA
320 #undef PACKAGE_TARNAME
321 #undef PACKAGE_VERSION
322 #undef PACKAGE_STRING
323 #undef PACKAGE_BUGREPORT
325 #include <linux/compat-2.6.h>
327 #include <rdma/ib_verbs.h>
329 struct ib_cq_init_attr cq_attr;
331 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
333 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
334 [struct ib_cq_init_attr is used by ib_create_cq])
337 # 4.3 removed ib_alloc_fast_reg_mr()
338 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
339 ib_alloc_fast_reg_mr, [
340 #ifdef HAVE_COMPAT_RDMA
342 #undef PACKAGE_TARNAME
343 #undef PACKAGE_VERSION
344 #undef PACKAGE_STRING
345 #undef PACKAGE_BUGREPORT
347 #include <linux/compat-2.6.h>
349 #include <rdma/ib_verbs.h>
351 ib_alloc_fast_reg_mr(NULL, 0);
353 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
354 [ib_alloc_fast_reg_mr is defined])
357 # 4.9 must stop using ib_get_dma_mr and the global MR
358 # We then have to use FMR/Fastreg for all RDMA.
359 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
361 #ifdef HAVE_COMPAT_RDMA
363 #undef PACKAGE_TARNAME
364 #undef PACKAGE_VERSION
365 #undef PACKAGE_STRING
366 #undef PACKAGE_BUGREPORT
368 #include <linux/compat-2.6.h>
370 #include <rdma/ib_verbs.h>
372 ib_get_dma_mr(NULL, 0);
374 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
375 [ib_get_dma_mr is defined])
378 # In v4.4 Linux kernel,
379 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
380 # split up struct ib_send_wr so that all non-trivial verbs
381 # use their own structure which embedds struct ib_send_wr.
382 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
384 #ifdef HAVE_COMPAT_RDMA
386 #undef PACKAGE_TARNAME
387 #undef PACKAGE_VERSION
388 #undef PACKAGE_STRING
389 #undef PACKAGE_BUGREPORT
391 #include <linux/compat-2.6.h>
393 #include <rdma/ib_verbs.h>
395 struct ib_rdma_wr *wr __attribute__ ((unused));
399 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
400 [struct ib_rdma_wr is defined])
403 # new fast registration API introduced in 4.4
404 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
405 ib_map_mr_sg_4args, [
406 #ifdef HAVE_COMPAT_RDMA
408 #undef PACKAGE_TARNAME
409 #undef PACKAGE_VERSION
410 #undef PACKAGE_STRING
411 #undef PACKAGE_BUGREPORT
413 #include <linux/compat-2.6.h>
415 #include <rdma/ib_verbs.h>
417 ib_map_mr_sg(NULL, NULL, 0, 0);
419 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
420 [ib_map_mr_sg exists])
423 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
424 # in kernel 4.7 (and RHEL 7.3)
425 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
426 ib_map_mr_sg_5args, [
427 #ifdef HAVE_COMPAT_RDMA
429 #undef PACKAGE_TARNAME
430 #undef PACKAGE_VERSION
431 #undef PACKAGE_STRING
432 #undef PACKAGE_BUGREPORT
434 #include <linux/compat-2.6.h>
436 #include <rdma/ib_verbs.h>
438 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
440 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
441 [ib_map_mr_sg exists])
442 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
443 [ib_map_mr_sg has 5 arguments])
446 # ib_query_device() removed in 4.5
447 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
449 #ifdef HAVE_COMPAT_RDMA
451 #undef PACKAGE_TARNAME
452 #undef PACKAGE_VERSION
453 #undef PACKAGE_STRING
454 #undef PACKAGE_BUGREPORT
456 #include <linux/compat-2.6.h>
458 #include <rdma/ib_verbs.h>
460 struct ib_device dev;
461 struct ib_device_attr dev_attr = {};
462 dev.attrs = dev_attr;
464 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
465 [struct ib_device.attrs is defined])
468 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
469 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
470 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
472 #ifdef HAVE_COMPAT_RDMA
474 #undef PACKAGE_TARNAME
475 #undef PACKAGE_VERSION
476 #undef PACKAGE_STRING
477 #undef PACKAGE_BUGREPORT
479 #include <linux/compat-2.6.h>
481 #include <rdma/ib_verbs.h>
483 ib_alloc_pd(NULL, 0);
485 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
486 [ib_alloc_pd has 2 arguments])
489 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
491 #ifdef HAVE_COMPAT_RDMA
493 #undef PACKAGE_TARNAME
494 #undef PACKAGE_VERSION
495 #undef PACKAGE_STRING
496 #undef PACKAGE_BUGREPORT
498 #include <linux/compat-2.6.h>
500 #include <rdma/ib_verbs.h>
502 (void)ib_inc_rkey(0);
504 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
505 [function ib_inc_rkey exist])
508 # In MOFED 4.6, the second and third parameters for
509 # ib_post_send() and ib_post_recv() are declared with
511 tmp_flags="$EXTRA_KCFLAGS"
512 EXTRA_KCFLAGS="-Werror"
513 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
514 ib_post_send_recv_const, [
515 #ifdef HAVE_COMPAT_RDMA
517 #undef PACKAGE_TARNAME
518 #undef PACKAGE_VERSION
519 #undef PACKAGE_STRING
520 #undef PACKAGE_BUGREPORT
522 #include <linux/compat-2.6.h>
524 #include <rdma/ib_verbs.h>
526 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
527 (const struct ib_send_wr **)NULL);
529 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
530 [ib_post_send and ib_post_recv have const parameters])
532 EXTRA_KCFLAGS="$tmp_flags"
535 LN_IB_DEVICE_OPS_EXISTS
537 LN_IB_SG_DMA_ADDRESS_EXISTS
539 # A reason argument was added to rdma_reject() in Linux 5.8,
540 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
541 LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
543 #ifdef HAVE_COMPAT_RDMA
545 #undef PACKAGE_TARNAME
546 #undef PACKAGE_VERSION
547 #undef PACKAGE_STRING
548 #undef PACKAGE_BUGREPORT
550 #include <linux/compat-2.6.h>
552 #include <rdma/ib_verbs.h>
553 #include <rdma/ib_cm.h>
554 #include <rdma/rdma_cm.h>
556 rdma_reject(NULL, NULL, 0, 0);
558 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
559 [rdma_reject has 4 arguments])
562 # The FMR pool API was removed in Linux 5.8,
563 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
564 LB_CHECK_COMPILE([if FMR pools API available],
566 #include <rdma/ib_verbs.h>
568 struct ib_fmr fmr = {};
570 AC_DEFINE(HAVE_FMR_POOL_API, 1,
571 [FMR pool API is available])
574 # rdma_connect_locked() was added in Linux 5.10,
575 # commit 071ba4cc559de47160761b9500b72e8fa09d923d
576 # and in MOFED-5.2-2. rdma_connect_locked() must
577 # be called instead of rdma_connect() in
578 # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
579 LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
580 rdma_connect_locked, [
581 #include <rdma/rdma_cm.h>
583 rdma_connect_locked(NULL, NULL);
585 AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
586 [rdma_connect_locked is defined])
589 # ethtool_link_settings was added in Linux 4.6
590 LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
591 ethtool_link_settings, [
592 #include <linux/ethtool.h>
594 struct ethtool_link_ksettings cmd;
596 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
597 [ethtool_link_settings is defined])
600 EXTRA_CHECK_INCLUDE=""
601 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
602 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
603 ]) # ENABLEO2IB != "no"
609 # check whether to use the Gemini Network Interface lnd
611 AC_DEFUN([LN_CONFIG_GNILND], [
612 AC_MSG_CHECKING([whether to enable GNI lnd])
614 AS_HELP_STRING([--enable-gni],
616 [], [enable_gni="no"])
617 AC_MSG_RESULT([$enable_gni])
619 AS_IF([test "x$enable_gni" = xyes], [
620 # GNICPPFLAGS was set in spec file
621 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
622 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
623 LB_CHECK_COMPILE([if GNI kernel headers are present],
625 #include <linux/types.h>
628 gni_cdm_handle_t kgni_domain;
631 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
632 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
637 AC_MSG_ERROR([cannot compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
639 # at this point, we have gnilnd basic support,
640 # now check for extra features
641 LB_CHECK_COMPILE([to use RCA in gnilnd],
643 #include <linux/types.h>
645 #include <krca_lib.h>
647 gni_cdm_handle_t kgni_domain;
649 krca_ticket_t ticket = KRCA_NULL_TICKET;
651 __u32 nid = 0, nic_addr;
652 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
653 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
654 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
655 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
658 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
660 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
662 AC_SUBST(GNICPPFLAGS)
664 ]) # LN_CONFIG_GNILND
669 # check whether to use the kfabric Network Interface lnd
671 AC_DEFUN([LN_CONFIG_KFILND], [
673 AC_HELP_STRING([--with-kfi=<path>], [Kfabric build path for kfilnd]),
675 AC_CHECK_FILE([$with_kfi/Module.symvers],
677 # KFICPPFLAGS was set in spec file
678 KFICPPFLAGS="-I$with_kfi/include"
679 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
680 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $KFICPPFLAGS"
681 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $with_kfi/Module.symvers"
682 LB_CHECK_COMPILE([if kfabric headers are present], KFI_header,
684 #include <kfi_endpoint.h>
686 struct kfi_info *hints;
687 hints = kfi_allocinfo();
690 AC_MSG_NOTICE([adding $with_kfi/Module.symvers to Symbol Path])
691 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $with_kfi/Module.symvers"
693 AC_MSG_ERROR([can't compile kfilnd with given KFICPPFLAGS: $KFICPPFLAGS])
696 AC_MSG_ERROR(["$with_kfi/Module.symvers does not exist"])
699 AC_SUBST(KFICPPFLAGS)
701 AC_SUBST(EXTRA_SYMBOLS)
702 ]) # LN_CONFIG_KFILND
704 # LN_CONFIG_STRSCPY_EXISTS
706 # If strscpy exists, prefer it over strlcpy
708 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
709 tmp_flags="$EXTRA_KCFLAGS"
710 EXTRA_KCFLAGS="-Werror"
711 LB_CHECK_COMPILE([kernel strscpy is available],
713 #include <linux/string.h>
715 strscpy((char *)NULL, (const char *)NULL, 0);
717 AC_DEFINE(HAVE_STRSCPY, 1,
718 [kernel strscpy is available])
720 EXTRA_KCFLAGS="$tmp_flags"
721 ]) # LN_CONFIG_STRSCPY_EXISTS
723 # LN_CONFIG_SOCK_CREATE_KERN
725 # 4.x sock_create_kern() added a first parameter as 'struct net *'
728 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
729 tmp_flags="$EXTRA_KCFLAGS"
730 EXTRA_KCFLAGS="-Werror"
731 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
732 sock_create_kern_net, [
733 #include <linux/net.h>
734 #include <net/net_namespace.h>
736 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
738 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
739 [sock_create_kern use net as first parameter])
741 EXTRA_KCFLAGS="$tmp_flags"
742 ]) # LN_CONFIG_SOCK_CREATE_KERN
745 # LN_CONFIG_SK_DATA_READY
747 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
749 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
750 tmp_flags="$EXTRA_KCFLAGS"
751 EXTRA_KCFLAGS="-Werror"
752 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
754 #include <linux/net.h>
755 #include <net/sock.h>
757 ((struct sock *)0)->sk_data_ready(NULL);
759 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
760 [sk_data_ready uses only one argument])
762 EXTRA_KCFLAGS="$tmp_flags"
763 ]) # LN_CONFIG_SK_DATA_READY
766 # LN_EXPORT_KMAP_TO_PAGE
768 # 3.10 Export kmap_to_page
770 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
771 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
772 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
773 [kmap_to_page is exported by the kernel])])
774 ]) # LN_EXPORT_KMAP_TO_PAG
777 # LN_HAVE_HYPERVISOR_IS_TYPE
779 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
780 # x86/paravirt: Provide a way to check for hypervisors
782 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
783 tmp_flags="$EXTRA_KCFLAGS"
784 EXTRA_KCFLAGS="-Werror"
785 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
786 hypervisor_is_type_exists, [
787 #include <asm/hypervisor.h>
789 (void)hypervisor_is_type(X86_HYPER_NATIVE);
791 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
792 [hypervisor_is_type function exists])
794 EXTRA_KCFLAGS="$tmp_flags"
795 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
798 # LN_HAVE_ORACLE_OFED_EXTENSIONS
802 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
803 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
805 #include <rdma/ib_fmr_pool.h>
807 struct ib_fmr_pool_param param = {
812 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
813 [if Oracle OFED Extensions are enabled])
815 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
818 # LN_CONFIG_SOCK_GETNAME
820 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
821 # does not take the length *int argument and returns the length
823 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
824 tmp_flags="$EXTRA_KCFLAGS"
825 EXTRA_KCFLAGS="-Werror"
826 LB_CHECK_COMPILE([if 'getname' has two args],
827 kern_sock_getname_2args, [
828 #include <linux/net.h>
830 kernel_getsockname(NULL, NULL);
832 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
833 ['getname' has two args])
835 EXTRA_KCFLAGS="$tmp_flags"
836 ]) # LN_CONFIG_SOCK_GETNAME
839 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
841 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
842 # and kernel 4.18.0-193.el8:
843 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
844 # and removed for_ifa and endfor_ifa.
845 # Use the _rntl variant as the current locking is rtnl.
847 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
848 tmp_flags="$EXTRA_KCFLAGS"
849 EXTRA_KCFLAGS="-Werror"
850 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
851 in_dev_for_each_ifa_rtnl_test, [
852 #include <linux/inetdevice.h>
854 const struct in_ifaddr *ifa = NULL;
855 struct in_device *in_dev = NULL;
857 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
859 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
860 ['in_dev_for_each_ifa_rtnl' is defined])
862 EXTRA_KCFLAGS="$tmp_flags"
863 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
866 # LN_IB_DEVICE_OPS_EXISTS
868 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
869 # RDMA/core: Introduce ib_device_ops
870 # ... introduces the ib_device_ops structure that defines all the
871 # InfiniBand device operations in one place ...
873 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
874 tmp_flags="$EXTRA_KCFLAGS"
875 EXTRA_KCFLAGS="-Werror"
876 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
877 ib_device_ops_test, [
878 #include <rdma/ib_verbs.h>
880 int x = offsetof(struct ib_device_ops, unmap_fmr);
884 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
885 [if struct ib_device_ops is defined])
887 EXTRA_KCFLAGS="$tmp_flags"
888 ]) # LN_IB_DEVICE_OPS_EXISTS
891 # LN_IB_SG_DMA_ADDRESS_EXISTS
893 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
894 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
895 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
897 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
898 tmp_flags="$EXTRA_KCFLAGS"
899 EXTRA_KCFLAGS="-Werror"
900 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
901 ib_sg_dma_address_test, [
902 #include <rdma/ib_verbs.h>
904 u64 x = ib_sg_dma_address(NULL, NULL);
908 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
909 [if ib_sg_dma_address wrapper exists])
911 EXTRA_KCFLAGS="$tmp_flags"
912 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
918 AC_DEFUN([LN_USR_RDMA], [
919 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
920 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
921 #include <rdma/rdma_user_cm.h>
924 int x = (int)RDMA_PS_TCP;
928 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
929 [RDMA_PS_TCP exists])
934 AC_DEFUN([LN_PROG_LINUX_SRC], [])
935 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
940 # LNet linux kernel checks
942 AC_DEFUN([LN_PROG_LINUX], [
943 AC_MSG_NOTICE([LNet kernel checks
944 ==============================================================================])
949 LN_CONFIG_STRSCPY_EXISTS
952 LN_EXPORT_KMAP_TO_PAGE
954 LN_CONFIG_SK_DATA_READY
956 LN_CONFIG_SOCK_CREATE_KERN
958 LN_HAVE_HYPERVISOR_IS_TYPE
959 LN_HAVE_ORACLE_OFED_EXTENSIONS
961 LN_CONFIG_SOCK_GETNAME
962 # 5.3 and 4.18.0-193.el8
963 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
969 # default paths for installed files
971 AC_DEFUN([LN_PATH_DEFAULTS], [
972 ]) # LN_PATH_DEFAULTS
977 # other configure checks
979 AC_DEFUN([LN_CONFIGURE], [
980 AC_MSG_NOTICE([LNet core checks
981 ==============================================================================])
984 AS_HELP_STRING([--with-cuda=path],
985 [Use a CUDA sources.]),
986 [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
987 [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
991 AS_HELP_STRING([--with-gds=path],
992 [Use a gds sources.]),
993 [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
994 [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
997 AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
998 LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
1000 AC_MSG_RESULT([CUDA path is $CUDA_PATH])
1003 [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
1006 LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
1008 LB_CHECK_FILE([$GDS_PATH/config-host.h], [
1009 AC_MSG_RESULT([GDS path is $GDS_PATH])
1011 AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
1016 AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
1020 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
1021 AS_IF([test "x$enable_dist" = xno], [
1022 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
1025 AC_CHECK_LIB([nl-3], [nla_get_s32], [
1026 AC_DEFINE(HAVE_NLA_GET_S32, 1,
1027 [libnl3 supports nla_get_s32])
1031 AC_CHECK_LIB([nl-3], [nla_get_s64], [
1032 AC_DEFINE(HAVE_NLA_GET_S64, 1,
1033 [libnl3 supports nla_get_s64])
1040 AC_DEFUN([LN_USR_NLMSGERR], [
1041 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
1042 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1043 #include <linux/netlink.h>
1046 int x = (int)NLMSGERR_ATTR_MAX;
1050 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
1051 ['enum nlmsgerr_attrs' exists])
1053 ]) # LN_USR_NLMGSERR
1055 # lnet/utils/portals.c
1056 AC_CHECK_HEADERS([netdb.h])
1057 AC_CHECK_FUNCS([gethostbyname])
1059 # lnet/utils/wirecheck.c
1060 AC_CHECK_FUNCS([strnlen])
1062 # -------- Check for required packages --------------
1064 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1065 AC_ARG_ENABLE(efence,
1066 AS_HELP_STRING([--enable-efence],
1067 [use efence library]),
1068 [], [enable_efence="no"])
1069 AC_MSG_RESULT([$enable_efence])
1072 AS_IF([test "$enable_efence" = yes], [
1073 LIBEFENCE="-lefence"
1074 AC_DEFINE(HAVE_LIBEFENCE, 1,
1075 [libefence support is requested])
1087 # AM_CONDITIONAL defines for lnet
1089 AC_DEFUN([LN_CONDITIONALS], [
1090 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1091 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1092 AM_CONDITIONAL(BUILD_KFILND, test x$KFILND = "xkfilnd")
1093 ]) # LN_CONDITIONALS
1098 # files that should be generated with AC_OUTPUT
1100 AC_DEFUN([LN_CONFIG_FILES], [
1104 lnet/autoconf/Makefile
1106 lnet/include/Makefile
1107 lnet/include/lnet/Makefile
1108 lnet/include/uapi/linux/lnet/Makefile
1110 lnet/klnds/autoMakefile
1111 lnet/klnds/o2iblnd/Makefile
1112 lnet/klnds/o2iblnd/autoMakefile
1113 lnet/klnds/gnilnd/Makefile
1114 lnet/klnds/gnilnd/autoMakefile
1115 lnet/klnds/socklnd/Makefile
1116 lnet/klnds/socklnd/autoMakefile
1117 lnet/klnds/kfilnd/Makefile
1118 lnet/klnds/kfilnd/autoMakefile
1120 lnet/lnet/autoMakefile
1121 lnet/selftest/Makefile
1122 lnet/selftest/autoMakefile
1124 lnet/utils/lnetconfig/Makefile
1126 ]) # LN_CONFIG_FILES