4 # Check compiler version
6 AC_DEFUN([LN_CHECK_GCC_VERSION], [
7 AC_MSG_CHECKING([compiler version])
8 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
9 PTL_MIN_CC_VERSION="3.2.2"
11 awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
13 if test -z "$PTL_CC_VERSION" -o \
14 $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
17 AC_MSG_RESULT([Buggy compiler found])
18 AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
20 ]) # LN_CHECK_GCC_VERSION
25 # check if cpu affinity is available/wanted
27 AC_DEFUN([LN_CONFIG_AFFINITY], [
28 AC_MSG_CHECKING([whether to enable CPU affinity support])
29 AC_ARG_ENABLE([affinity],
30 AC_HELP_STRING([--disable-affinity],
31 [disable process/irq affinity]),
32 [], [enable_affinity="yes"])
33 AC_MSG_RESULT([$enable_affinity])
34 AS_IF([test "x$enable_affinity" = xyes], [
35 LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
36 set_cpus_allowed_ptr, [
37 #include <linux/sched.h>
39 struct task_struct *t = NULL;
42 set_cpus_allowed_ptr(t, &m);
44 AC_DEFINE(CPU_AFFINITY, 1,
45 [kernel has cpu affinity support])
48 ]) # LN_CONFIG_AFFINITY
53 # check if tunable tcp backoff is available/wanted
55 AC_DEFUN([LN_CONFIG_BACKOFF], [
56 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
57 AC_ARG_ENABLE([backoff],
58 AC_HELP_STRING([--disable-backoff],
59 [disable socknal tunable backoff]),
60 [], [enable_backoff="yes"])
61 AC_MSG_RESULT([$enable_backoff])
62 AS_IF([test "x$enable_backoff" = xyes], [
63 AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
64 AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
66 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
67 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
68 [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
69 [tunable backoff TCP in ms])])
74 ]) # LN_CONFIG_BACKOFF
81 # fail to build if libyaml is not installed
83 AC_DEFUN([LN_CONFIG_DLC], [
84 AS_IF([test "x$enable_dist" = xno], [
85 AC_CHECK_LIB([yaml], [yaml_parser_initialize],
87 [AC_MSG_ERROR([YAML development libraries not not installed])],
95 # If current OFED installed (assume with "ofed_info") and devel
96 # headers are not found, error because we assume OFED infiniband
97 # driver needs to be used and we must configure/build with it.
98 # Current OFED headers detection mechanism allow for non-standard
99 # prefix but relies on "ofed_info" command and on "%prefix/openib"
100 # link (both are ok for 1.5.x and 3.x versions), and should work
101 # for both source and DKMS builds.
103 AC_DEFUN([LN_CONFIG_O2IB], [
104 AC_MSG_CHECKING([whether to use Compat RDMA])
106 AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
107 [build o2iblnd against path]),
108 [], [with_o2ib="yes"])
111 yes) AS_IF([which ofed_info 2>/dev/null], [
112 AS_IF([test x$uses_dpkg = xyes], [
113 OFED_INFO="ofed_info | awk '{print \[$]2}'"
114 LSPKG="dpkg --listfiles"
116 OFED_INFO="ofed_info"
119 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)
120 AS_IF([test -z "$O2IBPATHS"], [
122 You seem to have an OFED installed but have not installed it's devel package.
123 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
124 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.
127 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
129 It appears that you have multiple OFED versions installed.
130 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.
131 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.
134 if test -e $O2IBPATHS/${LINUXRELEASE}; then
135 O2IBPATHS=$O2IBPATHS/${LINUXRELEASE}
136 elif test -e $O2IBPATHS/default; then
137 O2IBPATHS=$O2IBPATHS/default
141 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
147 *) O2IBPATHS=$with_o2ib
148 ENABLEO2IB="withpath"
153 AS_IF([test $ENABLEO2IB = "no"], [
157 for O2IBPATH in $O2IBPATHS; do
158 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
159 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
160 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
161 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
166 if ! $o2ib_found; then
169 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
170 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
171 *) AC_MSG_ERROR([internal error]) ;;
175 compatrdma_found=false
176 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
178 compatrdma_found=true
179 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
180 EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
181 if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
182 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
187 if ! $compatrdma_found; then
188 if test -f "$O2IBPATH/config.mk"; then
189 . "$O2IBPATH/config.mk"
190 elif test -f "$O2IBPATH/ofed_patch.mk"; then
191 . "$O2IBPATH/ofed_patch.mk"
193 elif test -z "$COMPAT_AUTOCONF"; then
195 if test "x$RHEL_KERNEL" = xyes; then
196 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
197 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
198 while test "$I" -ge 0; do
199 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
202 elif test "x$SUSE_KERNEL" = xyes; then
203 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
204 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
208 AC_MSG_CHECKING([whether to use any OFED backport headers])
209 if test -n "$BACKPORT_INCLUDES"; then
211 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
212 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
218 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
219 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include -I$O2IBPATH/include/uapi"
220 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
221 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
222 openib_gen2_support, [
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/version.h>
233 #include <linux/pci.h>
234 #include <linux/gfp.h>
235 #include <rdma/rdma_cm.h>
236 #include <rdma/ib_cm.h>
237 #include <rdma/ib_verbs.h>
238 #include <rdma/ib_fmr_pool.h>
240 struct rdma_cm_id *cm_idi __attribute__ ((unused));
241 struct rdma_conn_param conn_param __attribute__ ((unused));
242 struct ib_device_attr device_attr __attribute__ ((unused));
243 struct ib_qp_attr qp_attr __attribute__ ((unused));
244 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
245 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
246 rdma_destroy_id(NULL);
251 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
252 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
253 *) AC_MSG_ERROR([internal error]) ;;
256 # we know at this point that the found OFED source is good
258 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
259 if test -f $O2IBPATH/Module.symvers; then
260 O2IB_SYMVER=$O2IBPATH/Module.symvers;
263 if test -n "$O2IB_SYMVER"; then
264 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
265 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
266 AC_SUBST(EXTRA_SYMBOLS)
268 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
272 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
273 linux_kthread_worker, [
274 #ifdef HAVE_COMPAT_RDMA
276 #undef PACKAGE_TARNAME
277 #undef PACKAGE_VERSION
278 #undef PACKAGE_STRING
279 #undef PACKAGE_BUGREPORT
281 #include <linux/compat-2.6.h>
283 #include <linux/kthread.h>
285 struct kthread_work *kth_wrk = NULL;
286 flush_kthread_work(kth_wrk);
288 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
289 if test -z "$COMPAT_AUTOCONF"; then
290 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
293 EXTRA_CHECK_INCLUDE=""
296 AC_SUBST(EXTRA_OFED_CONFIG)
297 AC_SUBST(EXTRA_OFED_INCLUDE)
302 AS_IF([test $ENABLEO2IB != "no"], [
303 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
305 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
306 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
307 rdma_create_id_4args, [
308 #ifdef HAVE_COMPAT_RDMA
310 #undef PACKAGE_TARNAME
311 #undef PACKAGE_VERSION
312 #undef PACKAGE_STRING
313 #undef PACKAGE_BUGREPORT
315 #include <linux/compat-2.6.h>
317 #include <rdma/rdma_cm.h>
319 rdma_create_id(NULL, NULL, 0, 0);
321 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
322 [rdma_create_id wants 4 args])
325 # 4.4 added network namespace parameter for rdma_create_id()
326 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
327 rdma_create_id_5args, [
328 #ifdef HAVE_COMPAT_RDMA
330 #undef PACKAGE_TARNAME
331 #undef PACKAGE_VERSION
332 #undef PACKAGE_STRING
333 #undef PACKAGE_BUGREPORT
335 #include <linux/compat-2.6.h>
337 #include <rdma/rdma_cm.h>
339 rdma_create_id(NULL, NULL, NULL, 0, 0);
341 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
342 [rdma_create_id wants 5 args])
345 # 4.2 introduced struct ib_cq_init_attr which is used
346 # by ib_create_cq(). Note some OFED stacks only keep
347 # their headers in sync with latest kernels but not
348 # the functionality which means for infiniband testing
349 # we need to always test functionality testings.
350 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
352 #ifdef HAVE_COMPAT_RDMA
354 #undef PACKAGE_TARNAME
355 #undef PACKAGE_VERSION
356 #undef PACKAGE_STRING
357 #undef PACKAGE_BUGREPORT
359 #include <linux/compat-2.6.h>
361 #include <rdma/ib_verbs.h>
363 struct ib_cq_init_attr cq_attr;
365 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
367 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
368 [struct ib_cq_init_attr is used by ib_create_cq])
371 # 4.3 removed ib_alloc_fast_reg_mr()
372 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
373 ib_alloc_fast_reg_mr, [
374 #ifdef HAVE_COMPAT_RDMA
376 #undef PACKAGE_TARNAME
377 #undef PACKAGE_VERSION
378 #undef PACKAGE_STRING
379 #undef PACKAGE_BUGREPORT
381 #include <linux/compat-2.6.h>
383 #include <rdma/ib_verbs.h>
385 ib_alloc_fast_reg_mr(NULL, 0);
387 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
388 [ib_alloc_fast_reg_mr is defined])
391 # 4.9 must stop using ib_get_dma_mr and the global MR
392 # We then have to use FMR/Fastreg for all RDMA.
393 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
395 #ifdef HAVE_COMPAT_RDMA
397 #undef PACKAGE_TARNAME
398 #undef PACKAGE_VERSION
399 #undef PACKAGE_STRING
400 #undef PACKAGE_BUGREPORT
402 #include <linux/compat-2.6.h>
404 #include <rdma/ib_verbs.h>
406 ib_get_dma_mr(NULL, 0);
408 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
409 [ib_get_dma_mr is defined])
412 # In v4.4 Linux kernel,
413 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
414 # split up struct ib_send_wr so that all non-trivial verbs
415 # use their own structure which embedds struct ib_send_wr.
416 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
418 #ifdef HAVE_COMPAT_RDMA
420 #undef PACKAGE_TARNAME
421 #undef PACKAGE_VERSION
422 #undef PACKAGE_STRING
423 #undef PACKAGE_BUGREPORT
425 #include <linux/compat-2.6.h>
427 #include <rdma/ib_verbs.h>
429 struct ib_rdma_wr *wr __attribute__ ((unused));
433 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
434 [struct ib_rdma_wr is defined])
437 # new fast registration API introduced in 4.4
438 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
439 ib_map_mr_sg_4args, [
440 #ifdef HAVE_COMPAT_RDMA
442 #undef PACKAGE_TARNAME
443 #undef PACKAGE_VERSION
444 #undef PACKAGE_STRING
445 #undef PACKAGE_BUGREPORT
447 #include <linux/compat-2.6.h>
449 #include <rdma/ib_verbs.h>
451 ib_map_mr_sg(NULL, NULL, 0, 0);
453 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
454 [ib_map_mr_sg exists])
457 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
458 # in kernel 4.7 (and RHEL 7.3)
459 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
460 ib_map_mr_sg_5args, [
461 #ifdef HAVE_COMPAT_RDMA
463 #undef PACKAGE_TARNAME
464 #undef PACKAGE_VERSION
465 #undef PACKAGE_STRING
466 #undef PACKAGE_BUGREPORT
468 #include <linux/compat-2.6.h>
470 #include <rdma/ib_verbs.h>
472 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
474 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
475 [ib_map_mr_sg exists])
476 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
477 [ib_map_mr_sg has 5 arguments])
480 # ib_query_device() removed in 4.5
481 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
483 #ifdef HAVE_COMPAT_RDMA
485 #undef PACKAGE_TARNAME
486 #undef PACKAGE_VERSION
487 #undef PACKAGE_STRING
488 #undef PACKAGE_BUGREPORT
490 #include <linux/compat-2.6.h>
492 #include <rdma/ib_verbs.h>
494 struct ib_device dev;
495 struct ib_device_attr dev_attr = {};
496 dev.attrs = dev_attr;
498 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
499 [struct ib_device.attrs is defined])
502 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
503 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
504 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
506 #ifdef HAVE_COMPAT_RDMA
508 #undef PACKAGE_TARNAME
509 #undef PACKAGE_VERSION
510 #undef PACKAGE_STRING
511 #undef PACKAGE_BUGREPORT
513 #include <linux/compat-2.6.h>
515 #include <rdma/ib_verbs.h>
517 ib_alloc_pd(NULL, 0);
519 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
520 [ib_alloc_pd has 2 arguments])
523 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
525 #ifdef HAVE_COMPAT_RDMA
527 #undef PACKAGE_TARNAME
528 #undef PACKAGE_VERSION
529 #undef PACKAGE_STRING
530 #undef PACKAGE_BUGREPORT
532 #include <linux/compat-2.6.h>
534 #include <rdma/ib_verbs.h>
536 (void)ib_inc_rkey(0);
538 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
539 [function ib_inc_rkey exist])
542 # In MOFED 4.6, the second and third parameters for
543 # ib_post_send() and ib_post_recv() are declared with
545 tmp_flags="$EXTRA_KCFLAGS"
546 EXTRA_KCFLAGS="-Werror"
547 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
548 ib_post_send_recv_const, [
549 #ifdef HAVE_COMPAT_RDMA
551 #undef PACKAGE_TARNAME
552 #undef PACKAGE_VERSION
553 #undef PACKAGE_STRING
554 #undef PACKAGE_BUGREPORT
556 #include <linux/compat-2.6.h>
558 #include <rdma/ib_verbs.h>
560 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
561 (const struct ib_send_wr **)NULL);
563 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
564 [ib_post_send and ib_post_recv have const parameters])
566 EXTRA_KCFLAGS="$tmp_flags"
568 EXTRA_CHECK_INCLUDE=""
569 ]) # ENABLEO2IB != "no"
575 # check whether to use the Gemini Network Interface lnd
577 AC_DEFUN([LN_CONFIG_GNILND], [
578 AC_MSG_CHECKING([whether to enable GNI lnd])
580 AC_HELP_STRING([--enable-gni],
582 [], [enable_gni="no"])
583 AC_MSG_RESULT([$enable_gni])
585 AS_IF([test "x$enable_gni" = xyes], [
586 # GNICPPFLAGS was set in spec file
587 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
588 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
589 LB_CHECK_COMPILE([if GNI kernel headers are present],
591 #include <linux/types.h>
594 gni_cdm_handle_t kgni_domain;
597 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
598 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
603 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
605 # at this point, we have gnilnd basic support,
606 # now check for extra features
607 LB_CHECK_COMPILE([to use RCA in gnilnd],
609 #include <linux/types.h>
611 #include <krca_lib.h>
613 gni_cdm_handle_t kgni_domain;
615 krca_ticket_t ticket = KRCA_NULL_TICKET;
617 __u32 nid = 0, nic_addr;
618 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
619 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
620 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
621 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
624 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
626 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
628 AC_SUBST(GNICPPFLAGS)
630 ]) # LN_CONFIG_GNILND
635 # 2.6.35 kernel has sk_sleep function
637 AC_DEFUN([LN_CONFIG_SK_SLEEP], [
638 LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
640 #include <net/sock.h>
644 AC_DEFINE(HAVE_SK_SLEEP, 1,
645 [kernel has sk_sleep])
647 ]) # LN_CONFIG_SK_SLEEP
650 # LN_CONFIG_TCP_SENDPAGE
652 # 2.6.36 tcp_sendpage() first parameter is 'struct sock'
653 # instead of 'struct socket'.
655 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
656 tmp_flags="$EXTRA_KCFLAGS"
657 EXTRA_KCFLAGS="-Werror"
658 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
659 tcp_sendpage_socket, [
660 #include <linux/net.h>
663 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
665 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
666 [tcp_sendpage use socket as first parameter])
668 EXTRA_KCFLAGS="$tmp_flags"
669 ]) # LN_CONFIG_TCP_SENDPAGE
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_CONFIG_SOCK_ACCEPT
727 # 4.11 commit cdfbabfb2f0ce983fdaa42f20e5f7842178fc01e added a flag
728 # to handle a possible lockdep condition kernel socket accept.
730 AC_DEFUN([LN_CONFIG_SOCK_ACCEPT], [
731 tmp_flags="$EXTRA_KCFLAGS"
732 EXTRA_KCFLAGS="-Werror"
733 LB_CHECK_COMPILE([if 'struct sock' accept function requires a bool argument],
735 #include <linux/net.h>
737 ((struct socket *)0)->ops->accept(NULL, NULL, O_NONBLOCK, false);
739 AC_DEFINE(HAVE_KERN_SOCK_ACCEPT_FLAG_ARG, 1,
740 ['struct sock' accept function requires bool argument])
742 EXTRA_KCFLAGS="$tmp_flags"
743 ]) # LN_CONFIG_SOCK_ACCEPT
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_IB_DEVICE_OPS_EXISTS
789 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
790 # RDMA/core: Introduce ib_device_ops
791 # ... introduces the ib_device_ops structure that defines all the
792 # InfiniBand device operations in one place ...
794 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
795 tmp_flags="$EXTRA_KCFLAGS"
796 EXTRA_KCFLAGS="-Werror"
797 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
798 ib_device_ops_test, [
799 #include <rdma/ib_verbs.h>
801 int x = offsetof(struct ib_device_ops, unmap_fmr);
805 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
806 [if struct ib_device_ops is defined])
808 EXTRA_KCFLAGS="$tmp_flags"
809 ]) # LN_IB_DEVICE_OPS_EXISTS
812 # LN_IB_SG_DMA_ADDRESS_EXISTS
814 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
815 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
816 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
818 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
819 tmp_flags="$EXTRA_KCFLAGS"
820 EXTRA_KCFLAGS="-Werror"
821 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
822 ib_sg_dma_address_test, [
823 #include <rdma/ib_verbs.h>
825 u64 x = ib_sg_dma_address(NULL, NULL);
829 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
830 [if ib_sg_dma_address wrapper exists])
832 EXTRA_KCFLAGS="$tmp_flags"
833 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
838 # LNet linux kernel checks
840 AC_DEFUN([LN_PROG_LINUX], [
841 AC_MSG_NOTICE([LNet kernel checks
842 ==============================================================================])
851 LN_CONFIG_TCP_SENDPAGE
853 LN_EXPORT_KMAP_TO_PAGE
855 LN_CONFIG_SK_DATA_READY
857 LN_CONFIG_SOCK_CREATE_KERN
859 LN_CONFIG_SOCK_ACCEPT
861 LN_HAVE_ORACLE_OFED_EXTENSIONS
863 LN_CONFIG_SOCK_GETNAME
865 LN_IB_DEVICE_OPS_EXISTS
867 LN_IB_SG_DMA_ADDRESS_EXISTS
873 # default paths for installed files
875 AC_DEFUN([LN_PATH_DEFAULTS], [
876 ]) # LN_PATH_DEFAULTS
881 # other configure checks
883 AC_DEFUN([LN_CONFIGURE], [
884 AC_MSG_NOTICE([LNet core checks
885 ==============================================================================])
887 # lnet/utils/portals.c
888 AC_CHECK_HEADERS([netdb.h])
889 AC_CHECK_FUNCS([gethostbyname])
891 # lnet/utils/wirecheck.c
892 AC_CHECK_FUNCS([strnlen])
894 # -------- Check for required packages --------------
896 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
897 AC_ARG_ENABLE(efence,
898 AC_HELP_STRING([--enable-efence],
899 [use efence library]),
900 [], [enable_efence="no"])
901 AC_MSG_RESULT([$enable_efence])
904 AS_IF([test "$enable_efence" = yes], [
906 AC_DEFINE(HAVE_LIBEFENCE, 1,
907 [libefence support is requested])
917 # AM_CONDITIONAL defines for lnet
919 AC_DEFUN([LN_CONDITIONALS], [
920 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
921 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
927 # files that should be generated with AC_OUTPUT
929 AC_DEFUN([LN_CONFIG_FILES], [
933 lnet/autoconf/Makefile
935 lnet/include/Makefile
936 lnet/include/lnet/Makefile
937 lnet/include/uapi/linux/lnet/Makefile
939 lnet/klnds/autoMakefile
940 lnet/klnds/o2iblnd/Makefile
941 lnet/klnds/o2iblnd/autoMakefile
942 lnet/klnds/gnilnd/Makefile
943 lnet/klnds/gnilnd/autoMakefile
944 lnet/klnds/socklnd/Makefile
945 lnet/klnds/socklnd/autoMakefile
947 lnet/lnet/autoMakefile
948 lnet/selftest/Makefile
949 lnet/selftest/autoMakefile
951 lnet/utils/lnetconfig/Makefile