2 # LN_CONFIG_MAX_PAYLOAD
4 # configure maximum payload
6 AC_DEFUN([LN_CONFIG_MAX_PAYLOAD], [
7 AC_MSG_CHECKING([for non-default maximum LNET payload])
8 AC_ARG_WITH([max-payload-mb],
9 AC_HELP_STRING([--with-max-payload-mb=MBytes],
10 [set maximum lnet payload in MBytes]),
12 AC_MSG_RESULT([$with_max_payload_mb])
13 CONFIG_LNET_MAX_PAYLOAD_MB=$with_max_payload_mb
14 CONFIG_LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)"
17 CONFIG_LNET_MAX_PAYLOAD="LNET_MTU"
19 AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_LNET_MAX_PAYLOAD,
21 ]) # LN_CONFIG_MAX_PAYLOAD
24 # LN_CHECK_GCC_VERSION
26 # Check compiler version
28 AC_DEFUN([LN_CHECK_GCC_VERSION], [
29 AC_MSG_CHECKING([compiler version])
30 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
31 PTL_MIN_CC_VERSION="3.2.2"
33 awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
35 if test -z "$PTL_CC_VERSION" -o \
36 $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
39 AC_MSG_RESULT([Buggy compiler found])
40 AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
42 ]) # LN_CHECK_GCC_VERSION
45 # LN_FUNC_DEV_GET_BY_NAME_2ARG
47 AC_DEFUN([LN_FUNC_DEV_GET_BY_NAME_2ARG], [
48 LB_CHECK_COMPILE([if 'dev_get_by_name' has two args],
49 dev_get_by_name_2args, [
50 #include <linux/netdevice.h>
52 dev_get_by_name(NULL, NULL);
54 AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1,
55 [dev_get_by_name has 2 args])
57 ]) # LN_FUNC_DEV_GET_BY_NAME_2ARG
62 # check if cpu affinity is available/wanted
64 AC_DEFUN([LN_CONFIG_AFFINITY], [
65 AC_MSG_CHECKING([whether to enable CPU affinity support])
66 AC_ARG_ENABLE([affinity],
67 AC_HELP_STRING([--disable-affinity],
68 [disable process/irq affinity]),
69 [], [enable_affinity="yes"])
70 AC_MSG_RESULT([$enable_affinity])
71 AS_IF([test "x$enable_affinity" = xyes], [
72 LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
73 set_cpus_allowed_ptr, [
74 #include <linux/sched.h>
76 struct task_struct *t;
82 set_cpus_allowed_ptr(t, &m);
84 AC_DEFINE(CPU_AFFINITY, 1,
85 [kernel has cpu affinity support])
88 ]) # LN_CONFIG_AFFINITY
93 # check if tunable tcp backoff is available/wanted
95 AC_DEFUN([LN_CONFIG_BACKOFF], [
96 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
97 AC_ARG_ENABLE([backoff],
98 AC_HELP_STRING([--disable-backoff],
99 [disable socknal tunable backoff]),
100 [], [enable_backoff="yes"])
101 AC_MSG_RESULT([$enable_backoff])
102 AS_IF([test "x$enable_backoff" = xyes], [
103 AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
104 AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
106 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
107 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
108 [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
109 [tunable backoff TCP in ms])])
114 ]) # LN_CONFIG_BACKOFF
119 # Configure dlc if enabled
121 # if libyaml is set (IE libyaml installed) and enable_dlc = yes then build
122 # dlc other wise (IE if libyaml is not set or enable_dlc = no) then don't
125 AC_DEFUN([LN_CONFIG_DLC], [
126 AC_CHECK_LIB([yaml], [yaml_parser_initialize],[
129 AC_MSG_CHECKING([whether to enable dlc])
131 AC_HELP_STRING([--disable-dlc],
132 [disable building dlc]),
133 [], [enable_dlc="yes"])
135 AS_IF([test "x$enable_dlc" = xyes],
136 [AS_IF([test "x$LIBYAML" = xlibyaml], [
140 AC_MSG_RESULT([no (libyaml not present)])
151 # If current OFED installed (assume with "ofed_info") and devel
152 # headers are not found, error because we assume OFED infiniband
153 # driver needs to be used and we must configure/build with it.
154 # Current OFED headers detection mechanism allow for non-standard
155 # prefix but relies on "ofed_info" command and on "%prefix/openib"
156 # link (both are ok for 1.5.x and 3.x versions), and should work
157 # for both source and DKMS builds.
159 AC_DEFUN([LN_CONFIG_O2IB], [
160 AC_MSG_CHECKING([whether to use Compat RDMA])
162 AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
163 [build o2iblnd against path]),
164 [], [with_o2ib="yes"])
167 yes) AS_IF([which ofed_info 2>/dev/null], [
168 O2IBPATHS=$(ofed_info | egrep -w 'compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs rpm -ql | grep '/openib$')
169 AS_IF([test -z "$O2IBPATHS"], [
171 You seem to have an OFED installed but have not installed it's devel package.
172 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
173 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.
176 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
178 It appears that you have multiple OFED versions installed.
179 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.
180 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.
185 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
191 *) O2IBPATHS=$with_o2ib
192 ENABLEO2IB="withpath"
197 AS_IF([test $ENABLEO2IB = "no"], [
201 for O2IBPATH in $O2IBPATHS; do
202 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
203 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
204 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
205 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
206 AS_IF([test \( \( \( -d ${O2IBPATH}/patches -a \
207 \( "x$OFED" = "xyes" \) \) -o \
208 -d ${O2IBPATH}/kernel_patches \) -a \
209 -f ${O2IBPATH}/Makefile \)], [
213 trying to use the, explicit or detected, OFED distribution's source
214 directory (${O2IBPATH}) rather than the "development/headers"
215 directory which is likely in ${O2IBPATH%-*}
222 if ! $o2ib_found; then
225 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
226 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
227 *) AC_MSG_ERROR([internal error]) ;;
230 compatrdma_found=false
231 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
233 compatrdma_found=true
234 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
238 if ! $compatrdma_found; then
239 if test -f "$O2IBPATH/config.mk"; then
240 . "$O2IBPATH/config.mk"
241 elif test -f "$O2IBPATH/ofed_patch.mk"; then
242 . "$O2IBPATH/ofed_patch.mk"
245 if test "x$RHEL_KERNEL" = xyes; then
246 case "$RHEL_RELEASE_NO" in
248 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4" ;;
250 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4 -DCONFIG_COMPAT_RHEL_6_5" ;;
252 elif test "x$SUSE_KERNEL" = xyes; then
253 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
254 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
258 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
259 linux_kthread_worker, [
260 #include <linux/kthread.h>
262 struct kthread_work *kth_wrk __attribute__ ((unused));
263 flush_kthread_work(kth_wrk);
265 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
266 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
269 AC_MSG_CHECKING([whether to use any OFED backport headers])
270 if test -n "$BACKPORT_INCLUDES"; then
272 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
273 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
279 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
280 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
281 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
282 openib_gen2_support, [
283 #ifdef HAVE_COMPAT_RDMA
284 #include <linux/compat-2.6.h>
286 #include <linux/version.h>
287 #include <linux/pci.h>
288 #include <linux/gfp.h>
289 #include <rdma/rdma_cm.h>
290 #include <rdma/ib_cm.h>
291 #include <rdma/ib_verbs.h>
292 #include <rdma/ib_fmr_pool.h>
294 struct rdma_cm_id *cm_idi __attribute__ ((unused));
295 struct rdma_conn_param conn_param __attribute__ ((unused));
296 struct ib_device_attr device_attr __attribute__ ((unused));
297 struct ib_qp_attr qp_attr __attribute__ ((unused));
298 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
299 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
300 rdma_destroy_id(NULL);
305 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
306 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
307 *) AC_MSG_ERROR([internal error]) ;;
310 # we know at this point that the found OFED source is good
312 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
313 # OFED default rpm not handle sles10 Modules.symvers name
314 for name in Module.symvers Modules.symvers; do
315 if test -f $O2IBPATH/$name; then
320 if test -n "$O2IB_SYMVER"; then
321 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to Symbol Path])
322 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IBPATH/$O2IB_SYMVER"
323 AC_SUBST(EXTRA_SYMBOLS)
325 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
332 AC_SUBST(EXTRA_OFED_INCLUDE)
337 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
338 AS_IF([test $ENABLEO2IB != "no"], [
339 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
340 rdma_create_id_4args, [
341 #ifdef HAVE_COMPAT_RDMA
342 #include <linux/compat-2.6.h>
344 #include <rdma/rdma_cm.h>
346 rdma_create_id(NULL, NULL, 0, 0);
348 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
349 [rdma_create_id wants 4 args])
357 # check whether to use the Gemini Network Interface lnd
359 AC_DEFUN([LN_CONFIG_GNILND], [
360 AC_MSG_CHECKING([whether to enable GNI lnd])
362 AC_HELP_STRING([--enable-gni],
364 [], [enable_gni="no"])
365 AC_MSG_RESULT([$enable_gni])
367 AS_IF([test "x$enable_gni" = xyes], [
368 # GNICPPFLAGS was set in spec file
369 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
370 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
371 LB_CHECK_COMPILE([if GNI kernel headers are present],
373 #include <linux/types.h>
376 gni_cdm_handle_t kgni_domain;
379 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
380 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
385 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
387 # at this point, we have gnilnd basic support,
388 # now check for extra features
389 LB_CHECK_COMPILE([to use RCA in gnilnd],
391 #include <linux/types.h>
393 #include <krca_lib.h>
395 gni_cdm_handle_t kgni_domain;
397 krca_ticket_t ticket = KRCA_NULL_TICKET;
399 __u32 nid = 0, nic_addr;
400 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
401 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
402 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
403 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
406 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
408 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
410 AC_SUBST(GNICPPFLAGS)
412 ]) # LN_CONFIG_GNILND
417 # 2.6.35 kernel has sk_sleep function
419 AC_DEFUN([LN_CONFIG_SK_SLEEP], [
420 LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
422 #ifdef HAVE_COMPAT_RDMA
423 #include <linux/compat-2.6.h>
425 #include <net/sock.h>
429 AC_DEFINE(HAVE_SK_SLEEP, 1,
430 [kernel has sk_sleep])
432 ]) # LN_CONFIG_SK_SLEEP
435 # LN_CONFIG_TCP_SENDPAGE
437 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
439 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
440 tmp_flags="$EXTRA_KCFLAGS"
441 EXTRA_KCFLAGS="-Werror"
442 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
443 tcp_sendpage_socket, [
444 #include <linux/net.h>
447 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
449 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
450 [tcp_sendpage use socket as first parameter])
452 EXTRA_KCFLAGS="$tmp_flags"
453 ]) # LN_CONFIG_TCP_SENDPAGE
456 # LN_CONFIG_SK_DATA_READY
458 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
460 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
461 tmp_flags="$EXTRA_KCFLAGS"
462 EXTRA_KCFLAGS="-Werror"
463 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
465 #include <linux/net.h>
466 #include <net/sock.h>
468 ((struct sock *)0)->sk_data_ready(NULL);
470 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
471 [sk_data_ready uses only one argument])
473 EXTRA_KCFLAGS="$tmp_flags"
474 ]) # LN_CONFIG_SK_DATA_READY
479 # LNet linux kernel checks
481 AC_DEFUN([LN_PROG_LINUX], [
482 AC_MSG_NOTICE([LNet kernel checks
483 ==============================================================================])
485 LN_FUNC_DEV_GET_BY_NAME_2ARG
493 LN_CONFIG_TCP_SENDPAGE
495 LN_CONFIG_SK_DATA_READY
501 # default paths for installed files
503 AC_DEFUN([LN_PATH_DEFAULTS], [
504 ]) # LN_PATH_DEFAULTS
509 # other configure checks
511 AC_DEFUN([LN_CONFIGURE], [
512 AC_MSG_NOTICE([LNet core checks
513 ==============================================================================])
515 # lnet/utils/portals.c
516 AC_CHECK_HEADERS([netdb.h])
517 AC_CHECK_FUNCS([gethostbyname])
519 # lnet/utils/wirecheck.c
520 AC_CHECK_FUNCS([strnlen])
522 # -------- Check for required packages --------------
524 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
525 AC_ARG_ENABLE(efence,
526 AC_HELP_STRING([--enable-efence],
527 [use efence library]),
528 [], [enable_efence="no"])
529 AC_MSG_RESULT([$enable_efence])
532 AS_IF([test "$enable_efence" = yes], [
534 AC_DEFINE(HAVE_LIBEFENCE, 1,
535 [libefence support is requested])
539 LN_CONFIG_MAX_PAYLOAD
546 # AM_CONDITIONAL defines for lnet
548 AC_DEFUN([LN_CONDITIONALS], [
549 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
550 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
551 AM_CONDITIONAL(BUILD_DLC, test x$USE_DLC = "xyes")
557 # files that should be generated with AC_OUTPUT
559 AC_DEFUN([LN_CONFIG_FILES], [
563 lnet/autoconf/Makefile
565 lnet/include/Makefile
566 lnet/include/lnet/Makefile
568 lnet/klnds/autoMakefile
569 lnet/klnds/o2iblnd/Makefile
570 lnet/klnds/o2iblnd/autoMakefile
571 lnet/klnds/gnilnd/Makefile
572 lnet/klnds/gnilnd/autoMakefile
573 lnet/klnds/socklnd/Makefile
574 lnet/klnds/socklnd/autoMakefile
576 lnet/lnet/autoMakefile
577 lnet/selftest/Makefile
578 lnet/selftest/autoMakefile
580 lnet/utils/lnetconfig/Makefile