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"
253 KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
255 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
256 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
257 rdma_create_id_4args, [
258 #ifdef HAVE_COMPAT_RDMA
260 #undef PACKAGE_TARNAME
261 #undef PACKAGE_VERSION
262 #undef PACKAGE_STRING
263 #undef PACKAGE_BUGREPORT
265 #include <linux/compat-2.6.h>
267 #include <rdma/rdma_cm.h>
269 rdma_create_id(NULL, NULL, 0, 0);
271 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
272 [rdma_create_id wants 4 args])
275 # 4.4 added network namespace parameter for rdma_create_id()
276 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
277 rdma_create_id_5args, [
278 #ifdef HAVE_COMPAT_RDMA
280 #undef PACKAGE_TARNAME
281 #undef PACKAGE_VERSION
282 #undef PACKAGE_STRING
283 #undef PACKAGE_BUGREPORT
285 #include <linux/compat-2.6.h>
287 #include <rdma/rdma_cm.h>
289 rdma_create_id(NULL, NULL, NULL, 0, 0);
291 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
292 [rdma_create_id wants 5 args])
295 # 4.2 introduced struct ib_cq_init_attr which is used
296 # by ib_create_cq(). Note some OFED stacks only keep
297 # their headers in sync with latest kernels but not
298 # the functionality which means for infiniband testing
299 # we need to always test functionality testings.
300 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
302 #ifdef HAVE_COMPAT_RDMA
304 #undef PACKAGE_TARNAME
305 #undef PACKAGE_VERSION
306 #undef PACKAGE_STRING
307 #undef PACKAGE_BUGREPORT
309 #include <linux/compat-2.6.h>
311 #include <rdma/ib_verbs.h>
313 struct ib_cq_init_attr cq_attr;
315 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
317 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
318 [struct ib_cq_init_attr is used by ib_create_cq])
321 # 4.3 removed ib_alloc_fast_reg_mr()
322 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
323 ib_alloc_fast_reg_mr, [
324 #ifdef HAVE_COMPAT_RDMA
326 #undef PACKAGE_TARNAME
327 #undef PACKAGE_VERSION
328 #undef PACKAGE_STRING
329 #undef PACKAGE_BUGREPORT
331 #include <linux/compat-2.6.h>
333 #include <rdma/ib_verbs.h>
335 ib_alloc_fast_reg_mr(NULL, 0);
337 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
338 [ib_alloc_fast_reg_mr is defined])
341 # 4.9 must stop using ib_get_dma_mr and the global MR
342 # We then have to use FMR/Fastreg for all RDMA.
343 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
345 #ifdef HAVE_COMPAT_RDMA
347 #undef PACKAGE_TARNAME
348 #undef PACKAGE_VERSION
349 #undef PACKAGE_STRING
350 #undef PACKAGE_BUGREPORT
352 #include <linux/compat-2.6.h>
354 #include <rdma/ib_verbs.h>
356 ib_get_dma_mr(NULL, 0);
358 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
359 [ib_get_dma_mr is defined])
362 # In v4.4 Linux kernel,
363 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
364 # split up struct ib_send_wr so that all non-trivial verbs
365 # use their own structure which embedds struct ib_send_wr.
366 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
368 #ifdef HAVE_COMPAT_RDMA
370 #undef PACKAGE_TARNAME
371 #undef PACKAGE_VERSION
372 #undef PACKAGE_STRING
373 #undef PACKAGE_BUGREPORT
375 #include <linux/compat-2.6.h>
377 #include <rdma/ib_verbs.h>
379 struct ib_rdma_wr *wr __attribute__ ((unused));
383 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
384 [struct ib_rdma_wr is defined])
387 # new fast registration API introduced in 4.4
388 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
389 ib_map_mr_sg_4args, [
390 #ifdef HAVE_COMPAT_RDMA
392 #undef PACKAGE_TARNAME
393 #undef PACKAGE_VERSION
394 #undef PACKAGE_STRING
395 #undef PACKAGE_BUGREPORT
397 #include <linux/compat-2.6.h>
399 #include <rdma/ib_verbs.h>
401 ib_map_mr_sg(NULL, NULL, 0, 0);
403 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
404 [ib_map_mr_sg exists])
407 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
408 # in kernel 4.7 (and RHEL 7.3)
409 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
410 ib_map_mr_sg_5args, [
411 #ifdef HAVE_COMPAT_RDMA
413 #undef PACKAGE_TARNAME
414 #undef PACKAGE_VERSION
415 #undef PACKAGE_STRING
416 #undef PACKAGE_BUGREPORT
418 #include <linux/compat-2.6.h>
420 #include <rdma/ib_verbs.h>
422 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
424 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
425 [ib_map_mr_sg exists])
426 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
427 [ib_map_mr_sg has 5 arguments])
430 # ib_query_device() removed in 4.5
431 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
433 #ifdef HAVE_COMPAT_RDMA
435 #undef PACKAGE_TARNAME
436 #undef PACKAGE_VERSION
437 #undef PACKAGE_STRING
438 #undef PACKAGE_BUGREPORT
440 #include <linux/compat-2.6.h>
442 #include <rdma/ib_verbs.h>
444 struct ib_device dev;
445 struct ib_device_attr dev_attr = {};
446 dev.attrs = dev_attr;
448 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
449 [struct ib_device.attrs is defined])
452 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
453 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
454 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
456 #ifdef HAVE_COMPAT_RDMA
458 #undef PACKAGE_TARNAME
459 #undef PACKAGE_VERSION
460 #undef PACKAGE_STRING
461 #undef PACKAGE_BUGREPORT
463 #include <linux/compat-2.6.h>
465 #include <rdma/ib_verbs.h>
467 ib_alloc_pd(NULL, 0);
469 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
470 [ib_alloc_pd has 2 arguments])
473 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
475 #ifdef HAVE_COMPAT_RDMA
477 #undef PACKAGE_TARNAME
478 #undef PACKAGE_VERSION
479 #undef PACKAGE_STRING
480 #undef PACKAGE_BUGREPORT
482 #include <linux/compat-2.6.h>
484 #include <rdma/ib_verbs.h>
486 (void)ib_inc_rkey(0);
488 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
489 [function ib_inc_rkey exist])
492 # In MOFED 4.6, the second and third parameters for
493 # ib_post_send() and ib_post_recv() are declared with
495 tmp_flags="$EXTRA_KCFLAGS"
496 EXTRA_KCFLAGS="-Werror"
497 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
498 ib_post_send_recv_const, [
499 #ifdef HAVE_COMPAT_RDMA
501 #undef PACKAGE_TARNAME
502 #undef PACKAGE_VERSION
503 #undef PACKAGE_STRING
504 #undef PACKAGE_BUGREPORT
506 #include <linux/compat-2.6.h>
508 #include <rdma/ib_verbs.h>
510 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
511 (const struct ib_send_wr **)NULL);
513 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
514 [ib_post_send and ib_post_recv have const parameters])
516 EXTRA_KCFLAGS="$tmp_flags"
519 LN_IB_DEVICE_OPS_EXISTS
521 LN_IB_SG_DMA_ADDRESS_EXISTS
523 # A reason argument was added to rdma_reject() in Linux 5.8,
524 # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
525 LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
527 #ifdef HAVE_COMPAT_RDMA
529 #undef PACKAGE_TARNAME
530 #undef PACKAGE_VERSION
531 #undef PACKAGE_STRING
532 #undef PACKAGE_BUGREPORT
534 #include <linux/compat-2.6.h>
536 #include <rdma/ib_verbs.h>
537 #include <rdma/ib_cm.h>
538 #include <rdma/rdma_cm.h>
540 rdma_reject(NULL, NULL, 0, 0);
542 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
543 [rdma_reject has 4 arguments])
546 # The FMR pool API was removed in Linux 5.8,
547 # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
548 LB_CHECK_COMPILE([if FMR pools API available],
550 #include <rdma/ib_verbs.h>
552 struct ib_fmr fmr = {};
554 AC_DEFINE(HAVE_FMR_POOL_API, 1,
555 [FMR pool API is available])
558 # rdma_connect_locked() was added in Linux 5.10,
559 # commit 071ba4cc559de47160761b9500b72e8fa09d923d
560 # and in MOFED-5.2-2. rdma_connect_locked() must
561 # be called instead of rdma_connect() in
562 # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
563 LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
564 rdma_connect_locked, [
565 #include <rdma/rdma_cm.h>
567 rdma_connect_locked(NULL, NULL);
569 AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
570 [rdma_connect_locked is defined])
573 # ethtool_link_settings was added in Linux 4.6
574 LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
575 ethtool_link_settings, [
576 #include <linux/ethtool.h>
578 struct ethtool_link_ksettings cmd;
580 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
581 [ethtool_link_settings is defined])
584 EXTRA_CHECK_INCLUDE=""
585 AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
586 AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
587 ]) # ENABLEO2IB != "no"
593 # check whether to use the Gemini Network Interface lnd
595 AC_DEFUN([LN_CONFIG_GNILND], [
596 AC_MSG_CHECKING([whether to enable GNI lnd])
598 AC_HELP_STRING([--enable-gni],
600 [], [enable_gni="no"])
601 AC_MSG_RESULT([$enable_gni])
603 AS_IF([test "x$enable_gni" = xyes], [
604 # GNICPPFLAGS was set in spec file
605 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
606 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
607 LB_CHECK_COMPILE([if GNI kernel headers are present],
609 #include <linux/types.h>
612 gni_cdm_handle_t kgni_domain;
615 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
616 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
621 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
623 # at this point, we have gnilnd basic support,
624 # now check for extra features
625 LB_CHECK_COMPILE([to use RCA in gnilnd],
627 #include <linux/types.h>
629 #include <krca_lib.h>
631 gni_cdm_handle_t kgni_domain;
633 krca_ticket_t ticket = KRCA_NULL_TICKET;
635 __u32 nid = 0, nic_addr;
636 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
637 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
638 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
639 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
642 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
644 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
646 AC_SUBST(GNICPPFLAGS)
648 ]) # LN_CONFIG_GNILND
650 # LN_CONFIG_SOCK_CREATE_KERN
652 # 4.x sock_create_kern() added a first parameter as 'struct net *'
655 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
656 tmp_flags="$EXTRA_KCFLAGS"
657 EXTRA_KCFLAGS="-Werror"
658 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
659 sock_create_kern_net, [
660 #include <linux/net.h>
661 #include <net/net_namespace.h>
663 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
665 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
666 [sock_create_kern use net as first parameter])
668 EXTRA_KCFLAGS="$tmp_flags"
669 ]) # LN_CONFIG_SOCK_CREATE_KERN
672 # LN_CONFIG_SK_DATA_READY
674 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
676 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
677 tmp_flags="$EXTRA_KCFLAGS"
678 EXTRA_KCFLAGS="-Werror"
679 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
681 #include <linux/net.h>
682 #include <net/sock.h>
684 ((struct sock *)0)->sk_data_ready(NULL);
686 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
687 [sk_data_ready uses only one argument])
689 EXTRA_KCFLAGS="$tmp_flags"
690 ]) # LN_CONFIG_SK_DATA_READY
693 # LN_EXPORT_KMAP_TO_PAGE
695 # 3.10 Export kmap_to_page
697 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
698 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
699 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
700 [kmap_to_page is exported by the kernel])])
701 ]) # LN_EXPORT_KMAP_TO_PAG
704 # LN_HAVE_HYPERVISOR_IS_TYPE
706 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
707 # x86/paravirt: Provide a way to check for hypervisors
709 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
710 tmp_flags="$EXTRA_KCFLAGS"
711 EXTRA_KCFLAGS="-Werror"
712 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
713 hypervisor_is_type_exists, [
714 #include <asm/hypervisor.h>
716 (void)hypervisor_is_type(X86_HYPER_NATIVE);
718 AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
719 [hypervisor_is_type function exists])
721 EXTRA_KCFLAGS="$tmp_flags"
722 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
725 # LN_HAVE_ORACLE_OFED_EXTENSIONS
729 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
730 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
732 #include <rdma/ib_fmr_pool.h>
734 struct ib_fmr_pool_param param = {
739 AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
740 [if Oracle OFED Extensions are enabled])
742 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
745 # LN_CONFIG_SOCK_GETNAME
747 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
748 # does not take the length *int argument and returns the length
750 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
751 tmp_flags="$EXTRA_KCFLAGS"
752 EXTRA_KCFLAGS="-Werror"
753 LB_CHECK_COMPILE([if 'getname' has two args],
754 kern_sock_getname_2args, [
755 #include <linux/net.h>
757 kernel_getsockname(NULL, NULL);
759 AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
760 ['getname' has two args])
762 EXTRA_KCFLAGS="$tmp_flags"
763 ]) # LN_CONFIG_SOCK_GETNAME
766 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
768 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
769 # and kernel 4.18.0-193.el8:
770 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
771 # and removed for_ifa and endfor_ifa.
772 # Use the _rntl variant as the current locking is rtnl.
774 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
775 tmp_flags="$EXTRA_KCFLAGS"
776 EXTRA_KCFLAGS="-Werror"
777 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
778 in_dev_for_each_ifa_rtnl_test, [
779 #include <linux/inetdevice.h>
781 const struct in_ifaddr *ifa = NULL;
782 struct in_device *in_dev = NULL;
784 in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
786 AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
787 ['in_dev_for_each_ifa_rtnl' is defined])
789 EXTRA_KCFLAGS="$tmp_flags"
790 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
793 # LN_IB_DEVICE_OPS_EXISTS
795 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
796 # RDMA/core: Introduce ib_device_ops
797 # ... introduces the ib_device_ops structure that defines all the
798 # InfiniBand device operations in one place ...
800 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
801 tmp_flags="$EXTRA_KCFLAGS"
802 EXTRA_KCFLAGS="-Werror"
803 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
804 ib_device_ops_test, [
805 #include <rdma/ib_verbs.h>
807 int x = offsetof(struct ib_device_ops, unmap_fmr);
811 AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
812 [if struct ib_device_ops is defined])
814 EXTRA_KCFLAGS="$tmp_flags"
815 ]) # LN_IB_DEVICE_OPS_EXISTS
818 # LN_IB_SG_DMA_ADDRESS_EXISTS
820 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
821 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
822 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
824 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
825 tmp_flags="$EXTRA_KCFLAGS"
826 EXTRA_KCFLAGS="-Werror"
827 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
828 ib_sg_dma_address_test, [
829 #include <rdma/ib_verbs.h>
831 u64 x = ib_sg_dma_address(NULL, NULL);
835 AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
836 [if ib_sg_dma_address wrapper exists])
838 EXTRA_KCFLAGS="$tmp_flags"
839 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
845 AC_DEFUN([LN_USR_RDMA], [
846 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
847 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
848 #include <rdma/rdma_user_cm.h>
851 int x = (int)RDMA_PS_TCP;
855 AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
856 [RDMA_PS_TCP exists])
861 AC_DEFUN([LN_PROG_LINUX_SRC], [])
862 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
867 # LNet linux kernel checks
869 AC_DEFUN([LN_PROG_LINUX], [
870 AC_MSG_NOTICE([LNet kernel checks
871 ==============================================================================])
877 LN_EXPORT_KMAP_TO_PAGE
879 LN_CONFIG_SK_DATA_READY
881 LN_CONFIG_SOCK_CREATE_KERN
883 LN_HAVE_HYPERVISOR_IS_TYPE
884 LN_HAVE_ORACLE_OFED_EXTENSIONS
886 LN_CONFIG_SOCK_GETNAME
887 # 5.3 and 4.18.0-193.el8
888 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
894 # default paths for installed files
896 AC_DEFUN([LN_PATH_DEFAULTS], [
897 ]) # LN_PATH_DEFAULTS
902 # other configure checks
904 AC_DEFUN([LN_CONFIGURE], [
905 AC_MSG_NOTICE([LNet core checks
906 ==============================================================================])
908 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
909 AS_IF([test "x$enable_dist" = xno], [
910 PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
913 AC_CHECK_LIB([nl-3], [nla_get_s32], [
914 AC_DEFINE(HAVE_NLA_GET_S32, 1,
915 [libnl3 supports nla_get_s32])
919 AC_CHECK_LIB([nl-3], [nla_get_s64], [
920 AC_DEFINE(HAVE_NLA_GET_S64, 1,
921 [libnl3 supports nla_get_s64])
928 AC_DEFUN([LN_USR_NLMSGERR], [
929 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
930 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
931 #include <linux/netlink.h>
934 int x = (int)NLMSGERR_ATTR_MAX;
938 AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
939 ['enum nlmsgerr_attrs' exists])
943 # lnet/utils/portals.c
944 AC_CHECK_HEADERS([netdb.h])
945 AC_CHECK_FUNCS([gethostbyname])
947 # lnet/utils/wirecheck.c
948 AC_CHECK_FUNCS([strnlen])
950 # -------- Check for required packages --------------
952 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
953 AC_ARG_ENABLE(efence,
954 AC_HELP_STRING([--enable-efence],
955 [use efence library]),
956 [], [enable_efence="no"])
957 AC_MSG_RESULT([$enable_efence])
960 AS_IF([test "$enable_efence" = yes], [
962 AC_DEFINE(HAVE_LIBEFENCE, 1,
963 [libefence support is requested])
975 # AM_CONDITIONAL defines for lnet
977 AC_DEFUN([LN_CONDITIONALS], [
978 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
979 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
985 # files that should be generated with AC_OUTPUT
987 AC_DEFUN([LN_CONFIG_FILES], [
991 lnet/autoconf/Makefile
993 lnet/include/Makefile
994 lnet/include/lnet/Makefile
995 lnet/include/uapi/linux/lnet/Makefile
997 lnet/klnds/autoMakefile
998 lnet/klnds/o2iblnd/Makefile
999 lnet/klnds/o2iblnd/autoMakefile
1000 lnet/klnds/gnilnd/Makefile
1001 lnet/klnds/gnilnd/autoMakefile
1002 lnet/klnds/socklnd/Makefile
1003 lnet/klnds/socklnd/autoMakefile
1005 lnet/lnet/autoMakefile
1006 lnet/selftest/Makefile
1007 lnet/selftest/autoMakefile
1009 lnet/utils/lnetconfig/Makefile
1011 ]) # LN_CONFIG_FILES