rdma.m4: Fixing and adding defines for be2net driver backport
[~tnikolova/compat/.git] / config / rdma.m4
1 dnl Checks for the in-box ib_core
2 AC_DEFUN([RDMA_CONFIG_COMPAT],
3 [
4         AC_MSG_CHECKING([if ib_verbs has ib_dma_map_single])
5         LB_LINUX_TRY_COMPILE([
6                 #include <linux/version.h>
7                 #include <linux/pci.h>
8                 #include <linux/gfp.h>
9                 #include <rdma/ib_verbs.h>
10         ],[
11                 ib_dma_map_single(NULL, NULL, 0, 0);
12                 return 0;
13         ],[
14                 AC_MSG_RESULT(yes)
15                 AC_DEFINE(HAVE_INBOX_IB_DMA_MAP, 1,
16                           [ib_dma_map_single defined])
17         ],[
18                 AC_MSG_RESULT(no)
19         ])
20
21         AC_MSG_CHECKING([if ib_create_cq wants comp_vector])
22         LB_LINUX_TRY_COMPILE([
23                 #include <linux/version.h>
24                 #include <linux/pci.h>
25                 #include <linux/gfp.h>
26                 #include <rdma/ib_verbs.h>
27         ],[
28                 ib_create_cq(NULL, NULL, NULL, NULL, 0, 0);
29                 return 0;
30         ],[
31                 AC_MSG_RESULT(yes)
32                 AC_DEFINE(HAVE_INBOX_IB_COMP_VECTOR, 1,
33                           [has completion vector])
34         ],[
35                 AC_MSG_RESULT(no)
36         ])
37
38         AC_MSG_CHECKING([if rdma_cm has RDMA_CM_EVENT_ADDR_CHANGE])
39         LB_LINUX_TRY_COMPILE([
40                 #include <linux/version.h>
41                 #include <linux/pci.h>
42                 #include <linux/gfp.h>
43                 #include <rdma/rdma_cm.h>
44         ],[
45                 return (RDMA_CM_EVENT_ADDR_CHANGE == 0);
46         ],[
47                 AC_MSG_RESULT(yes)
48                 AC_DEFINE(HAVE_INBOX_RDMA_CMEV_ADDRCHANGE, 1,
49                           [has completion vector])
50         ],[
51                 AC_MSG_RESULT(no)
52         ])
53
54         AC_MSG_CHECKING([if rdma_cm has RDMA_CM_EVENT_TIMEWAIT_EXIT])
55         LB_LINUX_TRY_COMPILE([
56                 #include <linux/version.h>
57                 #include <linux/pci.h>
58                 #include <linux/gfp.h>
59                 #include <rdma/rdma_cm.h>
60         ],[
61                 return (RDMA_CM_EVENT_TIMEWAIT_EXIT == 0);
62         ],[
63                 AC_MSG_RESULT(yes)
64                 AC_DEFINE(HAVE_INBOX_RDMA_CMEV_TIMEWAIT_EXIT, 1,
65                           [has completion vector])
66         ],[
67                 AC_MSG_RESULT(no)
68         ])
69
70         AC_MSG_CHECKING([if rdma_cm has rdma_set_reuseaddr])
71         LB_LINUX_TRY_COMPILE([
72                 #include <linux/version.h>
73                 #include <linux/pci.h>
74                 #include <linux/gfp.h>
75                 #include <rdma/rdma_cm.h>
76         ],[
77                 rdma_set_reuseaddr(NULL, 1);
78                 return 0;
79         ],[
80                 AC_MSG_RESULT(yes)
81                 AC_DEFINE(HAVE_INBOX_RDMA_SET_REUSEADDR, 1,
82                           [rdma_set_reuse defined])
83         ],[
84                 AC_MSG_RESULT(no)
85         ])
86
87         AC_MSG_CHECKING([if struct ib_wc has member named ts])
88         LB_LINUX_TRY_COMPILE([
89                 #include <linux/version.h>
90                 #include <rdma/ib_verbs.h>
91         ],[
92         struct ib_wc wc;
93         wc->ts.timestamp = 0;
94
95                 return 0;
96         ],[
97                 AC_MSG_RESULT(yes)
98                 AC_DEFINE(HAVE_INBOX_IB_WC_TS, 1,
99                           [ib_wc has member named ts])
100         ],[
101                 AC_MSG_RESULT(no)
102         ])
103
104         AC_MSG_CHECKING([if struct ib_ah_attr has member named dmac])
105         LB_LINUX_TRY_COMPILE([
106                 #include <linux/version.h>
107                 #include <rdma/ib_verbs.h>
108         ],[
109         struct ib_ah_attr *ah_attr;
110         memset(ah_attr->dmac, 0, 6);
111
112                 return 0;
113         ],[
114                 AC_MSG_RESULT(yes)
115                 AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_DMAC, 1,
116                           [ah_attr has member named dmac])
117         ],[
118                 AC_MSG_RESULT(no)
119         ])
120
121         AC_MSG_CHECKING([if struct ib_ah_attr has member named vlan_id])
122         LB_LINUX_TRY_COMPILE([
123                 #include <linux/version.h>
124                 #include <rdma/ib_verbs.h>
125         ],[
126         struct ib_ah_attr *ah_attr;
127         ah_attr->vlan_id = 0;
128
129                 return 0;
130         ],[
131                 AC_MSG_RESULT(yes)
132                 AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_VLAN_ID, 1,
133                           [ah_attr has member named vlan_id])
134         ],[
135                 AC_MSG_RESULT(no)
136         ])
137 ])
138
139 dnl Examine kernel functionality
140 AC_DEFUN([LINUX_CONFIG_COMPAT],
141 [
142         AC_MSG_CHECKING([if file_system_type has mount method])
143         LB_LINUX_TRY_COMPILE([
144                 #include <linux/fs.h>
145         ],[
146                 struct file_system_type fst;
147
148                 fst.mount = NULL;
149                 return 0;
150         ],[
151                 AC_MSG_RESULT(yes)
152                 AC_DEFINE(HAVE_MOUNT_METHOD, 1,
153                           [mount method defined])
154         ],[
155                 AC_MSG_RESULT(no)
156         ])
157
158         AC_MSG_CHECKING([if kernel has get_next_ino])
159         LB_LINUX_TRY_COMPILE([
160                 #include <linux/fs.h>
161         ],[
162                 unsigned int ino;
163
164                 ino = get_next_ino();
165                 return 0;
166         ],[
167                 AC_MSG_RESULT(yes)
168                 AC_DEFINE(HAVE_GET_NEXT_INO, 1,
169                           [get_next_ino defined])
170         ],[
171                 AC_MSG_RESULT(no)
172         ])
173
174         AC_MSG_CHECKING([if kernel has ktime_get_ns])
175         LB_LINUX_TRY_COMPILE([
176                 #include <linux/ktime.h>
177         ],[
178                 unsigned long long ns;
179
180                 ns = ktime_get_ns();
181                 return 0;
182         ],[
183                 AC_MSG_RESULT(yes)
184                 AC_DEFINE(HAVE_KTIME_GET_NS, 1,
185                           [ktime_get_ns defined])
186         ],[
187                 AC_MSG_RESULT(no)
188         ])
189
190         AC_MSG_CHECKING([if svc_xprt_class has xcl_ident])
191         LB_LINUX_TRY_COMPILE([
192                 #include <linux/sunrpc/xprt.h>
193                 #include <linux/sunrpc/svc_xprt.h>
194         ],[
195                 struct svc_xprt_class svc_rdma_class = {
196                         .xcl_ident = XPRT_TRANSPORT_RDMA,
197                 };
198                 return 0;
199         ],[
200                 AC_MSG_RESULT(yes)
201                 AC_DEFINE(HAVE_XCL_IDENT, 1,
202                           [xcl_ident defined])
203         ],[
204                 AC_MSG_RESULT(no)
205         ])
206
207         AC_MSG_CHECKING([if struct ifla_vf_info has max_tx_rate])
208         LB_LINUX_TRY_COMPILE([
209                 #include <linux/if_link.h>
210         ],[
211                 struct ifla_vf_info *ivf;
212
213                 ivf->max_tx_rate = 0;
214                 ivf->min_tx_rate = 0;
215
216                 return 0;
217         ],[
218                 AC_MSG_RESULT(yes)
219                 AC_DEFINE(HAVE_TX_RATE_LIMIT, 1,
220                           [max_tx_rate is defined])
221         ],[
222                 AC_MSG_RESULT(no)
223         ])
224
225         AC_MSG_CHECKING([if struct ethtool_ops has get/set_rxfh])
226         LB_LINUX_TRY_COMPILE([
227                 #include <linux/ethtool.h>
228         ],[
229                 const struct ethtool_ops en_ethtool_ops = {
230                         .get_rxfh_indir_size = NULL,
231                         .get_rxfh = NULL,
232                         .set_rxfh = NULL,
233                 };
234
235                 return 0;
236         ],[
237                 AC_MSG_RESULT(yes)
238                 AC_DEFINE(HAVE_GET_SET_RXFH, 1,
239                           [get/set_rxfh is defined])
240         ],[
241                 AC_MSG_RESULT(no)
242         ])
243
244
245         AC_MSG_CHECKING([if struct ethtool_ops has get/set_tunable])
246         LB_LINUX_TRY_COMPILE([
247                 #include <linux/ethtool.h>
248         ],[
249                 const struct ethtool_ops en_ethtool_ops = {
250                         .get_tunable = NULL,
251                         .set_tunable = NULL,
252                 };
253
254                 return 0;
255         ],[
256                 AC_MSG_RESULT(yes)
257                 AC_DEFINE(HAVE_GET_SET_TUNABLE, 1,
258                           [get/set_tunable is defined])
259         ],[
260                 AC_MSG_RESULT(no)
261         ])
262
263         AC_MSG_CHECKING([if exist struct ethtool_ops_ext])
264         LB_LINUX_TRY_COMPILE([
265                 #include <linux/ethtool.h>
266         ],[
267                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
268                         .size = sizeof(struct ethtool_ops_ext),
269                 };
270
271                 return 0;
272         ],[
273                 AC_MSG_RESULT(yes)
274                 AC_DEFINE(HAVE_ETHTOOL_OPS_EXT, 1,
275                           [struct ethtool_ops_ext is defined])
276         ],[
277                 AC_MSG_RESULT(no)
278         ])
279
280         AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_rxfh])
281         LB_LINUX_TRY_COMPILE([
282                 #include <linux/ethtool.h>
283         ],[
284                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
285                         .get_rxfh_indir_size = NULL,
286                         .get_rxfh = NULL,
287                         .set_rxfh = NULL,
288                 };
289
290                 return 0;
291         ],[
292                 AC_MSG_RESULT(yes)
293                 AC_DEFINE(HAVE_GET_SET_RXFH_OPS_EXT, 1,
294                           [get/set_rxfh is defined])
295         ],[
296                 AC_MSG_RESULT(no)
297         ])
298
299         AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_rxfh_indir])
300         LB_LINUX_TRY_COMPILE([
301                 #include <linux/ethtool.h>
302         ],[
303                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
304                         .get_rxfh_indir_size = NULL,
305                         .get_rxfh_indir = NULL,
306                         .set_rxfh_indir = NULL,
307                 };
308
309                 return 0;
310         ],[
311                 AC_MSG_RESULT(yes)
312                 AC_DEFINE(HAVE_GET_SET_RXFH_INDIR, 1,
313                           [get/set_rxfh_indir is defined])
314         ],[
315                 AC_MSG_RESULT(no)
316         ])
317
318         AC_MSG_CHECKING([if struct net_device has dev_port])
319         LB_LINUX_TRY_COMPILE([
320                 #include <linux/netdevice.h>
321         ],[
322                 struct net_device *dev = NULL;
323
324                 dev->dev_port = 0;
325
326                 return 0;
327         ],[
328                 AC_MSG_RESULT(yes)
329                 AC_DEFINE(HAVE_NET_DEVICE_DEV_PORT, 1,
330                           [dev_port is defined])
331         ],[
332                 AC_MSG_RESULT(no)
333         ])
334
335         AC_MSG_CHECKING([if struct ptp_clock_info has n_pins])
336         LB_LINUX_TRY_COMPILE([
337                 #include <linux/ptp_clock_kernel.h>
338         ],[
339                 struct ptp_clock_info *info;
340                 info->n_pins = 0;
341
342                 return 0;
343         ],[
344                 AC_MSG_RESULT(yes)
345                 AC_DEFINE(HAVE_PTP_CLOCK_INFO_N_PINS, 1,
346                           [n_pins is defined])
347         ],[
348                 AC_MSG_RESULT(no)
349         ])
350
351         AC_MSG_CHECKING([if pci.h pci_enable_msi_exact])
352         LB_LINUX_TRY_COMPILE([
353                 #include <linux/pci.h>
354         ],[
355                 int x = pci_enable_msi_exact(NULL, 0);
356
357                 return 0;
358         ],[
359                 AC_MSG_RESULT(yes)
360                 AC_DEFINE(HAVE_PCI_ENABLE_MSI_EXACT, 1,
361                           [pci_enable_msi_exact is defined])
362         ],[
363                 AC_MSG_RESULT(no)
364         ])
365
366         AC_MSG_CHECKING([if pci.h pci_enable_msix_range])
367         LB_LINUX_TRY_COMPILE([
368                 #include <linux/pci.h>
369         ],[
370                 int x = pci_enable_msix_range(NULL, 0, 0, 0);
371
372                 return 0;
373         ],[
374                 AC_MSG_RESULT(yes)
375                 AC_DEFINE(HAVE_PCI_ENABLE_MSIX_RANGE, 1,
376                           [pci_enable_msix_range is defined])
377         ],[
378                 AC_MSG_RESULT(no)
379         ])
380
381         AC_MSG_CHECKING([if pci.h pci_msix_vec_count])
382         LB_LINUX_TRY_COMPILE([
383                 #include <linux/pci.h>
384         ],[
385                 int x = pci_msix_vec_count(NULL);
386
387                 return 0;
388         ],[
389                 AC_MSG_RESULT(yes)
390                 AC_DEFINE(HAVE_PCI_MSIX_VEC_COUNT, 1,
391                           [pci_msix_vec_count is defined])
392         ],[
393                 AC_MSG_RESULT(no)
394         ])
395
396         AC_MSG_CHECKING([if pci_dev has msix_cap])
397         LB_LINUX_TRY_COMPILE([
398                 #include <linux/pci.h>
399         ],[
400                 struct pci_dev pdev;
401                 pdev.msix_cap = 0;
402
403                 return 0;
404         ],[
405                 AC_MSG_RESULT(yes)
406                 AC_DEFINE(HAVE_PCI_MSIX_CAP, 1,
407                           [msix_cap is defined])
408         ],[
409                 AC_MSG_RESULT(no)
410         ])
411
412         AC_MSG_CHECKING([if mm_struct has pinned_vm])
413         LB_LINUX_TRY_COMPILE([
414                 #include <linux/mm_types.h>
415         ],[
416                 struct mm_types mmt;
417                 mmt.pinned_vm = 0;
418
419                 return 0;
420         ],[
421                 AC_MSG_RESULT(yes)
422                 AC_DEFINE(HAVE_PINNED_VM, 1,
423                           [pinned_vm is defined])
424         ],[
425                 AC_MSG_RESULT(no)
426         ])
427
428         AC_MSG_CHECKING([if kernel has idr_alloc])
429         LB_LINUX_TRY_COMPILE([
430                 #include <linux/idr.h>
431         ],[
432                 int x;
433                 x =  idr_alloc(NULL, NULL, 0, 0, 0);
434
435                 return 0;
436         ],[
437                 AC_MSG_RESULT(yes)
438                 AC_DEFINE(HAVE_IDR_ALLOC, 1,
439                           [idr_alloc is defined])
440         ],[
441                 AC_MSG_RESULT(no)
442         ])
443
444         AC_MSG_CHECKING([if kernel has percpu variables])
445         LB_LINUX_TRY_COMPILE([
446                 #include <linux/percpu.h>
447         ],[
448                 static DEFINE_PER_CPU(unsigned int, x);
449                 this_cpu_inc(x);
450
451                 return 0;
452         ],[
453                 AC_MSG_RESULT(yes)
454                 AC_DEFINE(HAVE_PERCPU_VARS, 1,
455                           [percpu variables are defined])
456         ],[
457                 AC_MSG_RESULT(no)
458         ])
459
460         AC_MSG_CHECKING([if struct iscsi_transport has attr_is_visible])
461         LB_LINUX_TRY_COMPILE([
462                 #include <scsi/scsi_transport_iscsi.h>
463         ],[
464                 static struct iscsi_transport iscsi_iser_transport = {
465                         .attr_is_visible = NULL,
466                 };
467
468                 return 0;
469         ],[
470                 AC_MSG_RESULT(yes)
471                 AC_DEFINE(HAVE_ISCSI_ATTR_IS_VISIBLE, 1,
472                           [attr_is_visible is defined])
473         ],[
474                 AC_MSG_RESULT(no)
475         ])
476
477         AC_MSG_CHECKING([if struct iscsi_transport has get_ep_param])
478         LB_LINUX_TRY_COMPILE([
479                 #include <scsi/scsi_transport_iscsi.h>
480         ],[
481                 static struct iscsi_transport iscsi_iser_transport = {
482                         .get_ep_param = NULL,
483                 };
484
485                 return 0;
486         ],[
487                 AC_MSG_RESULT(yes)
488                 AC_DEFINE(HAVE_ISCSI_GET_EP_PARAM, 1,
489                           [get_ep_param is defined])
490         ],[
491                 AC_MSG_RESULT(no)
492         ])
493
494         AC_MSG_CHECKING([if struct iscsi_transport has check_protection])
495         LB_LINUX_TRY_COMPILE([
496                 #include <scsi/scsi_transport_iscsi.h>
497         ],[
498                 static struct iscsi_transport iscsi_iser_transport = {
499                         .check_protection = NULL,
500                 };
501
502                 return 0;
503         ],[
504                 AC_MSG_RESULT(yes)
505                 AC_DEFINE(HAVE_ISCSI_CHECK_PROTECTION, 1,
506                           [check_protection is defined])
507         ],[
508                 AC_MSG_RESULT(no)
509         ])
510
511         AC_MSG_CHECKING([if iscsi_proto.h has struct iscsi_scsi_req])
512         LB_LINUX_TRY_COMPILE([
513                 #include <scsi/iscsi_proto.h>
514         ],[
515                 struct iscsi_scsi_req req = {
516                         .opcode = 0,
517                 };
518
519                 return 0;
520         ],[
521                 AC_MSG_RESULT(yes)
522                 AC_DEFINE(HAVE_ISCSI_SCSI_REQ, 1,
523                           [struct iscsi_scsi_req is defined])
524         ],[
525                 AC_MSG_RESULT(no)
526         ])
527
528         AC_MSG_CHECKING([if struct request_queue has request_fn_active])
529         LB_LINUX_TRY_COMPILE([
530                 #include <linux/blkdev.h>
531         ],[
532                 struct request_queue rq = {
533                         .request_fn_active = 0,
534                 };
535
536                 return 0;
537         ],[
538                 AC_MSG_RESULT(yes)
539                 AC_DEFINE(HAVE_REQUEST_QUEUE_REQUEST_FN_ACTIVE, 1,
540                           [struct request_queue has request_fn_active])
541         ],[
542                 AC_MSG_RESULT(no)
543         ])
544
545         AC_MSG_CHECKING([if netdevice.h has select_queue_fallback_t])
546         LB_LINUX_TRY_COMPILE([
547                 #include <linux/netdevice.h>
548         ],[
549                 select_queue_fallback_t fallback;
550
551                 fallback = NULL;
552
553                 return 0;
554         ],[
555                 AC_MSG_RESULT(yes)
556                 AC_DEFINE(HAVE_SELECT_QUEUE_FALLBACK_T, 1,
557                           [select_queue_fallback_t is defined])
558         ],[
559                 AC_MSG_RESULT(no)
560         ])
561
562         AC_MSG_CHECKING([if skbuff.h has skb_set_hash])
563         LB_LINUX_TRY_COMPILE([
564                 #include <linux/netdevice.h>
565         ],[
566                 skb_set_hash(NULL, 0, PKT_HASH_TYPE_L3);
567
568                 return 0;
569         ],[
570                 AC_MSG_RESULT(yes)
571                 AC_DEFINE(HAVE_SKB_SET_HASH, 1,
572                           [skb_set_hash is defined])
573         ],[
574                 AC_MSG_RESULT(no)
575         ])
576
577         AC_MSG_CHECKING([if sockios.h has SIOCGHWTSTAMP])
578         LB_LINUX_TRY_COMPILE([
579                 #include <linux/sockios.h>
580         ],[
581                 int x = SIOCGHWTSTAMP;
582
583                 return 0;
584         ],[
585                 AC_MSG_RESULT(yes)
586                 AC_DEFINE(HAVE_SIOCGHWTSTAMP, 1,
587                           [SIOCGHWTSTAMP is defined])
588         ],[
589                 AC_MSG_RESULT(no)
590         ])
591
592         AC_MSG_CHECKING([if ip.h inet_get_local_port_range has 3 parameters])
593         LB_LINUX_TRY_COMPILE([
594                 #include <net/ip.h>
595         ],[
596                 inet_get_local_port_range(NULL, NULL, NULL);
597
598                 return 0;
599         ],[
600                 AC_MSG_RESULT(yes)
601                 AC_DEFINE(HAVE_INET_GET_LOCAL_PORT_RANGE_3_PARAMS, 1,
602                           [inet_get_local_port_range has 3 parameters])
603         ],[
604                 AC_MSG_RESULT(no)
605         ])
606
607         AC_MSG_CHECKING([if net.h has net_get_random_once])
608         LB_LINUX_TRY_COMPILE([
609                 #include <linux/net.h>
610         ],[
611                 net_get_random_once(NULL, 0);
612
613                 return 0;
614         ],[
615                 AC_MSG_RESULT(yes)
616                 AC_DEFINE(HAVE_NET_GET_RANDOM_ONCE, 1,
617                           [net_get_random_once is defined])
618         ],[
619                 AC_MSG_RESULT(no)
620         ])
621
622         AC_MSG_CHECKING([if inet_sock.h has __inet_ehashfn])
623         LB_LINUX_TRY_COMPILE([
624                 #include <net/inet_sock.h>
625         ],[
626                 __inet_ehashfn(0, 0, 0, 0, 0);
627
628                 return 0;
629         ],[
630                 AC_MSG_RESULT(yes)
631                 AC_DEFINE(HAVE_INET_EHASHFN, 1,
632                           [__inet_ehashfn is defined])
633         ],[
634                 AC_MSG_RESULT(no)
635         ])
636
637         AC_MSG_CHECKING([if err.h has PTR_ERR_OR_ZERO])
638         LB_LINUX_TRY_COMPILE([
639                 #include <linux/err.h>
640         ],[
641                 int x = PTR_ERR_OR_ZERO(NULL);
642
643                 return 0;
644         ],[
645                 AC_MSG_RESULT(yes)
646                 AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
647                           [PTR_ERR_OR_ZERO is defined])
648         ],[
649                 AC_MSG_RESULT(no)
650         ])
651
652         AC_MSG_CHECKING([if struct iscsi_session has discovery_sess])
653         LB_LINUX_TRY_COMPILE([
654                 #include <scsi/libiscsi.h>
655         ],[
656                 struct iscsi_session session;
657                 session.discovery_sess = 0;
658
659                 return 0;
660         ],[
661                 AC_MSG_RESULT(yes)
662                 AC_DEFINE(HAVE_ISCSI_DISCOVERY_SESS, 1,
663                           [discovery_sess is defined])
664         ],[
665                 AC_MSG_RESULT(no)
666         ])
667
668         AC_MSG_CHECKING([if enum iscsi_param has ISCSI_PARAM_DISCOVERY_SESS])
669         LB_LINUX_TRY_COMPILE([
670                 #include <scsi/iscsi_if.h>
671         ],[
672                 int x = ISCSI_PARAM_DISCOVERY_SESS;
673
674                 return 0;
675         ],[
676                 AC_MSG_RESULT(yes)
677                 AC_DEFINE(HAVE_ISCSI_PARAM_DISCOVERY_SESS, 1,
678                           [ISCSI_PARAM_DISCOVERY_SESS is defined])
679         ],[
680                 AC_MSG_RESULT(no)
681         ])
682
683         AC_MSG_CHECKING([if pci.h has enum pcie_link_width])
684         LB_LINUX_TRY_COMPILE([
685                 #include <linux/pci.h>
686         ],[
687                 enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
688
689                 return 0;
690         ],[
691                 AC_MSG_RESULT(yes)
692                 AC_DEFINE(HAVE_PCIE_LINK_WIDTH, 1,
693                           [pcie_link_width is defined])
694         ],[
695                 AC_MSG_RESULT(no)
696         ])
697
698         AC_MSG_CHECKING([if pci.h has enum pci_bus_speed])
699         LB_LINUX_TRY_COMPILE([
700                 #include <linux/pci.h>
701         ],[
702                 enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
703
704                 return 0;
705         ],[
706                 AC_MSG_RESULT(yes)
707                 AC_DEFINE(HAVE_PCI_BUS_SPEED, 1,
708                           [pci_bus_speed is defined])
709         ],[
710                 AC_MSG_RESULT(no)
711         ])
712
713         AC_MSG_CHECKING([if netdevice.h has struct netdev_phys_port_id])
714         LB_LINUX_TRY_COMPILE([
715                 #include <linux/netdevice.h>
716         ],[
717                 struct netdev_phys_port_id *x = NULL;
718
719                 return 0;
720         ],[
721                 AC_MSG_RESULT(yes)
722                 AC_DEFINE(HAVE_NETDEV_PHYS_PORT_ID, 1,
723                           [netdev_phys_port_id is defined])
724         ],[
725                 AC_MSG_RESULT(no)
726         ])
727
728         AC_MSG_CHECKING([if struct ifla_vf_info has linkstate])
729         LB_LINUX_TRY_COMPILE([
730                 #include <linux/if_link.h>
731         ],[
732                 struct ifla_vf_info *x;
733                 x->linkstate = 0;
734
735                 return 0;
736         ],[
737                 AC_MSG_RESULT(yes)
738                 AC_DEFINE(HAVE_LINKSTATE, 1,
739                           [linkstate is defined])
740         ],[
741                 AC_MSG_RESULT(no)
742         ])
743
744         AC_MSG_CHECKING([if busy_poll.h has skb_mark_napi_id])
745         LB_LINUX_TRY_COMPILE([
746                 #include <net/busy_poll.h>
747         ],[
748                 skb_mark_napi_id(NULL, NULL);
749
750                 return 0;
751         ],[
752                 AC_MSG_RESULT(yes)
753                 AC_DEFINE(HAVE_SKB_MARK_NAPI_ID, 1,
754                           [skb_mark_napi_id is defined])
755         ],[
756                 AC_MSG_RESULT(no)
757         ])
758
759         AC_MSG_CHECKING([if netdevice.h has napi_hash_add])
760         LB_LINUX_TRY_COMPILE([
761                 #include <linux/netdevice.h>
762         ],[
763                 napi_hash_add(NULL);
764
765                 return 0;
766         ],[
767                 AC_MSG_RESULT(yes)
768                 AC_DEFINE(HAVE_NAPI_HASH_ADD, 1,
769                           [napi_hash_add is defined])
770         ],[
771                 AC_MSG_RESULT(no)
772         ])
773
774         AC_MSG_CHECKING([if netdevice.h has netif_keep_dst])
775         LB_LINUX_TRY_COMPILE([
776                 #include <linux/netdevice.h>
777         ],[
778                 netif_keep_dst(NULL);
779
780                 return 0;
781         ],[
782                 AC_MSG_RESULT(yes)
783                 AC_DEFINE(HAVE_NETIF_KEEP_DST, 1,
784                           [netif_keep_dst is defined])
785         ],[
786                 AC_MSG_RESULT(no)
787         ])
788
789         AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any])
790         LB_LINUX_TRY_COMPILE([
791                 #include <linux/netdevice.h>
792         ],[
793                 dev_consume_skb_any(NULL);
794
795                 return 0;
796         ],[
797                 AC_MSG_RESULT(yes)
798                 AC_DEFINE(HAVE_DEV_CONSUME_SKB_ANY, 1,
799                           [dev_consume_skb_any is defined])
800         ],[
801                 AC_MSG_RESULT(no)
802         ])
803
804         AC_MSG_CHECKING([if netdevice.h has netdev_txq_bql_complete_prefetchw])
805         LB_LINUX_TRY_COMPILE([
806                 #include <linux/netdevice.h>
807         ],[
808                 netdev_txq_bql_complete_prefetchw(NULL);
809                 netdev_txq_bql_enqueue_prefetchw(NULL);
810
811                 return 0;
812         ],[
813                 AC_MSG_RESULT(yes)
814                 AC_DEFINE(HAVE_NETDEV_TXQ_BQL_PREFETCHW, 1,
815                           [netdev_txq_bql_complete_prefetchw is defined])
816         ],[
817                 AC_MSG_RESULT(no)
818         ])
819
820         AC_MSG_CHECKING([if struct sk_buff has xmit_more])
821         LB_LINUX_TRY_COMPILE([
822                 #include <linux/skbuff.h>
823         ],[
824                 struct sk_buff *skb;
825                 skb->xmit_more = 0;
826
827                 return 0;
828         ],[
829                 AC_MSG_RESULT(yes)
830                 AC_DEFINE(HAVE_SK_BUFF_XMIT_MORE, 1,
831                           [xmit_more is defined])
832         ],[
833                 AC_MSG_RESULT(no)
834         ])
835
836         AC_MSG_CHECKING([if struct sk_buff has encapsulation])
837         LB_LINUX_TRY_COMPILE([
838                 #include <linux/skbuff.h>
839         ],[
840                 struct sk_buff *skb;
841                 skb->encapsulation = 0;
842
843                 return 0;
844         ],[
845                 AC_MSG_RESULT(yes)
846                 AC_DEFINE(HAVE_SK_BUFF_ENCAPSULATION, 1,
847                           [encapsulation is defined])
848         ],[
849                 AC_MSG_RESULT(no)
850         ])
851
852         AC_MSG_CHECKING([if etherdevice.h has eth_get_headlen])
853         LB_LINUX_TRY_COMPILE([
854                 #include <linux/etherdevice.h>
855         ],[
856                 eth_get_headlen(NULL, 0);
857
858                 return 0;
859         ],[
860                 AC_MSG_RESULT(yes)
861                 AC_DEFINE(HAVE_ETH_GET_HEADLEN, 1,
862                           [eth_get_headlen is defined])
863         ],[
864                 AC_MSG_RESULT(no)
865         ])
866
867         AC_MSG_CHECKING([if struct sk_buff has csum_level])
868         LB_LINUX_TRY_COMPILE([
869                 #include <linux/skbuff.h>
870         ],[
871                 struct sk_buff *skb;
872                 skb->csum_level = 0;
873
874                 return 0;
875         ],[
876                 AC_MSG_RESULT(yes)
877                 AC_DEFINE(HAVE_SK_BUFF_CSUM_LEVEL, 1,
878                           [csum_level is defined])
879         ],[
880                 AC_MSG_RESULT(no)
881         ])
882
883         AC_MSG_CHECKING([if struct skbuff.h has skb_inner_transport_header])
884         LB_LINUX_TRY_COMPILE([
885                 #include <linux/skbuff.h>
886         ],[
887                 skb_inner_transport_header(NULL);
888
889                 return 0;
890         ],[
891                 AC_MSG_RESULT(yes)
892                 AC_DEFINE(HAVE_SKB_INNER_TRANSPORT_HEADER, 1,
893                           [skb_inner_transport_header is defined])
894         ],[
895                 AC_MSG_RESULT(no)
896         ])
897
898         AC_MSG_CHECKING([if struct skbuff.h has skb_inner_network_header])
899         LB_LINUX_TRY_COMPILE([
900                 #include <linux/skbuff.h>
901         ],[
902                 skb_inner_network_header(NULL);
903
904                 return 0;
905         ],[
906                 AC_MSG_RESULT(yes)
907                 AC_DEFINE(HAVE_SKB_INNER_NETWORK_HEADER, 1,
908                           [skb_inner_network_header is defined])
909         ],[
910                 AC_MSG_RESULT(no)
911         ])
912
913         AC_MSG_CHECKING([if if_vlan.h has vlan_dev_get_egress_qos_mask])
914         LB_LINUX_TRY_COMPILE([
915                 #include <linux/if_vlan.h>
916         ],[
917                 vlan_dev_get_egress_qos_mask(NULL, 0);
918
919                 return 0;
920         ],[
921                 AC_MSG_RESULT(yes)
922                 AC_DEFINE(HAVE_VLAN_DEV_GET_EGRESS_QOS_MASK, 1,
923                           [vlan_dev_get_egress_qos_mask is defined])
924         ],[
925                 AC_MSG_RESULT(no)
926         ])
927
928         AC_MSG_CHECKING([if netdevice.h has netdev_get_prio_tc_map])
929         LB_LINUX_TRY_COMPILE([
930                 #include <linux/netdevice.h>
931         ],[
932                 netdev_get_prio_tc_map(NULL, 0);
933
934                 return 0;
935         ],[
936                 AC_MSG_RESULT(yes)
937                 AC_DEFINE(HAVE_NETDEV_GET_PRIO_TC_MAP, 1,
938                           [netdev_get_prio_tc_map is defined])
939         ],[
940                 AC_MSG_RESULT(no)
941         ])
942
943         AC_MSG_CHECKING([if if_vlan.h has __vlan_find_dev_deep_rcu])
944         LB_LINUX_TRY_COMPILE([
945                 #include <linux/if_vlan.h>
946         ],[
947                 __vlan_find_dev_deep_rcu(NULL, 0, 0);
948
949                 return 0;
950         ],[
951                 AC_MSG_RESULT(yes)
952                 AC_DEFINE(HAVE___VLAN_FIND_DEV_DEEP_RCU, 1,
953                           [__vlan_find_dev_deep_rcu is defined])
954         ],[
955                 AC_MSG_RESULT(no)
956         ])
957
958         AC_MSG_CHECKING([if ndo_select_queue has accel_priv])
959         LB_LINUX_TRY_COMPILE([
960                 #include <linux/netdevice.h>
961
962                 static u16 select_queue(struct net_device *dev, struct sk_buff *skb,
963                                         void *accel_priv)
964                 {
965                         return 0;
966                 }
967         ],[
968                 struct net_device_opts ndops;
969
970                 ndops.ndo_select_queue = select_queue;
971
972                 return 0;
973         ],[
974                 AC_MSG_RESULT(yes)
975                 AC_DEFINE(NDO_SELECT_QUEUE_HAS_ACCEL_PRIV, 1,
976                           [ndo_select_queue has accel_priv])
977         ],[
978                 AC_MSG_RESULT(no)
979         ])
980
981         AC_MSG_CHECKING([if include/net/bonding.h exists])
982         LB_LINUX_TRY_COMPILE([
983                 #include <net/bonding.h>
984         ],[
985                 return 0;
986         ],[
987                 AC_MSG_RESULT(yes)
988                 AC_DEFINE(HAVE_BONDING_H, 1,
989                           [include/net/bonding.h exists])
990         ],[
991                 AC_MSG_RESULT(no)
992         ])
993
994         AC_MSG_CHECKING([if bonding.h bond_for_each_slave has 3 parameters])
995         LB_LINUX_TRY_COMPILE([
996                 #include "../drivers/net/bonding/bonding.h"
997         ],[
998                 struct bonding *bond = NULL;
999                 struct list_head *iter = NULL;
1000                 struct slave *slave = NULL;
1001
1002                 bond_for_each_slave(bond, slave, iter) ;
1003
1004                 return 0;
1005         ],[
1006                 AC_MSG_RESULT(yes)
1007                 AC_DEFINE(HAVE_BOND_FOR_EACH_SLAVE_3_PARAMS, 1,
1008                           [bond_for_each_slave has 3 parameters])
1009         ],[
1010                 AC_MSG_RESULT(no)
1011         ])
1012
1013
1014         AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_init])
1015         LB_LINUX_TRY_COMPILE([
1016                 #include <linux/u64_stats_sync.h>
1017         ],[
1018                 struct u64_stats_sync sync;
1019                 u64_stats_init(&sync);
1020
1021                 return 0;
1022         ],[
1023                 AC_MSG_RESULT(yes)
1024                 AC_DEFINE(HAVE_U64_STATS_SYNC, 1,
1025                           [u64_stats_sync is defined])
1026         ],[
1027                 AC_MSG_RESULT(no)
1028         ])
1029
1030         AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_fetch_begin_irq])
1031         LB_LINUX_TRY_COMPILE([
1032                 #include <linux/u64_stats_sync.h>
1033         ],[
1034                 struct u64_stats_sync sync;
1035                 u64_stats_fetch_begin_irq(&sync);
1036
1037                 return 0;
1038         ],[
1039                 AC_MSG_RESULT(yes)
1040                 AC_DEFINE(HAVE_U64_STATS_FETCH_BEGIN_IRQ, 1,
1041                           [u64_stats_fetch_begin_irq is defined])
1042         ],[
1043                 AC_MSG_RESULT(no)
1044         ])
1045         AC_MSG_CHECKING([if etherdevice.h has ether_addr_copy])
1046         LB_LINUX_TRY_COMPILE([
1047                 #include <linux/etherdevice.h>
1048         ],[
1049                 char dest[6], src[6];
1050                 ether_addr_copy(&dest, &src);
1051
1052                 return 0;
1053         ],[
1054                 AC_MSG_RESULT(yes)
1055                 AC_DEFINE(HAVE_ETHER_ADDR_COPY, 1,
1056                           [ether_addr_copy is defined])
1057         ],[
1058                 AC_MSG_RESULT(no)
1059         ])
1060
1061         AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_vf_rate])
1062         LB_LINUX_TRY_COMPILE([
1063                 #include <linux/netdevice.h>
1064
1065                 int set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
1066                                                    int max_tx_rate)
1067                 {
1068                         return 0;
1069                 }
1070         ],[
1071                 struct net_device_ops netdev_ops;
1072
1073                 netdev_ops.ndo_set_vf_rate = set_vf_rate;
1074                 return 0;
1075         ],[
1076                 AC_MSG_RESULT(yes)
1077                 AC_DEFINE(HAVE_SET_VF_RATE, 1,
1078                           [ndo_set_vf_rate is defined])
1079         ],[
1080                 AC_MSG_RESULT(no)
1081         ])
1082
1083         AC_MSG_CHECKING([if netdev_extended has hw_features])
1084         LB_LINUX_TRY_COMPILE([
1085                 #include <linux/netdevice.h>
1086         ],[
1087                 struct net_device *dev = NULL;
1088
1089                 netdev_extended(dev)->hw_features = 0;
1090
1091                 return 0;
1092         ],[
1093                 AC_MSG_RESULT(yes)
1094                 AC_DEFINE(HAVE_NETDEV_EXTENDED_HW_FEATURES, 1,
1095                           [ is defined])
1096         ],[
1097                 AC_MSG_RESULT(no)
1098         ])
1099
1100         AC_MSG_CHECKING([if net_device_extended has _tx_ext])
1101         LB_LINUX_TRY_COMPILE([
1102                 #include <linux/netdevice.h>
1103         ],[
1104                 struct net_device *dev = NULL;
1105
1106                 netdev_extended(dev)->_tx_ext = NULL;
1107
1108                 return 0;
1109         ],[
1110                 AC_MSG_RESULT(yes)
1111                 AC_DEFINE(HAVE_NET_DEVICE_EXTENDED_TX_EXT, 1,
1112                           [ is defined])
1113         ],[
1114                 AC_MSG_RESULT(no)
1115         ])
1116
1117         AC_MSG_CHECKING([if net_device_extended has ndo_busy_poll])
1118         LB_LINUX_TRY_COMPILE([
1119                 #include <linux/netdevice.h>
1120
1121                 int busy_poll(struct napi_struct *napi)
1122                 {
1123                         return 0;
1124                 }
1125         ],[
1126                 struct net_device *dev = NULL;
1127
1128                 netdev_extended(dev)->ndo_busy_poll = busy_poll;
1129
1130                 return 0;
1131         ],[
1132                 AC_MSG_RESULT(yes)
1133                 AC_DEFINE(HAVE_NETDEV_EXTENDED_NDO_BUSY_POLL, 1,
1134                           [ is defined])
1135         ],[
1136                 AC_MSG_RESULT(no)
1137         ])
1138
1139         AC_MSG_CHECKING([if netdevice.h has set_netdev_hw_features])
1140         LB_LINUX_TRY_COMPILE([
1141                 #include <linux/netdevice.h>
1142         ],[
1143                 struct net_device *dev = NULL;
1144
1145                 set_netdev_hw_features(dev, 0);
1146
1147                 return 0;
1148         ],[
1149                 AC_MSG_RESULT(yes)
1150                 AC_DEFINE(HAVE_SET_NETDEV_HW_FEATURES, 1,
1151                           [ is defined])
1152         ],[
1153                 AC_MSG_RESULT(no)
1154         ])
1155
1156         AC_MSG_CHECKING([if netdevice.h has netif_set_xps_queue])
1157         LB_LINUX_TRY_COMPILE([
1158                 #include <linux/netdevice.h>
1159         ],[
1160                 struct net_device *dev = NULL;
1161
1162                 netif_set_xps_queue(dev, NULL, 0);
1163
1164                 return 0;
1165         ],[
1166                 AC_MSG_RESULT(yes)
1167                 AC_DEFINE(HAVE_NETIF_SET_XPS_QUEUE, 1,
1168                           [ is defined])
1169         ],[
1170                 AC_MSG_RESULT(no)
1171         ])
1172
1173
1174         AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_features])
1175         LB_LINUX_TRY_COMPILE([
1176                 #include <linux/netdevice.h>
1177
1178                 int set_features(struct net_device *dev, netdev_features_t features)
1179                 {
1180                         return 0;
1181                 }
1182         ],[
1183                 struct net_device_ops netdev_ops;
1184
1185                 netdev_ops.ndo_set_features = set_features;
1186                 return 0;
1187         ],[
1188                 AC_MSG_RESULT(yes)
1189                 AC_DEFINE(HAVE_NDO_SET_FEATURES, 1,
1190                           [ndo_set_features is defined])
1191         ],[
1192                 AC_MSG_RESULT(no)
1193         ])
1194
1195         AC_MSG_CHECKING([if struct net_device_ops has *ndo_setup_tc])
1196         LB_LINUX_TRY_COMPILE([
1197                 #include <linux/netdevice.h>
1198         ],[
1199                 struct net_device_ops x = {
1200                         .ndo_setup_tc = NULL,
1201                 };
1202
1203                 return 0;
1204         ],[
1205                 AC_MSG_RESULT(yes)
1206                 AC_DEFINE(HAVE_NDO_SETUP_TC, 1,
1207                           [ndo_setup_tc is defined])
1208         ],[
1209                 AC_MSG_RESULT(no)
1210         ])
1211
1212         AC_MSG_CHECKING([if struct net_device_ops has *ndo_rx_flow_steer])
1213         LB_LINUX_TRY_COMPILE([
1214                 #include <linux/netdevice.h>
1215
1216                 int rx_flow_steer(struct net_device *dev,
1217                                                      const struct sk_buff *skb,
1218                                                      u16 rxq_index,
1219                                                      u32 flow_id)
1220                 {
1221                         return 0;
1222                 }
1223         ],[
1224                 struct net_device_ops netdev_ops;
1225
1226                 netdev_ops.ndo_rx_flow_steer = rx_flow_steer;
1227                 return 0;
1228         ],[
1229                 AC_MSG_RESULT(yes)
1230                 AC_DEFINE(HAVE_NDO_RX_FLOW_STEER, 1,
1231                           [ndo_rx_flow_steer is defined])
1232         ],[
1233                 AC_MSG_RESULT(no)
1234         ])
1235
1236         AC_MSG_CHECKING([if struct net_device has priv_flags])
1237         LB_LINUX_TRY_COMPILE([
1238                 #include <linux/netdevice.h>
1239         ],[
1240                 struct net_device *netdev;
1241                 netdev->priv_flags = 0;
1242
1243                 return 0;
1244         ],[
1245                 AC_MSG_RESULT(yes)
1246                 AC_DEFINE(HAVE_NET_DEVICE_PRIV_FLAGS, 1,
1247                           [priv_flags is defined])
1248         ],[
1249                 AC_MSG_RESULT(no)
1250         ])
1251
1252         AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_stats64])
1253         LB_LINUX_TRY_COMPILE([
1254                 #include <linux/netdevice.h>
1255
1256                 struct rtnl_link_stats64* get_stats_64(struct net_device *dev,
1257                                                      struct rtnl_link_stats64 *storage)
1258                 {
1259                         struct rtnl_link_stats64 stats_64;
1260                         return &stats_64;
1261                 }
1262         ],[
1263                 struct net_device_ops netdev_ops;
1264
1265                 netdev_ops.ndo_get_stats64 = get_stats_64;
1266
1267                 return 0;
1268         ],[
1269                 AC_MSG_RESULT(yes)
1270                 AC_DEFINE(HAVE_NDO_GET_STATS64, 1,
1271                           [ndo_get_stats64 is defined])
1272         ],[
1273                 AC_MSG_RESULT(no)
1274         ])
1275         AC_MSG_CHECKING([if struct net_device_ops has ndo_bridge_set/getlink])
1276         LB_LINUX_TRY_COMPILE([
1277                 #include <linux/netdevice.h>
1278         ],[
1279                 struct net_device_ops netdev_ops =  {
1280                         .ndo_bridge_setlink = NULL,
1281                         .ndo_bridge_getlink = NULL,
1282                 };
1283
1284                 return 0;
1285         ],[
1286                 AC_MSG_RESULT(yes)
1287                 AC_DEFINE(HAVE_NDO_BRIDGE_SET_GET_LINK, 1,
1288                           [ndo_bridge_set/getlink is defined])
1289         ],[
1290                 AC_MSG_RESULT(no)
1291         ])
1292
1293         AC_MSG_CHECKING([if struct net_device_ops ndo_vlan_rx_add_vid has 3 parameters ])
1294         LB_LINUX_TRY_COMPILE([
1295                 #include <linux/netdevice.h>
1296
1297         ],[
1298                 int vlan_rx_add_vid(struct net_device *dev,__be16 proto, u16 vid)
1299                 {
1300                         return 0;
1301                 }
1302                 struct net_device_ops netdev_ops;
1303
1304                 netdev_ops.ndo_vlan_rx_add_vid = vlan_rx_add_vid;
1305                 netdev_ops.ndo_vlan_rx_add_vid (NULL, 1, 1) ;
1306
1307                 return 0;
1308         ],[
1309                 AC_MSG_RESULT(yes)
1310                 AC_DEFINE(HAVE_NDO_RX_ADD_VID_HAS_3_PARAMS, 1,
1311                           [ndo_vlan_rx_add_vid has 3 parameters])
1312         ],[
1313                 AC_MSG_RESULT(no)
1314         ])
1315
1316         AC_MSG_CHECKING([if net_device_ops has ndo_get_phys_port_id])
1317         LB_LINUX_TRY_COMPILE([
1318                 #include <linux/netdevice.h>
1319
1320                 int get_phys_port_id(struct net_device *dev,
1321                                      struct netdev_phys_port_id *ppid)
1322                 {
1323                         return 0;
1324                 }
1325         ],[
1326                 struct net_device_ops netdev_ops;
1327
1328                 netdev_ops.ndo_get_phys_port_id = get_phys_port_id;
1329
1330                 return 0;
1331         ],[
1332                 AC_MSG_RESULT(yes)
1333                 AC_DEFINE(HAVE_NETDEV_NDO_GET_PHYS_PORT_ID, 1,
1334                           [ is defined])
1335         ],[
1336                 AC_MSG_RESULT(no)
1337         ])
1338
1339         AC_MSG_CHECKING([if struct net_device_ops_ext exist])
1340         LB_LINUX_TRY_COMPILE([
1341                 #include <linux/netdevice.h>
1342         ],[
1343                 struct net_device_ops_ext netdev_ops_ext = {
1344                         .size = sizeof(struct net_device_ops_ext),
1345                 };
1346
1347                 return 0;
1348         ],[
1349                 AC_MSG_RESULT(yes)
1350                 AC_DEFINE(HAVE_NET_DEVICE_OPS_EXT, 1,
1351                           [struct net_device_ops_ext is defined])
1352         ],[
1353                 AC_MSG_RESULT(no)
1354         ])
1355
1356         AC_MSG_CHECKING([if net_device_ops_ext has ndo_get_phys_port_id])
1357         LB_LINUX_TRY_COMPILE([
1358                 #include <linux/netdevice.h>
1359
1360                 int get_phys_port_id(struct net_device *dev,
1361                                      struct netdev_phys_port_id *ppid)
1362                 {
1363                         return 0;
1364                 }
1365         ],[
1366                 struct net_device_ops_ext netdev_ops_ext;
1367
1368                 netdev_ops_ext.ndo_get_phys_port_id = get_phys_port_id;
1369
1370                 return 0;
1371         ],[
1372                 AC_MSG_RESULT(yes)
1373                 AC_DEFINE(HAVE_NETDEV_EXT_NDO_GET_PHYS_PORT_ID, 1,
1374                           [ndo_get_phys_port_id is defined])
1375         ],[
1376                 AC_MSG_RESULT(no)
1377         ])
1378
1379         AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_spoofchk])
1380         LB_LINUX_TRY_COMPILE([
1381                 #include <linux/netdevice.h>
1382
1383                 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1384                 {
1385                         return 0;
1386                 }
1387         ],[
1388                 struct net_device_ops netdev_ops;
1389
1390                 netdev_ops.ndo_set_vf_spoofchk = set_vf_spoofchk;
1391
1392                 return 0;
1393         ],[
1394                 AC_MSG_RESULT(yes)
1395                 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_SPOOFCHK, 1,
1396                           [ndo_set_vf_spoofchk is defined in net_device_ops])
1397         ],[
1398                 AC_MSG_RESULT(no)
1399         ])
1400
1401         AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_spoofchk])
1402         LB_LINUX_TRY_COMPILE([
1403                 #include <linux/netdevice.h>
1404
1405                 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1406                 {
1407                         return 0;
1408                 }
1409         ],[
1410                 struct net_device_ops_ext netdev_ops_ext;
1411
1412                 netdev_ops_ext.ndo_set_vf_spoofchk = set_vf_spoofchk;
1413
1414                 return 0;
1415         ],[
1416                 AC_MSG_RESULT(yes)
1417                 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_SPOOFCHK, 1,
1418                           [ndo_set_vf_spoofchk is defined in net_device_ops_ext])
1419         ],[
1420                 AC_MSG_RESULT(no)
1421         ])
1422
1423         AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_link_state])
1424         LB_LINUX_TRY_COMPILE([
1425                 #include <linux/netdevice.h>
1426
1427                 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1428                 {
1429                         return 0;
1430                 }
1431         ],[
1432                 struct net_device_ops netdev_ops;
1433
1434                 netdev_ops.ndo_set_vf_link_state = set_vf_link_state;
1435
1436                 return 0;
1437         ],[
1438                 AC_MSG_RESULT(yes)
1439                 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_LINK_STATE, 1,
1440                           [ndo_set_vf_link_state is defined in net_device_ops])
1441         ],[
1442                 AC_MSG_RESULT(no)
1443         ])
1444
1445         AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_link_state])
1446         LB_LINUX_TRY_COMPILE([
1447                 #include <linux/netdevice.h>
1448
1449                 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1450                 {
1451                         return 0;
1452                 }
1453         ],[
1454                 struct net_device_ops_ext netdev_ops_ext;
1455
1456                 netdev_ops_ext.ndo_set_vf_link_state = set_vf_link_state;
1457
1458                 return 0;
1459         ],[
1460                 AC_MSG_RESULT(yes)
1461                 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_LINK_STATE, 1,
1462                           [ndo_set_vf_link_state is defined])
1463         ],[
1464                 AC_MSG_RESULT(no)
1465         ])
1466
1467
1468         AC_MSG_CHECKING([if netdevice.h netif_set_real_num_tx_queues returns int])
1469         LB_LINUX_TRY_COMPILE([
1470                 #include <linux/netdevice.h>
1471         ],[
1472                 struct net_device dev;
1473                 int ret;
1474                 ret = netif_set_real_num_tx_queues(&dev, 2);
1475                 return 0;
1476         ],[
1477                 AC_MSG_RESULT(yes)
1478                 AC_DEFINE(HAVE_RETURN_INT_FOR_SET_NUM_TX_QUEUES, 1,
1479                           [netif_set_real_num_tx_queues returns int])
1480         ],[
1481                 AC_MSG_RESULT(no)
1482         ])
1483
1484         AC_MSG_CHECKING([if struct netdevice.h has struct xps_map])
1485         LB_LINUX_TRY_COMPILE([
1486                 #include <linux/netdevice.h>
1487         ],[
1488                 struct xps_map map;
1489                 map.len = 0;
1490
1491                 return 0;
1492         ],[
1493                 AC_MSG_RESULT(yes)
1494                 AC_DEFINE(HAVE_XPS_MAP, 1,
1495                           [struct xps_map is defined])
1496         ],[
1497                 AC_MSG_RESULT(no)
1498         ])
1499
1500         AC_MSG_CHECKING([if struct ethtool_ops has set_phys_id])
1501         LB_LINUX_TRY_COMPILE([
1502                 #include <linux/ethtool.h>
1503         ],[
1504                 const struct ethtool_ops en_ethtool_ops = {
1505                         .set_phys_id= NULL,
1506                 };
1507
1508                 return 0;
1509         ],[
1510                 AC_MSG_RESULT(yes)
1511                 AC_DEFINE(HAVE_SET_PHYS_ID, 1,
1512                           [set_phys_id is defined])
1513         ],[
1514                 AC_MSG_RESULT(no)
1515         ])
1516
1517         AC_MSG_CHECKING([if struct ethtool_ops has get/set_channels])
1518         LB_LINUX_TRY_COMPILE([
1519                 #include <linux/ethtool.h>
1520         ],[
1521                 const struct ethtool_ops en_ethtool_ops = {
1522                         .get_channels = NULL,
1523                         .set_channels = NULL,
1524                 };
1525
1526                 return 0;
1527         ],[
1528                 AC_MSG_RESULT(yes)
1529                 AC_DEFINE(HAVE_GET_SET_CHANNELS, 1,
1530                           [get/set_channels is defined])
1531         ],[
1532                 AC_MSG_RESULT(no)
1533         ])
1534
1535         AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_channels])
1536         LB_LINUX_TRY_COMPILE([
1537                 #include <linux/ethtool.h>
1538         ],[
1539                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1540                         .get_channels = NULL,
1541                         .set_channels = NULL,
1542                 };
1543
1544                 return 0;
1545         ],[
1546                 AC_MSG_RESULT(yes)
1547                 AC_DEFINE(HAVE_GET_SET_CHANNELS_EXT, 1,
1548                           [get/set_channels is defined in ethtool_ops_ext])
1549         ],[
1550                 AC_MSG_RESULT(no)
1551         ])
1552
1553         AC_MSG_CHECKING([if struct ethtool_ops has get_ts_info])
1554         LB_LINUX_TRY_COMPILE([
1555                 #include <linux/ethtool.h>
1556         ],[
1557                 const struct ethtool_ops en_ethtool_ops = {
1558                         .get_ts_info = NULL,
1559                 };
1560
1561                 return 0;
1562         ],[
1563                 AC_MSG_RESULT(yes)
1564                 AC_DEFINE(HAVE_GET_TS_INFO, 1,
1565                           [get_ts_info is defined])
1566         ],[
1567                 AC_MSG_RESULT(no)
1568         ])
1569
1570         AC_MSG_CHECKING([if struct ethtool_ops has set_dump])
1571         LB_LINUX_TRY_COMPILE([
1572                 #include <linux/ethtool.h>
1573         ],[
1574                 const struct ethtool_ops en_ethtool_ops = {
1575                         .set_dump = NULL,
1576                 };
1577
1578                 return 0;
1579         ],[
1580                 AC_MSG_RESULT(yes)
1581                 AC_DEFINE(HAVE_ETHTOOL_OPS_SET_DUMP, 1,
1582                           [set_dump is defined])
1583         ],[
1584                 AC_MSG_RESULT(no)
1585         ])
1586
1587         AC_MSG_CHECKING([if struct ethtool_ops has get_module_info])
1588         LB_LINUX_TRY_COMPILE([
1589                 #include <linux/ethtool.h>
1590         ],[
1591                 const struct ethtool_ops en_ethtool_ops = {
1592                         .get_module_info = NULL,
1593                 };
1594
1595                 return 0;
1596         ],[
1597                 AC_MSG_RESULT(yes)
1598                 AC_DEFINE(HAVE_ETHTOOL_OPS_GET_MODULE_INFO, 1,
1599                           [get_module_info is defined])
1600         ],[
1601                 AC_MSG_RESULT(no)
1602         ])
1603
1604         AC_MSG_CHECKING([if struct ethtool_ops has get_module_eeprom])
1605         LB_LINUX_TRY_COMPILE([
1606                 #include <linux/ethtool.h>
1607         ],[
1608                 const struct ethtool_ops en_ethtool_ops = {
1609                         .get_module_eeprom = NULL,
1610                 };
1611
1612                 return 0;
1613         ],[
1614                 AC_MSG_RESULT(yes)
1615                 AC_DEFINE(HAVE_ETHTOOL_OPS_GET_MODULE_EEPROM, 1,
1616                           [get_module_eeprom is defined])
1617         ],[
1618                 AC_MSG_RESULT(no)
1619         ])
1620
1621         AC_MSG_CHECKING([if struct ethtool_ops_ext has get_ts_info])
1622         LB_LINUX_TRY_COMPILE([
1623                 #include <linux/ethtool.h>
1624         ],[
1625                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1626                         .get_ts_info = NULL,
1627                 };
1628
1629                 return 0;
1630         ],[
1631                 AC_MSG_RESULT(yes)
1632                 AC_DEFINE(HAVE_GET_TS_INFO_EXT, 1,
1633                           [get_ts_info is defined in ethtool_ops_ext])
1634         ],[
1635                 AC_MSG_RESULT(no)
1636         ])
1637
1638         AC_MSG_CHECKING([if struct ethtool_flow_ext has h_dest])
1639         LB_LINUX_TRY_COMPILE([
1640                 #include <linux/ethtool.h>
1641         ],[
1642                 unsigned char mac[ETH_ALEN];
1643                 struct ethtool_flow_ext h_ext;
1644
1645                 memcpy(&mac, h_ext.h_dest, ETH_ALEN);
1646
1647                 return 0;
1648         ],[
1649                 AC_MSG_RESULT(yes)
1650                 AC_DEFINE(HAVE_ETHTOOL_FLOW_EXT_H_DEST, 1,
1651                           [ethtool_flow_ext has h_dest])
1652         ],[
1653                 AC_MSG_RESULT(no)
1654         ])
1655
1656         AC_MSG_CHECKING([if netdevice.h has struct dev_addr_list])
1657         LB_LINUX_TRY_COMPILE([
1658                 #include <linux/netdevice.h>
1659         ],[
1660                 struct dev_addr_list addr;
1661                 return 0;
1662         ],[
1663                 AC_MSG_RESULT(yes)
1664                 AC_DEFINE(HAVE_NETDEV_DEV_ADDR, 1,
1665                           [dev_addr_list is defined])
1666         ],[
1667                 AC_MSG_RESULT(no)
1668         ])
1669
1670         AC_MSG_CHECKING([if pci.h has pci_vfs_assigned])
1671         LB_LINUX_TRY_COMPILE([
1672                 #include <linux/pci.h>
1673         ],[
1674                 struct pci_dev pdev;
1675                 pci_vfs_assigned(&pdev);
1676                 return 0;
1677         ],[
1678                 AC_MSG_RESULT(yes)
1679                 AC_DEFINE(HAVE_PCI_VF_ASSIGNED, 1,
1680                           [pci_vfs_assigned is defined])
1681         ],[
1682                 AC_MSG_RESULT(no)
1683         ])
1684         AC_MSG_CHECKING([if __vlan_put_tag has 3 parameters])
1685         LB_LINUX_TRY_COMPILE([
1686                 #include <linux/if_vlan.h>
1687         ],[
1688                 struct sk_buff *skb;
1689                 __vlan_put_tag(skb, 0, 0);
1690
1691                 return 0;
1692         ],[
1693                 AC_MSG_RESULT(yes)
1694                 AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_PUT_TAG, 1,
1695                           [__vlan_put_tag has 3 parameters])
1696         ],[
1697                 AC_MSG_RESULT(no)
1698         ])
1699
1700         AC_MSG_CHECKING([if __vlan_hwaccel_put_tag has 3 parameters])
1701         LB_LINUX_TRY_COMPILE([
1702                 #include <linux/if_vlan.h>
1703         ],[
1704                 struct sk_buff *skb;
1705                 __vlan_hwaccel_put_tag(skb, 0, 0);
1706
1707                 return 0;
1708         ],[
1709                 AC_MSG_RESULT(yes)
1710                 AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_HWACCEL_PUT_TAG, 1,
1711                           [__vlan_hwaccel_put_tag has 3 parameters])
1712         ],[
1713                 AC_MSG_RESULT(no)
1714         ])
1715
1716         AC_MSG_CHECKING([if struct inet6_ifaddr has if_next])
1717         LB_LINUX_TRY_COMPILE([
1718                 #include <net/if_inet6.h>
1719         ],[
1720                 struct inet6_ifaddr ifp ;
1721                 ifp.if_next = 0;
1722
1723                 return 0;
1724         ],[
1725                 AC_MSG_RESULT(yes)
1726                 AC_DEFINE(HAVE_INETADDR_IF_NEXT, 1,
1727                           [if_next is defined])
1728         ],[
1729                 AC_MSG_RESULT(no)
1730         ])
1731
1732         AC_MSG_CHECKING([if struct net_device has hw_features])
1733         LB_LINUX_TRY_COMPILE([
1734                 #include <linux/netdevice.h>
1735         ],[
1736                 struct net_device dev;
1737                 dev.hw_features = 0;
1738
1739                 return 0;
1740         ],[
1741                 AC_MSG_RESULT(yes)
1742                 AC_DEFINE(HAVE_NETDEV_HW_FEATURES, 1,
1743                           [hw_features is defined])
1744         ],[
1745                 AC_MSG_RESULT(no)
1746         ])
1747
1748         AC_MSG_CHECKING([if struct net_device has hw_enc_features])
1749         LB_LINUX_TRY_COMPILE([
1750                 #include <linux/netdevice.h>
1751         ],[
1752                 struct net_device dev;
1753                 dev.hw_enc_features = 0;
1754
1755                 return 0;
1756         ],[
1757                 AC_MSG_RESULT(yes)
1758                 AC_DEFINE(HAVE_NETDEV_HW_ENC_FEATURES, 1,
1759                           [hw_enc_features is defined])
1760         ],[
1761                 AC_MSG_RESULT(no)
1762         ])
1763
1764         AC_MSG_CHECKING([if struct net_device has rx_cpu_rmap])
1765         LB_LINUX_TRY_COMPILE([
1766                 #include <linux/netdevice.h>
1767         ],[
1768                 struct net_device dev;
1769                 dev.rx_cpu_rmap = NULL;
1770
1771                 return 0;
1772         ],[
1773                 AC_MSG_RESULT(yes)
1774                 AC_DEFINE(HAVE_NETDEV_RX_CPU_RMAP, 1,
1775                           [rx_cpu_rmap is defined])
1776         ],[
1777                 AC_MSG_RESULT(no)
1778         ])
1779
1780         AC_MSG_CHECKING([if if_vlan.h has vlan_hwaccel_receive_skb])
1781         LB_LINUX_TRY_COMPILE([
1782                 #include <linux/if_vlan.h>
1783         ],[
1784                 struct sk_buff *skb;
1785                 vlan_hwaccel_receive_skb(skb,0,0);
1786                 return 0;
1787         ],[
1788                 AC_MSG_RESULT(yes)
1789                 AC_DEFINE(HAVE_VLAN_HWACCEL_RECEIVE_SKB, 1,
1790                           [vlan_hwaccel_receive_skb is defined])
1791         ],[
1792                 AC_MSG_RESULT(no)
1793         ])
1794
1795         AC_MSG_CHECKING([if irqdesc.h has irq_desc_get_irq_data])
1796         LB_LINUX_TRY_COMPILE([
1797                 #include <linux/irq.h>
1798                 #include <linux/irqdesc.h>
1799         ],[
1800                 struct irq_desc desc;
1801                 struct irq_data *data = irq_desc_get_irq_data(&desc);
1802
1803                 return 0;
1804         ],[
1805                 AC_MSG_RESULT(yes)
1806                 AC_DEFINE(HAVE_IRQ_DESC_GET_IRQ_DATA, 1,
1807                           [irq_desc_get_irq_data is defined])
1808         ],[
1809                 AC_MSG_RESULT(no)
1810         ])
1811
1812
1813         AC_MSG_CHECKING([if pci_dev has pcie_mpss])
1814         LB_LINUX_TRY_COMPILE([
1815                 #include <linux/pci.h>
1816         ],[
1817                 struct pci_dev *pdev;
1818
1819                 pdev->pcie_mpss = 0;
1820                 return 0;
1821         ],[
1822                 AC_MSG_RESULT(yes)
1823                 AC_DEFINE(HAVE_PCI_DEV_PCIE_MPSS, 1,
1824                           [pcie_mpss is defined])
1825         ],[
1826                 AC_MSG_RESULT(no)
1827         ])
1828
1829         AC_MSG_CHECKING([if uapi/linux/if_ether.h exist])
1830         LB_LINUX_TRY_COMPILE([
1831                 #include <uapi/linux/if_ether.h>
1832         ],[
1833                 return 0;
1834         ],[
1835                 AC_MSG_RESULT(yes)
1836                 AC_DEFINE(HAVE_UAPI_LINUX_IF_ETHER_H, 1,
1837                           [uapi/linux/if_ether.h exist])
1838         ],[
1839                 AC_MSG_RESULT(no)
1840         ])
1841
1842         AC_MSG_CHECKING([if ifla_vf_info has spoofchk])
1843         LB_LINUX_TRY_COMPILE([
1844                 #include <linux/if_link.h>
1845         ],[
1846                 struct ifla_vf_info *ivf;
1847
1848                 ivf->spoofchk = 0;
1849                 return 0;
1850         ],[
1851                 AC_MSG_RESULT(yes)
1852                 AC_DEFINE(HAVE_VF_INFO_SPOOFCHK, 1,
1853                           [spoofchk is defined])
1854         ],[
1855                 AC_MSG_RESULT(no)
1856         ])
1857
1858         AC_MSG_CHECKING([if dst.h has dst_get_neighbour])
1859         LB_LINUX_TRY_COMPILE([
1860                 #include <net/dst.h>
1861         ],[
1862                 struct neighbour *neigh = dst_get_neighbour(NULL);
1863
1864                 return 0;
1865         ],[
1866                 AC_MSG_RESULT(yes)
1867                 AC_DEFINE(HAVE_DST_GET_NEIGHBOUR, 1,
1868                           [ is defined])
1869         ],[
1870                 AC_MSG_RESULT(no)
1871         ])
1872
1873         AC_MSG_CHECKING([if netlink_dump_start has 6 parameters])
1874         LB_LINUX_TRY_COMPILE([
1875                 #include <linux/netlink.h>
1876         ],[
1877                 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL, 0);
1878
1879                 return 0;
1880         ],[
1881                 AC_MSG_RESULT(yes)
1882                 AC_DEFINE(HAVE_NETLINK_DUMP_START_6P, 1,
1883                           [ is defined])
1884         ],[
1885                 AC_MSG_RESULT(no)
1886         ])
1887
1888         AC_MSG_CHECKING([if netlink_dump_start has 5 parameters])
1889         LB_LINUX_TRY_COMPILE([
1890                 #include <linux/netlink.h>
1891         ],[
1892                 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL);
1893
1894                 return 0;
1895         ],[
1896                 AC_MSG_RESULT(yes)
1897                 AC_DEFINE(HAVE_NETLINK_DUMP_START_5P, 1,
1898                           [ is defined])
1899         ],[
1900                 AC_MSG_RESULT(no)
1901         ])
1902
1903         AC_MSG_CHECKING([if struct dcbnl_rtnl_ops has ieee_getmaxrate/ieee_setmaxrate])
1904         LB_LINUX_TRY_COMPILE([
1905                 #include <net/dcbnl.h>
1906         ],[
1907                 const struct dcbnl_rtnl_ops en_dcbnl_ops = {
1908                         .ieee_getmaxrate = NULL,
1909                         .ieee_setmaxrate = NULL,
1910                 };
1911
1912                 return 0;
1913         ],[
1914                 AC_MSG_RESULT(yes)
1915                 AC_DEFINE(HAVE_IEEE_GET_SET_MAXRATE, 1,
1916                           [ieee_getmaxrate/ieee_setmaxrate is defined])
1917         ],[
1918                 AC_MSG_RESULT(no)
1919         ])
1920
1921         AC_LANG_PUSH(C)
1922         ac_c_werror_flag=yes
1923         save_EXTRA_KCFLAGS=$EXTRA_KCFLAGS
1924         EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Werror"
1925
1926         AC_MSG_CHECKING([if bonding.h bond_for_each_slave has int for 3rd parameter])
1927         LB_LINUX_TRY_COMPILE([
1928                 #include "../drivers/net/bonding/bonding.h"
1929         ],[
1930                 struct bonding *bond = NULL;
1931                 struct slave *slave = NULL;
1932                 int iter;
1933
1934                 bond_for_each_slave(bond, slave, iter) ;
1935
1936                 return 0;
1937         ],[
1938                 AC_MSG_RESULT(yes)
1939                 AC_DEFINE(HAVE_BOND_FOR_EACH_SLAVE_3RD_PARAM_IS_INT, 1,
1940                           [bond_for_each_slave has int for 3rd parameter])
1941         ],[
1942                 AC_MSG_RESULT(no)
1943         ])
1944         EXTRA_KCFLAGS="$save_EXTRA_KCFLAGS"
1945         ac_c_werror_flag=
1946         AC_LANG_POP
1947
1948         AC_MSG_CHECKING([if netdevice.h has netdev_master_upper_dev_get_rcu])
1949         LB_LINUX_TRY_COMPILE([
1950                 #include <linux/netdevice.h>
1951         ],[
1952                 netdev_master_upper_dev_get_rcu(NULL);
1953
1954                 return 0;
1955         ],[
1956                 AC_MSG_RESULT(yes)
1957                 AC_DEFINE(HAVE_NETDEV_MASTER_UPPER_DEV_GET_RCU, 1,
1958                           [netdev_master_upper_dev_get_rcu is defined])
1959         ],[
1960                 AC_MSG_RESULT(no)
1961         ])
1962
1963         AC_MSG_CHECKING([if __vlan_find_dev_deep has 3 parameters])
1964         LB_LINUX_TRY_COMPILE([
1965                 #include <linux/if_vlan.h>
1966         ],[
1967                 __vlan_find_dev_deep(NULL, 0, 0);
1968
1969                 return 0;
1970         ],[
1971                 AC_MSG_RESULT(yes)
1972                 AC_DEFINE(HAVE__VLAN_FIND_DEV_DEEP_3P, 1,
1973                           [__vlan_find_dev_deep has 3 paramters])
1974         ],[
1975                 AC_MSG_RESULT(no)
1976         ])
1977
1978         AC_MSG_CHECKING([if sk_buff.h has __skb_alloc_page])
1979         LB_LINUX_TRY_COMPILE([
1980                 #include <linux/skbuff.h>
1981         ],[
1982                 __skb_alloc_page(0, NULL);
1983
1984                 return 0;
1985         ],[
1986                 AC_MSG_RESULT(yes)
1987                 AC_DEFINE(HAVE__SKB_ALLOC_PAGE, 1,
1988                           [sk_buff has __skb_alloc_page])
1989         ],[
1990                 AC_MSG_RESULT(no)
1991         ])
1992
1993         AC_MSG_CHECKING([if __vlan_hwaccel_put_tag has 3 parameters])
1994         LB_LINUX_TRY_COMPILE([
1995                 #include <linux/if_vlan.h>
1996         ],[
1997                 __vlan_hwaccel_put_tag(NULL, 0, 0);
1998
1999                 return 0;
2000         ],[
2001                 AC_MSG_RESULT(yes)
2002                 AC_DEFINE(HAVE__VLAN_HWACCEL_PUT_TAG_3P, 1,
2003                           [__vlan_hwaccel_put_tag has 3 paramters])
2004         ],[
2005                 AC_MSG_RESULT(no)
2006         ])
2007
2008         AC_MSG_CHECKING([if linux/mm_types.h has struct page_frag])
2009         LB_LINUX_TRY_COMPILE([
2010                 #include <linux/mm_types.h>
2011         ],[
2012                 struct page_frag frag = {0};
2013
2014                 return 0;
2015         ],[
2016                 AC_MSG_RESULT(yes)
2017                 AC_DEFINE(HAVE_MM_TYPES_PAGE_FRAG, 1,
2018                           [linux/mm_types.h has struct page_frag])
2019         ],[
2020                 AC_MSG_RESULT(no)
2021         ])
2022
2023         AC_MSG_CHECKING([if if_vlan.h has __vlan_find_dev_deep])
2024         LB_LINUX_TRY_COMPILE([
2025                 #include <linux/if_vlan.h>
2026         ],[
2027                 __vlan_find_dev_deep(NULL, 0);
2028
2029                 return 0;
2030         ],[
2031                 AC_MSG_RESULT(yes)
2032                 AC_DEFINE(HAVE___VLAN_FIND_DEV_DEEP, 1,
2033                           [__vlan_find_dev_deep is defined])
2034         ],[
2035                 AC_MSG_RESULT(no)
2036         ])
2037
2038         AC_MSG_CHECKING([if idr .h has idr_Alloc])
2039         LB_LINUX_TRY_COMPILE([
2040                 #include <linux/idr.h>
2041         ],[
2042                 idr_alloc(NULL, NULL, 0, 0, 0);
2043                 return 0;
2044         ],[
2045                 AC_MSG_RESULT(yes)
2046                 AC_DEFINE(HAVE_IDR_NEW_INTERFACE, 1,
2047                           [idr_Alloc is defined]) ],[
2048                 AC_MSG_RESULT(no)
2049         ])
2050
2051         AC_MSG_CHECKING([if completion.h has reinit_completion])
2052         LB_LINUX_TRY_COMPILE([
2053                 #include <linux/completion.h>
2054         ],[
2055                 struct completion c;
2056
2057                 reinit_completion(&c);
2058                 return 0;
2059         ],[
2060                 AC_MSG_RESULT(yes)
2061                 AC_DEFINE(HAVE_REINIT_COMPLETION, 1,
2062                           [reinit_completion is defined])
2063         ],[
2064                 AC_MSG_RESULT(no)
2065         ])
2066
2067         AC_MSG_CHECKING([if dma-mapping.h has dma_set_mask_and_coherent])
2068         LB_LINUX_TRY_COMPILE([
2069                 #include <linux/dma-mapping.h>
2070         ],[
2071                 dma_set_mask_and_coherent(NULL, 0);
2072
2073                 return 0;
2074         ],[
2075                 AC_MSG_RESULT(yes)
2076                 AC_DEFINE(HAVE_DMA_SET_MASK_AND_COHERENT, 1,
2077                           [dma_set_mask_and_coherent is defined])
2078         ],[
2079                 AC_MSG_RESULT(no)
2080         ])
2081 ])
2082 #
2083 # COMPAT_CONFIG_HEADERS
2084 #
2085 # add -include config.h
2086 #
2087 AC_DEFUN([COMPAT_CONFIG_HEADERS],[
2088         AC_CONFIG_HEADERS([config.h])
2089         EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
2090         AC_SUBST(EXTRA_KCFLAGS)
2091 ])
2092
2093 AC_DEFUN([OFA_PROG_LINUX],
2094 [
2095
2096 LB_LINUX_PATH
2097 LB_LINUX_SYMVERFILE
2098 LB_LINUX_CONFIG([MODULES],[],[
2099     AC_MSG_ERROR([module support is required to build mlnx kernel modules.])
2100 ])
2101 LB_LINUX_CONFIG([MODVERSIONS])
2102 LB_LINUX_CONFIG([KALLSYMS],[],[
2103     AC_MSG_ERROR([compat_mlnx requires that CONFIG_KALLSYMS is enabled in your kernel.])
2104 ])
2105
2106 LINUX_CONFIG_COMPAT
2107 COMPAT_CONFIG_HEADERS
2108
2109 ])