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
654 # LN_CONFIG_STRSCPY_EXISTS
656 # If strscpy exists, prefer it over strlcpy
658 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
659 tmp_flags="$EXTRA_KCFLAGS"
660 EXTRA_KCFLAGS="-Werror"
661 LB_CHECK_COMPILE([kernel strscpy is available],
663 #include <linux/string.h>
665 strscpy((char *)NULL, (const char *)NULL, 0);
667 AC_DEFINE(HAVE_STRSCPY, 1,
668 [kernel strscpy is available])
670 EXTRA_KCFLAGS="$tmp_flags"
671 ]) # LN_CONFIG_STRSCPY_EXISTS
673 # LN_CONFIG_SOCK_CREATE_KERN
675 # 4.x sock_create_kern() added a first parameter as 'struct net *'
678 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
679 tmp_flags="$EXTRA_KCFLAGS"
680 EXTRA_KCFLAGS="-Werror"
681 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
682 sock_create_kern_net, [
683 #include <linux/net.h>
684 #include <net/net_namespace.h>
686 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
688 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
689 [sock_create_kern use net as first parameter])
691 EXTRA_KCFLAGS="$tmp_flags"
692 ]) # LN_CONFIG_SOCK_CREATE_KERN
695 # LN_CONFIG_SK_DATA_READY
697 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
699 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
700 tmp_flags="$EXTRA_KCFLAGS"
701 EXTRA_KCFLAGS="-Werror"
702 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
704 #include <linux/net.h>
705 #include <net/sock.h>
707 ((struct sock *)0)->sk_data_ready(NULL);
709 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
710 [sk_data_ready uses only one argument])
712 EXTRA_KCFLAGS="$tmp_flags"
713 ]) # LN_CONFIG_SK_DATA_READY
716 # LN_EXPORT_KMAP_TO_PAGE
718 # 3.10 Export kmap_to_page
720 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
721 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
722 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
723 [kmap_to_page is exported by the kernel])])
724 ]) # LN_EXPORT_KMAP_TO_PAG
727 # LN_HAVE_HYPERVISOR_IS_TYPE
729 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
730 # x86/paravirt: Provide a way to check for hypervisors
732 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
733 tmp_flags="$EXTRA_KCFLAGS"
734 EXTRA_KCFLAGS="-Werror"
735 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
736 hypervisor_is_type_exists, [
737 #include <asm/hypervisor.h>
739 (void)hypervisor_is_type(X86_HYPER_NATIVE);
741 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
742 [hypervisor_is_type function exists])
744 EXTRA_KCFLAGS="$tmp_flags"
745 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
748 # LN_HAVE_ORACLE_OFED_EXTENSIONS
752 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
753 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
755 #include <rdma/ib_fmr_pool.h>
757 struct ib_fmr_pool_param param = {
762 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
763 [if Oracle OFED Extensions are enabled])
765 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
768 # LN_CONFIG_SOCK_GETNAME
770 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
771 # does not take the length *int argument and returns the length
773 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
774 tmp_flags="$EXTRA_KCFLAGS"
775 EXTRA_KCFLAGS="-Werror"
776 LB_CHECK_COMPILE([if 'getname' has two args],
777 kern_sock_getname_2args, [
778 #include <linux/net.h>
780 kernel_getsockname(NULL, NULL);
782 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
783 ['getname' has two args])
785 EXTRA_KCFLAGS="$tmp_flags"
786 ]) # LN_CONFIG_SOCK_GETNAME
789 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
791 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
792 # and kernel 4.18.0-193.el8:
793 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
794 # and removed for_ifa and endfor_ifa.
795 # Use the _rntl variant as the current locking is rtnl.
797 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
798 tmp_flags="$EXTRA_KCFLAGS"
799 EXTRA_KCFLAGS="-Werror"
800 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
801 in_dev_for_each_ifa_rtnl_test, [
802 #include <linux/inetdevice.h>
804 const struct in_ifaddr *ifa = NULL;
805 struct in_device *in_dev = NULL;
807 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
809 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
810 ['in_dev_for_each_ifa_rtnl' is defined])
812 EXTRA_KCFLAGS="$tmp_flags"
813 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
816 # LN_IB_DEVICE_OPS_EXISTS
818 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
819 # RDMA/core: Introduce ib_device_ops
820 # ... introduces the ib_device_ops structure that defines all the
821 # InfiniBand device operations in one place ...
823 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
824 tmp_flags="$EXTRA_KCFLAGS"
825 EXTRA_KCFLAGS="-Werror"
826 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
827 ib_device_ops_test, [
828 #include <rdma/ib_verbs.h>
830 int x = offsetof(struct ib_device_ops, unmap_fmr);
834 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
835 [if struct ib_device_ops is defined])
837 EXTRA_KCFLAGS="$tmp_flags"
838 ]) # LN_IB_DEVICE_OPS_EXISTS
841 # LN_IB_SG_DMA_ADDRESS_EXISTS
843 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
844 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
845 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
847 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
848 tmp_flags="$EXTRA_KCFLAGS"
849 EXTRA_KCFLAGS="-Werror"
850 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
851 ib_sg_dma_address_test, [
852 #include <rdma/ib_verbs.h>
854 u64 x = ib_sg_dma_address(NULL, NULL);
858 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
859 [if ib_sg_dma_address wrapper exists])
861 EXTRA_KCFLAGS="$tmp_flags"
862 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
868 AC_DEFUN([LN_USR_RDMA], [
869 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
870 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
871 #include <rdma/rdma_user_cm.h>
874 int x = (int)RDMA_PS_TCP;
878 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
879 [RDMA_PS_TCP exists])
884 AC_DEFUN([LN_PROG_LINUX_SRC], [])
885 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
890 # LNet linux kernel checks
892 AC_DEFUN([LN_PROG_LINUX], [
893 AC_MSG_NOTICE([LNet kernel checks
894 ==============================================================================])
899 LN_CONFIG_STRSCPY_EXISTS
901 LN_EXPORT_KMAP_TO_PAGE
903 LN_CONFIG_SK_DATA_READY
905 LN_CONFIG_SOCK_CREATE_KERN
907 LN_HAVE_HYPERVISOR_IS_TYPE
908 LN_HAVE_ORACLE_OFED_EXTENSIONS
910 LN_CONFIG_SOCK_GETNAME
911 # 5.3 and 4.18.0-193.el8
912 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
918 # default paths for installed files
920 AC_DEFUN([LN_PATH_DEFAULTS], [
921 ]) # LN_PATH_DEFAULTS
926 # other configure checks
928 AC_DEFUN([LN_CONFIGURE], [
929 AC_MSG_NOTICE([LNet core checks
930 ==============================================================================])
933 AS_HELP_STRING([--with-cuda=path],
934 [Use a CUDA sources.]),
935 [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
936 [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
940 AS_HELP_STRING([--with-gds=path],
941 [Use a gds sources.]),
942 [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
943 [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
946 AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
947 LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
949 AC_MSG_RESULT([CUDA path is $CUDA_PATH])
952 [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
955 LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
957 LB_CHECK_FILE([$GDS_PATH/config-host.h], [
958 AC_MSG_RESULT([GDS path is $GDS_PATH])
960 AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
965 AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
969 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
970 AS_IF([test "x$enable_dist" = xno], [
971 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
974 AC_CHECK_LIB([nl-3], [nla_get_s32], [
975 AC_DEFINE(HAVE_NLA_GET_S32, 1,
976 [libnl3 supports nla_get_s32])
980 AC_CHECK_LIB([nl-3], [nla_get_s64], [
981 AC_DEFINE(HAVE_NLA_GET_S64, 1,
982 [libnl3 supports nla_get_s64])
989 AC_DEFUN([LN_USR_NLMSGERR], [
990 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
991 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
992 #include <linux/netlink.h>
995 int x = (int)NLMSGERR_ATTR_MAX;
999 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
1000 ['enum nlmsgerr_attrs' exists])
1002 ]) # LN_USR_NLMGSERR
1004 # lnet/utils/portals.c
1005 AC_CHECK_HEADERS([netdb.h])
1006 AC_CHECK_FUNCS([gethostbyname])
1008 # lnet/utils/wirecheck.c
1009 AC_CHECK_FUNCS([strnlen])
1011 # -------- Check for required packages --------------
1013 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1014 AC_ARG_ENABLE(efence,
1015 AS_HELP_STRING([--enable-efence],
1016 [use efence library]),
1017 [], [enable_efence="no"])
1018 AC_MSG_RESULT([$enable_efence])
1021 AS_IF([test "$enable_efence" = yes], [
1022 LIBEFENCE="-lefence"
1023 AC_DEFINE(HAVE_LIBEFENCE, 1,
1024 [libefence support is requested])
1036 # AM_CONDITIONAL defines for lnet
1038 AC_DEFUN([LN_CONDITIONALS], [
1039 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1040 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1041 ]) # LN_CONDITIONALS
1046 # files that should be generated with AC_OUTPUT
1048 AC_DEFUN([LN_CONFIG_FILES], [
1052 lnet/autoconf/Makefile
1054 lnet/include/Makefile
1055 lnet/include/lnet/Makefile
1056 lnet/include/uapi/linux/lnet/Makefile
1058 lnet/klnds/autoMakefile
1059 lnet/klnds/o2iblnd/Makefile
1060 lnet/klnds/o2iblnd/autoMakefile
1061 lnet/klnds/gnilnd/Makefile
1062 lnet/klnds/gnilnd/autoMakefile
1063 lnet/klnds/socklnd/Makefile
1064 lnet/klnds/socklnd/autoMakefile
1066 lnet/lnet/autoMakefile
1067 lnet/selftest/Makefile
1068 lnet/selftest/autoMakefile
1070 lnet/utils/lnetconfig/Makefile
1072 ]) # LN_CONFIG_FILES