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 | egrep -w 'mlnx-ofed-kernel-dkms|mlnx-ofa_kernel-devel|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs $LSPKG | grep '\(/openib\|/ofa_kernel/default\|/ofa_kernel\)$' | head -n1)
70 AS_IF([test -z "$O2IBPATHS"], [
72 You seem to have an OFED installed but have not installed it's devel package.
73 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
74 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.
77 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
79 It appears that you have multiple OFED versions installed.
80 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.
81 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.
84 if test -e $O2IBPATHS/${LINUXRELEASE}; then
85 O2IBPATHS=$O2IBPATHS/${LINUXRELEASE}
86 elif test -e $O2IBPATHS/default; then
87 O2IBPATHS=$O2IBPATHS/default
91 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
97 *) O2IBPATHS=$with_o2ib
103 AS_IF([test $ENABLEO2IB = "no"], [
105 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
106 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
109 for O2IBPATH in $O2IBPATHS; do
110 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
111 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
112 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
113 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
118 if ! $o2ib_found; then
121 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
122 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
123 *) AC_MSG_ERROR([internal error]) ;;
127 compatrdma_found=false
128 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
130 compatrdma_found=true
131 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
132 EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
133 if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
134 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
139 if ! $compatrdma_found; then
140 if test -f "$O2IBPATH/config.mk"; then
141 . "$O2IBPATH/config.mk"
142 elif test -f "$O2IBPATH/ofed_patch.mk"; then
143 . "$O2IBPATH/ofed_patch.mk"
145 elif test -z "$COMPAT_AUTOCONF"; then
147 if test "x$RHEL_KERNEL" = xyes; then
148 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
149 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
150 while test "$I" -ge 0; do
151 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
154 elif test "x$SUSE_KERNEL" = xyes; then
155 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
156 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
160 AC_MSG_CHECKING([whether to use any OFED backport headers])
161 if test -n "$BACKPORT_INCLUDES"; then
163 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
164 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
170 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
171 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include -I$O2IBPATH/include/uapi"
172 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
173 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
174 openib_gen2_support, [
175 #ifdef HAVE_COMPAT_RDMA
177 #undef PACKAGE_TARNAME
178 #undef PACKAGE_VERSION
179 #undef PACKAGE_STRING
180 #undef PACKAGE_BUGREPORT
182 #include <linux/compat-2.6.h>
184 #include <linux/version.h>
185 #include <linux/pci.h>
186 #include <linux/gfp.h>
187 #include <rdma/rdma_cm.h>
188 #include <rdma/ib_cm.h>
189 #include <rdma/ib_verbs.h>
190 #include <rdma/ib_fmr_pool.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 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
197 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
198 rdma_destroy_id(NULL);
203 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
204 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
205 *) AC_MSG_ERROR([internal error]) ;;
208 # we know at this point that the found OFED source is good
210 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
211 if test -f $O2IBPATH/Module.symvers; then
212 O2IB_SYMVER=$O2IBPATH/Module.symvers;
215 if test -n "$O2IB_SYMVER"; then
216 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
217 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
218 AC_SUBST(EXTRA_SYMBOLS)
220 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
224 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
225 linux_kthread_worker, [
226 #ifdef HAVE_COMPAT_RDMA
228 #undef PACKAGE_TARNAME
229 #undef PACKAGE_VERSION
230 #undef PACKAGE_STRING
231 #undef PACKAGE_BUGREPORT
233 #include <linux/compat-2.6.h>
235 #include <linux/kthread.h>
237 struct kthread_work *kth_wrk = NULL;
238 flush_kthread_work(kth_wrk);
240 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
241 if test -z "$COMPAT_AUTOCONF"; then
242 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
245 EXTRA_CHECK_INCLUDE=""
248 AC_SUBST(EXTRA_OFED_CONFIG)
249 AC_SUBST(EXTRA_OFED_INCLUDE)
254 AS_IF([test $ENABLEO2IB != "no"], [
255 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
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 EXTRA_CHECK_INCLUDE=""
526 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
527 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
528 ]) # ENABLEO2IB != "no"
534 # check whether to use the Gemini Network Interface lnd
536 AC_DEFUN([LN_CONFIG_GNILND], [
537 AC_MSG_CHECKING([whether to enable GNI lnd])
539 AC_HELP_STRING([--enable-gni],
541 [], [enable_gni="no"])
542 AC_MSG_RESULT([$enable_gni])
544 AS_IF([test "x$enable_gni" = xyes], [
545 # GNICPPFLAGS was set in spec file
546 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
547 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
548 LB_CHECK_COMPILE([if GNI kernel headers are present],
550 #include <linux/types.h>
553 gni_cdm_handle_t kgni_domain;
556 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
557 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
562 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
564 # at this point, we have gnilnd basic support,
565 # now check for extra features
566 LB_CHECK_COMPILE([to use RCA in gnilnd],
568 #include <linux/types.h>
570 #include <krca_lib.h>
572 gni_cdm_handle_t kgni_domain;
574 krca_ticket_t ticket = KRCA_NULL_TICKET;
576 __u32 nid = 0, nic_addr;
577 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
578 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
579 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
580 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
583 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
585 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
587 AC_SUBST(GNICPPFLAGS)
589 ]) # LN_CONFIG_GNILND
591 # LN_CONFIG_SOCK_CREATE_KERN
593 # 4.x sock_create_kern() added a first parameter as 'struct net *'
596 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
597 tmp_flags="$EXTRA_KCFLAGS"
598 EXTRA_KCFLAGS="-Werror"
599 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
600 sock_create_kern_net, [
601 #include <linux/net.h>
602 #include <net/net_namespace.h>
604 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
606 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
607 [sock_create_kern use net as first parameter])
609 EXTRA_KCFLAGS="$tmp_flags"
610 ]) # LN_CONFIG_SOCK_CREATE_KERN
613 # LN_CONFIG_SK_DATA_READY
615 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
617 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
618 tmp_flags="$EXTRA_KCFLAGS"
619 EXTRA_KCFLAGS="-Werror"
620 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
622 #include <linux/net.h>
623 #include <net/sock.h>
625 ((struct sock *)0)->sk_data_ready(NULL);
627 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
628 [sk_data_ready uses only one argument])
630 EXTRA_KCFLAGS="$tmp_flags"
631 ]) # LN_CONFIG_SK_DATA_READY
634 # LN_EXPORT_KMAP_TO_PAGE
636 # 3.10 Export kmap_to_page
638 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
639 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
640 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
641 [kmap_to_page is exported by the kernel])])
642 ]) # LN_EXPORT_KMAP_TO_PAG
645 # LN_HAVE_HYPERVISOR_IS_TYPE
647 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
648 # x86/paravirt: Provide a way to check for hypervisors
650 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
651 tmp_flags="$EXTRA_KCFLAGS"
652 EXTRA_KCFLAGS="-Werror"
653 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
654 hypervisor_is_type_exists, [
655 #include <asm/hypervisor.h>
657 (void)hypervisor_is_type(X86_HYPER_NATIVE);
659 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
660 [hypervisor_is_type function exists])
662 EXTRA_KCFLAGS="$tmp_flags"
663 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
666 # LN_HAVE_ORACLE_OFED_EXTENSIONS
670 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
671 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
673 #include <rdma/ib_fmr_pool.h>
675 struct ib_fmr_pool_param param = {
680 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
681 [if Oracle OFED Extensions are enabled])
683 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
686 # LN_CONFIG_SOCK_GETNAME
688 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
689 # does not take the length *int argument and returns the length
691 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
692 tmp_flags="$EXTRA_KCFLAGS"
693 EXTRA_KCFLAGS="-Werror"
694 LB_CHECK_COMPILE([if 'getname' has two args],
695 kern_sock_getname_2args, [
696 #include <linux/net.h>
698 kernel_getsockname(NULL, NULL);
700 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
701 ['getname' has two args])
703 EXTRA_KCFLAGS="$tmp_flags"
704 ]) # LN_CONFIG_SOCK_GETNAME
707 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
709 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
710 # and kernel 4.18.0-193.el8:
711 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
712 # and removed for_ifa and endfor_ifa.
713 # Use the _rntl variant as the current locking is rtnl.
715 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
716 tmp_flags="$EXTRA_KCFLAGS"
717 EXTRA_KCFLAGS="-Werror"
718 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
719 in_dev_for_each_ifa_rtnl_test, [
720 #include <linux/inetdevice.h>
722 const struct in_ifaddr *ifa = NULL;
723 struct in_device *in_dev = NULL;
725 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
727 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
728 ['in_dev_for_each_ifa_rtnl' is defined])
730 EXTRA_KCFLAGS="$tmp_flags"
731 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
734 # LN_IB_DEVICE_OPS_EXISTS
736 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
737 # RDMA/core: Introduce ib_device_ops
738 # ... introduces the ib_device_ops structure that defines all the
739 # InfiniBand device operations in one place ...
741 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
742 tmp_flags="$EXTRA_KCFLAGS"
743 EXTRA_KCFLAGS="-Werror"
744 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
745 ib_device_ops_test, [
746 #include <rdma/ib_verbs.h>
748 int x = offsetof(struct ib_device_ops, unmap_fmr);
752 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
753 [if struct ib_device_ops is defined])
755 EXTRA_KCFLAGS="$tmp_flags"
756 ]) # LN_IB_DEVICE_OPS_EXISTS
759 # LN_IB_SG_DMA_ADDRESS_EXISTS
761 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
762 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
763 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
765 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
766 tmp_flags="$EXTRA_KCFLAGS"
767 EXTRA_KCFLAGS="-Werror"
768 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
769 ib_sg_dma_address_test, [
770 #include <rdma/ib_verbs.h>
772 u64 x = ib_sg_dma_address(NULL, NULL);
776 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
777 [if ib_sg_dma_address wrapper exists])
779 EXTRA_KCFLAGS="$tmp_flags"
780 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
786 AC_DEFUN([LN_USR_RDMA], [
787 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
788 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
789 #include <rdma/rdma_user_cm.h>
792 int x = (int)RDMA_PS_TCP;
796 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
797 [RDMA_PS_TCP exists])
802 AC_DEFUN([LN_PROG_LINUX_SRC], [])
803 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
808 # LNet linux kernel checks
810 AC_DEFUN([LN_PROG_LINUX], [
811 AC_MSG_NOTICE([LNet kernel checks
812 ==============================================================================])
818 LN_EXPORT_KMAP_TO_PAGE
820 LN_CONFIG_SK_DATA_READY
822 LN_CONFIG_SOCK_CREATE_KERN
824 LN_HAVE_HYPERVISOR_IS_TYPE
825 LN_HAVE_ORACLE_OFED_EXTENSIONS
827 LN_CONFIG_SOCK_GETNAME
828 # 5.3 and 4.18.0-193.el8
829 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
835 # default paths for installed files
837 AC_DEFUN([LN_PATH_DEFAULTS], [
838 ]) # LN_PATH_DEFAULTS
843 # other configure checks
845 AC_DEFUN([LN_CONFIGURE], [
846 AC_MSG_NOTICE([LNet core checks
847 ==============================================================================])
849 # lnet/utils/portals.c
850 AC_CHECK_HEADERS([netdb.h])
851 AC_CHECK_FUNCS([gethostbyname])
853 # lnet/utils/wirecheck.c
854 AC_CHECK_FUNCS([strnlen])
856 # -------- Check for required packages --------------
858 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
859 AC_ARG_ENABLE(efence,
860 AC_HELP_STRING([--enable-efence],
861 [use efence library]),
862 [], [enable_efence="no"])
863 AC_MSG_RESULT([$enable_efence])
866 AS_IF([test "$enable_efence" = yes], [
868 AC_DEFINE(HAVE_LIBEFENCE, 1,
869 [libefence support is requested])
880 # AM_CONDITIONAL defines for lnet
882 AC_DEFUN([LN_CONDITIONALS], [
883 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
884 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
890 # files that should be generated with AC_OUTPUT
892 AC_DEFUN([LN_CONFIG_FILES], [
896 lnet/autoconf/Makefile
898 lnet/include/Makefile
899 lnet/include/lnet/Makefile
900 lnet/include/uapi/linux/lnet/Makefile
902 lnet/klnds/autoMakefile
903 lnet/klnds/o2iblnd/Makefile
904 lnet/klnds/o2iblnd/autoMakefile
905 lnet/klnds/gnilnd/Makefile
906 lnet/klnds/gnilnd/autoMakefile
907 lnet/klnds/socklnd/Makefile
908 lnet/klnds/socklnd/autoMakefile
910 lnet/lnet/autoMakefile
911 lnet/selftest/Makefile
912 lnet/selftest/autoMakefile
914 lnet/utils/lnetconfig/Makefile