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 \)], [
117 if ! $o2ib_found; then
120 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
121 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
122 *) AC_MSG_ERROR([internal error]) ;;
126 compatrdma_found=false
127 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
129 compatrdma_found=true
130 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
131 EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
132 if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
133 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
138 if ! $compatrdma_found; then
139 if test -f "$O2IBPATH/config.mk"; then
140 . "$O2IBPATH/config.mk"
141 elif test -f "$O2IBPATH/ofed_patch.mk"; then
142 . "$O2IBPATH/ofed_patch.mk"
144 elif test -z "$COMPAT_AUTOCONF"; then
146 if test "x$RHEL_KERNEL" = xyes; then
147 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
148 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
149 while test "$I" -ge 0; do
150 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
153 elif test "x$SUSE_KERNEL" = xyes; then
154 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
155 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
159 AC_MSG_CHECKING([whether to use any OFED backport headers])
160 if test -n "$BACKPORT_INCLUDES"; then
162 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
163 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
169 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
170 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include -I$O2IBPATH/include/uapi"
171 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
172 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
173 openib_gen2_support, [
174 #ifdef HAVE_COMPAT_RDMA
176 #undef PACKAGE_TARNAME
177 #undef PACKAGE_VERSION
178 #undef PACKAGE_STRING
179 #undef PACKAGE_BUGREPORT
181 #include <linux/compat-2.6.h>
183 #include <linux/version.h>
184 #include <linux/pci.h>
185 #include <linux/gfp.h>
186 #include <rdma/rdma_cm.h>
187 #include <rdma/ib_cm.h>
188 #include <rdma/ib_verbs.h>
190 struct rdma_cm_id *cm_idi __attribute__ ((unused));
191 struct rdma_conn_param conn_param __attribute__ ((unused));
192 struct ib_device_attr device_attr __attribute__ ((unused));
193 struct ib_qp_attr qp_attr __attribute__ ((unused));
194 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
195 rdma_destroy_id(NULL);
200 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
201 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
202 *) AC_MSG_ERROR([internal error]) ;;
205 # we know at this point that the found OFED source is good
207 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
208 if test -f $O2IBPATH/Module.symvers; then
209 O2IB_SYMVER=$O2IBPATH/Module.symvers;
212 if test -n "$O2IB_SYMVER"; then
213 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
214 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
215 AC_SUBST(EXTRA_SYMBOLS)
217 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
221 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
222 linux_kthread_worker, [
223 #ifdef HAVE_COMPAT_RDMA
225 #undef PACKAGE_TARNAME
226 #undef PACKAGE_VERSION
227 #undef PACKAGE_STRING
228 #undef PACKAGE_BUGREPORT
230 #include <linux/compat-2.6.h>
232 #include <linux/kthread.h>
234 struct kthread_work *kth_wrk = NULL;
235 flush_kthread_work(kth_wrk);
237 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
238 if test -z "$COMPAT_AUTOCONF"; then
239 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
242 EXTRA_CHECK_INCLUDE=""
245 AC_SUBST(EXTRA_OFED_CONFIG)
246 AC_SUBST(EXTRA_OFED_INCLUDE)
251 AS_IF([test $ENABLEO2IB != "no"], [
252 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
254 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
255 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
256 rdma_create_id_4args, [
257 #ifdef HAVE_COMPAT_RDMA
259 #undef PACKAGE_TARNAME
260 #undef PACKAGE_VERSION
261 #undef PACKAGE_STRING
262 #undef PACKAGE_BUGREPORT
264 #include <linux/compat-2.6.h>
266 #include <rdma/rdma_cm.h>
268 rdma_create_id(NULL, NULL, 0, 0);
270 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
271 [rdma_create_id wants 4 args])
274 # 4.4 added network namespace parameter for rdma_create_id()
275 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
276 rdma_create_id_5args, [
277 #ifdef HAVE_COMPAT_RDMA
279 #undef PACKAGE_TARNAME
280 #undef PACKAGE_VERSION
281 #undef PACKAGE_STRING
282 #undef PACKAGE_BUGREPORT
284 #include <linux/compat-2.6.h>
286 #include <rdma/rdma_cm.h>
288 rdma_create_id(NULL, NULL, NULL, 0, 0);
290 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
291 [rdma_create_id wants 5 args])
294 # 4.2 introduced struct ib_cq_init_attr which is used
295 # by ib_create_cq(). Note some OFED stacks only keep
296 # their headers in sync with latest kernels but not
297 # the functionality which means for infiniband testing
298 # we need to always test functionality testings.
299 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
301 #ifdef HAVE_COMPAT_RDMA
303 #undef PACKAGE_TARNAME
304 #undef PACKAGE_VERSION
305 #undef PACKAGE_STRING
306 #undef PACKAGE_BUGREPORT
308 #include <linux/compat-2.6.h>
310 #include <rdma/ib_verbs.h>
312 struct ib_cq_init_attr cq_attr;
314 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
316 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
317 [struct ib_cq_init_attr is used by ib_create_cq])
320 # 4.3 removed ib_alloc_fast_reg_mr()
321 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
322 ib_alloc_fast_reg_mr, [
323 #ifdef HAVE_COMPAT_RDMA
325 #undef PACKAGE_TARNAME
326 #undef PACKAGE_VERSION
327 #undef PACKAGE_STRING
328 #undef PACKAGE_BUGREPORT
330 #include <linux/compat-2.6.h>
332 #include <rdma/ib_verbs.h>
334 ib_alloc_fast_reg_mr(NULL, 0);
336 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
337 [ib_alloc_fast_reg_mr is defined])
340 # 4.9 must stop using ib_get_dma_mr and the global MR
341 # We then have to use FMR/Fastreg for all RDMA.
342 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
344 #ifdef HAVE_COMPAT_RDMA
346 #undef PACKAGE_TARNAME
347 #undef PACKAGE_VERSION
348 #undef PACKAGE_STRING
349 #undef PACKAGE_BUGREPORT
351 #include <linux/compat-2.6.h>
353 #include <rdma/ib_verbs.h>
355 ib_get_dma_mr(NULL, 0);
357 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
358 [ib_get_dma_mr is defined])
361 # In v4.4 Linux kernel,
362 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
363 # split up struct ib_send_wr so that all non-trivial verbs
364 # use their own structure which embedds struct ib_send_wr.
365 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
367 #ifdef HAVE_COMPAT_RDMA
369 #undef PACKAGE_TARNAME
370 #undef PACKAGE_VERSION
371 #undef PACKAGE_STRING
372 #undef PACKAGE_BUGREPORT
374 #include <linux/compat-2.6.h>
376 #include <rdma/ib_verbs.h>
378 struct ib_rdma_wr *wr __attribute__ ((unused));
382 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
383 [struct ib_rdma_wr is defined])
386 # new fast registration API introduced in 4.4
387 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
388 ib_map_mr_sg_4args, [
389 #ifdef HAVE_COMPAT_RDMA
391 #undef PACKAGE_TARNAME
392 #undef PACKAGE_VERSION
393 #undef PACKAGE_STRING
394 #undef PACKAGE_BUGREPORT
396 #include <linux/compat-2.6.h>
398 #include <rdma/ib_verbs.h>
400 ib_map_mr_sg(NULL, NULL, 0, 0);
402 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
403 [ib_map_mr_sg exists])
406 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
407 # in kernel 4.7 (and RHEL 7.3)
408 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
409 ib_map_mr_sg_5args, [
410 #ifdef HAVE_COMPAT_RDMA
412 #undef PACKAGE_TARNAME
413 #undef PACKAGE_VERSION
414 #undef PACKAGE_STRING
415 #undef PACKAGE_BUGREPORT
417 #include <linux/compat-2.6.h>
419 #include <rdma/ib_verbs.h>
421 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
423 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
424 [ib_map_mr_sg exists])
425 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
426 [ib_map_mr_sg has 5 arguments])
429 # ib_query_device() removed in 4.5
430 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
432 #ifdef HAVE_COMPAT_RDMA
434 #undef PACKAGE_TARNAME
435 #undef PACKAGE_VERSION
436 #undef PACKAGE_STRING
437 #undef PACKAGE_BUGREPORT
439 #include <linux/compat-2.6.h>
441 #include <rdma/ib_verbs.h>
443 struct ib_device dev;
444 struct ib_device_attr dev_attr = {};
445 dev.attrs = dev_attr;
447 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
448 [struct ib_device.attrs is defined])
451 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
452 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
453 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
455 #ifdef HAVE_COMPAT_RDMA
457 #undef PACKAGE_TARNAME
458 #undef PACKAGE_VERSION
459 #undef PACKAGE_STRING
460 #undef PACKAGE_BUGREPORT
462 #include <linux/compat-2.6.h>
464 #include <rdma/ib_verbs.h>
466 ib_alloc_pd(NULL, 0);
468 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
469 [ib_alloc_pd has 2 arguments])
472 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
474 #ifdef HAVE_COMPAT_RDMA
476 #undef PACKAGE_TARNAME
477 #undef PACKAGE_VERSION
478 #undef PACKAGE_STRING
479 #undef PACKAGE_BUGREPORT
481 #include <linux/compat-2.6.h>
483 #include <rdma/ib_verbs.h>
485 (void)ib_inc_rkey(0);
487 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
488 [function ib_inc_rkey exist])
491 # In MOFED 4.6, the second and third parameters for
492 # ib_post_send() and ib_post_recv() are declared with
494 tmp_flags="$EXTRA_KCFLAGS"
495 EXTRA_KCFLAGS="-Werror"
496 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
497 ib_post_send_recv_const, [
498 #ifdef HAVE_COMPAT_RDMA
500 #undef PACKAGE_TARNAME
501 #undef PACKAGE_VERSION
502 #undef PACKAGE_STRING
503 #undef PACKAGE_BUGREPORT
505 #include <linux/compat-2.6.h>
507 #include <rdma/ib_verbs.h>
509 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
510 (const struct ib_send_wr **)NULL);
512 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
513 [ib_post_send and ib_post_recv have const parameters])
515 EXTRA_KCFLAGS="$tmp_flags"
518 LN_IB_DEVICE_OPS_EXISTS
520 LN_IB_SG_DMA_ADDRESS_EXISTS
522 # A reason argument was added to rdma_reject() in Linux 5.8,
523 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
524 LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
526 #ifdef HAVE_COMPAT_RDMA
528 #undef PACKAGE_TARNAME
529 #undef PACKAGE_VERSION
530 #undef PACKAGE_STRING
531 #undef PACKAGE_BUGREPORT
533 #include <linux/compat-2.6.h>
535 #include <rdma/ib_verbs.h>
536 #include <rdma/ib_cm.h>
537 #include <rdma/rdma_cm.h>
539 rdma_reject(NULL, NULL, 0, 0);
541 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
542 [rdma_reject has 4 arguments])
545 # The FMR pool API was removed in Linux 5.8,
546 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
547 LB_CHECK_COMPILE([if FMR pools API available],
549 #include <rdma/ib_verbs.h>
551 struct ib_fmr fmr = {};
553 AC_DEFINE(HAVE_FMR_POOL_API, 1,
554 [FMR pool API is available])
557 EXTRA_CHECK_INCLUDE=""
558 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
559 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
560 ]) # ENABLEO2IB != "no"
566 # check whether to use the Gemini Network Interface lnd
568 AC_DEFUN([LN_CONFIG_GNILND], [
569 AC_MSG_CHECKING([whether to enable GNI lnd])
571 AC_HELP_STRING([--enable-gni],
573 [], [enable_gni="no"])
574 AC_MSG_RESULT([$enable_gni])
576 AS_IF([test "x$enable_gni" = xyes], [
577 # GNICPPFLAGS was set in spec file
578 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
579 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
580 LB_CHECK_COMPILE([if GNI kernel headers are present],
582 #include <linux/types.h>
585 gni_cdm_handle_t kgni_domain;
588 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
589 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
594 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
596 # at this point, we have gnilnd basic support,
597 # now check for extra features
598 LB_CHECK_COMPILE([to use RCA in gnilnd],
600 #include <linux/types.h>
602 #include <krca_lib.h>
604 gni_cdm_handle_t kgni_domain;
606 krca_ticket_t ticket = KRCA_NULL_TICKET;
608 __u32 nid = 0, nic_addr;
609 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
610 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
611 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
612 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
615 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
617 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
619 AC_SUBST(GNICPPFLAGS)
621 ]) # LN_CONFIG_GNILND
623 # LN_CONFIG_SOCK_CREATE_KERN
625 # 4.x sock_create_kern() added a first parameter as 'struct net *'
628 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
629 tmp_flags="$EXTRA_KCFLAGS"
630 EXTRA_KCFLAGS="-Werror"
631 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
632 sock_create_kern_net, [
633 #include <linux/net.h>
634 #include <net/net_namespace.h>
636 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
638 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
639 [sock_create_kern use net as first parameter])
641 EXTRA_KCFLAGS="$tmp_flags"
642 ]) # LN_CONFIG_SOCK_CREATE_KERN
645 # LN_CONFIG_SK_DATA_READY
647 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
649 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
650 tmp_flags="$EXTRA_KCFLAGS"
651 EXTRA_KCFLAGS="-Werror"
652 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
654 #include <linux/net.h>
655 #include <net/sock.h>
657 ((struct sock *)0)->sk_data_ready(NULL);
659 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
660 [sk_data_ready uses only one argument])
662 EXTRA_KCFLAGS="$tmp_flags"
663 ]) # LN_CONFIG_SK_DATA_READY
666 # LN_EXPORT_KMAP_TO_PAGE
668 # 3.10 Export kmap_to_page
670 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
671 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
672 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
673 [kmap_to_page is exported by the kernel])])
674 ]) # LN_EXPORT_KMAP_TO_PAG
677 # LN_HAVE_HYPERVISOR_IS_TYPE
679 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
680 # x86/paravirt: Provide a way to check for hypervisors
682 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
683 tmp_flags="$EXTRA_KCFLAGS"
684 EXTRA_KCFLAGS="-Werror"
685 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
686 hypervisor_is_type_exists, [
687 #include <asm/hypervisor.h>
689 (void)hypervisor_is_type(X86_HYPER_NATIVE);
691 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
692 [hypervisor_is_type function exists])
694 EXTRA_KCFLAGS="$tmp_flags"
695 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
698 # LN_HAVE_ORACLE_OFED_EXTENSIONS
702 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
703 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
705 #include <rdma/ib_fmr_pool.h>
707 struct ib_fmr_pool_param param = {
712 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
713 [if Oracle OFED Extensions are enabled])
715 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
718 # LN_CONFIG_SOCK_GETNAME
720 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
721 # does not take the length *int argument and returns the length
723 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
724 tmp_flags="$EXTRA_KCFLAGS"
725 EXTRA_KCFLAGS="-Werror"
726 LB_CHECK_COMPILE([if 'getname' has two args],
727 kern_sock_getname_2args, [
728 #include <linux/net.h>
730 kernel_getsockname(NULL, NULL);
732 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
733 ['getname' has two args])
735 EXTRA_KCFLAGS="$tmp_flags"
736 ]) # LN_CONFIG_SOCK_GETNAME
739 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
741 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
742 # and kernel 4.18.0-193.el8:
743 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
744 # and removed for_ifa and endfor_ifa.
745 # Use the _rntl variant as the current locking is rtnl.
747 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
748 tmp_flags="$EXTRA_KCFLAGS"
749 EXTRA_KCFLAGS="-Werror"
750 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
751 in_dev_for_each_ifa_rtnl_test, [
752 #include <linux/inetdevice.h>
754 const struct in_ifaddr *ifa = NULL;
755 struct in_device *in_dev = NULL;
757 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
759 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
760 ['in_dev_for_each_ifa_rtnl' is defined])
762 EXTRA_KCFLAGS="$tmp_flags"
763 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
766 # LN_IB_DEVICE_OPS_EXISTS
768 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
769 # RDMA/core: Introduce ib_device_ops
770 # ... introduces the ib_device_ops structure that defines all the
771 # InfiniBand device operations in one place ...
773 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
774 tmp_flags="$EXTRA_KCFLAGS"
775 EXTRA_KCFLAGS="-Werror"
776 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
777 ib_device_ops_test, [
778 #include <rdma/ib_verbs.h>
780 int x = offsetof(struct ib_device_ops, unmap_fmr);
784 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
785 [if struct ib_device_ops is defined])
787 EXTRA_KCFLAGS="$tmp_flags"
788 ]) # LN_IB_DEVICE_OPS_EXISTS
791 # LN_IB_SG_DMA_ADDRESS_EXISTS
793 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
794 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
795 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
797 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
798 tmp_flags="$EXTRA_KCFLAGS"
799 EXTRA_KCFLAGS="-Werror"
800 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
801 ib_sg_dma_address_test, [
802 #include <rdma/ib_verbs.h>
804 u64 x = ib_sg_dma_address(NULL, NULL);
808 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
809 [if ib_sg_dma_address wrapper exists])
811 EXTRA_KCFLAGS="$tmp_flags"
812 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
818 AC_DEFUN([LN_USR_RDMA], [
819 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
820 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
821 #include <rdma/rdma_user_cm.h>
824 int x = (int)RDMA_PS_TCP;
828 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
829 [RDMA_PS_TCP exists])
834 AC_DEFUN([LN_PROG_LINUX_SRC], [])
835 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
840 # LNet linux kernel checks
842 AC_DEFUN([LN_PROG_LINUX], [
843 AC_MSG_NOTICE([LNet kernel checks
844 ==============================================================================])
850 LN_EXPORT_KMAP_TO_PAGE
852 LN_CONFIG_SK_DATA_READY
854 LN_CONFIG_SOCK_CREATE_KERN
856 LN_HAVE_HYPERVISOR_IS_TYPE
857 LN_HAVE_ORACLE_OFED_EXTENSIONS
859 LN_CONFIG_SOCK_GETNAME
860 # 5.3 and 4.18.0-193.el8
861 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
867 # default paths for installed files
869 AC_DEFUN([LN_PATH_DEFAULTS], [
870 ]) # LN_PATH_DEFAULTS
875 # other configure checks
877 AC_DEFUN([LN_CONFIGURE], [
878 AC_MSG_NOTICE([LNet core checks
879 ==============================================================================])
881 # lnet/utils/portals.c
882 AC_CHECK_HEADERS([netdb.h])
883 AC_CHECK_FUNCS([gethostbyname])
885 # lnet/utils/wirecheck.c
886 AC_CHECK_FUNCS([strnlen])
888 # -------- Check for required packages --------------
890 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
891 AC_ARG_ENABLE(efence,
892 AC_HELP_STRING([--enable-efence],
893 [use efence library]),
894 [], [enable_efence="no"])
895 AC_MSG_RESULT([$enable_efence])
898 AS_IF([test "$enable_efence" = yes], [
900 AC_DEFINE(HAVE_LIBEFENCE, 1,
901 [libefence support is requested])
912 # AM_CONDITIONAL defines for lnet
914 AC_DEFUN([LN_CONDITIONALS], [
915 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
916 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
922 # files that should be generated with AC_OUTPUT
924 AC_DEFUN([LN_CONFIG_FILES], [
928 lnet/autoconf/Makefile
930 lnet/include/Makefile
931 lnet/include/lnet/Makefile
932 lnet/include/uapi/linux/lnet/Makefile
934 lnet/klnds/autoMakefile
935 lnet/klnds/o2iblnd/Makefile
936 lnet/klnds/o2iblnd/autoMakefile
937 lnet/klnds/gnilnd/Makefile
938 lnet/klnds/gnilnd/autoMakefile
939 lnet/klnds/socklnd/Makefile
940 lnet/klnds/socklnd/autoMakefile
942 lnet/lnet/autoMakefile
943 lnet/selftest/Makefile
944 lnet/selftest/autoMakefile
946 lnet/utils/lnetconfig/Makefile