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 elif test -f $LINUX_OBJ/Module.symvers; then
214 # Debian symvers is in the arch tree
215 O2IB_SYMVER=$LINUX_OBJ/Module.symvers
217 if test -n "$O2IB_SYMVER"; then
218 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
219 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
220 AC_SUBST(EXTRA_SYMBOLS)
222 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
225 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
226 linux_kthread_worker, [
227 #ifdef HAVE_COMPAT_RDMA
229 #undef PACKAGE_TARNAME
230 #undef PACKAGE_VERSION
231 #undef PACKAGE_STRING
232 #undef PACKAGE_BUGREPORT
234 #include <linux/compat-2.6.h>
236 #include <linux/kthread.h>
238 struct kthread_work *kth_wrk = NULL;
239 flush_kthread_work(kth_wrk);
241 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
242 if test -z "$COMPAT_AUTOCONF"; then
243 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
246 EXTRA_CHECK_INCLUDE=""
249 AC_SUBST(EXTRA_OFED_CONFIG)
250 AC_SUBST(EXTRA_OFED_INCLUDE)
255 AS_IF([test $ENABLEO2IB != "no"], [
256 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
257 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
259 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
260 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
261 rdma_create_id_4args, [
262 #ifdef HAVE_COMPAT_RDMA
264 #undef PACKAGE_TARNAME
265 #undef PACKAGE_VERSION
266 #undef PACKAGE_STRING
267 #undef PACKAGE_BUGREPORT
269 #include <linux/compat-2.6.h>
271 #include <rdma/rdma_cm.h>
273 rdma_create_id(NULL, NULL, 0, 0);
275 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
276 [rdma_create_id wants 4 args])
279 # 4.4 added network namespace parameter for rdma_create_id()
280 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
281 rdma_create_id_5args, [
282 #ifdef HAVE_COMPAT_RDMA
284 #undef PACKAGE_TARNAME
285 #undef PACKAGE_VERSION
286 #undef PACKAGE_STRING
287 #undef PACKAGE_BUGREPORT
289 #include <linux/compat-2.6.h>
291 #include <rdma/rdma_cm.h>
293 rdma_create_id(NULL, NULL, NULL, 0, 0);
295 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
296 [rdma_create_id wants 5 args])
299 # 4.2 introduced struct ib_cq_init_attr which is used
300 # by ib_create_cq(). Note some OFED stacks only keep
301 # their headers in sync with latest kernels but not
302 # the functionality which means for infiniband testing
303 # we need to always test functionality testings.
304 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
306 #ifdef HAVE_COMPAT_RDMA
308 #undef PACKAGE_TARNAME
309 #undef PACKAGE_VERSION
310 #undef PACKAGE_STRING
311 #undef PACKAGE_BUGREPORT
313 #include <linux/compat-2.6.h>
315 #include <rdma/ib_verbs.h>
317 struct ib_cq_init_attr cq_attr;
319 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
321 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
322 [struct ib_cq_init_attr is used by ib_create_cq])
325 # 4.3 removed ib_alloc_fast_reg_mr()
326 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
327 ib_alloc_fast_reg_mr, [
328 #ifdef HAVE_COMPAT_RDMA
330 #undef PACKAGE_TARNAME
331 #undef PACKAGE_VERSION
332 #undef PACKAGE_STRING
333 #undef PACKAGE_BUGREPORT
335 #include <linux/compat-2.6.h>
337 #include <rdma/ib_verbs.h>
339 ib_alloc_fast_reg_mr(NULL, 0);
341 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
342 [ib_alloc_fast_reg_mr is defined])
345 # 4.9 must stop using ib_get_dma_mr and the global MR
346 # We then have to use FMR/Fastreg for all RDMA.
347 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
349 #ifdef HAVE_COMPAT_RDMA
351 #undef PACKAGE_TARNAME
352 #undef PACKAGE_VERSION
353 #undef PACKAGE_STRING
354 #undef PACKAGE_BUGREPORT
356 #include <linux/compat-2.6.h>
358 #include <rdma/ib_verbs.h>
360 ib_get_dma_mr(NULL, 0);
362 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
363 [ib_get_dma_mr is defined])
366 # In v4.4 Linux kernel,
367 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
368 # split up struct ib_send_wr so that all non-trivial verbs
369 # use their own structure which embedds struct ib_send_wr.
370 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
372 #ifdef HAVE_COMPAT_RDMA
374 #undef PACKAGE_TARNAME
375 #undef PACKAGE_VERSION
376 #undef PACKAGE_STRING
377 #undef PACKAGE_BUGREPORT
379 #include <linux/compat-2.6.h>
381 #include <rdma/ib_verbs.h>
383 struct ib_rdma_wr *wr __attribute__ ((unused));
387 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
388 [struct ib_rdma_wr is defined])
391 # new fast registration API introduced in 4.4
392 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
393 ib_map_mr_sg_4args, [
394 #ifdef HAVE_COMPAT_RDMA
396 #undef PACKAGE_TARNAME
397 #undef PACKAGE_VERSION
398 #undef PACKAGE_STRING
399 #undef PACKAGE_BUGREPORT
401 #include <linux/compat-2.6.h>
403 #include <rdma/ib_verbs.h>
405 ib_map_mr_sg(NULL, NULL, 0, 0);
407 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
408 [ib_map_mr_sg exists])
411 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
412 # in kernel 4.7 (and RHEL 7.3)
413 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
414 ib_map_mr_sg_5args, [
415 #ifdef HAVE_COMPAT_RDMA
417 #undef PACKAGE_TARNAME
418 #undef PACKAGE_VERSION
419 #undef PACKAGE_STRING
420 #undef PACKAGE_BUGREPORT
422 #include <linux/compat-2.6.h>
424 #include <rdma/ib_verbs.h>
426 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
428 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
429 [ib_map_mr_sg exists])
430 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
431 [ib_map_mr_sg has 5 arguments])
434 # ib_query_device() removed in 4.5
435 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
437 #ifdef HAVE_COMPAT_RDMA
439 #undef PACKAGE_TARNAME
440 #undef PACKAGE_VERSION
441 #undef PACKAGE_STRING
442 #undef PACKAGE_BUGREPORT
444 #include <linux/compat-2.6.h>
446 #include <rdma/ib_verbs.h>
448 struct ib_device dev;
449 struct ib_device_attr dev_attr = {};
450 dev.attrs = dev_attr;
452 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
453 [struct ib_device.attrs is defined])
456 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
457 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
458 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
460 #ifdef HAVE_COMPAT_RDMA
462 #undef PACKAGE_TARNAME
463 #undef PACKAGE_VERSION
464 #undef PACKAGE_STRING
465 #undef PACKAGE_BUGREPORT
467 #include <linux/compat-2.6.h>
469 #include <rdma/ib_verbs.h>
471 ib_alloc_pd(NULL, 0);
473 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
474 [ib_alloc_pd has 2 arguments])
477 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
479 #ifdef HAVE_COMPAT_RDMA
481 #undef PACKAGE_TARNAME
482 #undef PACKAGE_VERSION
483 #undef PACKAGE_STRING
484 #undef PACKAGE_BUGREPORT
486 #include <linux/compat-2.6.h>
488 #include <rdma/ib_verbs.h>
490 (void)ib_inc_rkey(0);
492 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
493 [function ib_inc_rkey exist])
496 # In MOFED 4.6, the second and third parameters for
497 # ib_post_send() and ib_post_recv() are declared with
499 tmp_flags="$EXTRA_KCFLAGS"
500 EXTRA_KCFLAGS="-Werror"
501 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
502 ib_post_send_recv_const, [
503 #ifdef HAVE_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_post_send(NULL, (const struct ib_send_wr *)NULL,
515 (const struct ib_send_wr **)NULL);
517 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
518 [ib_post_send and ib_post_recv have const parameters])
520 EXTRA_KCFLAGS="$tmp_flags"
523 LN_IB_DEVICE_OPS_EXISTS
525 LN_IB_SG_DMA_ADDRESS_EXISTS
527 # A reason argument was added to rdma_reject() in Linux 5.8,
528 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
529 LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
531 #ifdef HAVE_COMPAT_RDMA
533 #undef PACKAGE_TARNAME
534 #undef PACKAGE_VERSION
535 #undef PACKAGE_STRING
536 #undef PACKAGE_BUGREPORT
538 #include <linux/compat-2.6.h>
540 #include <rdma/ib_verbs.h>
541 #include <rdma/ib_cm.h>
542 #include <rdma/rdma_cm.h>
544 rdma_reject(NULL, NULL, 0, 0);
546 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
547 [rdma_reject has 4 arguments])
550 # The FMR pool API was removed in Linux 5.8,
551 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
552 LB_CHECK_COMPILE([if FMR pools API available],
554 #include <rdma/ib_verbs.h>
556 struct ib_fmr fmr = {};
558 AC_DEFINE(HAVE_FMR_POOL_API, 1,
559 [FMR pool API is available])
562 # rdma_connect_locked() was added in Linux 5.10,
563 # commit 071ba4cc559de47160761b9500b72e8fa09d923d
564 # and in MOFED-5.2-2. rdma_connect_locked() must
565 # be called instead of rdma_connect() in
566 # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
567 LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
568 rdma_connect_locked, [
569 #include <rdma/rdma_cm.h>
571 rdma_connect_locked(NULL, NULL);
573 AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
574 [rdma_connect_locked is defined])
577 # ethtool_link_settings was added in Linux 4.6
578 LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
579 ethtool_link_settings, [
580 #include <linux/ethtool.h>
582 struct ethtool_link_ksettings cmd;
584 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
585 [ethtool_link_settings is defined])
588 EXTRA_CHECK_INCLUDE=""
589 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
590 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
591 ]) # ENABLEO2IB != "no"
597 # check whether to use the Gemini Network Interface lnd
599 AC_DEFUN([LN_CONFIG_GNILND], [
600 AC_MSG_CHECKING([whether to enable GNI lnd])
602 AS_HELP_STRING([--enable-gni],
604 [], [enable_gni="no"])
605 AC_MSG_RESULT([$enable_gni])
607 AS_IF([test "x$enable_gni" = xyes], [
608 # GNICPPFLAGS was set in spec file
609 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
610 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
611 LB_CHECK_COMPILE([if GNI kernel headers are present],
613 #include <linux/types.h>
616 gni_cdm_handle_t kgni_domain;
619 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
620 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
625 AC_MSG_ERROR([cannot compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
627 # at this point, we have gnilnd basic support,
628 # now check for extra features
629 LB_CHECK_COMPILE([to use RCA in gnilnd],
631 #include <linux/types.h>
633 #include <krca_lib.h>
635 gni_cdm_handle_t kgni_domain;
637 krca_ticket_t ticket = KRCA_NULL_TICKET;
639 __u32 nid = 0, nic_addr;
640 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
641 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
642 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
643 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
646 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
648 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
650 AC_SUBST(GNICPPFLAGS)
652 ]) # LN_CONFIG_GNILND
657 # check whether to use the kfabric Network Interface lnd
659 AC_DEFUN([LN_CONFIG_KFILND], [
661 AC_HELP_STRING([--with-kfi=<path>], [Kfabric build path for kfilnd]),
663 AC_CHECK_FILE([$with_kfi/Module.symvers],
665 # KFICPPFLAGS was set in spec file
666 KFICPPFLAGS="-I$with_kfi/include"
667 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
668 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $KFICPPFLAGS"
669 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $with_kfi/Module.symvers"
670 LB_CHECK_COMPILE([if kfabric headers are present], KFI_header,
672 #include <kfi_endpoint.h>
674 struct kfi_info *hints;
675 hints = kfi_allocinfo();
678 AC_MSG_NOTICE([adding $with_kfi/Module.symvers to Symbol Path])
679 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $with_kfi/Module.symvers"
681 AC_MSG_ERROR([can't compile kfilnd with given KFICPPFLAGS: $KFICPPFLAGS])
684 AC_MSG_ERROR(["$with_kfi/Module.symvers does not exist"])
687 AC_SUBST(KFICPPFLAGS)
689 AC_SUBST(EXTRA_SYMBOLS)
690 ]) # LN_CONFIG_KFILND
692 # LN_CONFIG_STRSCPY_EXISTS
694 # If strscpy exists, prefer it over strlcpy
696 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
697 tmp_flags="$EXTRA_KCFLAGS"
698 EXTRA_KCFLAGS="-Werror"
699 LB_CHECK_COMPILE([kernel strscpy is available],
701 #include <linux/string.h>
703 strscpy((char *)NULL, (const char *)NULL, 0);
705 AC_DEFINE(HAVE_STRSCPY, 1,
706 [kernel strscpy is available])
708 EXTRA_KCFLAGS="$tmp_flags"
709 ]) # LN_CONFIG_STRSCPY_EXISTS
711 # LN_CONFIG_SOCK_CREATE_KERN
713 # 4.x sock_create_kern() added a first parameter as 'struct net *'
716 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
717 tmp_flags="$EXTRA_KCFLAGS"
718 EXTRA_KCFLAGS="-Werror"
719 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
720 sock_create_kern_net, [
721 #include <linux/net.h>
722 #include <net/net_namespace.h>
724 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
726 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
727 [sock_create_kern use net as first parameter])
729 EXTRA_KCFLAGS="$tmp_flags"
730 ]) # LN_CONFIG_SOCK_CREATE_KERN
733 # LN_CONFIG_SK_DATA_READY
735 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
737 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
738 tmp_flags="$EXTRA_KCFLAGS"
739 EXTRA_KCFLAGS="-Werror"
740 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
742 #include <linux/net.h>
743 #include <net/sock.h>
745 ((struct sock *)0)->sk_data_ready(NULL);
747 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
748 [sk_data_ready uses only one argument])
750 EXTRA_KCFLAGS="$tmp_flags"
751 ]) # LN_CONFIG_SK_DATA_READY
754 # LN_EXPORT_KMAP_TO_PAGE
756 # 3.10 Export kmap_to_page
758 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
759 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
760 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
761 [kmap_to_page is exported by the kernel])])
762 ]) # LN_EXPORT_KMAP_TO_PAG
765 # LN_HAVE_HYPERVISOR_IS_TYPE
767 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
768 # x86/paravirt: Provide a way to check for hypervisors
770 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
771 tmp_flags="$EXTRA_KCFLAGS"
772 EXTRA_KCFLAGS="-Werror"
773 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
774 hypervisor_is_type_exists, [
775 #include <asm/hypervisor.h>
777 (void)hypervisor_is_type(X86_HYPER_NATIVE);
779 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
780 [hypervisor_is_type function exists])
782 EXTRA_KCFLAGS="$tmp_flags"
783 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
786 # LN_HAVE_ORACLE_OFED_EXTENSIONS
790 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
791 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
793 #include <rdma/ib_fmr_pool.h>
795 struct ib_fmr_pool_param param = {
800 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
801 [if Oracle OFED Extensions are enabled])
803 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
806 # LN_CONFIG_SOCK_GETNAME
808 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
809 # does not take the length *int argument and returns the length
811 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
812 tmp_flags="$EXTRA_KCFLAGS"
813 EXTRA_KCFLAGS="-Werror"
814 LB_CHECK_COMPILE([if 'getname' has two args],
815 kern_sock_getname_2args, [
816 #include <linux/net.h>
818 kernel_getsockname(NULL, NULL);
820 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
821 ['getname' has two args])
823 EXTRA_KCFLAGS="$tmp_flags"
824 ]) # LN_CONFIG_SOCK_GETNAME
827 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
829 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
830 # and kernel 4.18.0-193.el8:
831 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
832 # and removed for_ifa and endfor_ifa.
833 # Use the _rntl variant as the current locking is rtnl.
835 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
836 tmp_flags="$EXTRA_KCFLAGS"
837 EXTRA_KCFLAGS="-Werror"
838 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
839 in_dev_for_each_ifa_rtnl_test, [
840 #include <linux/inetdevice.h>
842 const struct in_ifaddr *ifa = NULL;
843 struct in_device *in_dev = NULL;
845 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
847 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
848 ['in_dev_for_each_ifa_rtnl' is defined])
850 EXTRA_KCFLAGS="$tmp_flags"
851 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
854 # LN_IB_DEVICE_OPS_EXISTS
856 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
857 # RDMA/core: Introduce ib_device_ops
858 # ... introduces the ib_device_ops structure that defines all the
859 # InfiniBand device operations in one place ...
861 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
862 tmp_flags="$EXTRA_KCFLAGS"
863 EXTRA_KCFLAGS="-Werror"
864 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
865 ib_device_ops_test, [
866 #include <rdma/ib_verbs.h>
868 int x = offsetof(struct ib_device_ops, unmap_fmr);
872 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
873 [if struct ib_device_ops is defined])
875 EXTRA_KCFLAGS="$tmp_flags"
876 ]) # LN_IB_DEVICE_OPS_EXISTS
879 # LN_IB_SG_DMA_ADDRESS_EXISTS
881 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
882 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
883 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
885 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
886 tmp_flags="$EXTRA_KCFLAGS"
887 EXTRA_KCFLAGS="-Werror"
888 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
889 ib_sg_dma_address_test, [
890 #include <rdma/ib_verbs.h>
892 u64 x = ib_sg_dma_address(NULL, NULL);
896 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
897 [if ib_sg_dma_address wrapper exists])
899 EXTRA_KCFLAGS="$tmp_flags"
900 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
906 AC_DEFUN([LN_USR_RDMA], [
907 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
908 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
909 #include <rdma/rdma_user_cm.h>
912 int x = (int)RDMA_PS_TCP;
916 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
917 [RDMA_PS_TCP exists])
922 AC_DEFUN([LN_PROG_LINUX_SRC], [])
923 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
928 # LNet linux kernel checks
930 AC_DEFUN([LN_PROG_LINUX], [
931 AC_MSG_NOTICE([LNet kernel checks
932 ==============================================================================])
937 LN_CONFIG_STRSCPY_EXISTS
940 LN_EXPORT_KMAP_TO_PAGE
942 LN_CONFIG_SK_DATA_READY
944 LN_CONFIG_SOCK_CREATE_KERN
946 LN_HAVE_HYPERVISOR_IS_TYPE
947 LN_HAVE_ORACLE_OFED_EXTENSIONS
949 LN_CONFIG_SOCK_GETNAME
950 # 5.3 and 4.18.0-193.el8
951 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
957 # default paths for installed files
959 AC_DEFUN([LN_PATH_DEFAULTS], [
960 ]) # LN_PATH_DEFAULTS
965 # other configure checks
967 AC_DEFUN([LN_CONFIGURE], [
968 AC_MSG_NOTICE([LNet core checks
969 ==============================================================================])
972 AS_HELP_STRING([--with-cuda=path],
973 [Use a CUDA sources.]),
974 [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
975 [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
979 AS_HELP_STRING([--with-gds=path],
980 [Use a gds sources.]),
981 [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
982 [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
985 AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
986 LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
988 AC_MSG_RESULT([CUDA path is $CUDA_PATH])
991 [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
994 LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
996 LB_CHECK_FILE([$GDS_PATH/config-host.h], [
997 AC_MSG_RESULT([GDS path is $GDS_PATH])
999 AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
1004 AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
1008 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
1009 AS_IF([test "x$enable_dist" = xno], [
1010 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
1013 AC_CHECK_LIB([nl-3], [nla_get_s32], [
1014 AC_DEFINE(HAVE_NLA_GET_S32, 1,
1015 [libnl3 supports nla_get_s32])
1019 AC_CHECK_LIB([nl-3], [nla_get_s64], [
1020 AC_DEFINE(HAVE_NLA_GET_S64, 1,
1021 [libnl3 supports nla_get_s64])
1028 AC_DEFUN([LN_USR_NLMSGERR], [
1029 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
1030 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1031 #include <linux/netlink.h>
1034 int x = (int)NLMSGERR_ATTR_MAX;
1038 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
1039 ['enum nlmsgerr_attrs' exists])
1041 ]) # LN_USR_NLMGSERR
1043 # lnet/utils/portals.c
1044 AC_CHECK_HEADERS([netdb.h])
1045 AC_CHECK_FUNCS([gethostbyname])
1047 # lnet/utils/wirecheck.c
1048 AC_CHECK_FUNCS([strnlen])
1050 # -------- Check for required packages --------------
1052 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1053 AC_ARG_ENABLE(efence,
1054 AS_HELP_STRING([--enable-efence],
1055 [use efence library]),
1056 [], [enable_efence="no"])
1057 AC_MSG_RESULT([$enable_efence])
1060 AS_IF([test "$enable_efence" = yes], [
1061 LIBEFENCE="-lefence"
1062 AC_DEFINE(HAVE_LIBEFENCE, 1,
1063 [libefence support is requested])
1075 # AM_CONDITIONAL defines for lnet
1077 AC_DEFUN([LN_CONDITIONALS], [
1078 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1079 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1080 AM_CONDITIONAL(BUILD_KFILND, test x$KFILND = "xkfilnd")
1081 ]) # LN_CONDITIONALS
1086 # files that should be generated with AC_OUTPUT
1088 AC_DEFUN([LN_CONFIG_FILES], [
1092 lnet/autoconf/Makefile
1094 lnet/include/Makefile
1095 lnet/include/lnet/Makefile
1096 lnet/include/uapi/linux/lnet/Makefile
1098 lnet/klnds/autoMakefile
1099 lnet/klnds/o2iblnd/Makefile
1100 lnet/klnds/o2iblnd/autoMakefile
1101 lnet/klnds/gnilnd/Makefile
1102 lnet/klnds/gnilnd/autoMakefile
1103 lnet/klnds/socklnd/Makefile
1104 lnet/klnds/socklnd/autoMakefile
1105 lnet/klnds/kfilnd/Makefile
1106 lnet/klnds/kfilnd/autoMakefile
1108 lnet/lnet/autoMakefile
1109 lnet/selftest/Makefile
1110 lnet/selftest/autoMakefile
1112 lnet/utils/lnetconfig/Makefile
1114 ]) # LN_CONFIG_FILES