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
666 # LN_CONFIG_STRSCPY_EXISTS
668 # If strscpy exists, prefer it over strlcpy
670 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
671 tmp_flags="$EXTRA_KCFLAGS"
672 EXTRA_KCFLAGS="-Werror"
673 LB_CHECK_COMPILE([kernel strscpy is available],
675 #include <linux/string.h>
677 strscpy((char *)NULL, (const char *)NULL, 0);
679 AC_DEFINE(HAVE_STRSCPY, 1,
680 [kernel strscpy is available])
682 EXTRA_KCFLAGS="$tmp_flags"
683 ]) # LN_CONFIG_STRSCPY_EXISTS
685 # LN_CONFIG_SOCK_CREATE_KERN
687 # 4.x sock_create_kern() added a first parameter as 'struct net *'
690 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
691 tmp_flags="$EXTRA_KCFLAGS"
692 EXTRA_KCFLAGS="-Werror"
693 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
694 sock_create_kern_net, [
695 #include <linux/net.h>
696 #include <net/net_namespace.h>
698 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
700 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
701 [sock_create_kern use net as first parameter])
703 EXTRA_KCFLAGS="$tmp_flags"
704 ]) # LN_CONFIG_SOCK_CREATE_KERN
707 # LN_CONFIG_SK_DATA_READY
709 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
711 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
712 tmp_flags="$EXTRA_KCFLAGS"
713 EXTRA_KCFLAGS="-Werror"
714 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
716 #include <linux/net.h>
717 #include <net/sock.h>
719 ((struct sock *)0)->sk_data_ready(NULL);
721 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
722 [sk_data_ready uses only one argument])
724 EXTRA_KCFLAGS="$tmp_flags"
725 ]) # LN_CONFIG_SK_DATA_READY
728 # LN_EXPORT_KMAP_TO_PAGE
730 # 3.10 Export kmap_to_page
732 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
733 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
734 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
735 [kmap_to_page is exported by the kernel])])
736 ]) # LN_EXPORT_KMAP_TO_PAG
739 # LN_HAVE_HYPERVISOR_IS_TYPE
741 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
742 # x86/paravirt: Provide a way to check for hypervisors
744 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
745 tmp_flags="$EXTRA_KCFLAGS"
746 EXTRA_KCFLAGS="-Werror"
747 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
748 hypervisor_is_type_exists, [
749 #include <asm/hypervisor.h>
751 (void)hypervisor_is_type(X86_HYPER_NATIVE);
753 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
754 [hypervisor_is_type function exists])
756 EXTRA_KCFLAGS="$tmp_flags"
757 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
760 # LN_HAVE_ORACLE_OFED_EXTENSIONS
764 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
765 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
767 #include <rdma/ib_fmr_pool.h>
769 struct ib_fmr_pool_param param = {
774 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
775 [if Oracle OFED Extensions are enabled])
777 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
780 # LN_CONFIG_SOCK_GETNAME
782 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
783 # does not take the length *int argument and returns the length
785 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
786 tmp_flags="$EXTRA_KCFLAGS"
787 EXTRA_KCFLAGS="-Werror"
788 LB_CHECK_COMPILE([if 'getname' has two args],
789 kern_sock_getname_2args, [
790 #include <linux/net.h>
792 kernel_getsockname(NULL, NULL);
794 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
795 ['getname' has two args])
797 EXTRA_KCFLAGS="$tmp_flags"
798 ]) # LN_CONFIG_SOCK_GETNAME
801 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
803 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
804 # and kernel 4.18.0-193.el8:
805 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
806 # and removed for_ifa and endfor_ifa.
807 # Use the _rntl variant as the current locking is rtnl.
809 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
810 tmp_flags="$EXTRA_KCFLAGS"
811 EXTRA_KCFLAGS="-Werror"
812 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
813 in_dev_for_each_ifa_rtnl_test, [
814 #include <linux/inetdevice.h>
816 const struct in_ifaddr *ifa = NULL;
817 struct in_device *in_dev = NULL;
819 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
821 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
822 ['in_dev_for_each_ifa_rtnl' is defined])
824 EXTRA_KCFLAGS="$tmp_flags"
825 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
828 # LN_IB_DEVICE_OPS_EXISTS
830 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
831 # RDMA/core: Introduce ib_device_ops
832 # ... introduces the ib_device_ops structure that defines all the
833 # InfiniBand device operations in one place ...
835 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
836 tmp_flags="$EXTRA_KCFLAGS"
837 EXTRA_KCFLAGS="-Werror"
838 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
839 ib_device_ops_test, [
840 #include <rdma/ib_verbs.h>
842 int x = offsetof(struct ib_device_ops, unmap_fmr);
846 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
847 [if struct ib_device_ops is defined])
849 EXTRA_KCFLAGS="$tmp_flags"
850 ]) # LN_IB_DEVICE_OPS_EXISTS
853 # LN_IB_SG_DMA_ADDRESS_EXISTS
855 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
856 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
857 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
859 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
860 tmp_flags="$EXTRA_KCFLAGS"
861 EXTRA_KCFLAGS="-Werror"
862 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
863 ib_sg_dma_address_test, [
864 #include <rdma/ib_verbs.h>
866 u64 x = ib_sg_dma_address(NULL, NULL);
870 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
871 [if ib_sg_dma_address wrapper exists])
873 EXTRA_KCFLAGS="$tmp_flags"
874 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
880 AC_DEFUN([LN_USR_RDMA], [
881 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
882 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
883 #include <rdma/rdma_user_cm.h>
886 int x = (int)RDMA_PS_TCP;
890 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
891 [RDMA_PS_TCP exists])
896 AC_DEFUN([LN_PROG_LINUX_SRC], [])
897 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
902 # LNet linux kernel checks
904 AC_DEFUN([LN_PROG_LINUX], [
905 AC_MSG_NOTICE([LNet kernel checks
906 ==============================================================================])
911 LN_CONFIG_STRSCPY_EXISTS
913 LN_EXPORT_KMAP_TO_PAGE
915 LN_CONFIG_SK_DATA_READY
917 LN_CONFIG_SOCK_CREATE_KERN
919 LN_HAVE_HYPERVISOR_IS_TYPE
920 LN_HAVE_ORACLE_OFED_EXTENSIONS
922 LN_CONFIG_SOCK_GETNAME
923 # 5.3 and 4.18.0-193.el8
924 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
930 # default paths for installed files
932 AC_DEFUN([LN_PATH_DEFAULTS], [
933 ]) # LN_PATH_DEFAULTS
938 # other configure checks
940 AC_DEFUN([LN_CONFIGURE], [
941 AC_MSG_NOTICE([LNet core checks
942 ==============================================================================])
944 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
945 AS_IF([test "x$enable_dist" = xno], [
946 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
949 AC_CHECK_LIB([nl-3], [nla_get_s32], [
950 AC_DEFINE(HAVE_NLA_GET_S32, 1,
951 [libnl3 supports nla_get_s32])
955 AC_CHECK_LIB([nl-3], [nla_get_s64], [
956 AC_DEFINE(HAVE_NLA_GET_S64, 1,
957 [libnl3 supports nla_get_s64])
964 AC_DEFUN([LN_USR_NLMSGERR], [
965 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
966 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
967 #include <linux/netlink.h>
970 int x = (int)NLMSGERR_ATTR_MAX;
974 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
975 ['enum nlmsgerr_attrs' exists])
979 # lnet/utils/portals.c
980 AC_CHECK_HEADERS([netdb.h])
981 AC_CHECK_FUNCS([gethostbyname])
983 # lnet/utils/wirecheck.c
984 AC_CHECK_FUNCS([strnlen])
986 # -------- Check for required packages --------------
988 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
989 AC_ARG_ENABLE(efence,
990 AS_HELP_STRING([--enable-efence],
991 [use efence library]),
992 [], [enable_efence="no"])
993 AC_MSG_RESULT([$enable_efence])
996 AS_IF([test "$enable_efence" = yes], [
998 AC_DEFINE(HAVE_LIBEFENCE, 1,
999 [libefence support is requested])
1011 # AM_CONDITIONAL defines for lnet
1013 AC_DEFUN([LN_CONDITIONALS], [
1014 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1015 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1016 ]) # LN_CONDITIONALS
1021 # files that should be generated with AC_OUTPUT
1023 AC_DEFUN([LN_CONFIG_FILES], [
1027 lnet/autoconf/Makefile
1029 lnet/include/Makefile
1030 lnet/include/lnet/Makefile
1031 lnet/include/uapi/linux/lnet/Makefile
1033 lnet/klnds/autoMakefile
1034 lnet/klnds/o2iblnd/Makefile
1035 lnet/klnds/o2iblnd/autoMakefile
1036 lnet/klnds/gnilnd/Makefile
1037 lnet/klnds/gnilnd/autoMakefile
1038 lnet/klnds/socklnd/Makefile
1039 lnet/klnds/socklnd/autoMakefile
1041 lnet/lnet/autoMakefile
1042 lnet/selftest/Makefile
1043 lnet/selftest/autoMakefile
1045 lnet/utils/lnetconfig/Makefile
1047 ]) # LN_CONFIG_FILES