Whamcloud - gitweb
LU-6215 o2iblnd: port to new fast reg API introduced in 4.4
[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                 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
250                 openib_gen2_support, [
251                         #ifdef HAVE_COMPAT_RDMA
252                         #undef PACKAGE_NAME
253                         #undef PACKAGE_TARNAME
254                         #undef PACKAGE_VERSION
255                         #undef PACKAGE_STRING
256                         #undef PACKAGE_BUGREPORT
257                         #undef PACKAGE_URL
258                         #include <linux/compat-2.6.h>
259                         #endif
260                         #include <linux/version.h>
261                         #include <linux/pci.h>
262                         #include <linux/gfp.h>
263                         #include <rdma/rdma_cm.h>
264                         #include <rdma/ib_cm.h>
265                         #include <rdma/ib_verbs.h>
266                         #include <rdma/ib_fmr_pool.h>
267                 ],[
268                         struct rdma_cm_id      *cm_idi __attribute__ ((unused));
269                         struct rdma_conn_param  conn_param __attribute__ ((unused));
270                         struct ib_device_attr   device_attr __attribute__ ((unused));
271                         struct ib_qp_attr       qp_attr __attribute__ ((unused));
272                         struct ib_pool_fmr      pool_fmr __attribute__ ((unused));
273                         enum   ib_cm_rej_reason rej_reason __attribute__ ((unused));
274                         rdma_destroy_id(NULL);
275                 ],[
276                         O2IBLND="o2iblnd"
277                 ],[
278                         case $ENABLEO2IB in
279                         "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
280                         "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
281                         *) AC_MSG_ERROR([internal error]) ;;
282                         esac
283                 ])
284                 # we know at this point that the found OFED source is good
285                 O2IB_SYMVER=""
286                 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
287                         # OFED default rpm not handle sles10 Modules.symvers name
288                         for name in Module.symvers Modules.symvers; do
289                                 if test -f $O2IBPATH/$name; then
290                                         O2IB_SYMVER=$name;
291                                         break;
292                                 fi
293                         done
294                         if test -n "$O2IB_SYMVER"; then
295                                 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to Symbol Path])
296                                 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IBPATH/$O2IB_SYMVER"
297                                 AC_SUBST(EXTRA_SYMBOLS)
298                         else
299                                 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
300                         fi
301                 fi
302
303                 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
304                 linux_kthread_worker, [
305                         #ifdef HAVE_COMPAT_RDMA
306                         #undef PACKAGE_NAME
307                         #undef PACKAGE_TARNAME
308                         #undef PACKAGE_VERSION
309                         #undef PACKAGE_STRING
310                         #undef PACKAGE_BUGREPORT
311                         #undef PACKAGE_URL
312                         #include <linux/compat-2.6.h>
313                         #endif
314                         #include <linux/kthread.h>
315                 ],[
316                         struct kthread_work     *kth_wrk __attribute__ ((unused));
317                         flush_kthread_work(kth_wrk);
318                 ],[
319                         AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
320                         if test -z "$COMPAT_AUTOCONF"; then
321                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
322                         fi
323                 ])
324         fi
325 ])
326 AC_SUBST(EXTRA_OFED_CONFIG)
327 AC_SUBST(EXTRA_OFED_INCLUDE)
328 AC_SUBST(O2IBLND)
329 AC_SUBST(O2IBPATH)
330 AC_SUBST(ENABLEO2IB)
331
332 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
333 AS_IF([test $ENABLEO2IB != "no"], [
334         LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
335         rdma_create_id_4args, [
336                 #ifdef HAVE_COMPAT_RDMA
337                 #undef PACKAGE_NAME
338                 #undef PACKAGE_TARNAME
339                 #undef PACKAGE_VERSION
340                 #undef PACKAGE_STRING
341                 #undef PACKAGE_BUGREPORT
342                 #undef PACKAGE_URL
343                 #include <linux/compat-2.6.h>
344                 #endif
345                 #include <rdma/rdma_cm.h>
346         ],[
347                 rdma_create_id(NULL, NULL, 0, 0);
348         ],[
349                 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
350                         [rdma_create_id wants 4 args])
351         ])
352 ])
353 #
354 # 4.2 introduced struct ib_cq_init_attr which is used
355 # by ib_create_cq(). Note some OFED stacks only keep
356 # their headers in sync with latest kernels but not
357 # the functionality which means for infiniband testing
358 # we need to always test functionality testings.
359 #
360 AS_IF([test $ENABLEO2IB != "no"], [
361         LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
362         ib_cq_init_attr, [
363                 #ifdef HAVE_COMPAT_RDMA
364                 #undef PACKAGE_NAME
365                 #undef PACKAGE_TARNAME
366                 #undef PACKAGE_VERSION
367                 #undef PACKAGE_STRING
368                 #undef PACKAGE_BUGREPORT
369                 #undef PACKAGE_URL
370                 #include <linux/compat-2.6.h>
371                 #endif
372                 #include <rdma/ib_verbs.h>
373         ],[
374                 struct ib_cq_init_attr cq_attr;
375
376                 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
377         ],[
378                 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
379                         [struct ib_cq_init_attr is used by ib_create_cq])
380         ])
381 ])
382
383 # 4.3 removed ib_alloc_fast_reg_mr()
384 AS_IF([test $ENABLEO2IB != "no"], [
385         LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
386         ib_alloc_fast_reg_mr, [
387                 #ifdef HAVE_COMPAT_RDMA
388                 #undef PACKAGE_NAME
389                 #undef PACKAGE_TARNAME
390                 #undef PACKAGE_VERSION
391                 #undef PACKAGE_STRING
392                 #undef PACKAGE_BUGREPORT
393                 #undef PACKAGE_URL
394                 #include <linux/compat-2.6.h>
395                 #endif
396                 #include <rdma/ib_verbs.h>
397         ],[
398                 ib_alloc_fast_reg_mr(NULL, 0);
399         ],[
400                 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
401                         [ib_alloc_fast_reg_mr is defined])
402         ])
403 ])
404
405 # 4.4 added network namespace parameter for rdma_create_id()
406 AS_IF([test $ENABLEO2IB != "no"], [
407         LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
408         rdma_create_id_5args, [
409                 #ifdef HAVE_COMPAT_RDMA
410                 #undef PACKAGE_NAME
411                 #undef PACKAGE_TARNAME
412                 #undef PACKAGE_VERSION
413                 #undef PACKAGE_STRING
414                 #undef PACKAGE_BUGREPORT
415                 #undef PACKAGE_URL
416                 #include <linux/compat-2.6.h>
417                 #endif
418                 #include <rdma/rdma_cm.h>
419         ],[
420                 rdma_create_id(NULL, NULL, NULL, 0, 0);
421         ],[
422                 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
423                         [rdma_create_id wants 5 args])
424         ])
425 ])
426
427 # new fast registration API introduced in 4.4
428 AS_IF([test $ENABLEO2IB != "no"], [
429         LB_CHECK_COMPILE([if 'ib_map_mr_sg' exists],
430         ib_map_mr_sg, [
431                 #ifdef HAVE_COMPAT_RDMA
432                 #undef PACKAGE_NAME
433                 #undef PACKAGE_TARNAME
434                 #undef PACKAGE_VERSION
435                 #undef PACKAGE_STRING
436                 #undef PACKAGE_BUGREPORT
437                 #undef PACKAGE_URL
438                 #include <linux/compat-2.6.h>
439                 #endif
440                 #include <rdma/ib_verbs.h>
441         ],[
442                 ib_map_mr_sg(NULL, NULL, 0, 0);
443         ],[
444                 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
445                         [ib_map_mr_sg exists])
446         ])
447 ])
448 ]) # LN_CONFIG_O2IB
449
450 #
451 # LN_CONFIG_GNILND
452 #
453 # check whether to use the Gemini Network Interface lnd
454 #
455 AC_DEFUN([LN_CONFIG_GNILND], [
456 AC_MSG_CHECKING([whether to enable GNI lnd])
457 AC_ARG_ENABLE([gni],
458         AC_HELP_STRING([--enable-gni],
459                 [enable GNI lnd]),
460         [], [enable_gni="no"])
461 AC_MSG_RESULT([$enable_gni])
462
463 AS_IF([test "x$enable_gni" = xyes], [
464         # GNICPPFLAGS was set in spec file
465         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
466         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
467         LB_CHECK_COMPILE([if GNI kernel headers are present],
468         GNI_header, [
469                 #include <linux/types.h>
470                 #include <gni_pub.h>
471         ],[
472                 gni_cdm_handle_t kgni_domain;
473                 gni_return_t     rc;
474                 int              rrc;
475                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
476                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
477                 return rrc;
478         ],[
479                 GNILND="gnilnd"
480         ],[
481                 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
482         ])
483         # at this point, we have gnilnd basic support,
484         # now check for extra features
485         LB_CHECK_COMPILE([to use RCA in gnilnd],
486         RCA_gnilnd, [
487                 #include <linux/types.h>
488                 #include <gni_pub.h>
489                 #include <krca_lib.h>
490         ],[
491                 gni_cdm_handle_t kgni_domain;
492                 gni_return_t     rc;
493                 krca_ticket_t    ticket = KRCA_NULL_TICKET;
494                 int              rrc;
495                 __u32            nid = 0, nic_addr;
496                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
497                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
498                 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
499                 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
500                 return rrc;
501         ],[
502                 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
503         ])
504         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
505 ])
506 AC_SUBST(GNICPPFLAGS)
507 AC_SUBST(GNILND)
508 ]) # LN_CONFIG_GNILND
509
510 #
511 # LN_CONFIG_SK_SLEEP
512 #
513 # 2.6.35 kernel has sk_sleep function
514 #
515 AC_DEFUN([LN_CONFIG_SK_SLEEP], [
516 LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
517 sk_sleep, [
518         #ifdef HAVE_COMPAT_RDMA
519         #undef PACKAGE_NAME
520         #undef PACKAGE_TARNAME
521         #undef PACKAGE_VERSION
522         #undef PACKAGE_STRING
523         #undef PACKAGE_BUGREPORT
524         #undef PACKAGE_URL
525         #include <linux/compat-2.6.h>
526         #endif
527         #include <net/sock.h>
528 ],[
529         sk_sleep(NULL);
530 ],[
531         AC_DEFINE(HAVE_SK_SLEEP, 1,
532                   [kernel has sk_sleep])
533 ])
534 ]) # LN_CONFIG_SK_SLEEP
535
536 #
537 # LN_CONFIG_TCP_SENDPAGE
538 #
539 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
540 #
541 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
542 tmp_flags="$EXTRA_KCFLAGS"
543 EXTRA_KCFLAGS="-Werror"
544 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
545 tcp_sendpage_socket, [
546         #ifdef HAVE_COMPAT_RDMA
547         #undef PACKAGE_NAME
548         #undef PACKAGE_TARNAME
549         #undef PACKAGE_VERSION
550         #undef PACKAGE_STRING
551         #undef PACKAGE_BUGREPORT
552         #undef PACKAGE_URL
553         #include <linux/compat-2.6.h>
554         #endif
555         #include <linux/net.h>
556         #include <net/tcp.h>
557 ],[
558         tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
559 ],[
560         AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
561                 [tcp_sendpage use socket as first parameter])
562 ])
563 EXTRA_KCFLAGS="$tmp_flags"
564 ]) # LN_CONFIG_TCP_SENDPAGE
565
566 #
567 # LN_CONFIG_SK_DATA_READY
568 #
569 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
570 #
571 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
572 tmp_flags="$EXTRA_KCFLAGS"
573 EXTRA_KCFLAGS="-Werror"
574 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
575 sk_data_ready, [
576         #ifdef HAVE_COMPAT_RDMA
577         #undef PACKAGE_NAME
578         #undef PACKAGE_TARNAME
579         #undef PACKAGE_VERSION
580         #undef PACKAGE_STRING
581         #undef PACKAGE_BUGREPORT
582         #undef PACKAGE_URL
583         #include <linux/compat-2.6.h>
584         #endif
585         #include <linux/net.h>
586         #include <net/sock.h>
587 ],[
588         ((struct sock *)0)->sk_data_ready(NULL);
589 ],[
590         AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
591                 [sk_data_ready uses only one argument])
592 ])
593 EXTRA_KCFLAGS="$tmp_flags"
594 ]) # LN_CONFIG_SK_DATA_READY
595
596 #
597 # LN_CONFIG_IB_INC_RKEY
598 #
599 AC_DEFUN([LN_CONFIG_IB_INC_RKEY], [
600 tmp_flags="$EXTRA_KCFLAGS"
601 EXTRA_KCFLAGS="-Werror"
602 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
603 ib_inc_rkey, [
604         #ifdef HAVE_COMPAT_RDMA
605         #undef PACKAGE_NAME
606         #undef PACKAGE_TARNAME
607         #undef PACKAGE_VERSION
608         #undef PACKAGE_STRING
609         #undef PACKAGE_BUGREPORT
610         #undef PACKAGE_URL
611         #include <linux/compat-2.6.h>
612         #endif
613         #include <rdma/ib_verbs.h>
614 ],[
615         (void)ib_inc_rkey(0);
616 ],[
617         AC_DEFINE(HAVE_IB_INC_RKEY, 1,
618                   [function ib_inc_rkey exist])
619 ])
620 EXTRA_KCFLAGS="$tmp_flags"
621 ]) # LN_CONFIG_IB_INC_RKEY
622
623 #
624 # LN_PROG_LINUX
625 #
626 # LNet linux kernel checks
627 #
628 AC_DEFUN([LN_PROG_LINUX], [
629 AC_MSG_NOTICE([LNet kernel checks
630 ==============================================================================])
631
632 LN_CONFIG_AFFINITY
633 LN_CONFIG_BACKOFF
634 LN_CONFIG_O2IB
635 LN_CONFIG_GNILND
636 LN_CONFIG_IB_INC_RKEY
637 # 2.6.35
638 LN_CONFIG_SK_SLEEP
639 # 2.6.36
640 LN_CONFIG_TCP_SENDPAGE
641 # 3.15
642 LN_CONFIG_SK_DATA_READY
643 ]) # LN_PROG_LINUX
644
645 #
646 # LN_PATH_DEFAULTS
647 #
648 # default paths for installed files
649 #
650 AC_DEFUN([LN_PATH_DEFAULTS], [
651 ]) # LN_PATH_DEFAULTS
652
653 #
654 # LN_CONFIGURE
655 #
656 # other configure checks
657 #
658 AC_DEFUN([LN_CONFIGURE], [
659 AC_MSG_NOTICE([LNet core checks
660 ==============================================================================])
661
662 # lnet/utils/portals.c
663 AC_CHECK_HEADERS([netdb.h])
664 AC_CHECK_FUNCS([gethostbyname])
665
666 # lnet/utils/wirecheck.c
667 AC_CHECK_FUNCS([strnlen])
668
669 # --------  Check for required packages  --------------
670
671 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
672 AC_ARG_ENABLE(efence,
673         AC_HELP_STRING([--enable-efence],
674                 [use efence library]),
675         [], [enable_efence="no"])
676 AC_MSG_RESULT([$enable_efence])
677
678 LIBEFENCE=""
679 AS_IF([test "$enable_efence" = yes], [
680         LIBEFENCE="-lefence"
681         AC_DEFINE(HAVE_LIBEFENCE, 1,
682                 [libefence support is requested])
683 ])
684 AC_SUBST(LIBEFENCE)
685
686 LN_CONFIG_MAX_PAYLOAD
687 LN_CONFIG_DLC
688 ]) # LN_CONFIGURE
689
690 #
691 # LN_CONDITIONALS
692 #
693 # AM_CONDITIONAL defines for lnet
694 #
695 AC_DEFUN([LN_CONDITIONALS], [
696 AM_CONDITIONAL(BUILD_O2IBLND,    test x$O2IBLND = "xo2iblnd")
697 AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND  = "xgnilnd")
698 AM_CONDITIONAL(BUILD_DLC,        test x$USE_DLC = "xyes")
699 ]) # LN_CONDITIONALS
700
701 #
702 # LN_CONFIG_FILES
703 #
704 # files that should be generated with AC_OUTPUT
705 #
706 AC_DEFUN([LN_CONFIG_FILES], [
707 AC_CONFIG_FILES([
708 lnet/Makefile
709 lnet/autoMakefile
710 lnet/autoconf/Makefile
711 lnet/doc/Makefile
712 lnet/include/Makefile
713 lnet/include/lnet/Makefile
714 lnet/klnds/Makefile
715 lnet/klnds/autoMakefile
716 lnet/klnds/o2iblnd/Makefile
717 lnet/klnds/o2iblnd/autoMakefile
718 lnet/klnds/gnilnd/Makefile
719 lnet/klnds/gnilnd/autoMakefile
720 lnet/klnds/socklnd/Makefile
721 lnet/klnds/socklnd/autoMakefile
722 lnet/lnet/Makefile
723 lnet/lnet/autoMakefile
724 lnet/selftest/Makefile
725 lnet/selftest/autoMakefile
726 lnet/utils/Makefile
727 lnet/utils/lnetconfig/Makefile
728 ])
729 ]) # LN_CONFIG_FILES