Whamcloud - gitweb
LU-8163 hsm: user_request_mask can't be unset in test 24c
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
1 #
2 # LN_CONFIG_MAX_PAYLOAD
3 #
4 # configure maximum payload
5 #
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]),
11         [
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)"
15         ], [
16                 AC_MSG_RESULT([no])
17                 CONFIG_LNET_MAX_PAYLOAD="LNET_MTU"
18         ])
19 AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_LNET_MAX_PAYLOAD,
20         [Max LNET payload])
21 ]) # LN_CONFIG_MAX_PAYLOAD
22
23 #
24 # LN_CHECK_GCC_VERSION
25 #
26 # Check compiler version
27 #
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"
32 v2n() {
33         awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
34 }
35 if test -z "$PTL_CC_VERSION" -o \
36         $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
37         AC_MSG_RESULT([ok])
38 else
39         AC_MSG_RESULT([Buggy compiler found])
40         AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
41 fi
42 ]) # LN_CHECK_GCC_VERSION
43
44 #
45 # LN_CONFIG_AFFINITY
46 #
47 # check if cpu affinity is available/wanted
48 #
49 AC_DEFUN([LN_CONFIG_AFFINITY], [
50 AC_MSG_CHECKING([whether to enable CPU affinity support])
51 AC_ARG_ENABLE([affinity],
52         AC_HELP_STRING([--disable-affinity],
53                 [disable process/irq affinity]),
54         [], [enable_affinity="yes"])
55 AC_MSG_RESULT([$enable_affinity])
56 AS_IF([test "x$enable_affinity" = xyes], [
57         LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
58         set_cpus_allowed_ptr, [
59                 #include <linux/sched.h>
60         ],[
61                 struct task_struct *t;
62                 #if HAVE_CPUMASK_T
63                 cpumask_t     m;
64                 #else
65                 unsigned long m;
66                 #endif
67                 set_cpus_allowed_ptr(t, &m);
68         ],[
69                 AC_DEFINE(CPU_AFFINITY, 1,
70                         [kernel has cpu affinity support])
71         ])
72 ])
73 ]) # LN_CONFIG_AFFINITY
74
75 #
76 # LN_CONFIG_BACKOFF
77 #
78 # check if tunable tcp backoff is available/wanted
79 #
80 AC_DEFUN([LN_CONFIG_BACKOFF], [
81 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
82 AC_ARG_ENABLE([backoff],
83         AC_HELP_STRING([--disable-backoff],
84                 [disable socknal tunable backoff]),
85         [], [enable_backoff="yes"])
86 AC_MSG_RESULT([$enable_backoff])
87 AS_IF([test "x$enable_backoff" = xyes], [
88         AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
89         AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
90                 AC_MSG_RESULT([yes])
91                 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
92                 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
93                         [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
94                                 [tunable backoff TCP in ms])])
95         ], [
96                 AC_MSG_RESULT([no])
97         ])
98 ])
99 ]) # LN_CONFIG_BACKOFF
100
101 #
102 # LN_CONFIG_DLC
103 #
104 # Configure dlc if enabled
105 #
106 # if libyaml is set (IE libyaml installed) and enable_dlc = yes then build
107 # dlc other wise (IE if libyaml is not set or enable_dlc = no) then don't
108 # build dlc.
109 #
110 AC_DEFUN([LN_CONFIG_DLC], [
111         AC_CHECK_LIB([yaml],  [yaml_parser_initialize],[
112                 LIBYAML="libyaml"],[
113                 LIBYAML=""],[-lm])
114         AC_MSG_CHECKING([whether to enable dlc])
115         AC_ARG_ENABLE([dlc],
116                 AC_HELP_STRING([--disable-dlc],
117                         [disable building dlc]),
118                         [], [enable_dlc="yes"])
119         USE_DLC=""
120         AS_IF([test "x$enable_dlc" = xyes],
121                 [AS_IF([test "x$LIBYAML" = xlibyaml], [
122                         USE_DLC="yes"
123                         AC_MSG_RESULT([yes])
124                 ], [
125                         AC_MSG_RESULT([no (libyaml not present)])
126                 ])
127         ], [
128                 AC_MSG_RESULT([no])
129         ])
130         AC_SUBST(USE_DLC)
131 ])
132
133 #
134 # LN_CONFIG_O2IB
135 #
136 # If current OFED installed (assume with "ofed_info") and devel
137 # headers are not found, error because we assume OFED infiniband
138 # driver needs to be used and we must configure/build with it.
139 # Current OFED headers detection mechanism allow for non-standard
140 # prefix but relies on "ofed_info" command and on "%prefix/openib"
141 # link (both are ok for 1.5.x and 3.x versions), and should work
142 # for both source and DKMS builds.
143 #
144 AC_DEFUN([LN_CONFIG_O2IB], [
145 AC_MSG_CHECKING([whether to use Compat RDMA])
146 AC_ARG_WITH([o2ib],
147         AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
148                 [build o2iblnd against path]),
149         [], [with_o2ib="yes"])
150
151 case $with_o2ib in
152         yes)    AS_IF([which ofed_info 2>/dev/null], [
153                         O2IBPATHS=$(ofed_info | egrep -w 'compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs rpm -ql | grep '/openib$')
154                         AS_IF([test -z "$O2IBPATHS"], [
155                                 AC_MSG_ERROR([
156 You seem to have an OFED installed but have not installed it's devel package.
157 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
158 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.
159                                              ])
160                         ])
161                         AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
162                                 AC_MSG_ERROR([
163 It appears that you have multiple OFED versions installed.
164 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.
165 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.
166                                              ])
167                         ])
168                         OFED="yes"
169                 ], [
170                         O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
171                 ])
172                 ENABLEO2IB="yes"
173                 ;;
174         no)     ENABLEO2IB="no"
175                 ;;
176         *)      O2IBPATHS=$with_o2ib
177                 ENABLEO2IB="withpath"
178                 OFED="yes"
179                 ;;
180 esac
181
182 AS_IF([test $ENABLEO2IB = "no"], [
183         AC_MSG_RESULT([no])
184 ], [
185         o2ib_found=false
186         for O2IBPATH in $O2IBPATHS; do
187                 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
188                            -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
189                            -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
190                            -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
191                         o2ib_found=true
192                         break
193                 ])
194         done
195         if ! $o2ib_found; then
196                 AC_MSG_RESULT([no])
197                 case $ENABLEO2IB in
198                         "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
199                         "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
200                         *) AC_MSG_ERROR([internal error]) ;;
201                 esac
202         else
203                 COMPAT_AUTOCONF=""
204                 compatrdma_found=false
205                 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
206                         AC_MSG_RESULT([yes])
207                         compatrdma_found=true
208                         AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
209                         EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
210                         if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
211                                 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
212                         fi
213                 else
214                         AC_MSG_RESULT([no])
215                 fi
216                 if ! $compatrdma_found; then
217                         if test -f "$O2IBPATH/config.mk"; then
218                                 . "$O2IBPATH/config.mk"
219                         elif test -f "$O2IBPATH/ofed_patch.mk"; then
220                                 . "$O2IBPATH/ofed_patch.mk"
221                         fi
222                 elif test -z "$COMPAT_AUTOCONF"; then
223                         # Depreciated checks
224                         if test "x$RHEL_KERNEL" = xyes; then
225                                 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
226                                 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
227                                 while test "$I" -ge 0; do
228                                         EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
229                                         I=$(($I-1))
230                                 done
231                         elif test "x$SUSE_KERNEL" = xyes; then
232                                 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
233                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
234                         fi
235                 fi
236
237                 AC_MSG_CHECKING([whether to use any OFED backport headers])
238                 if test -n "$BACKPORT_INCLUDES"; then
239                         AC_MSG_RESULT([yes])
240                         OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
241                         EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
242                 else
243                         AC_MSG_RESULT([no])
244                 fi
245
246                 O2IBLND=""
247                 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
248                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
249                 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
250                 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
251                 openib_gen2_support, [
252                         #ifdef HAVE_COMPAT_RDMA
253                         #undef PACKAGE_NAME
254                         #undef PACKAGE_TARNAME
255                         #undef PACKAGE_VERSION
256                         #undef PACKAGE_STRING
257                         #undef PACKAGE_BUGREPORT
258                         #undef PACKAGE_URL
259                         #include <linux/compat-2.6.h>
260                         #endif
261                         #include <linux/version.h>
262                         #include <linux/pci.h>
263                         #include <linux/gfp.h>
264                         #include <rdma/rdma_cm.h>
265                         #include <rdma/ib_cm.h>
266                         #include <rdma/ib_verbs.h>
267                         #include <rdma/ib_fmr_pool.h>
268                 ],[
269                         struct rdma_cm_id      *cm_idi __attribute__ ((unused));
270                         struct rdma_conn_param  conn_param __attribute__ ((unused));
271                         struct ib_device_attr   device_attr __attribute__ ((unused));
272                         struct ib_qp_attr       qp_attr __attribute__ ((unused));
273                         struct ib_pool_fmr      pool_fmr __attribute__ ((unused));
274                         enum   ib_cm_rej_reason rej_reason __attribute__ ((unused));
275                         rdma_destroy_id(NULL);
276                 ],[
277                         O2IBLND="o2iblnd"
278                 ],[
279                         case $ENABLEO2IB in
280                         "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
281                         "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
282                         *) AC_MSG_ERROR([internal error]) ;;
283                         esac
284                 ])
285                 # we know at this point that the found OFED source is good
286                 O2IB_SYMVER=""
287                 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
288                         # OFED default rpm not handle sles10 Modules.symvers name
289                         for name in Module.symvers Modules.symvers; do
290                                 if test -f $O2IBPATH/$name; then
291                                         O2IB_SYMVER=$name;
292                                         break;
293                                 fi
294                         done
295                         if test -n "$O2IB_SYMVER"; then
296                                 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to Symbol Path])
297                                 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IBPATH/$O2IB_SYMVER"
298                                 AC_SUBST(EXTRA_SYMBOLS)
299                         else
300                                 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
301                         fi
302                 fi
303
304                 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
305                 linux_kthread_worker, [
306                         #ifdef HAVE_COMPAT_RDMA
307                         #undef PACKAGE_NAME
308                         #undef PACKAGE_TARNAME
309                         #undef PACKAGE_VERSION
310                         #undef PACKAGE_STRING
311                         #undef PACKAGE_BUGREPORT
312                         #undef PACKAGE_URL
313                         #include <linux/compat-2.6.h>
314                         #endif
315                         #include <linux/kthread.h>
316                 ],[
317                         struct kthread_work     *kth_wrk __attribute__ ((unused));
318                         flush_kthread_work(kth_wrk);
319                 ],[
320                         AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
321                         if test -z "$COMPAT_AUTOCONF"; then
322                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
323                         fi
324                 ])
325                 EXTRA_CHECK_INCLUDE=""
326         fi
327 ])
328 AC_SUBST(EXTRA_OFED_CONFIG)
329 AC_SUBST(EXTRA_OFED_INCLUDE)
330 AC_SUBST(O2IBLND)
331 AC_SUBST(O2IBPATH)
332 AC_SUBST(ENABLEO2IB)
333
334 AS_IF([test $ENABLEO2IB != "no"], [
335         EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
336         # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
337         LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
338         rdma_create_id_4args, [
339                 #ifdef HAVE_COMPAT_RDMA
340                 #undef PACKAGE_NAME
341                 #undef PACKAGE_TARNAME
342                 #undef PACKAGE_VERSION
343                 #undef PACKAGE_STRING
344                 #undef PACKAGE_BUGREPORT
345                 #undef PACKAGE_URL
346                 #include <linux/compat-2.6.h>
347                 #endif
348                 #include <rdma/rdma_cm.h>
349         ],[
350                 rdma_create_id(NULL, NULL, 0, 0);
351         ],[
352                 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
353                         [rdma_create_id wants 4 args])
354         ])
355
356         # 4.4 added network namespace parameter for rdma_create_id()
357         LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
358         rdma_create_id_5args, [
359                 #ifdef HAVE_COMPAT_RDMA
360                 #undef PACKAGE_NAME
361                 #undef PACKAGE_TARNAME
362                 #undef PACKAGE_VERSION
363                 #undef PACKAGE_STRING
364                 #undef PACKAGE_BUGREPORT
365                 #undef PACKAGE_URL
366                 #include <linux/compat-2.6.h>
367                 #endif
368                 #include <rdma/rdma_cm.h>
369         ],[
370                 rdma_create_id(NULL, NULL, NULL, 0, 0);
371         ],[
372                 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
373                         [rdma_create_id wants 5 args])
374         ])
375
376         # 4.2 introduced struct ib_cq_init_attr which is used
377         # by ib_create_cq(). Note some OFED stacks only keep
378         # their headers in sync with latest kernels but not
379         # the functionality which means for infiniband testing
380         # we need to always test functionality testings.
381         LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
382         ib_cq_init_attr, [
383                 #ifdef HAVE_COMPAT_RDMA
384                 #undef PACKAGE_NAME
385                 #undef PACKAGE_TARNAME
386                 #undef PACKAGE_VERSION
387                 #undef PACKAGE_STRING
388                 #undef PACKAGE_BUGREPORT
389                 #undef PACKAGE_URL
390                 #include <linux/compat-2.6.h>
391                 #endif
392                 #include <rdma/ib_verbs.h>
393         ],[
394                 struct ib_cq_init_attr cq_attr;
395
396                 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
397         ],[
398                 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
399                         [struct ib_cq_init_attr is used by ib_create_cq])
400         ])
401
402         # 4.3 removed ib_alloc_fast_reg_mr()
403         LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
404         ib_alloc_fast_reg_mr, [
405                 #ifdef HAVE_COMPAT_RDMA
406                 #undef PACKAGE_NAME
407                 #undef PACKAGE_TARNAME
408                 #undef PACKAGE_VERSION
409                 #undef PACKAGE_STRING
410                 #undef PACKAGE_BUGREPORT
411                 #undef PACKAGE_URL
412                 #include <linux/compat-2.6.h>
413                 #endif
414                 #include <rdma/ib_verbs.h>
415         ],[
416                 ib_alloc_fast_reg_mr(NULL, 0);
417         ],[
418                 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
419                         [ib_alloc_fast_reg_mr is defined])
420         ])
421
422         # In v4.4 Linux kernel,
423         # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
424         # split up struct ib_send_wr so that all non-trivial verbs
425         # use their own structure which embedds struct ib_send_wr.
426         LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
427         ib_rdma_wr, [
428                 #ifdef HAVE_COMPAT_RDMA
429                 #undef PACKAGE_NAME
430                 #undef PACKAGE_TARNAME
431                 #undef PACKAGE_VERSION
432                 #undef PACKAGE_STRING
433                 #undef PACKAGE_BUGREPORT
434                 #undef PACKAGE_URL
435                 #include <linux/compat-2.6.h>
436                 #endif
437                 #include <rdma/ib_verbs.h>
438         ],[
439                 struct ib_rdma_wr *wr __attribute__ ((unused));
440
441                 wr = rdma_wr(NULL);
442         ],[
443                 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
444                         [struct ib_rdma_wr is defined])
445         ])
446
447         # new fast registration API introduced in 4.4
448         LB_CHECK_COMPILE([if 'ib_map_mr_sg' exists],
449         ib_map_mr_sg, [
450                 #ifdef HAVE_COMPAT_RDMA
451                 #undef PACKAGE_NAME
452                 #undef PACKAGE_TARNAME
453                 #undef PACKAGE_VERSION
454                 #undef PACKAGE_STRING
455                 #undef PACKAGE_BUGREPORT
456                 #undef PACKAGE_URL
457                 #include <linux/compat-2.6.h>
458                 #endif
459                 #include <rdma/ib_verbs.h>
460         ],[
461                 ib_map_mr_sg(NULL, NULL, 0, 0);
462         ],[
463                 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
464                         [ib_map_mr_sg exists])
465         ])
466         EXTRA_CHECK_INCLUDE=""
467 ]) # ENABLEO2IB != "no"
468 ]) # LN_CONFIG_O2IB
469
470 #
471 # LN_CONFIG_GNILND
472 #
473 # check whether to use the Gemini Network Interface lnd
474 #
475 AC_DEFUN([LN_CONFIG_GNILND], [
476 AC_MSG_CHECKING([whether to enable GNI lnd])
477 AC_ARG_ENABLE([gni],
478         AC_HELP_STRING([--enable-gni],
479                 [enable GNI lnd]),
480         [], [enable_gni="no"])
481 AC_MSG_RESULT([$enable_gni])
482
483 AS_IF([test "x$enable_gni" = xyes], [
484         # GNICPPFLAGS was set in spec file
485         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
486         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
487         LB_CHECK_COMPILE([if GNI kernel headers are present],
488         GNI_header, [
489                 #include <linux/types.h>
490                 #include <gni_pub.h>
491         ],[
492                 gni_cdm_handle_t kgni_domain;
493                 gni_return_t     rc;
494                 int              rrc;
495                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
496                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
497                 return rrc;
498         ],[
499                 GNILND="gnilnd"
500         ],[
501                 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
502         ])
503         # at this point, we have gnilnd basic support,
504         # now check for extra features
505         LB_CHECK_COMPILE([to use RCA in gnilnd],
506         RCA_gnilnd, [
507                 #include <linux/types.h>
508                 #include <gni_pub.h>
509                 #include <krca_lib.h>
510         ],[
511                 gni_cdm_handle_t kgni_domain;
512                 gni_return_t     rc;
513                 krca_ticket_t    ticket = KRCA_NULL_TICKET;
514                 int              rrc;
515                 __u32            nid = 0, nic_addr;
516                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
517                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
518                 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
519                 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
520                 return rrc;
521         ],[
522                 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
523         ])
524         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
525 ])
526 AC_SUBST(GNICPPFLAGS)
527 AC_SUBST(GNILND)
528 ]) # LN_CONFIG_GNILND
529
530 #
531 # LN_CONFIG_SK_SLEEP
532 #
533 # 2.6.35 kernel has sk_sleep function
534 #
535 AC_DEFUN([LN_CONFIG_SK_SLEEP], [
536 LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
537 sk_sleep, [
538         #ifdef HAVE_COMPAT_RDMA
539         #undef PACKAGE_NAME
540         #undef PACKAGE_TARNAME
541         #undef PACKAGE_VERSION
542         #undef PACKAGE_STRING
543         #undef PACKAGE_BUGREPORT
544         #undef PACKAGE_URL
545         #include <linux/compat-2.6.h>
546         #endif
547         #include <net/sock.h>
548 ],[
549         sk_sleep(NULL);
550 ],[
551         AC_DEFINE(HAVE_SK_SLEEP, 1,
552                   [kernel has sk_sleep])
553 ])
554 ]) # LN_CONFIG_SK_SLEEP
555
556 #
557 # LN_CONFIG_TCP_SENDPAGE
558 #
559 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
560 #
561 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
562 tmp_flags="$EXTRA_KCFLAGS"
563 EXTRA_KCFLAGS="-Werror"
564 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
565 tcp_sendpage_socket, [
566         #ifdef HAVE_COMPAT_RDMA
567         #undef PACKAGE_NAME
568         #undef PACKAGE_TARNAME
569         #undef PACKAGE_VERSION
570         #undef PACKAGE_STRING
571         #undef PACKAGE_BUGREPORT
572         #undef PACKAGE_URL
573         #include <linux/compat-2.6.h>
574         #endif
575         #include <linux/net.h>
576         #include <net/tcp.h>
577 ],[
578         tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
579 ],[
580         AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
581                 [tcp_sendpage use socket as first parameter])
582 ])
583 EXTRA_KCFLAGS="$tmp_flags"
584 ]) # LN_CONFIG_TCP_SENDPAGE
585
586 #
587 # LN_CONFIG_SK_DATA_READY
588 #
589 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
590 #
591 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
592 tmp_flags="$EXTRA_KCFLAGS"
593 EXTRA_KCFLAGS="-Werror"
594 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
595 sk_data_ready, [
596         #ifdef HAVE_COMPAT_RDMA
597         #undef PACKAGE_NAME
598         #undef PACKAGE_TARNAME
599         #undef PACKAGE_VERSION
600         #undef PACKAGE_STRING
601         #undef PACKAGE_BUGREPORT
602         #undef PACKAGE_URL
603         #include <linux/compat-2.6.h>
604         #endif
605         #include <linux/net.h>
606         #include <net/sock.h>
607 ],[
608         ((struct sock *)0)->sk_data_ready(NULL);
609 ],[
610         AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
611                 [sk_data_ready uses only one argument])
612 ])
613 EXTRA_KCFLAGS="$tmp_flags"
614 ]) # LN_CONFIG_SK_DATA_READY
615
616 #
617 # LN_CONFIG_IB_INC_RKEY
618 #
619 AC_DEFUN([LN_CONFIG_IB_INC_RKEY], [
620 tmp_flags="$EXTRA_KCFLAGS"
621 EXTRA_KCFLAGS="-Werror"
622 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
623 ib_inc_rkey, [
624         #ifdef HAVE_COMPAT_RDMA
625         #undef PACKAGE_NAME
626         #undef PACKAGE_TARNAME
627         #undef PACKAGE_VERSION
628         #undef PACKAGE_STRING
629         #undef PACKAGE_BUGREPORT
630         #undef PACKAGE_URL
631         #include <linux/compat-2.6.h>
632         #endif
633         #include <rdma/ib_verbs.h>
634 ],[
635         (void)ib_inc_rkey(0);
636 ],[
637         AC_DEFINE(HAVE_IB_INC_RKEY, 1,
638                   [function ib_inc_rkey exist])
639 ])
640 EXTRA_KCFLAGS="$tmp_flags"
641 ]) # LN_CONFIG_IB_INC_RKEY
642
643 #
644 # LN_PROG_LINUX
645 #
646 # LNet linux kernel checks
647 #
648 AC_DEFUN([LN_PROG_LINUX], [
649 AC_MSG_NOTICE([LNet kernel checks
650 ==============================================================================])
651
652 LN_CONFIG_AFFINITY
653 LN_CONFIG_BACKOFF
654 LN_CONFIG_O2IB
655 LN_CONFIG_GNILND
656 # OFED checks, so add extra OFED include
657 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
658 # 2.6.35
659 LN_CONFIG_SK_SLEEP
660 # 2.6.36
661 LN_CONFIG_TCP_SENDPAGE
662 # 3.8.1
663 LN_CONFIG_IB_INC_RKEY
664 # 3.15
665 LN_CONFIG_SK_DATA_READY
666 # remove extra include for none OFED code
667 EXTRA_CHECK_INCLUDE=""
668 ]) # LN_PROG_LINUX
669
670 #
671 # LN_PATH_DEFAULTS
672 #
673 # default paths for installed files
674 #
675 AC_DEFUN([LN_PATH_DEFAULTS], [
676 ]) # LN_PATH_DEFAULTS
677
678 #
679 # LN_CONFIGURE
680 #
681 # other configure checks
682 #
683 AC_DEFUN([LN_CONFIGURE], [
684 AC_MSG_NOTICE([LNet core checks
685 ==============================================================================])
686
687 # lnet/utils/portals.c
688 AC_CHECK_HEADERS([netdb.h])
689 AC_CHECK_FUNCS([gethostbyname])
690
691 # lnet/utils/wirecheck.c
692 AC_CHECK_FUNCS([strnlen])
693
694 # --------  Check for required packages  --------------
695
696 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
697 AC_ARG_ENABLE(efence,
698         AC_HELP_STRING([--enable-efence],
699                 [use efence library]),
700         [], [enable_efence="no"])
701 AC_MSG_RESULT([$enable_efence])
702
703 LIBEFENCE=""
704 AS_IF([test "$enable_efence" = yes], [
705         LIBEFENCE="-lefence"
706         AC_DEFINE(HAVE_LIBEFENCE, 1,
707                 [libefence support is requested])
708 ])
709 AC_SUBST(LIBEFENCE)
710
711 LN_CONFIG_MAX_PAYLOAD
712 LN_CONFIG_DLC
713 ]) # LN_CONFIGURE
714
715 #
716 # LN_CONDITIONALS
717 #
718 # AM_CONDITIONAL defines for lnet
719 #
720 AC_DEFUN([LN_CONDITIONALS], [
721 AM_CONDITIONAL(BUILD_O2IBLND,    test x$O2IBLND = "xo2iblnd")
722 AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND  = "xgnilnd")
723 AM_CONDITIONAL(BUILD_DLC,        test x$USE_DLC = "xyes")
724 ]) # LN_CONDITIONALS
725
726 #
727 # LN_CONFIG_FILES
728 #
729 # files that should be generated with AC_OUTPUT
730 #
731 AC_DEFUN([LN_CONFIG_FILES], [
732 AC_CONFIG_FILES([
733 lnet/Makefile
734 lnet/autoMakefile
735 lnet/autoconf/Makefile
736 lnet/doc/Makefile
737 lnet/include/Makefile
738 lnet/include/lnet/Makefile
739 lnet/klnds/Makefile
740 lnet/klnds/autoMakefile
741 lnet/klnds/o2iblnd/Makefile
742 lnet/klnds/o2iblnd/autoMakefile
743 lnet/klnds/gnilnd/Makefile
744 lnet/klnds/gnilnd/autoMakefile
745 lnet/klnds/socklnd/Makefile
746 lnet/klnds/socklnd/autoMakefile
747 lnet/lnet/Makefile
748 lnet/lnet/autoMakefile
749 lnet/selftest/Makefile
750 lnet/selftest/autoMakefile
751 lnet/utils/Makefile
752 lnet/utils/lnetconfig/Makefile
753 ])
754 ]) # LN_CONFIG_FILES