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 kernel's built-in I/B stack rather than your installed 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)
214 if test -n "$O2IB_SYMVER"; then
215 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
216 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
217 AC_SUBST(EXTRA_SYMBOLS)
219 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
222 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
223 linux_kthread_worker, [
224 #ifdef HAVE_COMPAT_RDMA
226 #undef PACKAGE_TARNAME
227 #undef PACKAGE_VERSION
228 #undef PACKAGE_STRING
229 #undef PACKAGE_BUGREPORT
231 #include <linux/compat-2.6.h>
233 #include <linux/kthread.h>
235 struct kthread_work *kth_wrk = NULL;
236 flush_kthread_work(kth_wrk);
238 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
239 if test -z "$COMPAT_AUTOCONF"; then
240 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
243 EXTRA_CHECK_INCLUDE=""
246 AC_SUBST(EXTRA_OFED_CONFIG)
247 AC_SUBST(EXTRA_OFED_INCLUDE)
252 AS_IF([test $ENABLEO2IB != "no"], [
253 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
254 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
256 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
257 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
258 rdma_create_id_4args, [
259 #ifdef HAVE_COMPAT_RDMA
261 #undef PACKAGE_TARNAME
262 #undef PACKAGE_VERSION
263 #undef PACKAGE_STRING
264 #undef PACKAGE_BUGREPORT
266 #include <linux/compat-2.6.h>
268 #include <rdma/rdma_cm.h>
270 rdma_create_id(NULL, NULL, 0, 0);
272 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
273 [rdma_create_id wants 4 args])
276 # 4.4 added network namespace parameter for rdma_create_id()
277 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
278 rdma_create_id_5args, [
279 #ifdef HAVE_COMPAT_RDMA
281 #undef PACKAGE_TARNAME
282 #undef PACKAGE_VERSION
283 #undef PACKAGE_STRING
284 #undef PACKAGE_BUGREPORT
286 #include <linux/compat-2.6.h>
288 #include <rdma/rdma_cm.h>
290 rdma_create_id(NULL, NULL, NULL, 0, 0);
292 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
293 [rdma_create_id wants 5 args])
296 # 4.2 introduced struct ib_cq_init_attr which is used
297 # by ib_create_cq(). Note some OFED stacks only keep
298 # their headers in sync with latest kernels but not
299 # the functionality which means for infiniband testing
300 # we need to always test functionality testings.
301 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
303 #ifdef HAVE_COMPAT_RDMA
305 #undef PACKAGE_TARNAME
306 #undef PACKAGE_VERSION
307 #undef PACKAGE_STRING
308 #undef PACKAGE_BUGREPORT
310 #include <linux/compat-2.6.h>
312 #include <rdma/ib_verbs.h>
314 struct ib_cq_init_attr cq_attr;
316 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
318 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
319 [struct ib_cq_init_attr is used by ib_create_cq])
322 # 4.3 removed ib_alloc_fast_reg_mr()
323 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
324 ib_alloc_fast_reg_mr, [
325 #ifdef HAVE_COMPAT_RDMA
327 #undef PACKAGE_TARNAME
328 #undef PACKAGE_VERSION
329 #undef PACKAGE_STRING
330 #undef PACKAGE_BUGREPORT
332 #include <linux/compat-2.6.h>
334 #include <rdma/ib_verbs.h>
336 ib_alloc_fast_reg_mr(NULL, 0);
338 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
339 [ib_alloc_fast_reg_mr is defined])
342 # 4.9 must stop using ib_get_dma_mr and the global MR
343 # We then have to use FMR/Fastreg for all RDMA.
344 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
346 #ifdef HAVE_COMPAT_RDMA
348 #undef PACKAGE_TARNAME
349 #undef PACKAGE_VERSION
350 #undef PACKAGE_STRING
351 #undef PACKAGE_BUGREPORT
353 #include <linux/compat-2.6.h>
355 #include <rdma/ib_verbs.h>
357 ib_get_dma_mr(NULL, 0);
359 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
360 [ib_get_dma_mr is defined])
363 # In v4.4 Linux kernel,
364 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
365 # split up struct ib_send_wr so that all non-trivial verbs
366 # use their own structure which embedds struct ib_send_wr.
367 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
369 #ifdef HAVE_COMPAT_RDMA
371 #undef PACKAGE_TARNAME
372 #undef PACKAGE_VERSION
373 #undef PACKAGE_STRING
374 #undef PACKAGE_BUGREPORT
376 #include <linux/compat-2.6.h>
378 #include <rdma/ib_verbs.h>
380 struct ib_rdma_wr *wr __attribute__ ((unused));
384 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
385 [struct ib_rdma_wr is defined])
388 # new fast registration API introduced in 4.4
389 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
390 ib_map_mr_sg_4args, [
391 #ifdef HAVE_COMPAT_RDMA
393 #undef PACKAGE_TARNAME
394 #undef PACKAGE_VERSION
395 #undef PACKAGE_STRING
396 #undef PACKAGE_BUGREPORT
398 #include <linux/compat-2.6.h>
400 #include <rdma/ib_verbs.h>
402 ib_map_mr_sg(NULL, NULL, 0, 0);
404 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
405 [ib_map_mr_sg exists])
408 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
409 # in kernel 4.7 (and RHEL 7.3)
410 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
411 ib_map_mr_sg_5args, [
412 #ifdef HAVE_COMPAT_RDMA
414 #undef PACKAGE_TARNAME
415 #undef PACKAGE_VERSION
416 #undef PACKAGE_STRING
417 #undef PACKAGE_BUGREPORT
419 #include <linux/compat-2.6.h>
421 #include <rdma/ib_verbs.h>
423 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
425 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
426 [ib_map_mr_sg exists])
427 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
428 [ib_map_mr_sg has 5 arguments])
431 # ib_query_device() removed in 4.5
432 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
434 #ifdef HAVE_COMPAT_RDMA
436 #undef PACKAGE_TARNAME
437 #undef PACKAGE_VERSION
438 #undef PACKAGE_STRING
439 #undef PACKAGE_BUGREPORT
441 #include <linux/compat-2.6.h>
443 #include <rdma/ib_verbs.h>
445 struct ib_device dev;
446 struct ib_device_attr dev_attr = {};
447 dev.attrs = dev_attr;
449 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
450 [struct ib_device.attrs is defined])
453 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
454 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
455 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
457 #ifdef HAVE_COMPAT_RDMA
459 #undef PACKAGE_TARNAME
460 #undef PACKAGE_VERSION
461 #undef PACKAGE_STRING
462 #undef PACKAGE_BUGREPORT
464 #include <linux/compat-2.6.h>
466 #include <rdma/ib_verbs.h>
468 ib_alloc_pd(NULL, 0);
470 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
471 [ib_alloc_pd has 2 arguments])
474 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
476 #ifdef HAVE_COMPAT_RDMA
478 #undef PACKAGE_TARNAME
479 #undef PACKAGE_VERSION
480 #undef PACKAGE_STRING
481 #undef PACKAGE_BUGREPORT
483 #include <linux/compat-2.6.h>
485 #include <rdma/ib_verbs.h>
487 (void)ib_inc_rkey(0);
489 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
490 [function ib_inc_rkey exist])
493 # In MOFED 4.6, the second and third parameters for
494 # ib_post_send() and ib_post_recv() are declared with
496 tmp_flags="$EXTRA_KCFLAGS"
497 EXTRA_KCFLAGS="-Werror"
498 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
499 ib_post_send_recv_const, [
500 #ifdef HAVE_COMPAT_RDMA
502 #undef PACKAGE_TARNAME
503 #undef PACKAGE_VERSION
504 #undef PACKAGE_STRING
505 #undef PACKAGE_BUGREPORT
507 #include <linux/compat-2.6.h>
509 #include <rdma/ib_verbs.h>
511 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
512 (const struct ib_send_wr **)NULL);
514 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
515 [ib_post_send and ib_post_recv have const parameters])
517 EXTRA_KCFLAGS="$tmp_flags"
520 LN_IB_DEVICE_OPS_EXISTS
522 LN_IB_SG_DMA_ADDRESS_EXISTS
524 # A reason argument was added to rdma_reject() in Linux 5.8,
525 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
526 LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
528 #ifdef HAVE_COMPAT_RDMA
530 #undef PACKAGE_TARNAME
531 #undef PACKAGE_VERSION
532 #undef PACKAGE_STRING
533 #undef PACKAGE_BUGREPORT
535 #include <linux/compat-2.6.h>
537 #include <rdma/ib_verbs.h>
538 #include <rdma/ib_cm.h>
539 #include <rdma/rdma_cm.h>
541 rdma_reject(NULL, NULL, 0, 0);
543 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
544 [rdma_reject has 4 arguments])
547 # The FMR pool API was removed in Linux 5.8,
548 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
549 LB_CHECK_COMPILE([if FMR pools API available],
551 #include <rdma/ib_verbs.h>
553 struct ib_fmr fmr = {};
555 AC_DEFINE(HAVE_FMR_POOL_API, 1,
556 [FMR pool API is available])
559 # rdma_connect_locked() was added in Linux 5.10,
560 # commit 071ba4cc559de47160761b9500b72e8fa09d923d
561 # and in MOFED-5.2-2. rdma_connect_locked() must
562 # be called instead of rdma_connect() in
563 # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
564 LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
565 rdma_connect_locked, [
566 #include <rdma/rdma_cm.h>
568 rdma_connect_locked(NULL, NULL);
570 AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
571 [rdma_connect_locked is defined])
574 # ethtool_link_settings was added in Linux 4.6
575 LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
576 ethtool_link_settings, [
577 #include <linux/ethtool.h>
579 struct ethtool_link_ksettings cmd;
581 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
582 [ethtool_link_settings is defined])
585 EXTRA_CHECK_INCLUDE=""
586 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
587 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
588 ]) # ENABLEO2IB != "no"
594 # check whether to use the Gemini Network Interface lnd
596 AC_DEFUN([LN_CONFIG_GNILND], [
597 AC_MSG_CHECKING([whether to enable GNI lnd])
599 AS_HELP_STRING([--enable-gni],
601 [], [enable_gni="no"])
602 AC_MSG_RESULT([$enable_gni])
604 AS_IF([test "x$enable_gni" = xyes], [
605 # GNICPPFLAGS was set in spec file
606 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
607 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
608 LB_CHECK_COMPILE([if GNI kernel headers are present],
610 #include <linux/types.h>
613 gni_cdm_handle_t kgni_domain;
616 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
617 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
622 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
624 # at this point, we have gnilnd basic support,
625 # now check for extra features
626 LB_CHECK_COMPILE([to use RCA in gnilnd],
628 #include <linux/types.h>
630 #include <krca_lib.h>
632 gni_cdm_handle_t kgni_domain;
634 krca_ticket_t ticket = KRCA_NULL_TICKET;
636 __u32 nid = 0, nic_addr;
637 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
638 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
639 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
640 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
643 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
645 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
647 AC_SUBST(GNICPPFLAGS)
649 ]) # LN_CONFIG_GNILND
651 # LN_CONFIG_STRSCPY_EXISTS
653 # If strscpy exists, prefer it over strlcpy
655 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
656 tmp_flags="$EXTRA_KCFLAGS"
657 EXTRA_KCFLAGS="-Werror"
658 LB_CHECK_COMPILE([kernel strscpy is available],
660 #include <linux/string.h>
662 strscpy((char *)NULL, (const char *)NULL, 0);
664 AC_DEFINE(HAVE_STRSCPY, 1,
665 [kernel strscpy is available])
667 EXTRA_KCFLAGS="$tmp_flags"
668 ]) # LN_CONFIG_STRSCPY_EXISTS
670 # LN_CONFIG_SOCK_CREATE_KERN
672 # 4.x sock_create_kern() added a first parameter as 'struct net *'
675 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
676 tmp_flags="$EXTRA_KCFLAGS"
677 EXTRA_KCFLAGS="-Werror"
678 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
679 sock_create_kern_net, [
680 #include <linux/net.h>
681 #include <net/net_namespace.h>
683 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
685 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
686 [sock_create_kern use net as first parameter])
688 EXTRA_KCFLAGS="$tmp_flags"
689 ]) # LN_CONFIG_SOCK_CREATE_KERN
692 # LN_CONFIG_SK_DATA_READY
694 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
696 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
697 tmp_flags="$EXTRA_KCFLAGS"
698 EXTRA_KCFLAGS="-Werror"
699 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
701 #include <linux/net.h>
702 #include <net/sock.h>
704 ((struct sock *)0)->sk_data_ready(NULL);
706 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
707 [sk_data_ready uses only one argument])
709 EXTRA_KCFLAGS="$tmp_flags"
710 ]) # LN_CONFIG_SK_DATA_READY
713 # LN_EXPORT_KMAP_TO_PAGE
715 # 3.10 Export kmap_to_page
717 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
718 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
719 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
720 [kmap_to_page is exported by the kernel])])
721 ]) # LN_EXPORT_KMAP_TO_PAG
724 # LN_HAVE_HYPERVISOR_IS_TYPE
726 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
727 # x86/paravirt: Provide a way to check for hypervisors
729 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
730 tmp_flags="$EXTRA_KCFLAGS"
731 EXTRA_KCFLAGS="-Werror"
732 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
733 hypervisor_is_type_exists, [
734 #include <asm/hypervisor.h>
736 (void)hypervisor_is_type(X86_HYPER_NATIVE);
738 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
739 [hypervisor_is_type function exists])
741 EXTRA_KCFLAGS="$tmp_flags"
742 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
745 # LN_HAVE_ORACLE_OFED_EXTENSIONS
749 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
750 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
752 #include <rdma/ib_fmr_pool.h>
754 struct ib_fmr_pool_param param = {
759 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
760 [if Oracle OFED Extensions are enabled])
762 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
765 # LN_CONFIG_SOCK_GETNAME
767 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
768 # does not take the length *int argument and returns the length
770 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
771 tmp_flags="$EXTRA_KCFLAGS"
772 EXTRA_KCFLAGS="-Werror"
773 LB_CHECK_COMPILE([if 'getname' has two args],
774 kern_sock_getname_2args, [
775 #include <linux/net.h>
777 kernel_getsockname(NULL, NULL);
779 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
780 ['getname' has two args])
782 EXTRA_KCFLAGS="$tmp_flags"
783 ]) # LN_CONFIG_SOCK_GETNAME
786 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
788 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
789 # and kernel 4.18.0-193.el8:
790 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
791 # and removed for_ifa and endfor_ifa.
792 # Use the _rntl variant as the current locking is rtnl.
794 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
795 tmp_flags="$EXTRA_KCFLAGS"
796 EXTRA_KCFLAGS="-Werror"
797 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
798 in_dev_for_each_ifa_rtnl_test, [
799 #include <linux/inetdevice.h>
801 const struct in_ifaddr *ifa = NULL;
802 struct in_device *in_dev = NULL;
804 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
806 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
807 ['in_dev_for_each_ifa_rtnl' is defined])
809 EXTRA_KCFLAGS="$tmp_flags"
810 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
813 # LN_IB_DEVICE_OPS_EXISTS
815 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
816 # RDMA/core: Introduce ib_device_ops
817 # ... introduces the ib_device_ops structure that defines all the
818 # InfiniBand device operations in one place ...
820 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
821 tmp_flags="$EXTRA_KCFLAGS"
822 EXTRA_KCFLAGS="-Werror"
823 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
824 ib_device_ops_test, [
825 #include <rdma/ib_verbs.h>
827 int x = offsetof(struct ib_device_ops, unmap_fmr);
831 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
832 [if struct ib_device_ops is defined])
834 EXTRA_KCFLAGS="$tmp_flags"
835 ]) # LN_IB_DEVICE_OPS_EXISTS
838 # LN_IB_SG_DMA_ADDRESS_EXISTS
840 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
841 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
842 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
844 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
845 tmp_flags="$EXTRA_KCFLAGS"
846 EXTRA_KCFLAGS="-Werror"
847 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
848 ib_sg_dma_address_test, [
849 #include <rdma/ib_verbs.h>
851 u64 x = ib_sg_dma_address(NULL, NULL);
855 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
856 [if ib_sg_dma_address wrapper exists])
858 EXTRA_KCFLAGS="$tmp_flags"
859 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
865 AC_DEFUN([LN_USR_RDMA], [
866 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
867 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
868 #include <rdma/rdma_user_cm.h>
871 int x = (int)RDMA_PS_TCP;
875 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
876 [RDMA_PS_TCP exists])
881 AC_DEFUN([LN_PROG_LINUX_SRC], [])
882 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
887 # LNet linux kernel checks
889 AC_DEFUN([LN_PROG_LINUX], [
890 AC_MSG_NOTICE([LNet kernel checks
891 ==============================================================================])
896 LN_CONFIG_STRSCPY_EXISTS
898 LN_EXPORT_KMAP_TO_PAGE
900 LN_CONFIG_SK_DATA_READY
902 LN_CONFIG_SOCK_CREATE_KERN
904 LN_HAVE_HYPERVISOR_IS_TYPE
905 LN_HAVE_ORACLE_OFED_EXTENSIONS
907 LN_CONFIG_SOCK_GETNAME
908 # 5.3 and 4.18.0-193.el8
909 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
915 # default paths for installed files
917 AC_DEFUN([LN_PATH_DEFAULTS], [
918 ]) # LN_PATH_DEFAULTS
923 # other configure checks
925 AC_DEFUN([LN_CONFIGURE], [
926 AC_MSG_NOTICE([LNet core checks
927 ==============================================================================])
930 AS_HELP_STRING([--with-cuda=path],
931 [Use a CUDA sources.]),
932 [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
933 [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
937 AS_HELP_STRING([--with-gds=path],
938 [Use a gds sources.]),
939 [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
940 [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
943 AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
944 LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
946 AC_MSG_RESULT([CUDA path is $CUDA_PATH])
949 [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
952 LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
954 LB_CHECK_FILE([$GDS_PATH/config-host.h], [
955 AC_MSG_RESULT([GDS path is $GDS_PATH])
957 AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
962 AC_MSG_WARN([CUDA or GDS sources don't found. GDS support disabled])
966 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
967 AS_IF([test "x$enable_dist" = xno], [
968 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
971 AC_CHECK_LIB([nl-3], [nla_get_s32], [
972 AC_DEFINE(HAVE_NLA_GET_S32, 1,
973 [libnl3 supports nla_get_s32])
977 AC_CHECK_LIB([nl-3], [nla_get_s64], [
978 AC_DEFINE(HAVE_NLA_GET_S64, 1,
979 [libnl3 supports nla_get_s64])
986 AC_DEFUN([LN_USR_NLMSGERR], [
987 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
988 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
989 #include <linux/netlink.h>
992 int x = (int)NLMSGERR_ATTR_MAX;
996 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
997 ['enum nlmsgerr_attrs' exists])
1001 # lnet/utils/portals.c
1002 AC_CHECK_HEADERS([netdb.h])
1003 AC_CHECK_FUNCS([gethostbyname])
1005 # lnet/utils/wirecheck.c
1006 AC_CHECK_FUNCS([strnlen])
1008 # -------- Check for required packages --------------
1010 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1011 AC_ARG_ENABLE(efence,
1012 AS_HELP_STRING([--enable-efence],
1013 [use efence library]),
1014 [], [enable_efence="no"])
1015 AC_MSG_RESULT([$enable_efence])
1018 AS_IF([test "$enable_efence" = yes], [
1019 LIBEFENCE="-lefence"
1020 AC_DEFINE(HAVE_LIBEFENCE, 1,
1021 [libefence support is requested])
1033 # AM_CONDITIONAL defines for lnet
1035 AC_DEFUN([LN_CONDITIONALS], [
1036 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1037 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1038 ]) # LN_CONDITIONALS
1043 # files that should be generated with AC_OUTPUT
1045 AC_DEFUN([LN_CONFIG_FILES], [
1049 lnet/autoconf/Makefile
1051 lnet/include/Makefile
1052 lnet/include/lnet/Makefile
1053 lnet/include/uapi/linux/lnet/Makefile
1055 lnet/klnds/autoMakefile
1056 lnet/klnds/o2iblnd/Makefile
1057 lnet/klnds/o2iblnd/autoMakefile
1058 lnet/klnds/gnilnd/Makefile
1059 lnet/klnds/gnilnd/autoMakefile
1060 lnet/klnds/socklnd/Makefile
1061 lnet/klnds/socklnd/autoMakefile
1063 lnet/lnet/autoMakefile
1064 lnet/selftest/Makefile
1065 lnet/selftest/autoMakefile
1067 lnet/utils/lnetconfig/Makefile
1069 ]) # LN_CONFIG_FILES