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 AC_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 AC_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 $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
210 if test -f $O2IBPATH/Module.symvers; then
211 O2IB_SYMVER=$O2IBPATH/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])
223 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
224 linux_kthread_worker, [
225 #ifdef HAVE_COMPAT_RDMA
227 #undef PACKAGE_TARNAME
228 #undef PACKAGE_VERSION
229 #undef PACKAGE_STRING
230 #undef PACKAGE_BUGREPORT
232 #include <linux/compat-2.6.h>
234 #include <linux/kthread.h>
236 struct kthread_work *kth_wrk = NULL;
237 flush_kthread_work(kth_wrk);
239 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
240 if test -z "$COMPAT_AUTOCONF"; then
241 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
244 EXTRA_CHECK_INCLUDE=""
247 AC_SUBST(EXTRA_OFED_CONFIG)
248 AC_SUBST(EXTRA_OFED_INCLUDE)
253 AS_IF([test $ENABLEO2IB != "no"], [
254 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
255 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
257 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
258 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
259 rdma_create_id_4args, [
260 #ifdef HAVE_COMPAT_RDMA
262 #undef PACKAGE_TARNAME
263 #undef PACKAGE_VERSION
264 #undef PACKAGE_STRING
265 #undef PACKAGE_BUGREPORT
267 #include <linux/compat-2.6.h>
269 #include <rdma/rdma_cm.h>
271 rdma_create_id(NULL, NULL, 0, 0);
273 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
274 [rdma_create_id wants 4 args])
277 # 4.4 added network namespace parameter for rdma_create_id()
278 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
279 rdma_create_id_5args, [
280 #ifdef HAVE_COMPAT_RDMA
282 #undef PACKAGE_TARNAME
283 #undef PACKAGE_VERSION
284 #undef PACKAGE_STRING
285 #undef PACKAGE_BUGREPORT
287 #include <linux/compat-2.6.h>
289 #include <rdma/rdma_cm.h>
291 rdma_create_id(NULL, NULL, NULL, 0, 0);
293 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
294 [rdma_create_id wants 5 args])
297 # 4.2 introduced struct ib_cq_init_attr which is used
298 # by ib_create_cq(). Note some OFED stacks only keep
299 # their headers in sync with latest kernels but not
300 # the functionality which means for infiniband testing
301 # we need to always test functionality testings.
302 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
304 #ifdef HAVE_COMPAT_RDMA
306 #undef PACKAGE_TARNAME
307 #undef PACKAGE_VERSION
308 #undef PACKAGE_STRING
309 #undef PACKAGE_BUGREPORT
311 #include <linux/compat-2.6.h>
313 #include <rdma/ib_verbs.h>
315 struct ib_cq_init_attr cq_attr;
317 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
319 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
320 [struct ib_cq_init_attr is used by ib_create_cq])
323 # 4.3 removed ib_alloc_fast_reg_mr()
324 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
325 ib_alloc_fast_reg_mr, [
326 #ifdef HAVE_COMPAT_RDMA
328 #undef PACKAGE_TARNAME
329 #undef PACKAGE_VERSION
330 #undef PACKAGE_STRING
331 #undef PACKAGE_BUGREPORT
333 #include <linux/compat-2.6.h>
335 #include <rdma/ib_verbs.h>
337 ib_alloc_fast_reg_mr(NULL, 0);
339 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
340 [ib_alloc_fast_reg_mr is defined])
343 # 4.9 must stop using ib_get_dma_mr and the global MR
344 # We then have to use FMR/Fastreg for all RDMA.
345 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
347 #ifdef HAVE_COMPAT_RDMA
349 #undef PACKAGE_TARNAME
350 #undef PACKAGE_VERSION
351 #undef PACKAGE_STRING
352 #undef PACKAGE_BUGREPORT
354 #include <linux/compat-2.6.h>
356 #include <rdma/ib_verbs.h>
358 ib_get_dma_mr(NULL, 0);
360 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
361 [ib_get_dma_mr is defined])
364 # In v4.4 Linux kernel,
365 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
366 # split up struct ib_send_wr so that all non-trivial verbs
367 # use their own structure which embedds struct ib_send_wr.
368 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
370 #ifdef HAVE_COMPAT_RDMA
372 #undef PACKAGE_TARNAME
373 #undef PACKAGE_VERSION
374 #undef PACKAGE_STRING
375 #undef PACKAGE_BUGREPORT
377 #include <linux/compat-2.6.h>
379 #include <rdma/ib_verbs.h>
381 struct ib_rdma_wr *wr __attribute__ ((unused));
385 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
386 [struct ib_rdma_wr is defined])
389 # new fast registration API introduced in 4.4
390 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
391 ib_map_mr_sg_4args, [
392 #ifdef HAVE_COMPAT_RDMA
394 #undef PACKAGE_TARNAME
395 #undef PACKAGE_VERSION
396 #undef PACKAGE_STRING
397 #undef PACKAGE_BUGREPORT
399 #include <linux/compat-2.6.h>
401 #include <rdma/ib_verbs.h>
403 ib_map_mr_sg(NULL, NULL, 0, 0);
405 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
406 [ib_map_mr_sg exists])
409 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
410 # in kernel 4.7 (and RHEL 7.3)
411 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
412 ib_map_mr_sg_5args, [
413 #ifdef HAVE_COMPAT_RDMA
415 #undef PACKAGE_TARNAME
416 #undef PACKAGE_VERSION
417 #undef PACKAGE_STRING
418 #undef PACKAGE_BUGREPORT
420 #include <linux/compat-2.6.h>
422 #include <rdma/ib_verbs.h>
424 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
426 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
427 [ib_map_mr_sg exists])
428 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
429 [ib_map_mr_sg has 5 arguments])
432 # ib_query_device() removed in 4.5
433 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
435 #ifdef HAVE_COMPAT_RDMA
437 #undef PACKAGE_TARNAME
438 #undef PACKAGE_VERSION
439 #undef PACKAGE_STRING
440 #undef PACKAGE_BUGREPORT
442 #include <linux/compat-2.6.h>
444 #include <rdma/ib_verbs.h>
446 struct ib_device dev;
447 struct ib_device_attr dev_attr = {};
448 dev.attrs = dev_attr;
450 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
451 [struct ib_device.attrs is defined])
454 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
455 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
456 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
458 #ifdef HAVE_COMPAT_RDMA
460 #undef PACKAGE_TARNAME
461 #undef PACKAGE_VERSION
462 #undef PACKAGE_STRING
463 #undef PACKAGE_BUGREPORT
465 #include <linux/compat-2.6.h>
467 #include <rdma/ib_verbs.h>
469 ib_alloc_pd(NULL, 0);
471 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
472 [ib_alloc_pd has 2 arguments])
475 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
477 #ifdef HAVE_COMPAT_RDMA
479 #undef PACKAGE_TARNAME
480 #undef PACKAGE_VERSION
481 #undef PACKAGE_STRING
482 #undef PACKAGE_BUGREPORT
484 #include <linux/compat-2.6.h>
486 #include <rdma/ib_verbs.h>
488 (void)ib_inc_rkey(0);
490 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
491 [function ib_inc_rkey exist])
494 # In MOFED 4.6, the second and third parameters for
495 # ib_post_send() and ib_post_recv() are declared with
497 tmp_flags="$EXTRA_KCFLAGS"
498 EXTRA_KCFLAGS="-Werror"
499 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
500 ib_post_send_recv_const, [
501 #ifdef HAVE_COMPAT_RDMA
503 #undef PACKAGE_TARNAME
504 #undef PACKAGE_VERSION
505 #undef PACKAGE_STRING
506 #undef PACKAGE_BUGREPORT
508 #include <linux/compat-2.6.h>
510 #include <rdma/ib_verbs.h>
512 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
513 (const struct ib_send_wr **)NULL);
515 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
516 [ib_post_send and ib_post_recv have const parameters])
518 EXTRA_KCFLAGS="$tmp_flags"
521 LN_IB_DEVICE_OPS_EXISTS
523 LN_IB_SG_DMA_ADDRESS_EXISTS
525 # A reason argument was added to rdma_reject() in Linux 5.8,
526 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
527 LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
529 #ifdef HAVE_COMPAT_RDMA
531 #undef PACKAGE_TARNAME
532 #undef PACKAGE_VERSION
533 #undef PACKAGE_STRING
534 #undef PACKAGE_BUGREPORT
536 #include <linux/compat-2.6.h>
538 #include <rdma/ib_verbs.h>
539 #include <rdma/ib_cm.h>
540 #include <rdma/rdma_cm.h>
542 rdma_reject(NULL, NULL, 0, 0);
544 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
545 [rdma_reject has 4 arguments])
548 # The FMR pool API was removed in Linux 5.8,
549 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
550 LB_CHECK_COMPILE([if FMR pools API available],
552 #include <rdma/ib_verbs.h>
554 struct ib_fmr fmr = {};
556 AC_DEFINE(HAVE_FMR_POOL_API, 1,
557 [FMR pool API is available])
560 # rdma_connect_locked() was added in Linux 5.10,
561 # commit 071ba4cc559de47160761b9500b72e8fa09d923d
562 # and in MOFED-5.2-2. rdma_connect_locked() must
563 # be called instead of rdma_connect() in
564 # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
565 LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
566 rdma_connect_locked, [
567 #include <rdma/rdma_cm.h>
569 rdma_connect_locked(NULL, NULL);
571 AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
572 [rdma_connect_locked is defined])
575 # ethtool_link_settings was added in Linux 4.6
576 LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
577 ethtool_link_settings, [
578 #include <linux/ethtool.h>
580 struct ethtool_link_ksettings cmd;
582 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
583 [ethtool_link_settings is defined])
586 EXTRA_CHECK_INCLUDE=""
587 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
588 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
589 ]) # ENABLEO2IB != "no"
595 # check whether to use the Gemini Network Interface lnd
597 AC_DEFUN([LN_CONFIG_GNILND], [
598 AC_MSG_CHECKING([whether to enable GNI lnd])
600 AC_HELP_STRING([--enable-gni],
602 [], [enable_gni="no"])
603 AC_MSG_RESULT([$enable_gni])
605 AS_IF([test "x$enable_gni" = xyes], [
606 # GNICPPFLAGS was set in spec file
607 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
608 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
609 LB_CHECK_COMPILE([if GNI kernel headers are present],
611 #include <linux/types.h>
614 gni_cdm_handle_t kgni_domain;
617 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
618 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
623 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
625 # at this point, we have gnilnd basic support,
626 # now check for extra features
627 LB_CHECK_COMPILE([to use RCA in gnilnd],
629 #include <linux/types.h>
631 #include <krca_lib.h>
633 gni_cdm_handle_t kgni_domain;
635 krca_ticket_t ticket = KRCA_NULL_TICKET;
637 __u32 nid = 0, nic_addr;
638 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
639 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
640 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
641 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
644 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
646 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
648 AC_SUBST(GNICPPFLAGS)
650 ]) # LN_CONFIG_GNILND
652 # LN_CONFIG_STRSCPY_EXISTS
654 # If strscpy exists, prefer it over strlcpy
656 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
657 tmp_flags="$EXTRA_KCFLAGS"
658 EXTRA_KCFLAGS="-Werror"
659 LB_CHECK_COMPILE([kernel strscpy is available],
661 #include <linux/string.h>
663 strscpy((char *)NULL, (const char *)NULL, 0);
665 AC_DEFINE(HAVE_STRSCPY, 1,
666 [kernel strscpy is available])
668 EXTRA_KCFLAGS="$tmp_flags"
669 ]) # LN_CONFIG_STRSCPY_EXISTS
671 # LN_CONFIG_SOCK_CREATE_KERN
673 # 4.x sock_create_kern() added a first parameter as 'struct net *'
676 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
677 tmp_flags="$EXTRA_KCFLAGS"
678 EXTRA_KCFLAGS="-Werror"
679 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
680 sock_create_kern_net, [
681 #include <linux/net.h>
682 #include <net/net_namespace.h>
684 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
686 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
687 [sock_create_kern use net as first parameter])
689 EXTRA_KCFLAGS="$tmp_flags"
690 ]) # LN_CONFIG_SOCK_CREATE_KERN
693 # LN_CONFIG_SK_DATA_READY
695 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
697 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
698 tmp_flags="$EXTRA_KCFLAGS"
699 EXTRA_KCFLAGS="-Werror"
700 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
702 #include <linux/net.h>
703 #include <net/sock.h>
705 ((struct sock *)0)->sk_data_ready(NULL);
707 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
708 [sk_data_ready uses only one argument])
710 EXTRA_KCFLAGS="$tmp_flags"
711 ]) # LN_CONFIG_SK_DATA_READY
714 # LN_EXPORT_KMAP_TO_PAGE
716 # 3.10 Export kmap_to_page
718 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
719 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
720 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
721 [kmap_to_page is exported by the kernel])])
722 ]) # LN_EXPORT_KMAP_TO_PAG
725 # LN_HAVE_HYPERVISOR_IS_TYPE
727 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
728 # x86/paravirt: Provide a way to check for hypervisors
730 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
731 tmp_flags="$EXTRA_KCFLAGS"
732 EXTRA_KCFLAGS="-Werror"
733 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
734 hypervisor_is_type_exists, [
735 #include <asm/hypervisor.h>
737 (void)hypervisor_is_type(X86_HYPER_NATIVE);
739 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
740 [hypervisor_is_type function exists])
742 EXTRA_KCFLAGS="$tmp_flags"
743 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
746 # LN_HAVE_ORACLE_OFED_EXTENSIONS
750 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
751 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
753 #include <rdma/ib_fmr_pool.h>
755 struct ib_fmr_pool_param param = {
760 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
761 [if Oracle OFED Extensions are enabled])
763 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
766 # LN_CONFIG_SOCK_GETNAME
768 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
769 # does not take the length *int argument and returns the length
771 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
772 tmp_flags="$EXTRA_KCFLAGS"
773 EXTRA_KCFLAGS="-Werror"
774 LB_CHECK_COMPILE([if 'getname' has two args],
775 kern_sock_getname_2args, [
776 #include <linux/net.h>
778 kernel_getsockname(NULL, NULL);
780 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
781 ['getname' has two args])
783 EXTRA_KCFLAGS="$tmp_flags"
784 ]) # LN_CONFIG_SOCK_GETNAME
787 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
789 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
790 # and kernel 4.18.0-193.el8:
791 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
792 # and removed for_ifa and endfor_ifa.
793 # Use the _rntl variant as the current locking is rtnl.
795 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
796 tmp_flags="$EXTRA_KCFLAGS"
797 EXTRA_KCFLAGS="-Werror"
798 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
799 in_dev_for_each_ifa_rtnl_test, [
800 #include <linux/inetdevice.h>
802 const struct in_ifaddr *ifa = NULL;
803 struct in_device *in_dev = NULL;
805 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
807 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
808 ['in_dev_for_each_ifa_rtnl' is defined])
810 EXTRA_KCFLAGS="$tmp_flags"
811 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
814 # LN_IB_DEVICE_OPS_EXISTS
816 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
817 # RDMA/core: Introduce ib_device_ops
818 # ... introduces the ib_device_ops structure that defines all the
819 # InfiniBand device operations in one place ...
821 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
822 tmp_flags="$EXTRA_KCFLAGS"
823 EXTRA_KCFLAGS="-Werror"
824 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
825 ib_device_ops_test, [
826 #include <rdma/ib_verbs.h>
828 int x = offsetof(struct ib_device_ops, unmap_fmr);
832 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
833 [if struct ib_device_ops is defined])
835 EXTRA_KCFLAGS="$tmp_flags"
836 ]) # LN_IB_DEVICE_OPS_EXISTS
839 # LN_IB_SG_DMA_ADDRESS_EXISTS
841 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
842 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
843 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
845 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
846 tmp_flags="$EXTRA_KCFLAGS"
847 EXTRA_KCFLAGS="-Werror"
848 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
849 ib_sg_dma_address_test, [
850 #include <rdma/ib_verbs.h>
852 u64 x = ib_sg_dma_address(NULL, NULL);
856 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
857 [if ib_sg_dma_address wrapper exists])
859 EXTRA_KCFLAGS="$tmp_flags"
860 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
866 AC_DEFUN([LN_USR_RDMA], [
867 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
868 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
869 #include <rdma/rdma_user_cm.h>
872 int x = (int)RDMA_PS_TCP;
876 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
877 [RDMA_PS_TCP exists])
882 AC_DEFUN([LN_PROG_LINUX_SRC], [])
883 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
888 # LNet linux kernel checks
890 AC_DEFUN([LN_PROG_LINUX], [
891 AC_MSG_NOTICE([LNet kernel checks
892 ==============================================================================])
897 LN_CONFIG_STRSCPY_EXISTS
899 LN_EXPORT_KMAP_TO_PAGE
901 LN_CONFIG_SK_DATA_READY
903 LN_CONFIG_SOCK_CREATE_KERN
905 LN_HAVE_HYPERVISOR_IS_TYPE
906 LN_HAVE_ORACLE_OFED_EXTENSIONS
908 LN_CONFIG_SOCK_GETNAME
909 # 5.3 and 4.18.0-193.el8
910 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
916 # default paths for installed files
918 AC_DEFUN([LN_PATH_DEFAULTS], [
919 ]) # LN_PATH_DEFAULTS
924 # other configure checks
926 AC_DEFUN([LN_CONFIGURE], [
927 AC_MSG_NOTICE([LNet core checks
928 ==============================================================================])
930 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
931 AS_IF([test "x$enable_dist" = xno], [
932 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
935 AC_CHECK_LIB([nl-3], [nla_get_s32], [
936 AC_DEFINE(HAVE_NLA_GET_S32, 1,
937 [libnl3 supports nla_get_s32])
941 AC_CHECK_LIB([nl-3], [nla_get_s64], [
942 AC_DEFINE(HAVE_NLA_GET_S64, 1,
943 [libnl3 supports nla_get_s64])
950 AC_DEFUN([LN_USR_NLMSGERR], [
951 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
952 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
953 #include <linux/netlink.h>
956 int x = (int)NLMSGERR_ATTR_MAX;
960 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
961 ['enum nlmsgerr_attrs' exists])
965 # lnet/utils/portals.c
966 AC_CHECK_HEADERS([netdb.h])
967 AC_CHECK_FUNCS([gethostbyname])
969 # lnet/utils/wirecheck.c
970 AC_CHECK_FUNCS([strnlen])
972 # -------- Check for required packages --------------
974 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
975 AC_ARG_ENABLE(efence,
976 AC_HELP_STRING([--enable-efence],
977 [use efence library]),
978 [], [enable_efence="no"])
979 AC_MSG_RESULT([$enable_efence])
982 AS_IF([test "$enable_efence" = yes], [
984 AC_DEFINE(HAVE_LIBEFENCE, 1,
985 [libefence support is requested])
997 # AM_CONDITIONAL defines for lnet
999 AC_DEFUN([LN_CONDITIONALS], [
1000 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1001 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
1002 ]) # LN_CONDITIONALS
1007 # files that should be generated with AC_OUTPUT
1009 AC_DEFUN([LN_CONFIG_FILES], [
1013 lnet/autoconf/Makefile
1015 lnet/include/Makefile
1016 lnet/include/lnet/Makefile
1017 lnet/include/uapi/linux/lnet/Makefile
1019 lnet/klnds/autoMakefile
1020 lnet/klnds/o2iblnd/Makefile
1021 lnet/klnds/o2iblnd/autoMakefile
1022 lnet/klnds/gnilnd/Makefile
1023 lnet/klnds/gnilnd/autoMakefile
1024 lnet/klnds/socklnd/Makefile
1025 lnet/klnds/socklnd/autoMakefile
1027 lnet/lnet/autoMakefile
1028 lnet/selftest/Makefile
1029 lnet/selftest/autoMakefile
1031 lnet/utils/lnetconfig/Makefile
1033 ]) # LN_CONFIG_FILES