Added macros and headers to support NVME host
[compat-rdma/compat.git] / config / rdma.m4
1 dnl Examine kernel functionality
2 AC_DEFUN([LINUX_CONFIG_COMPAT],
3 [
4         AC_MSG_CHECKING([if file_system_type has mount method])
5         LB_LINUX_TRY_COMPILE([
6                 #include <linux/fs.h>
7         ],[
8                 struct file_system_type fst;
9
10                 fst.mount = NULL;
11                 return 0;
12         ],[
13                 AC_MSG_RESULT(yes)
14                 AC_DEFINE(HAVE_MOUNT_METHOD, 1,
15                           [mount method defined])
16         ],[
17                 AC_MSG_RESULT(no)
18         ])
19
20         AC_MSG_CHECKING([if kernel has get_next_ino])
21         LB_LINUX_TRY_COMPILE([
22                 #include <linux/fs.h>
23         ],[
24                 unsigned int ino;
25
26                 ino = get_next_ino();
27                 return 0;
28         ],[
29                 AC_MSG_RESULT(yes)
30                 AC_DEFINE(HAVE_GET_NEXT_INO, 1,
31                           [get_next_ino defined])
32         ],[
33                 AC_MSG_RESULT(no)
34         ])
35
36         AC_MSG_CHECKING([if kernel has ktime_get_ns])
37         LB_LINUX_TRY_COMPILE([
38                 #include <linux/ktime.h>
39         ],[
40                 unsigned long long ns;
41
42                 ns = ktime_get_ns();
43                 return 0;
44         ],[
45                 AC_MSG_RESULT(yes)
46                 AC_DEFINE(HAVE_KTIME_GET_NS, 1,
47                           [ktime_get_ns defined])
48         ],[
49                 AC_MSG_RESULT(no)
50         ])
51
52         AC_MSG_CHECKING([if kernel has ktime_get_boot_ns])
53         LB_LINUX_TRY_COMPILE([
54                 #include <linux/ktime.h>
55         ],[
56                 unsigned long long ns;
57
58                 ns = ktime_get_boot_ns();
59                 return 0;
60         ],[
61                 AC_MSG_RESULT(yes)
62                 AC_DEFINE(HAVE_KTIME_GET_BOOT_NS, 1,
63                           [ktime_get_boot_ns defined])
64         ],[
65                 AC_MSG_RESULT(no)
66         ])
67
68         AC_MSG_CHECKING([if timekeeping.h has ktime_get_real_ns])
69         LB_LINUX_TRY_COMPILE([
70                 #include <linux/ktime.h>
71                 #include <linux/timekeeping.h>
72         ],[
73                 ktime_get_real_ns();
74
75                 return 0;
76         ],[
77                 AC_MSG_RESULT(yes)
78                 AC_DEFINE(HAVE_KTIME_GET_REAL_NS, 1,
79                           [ktime_get_real_ns is defined])
80         ],[
81                 AC_MSG_RESULT(no)
82         ])
83
84         AC_MSG_CHECKING([if time.h has time64_to_tm])
85         LB_LINUX_TRY_COMPILE([
86                 #include <linux/time.h>
87         ],[
88                 struct tm tm;
89                 time64_t now = 0;
90
91                 time64_to_tm(now, 0, &tm);
92
93                 return 0;
94         ],[
95                 AC_MSG_RESULT(yes)
96                 AC_DEFINE(HAVE_TIME64_TO_TM, 1,
97                           [time64_to_tm is defined])
98         ],[
99                 AC_MSG_RESULT(no)
100         ])
101
102         AC_MSG_CHECKING([if svc_xprt_class has xcl_ident])
103         LB_LINUX_TRY_COMPILE([
104                 #include <linux/sunrpc/xprt.h>
105                 #include <linux/sunrpc/svc_xprt.h>
106         ],[
107                 struct svc_xprt_class svc_rdma_class = {
108                         .xcl_ident = XPRT_TRANSPORT_RDMA,
109                 };
110                 return 0;
111         ],[
112                 AC_MSG_RESULT(yes)
113                 AC_DEFINE(HAVE_XCL_IDENT, 1,
114                           [xcl_ident defined])
115         ],[
116                 AC_MSG_RESULT(no)
117         ])
118
119         AC_MSG_CHECKING([if struct ifla_vf_info has max_tx_rate])
120         LB_LINUX_TRY_COMPILE([
121                 #include <linux/if_link.h>
122         ],[
123                 struct ifla_vf_info *ivf;
124
125                 ivf->max_tx_rate = 0;
126                 ivf->min_tx_rate = 0;
127
128                 return 0;
129         ],[
130                 AC_MSG_RESULT(yes)
131                 AC_DEFINE(HAVE_TX_RATE_LIMIT, 1,
132                           [max_tx_rate is defined])
133         ],[
134                 AC_MSG_RESULT(no)
135         ])
136
137         AC_MSG_CHECKING([if netdev_master_upper_dev_link gets 4 parameters])
138         LB_LINUX_TRY_COMPILE([
139                 #include <linux/netdevice.h>
140         ],[
141                 netdev_master_upper_dev_link(NULL, NULL, NULL, NULL);
142
143                 return 0;
144         ],[
145                 AC_MSG_RESULT(yes)
146                 AC_DEFINE(NETDEV_MASTER_UPPER_DEV_LINK_4_PARAMS, 1,
147                           [netdev_master_upper_dev_link gets 4 parameters])
148         ],[
149                 AC_MSG_RESULT(no)
150         ])
151
152         AC_MSG_CHECKING([if struct ethtool_ops has get/set_rxfh])
153         LB_LINUX_TRY_COMPILE([
154                 #include <linux/ethtool.h>
155         ],[
156                 const struct ethtool_ops en_ethtool_ops = {
157                         .get_rxfh_key_size = NULL,
158                         .get_rxfh = NULL,
159                         .set_rxfh = NULL,
160                 };
161
162                 return 0;
163         ],[
164                 AC_MSG_RESULT(yes)
165                 AC_DEFINE(HAVE_GET_SET_RXFH, 1,
166                           [get/set_rxfh is defined])
167         ],[
168                 AC_MSG_RESULT(no)
169         ])
170
171         AC_MSG_CHECKING([if struct ethtool_ops has get_rxfh_indir_size])
172         LB_LINUX_TRY_COMPILE([
173                 #include <linux/ethtool.h>
174         ],[
175                 const struct ethtool_ops en_ethtool_ops = {
176                         .get_rxfh_indir_size = NULL,
177                 };
178
179                 return 0;
180         ],[
181                 AC_MSG_RESULT(yes)
182                 AC_DEFINE(HAVE_RXFH_INDIR_SIZE, 1,
183                         [get_rxfh_indir_size is defined])
184         ],[
185                 AC_MSG_RESULT(no)
186         ])
187
188         AC_MSG_CHECKING([if struct ethtool_ops_ext has get_rxfh_indir_size])
189         LB_LINUX_TRY_COMPILE([
190                 #include <linux/ethtool.h>
191         ],[
192                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
193                         .get_rxfh_indir_size = NULL,
194                 };
195
196                 return 0;
197         ],[
198                 AC_MSG_RESULT(yes)
199                 AC_DEFINE(HAVE_RXFH_INDIR_SIZE_EXT, 1,
200                         [get_rxfh_indir_size is defined in ethtool_ops_ext])
201         ],[
202                 AC_MSG_RESULT(no)
203         ])
204
205         AC_MSG_CHECKING([if struct ethtool_ops has get/set_rxfh_indir])
206         LB_LINUX_TRY_COMPILE([
207                 #include <linux/ethtool.h>
208
209                 int mlx4_en_get_rxfh_indir(struct net_device *d, u32 *r)
210                 {
211                         return 0;
212                 }
213         ],[
214                 struct ethtool_ops en_ethtool_ops;
215                 en_ethtool_ops.get_rxfh_indir = mlx4_en_get_rxfh_indir;
216
217                 return 0;
218         ],[
219                 AC_MSG_RESULT(yes)
220                 AC_DEFINE(HAVE_GET_SET_RXFH_INDIR, 1,
221                         [get/set_rxfh_indir is defined])
222         ],[
223                 AC_MSG_RESULT(no)
224         ])
225
226         AC_MSG_CHECKING([if struct ethtool_ops has get/set_tunable])
227         LB_LINUX_TRY_COMPILE([
228                 #include <linux/ethtool.h>
229         ],[
230                 const struct ethtool_ops en_ethtool_ops = {
231                         .get_tunable = NULL,
232                         .set_tunable = NULL,
233                 };
234
235                 return 0;
236         ],[
237                 AC_MSG_RESULT(yes)
238                 AC_DEFINE(HAVE_GET_SET_TUNABLE, 1,
239                           [get/set_tunable is defined])
240         ],[
241                 AC_MSG_RESULT(no)
242         ])
243
244         AC_MSG_CHECKING([if exist struct ethtool_ops_ext])
245         LB_LINUX_TRY_COMPILE([
246                 #include <linux/ethtool.h>
247         ],[
248                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
249                         .size = sizeof(struct ethtool_ops_ext),
250                 };
251
252                 return 0;
253         ],[
254                 AC_MSG_RESULT(yes)
255                 AC_DEFINE(HAVE_ETHTOOL_OPS_EXT, 1,
256                           [struct ethtool_ops_ext is defined])
257         ],[
258                 AC_MSG_RESULT(no)
259         ])
260
261         AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_rxfh_indir])
262         LB_LINUX_TRY_COMPILE([
263                 #include <linux/ethtool.h>
264         ],[
265                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
266                         .get_rxfh_indir = NULL,
267                         .set_rxfh_indir = NULL,
268                 };
269
270                 return 0;
271         ],[
272                 AC_MSG_RESULT(yes)
273                 AC_DEFINE(HAVE_GET_SET_RXFH_INDIR_EXT, 1,
274                           [get/set_rxfh_indir is defined])
275         ],[
276                 AC_MSG_RESULT(no)
277         ])
278
279         AC_MSG_CHECKING([if struct net_device has dev_port])
280         LB_LINUX_TRY_COMPILE([
281                 #include <linux/netdevice.h>
282         ],[
283                 struct net_device *dev = NULL;
284
285                 dev->dev_port = 0;
286
287                 return 0;
288         ],[
289                 AC_MSG_RESULT(yes)
290                 AC_DEFINE(HAVE_NET_DEVICE_DEV_PORT, 1,
291                           [dev_port is defined])
292         ],[
293                 AC_MSG_RESULT(no)
294         ])
295
296         AC_MSG_CHECKING([if netdev_extended has dev_port])
297         LB_LINUX_TRY_COMPILE([
298                 #include <linux/netdevice.h>
299         ],[
300                 struct net_device *dev = NULL;
301
302                 netdev_extended(dev)->dev_port = 0;
303
304                 return 0;
305         ],[
306                 AC_MSG_RESULT(yes)
307                 AC_DEFINE(HAVE_NETDEV_EXTENDED_DEV_PORT, 1,
308                           [ is defined])
309         ],[
310                 AC_MSG_RESULT(no)
311         ])
312
313         AC_MSG_CHECKING([if struct ptp_clock_info has n_pins])
314         LB_LINUX_TRY_COMPILE([
315                 #include <linux/ptp_clock_kernel.h>
316         ],[
317                 struct ptp_clock_info *info;
318                 info->n_pins = 0;
319
320                 return 0;
321         ],[
322                 AC_MSG_RESULT(yes)
323                 AC_DEFINE(HAVE_PTP_CLOCK_INFO_N_PINS, 1,
324                           [n_pins is defined])
325         ],[
326                 AC_MSG_RESULT(no)
327         ])
328
329         AC_MSG_CHECKING([if pci.h pci_enable_msi_exact])
330         LB_LINUX_TRY_COMPILE([
331                 #include <linux/pci.h>
332         ],[
333                 int x = pci_enable_msi_exact(NULL, 0);
334
335                 return 0;
336         ],[
337                 AC_MSG_RESULT(yes)
338                 AC_DEFINE(HAVE_PCI_ENABLE_MSI_EXACT, 1,
339                           [pci_enable_msi_exact is defined])
340         ],[
341                 AC_MSG_RESULT(no)
342         ])
343
344         AC_MSG_CHECKING([if pci.h pci_enable_msix_range])
345         LB_LINUX_TRY_COMPILE([
346                 #include <linux/pci.h>
347         ],[
348                 int x = pci_enable_msix_range(NULL, 0, 0, 0);
349
350                 return 0;
351         ],[
352                 AC_MSG_RESULT(yes)
353                 AC_DEFINE(HAVE_PCI_ENABLE_MSIX_RANGE, 1,
354                           [pci_enable_msix_range is defined])
355         ],[
356                 AC_MSG_RESULT(no)
357         ])
358
359         AC_MSG_CHECKING([if pci.h pci_msix_vec_count])
360         LB_LINUX_TRY_COMPILE([
361                 #include <linux/pci.h>
362         ],[
363                 int x = pci_msix_vec_count(NULL);
364
365                 return 0;
366         ],[
367                 AC_MSG_RESULT(yes)
368                 AC_DEFINE(HAVE_PCI_MSIX_VEC_COUNT, 1,
369                           [pci_msix_vec_count is defined])
370         ],[
371                 AC_MSG_RESULT(no)
372         ])
373
374         AC_MSG_CHECKING([if pci_dev has msix_cap])
375         LB_LINUX_TRY_COMPILE([
376                 #include <linux/pci.h>
377         ],[
378                 struct pci_dev pdev;
379                 pdev.msix_cap = 0;
380
381                 return 0;
382         ],[
383                 AC_MSG_RESULT(yes)
384                 AC_DEFINE(HAVE_PCI_MSIX_CAP, 1,
385                           [msix_cap is defined])
386         ],[
387                 AC_MSG_RESULT(no)
388         ])
389
390         AC_MSG_CHECKING([if mm_struct has pinned_vm])
391         LB_LINUX_TRY_COMPILE([
392                 #include <linux/mm_types.h>
393         ],[
394                 struct mm_types mmt;
395                 mmt.pinned_vm = 0;
396
397                 return 0;
398         ],[
399                 AC_MSG_RESULT(yes)
400                 AC_DEFINE(HAVE_PINNED_VM, 1,
401                           [pinned_vm is defined])
402         ],[
403                 AC_MSG_RESULT(no)
404         ])
405
406         AC_MSG_CHECKING([if kernel has idr_alloc])
407         LB_LINUX_TRY_COMPILE([
408                 #include <linux/idr.h>
409         ],[
410                 int x;
411                 x =  idr_alloc(NULL, NULL, 0, 0, 0);
412
413                 return 0;
414         ],[
415                 AC_MSG_RESULT(yes)
416                 AC_DEFINE(HAVE_IDR_ALLOC, 1,
417                           [idr_alloc is defined])
418         ],[
419                 AC_MSG_RESULT(no)
420         ])
421
422         AC_MSG_CHECKING([if kernel has percpu variables])
423         LB_LINUX_TRY_COMPILE([
424                 #include <linux/percpu.h>
425         ],[
426                 static DEFINE_PER_CPU(unsigned int, x);
427                 this_cpu_inc(x);
428
429                 return 0;
430         ],[
431                 AC_MSG_RESULT(yes)
432                 AC_DEFINE(HAVE_PERCPU_VARS, 1,
433                           [percpu variables are defined])
434         ],[
435                 AC_MSG_RESULT(no)
436         ])
437
438         AC_MSG_CHECKING([if struct iscsi_transport has attr_is_visible])
439         LB_LINUX_TRY_COMPILE([
440                 #include <scsi/scsi_transport_iscsi.h>
441         ],[
442                 static struct iscsi_transport iscsi_iser_transport = {
443                         .attr_is_visible = NULL,
444                 };
445
446                 return 0;
447         ],[
448                 AC_MSG_RESULT(yes)
449                 AC_DEFINE(HAVE_ISCSI_ATTR_IS_VISIBLE, 1,
450                           [attr_is_visible is defined])
451         ],[
452                 AC_MSG_RESULT(no)
453         ])
454
455         AC_MSG_CHECKING([if struct iscsi_transport has get_ep_param])
456         LB_LINUX_TRY_COMPILE([
457                 #include <scsi/scsi_transport_iscsi.h>
458         ],[
459                 static struct iscsi_transport iscsi_iser_transport = {
460                         .get_ep_param = NULL,
461                 };
462
463                 return 0;
464         ],[
465                 AC_MSG_RESULT(yes)
466                 AC_DEFINE(HAVE_ISCSI_GET_EP_PARAM, 1,
467                           [get_ep_param is defined])
468         ],[
469                 AC_MSG_RESULT(no)
470         ])
471
472         AC_MSG_CHECKING([if struct iscsi_transport has check_protection])
473         LB_LINUX_TRY_COMPILE([
474                 #include <scsi/scsi_transport_iscsi.h>
475         ],[
476                 static struct iscsi_transport iscsi_iser_transport = {
477                         .check_protection = NULL,
478                 };
479
480                 return 0;
481         ],[
482                 AC_MSG_RESULT(yes)
483                 AC_DEFINE(HAVE_ISCSI_CHECK_PROTECTION, 1,
484                           [check_protection is defined])
485         ],[
486                 AC_MSG_RESULT(no)
487         ])
488
489         AC_MSG_CHECKING([if iscsi_proto.h has struct iscsi_scsi_req])
490         LB_LINUX_TRY_COMPILE([
491                 #include <scsi/iscsi_proto.h>
492         ],[
493                 struct iscsi_scsi_req req = {
494                         .opcode = 0,
495                 };
496
497                 return 0;
498         ],[
499                 AC_MSG_RESULT(yes)
500                 AC_DEFINE(HAVE_ISCSI_SCSI_REQ, 1,
501                           [struct iscsi_scsi_req is defined])
502         ],[
503                 AC_MSG_RESULT(no)
504         ])
505
506         AC_MSG_CHECKING([if struct request_queue has request_fn_active])
507         LB_LINUX_TRY_COMPILE([
508                 #include <linux/blkdev.h>
509         ],[
510                 struct request_queue rq = {
511                         .request_fn_active = 0,
512                 };
513
514                 return 0;
515         ],[
516                 AC_MSG_RESULT(yes)
517                 AC_DEFINE(HAVE_REQUEST_QUEUE_REQUEST_FN_ACTIVE, 1,
518                           [struct request_queue has request_fn_active])
519         ],[
520                 AC_MSG_RESULT(no)
521         ])
522
523         AC_MSG_CHECKING([if netdevice.h has select_queue_fallback_t])
524         LB_LINUX_TRY_COMPILE([
525                 #include <linux/netdevice.h>
526         ],[
527                 select_queue_fallback_t fallback;
528
529                 fallback = NULL;
530
531                 return 0;
532         ],[
533                 AC_MSG_RESULT(yes)
534                 AC_DEFINE(HAVE_SELECT_QUEUE_FALLBACK_T, 1,
535                           [select_queue_fallback_t is defined])
536         ],[
537                 AC_MSG_RESULT(no)
538         ])
539
540         AC_MSG_CHECKING([if netdevice.h has skb_set_hash])
541         LB_LINUX_TRY_COMPILE([
542                 #include <linux/netdevice.h>
543         ],[
544                 skb_set_hash(NULL, 0, PKT_HASH_TYPE_L3);
545
546                 return 0;
547         ],[
548                 AC_MSG_RESULT(yes)
549                 AC_DEFINE(HAVE_SKB_SET_HASH, 1,
550                           [skb_set_hash is defined])
551         ],[
552                 AC_MSG_RESULT(no)
553         ])
554
555         AC_MSG_CHECKING([if netdevice.h has alloc_netdev with 4 params])
556         LB_LINUX_TRY_COMPILE([
557                 #include <linux/netdevice.h>
558         ],[
559                 struct net_device *dev;
560
561                 dev = alloc_netdev(0, NULL, 0, NULL);
562
563                 return 0;
564         ],[
565                 AC_MSG_RESULT(yes)
566                 AC_DEFINE(HAVE_ALLOC_NETDEV_4P, 1,
567                           [alloc_netdev has 4 parameters])
568         ],[
569                 AC_MSG_RESULT(no)
570         ])
571
572         AC_MSG_CHECKING([if sockios.h has SIOCGHWTSTAMP])
573         LB_LINUX_TRY_COMPILE([
574                 #include <linux/sockios.h>
575         ],[
576                 int x = SIOCGHWTSTAMP;
577
578                 return 0;
579         ],[
580                 AC_MSG_RESULT(yes)
581                 AC_DEFINE(HAVE_SIOCGHWTSTAMP, 1,
582                           [SIOCGHWTSTAMP is defined])
583         ],[
584                 AC_MSG_RESULT(no)
585         ])
586
587         AC_MSG_CHECKING([if ip.h inet_get_local_port_range has 3 parameters])
588         LB_LINUX_TRY_COMPILE([
589                 #include <net/ip.h>
590         ],[
591                 inet_get_local_port_range(NULL, NULL, NULL);
592
593                 return 0;
594         ],[
595                 AC_MSG_RESULT(yes)
596                 AC_DEFINE(HAVE_INET_GET_LOCAL_PORT_RANGE_3_PARAMS, 1,
597                           [inet_get_local_port_range has 3 parameters])
598         ],[
599                 AC_MSG_RESULT(no)
600         ])
601
602         AC_MSG_CHECKING([if net.h has net_get_random_once])
603         LB_LINUX_TRY_COMPILE([
604                 #include <linux/net.h>
605         ],[
606                 net_get_random_once(NULL, 0);
607
608                 return 0;
609         ],[
610                 AC_MSG_RESULT(yes)
611                 AC_DEFINE(HAVE_NET_GET_RANDOM_ONCE, 1,
612                           [net_get_random_once is defined])
613         ],[
614                 AC_MSG_RESULT(no)
615         ])
616
617         AC_MSG_CHECKING([if inet_sock.h has __inet_ehashfn])
618         LB_LINUX_TRY_COMPILE([
619                 #include <net/inet_sock.h>
620         ],[
621                 __inet_ehashfn(0, 0, 0, 0, 0);
622
623                 return 0;
624         ],[
625                 AC_MSG_RESULT(yes)
626                 AC_DEFINE(HAVE_INET_EHASHFN, 1,
627                           [__inet_ehashfn is defined])
628         ],[
629                 AC_MSG_RESULT(no)
630         ])
631
632         AC_MSG_CHECKING([if err.h has PTR_ERR_OR_ZERO])
633         LB_LINUX_TRY_COMPILE([
634                 #include <linux/err.h>
635         ],[
636                 int x = PTR_ERR_OR_ZERO(NULL);
637
638                 return 0;
639         ],[
640                 AC_MSG_RESULT(yes)
641                 AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
642                           [PTR_ERR_OR_ZERO is defined])
643         ],[
644                 AC_MSG_RESULT(no)
645         ])
646
647         AC_MSG_CHECKING([if struct iscsi_session has discovery_sess])
648         LB_LINUX_TRY_COMPILE([
649                 #include <scsi/libiscsi.h>
650         ],[
651                 struct iscsi_session session;
652                 session.discovery_sess = 0;
653
654                 return 0;
655         ],[
656                 AC_MSG_RESULT(yes)
657                 AC_DEFINE(HAVE_ISCSI_DISCOVERY_SESS, 1,
658                           [discovery_sess is defined])
659         ],[
660                 AC_MSG_RESULT(no)
661         ])
662
663         AC_MSG_CHECKING([if enum iscsi_param has ISCSI_PARAM_DISCOVERY_SESS])
664         LB_LINUX_TRY_COMPILE([
665                 #include <scsi/iscsi_if.h>
666         ],[
667                 int x = ISCSI_PARAM_DISCOVERY_SESS;
668
669                 return 0;
670         ],[
671                 AC_MSG_RESULT(yes)
672                 AC_DEFINE(HAVE_ISCSI_PARAM_DISCOVERY_SESS, 1,
673                           [ISCSI_PARAM_DISCOVERY_SESS is defined])
674         ],[
675                 AC_MSG_RESULT(no)
676         ])
677
678         AC_MSG_CHECKING([if pci.h has enum pcie_link_width])
679         LB_LINUX_TRY_COMPILE([
680                 #include <linux/pci.h>
681                 #include <linux/pci_hotplug.h>
682         ],[
683                 enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
684
685                 return 0;
686         ],[
687                 AC_MSG_RESULT(yes)
688                 AC_DEFINE(HAVE_PCIE_LINK_WIDTH, 1,
689                           [pcie_link_width is defined])
690         ],[
691                 AC_MSG_RESULT(no)
692         ])
693
694         AC_MSG_CHECKING([if pci.h has enum pci_bus_speed])
695         LB_LINUX_TRY_COMPILE([
696                 #include <linux/pci.h>
697                 #include <linux/pci_hotplug.h>
698         ],[
699                 enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
700
701                 return speed;
702         ],[
703                 AC_MSG_RESULT(yes)
704                 AC_DEFINE(HAVE_PCI_BUS_SPEED, 1,
705                           [pci_bus_speed is defined])
706         ],[
707                 AC_MSG_RESULT(no)
708         ])
709
710         AC_MSG_CHECKING([if netdevice.h has struct netdev_phys_port_id])
711         LB_LINUX_TRY_COMPILE([
712                 #include <linux/netdevice.h>
713         ],[
714                 struct netdev_phys_port_id *x = NULL;
715
716                 return 0;
717         ],[
718                 AC_MSG_RESULT(yes)
719                 AC_DEFINE(HAVE_NETDEV_PHYS_PORT_ID, 1,
720                           [netdev_phys_port_id is defined])
721         ],[
722                 AC_MSG_RESULT(no)
723         ])
724
725         AC_MSG_CHECKING([if struct ifla_vf_info has linkstate])
726         LB_LINUX_TRY_COMPILE([
727                 #include <linux/if_link.h>
728         ],[
729                 struct ifla_vf_info *x;
730                 x->linkstate = 0;
731
732                 return 0;
733         ],[
734                 AC_MSG_RESULT(yes)
735                 AC_DEFINE(HAVE_LINKSTATE, 1,
736                           [linkstate is defined])
737         ],[
738                 AC_MSG_RESULT(no)
739         ])
740
741         AC_MSG_CHECKING([if busy_poll.h has skb_mark_napi_id])
742         LB_LINUX_TRY_COMPILE([
743                 #include <net/busy_poll.h>
744         ],[
745                 skb_mark_napi_id(NULL, NULL);
746
747                 return 0;
748         ],[
749                 AC_MSG_RESULT(yes)
750                 AC_DEFINE(HAVE_SKB_MARK_NAPI_ID, 1,
751                           [skb_mark_napi_id is defined])
752         ],[
753                 AC_MSG_RESULT(no)
754         ])
755
756         AC_MSG_CHECKING([if netdevice.h has napi_hash_add])
757         LB_LINUX_TRY_COMPILE([
758                 #include <linux/netdevice.h>
759         ],[
760                 napi_hash_add(NULL);
761
762                 return 0;
763         ],[
764                 AC_MSG_RESULT(yes)
765                 AC_DEFINE(HAVE_NAPI_HASH_ADD, 1,
766                           [napi_hash_add is defined])
767         ],[
768                 AC_MSG_RESULT(no)
769         ])
770
771         AC_MSG_CHECKING([if netdevice.h has netif_keep_dst])
772         LB_LINUX_TRY_COMPILE([
773                 #include <linux/netdevice.h>
774         ],[
775                 netif_keep_dst(NULL);
776
777                 return 0;
778         ],[
779                 AC_MSG_RESULT(yes)
780                 AC_DEFINE(HAVE_NETIF_KEEP_DST, 1,
781                           [netif_keep_dst is defined])
782         ],[
783                 AC_MSG_RESULT(no)
784         ])
785
786         AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any])
787         LB_LINUX_TRY_COMPILE([
788                 #include <linux/netdevice.h>
789         ],[
790                 dev_consume_skb_any(NULL);
791
792                 return 0;
793         ],[
794                 AC_MSG_RESULT(yes)
795                 AC_DEFINE(HAVE_DEV_CONSUME_SKB_ANY, 1,
796                           [dev_consume_skb_any is defined])
797         ],[
798                 AC_MSG_RESULT(no)
799         ])
800
801         AC_MSG_CHECKING([if netdevice.h has __dev_uc_sync])
802         LB_LINUX_TRY_COMPILE([
803                 #include <linux/netdevice.h>
804         ],[
805                 __dev_uc_sync(NULL, NULL, NULL);
806
807                 return 0;
808         ],[
809                 AC_MSG_RESULT(yes)
810                 AC_DEFINE(HAVE___DEV_UC_SYNC, 1,
811                           [__dev_uc_sync is defined])
812         ],[
813                 AC_MSG_RESULT(no)
814         ])
815
816         AC_MSG_CHECKING([if netdevice.h has __dev_mc_sync])
817         LB_LINUX_TRY_COMPILE([
818                 #include <linux/netdevice.h>
819         ],[
820                 __dev_mc_sync(NULL, NULL, NULL);
821
822                 return 0;
823         ],[
824                 AC_MSG_RESULT(yes)
825                 AC_DEFINE(HAVE___DEV_MC_SYNC, 1,
826                           [__dev_mc_sync is defined])
827         ],[
828                 AC_MSG_RESULT(no)
829         ])
830
831         AC_MSG_CHECKING([if netdevice.h has netdev_txq_bql_complete_prefetchw])
832         LB_LINUX_TRY_COMPILE([
833                 #include <linux/netdevice.h>
834         ],[
835                 netdev_txq_bql_complete_prefetchw(NULL);
836                 netdev_txq_bql_enqueue_prefetchw(NULL);
837
838                 return 0;
839         ],[
840                 AC_MSG_RESULT(yes)
841                 AC_DEFINE(HAVE_NETDEV_TXQ_BQL_PREFETCHW, 1,
842                           [netdev_txq_bql_complete_prefetchw is defined])
843         ],[
844                 AC_MSG_RESULT(no)
845         ])
846
847         AC_MSG_CHECKING([if struct sk_buff has xmit_more])
848         LB_LINUX_TRY_COMPILE([
849                 #include <linux/skbuff.h>
850         ],[
851                 struct sk_buff *skb;
852                 skb->xmit_more = 0;
853
854                 return 0;
855         ],[
856                 AC_MSG_RESULT(yes)
857                 AC_DEFINE(HAVE_SK_BUFF_XMIT_MORE, 1,
858                           [xmit_more is defined])
859         ],[
860                 AC_MSG_RESULT(no)
861         ])
862
863         AC_MSG_CHECKING([if struct sk_buff has encapsulation])
864         LB_LINUX_TRY_COMPILE([
865                 #include <linux/skbuff.h>
866         ],[
867                 struct sk_buff *skb;
868                 skb->encapsulation = 0;
869
870                 return 0;
871         ],[
872                 AC_MSG_RESULT(yes)
873                 AC_DEFINE(HAVE_SK_BUFF_ENCAPSULATION, 1,
874                           [encapsulation is defined])
875         ],[
876                 AC_MSG_RESULT(no)
877         ])
878
879         AC_MSG_CHECKING([if etherdevice.h has eth_get_headlen])
880         LB_LINUX_TRY_COMPILE([
881                 #include <linux/etherdevice.h>
882         ],[
883                 eth_get_headlen(NULL, 0);
884
885                 return 0;
886         ],[
887                 AC_MSG_RESULT(yes)
888                 AC_DEFINE(HAVE_ETH_GET_HEADLEN, 1,
889                           [eth_get_headlen is defined])
890         ],[
891                 AC_MSG_RESULT(no)
892         ])
893
894         AC_MSG_CHECKING([if struct sk_buff has csum_level])
895         LB_LINUX_TRY_COMPILE([
896                 #include <linux/skbuff.h>
897         ],[
898                 struct sk_buff *skb;
899                 skb->csum_level = 0;
900
901                 return 0;
902         ],[
903                 AC_MSG_RESULT(yes)
904                 AC_DEFINE(HAVE_SK_BUFF_CSUM_LEVEL, 1,
905                           [csum_level is defined])
906         ],[
907                 AC_MSG_RESULT(no)
908         ])
909
910         AC_MSG_CHECKING([if struct skbuff.h has skb_inner_transport_header])
911         LB_LINUX_TRY_COMPILE([
912                 #include <linux/skbuff.h>
913         ],[
914                 skb_inner_transport_header(NULL);
915
916                 return 0;
917         ],[
918                 AC_MSG_RESULT(yes)
919                 AC_DEFINE(HAVE_SKB_INNER_TRANSPORT_HEADER, 1,
920                           [skb_inner_transport_header is defined])
921         ],[
922                 AC_MSG_RESULT(no)
923         ])
924
925         AC_MSG_CHECKING([if struct skbuff.h has skb_inner_network_header])
926         LB_LINUX_TRY_COMPILE([
927                 #include <linux/skbuff.h>
928         ],[
929                 skb_inner_network_header(NULL);
930
931                 return 0;
932         ],[
933                 AC_MSG_RESULT(yes)
934                 AC_DEFINE(HAVE_SKB_INNER_NETWORK_HEADER, 1,
935                           [skb_inner_network_header is defined])
936         ],[
937                 AC_MSG_RESULT(no)
938         ])
939
940         AC_MSG_CHECKING([if if_vlan.h has vlan_dev_get_egress_qos_mask])
941         LB_LINUX_TRY_COMPILE([
942                 #include <linux/if_vlan.h>
943         ],[
944                 vlan_dev_get_egress_qos_mask(NULL, 0);
945
946                 return 0;
947         ],[
948                 AC_MSG_RESULT(yes)
949                 AC_DEFINE(HAVE_VLAN_DEV_GET_EGRESS_QOS_MASK, 1,
950                           [vlan_dev_get_egress_qos_mask is defined])
951         ],[
952                 AC_MSG_RESULT(no)
953         ])
954
955         AC_MSG_CHECKING([if netdevice.h has netdev_get_prio_tc_map])
956         LB_LINUX_TRY_COMPILE([
957                 #include <linux/netdevice.h>
958         ],[
959                 netdev_get_prio_tc_map(NULL, 0);
960
961                 return 0;
962         ],[
963                 AC_MSG_RESULT(yes)
964                 AC_DEFINE(HAVE_NETDEV_GET_PRIO_TC_MAP, 1,
965                           [netdev_get_prio_tc_map is defined])
966         ],[
967                 AC_MSG_RESULT(no)
968         ])
969
970         AC_MSG_CHECKING([if if_vlan.h has __vlan_find_dev_deep_rcu])
971         LB_LINUX_TRY_COMPILE([
972                 #include <linux/if_vlan.h>
973         ],[
974                 __vlan_find_dev_deep_rcu(NULL, 0, 0);
975
976                 return 0;
977         ],[
978                 AC_MSG_RESULT(yes)
979                 AC_DEFINE(HAVE___VLAN_FIND_DEV_DEEP_RCU, 1,
980                           [__vlan_find_dev_deep_rcu is defined])
981         ],[
982                 AC_MSG_RESULT(no)
983         ])
984
985         AC_MSG_CHECKING([if ndo_select_queue has accel_priv])
986         LB_LINUX_TRY_COMPILE([
987                 #include <linux/netdevice.h>
988
989                 static u16 select_queue(struct net_device *dev, struct sk_buff *skb,
990                                         void *accel_priv)
991                 {
992                         return 0;
993                 }
994         ],[
995                 struct net_device_opts ndops;
996
997                 ndops.ndo_select_queue = select_queue;
998
999                 return 0;
1000         ],[
1001                 AC_MSG_RESULT(yes)
1002                 AC_DEFINE(NDO_SELECT_QUEUE_HAS_ACCEL_PRIV, 1,
1003                           [ndo_select_queue has accel_priv])
1004         ],[
1005                 AC_MSG_RESULT(no)
1006         ])
1007
1008         AC_MSG_CHECKING([if include/net/bonding.h exists])
1009         LB_LINUX_TRY_COMPILE([
1010                 #include <net/bonding.h>
1011         ],[
1012                 return 0;
1013         ],[
1014                 AC_MSG_RESULT(yes)
1015                 AC_DEFINE(HAVE_BONDING_H, 1,
1016                           [include/net/bonding.h exists])
1017         ],[
1018                 AC_MSG_RESULT(no)
1019         ])
1020
1021         AC_MSG_CHECKING([if bonding.h bond_for_each_slave has 3 parameters])
1022         LB_LINUX_TRY_COMPILE([
1023                 #include <net/bonding.h>
1024         ],[
1025                 struct bonding *bond = NULL;
1026                 struct list_head *iter = NULL;
1027                 struct slave *slave = NULL;
1028
1029                 bond_for_each_slave(bond, slave, iter) ;
1030
1031                 return 0;
1032         ],[
1033                 AC_MSG_RESULT(yes)
1034                 AC_DEFINE(HAVE_BOND_FOR_EACH_SLAVE_3_PARAMS, 1,
1035                           [bond_for_each_slave has 3 parameters])
1036         ],[
1037                 AC_MSG_RESULT(no)
1038         ])
1039
1040
1041         AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_init])
1042         LB_LINUX_TRY_COMPILE([
1043                 #include <linux/u64_stats_sync.h>
1044         ],[
1045                 struct u64_stats_sync sync;
1046                 u64_stats_init(&sync);
1047
1048                 return 0;
1049         ],[
1050                 AC_MSG_RESULT(yes)
1051                 AC_DEFINE(HAVE_U64_STATS_SYNC, 1,
1052                           [u64_stats_sync is defined])
1053         ],[
1054                 AC_MSG_RESULT(no)
1055         ])
1056
1057         AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_fetch_begin_irq])
1058         LB_LINUX_TRY_COMPILE([
1059                 #include <linux/u64_stats_sync.h>
1060         ],[
1061                 struct u64_stats_sync sync;
1062                 u64_stats_fetch_begin_irq(&sync);
1063
1064                 return 0;
1065         ],[
1066                 AC_MSG_RESULT(yes)
1067                 AC_DEFINE(HAVE_U64_STATS_FETCH_BEGIN_IRQ, 1,
1068                           [u64_stats_fetch_begin_irq is defined])
1069         ],[
1070                 AC_MSG_RESULT(no)
1071         ])
1072         AC_MSG_CHECKING([if etherdevice.h has ether_addr_copy])
1073         LB_LINUX_TRY_COMPILE([
1074                 #include <linux/etherdevice.h>
1075         ],[
1076                 char dest[6], src[6];
1077                 ether_addr_copy(&dest, &src);
1078
1079                 return 0;
1080         ],[
1081                 AC_MSG_RESULT(yes)
1082                 AC_DEFINE(HAVE_ETHER_ADDR_COPY, 1,
1083                           [ether_addr_copy is defined])
1084         ],[
1085                 AC_MSG_RESULT(no)
1086         ])
1087
1088         AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_vf_rate])
1089         LB_LINUX_TRY_COMPILE([
1090                 #include <linux/netdevice.h>
1091
1092                 int set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
1093                                                    int max_tx_rate)
1094                 {
1095                         return 0;
1096                 }
1097         ],[
1098                 struct net_device_ops netdev_ops;
1099
1100                 netdev_ops.ndo_set_vf_rate = set_vf_rate;
1101                 return 0;
1102         ],[
1103                 AC_MSG_RESULT(yes)
1104                 AC_DEFINE(HAVE_SET_VF_RATE, 1,
1105                           [ndo_set_vf_rate is defined])
1106         ],[
1107                 AC_MSG_RESULT(no)
1108         ])
1109
1110         AC_MSG_CHECKING([if netdev_extended has hw_features])
1111         LB_LINUX_TRY_COMPILE([
1112                 #include <linux/netdevice.h>
1113         ],[
1114                 struct net_device *dev = NULL;
1115
1116                 netdev_extended(dev)->hw_features = 0;
1117
1118                 return 0;
1119         ],[
1120                 AC_MSG_RESULT(yes)
1121                 AC_DEFINE(HAVE_NETDEV_EXTENDED_HW_FEATURES, 1,
1122                           [ is defined])
1123         ],[
1124                 AC_MSG_RESULT(no)
1125         ])
1126
1127         AC_MSG_CHECKING([if net_device_extended has _tx_ext])
1128         LB_LINUX_TRY_COMPILE([
1129                 #include <linux/netdevice.h>
1130         ],[
1131                 struct net_device *dev = NULL;
1132
1133                 netdev_extended(dev)->_tx_ext = NULL;
1134
1135                 return 0;
1136         ],[
1137                 AC_MSG_RESULT(yes)
1138                 AC_DEFINE(HAVE_NET_DEVICE_EXTENDED_TX_EXT, 1,
1139                           [ is defined])
1140         ],[
1141                 AC_MSG_RESULT(no)
1142         ])
1143
1144         AC_MSG_CHECKING([if net_device_extended has ndo_busy_poll])
1145         LB_LINUX_TRY_COMPILE([
1146                 #include <linux/netdevice.h>
1147
1148                 int busy_poll(struct napi_struct *napi)
1149                 {
1150                         return 0;
1151                 }
1152         ],[
1153                 struct net_device *dev = NULL;
1154
1155                 netdev_extended(dev)->ndo_busy_poll = busy_poll;
1156
1157                 return 0;
1158         ],[
1159                 AC_MSG_RESULT(yes)
1160                 AC_DEFINE(HAVE_NETDEV_EXTENDED_NDO_BUSY_POLL, 1,
1161                           [ is defined])
1162         ],[
1163                 AC_MSG_RESULT(no)
1164         ])
1165
1166         AC_MSG_CHECKING([if netdevice.h has set_netdev_hw_features])
1167         LB_LINUX_TRY_COMPILE([
1168                 #include <linux/netdevice.h>
1169         ],[
1170                 struct net_device *dev = NULL;
1171
1172                 set_netdev_hw_features(dev, 0);
1173
1174                 return 0;
1175         ],[
1176                 AC_MSG_RESULT(yes)
1177                 AC_DEFINE(HAVE_SET_NETDEV_HW_FEATURES, 1,
1178                           [ is defined])
1179         ],[
1180                 AC_MSG_RESULT(no)
1181         ])
1182
1183         AC_MSG_CHECKING([if netdevice.h has netif_set_xps_queue])
1184         LB_LINUX_TRY_COMPILE([
1185                 #include <linux/netdevice.h>
1186         ],[
1187                 struct net_device *dev = NULL;
1188
1189                 netif_set_xps_queue(dev, NULL, 0);
1190
1191                 return 0;
1192         ],[
1193                 AC_MSG_RESULT(yes)
1194                 AC_DEFINE(HAVE_NETIF_SET_XPS_QUEUE, 1,
1195                           [ is defined])
1196         ],[
1197                 AC_MSG_RESULT(no)
1198         ])
1199
1200
1201         AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_features])
1202         LB_LINUX_TRY_COMPILE([
1203                 #include <linux/netdevice.h>
1204
1205                 int set_features(struct net_device *dev, netdev_features_t features)
1206                 {
1207                         return 0;
1208                 }
1209         ],[
1210                 struct net_device_ops netdev_ops;
1211
1212                 netdev_ops.ndo_set_features = set_features;
1213                 return 0;
1214         ],[
1215                 AC_MSG_RESULT(yes)
1216                 AC_DEFINE(HAVE_NDO_SET_FEATURES, 1,
1217                           [ndo_set_features is defined])
1218         ],[
1219                 AC_MSG_RESULT(no)
1220         ])
1221
1222         AC_MSG_CHECKING([if struct net_device_ops has *ndo_rx_flow_steer])
1223         LB_LINUX_TRY_COMPILE([
1224                 #include <linux/netdevice.h>
1225
1226                 int rx_flow_steer(struct net_device *dev,
1227                                                      const struct sk_buff *skb,
1228                                                      u16 rxq_index,
1229                                                      u32 flow_id)
1230                 {
1231                         return 0;
1232                 }
1233         ],[
1234                 struct net_device_ops netdev_ops;
1235
1236                 netdev_ops.ndo_rx_flow_steer = rx_flow_steer;
1237                 return 0;
1238         ],[
1239                 AC_MSG_RESULT(yes)
1240                 AC_DEFINE(HAVE_NDO_RX_FLOW_STEER, 1,
1241                           [ndo_rx_flow_steer is defined])
1242         ],[
1243                 AC_MSG_RESULT(no)
1244         ])
1245
1246         AC_MSG_CHECKING([if struct net_device has priv_flags])
1247         LB_LINUX_TRY_COMPILE([
1248                 #include <linux/netdevice.h>
1249         ],[
1250                 struct net_device *netdev;
1251                 netdev->priv_flags = 0;
1252
1253                 return 0;
1254         ],[
1255                 AC_MSG_RESULT(yes)
1256                 AC_DEFINE(HAVE_NET_DEVICE_PRIV_FLAGS, 1,
1257                           [priv_flags is defined])
1258         ],[
1259                 AC_MSG_RESULT(no)
1260         ])
1261
1262         AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_stats64])
1263         LB_LINUX_TRY_COMPILE([
1264                 #include <linux/netdevice.h>
1265
1266                 struct rtnl_link_stats64* get_stats_64(struct net_device *dev,
1267                                                      struct rtnl_link_stats64 *storage)
1268                 {
1269                         struct rtnl_link_stats64 stats_64;
1270                         return &stats_64;
1271                 }
1272         ],[
1273                 struct net_device_ops netdev_ops;
1274
1275                 netdev_ops.ndo_get_stats64 = get_stats_64;
1276
1277                 return 0;
1278         ],[
1279                 AC_MSG_RESULT(yes)
1280                 AC_DEFINE(HAVE_NDO_GET_STATS64, 1,
1281                           [ndo_get_stats64 is defined])
1282         ],[
1283                 AC_MSG_RESULT(no)
1284         ])
1285         AC_MSG_CHECKING([if struct net_device_ops has ndo_bridge_set/getlink])
1286         LB_LINUX_TRY_COMPILE([
1287                 #include <linux/netdevice.h>
1288         ],[
1289                 struct net_device_ops netdev_ops =  {
1290                         .ndo_bridge_setlink = NULL,
1291                         .ndo_bridge_getlink = NULL,
1292                 };
1293
1294                 return 0;
1295         ],[
1296                 AC_MSG_RESULT(yes)
1297                 AC_DEFINE(HAVE_NDO_BRIDGE_SET_GET_LINK, 1,
1298                           [ndo_bridge_set/getlink is defined])
1299         ],[
1300                 AC_MSG_RESULT(no)
1301         ])
1302
1303         AC_MSG_CHECKING([if rtnetlink.h ndo_dflt_bridge_getlink has 7 params])
1304         LB_LINUX_TRY_COMPILE([
1305                 #include <linux/rtnetlink.h>
1306         ],[
1307                 ndo_dflt_bridge_getlink(NULL, 0, 0, NULL, 0, 0, 0);
1308
1309                 return 0;
1310         ],[
1311                 AC_MSG_RESULT(yes)
1312                 AC_DEFINE(HAVE_NDO_DFLT_BRIDGE_GETLINK_7_PARAMS, 1,
1313                         [ ndo_dflt_bridge_getlink with 7 params is defined])
1314         ],[
1315                 AC_MSG_RESULT(no)
1316         ])
1317
1318         AC_MSG_CHECKING([if struct net_device_ops ndo_vlan_rx_add_vid has 3 parameters ])
1319         LB_LINUX_TRY_COMPILE([
1320                 #include <linux/netdevice.h>
1321
1322         ],[
1323                 int vlan_rx_add_vid(struct net_device *dev,__be16 proto, u16 vid)
1324                 {
1325                         return 0;
1326                 }
1327                 struct net_device_ops netdev_ops;
1328
1329                 netdev_ops.ndo_vlan_rx_add_vid = vlan_rx_add_vid;
1330                 netdev_ops.ndo_vlan_rx_add_vid (NULL, 1, 1) ;
1331
1332                 return 0;
1333         ],[
1334                 AC_MSG_RESULT(yes)
1335                 AC_DEFINE(HAVE_NDO_RX_ADD_VID_HAS_3_PARAMS, 1,
1336                           [ndo_vlan_rx_add_vid has 3 parameters])
1337         ],[
1338                 AC_MSG_RESULT(no)
1339         ])
1340
1341         AC_MSG_CHECKING([if net_device_ops has ndo_get_phys_port_id])
1342         LB_LINUX_TRY_COMPILE([
1343                 #include <linux/netdevice.h>
1344
1345                 int get_phys_port_id(struct net_device *dev,
1346                                      struct netdev_phys_port_id *ppid)
1347                 {
1348                         return 0;
1349                 }
1350         ],[
1351                 struct net_device_ops netdev_ops;
1352
1353                 netdev_ops.ndo_get_phys_port_id = get_phys_port_id;
1354
1355                 return 0;
1356         ],[
1357                 AC_MSG_RESULT(yes)
1358                 AC_DEFINE(HAVE_NETDEV_NDO_GET_PHYS_PORT_ID, 1,
1359                           [ is defined])
1360         ],[
1361                 AC_MSG_RESULT(no)
1362         ])
1363
1364         AC_MSG_CHECKING([if struct net_device_ops_ext exist])
1365         LB_LINUX_TRY_COMPILE([
1366                 #include <linux/netdevice.h>
1367         ],[
1368                 struct net_device_ops_ext netdev_ops_ext = {
1369                         .size = sizeof(struct net_device_ops_ext),
1370                 };
1371
1372                 return 0;
1373         ],[
1374                 AC_MSG_RESULT(yes)
1375                 AC_DEFINE(HAVE_NET_DEVICE_OPS_EXT, 1,
1376                           [struct net_device_ops_ext is defined])
1377         ],[
1378                 AC_MSG_RESULT(no)
1379         ])
1380
1381         AC_MSG_CHECKING([if struct net_device_ops_extended exist])
1382         LB_LINUX_TRY_COMPILE([
1383                 #include <linux/netdevice.h>
1384         ],[
1385                 struct net_device_ops_extended ops_extended;
1386
1387                 return 0;
1388         ],[
1389                 AC_MSG_RESULT(yes)
1390                 AC_DEFINE(HAVE_NET_DEVICE_OPS_EXTENDED, 1,
1391                           [struct net_device_ops_extended is defined])
1392         ],[
1393                 AC_MSG_RESULT(no)
1394         ])
1395
1396         AC_MSG_CHECKING([if net_device_ops_ext has ndo_get_phys_port_id])
1397         LB_LINUX_TRY_COMPILE([
1398                 #include <linux/netdevice.h>
1399
1400                 int get_phys_port_id(struct net_device *dev,
1401                                      struct netdev_phys_port_id *ppid)
1402                 {
1403                         return 0;
1404                 }
1405         ],[
1406                 struct net_device_ops_ext netdev_ops_ext;
1407
1408                 netdev_ops_ext.ndo_get_phys_port_id = get_phys_port_id;
1409
1410                 return 0;
1411         ],[
1412                 AC_MSG_RESULT(yes)
1413                 AC_DEFINE(HAVE_NETDEV_EXT_NDO_GET_PHYS_PORT_ID, 1,
1414                           [ndo_get_phys_port_id is defined])
1415         ],[
1416                 AC_MSG_RESULT(no)
1417         ])
1418
1419         AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_spoofchk])
1420         LB_LINUX_TRY_COMPILE([
1421                 #include <linux/netdevice.h>
1422
1423                 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1424                 {
1425                         return 0;
1426                 }
1427         ],[
1428                 struct net_device_ops netdev_ops;
1429
1430                 netdev_ops.ndo_set_vf_spoofchk = set_vf_spoofchk;
1431
1432                 return 0;
1433         ],[
1434                 AC_MSG_RESULT(yes)
1435                 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_SPOOFCHK, 1,
1436                           [ndo_set_vf_spoofchk is defined in net_device_ops])
1437         ],[
1438                 AC_MSG_RESULT(no)
1439         ])
1440
1441         AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_spoofchk])
1442         LB_LINUX_TRY_COMPILE([
1443                 #include <linux/netdevice.h>
1444
1445                 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1446                 {
1447                         return 0;
1448                 }
1449         ],[
1450                 struct net_device_ops_ext netdev_ops_ext;
1451
1452                 netdev_ops_ext.ndo_set_vf_spoofchk = set_vf_spoofchk;
1453
1454                 return 0;
1455         ],[
1456                 AC_MSG_RESULT(yes)
1457                 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_SPOOFCHK, 1,
1458                           [ndo_set_vf_spoofchk is defined in net_device_ops_ext])
1459         ],[
1460                 AC_MSG_RESULT(no)
1461         ])
1462
1463         AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_link_state])
1464         LB_LINUX_TRY_COMPILE([
1465                 #include <linux/netdevice.h>
1466
1467                 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1468                 {
1469                         return 0;
1470                 }
1471         ],[
1472                 struct net_device_ops netdev_ops;
1473
1474                 netdev_ops.ndo_set_vf_link_state = set_vf_link_state;
1475
1476                 return 0;
1477         ],[
1478                 AC_MSG_RESULT(yes)
1479                 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_LINK_STATE, 1,
1480                           [ndo_set_vf_link_state is defined in net_device_ops])
1481         ],[
1482                 AC_MSG_RESULT(no)
1483         ])
1484
1485         AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_link_state])
1486         LB_LINUX_TRY_COMPILE([
1487                 #include <linux/netdevice.h>
1488
1489                 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1490                 {
1491                         return 0;
1492                 }
1493         ],[
1494                 struct net_device_ops_ext netdev_ops_ext;
1495
1496                 netdev_ops_ext.ndo_set_vf_link_state = set_vf_link_state;
1497
1498                 return 0;
1499         ],[
1500                 AC_MSG_RESULT(yes)
1501                 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_LINK_STATE, 1,
1502                           [ndo_set_vf_link_state is defined])
1503         ],[
1504                 AC_MSG_RESULT(no)
1505         ])
1506
1507
1508         AC_MSG_CHECKING([if netdevice.h netif_set_real_num_tx_queues returns int])
1509         LB_LINUX_TRY_COMPILE([
1510                 #include <linux/netdevice.h>
1511         ],[
1512                 struct net_device dev;
1513                 int ret;
1514                 ret = netif_set_real_num_tx_queues(&dev, 2);
1515                 return 0;
1516         ],[
1517                 AC_MSG_RESULT(yes)
1518                 AC_DEFINE(HAVE_RETURN_INT_FOR_SET_NUM_TX_QUEUES, 1,
1519                           [netif_set_real_num_tx_queues returns int])
1520         ],[
1521                 AC_MSG_RESULT(no)
1522         ])
1523
1524         AC_MSG_CHECKING([if struct netdevice.h has struct xps_map])
1525         LB_LINUX_TRY_COMPILE([
1526                 #include <linux/netdevice.h>
1527         ],[
1528                 struct xps_map map;
1529                 map.len = 0;
1530
1531                 return 0;
1532         ],[
1533                 AC_MSG_RESULT(yes)
1534                 AC_DEFINE(HAVE_XPS_MAP, 1,
1535                           [struct xps_map is defined])
1536         ],[
1537                 AC_MSG_RESULT(no)
1538         ])
1539
1540         AC_MSG_CHECKING([if struct ethtool_ops has set_phys_id])
1541         LB_LINUX_TRY_COMPILE([
1542                 #include <linux/ethtool.h>
1543         ],[
1544                 const struct ethtool_ops en_ethtool_ops = {
1545                         .set_phys_id= NULL,
1546                 };
1547
1548                 return 0;
1549         ],[
1550                 AC_MSG_RESULT(yes)
1551                 AC_DEFINE(HAVE_SET_PHYS_ID, 1,
1552                           [set_phys_id is defined])
1553         ],[
1554                 AC_MSG_RESULT(no)
1555         ])
1556
1557         AC_MSG_CHECKING([if struct ethtool_ops has get/set_channels])
1558         LB_LINUX_TRY_COMPILE([
1559                 #include <linux/ethtool.h>
1560         ],[
1561                 const struct ethtool_ops en_ethtool_ops = {
1562                         .get_channels = NULL,
1563                         .set_channels = NULL,
1564                 };
1565
1566                 return 0;
1567         ],[
1568                 AC_MSG_RESULT(yes)
1569                 AC_DEFINE(HAVE_GET_SET_CHANNELS, 1,
1570                           [get/set_channels is defined])
1571         ],[
1572                 AC_MSG_RESULT(no)
1573         ])
1574
1575         AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_channels])
1576         LB_LINUX_TRY_COMPILE([
1577                 #include <linux/ethtool.h>
1578         ],[
1579                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1580                         .get_channels = NULL,
1581                         .set_channels = NULL,
1582                 };
1583
1584                 return 0;
1585         ],[
1586                 AC_MSG_RESULT(yes)
1587                 AC_DEFINE(HAVE_GET_SET_CHANNELS_EXT, 1,
1588                           [get/set_channels is defined in ethtool_ops_ext])
1589         ],[
1590                 AC_MSG_RESULT(no)
1591         ])
1592
1593         AC_MSG_CHECKING([if struct ethtool_ops has get_ts_info])
1594         LB_LINUX_TRY_COMPILE([
1595                 #include <linux/ethtool.h>
1596         ],[
1597                 const struct ethtool_ops en_ethtool_ops = {
1598                         .get_ts_info = NULL,
1599                 };
1600
1601                 return 0;
1602         ],[
1603                 AC_MSG_RESULT(yes)
1604                 AC_DEFINE(HAVE_GET_TS_INFO, 1,
1605                           [get_ts_info is defined])
1606         ],[
1607                 AC_MSG_RESULT(no)
1608         ])
1609
1610         AC_MSG_CHECKING([if struct ethtool_ops has set_dump])
1611         LB_LINUX_TRY_COMPILE([
1612                 #include <linux/ethtool.h>
1613         ],[
1614                 const struct ethtool_ops en_ethtool_ops = {
1615                         .set_dump = NULL,
1616                 };
1617
1618                 return 0;
1619         ],[
1620                 AC_MSG_RESULT(yes)
1621                 AC_DEFINE(HAVE_ETHTOOL_OPS_SET_DUMP, 1,
1622                           [set_dump is defined])
1623         ],[
1624                 AC_MSG_RESULT(no)
1625         ])
1626
1627         AC_MSG_CHECKING([if struct ethtool_ops has get_module_info])
1628         LB_LINUX_TRY_COMPILE([
1629                 #include <linux/ethtool.h>
1630         ],[
1631                 const struct ethtool_ops en_ethtool_ops = {
1632                         .get_module_info = NULL,
1633                 };
1634
1635                 return 0;
1636         ],[
1637                 AC_MSG_RESULT(yes)
1638                 AC_DEFINE(HAVE_ETHTOOL_OPS_GET_MODULE_INFO, 1,
1639                           [get_module_info is defined])
1640         ],[
1641                 AC_MSG_RESULT(no)
1642         ])
1643
1644         AC_MSG_CHECKING([if struct ethtool_ops has get_module_eeprom])
1645         LB_LINUX_TRY_COMPILE([
1646                 #include <linux/ethtool.h>
1647         ],[
1648                 const struct ethtool_ops en_ethtool_ops = {
1649                         .get_module_eeprom = NULL,
1650                 };
1651
1652                 return 0;
1653         ],[
1654                 AC_MSG_RESULT(yes)
1655                 AC_DEFINE(HAVE_ETHTOOL_OPS_GET_MODULE_EEPROM, 1,
1656                           [get_module_eeprom is defined])
1657         ],[
1658                 AC_MSG_RESULT(no)
1659         ])
1660
1661         AC_MSG_CHECKING([if struct ethtool_ops_ext has get_ts_info])
1662         LB_LINUX_TRY_COMPILE([
1663                 #include <linux/ethtool.h>
1664         ],[
1665                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1666                         .get_ts_info = NULL,
1667                 };
1668
1669                 return 0;
1670         ],[
1671                 AC_MSG_RESULT(yes)
1672                 AC_DEFINE(HAVE_GET_TS_INFO_EXT, 1,
1673                           [get_ts_info is defined in ethtool_ops_ext])
1674         ],[
1675                 AC_MSG_RESULT(no)
1676         ])
1677
1678         AC_MSG_CHECKING([if struct ethtool_flow_ext has h_dest])
1679         LB_LINUX_TRY_COMPILE([
1680                 #include <linux/ethtool.h>
1681         ],[
1682                 unsigned char mac[ETH_ALEN];
1683                 struct ethtool_flow_ext h_ext;
1684
1685                 memcpy(&mac, h_ext.h_dest, ETH_ALEN);
1686
1687                 return 0;
1688         ],[
1689                 AC_MSG_RESULT(yes)
1690                 AC_DEFINE(HAVE_ETHTOOL_FLOW_EXT_H_DEST, 1,
1691                           [ethtool_flow_ext has h_dest])
1692         ],[
1693                 AC_MSG_RESULT(no)
1694         ])
1695
1696         AC_MSG_CHECKING([if netdevice.h has struct dev_addr_list])
1697         LB_LINUX_TRY_COMPILE([
1698                 #include <linux/netdevice.h>
1699         ],[
1700                 struct dev_addr_list addr;
1701                 return 0;
1702         ],[
1703                 AC_MSG_RESULT(yes)
1704                 AC_DEFINE(HAVE_NETDEV_DEV_ADDR, 1,
1705                           [dev_addr_list is defined])
1706         ],[
1707                 AC_MSG_RESULT(no)
1708         ])
1709
1710         AC_MSG_CHECKING([if pci.h has pci_vfs_assigned])
1711         LB_LINUX_TRY_COMPILE([
1712                 #include <linux/pci.h>
1713         ],[
1714                 struct pci_dev pdev;
1715                 pci_vfs_assigned(&pdev);
1716                 return 0;
1717         ],[
1718                 AC_MSG_RESULT(yes)
1719                 AC_DEFINE(HAVE_PCI_VF_ASSIGNED, 1,
1720                           [pci_vfs_assigned is defined])
1721         ],[
1722                 AC_MSG_RESULT(no)
1723         ])
1724
1725         AC_MSG_CHECKING([if vlan_insert_tag_set_proto is defined])
1726         LB_LINUX_TRY_COMPILE([
1727                 #include <linux/if_vlan.h>
1728         ],[
1729                 struct sk_buff *skb;
1730                 vlan_insert_tag_set_proto(skb, 0, 0);
1731                 return 0;
1732         ],[
1733                 AC_MSG_RESULT(yes)
1734                 AC_DEFINE(HAVE_VLAN_INSERT_TAG_SET_PROTO, 1,
1735                           [vlan_insert_tag_set_proto is defined])
1736         ],[
1737                 AC_MSG_RESULT(no)
1738                 AC_MSG_CHECKING([if __vlan_put_tag has 3 parameters])
1739                 LB_LINUX_TRY_COMPILE([
1740                         #include <linux/if_vlan.h>
1741                 ],[
1742                         struct sk_buff *skb;
1743                         __vlan_put_tag(skb, 0, 0);
1744                         return 0;
1745                 ],[
1746                         AC_MSG_RESULT(yes)
1747                         AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_PUT_TAG, 1,
1748                                   [__vlan_put_tag has 3 parameters])
1749                 ],[
1750                         AC_MSG_RESULT(no)
1751                 ])
1752         ])
1753
1754         AC_MSG_CHECKING([if __vlan_hwaccel_put_tag has 3 parameters])
1755         LB_LINUX_TRY_COMPILE([
1756                 #include <linux/if_vlan.h>
1757         ],[
1758                 struct sk_buff *skb;
1759                 __vlan_hwaccel_put_tag(skb, 0, 0);
1760
1761                 return 0;
1762         ],[
1763                 AC_MSG_RESULT(yes)
1764                 AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_HWACCEL_PUT_TAG, 1,
1765                           [__vlan_hwaccel_put_tag has 3 parameters])
1766         ],[
1767                 AC_MSG_RESULT(no)
1768         ])
1769
1770         AC_MSG_CHECKING([if struct inet6_ifaddr has if_next])
1771         LB_LINUX_TRY_COMPILE([
1772                 #include <net/if_inet6.h>
1773         ],[
1774                 struct inet6_ifaddr ifp ;
1775                 ifp.if_next = 0;
1776
1777                 return 0;
1778         ],[
1779                 AC_MSG_RESULT(yes)
1780                 AC_DEFINE(HAVE_INETADDR_IF_NEXT, 1,
1781                           [if_next is defined])
1782         ],[
1783                 AC_MSG_RESULT(no)
1784         ])
1785
1786         AC_MSG_CHECKING([if struct net_device has hw_features])
1787         LB_LINUX_TRY_COMPILE([
1788                 #include <linux/netdevice.h>
1789         ],[
1790                 struct net_device dev;
1791                 dev.hw_features = 0;
1792
1793                 return 0;
1794         ],[
1795                 AC_MSG_RESULT(yes)
1796                 AC_DEFINE(HAVE_NETDEV_HW_FEATURES, 1,
1797                           [hw_features is defined])
1798         ],[
1799                 AC_MSG_RESULT(no)
1800         ])
1801
1802         AC_MSG_CHECKING([if struct net_device has hw_enc_features])
1803         LB_LINUX_TRY_COMPILE([
1804                 #include <linux/netdevice.h>
1805         ],[
1806                 struct net_device dev;
1807                 dev.hw_enc_features = 0;
1808
1809                 return 0;
1810         ],[
1811                 AC_MSG_RESULT(yes)
1812                 AC_DEFINE(HAVE_NETDEV_HW_ENC_FEATURES, 1,
1813                           [hw_enc_features is defined])
1814         ],[
1815                 AC_MSG_RESULT(no)
1816         ])
1817
1818         AC_MSG_CHECKING([if struct net_device has rx_cpu_rmap])
1819         LB_LINUX_TRY_COMPILE([
1820                 #include <linux/netdevice.h>
1821         ],[
1822                 struct net_device dev;
1823                 dev.rx_cpu_rmap = NULL;
1824
1825                 return 0;
1826         ],[
1827                 AC_MSG_RESULT(yes)
1828                 AC_DEFINE(HAVE_NETDEV_RX_CPU_RMAP, 1,
1829                           [rx_cpu_rmap is defined])
1830         ],[
1831                 AC_MSG_RESULT(no)
1832         ])
1833
1834         AC_MSG_CHECKING([if if_vlan.h has vlan_hwaccel_receive_skb])
1835         LB_LINUX_TRY_COMPILE([
1836                 #include <linux/if_vlan.h>
1837         ],[
1838                 struct sk_buff *skb;
1839                 vlan_hwaccel_receive_skb(skb,0,0);
1840                 return 0;
1841         ],[
1842                 AC_MSG_RESULT(yes)
1843                 AC_DEFINE(HAVE_VLAN_HWACCEL_RECEIVE_SKB, 1,
1844                           [vlan_hwaccel_receive_skb is defined])
1845         ],[
1846                 AC_MSG_RESULT(no)
1847         ])
1848
1849         AC_MSG_CHECKING([if irqdesc.h has irq_desc_get_irq_data])
1850         LB_LINUX_TRY_COMPILE([
1851                 #include <linux/irq.h>
1852                 #include <linux/irqdesc.h>
1853         ],[
1854                 struct irq_desc desc;
1855                 struct irq_data *data = irq_desc_get_irq_data(&desc);
1856
1857                 return 0;
1858         ],[
1859                 AC_MSG_RESULT(yes)
1860                 AC_DEFINE(HAVE_IRQ_DESC_GET_IRQ_DATA, 1,
1861                           [irq_desc_get_irq_data is defined])
1862         ],[
1863                 AC_MSG_RESULT(no)
1864         ])
1865
1866
1867         AC_MSG_CHECKING([if pci_dev has pcie_mpss])
1868         LB_LINUX_TRY_COMPILE([
1869                 #include <linux/pci.h>
1870         ],[
1871                 struct pci_dev *pdev;
1872
1873                 pdev->pcie_mpss = 0;
1874                 return 0;
1875         ],[
1876                 AC_MSG_RESULT(yes)
1877                 AC_DEFINE(HAVE_PCI_DEV_PCIE_MPSS, 1,
1878                           [pcie_mpss is defined])
1879         ],[
1880                 AC_MSG_RESULT(no)
1881         ])
1882
1883         AC_MSG_CHECKING([if uapi/linux/if_ether.h exist])
1884         LB_LINUX_TRY_COMPILE([
1885                 #include <uapi/linux/if_ether.h>
1886         ],[
1887                 return 0;
1888         ],[
1889                 AC_MSG_RESULT(yes)
1890                 AC_DEFINE(HAVE_UAPI_LINUX_IF_ETHER_H, 1,
1891                           [uapi/linux/if_ether.h exist])
1892         ],[
1893                 AC_MSG_RESULT(no)
1894         ])
1895
1896         AC_MSG_CHECKING([if ifla_vf_info has spoofchk])
1897         LB_LINUX_TRY_COMPILE([
1898                 #include <linux/if_link.h>
1899         ],[
1900                 struct ifla_vf_info *ivf;
1901
1902                 ivf->spoofchk = 0;
1903                 return 0;
1904         ],[
1905                 AC_MSG_RESULT(yes)
1906                 AC_DEFINE(HAVE_VF_INFO_SPOOFCHK, 1,
1907                           [spoofchk is defined])
1908         ],[
1909                 AC_MSG_RESULT(no)
1910         ])
1911
1912         AC_MSG_CHECKING([if vxlan.h has vxlan_gso_check])
1913         LB_LINUX_TRY_COMPILE([
1914                 #include <net/vxlan.h>
1915         ],[
1916                 vxlan_gso_check(NULL);
1917
1918                 return 0;
1919         ],[
1920                 AC_MSG_RESULT(yes)
1921                 AC_DEFINE(HAVE_VXLAN_GSO_CHECK, 1,
1922                           [vxlan_gso_check is defined])
1923         ],[
1924                 AC_MSG_RESULT(no)
1925         ])
1926
1927         AC_MSG_CHECKING([if dst.h has dst_get_neighbour])
1928         LB_LINUX_TRY_COMPILE([
1929                 #include <net/dst.h>
1930         ],[
1931                 struct neighbour *neigh = dst_get_neighbour(NULL);
1932
1933                 return 0;
1934         ],[
1935                 AC_MSG_RESULT(yes)
1936                 AC_DEFINE(HAVE_DST_GET_NEIGHBOUR, 1,
1937                           [ is defined])
1938         ],[
1939                 AC_MSG_RESULT(no)
1940         ])
1941
1942         AC_MSG_CHECKING([if netlink_dump_start has 6 parameters])
1943         LB_LINUX_TRY_COMPILE([
1944                 #include <linux/netlink.h>
1945         ],[
1946                 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL, 0);
1947
1948                 return 0;
1949         ],[
1950                 AC_MSG_RESULT(yes)
1951                 AC_DEFINE(HAVE_NETLINK_DUMP_START_6P, 1,
1952                           [ is defined])
1953         ],[
1954                 AC_MSG_RESULT(no)
1955         ])
1956
1957         AC_MSG_CHECKING([if netlink_dump_start has 5 parameters])
1958         LB_LINUX_TRY_COMPILE([
1959                 #include <linux/netlink.h>
1960         ],[
1961                 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL);
1962
1963                 return 0;
1964         ],[
1965                 AC_MSG_RESULT(yes)
1966                 AC_DEFINE(HAVE_NETLINK_DUMP_START_5P, 1,
1967                           [ is defined])
1968         ],[
1969                 AC_MSG_RESULT(no)
1970         ])
1971
1972         AC_MSG_CHECKING([if struct dcbnl_rtnl_ops has ieee_getmaxrate/ieee_setmaxrate])
1973         LB_LINUX_TRY_COMPILE([
1974                 #include <net/dcbnl.h>
1975         ],[
1976                 const struct dcbnl_rtnl_ops en_dcbnl_ops = {
1977                         .ieee_getmaxrate = NULL,
1978                         .ieee_setmaxrate = NULL,
1979                 };
1980
1981                 return 0;
1982         ],[
1983                 AC_MSG_RESULT(yes)
1984                 AC_DEFINE(HAVE_IEEE_GET_SET_MAXRATE, 1,
1985                           [ieee_getmaxrate/ieee_setmaxrate is defined])
1986         ],[
1987                 AC_MSG_RESULT(no)
1988         ])
1989
1990         AC_LANG_PUSH(C)
1991         ac_c_werror_flag=yes
1992         save_EXTRA_KCFLAGS=$EXTRA_KCFLAGS
1993         EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Werror"
1994
1995         AC_MSG_CHECKING([if bonding.h bond_for_each_slave has int for 3rd parameter])
1996         LB_LINUX_TRY_COMPILE([
1997                 #include <net/bonding.h>
1998         ],[
1999                 struct bonding *bond = NULL;
2000                 struct slave *slave = NULL;
2001                 int iter;
2002
2003                 bond_for_each_slave(bond, slave, iter) ;
2004
2005                 return 0;
2006         ],[
2007                 AC_MSG_RESULT(yes)
2008                 AC_DEFINE(HAVE_BOND_FOR_EACH_SLAVE_3RD_PARAM_IS_INT, 1,
2009                           [bond_for_each_slave has int for 3rd parameter])
2010         ],[
2011                 AC_MSG_RESULT(no)
2012         ])
2013         EXTRA_KCFLAGS="$save_EXTRA_KCFLAGS"
2014         ac_c_werror_flag=
2015         AC_LANG_POP
2016
2017         AC_MSG_CHECKING([if netdevice.h has netdev_master_upper_dev_get_rcu])
2018         LB_LINUX_TRY_COMPILE([
2019                 #include <linux/netdevice.h>
2020         ],[
2021                 netdev_master_upper_dev_get_rcu(NULL);
2022
2023                 return 0;
2024         ],[
2025                 AC_MSG_RESULT(yes)
2026                 AC_DEFINE(HAVE_NETDEV_MASTER_UPPER_DEV_GET_RCU, 1,
2027                           [netdev_master_upper_dev_get_rcu is defined])
2028         ],[
2029                 AC_MSG_RESULT(no)
2030         ])
2031
2032         AC_MSG_CHECKING([if __vlan_find_dev_deep has 3 parameters])
2033         LB_LINUX_TRY_COMPILE([
2034                 #include <linux/if_vlan.h>
2035         ],[
2036                 __vlan_find_dev_deep(NULL, 0, 0);
2037
2038                 return 0;
2039         ],[
2040                 AC_MSG_RESULT(yes)
2041                 AC_DEFINE(HAVE__VLAN_FIND_DEV_DEEP_3P, 1,
2042                           [__vlan_find_dev_deep has 3 paramters])
2043         ],[
2044                 AC_MSG_RESULT(no)
2045         ])
2046
2047         AC_MSG_CHECKING([if sk_buff.h has __skb_alloc_page])
2048         LB_LINUX_TRY_COMPILE([
2049                 #include <linux/skbuff.h>
2050         ],[
2051                 __skb_alloc_page(0, NULL);
2052
2053                 return 0;
2054         ],[
2055                 AC_MSG_RESULT(yes)
2056                 AC_DEFINE(HAVE__SKB_ALLOC_PAGE, 1,
2057                           [sk_buff has __skb_alloc_page])
2058         ],[
2059                 AC_MSG_RESULT(no)
2060         ])
2061
2062         AC_MSG_CHECKING([if __vlan_hwaccel_put_tag has 3 parameters])
2063         LB_LINUX_TRY_COMPILE([
2064                 #include <linux/if_vlan.h>
2065         ],[
2066                 __vlan_hwaccel_put_tag(NULL, 0, 0);
2067
2068                 return 0;
2069         ],[
2070                 AC_MSG_RESULT(yes)
2071                 AC_DEFINE(HAVE__VLAN_HWACCEL_PUT_TAG_3P, 1,
2072                           [__vlan_hwaccel_put_tag has 3 paramters])
2073         ],[
2074                 AC_MSG_RESULT(no)
2075         ])
2076
2077         AC_MSG_CHECKING([if linux/mm_types.h has struct page_frag])
2078         LB_LINUX_TRY_COMPILE([
2079                 #include <linux/mm_types.h>
2080         ],[
2081                 struct page_frag frag = {0};
2082
2083                 return 0;
2084         ],[
2085                 AC_MSG_RESULT(yes)
2086                 AC_DEFINE(HAVE_MM_TYPES_PAGE_FRAG, 1,
2087                           [linux/mm_types.h has struct page_frag])
2088         ],[
2089                 AC_MSG_RESULT(no)
2090         ])
2091
2092         AC_MSG_CHECKING([if if_vlan.h has __vlan_find_dev_deep])
2093         LB_LINUX_TRY_COMPILE([
2094                 #include <linux/if_vlan.h>
2095         ],[
2096                 __vlan_find_dev_deep(NULL, 0);
2097
2098                 return 0;
2099         ],[
2100                 AC_MSG_RESULT(yes)
2101                 AC_DEFINE(HAVE___VLAN_FIND_DEV_DEEP, 1,
2102                           [__vlan_find_dev_deep is defined])
2103         ],[
2104                 AC_MSG_RESULT(no)
2105         ])
2106
2107         AC_MSG_CHECKING([if idr .h has idr_Alloc])
2108         LB_LINUX_TRY_COMPILE([
2109                 #include <linux/idr.h>
2110         ],[
2111                 idr_alloc(NULL, NULL, 0, 0, 0);
2112                 return 0;
2113         ],[
2114                 AC_MSG_RESULT(yes)
2115                 AC_DEFINE(HAVE_IDR_NEW_INTERFACE, 1,
2116                           [idr_Alloc is defined]) ],[
2117                 AC_MSG_RESULT(no)
2118         ])
2119
2120         AC_MSG_CHECKING([if idr.h has idr_is_empty])
2121         LB_LINUX_TRY_COMPILE([
2122                 #include <linux/idr.h>
2123         ],[
2124                 bool x = idr_is_empty(NULL);
2125                 return 0;
2126         ],[
2127                 AC_MSG_RESULT(yes)
2128                 AC_DEFINE(HAVE_IDR_IS_EMPTY, 1,
2129                           [idr_is_empty is defined])
2130         ],[
2131                 AC_MSG_RESULT(no)
2132         ])
2133
2134         AC_MSG_CHECKING([if completion.h has reinit_completion])
2135         LB_LINUX_TRY_COMPILE([
2136                 #include <linux/completion.h>
2137         ],[
2138                 struct completion c;
2139
2140                 reinit_completion(&c);
2141                 return 0;
2142         ],[
2143                 AC_MSG_RESULT(yes)
2144                 AC_DEFINE(HAVE_REINIT_COMPLETION, 1,
2145                           [reinit_completion is defined])
2146         ],[
2147                 AC_MSG_RESULT(no)
2148         ])
2149
2150         AC_MSG_CHECKING([if dma-mapping.h has dma_set_mask_and_coherent])
2151         LB_LINUX_TRY_COMPILE([
2152                 #include <linux/dma-mapping.h>
2153         ],[
2154                 dma_set_mask_and_coherent(NULL, 0);
2155
2156                 return 0;
2157         ],[
2158                 AC_MSG_RESULT(yes)
2159                 AC_DEFINE(HAVE_DMA_SET_MASK_AND_COHERENT, 1,
2160                           [dma_set_mask_and_coherent is defined])
2161         ],[
2162                 AC_MSG_RESULT(no)
2163         ])
2164
2165         AC_MSG_CHECKING([if in.h has proto_ports_offset])
2166         LB_LINUX_TRY_COMPILE([
2167                 #include <linux/in.h>
2168         ],[
2169                 int x = proto_ports_offset(IPPROTO_TCP);
2170                 return 0;
2171         ],[
2172                 AC_MSG_RESULT(yes)
2173                 AC_DEFINE(HAVE_PROTO_PORTS_OFFSET, 1,
2174                           [proto_ports_offset is defined])
2175         ],[
2176                 AC_MSG_RESULT(no)
2177         ])
2178
2179         LB_CHECK_SYMBOL_EXPORT([elfcorehdr_addr],
2180                 [kernel/crash_dump.c],
2181                 [AC_DEFINE(HAVE_ELFCOREHDR_ADDR_EXPORTED, 1,
2182                         [elfcorehdr_addr is exported by the kernel])],
2183         [])
2184
2185         AC_MSG_CHECKING([if netif_set_real_num_rx_queues is defined])
2186         LB_LINUX_TRY_COMPILE([
2187                 #include <linux/netdevice.h>
2188         ],[
2189                 int rc = netif_set_real_num_rx_queues(NULL, 0);
2190
2191                 return rc;
2192         ],[
2193                 AC_MSG_RESULT(yes)
2194                 AC_DEFINE(HAVE_NETIF_SET_REAL_NUM_RX_QUEUES, 1,
2195                           [netif_set_real_num_rx_queues is defined])
2196         ],[
2197                 AC_MSG_RESULT(no)
2198         ])
2199
2200         AC_MSG_CHECKING([if if_vlan.h has is_vlan_dev])
2201         LB_LINUX_TRY_COMPILE([
2202                 #include <linux/netdevice.h>
2203                 #include <linux/if_vlan.h>
2204         ],[
2205                 struct net_device dev;
2206                 is_vlan_dev(&dev);
2207
2208                 return 0;
2209         ],[
2210                 AC_MSG_RESULT(yes)
2211                 AC_DEFINE(HAVE_IS_VLAN_DEV, 1,
2212                           [is_vlan_dev is defined])
2213         ],[
2214                 AC_MSG_RESULT(no)
2215         ])
2216
2217         AC_MSG_CHECKING([if linux/timecounter.h exists])
2218         LB_LINUX_TRY_COMPILE([
2219                 #include <linux/timecounter.h>
2220         ],[
2221                 return 0;
2222         ],[
2223                 AC_MSG_RESULT(yes)
2224                 AC_DEFINE(HAVE_TIMECOUNTER_H, 1,
2225                           [linux/timecounter.h exists])
2226         ],[
2227                 AC_MSG_RESULT(no)
2228         ])
2229
2230         # timecounter_adjtime can be in timecounter.h or clocksource.h
2231         AC_MSG_CHECKING([if linux/clocksource.h has timecounter_adjtime])
2232         LB_LINUX_TRY_COMPILE([
2233                 #include <linux/timecounter.h>
2234         ],[
2235                 struct timecounter x;
2236                 s64 y = 0;
2237                 timecounter_adjtime(&x, y);
2238
2239                 return 0;
2240         ],[
2241                 AC_MSG_RESULT(yes)
2242                 AC_DEFINE(HAVE_TIMECOUNTER_ADJTIME, 1,
2243                           [timecounter_adjtime is defined])
2244         ],[
2245                 AC_MSG_RESULT(no)
2246         ])
2247
2248         AC_MSG_CHECKING([if linux/clocksource.h has timecounter_adjtime])
2249         LB_LINUX_TRY_COMPILE([
2250                 #include <linux/clocksource.h>
2251         ],[
2252                 struct timecounter x;
2253                 s64 y = 0;
2254                 timecounter_adjtime(&x, y);
2255
2256                 return 0;
2257         ],[
2258                 AC_MSG_RESULT(yes)
2259                 AC_DEFINE(HAVE_TIMECOUNTER_ADJTIME, 1,
2260                           [timecounter_adjtime is defined])
2261         ],[
2262                 AC_MSG_RESULT(no)
2263         ])
2264
2265         AC_MSG_CHECKING([if cyclecounter_cyc2ns has 4 parameters])
2266         LB_LINUX_TRY_COMPILE([
2267                 #include <linux/timecounter.h>
2268         ],[
2269                 cyclecounter_cyc2ns(NULL, NULL, 0, NULL);
2270
2271                 return 0;
2272         ],[
2273                 AC_MSG_RESULT(yes)
2274                 AC_DEFINE(HAVE_CYCLECOUNTER_CYC2NS_4_PARAMS, 1,
2275                           [cyclecounter_cyc2ns has 4 parameters])
2276         ],[
2277                 AC_MSG_RESULT(no)
2278         ])
2279
2280         AC_MSG_CHECKING([if netdevice.h struct net_device_ops has ndo_features_check])
2281         LB_LINUX_TRY_COMPILE([
2282                 #include <linux/netdevice.h>
2283         ],[
2284                 static const struct net_device_ops mlx4_netdev_ops = {
2285                         .ndo_features_check     = NULL,
2286                 };
2287
2288                 return 0;
2289         ],[
2290                 AC_MSG_RESULT(yes)
2291                 AC_DEFINE(HAVE_NETDEV_FEATURES_T, 1,
2292                           [netdev_features_t is defined])
2293         ],[
2294                 AC_MSG_RESULT(no)
2295         ])
2296
2297         AC_MSG_CHECKING([if struct ethtool_ops get_rxnfc gets u32 *rule_locs])
2298         LB_LINUX_TRY_COMPILE([
2299                 #include <linux/ethtool.h>
2300                 static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *c,
2301                                              u32 *rule_locs)
2302                 {
2303                         return 0;
2304                 }
2305         ],[
2306                 struct ethtool_ops x = {
2307                         .get_rxnfc = mlx4_en_get_rxnfc,
2308                 };
2309
2310                 return 0;
2311         ],[
2312                 AC_MSG_RESULT(yes)
2313                 AC_DEFINE(HAVE_ETHTOOL_OPS_GET_RXNFC_U32_RULE_LOCS, 1,
2314                           [ethtool_ops get_rxnfc gets u32 *rule_locs])
2315         ],[
2316                 AC_MSG_RESULT(no)
2317         ])
2318
2319         AC_MSG_CHECKING([if ethtool.h enum ethtool_stringset has ETH_SS_RSS_HASH_FUNCS])
2320         LB_LINUX_TRY_COMPILE([
2321                 #include <linux/ethtool.h>
2322         ],[
2323                 enum ethtool_stringset x = ETH_SS_RSS_HASH_FUNCS;
2324
2325                 return 0;
2326         ],[
2327                 AC_MSG_RESULT(yes)
2328                 AC_DEFINE(HAVE_ETH_SS_RSS_HASH_FUNCS, 1,
2329                           [ETH_SS_RSS_HASH_FUNCS is defined])
2330         ],[
2331                 AC_MSG_RESULT(no)
2332         ])
2333
2334         AC_MSG_CHECKING([if include/linux/irq_poll.h exists])
2335         LB_LINUX_TRY_COMPILE([
2336                 #include <linux/irq_poll.h>
2337         ],[
2338                 return 0;
2339         ],[
2340                 AC_MSG_RESULT(yes)
2341                 AC_DEFINE(HAVE_IRQ_POLL_H, 1,
2342                           [include/linux/irq_poll.h exists])
2343         ],[
2344                 AC_MSG_RESULT(no)
2345         ])
2346
2347         AC_MSG_CHECKING([if linux/dma-mapping.h has struct dma_attrs])
2348         LB_LINUX_TRY_COMPILE([
2349                 #include <linux/dma-mapping.h>
2350         ],[
2351                 struct dma_attrs *attrs;
2352                 int ret;
2353
2354                 ret = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
2355
2356                 return ret;
2357         ],[
2358                 AC_MSG_RESULT(yes)
2359                 AC_DEFINE(HAVE_STRUCT_DMA_ATTRS, 1,
2360                           [struct dma_attrs is defined])
2361         ],[
2362                 AC_MSG_RESULT(no)
2363         ])
2364
2365         AC_MSG_CHECKING([if pci.h has pcie_get_minimum_link])
2366         LB_LINUX_TRY_COMPILE([
2367                 #include <linux/pci.h>
2368         ],[
2369                 int ret;
2370                 ret = pcie_get_minimum_link(NULL, NULL, NULL);
2371
2372                 return ret;
2373         ],[
2374                 AC_MSG_RESULT(yes)
2375                 AC_DEFINE(HAVE_PCIE_GET_MINIMUM_LINK, 1,
2376                           [pcie_get_minimum_link is defined])
2377         ],[
2378                 AC_MSG_RESULT(no)
2379         ])
2380
2381         AC_MSG_CHECKING([if netdevice.h has netdev_for_each_all_upper_dev_rcu])
2382         LB_LINUX_TRY_COMPILE([
2383                 #include <linux/netdevice.h>
2384         ],[
2385                 struct net_device *dev;
2386                 struct net_device *upper;
2387                 struct list_head *list;
2388
2389                 netdev_for_each_all_upper_dev_rcu(dev, upper, list);
2390                 return 0;
2391         ],[
2392                 AC_MSG_RESULT(yes)
2393                 AC_DEFINE(HAVE_NETDEV_FOR_EACH_ALL_UPPER_DEV_RCU, 1,
2394                           [netdev_master_upper_dev_get_rcu is defined])
2395         ],[
2396                 AC_MSG_RESULT(no)
2397         ])
2398
2399         AC_MSG_CHECKING([if netdevice.h has netdev_has_upper_dev])
2400         LB_LINUX_TRY_COMPILE([
2401                 #include <linux/netdevice.h>
2402         ],[
2403                 struct net_device *dev;
2404                 struct net_device *upper;
2405                 netdev_has_upper_dev(dev, upper);
2406
2407                 return 0;
2408         ],[
2409                 AC_MSG_RESULT(yes)
2410                 AC_DEFINE(HAVE_NETDEV_HAS_UPPER_DEV, 1,
2411                           [netdev_has_upper_dev is defined])
2412         ],[
2413                 AC_MSG_RESULT(no)
2414         ])
2415
2416         AC_MSG_CHECKING([if ethtool.h has __ethtool_get_link_ksettings])
2417         LB_LINUX_TRY_COMPILE([
2418                 #include <linux/ethtool.h>
2419         ],[
2420                  __ethtool_get_link_ksettings(NULL, NULL);
2421
2422                 return 0;
2423         ],[
2424                 AC_MSG_RESULT(yes)
2425                 AC_DEFINE(HAVE___ETHTOOL_GET_LINK_KSETTINGS, 1,
2426                           [__ethtool_get_link_ksettings is defined])
2427         ],[
2428                 AC_MSG_RESULT(no)
2429         ])
2430
2431         AC_MSG_CHECKING([if addrconf.h has addrconf_ifid_eui48])
2432         LB_LINUX_TRY_COMPILE([
2433                 #include <net/addrconf.h>
2434         ],[
2435                 int x = addrconf_ifid_eui48(NULL, NULL);
2436
2437                 return 0;
2438         ],[
2439                 AC_MSG_RESULT(yes)
2440                 AC_DEFINE(HAVE_ADDRCONF_IFID_EUI48, 1,
2441                           [addrconf_ifid_eui48 is defined])
2442         ],[
2443                 AC_MSG_RESULT(no)
2444         ])
2445
2446         AC_MSG_CHECKING([if mm.h get_user_pages_remote])
2447         LB_LINUX_TRY_COMPILE([
2448                 #include <linux/mm.h>
2449         ],[
2450                 get_user_pages_remote(NULL, NULL, 0, 0, 0, 0, NULL, NULL);
2451
2452                 return 0;
2453         ],[
2454                 AC_MSG_RESULT(yes)
2455                 AC_DEFINE(HAVE_GET_USER_PAGES_REMOTE, 1,
2456                           [get_user_pages_remote exist])
2457         ],[
2458                 AC_MSG_RESULT(no)
2459         ])
2460
2461         AC_MSG_CHECKING([if ip_fib.h fib_lookup has 4 params])
2462         LB_LINUX_TRY_COMPILE([
2463                 #include <linux/bug.h>
2464                 #include <net/ip_fib.h>
2465         ],[
2466                 fib_lookup(NULL, NULL, NULL, 0);
2467
2468                 return 0;
2469         ],[
2470                 AC_MSG_RESULT(yes)
2471                 AC_DEFINE(HAVE_FIB_LOOKUP_4_PARAMS, 1,
2472                           [fib_lookup has 4 params])
2473         ],[
2474                 AC_MSG_RESULT(no)
2475         ])
2476
2477         AC_MSG_CHECKING([if include/net/devlink.h exists])
2478         LB_LINUX_TRY_COMPILE([
2479                 #include <net/devlink.h>
2480         ],[
2481                 return 0;
2482         ],[
2483                 AC_MSG_RESULT(yes)
2484                 AC_DEFINE(HAVE_NET_DEVLINK_H, 1,
2485                           [include/net/devlink.h exists])
2486         ],[
2487                 AC_MSG_RESULT(no)
2488         ])
2489
2490         AC_MSG_CHECKING([if io_mapping_map_wc has 3 params])
2491         LB_LINUX_TRY_COMPILE([
2492                 #include <linux/io-mapping.h>
2493         ],[
2494                 io_mapping_map_wc(NULL, 0, 0);
2495
2496                 return 0;
2497         ],[
2498                 AC_MSG_RESULT(yes)
2499                 AC_DEFINE(HAVE_IO_MAPPING_MAP_WC_3_PARAMS, 1,
2500                           [io_mapping_map_wc has 3 params])
2501         ],[
2502                 AC_MSG_RESULT(no)
2503         ])
2504
2505         AC_MSG_CHECKING([if include/net/dcbnl.h struct dcbnl_rtnl_ops has *ieee_getqcn])
2506         LB_LINUX_TRY_COMPILE([
2507                 #include <linux/netdevice.h>
2508                 #include <net/dcbnl.h>
2509         ],[
2510                 struct dcbnl_rtnl_ops x = {
2511                         .ieee_getqcn = NULL,
2512                 };
2513
2514                 return 0;
2515         ],[
2516                 AC_MSG_RESULT(yes)
2517                 AC_DEFINE(HAVE_IEEE_GETQCN, 1,
2518                           [ieee_getqcn is defined])
2519         ],[
2520                 AC_MSG_RESULT(no)
2521         ])
2522
2523         AC_MSG_CHECKING([if dcbnl.h has struct ieee_qcn])
2524         LB_LINUX_TRY_COMPILE([
2525                 #include <linux/netdevice.h>
2526                 #include <net/dcbnl.h>
2527         ],[
2528                 struct ieee_qcn x;
2529
2530                 return 0;
2531         ],[
2532                 AC_MSG_RESULT(yes)
2533                 AC_DEFINE(HAVE_STRUCT_IEEE_QCN, 1,
2534                           [ieee_qcn is defined])
2535         ],[
2536                 AC_MSG_RESULT(no)
2537         ])
2538
2539         AC_MSG_CHECKING([if netdevice.h has napi_consume_skb])
2540         LB_LINUX_TRY_COMPILE([
2541                 #include <linux/skbuff.h>
2542         ],[
2543                 napi_consume_skb(NULL, 0);
2544
2545                 return 0;
2546         ],[
2547                 AC_MSG_RESULT(yes)
2548                 AC_DEFINE(HAVE_NAPI_CONSUME_SKB, 1,
2549                           [napi_consume_skb is defined])
2550         ],[
2551                 AC_MSG_RESULT(no)
2552         ])
2553
2554         AC_MSG_CHECKING([if include/linux/bpf.h exists])
2555         LB_LINUX_TRY_COMPILE([
2556                 #include <linux/bpf.h>
2557         ],[
2558                 return 0;
2559         ],[
2560                 AC_MSG_RESULT(yes)
2561                 AC_DEFINE(HAVE_LINUX_BPF_H, 1,
2562                           [include/linux/bpf.h exists])
2563         ],[
2564                 AC_MSG_RESULT(no)
2565         ])
2566
2567         AC_MSG_CHECKING([if mm_types.h struct page has _count])
2568         LB_LINUX_TRY_COMPILE([
2569                 #include <linux/mm.h>
2570                 #include <linux/mm_types.h>
2571         ],[
2572                 struct page p;
2573                 p._count.counter = 0;
2574
2575                 return 0;
2576         ],[
2577                 AC_MSG_RESULT(yes)
2578                 AC_DEFINE(HAVE_MM_PAGE__COUNT, 1,
2579                           [struct page has _count])
2580         ],[
2581                 AC_MSG_RESULT(no)
2582         ])
2583
2584         AC_MSG_CHECKING([if include/linux/page_ref.h exists])
2585         LB_LINUX_TRY_COMPILE([
2586                 #include <linux/page_ref.h>
2587         ],[
2588                 return 0;
2589         ],[
2590                 AC_MSG_RESULT(yes)
2591                 AC_DEFINE(HAVE_LINUX_PAGE_REF_H, 1,
2592                           [include/linux/page_ref.h exists])
2593         ],[
2594                 AC_MSG_RESULT(no)
2595         ])
2596
2597         AC_MSG_CHECKING([if linux/ethtool.h has ETHTOOL_xLINKSETTINGS API])
2598         LB_LINUX_TRY_COMPILE([
2599                 #include <linux/ethtool.h>
2600         ],[
2601                 enum ethtool_link_mode_bit_indices x = ETHTOOL_LINK_MODE_TP_BIT;
2602
2603                 return 0;
2604         ],[
2605                 AC_MSG_RESULT(yes)
2606                 AC_DEFINE(HAVE_ETHTOOL_xLINKSETTINGS, 1,
2607                           [ETHTOOL_xLINKSETTINGS API is defined])
2608         ],[
2609                 AC_MSG_RESULT(no)
2610         ])
2611
2612         AC_MSG_CHECKING([if linux/printk.h exists])
2613         LB_LINUX_TRY_COMPILE([
2614                 #include <linux/printk.h>
2615         ],[
2616                 return 0;
2617         ],[
2618                 AC_MSG_RESULT(yes)
2619                 AC_DEFINE(HAVE_LINUX_PRINTK_H, 1,
2620                           [linux/printk.h is defined])
2621         ],[
2622                 AC_MSG_RESULT(no)
2623         ])
2624
2625         AC_MSG_CHECKING([if printk.h has struct va_format])
2626         LB_LINUX_TRY_COMPILE([
2627                 #include <linux/printk.h>
2628         ],[
2629                 struct va_format x;
2630
2631                 return 0;
2632         ],[
2633                 AC_MSG_RESULT(yes)
2634                 AC_DEFINE(HAVE_VA_FORMAT, 1,
2635                           [va_format is defined])
2636         ],[
2637                 AC_MSG_RESULT(no)
2638         ])
2639
2640         AC_MSG_CHECKING([if irq.h irq_data has member affinity])
2641         LB_LINUX_TRY_COMPILE([
2642                 #include <linux/irq.h>
2643                 #include <linux/cpumask.h>
2644         ],[
2645                 cpumask_var_t x;
2646                 struct irq_data y = {
2647                         .affinity = x,
2648                 };
2649
2650                 return 0;
2651         ],[
2652                 AC_MSG_RESULT(yes)
2653                 AC_DEFINE(HAVE_IRQ_DATA_AFFINITY, 1,
2654                           [irq_data member affinity is defined])
2655         ],[
2656                 AC_MSG_RESULT(no)
2657         ])
2658
2659         AC_MSG_CHECKING([if irq.h irq_data_get_affinity_mask])
2660         LB_LINUX_TRY_COMPILE([
2661                 #include <linux/irq.h>
2662         ],[
2663                 irq_data_get_affinity_mask(NULL);
2664
2665                 return 0;
2666         ],[
2667                 AC_MSG_RESULT(yes)
2668                 AC_DEFINE(HAVE_IRQ_DATA_GET_AFFINITY_MASK, 1,
2669                           [irq_data_get_affinity_mask exist])
2670         ],[
2671                 AC_MSG_RESULT(no)
2672         ])
2673
2674         AC_MSG_CHECKING([if netdevice.h has netif_tx_napi_add])
2675         LB_LINUX_TRY_COMPILE([
2676                 #include <linux/netdevice.h>
2677         ],[
2678                 netif_tx_napi_add(NULL, NULL, NULL, 0);
2679
2680                 return 0;
2681         ],[
2682                 AC_MSG_RESULT(yes)
2683                 AC_DEFINE(HAVE_NETIF_TX_NAPI_ADD, 1,
2684                           [netif_tx_napi_add is defined])
2685         ],[
2686                 AC_MSG_RESULT(no)
2687         ])
2688
2689         AC_MSG_CHECKING([if struct net_device_ops has *ndo_setup_tc])
2690         LB_LINUX_TRY_COMPILE([
2691                 #include <linux/netdevice.h>
2692         ],[
2693                 struct net_device_ops x = {
2694                         .ndo_setup_tc = NULL,
2695                 };
2696
2697                 return 0;
2698         ],[
2699                 AC_MSG_RESULT(yes)
2700                 AC_DEFINE(HAVE_NDO_SETUP_TC, 1,
2701                           [ndo_setup_tc is defined])
2702         ],[
2703                 AC_MSG_RESULT(no)
2704         ])
2705
2706         AC_MSG_CHECKING([if ndo_setup_tc takes 4 parameters])
2707         LB_LINUX_TRY_COMPILE([
2708                 #include <linux/netdevice.h>
2709
2710                 int mlx4_en_setup_tc(struct net_device *dev, u32 handle,
2711                                                          __be16 protocol, struct tc_to_netdev *tc)
2712                 {
2713                         return 0;
2714                 }
2715         ],[
2716                 struct net_device_ops x = {
2717                         .ndo_setup_tc = mlx4_en_setup_tc,
2718                 };
2719
2720                 return 0;
2721         ],[
2722                 AC_MSG_RESULT(yes)
2723                 AC_DEFINE(HAVE_NDO_SETUP_TC_4_PARAMS, 1,
2724                           [ndo_setup_tc takes 4 parameters])
2725         ],[
2726                 AC_MSG_RESULT(no)
2727         ])
2728
2729         AC_MSG_CHECKING([if etherdevice.h has alloc_etherdev_mqs, alloc_etherdev_mqs, num_tc])
2730         LB_LINUX_TRY_COMPILE([
2731                 #include <linux/etherdevice.h>
2732                 #include <linux/netdevice.h>
2733         ],[
2734                 struct net_device x = {
2735                         .num_tx_queues = 0,
2736                         .num_tc = 0,
2737                 };
2738                 alloc_etherdev_mqs(0, 0, 0);
2739
2740                 return 0;
2741         ],[
2742                 AC_MSG_RESULT(yes)
2743                 AC_DEFINE(HAVE_NEW_TX_RING_SCHEME, 1,
2744                           [alloc_etherdev_mqs, alloc_etherdev_mqs, num_tc is defined])
2745         ],[
2746                 AC_MSG_RESULT(no)
2747         ])
2748
2749         AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_tx_maxrate])
2750         LB_LINUX_TRY_COMPILE([
2751                 #include <linux/netdevice.h>
2752         ],[
2753                 struct net_device_ops x = {
2754                         .ndo_set_tx_maxrate = NULL,
2755                 };
2756
2757                 return 0;
2758         ],[
2759                 AC_MSG_RESULT(yes)
2760                 AC_DEFINE(HAVE_NDO_SET_TX_MAXRATE, 1,
2761                           [ndo_set_tx_maxrate is defined])
2762         ],[
2763                 AC_MSG_RESULT(no)
2764         ])
2765
2766         AC_MSG_CHECKING([if struct net_device has gso_partial_features])
2767         LB_LINUX_TRY_COMPILE([
2768                 #include <linux/netdevice.h>
2769         ],[
2770                 struct net_device *dev = NULL;
2771
2772                 dev->gso_partial_features = 0;
2773
2774                 return 0;
2775         ],[
2776                 AC_MSG_RESULT(yes)
2777                 AC_DEFINE(HAVE_NET_DEVICE_GSO_PARTIAL_FEATURES, 1,
2778                           [gso_partial_features is defined])
2779         ],[
2780                 AC_MSG_RESULT(no)
2781         ])
2782
2783         AC_MSG_CHECKING([if vxlan have ndo_add_vxlan_port])
2784         LB_LINUX_TRY_COMPILE([
2785                 #include <linux/netdevice.h>
2786
2787                 #if IS_ENABLED(CONFIG_VXLAN)
2788                 void add_vxlan_port(struct net_device *dev, sa_family_t sa_family, __be16 port)
2789                 {
2790                         return 0;
2791                 }
2792                 #endif
2793         ],[
2794                 struct net_device_ops netdev_ops;
2795                 netdev_ops.ndo_add_vxlan_port = add_vxlan_port;
2796
2797                 return 0;
2798         ],[
2799                 AC_MSG_RESULT(yes)
2800                 AC_DEFINE(HAVE_VXLAN_DYNAMIC_PORT, 1,
2801                         [ndo_add_vxlan_port is defined])
2802         ],[
2803                 AC_MSG_RESULT(no)
2804         ])
2805
2806         AC_MSG_CHECKING([if vxlan has vxlan_get_rx_port])
2807         LB_LINUX_TRY_COMPILE([
2808                 #if IS_ENABLED(CONFIG_VXLAN)
2809                 #include <net/vxlan.h>
2810                 #endif
2811         ],[
2812                 vxlan_get_rx_port(NULL);
2813
2814                 return 0;
2815         ],[
2816                 AC_MSG_RESULT(yes)
2817                 AC_DEFINE(HAVE_VXLAN_ENABLED, 1,
2818                           [vxlan_get_rx_port is defined])
2819         ],[
2820                 AC_MSG_RESULT(no)
2821         ])
2822
2823         AC_MSG_CHECKING([if vxlan have ndo_udp_tunnel_add])
2824         LB_LINUX_TRY_COMPILE([
2825                 #include <linux/netdevice.h>
2826
2827                 #if IS_ENABLED(CONFIG_VXLAN)
2828                 void udp_tunnel_add(struct net_device *dev, sa_family_t sa_family, __be16 port)
2829                 {
2830                         return 0;
2831                 }
2832                 #endif
2833         ],[
2834                 struct net_device_ops netdev_ops;
2835                 netdev_ops.ndo_udp_tunnel_add = udp_tunnel_add;
2836
2837                 return 0;
2838         ],[
2839                 AC_MSG_RESULT(yes)
2840                 AC_DEFINE(HAVE_NDO_UDP_TUNNEL_ADD, 1,
2841                         [ndo_udp_tunnel_add is defined])
2842         ],[
2843                 AC_MSG_RESULT(no)
2844         ])
2845
2846         AC_MSG_CHECKING([if vxlan has udp_tunnel_get_rx_info])
2847         LB_LINUX_TRY_COMPILE([
2848                 #include <net/udp_tunnel.h>
2849         ],[
2850                 udp_tunnel_get_rx_info(NULL);
2851
2852                 return 0;
2853         ],[
2854                 AC_MSG_RESULT(yes)
2855                 AC_DEFINE(HAVE_UDP_TUNNEL_GET_RX_INFO, 1,
2856                           [udp_tunnel_get_rx_info is defined])
2857         ],[
2858                 AC_MSG_RESULT(no)
2859         ])
2860
2861         AC_MSG_CHECKING([if netdevice.h has struct netdev_bonding_info])
2862         LB_LINUX_TRY_COMPILE([
2863                 #include <linux/netdevice.h>
2864         ],[
2865                 struct netdev_bonding_info x;
2866                 x.master.num_slaves = 0;
2867
2868                 return 0;
2869         ],[
2870                 AC_MSG_RESULT(yes)
2871                 AC_DEFINE(HAVE_NETDEV_BONDING_INFO, 1,
2872                           [netdev_bonding_info is defined])
2873         ],[
2874                 AC_MSG_RESULT(no)
2875         ])
2876
2877         AC_MSG_CHECKING([if netdevice.h has struct netdev_phys_item_id])
2878         LB_LINUX_TRY_COMPILE([
2879                 #include <linux/netdevice.h>
2880         ],[
2881                 struct netdev_phys_item_id x;
2882                 x.id_len = 0;
2883
2884                 return 0;
2885         ],[
2886                 AC_MSG_RESULT(yes)
2887                 AC_DEFINE(HAVE_NETDEV_PHYS_ITEM_ID, 1,
2888                           [netdev_phys_item_id is defined])
2889         ],[
2890                 AC_MSG_RESULT(no)
2891         ])
2892
2893         AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_vf_mac])
2894         LB_LINUX_TRY_COMPILE([
2895                 #include <linux/netdevice.h>
2896
2897                 int set_vf_mac(struct net_device *dev, int queue, u8 *mac)
2898                 {
2899                         return 0;
2900                 }
2901         ],[
2902                 struct net_device_ops netdev_ops;
2903                 netdev_ops.ndo_set_vf_mac = set_vf_mac;
2904
2905                 return 0;
2906         ],[
2907                 AC_MSG_RESULT(yes)
2908                 AC_DEFINE(HAVE_NDO_SET_VF_MAC, 1,
2909                           [ndo_set_vf_mac is defined])
2910         ],[
2911                 AC_MSG_RESULT(no)
2912         ])
2913
2914         AC_MSG_CHECKING([if getnumtcs returns int])
2915         LB_LINUX_TRY_COMPILE([
2916                 #include <linux/netdevice.h>
2917                 #include <net/dcbnl.h>
2918
2919                 static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
2920
2921                 {
2922                         return 0;
2923                 }
2924
2925         ],[
2926                 struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops = {
2927                         .getnumtcs      = mlx4_en_dcbnl_getnumtcs,
2928                 };
2929
2930                 return 0;
2931         ],[
2932                 AC_MSG_RESULT(yes)
2933                 AC_DEFINE(NDO_GETNUMTCS_RETURNS_INT, 1,
2934                           [if getnumtcs returns int])
2935         ],[
2936                 AC_MSG_RESULT(no)
2937         ])
2938
2939         AC_MSG_CHECKING([if getapp returns int])
2940         LB_LINUX_TRY_COMPILE([
2941                 #include <linux/netdevice.h>
2942                 #include <net/dcbnl.h>
2943
2944                 static int mlx4_en_dcbnl_getapp(struct net_device *netdev, u8 idtype,
2945                                                 u16 id)
2946                 {
2947                         return 0;
2948                 }
2949         ],[
2950                 struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops = {
2951                         .getapp         = mlx4_en_dcbnl_getapp,
2952                 };
2953
2954                 return 0;
2955         ],[
2956                 AC_MSG_RESULT(yes)
2957                 AC_DEFINE(NDO_GETAPP_RETURNS_INT, 1,
2958                           [if getapp returns int])
2959         ],[
2960                 AC_MSG_RESULT(no)
2961         ])
2962
2963         AC_MSG_CHECKING([if setapp returns int])
2964         LB_LINUX_TRY_COMPILE([
2965                 #include <linux/netdevice.h>
2966                 #include <net/dcbnl.h>
2967
2968                 static int mlx4_en_dcbnl_setapp(struct net_device *netdev, u8 idtype,
2969                                                 u16 id, u8 up)
2970                 {
2971                         return 0;
2972                 }
2973
2974         ],[
2975                 struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops = {
2976                         .setapp         = mlx4_en_dcbnl_setapp,
2977                 };
2978
2979                 return 0;
2980         ],[
2981                 AC_MSG_RESULT(yes)
2982                 AC_DEFINE(NDO_SETAPP_RETURNS_INT, 1,
2983                           [if setapp returns int])
2984         ],[
2985                 AC_MSG_RESULT(no)
2986         ])
2987
2988         AC_MSG_CHECKING([if linux/inetdevice.h inet_confirm_addr has 5 parameters])
2989         LB_LINUX_TRY_COMPILE([
2990                 #include <linux/inetdevice.h>
2991         ],[
2992                 inet_confirm_addr(NULL, NULL, 0, 0, 0);
2993
2994                 return 0;
2995         ],[
2996                 AC_MSG_RESULT(yes)
2997                 AC_DEFINE(HAVE_INET_CONFIRM_ADDR_5_PARAMS, 1,
2998                           [inet_confirm_addr has 5 parameters])
2999         ],[
3000                 AC_MSG_RESULT(no)
3001         ])
3002
3003         LB_CHECK_SYMBOL_EXPORT([inet_confirm_addr],
3004                 [net/ipv4/devinet.c],
3005                 [AC_DEFINE(HAVE_INET_CONFIRM_ADDR_EXPORTED, 1,
3006                         [inet_confirm_addr is exported by the kernel])],
3007         [])
3008
3009         AC_MSG_CHECKING([if netdevice.h has netdev_rss_key_fill])
3010         LB_LINUX_TRY_COMPILE([
3011                 #include <linux/netdevice.h>
3012         ],[
3013                 netdev_rss_key_fill(NULL, 0);
3014
3015                 return 0;
3016         ],[
3017                 AC_MSG_RESULT(yes)
3018                 AC_DEFINE(HAVE_NETDEV_RSS_KEY_FILL, 1,
3019                           [netdev_rss_key_fill is defined])
3020         ],[
3021                 AC_MSG_RESULT(no)
3022         ])
3023
3024         AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_vf_stats])
3025         LB_LINUX_TRY_COMPILE([
3026                 #include <linux/netdevice.h>
3027
3028                 int get_vf_stats(struct net_device *dev, int vf, struct ifla_vf_stats *vf_stats)
3029                 {
3030                         return 0;
3031                 }
3032         ],[
3033                 struct net_device_ops netdev_ops;
3034                 netdev_ops.ndo_get_vf_stats = get_vf_stats;
3035
3036                 return 0;
3037         ],[
3038                 AC_MSG_RESULT(yes)
3039                 AC_DEFINE(HAVE_NDO_GET_VF_STATS, 1,
3040                           [ndo_get_vf_stats is defined])
3041         ],[
3042                 AC_MSG_RESULT(no)
3043         ])
3044
3045         AC_MSG_CHECKING([if struct ifla_vf_stats has rx_dropped])
3046         LB_LINUX_TRY_COMPILE([
3047                 #include <linux/if_link.h>
3048         ],[
3049                 struct ifla_vf_stats stat = {
3050                         .rx_dropped = 0,
3051                         };
3052
3053                 return 0;
3054         ],[
3055                 AC_MSG_RESULT(yes)
3056                 AC_DEFINE(HAVE_IFLA_VF_STATS_RX_DROPPED, 1,
3057                           [struct ifla_vf_stats has rx_dropped])
3058         ],[
3059                 AC_MSG_RESULT(no)
3060         ])
3061
3062         AC_MSG_CHECKING([if struct net_device_ops has ndo_set_vf_guid])
3063         LB_LINUX_TRY_COMPILE([
3064                 #include <linux/netdevice.h>
3065
3066                 int set_vf_guid(struct net_device *dev, int vf, u64 guid, int guid_type)
3067                 {
3068                         return 0;
3069                 }
3070         ],[
3071                 struct net_device_ops netdev_ops;
3072                 netdev_ops.ndo_set_vf_guid = set_vf_guid;
3073
3074                 return 0;
3075         ],[
3076                 AC_MSG_RESULT(yes)
3077                 AC_DEFINE(HAVE_NDO_SET_VF_GUID, 1,
3078                           [ndo_set_vf_guid is defined])
3079         ],[
3080                 AC_MSG_RESULT(no)
3081         ])
3082
3083         AC_MSG_CHECKING([if netdevice.h has netif_trans_update])
3084         LB_LINUX_TRY_COMPILE([
3085                 #include <linux/netdevice.h>
3086         ],[
3087                 netif_trans_update(NULL);
3088
3089                 return 0;
3090         ],[
3091                 AC_MSG_RESULT(yes)
3092                 AC_DEFINE(HAVE_NETIF_TRANS_UPDATE, 1,
3093                           [netif_trans_update is defined])
3094         ],[
3095                 AC_MSG_RESULT(no)
3096         ])
3097
3098         AC_MSG_CHECKING([if netdevice.h alloc_netdev_mqs has 6 params])
3099         LB_LINUX_TRY_COMPILE([
3100                 #include <linux/netdevice.h>
3101         ],[
3102                 alloc_netdev_mqs(0, NULL, NET_NAME_UNKNOWN, NULL, 0, 0);
3103
3104                 return 0;
3105         ],[
3106                 AC_MSG_RESULT(yes)
3107                 AC_DEFINE(HAVE_ALLOC_NETDEV_MQS_6_PARAMS, 1,
3108                           [alloc_netdev_mqs has 6 params])
3109         ],[
3110                 AC_MSG_RESULT(no)
3111         ])
3112
3113         AC_MSG_CHECKING([if filter.h has XDP])
3114         LB_LINUX_TRY_COMPILE([
3115                 #include <linux/filter.h>
3116         ],[
3117                 enum xdp_action action = XDP_ABORTED;
3118
3119                 return 0;
3120         ],[
3121                 AC_MSG_RESULT(yes)
3122                 AC_DEFINE(HAVE_FILTER_XDP, 1,
3123                           [filter.h has XDP])
3124         ],[
3125                 AC_MSG_RESULT(no)
3126         ])
3127
3128         AC_MSG_CHECKING([if struct xdp_buff has rxq])
3129         LB_LINUX_TRY_COMPILE([
3130                 #include <linux/filter.h>
3131         ],[
3132                 struct xdp_buff x = {
3133                         .rxq = NULL,
3134                 };
3135
3136                 return 0;
3137         ],[
3138                 AC_MSG_RESULT(yes)
3139                 AC_DEFINE(HAVE_XDP_BUFF_RXQ, 1,
3140                           [struct xdp_buff has rxq])
3141         ],[
3142                 AC_MSG_RESULT(no)
3143         ])
3144
3145         AC_MSG_CHECKING([if firmware.h has request_firmware_direct])
3146         LB_LINUX_TRY_COMPILE([
3147                 #include <linux/firmware.h>
3148         ],[
3149                 (void)request_firmware_direct(NULL, NULL, NULL);
3150
3151                 return 0;
3152         ],[
3153                 AC_MSG_RESULT(yes)
3154                 AC_DEFINE(HAVE_REQUEST_FIRMWARE_DIRECT, 1,
3155                           [firmware.h has request_firmware_direct])
3156         ],[
3157                 AC_MSG_RESULT(no)
3158         ])
3159
3160         AC_MSG_CHECKING([if pci.h has pci_set_vpd_size])
3161         LB_LINUX_TRY_COMPILE([
3162                 #include <linux/pci.h>
3163         ],[
3164                 (void)pci_set_vpd_size(NULL, 0);
3165
3166                 return 0;
3167         ],[
3168                 AC_MSG_RESULT(yes)
3169                 AC_DEFINE(HAVE_PCI_SET_VPD_SIZE, 1,
3170                           [pci.h has pci_set_vpd_size])
3171         ],[
3172                 AC_MSG_RESULT(no)
3173         ])
3174
3175         AC_MSG_CHECKING([if ethtooL_drvinfo has erom_version])
3176         LB_LINUX_TRY_COMPILE([
3177                 #include <linux/ethtool.h>
3178         ],[
3179                 struct ethtool_drvinfo e;
3180
3181                 return (e.erom_version);
3182         ],[
3183                 AC_MSG_RESULT(yes)
3184                 AC_DEFINE(HAVE_ETHTOOL_DRVINFO_EROM_VERSION, 1,
3185                           [ethtool_drvinfo has erom_version])
3186         ],[
3187                 AC_MSG_RESULT(no)
3188         ])
3189
3190         AC_MSG_CHECKING([if string_helpers.h string_get_size has 5 params])
3191         LB_LINUX_TRY_COMPILE([
3192                 #include <linux/sched.h>
3193                 #include <linux/bug.h>
3194                 #include <linux/kernel.h>
3195                 #include <linux/math64.h>
3196                 #include <linux/export.h>
3197                 #include <linux/ctype.h>
3198                 #include <linux/errno.h>
3199                 #include <linux/string.h>
3200                 #include <linux/string_helpers.h>
3201         ],[
3202                 (void)string_get_size(0, 0, 0, NULL, 0);
3203
3204                 return 0;
3205         ],[
3206                 AC_MSG_RESULT(yes)
3207                 AC_DEFINE(HAVE_STRING_GET_SIZE_5_PARAMS, 1,
3208                           [string_get_size has 5 params])
3209         ],[
3210                 AC_MSG_RESULT(no)
3211         ])
3212
3213         AC_MSG_CHECKING([if debugfs.h debugfs_create_bool has bool pointer])
3214         LB_LINUX_TRY_COMPILE([
3215                 #include <linux/debugfs.h>
3216         ],[
3217                 (void)debugfs_create_bool(NULL, 0, NULL, (bool *)0);
3218
3219                 return 0;
3220         ],[
3221                 AC_MSG_RESULT(yes)
3222                 AC_DEFINE(HAVE_DEBUGFS_CREATE_BOOL_USES_BOOL_PTR, 1,
3223                           [debugfs_create_bool has bool pointer])
3224         ],[
3225                 AC_MSG_RESULT(no)
3226         ])
3227
3228         AC_MSG_CHECKING([if pat_enabled is a function on X86])
3229         LB_LINUX_TRY_COMPILE([
3230 #if defined(CONFIG_X86)
3231                 #include <asm/pat.h>
3232 #else
3233                 #error "Not X86"
3234 #endif
3235         ],[
3236 #if defined(CONFIG_X86)
3237                 if (pat_enabled())
3238                         return 0;
3239 #endif
3240
3241                 return 0;
3242         ],[
3243                 AC_MSG_RESULT(yes)
3244                 AC_DEFINE(HAVE_PAT_ENABLED_FUNCTION_X86, 1,
3245                           [pat_enabled is a function])
3246         ],[
3247                 AC_MSG_RESULT(no)
3248         ])
3249
3250         AC_MSG_CHECKING([if include/net/switchdev.h exists])
3251         LB_LINUX_TRY_COMPILE([
3252                 #include <net/switchdev.h>
3253         ],[
3254                 return 0;
3255         ],[
3256                 AC_MSG_RESULT(yes)
3257                 AC_DEFINE(HAVE_NET_SWITCHDEV_H, 1,
3258                           [include/net/switchdev.h exists])
3259         ],[
3260                 AC_MSG_RESULT(no)
3261         ])
3262
3263         AC_MSG_CHECKING([if net_device_ops has ndo_udp_tunnel_add])
3264         LB_LINUX_TRY_COMPILE([
3265                 #include <linux/netdevice.h>
3266
3267                 void add_udp_tunnel(struct net_device *dev, struct udp_tunnel_info *ti)
3268                 {
3269                         return 0;
3270                 }
3271         ],[
3272                 struct net_device_ops netdev_ops;
3273                 netdev_ops.ndo_udp_tunnel_add = add_udp_tunnel;
3274
3275                 return 0;
3276         ],[
3277                 AC_MSG_RESULT(yes)
3278                 AC_DEFINE(HAVE_NDO_UDP_TUNNEL_ADD, 1,
3279                         [ndo_udp_tunnel_add is defined])
3280         ],[
3281                 AC_MSG_RESULT(no)
3282         ])
3283
3284         AC_MSG_CHECKING([if linux/netdev_features.h has tc offload feature])
3285         LB_LINUX_TRY_COMPILE([
3286                 #include <linux/netdevice.h>
3287         ],[
3288                 netdev_features_t hw_features = NETIF_F_HW_TC;
3289
3290                 return 0;
3291         ],[
3292                 AC_MSG_RESULT(yes)
3293                 AC_DEFINE(HAVE_TC_OFFLOAD, 1,
3294                           [tc offload is supported])
3295         ],[
3296                 AC_MSG_RESULT(no)
3297         ])
3298
3299         AC_MSG_CHECKING([if struct skbuff.h has skb_flow_dissect_flow_keys])
3300         LB_LINUX_TRY_COMPILE([
3301                 #include <linux/skbuff.h>
3302         ],[
3303                 skb_flow_dissect_flow_keys(NULL, NULL, 0);
3304
3305                 return 0;
3306         ],[
3307                 AC_MSG_RESULT(yes)
3308                 AC_DEFINE(HAVE_SKB_FLOW_DISSECT_FLOW_KEYS, 1,
3309                           [skb_flow_dissect_flow_keys is defined])
3310         ],[
3311                 AC_MSG_RESULT(no)
3312         ])
3313
3314         AC_MSG_CHECKING([if workqueue.h has __cancel_delayed_work])
3315         LB_LINUX_TRY_COMPILE([
3316                 #include <linux/workqueue.h>
3317         ],[
3318                 __cancel_delayed_work(NULL);
3319
3320                 return 0;
3321         ],[
3322                 AC_MSG_RESULT(yes)
3323                 AC_DEFINE(HAVE___CANCEL_DELAYED_WORK, 1,
3324                           [__cancel_delayed_work is defined])
3325         ],[
3326                 AC_MSG_RESULT(no)
3327         ])
3328
3329         AC_MSG_CHECKING([if struct ethtool_ops has get/set_priv_flags])
3330         LB_LINUX_TRY_COMPILE([
3331                 #include <linux/ethtool.h>
3332         ],[
3333                 const struct ethtool_ops en_ethtool_ops = {
3334                         .get_priv_flags = NULL,
3335                         .set_priv_flags = NULL,
3336                 };
3337
3338                 return 0;
3339         ],[
3340                 AC_MSG_RESULT(yes)
3341                 AC_DEFINE(HAVE_GET_SET_PRIV_FLAGS, 1,
3342                           [get/set_priv_flags is defined])
3343         ],[
3344                 AC_MSG_RESULT(no)
3345         ])
3346
3347         AC_MSG_CHECKING([if netdevice.h has netdev_get_num_tc])
3348         LB_LINUX_TRY_COMPILE([
3349                 #include <linux/netdevice.h>
3350         ],[
3351                 netdev_get_num_tc(NULL);
3352
3353                 return 0;
3354         ],[
3355                 AC_MSG_RESULT(yes)
3356                 AC_DEFINE(HAVE_NETDEV_GET_NUM_TC, 1,
3357                           [netdev_get_num_tc is defined])
3358         ],[
3359                 AC_MSG_RESULT(no)
3360         ])
3361
3362         AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_trust])
3363         LB_LINUX_TRY_COMPILE([
3364                 #include <linux/netdevice.h>
3365
3366                 int set_vf_trust(struct net_device *dev, int vf, bool setting)
3367                 {
3368                         return 0;
3369                 }
3370         ],[
3371                 struct net_device_ops netdev_ops;
3372
3373                 netdev_ops.ndo_set_vf_trust = set_vf_trust;
3374
3375                 return 0;
3376         ],[
3377                 AC_MSG_RESULT(yes)
3378                 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_TRUST, 1,
3379                           [ndo_set_vf_trust is defined in net_device_ops])
3380         ],[
3381                 AC_MSG_RESULT(no)
3382         ])
3383
3384         AC_MSG_CHECKING([if netdev_features.h has NETIF_F_HW_VLAN_STAG_RX])
3385         LB_LINUX_TRY_COMPILE([
3386                 #include <linux/netdev_features.h>
3387         ],[
3388                 netdev_features_t stag = NETIF_F_HW_VLAN_STAG_RX;
3389
3390                 return 0;
3391         ],[
3392                 AC_MSG_RESULT(yes)
3393                 AC_DEFINE(HAVE_NETIF_F_HW_VLAN_STAG_RX, 1,
3394                         [NETIF_F_HW_VLAN_STAG_RX is defined in netdev_features.h])
3395         ],[
3396                 AC_MSG_RESULT(no)
3397         ])
3398
3399         AC_MSG_CHECKING([if struct netdevice.h has NETIF_F_RXHASH])
3400         LB_LINUX_TRY_COMPILE([
3401                 #include <linux/netdevice.h>
3402         ],[
3403                 int x = NETIF_F_RXHASH;
3404
3405                 return 0;
3406         ],[
3407                 AC_MSG_RESULT(yes)
3408                 AC_DEFINE(HAVE_NETIF_F_RXHASH, 1,
3409                           [NETIF_F_RXHASH is defined in netdevice.h])
3410         ],[
3411                 AC_MSG_RESULT(no)
3412         ])
3413
3414         AC_MSG_CHECKING([if if_link.h has IFLA_VF_IB_NODE_PORT_GUID])
3415         LB_LINUX_TRY_COMPILE([
3416                 #include <linux/if_link.h>
3417         ],[
3418                 int type = IFLA_VF_IB_NODE_GUID;
3419
3420                 type = IFLA_VF_IB_PORT_GUID;
3421
3422                 return 0;
3423         ],[
3424                 AC_MSG_RESULT(yes)
3425                 AC_DEFINE(HAVE_IFLA_VF_IB_NODE_PORT_GUID, 1,
3426                           [trust is defined])
3427         ],[
3428                 AC_MSG_RESULT(no)
3429         ])
3430
3431         AC_MSG_CHECKING([if skbuff.h skb_shared_info has UNION tx_flags])
3432         LB_LINUX_TRY_COMPILE([
3433                 #include <linux/skbuff.h>
3434         ],[
3435                 struct skb_shared_info x;
3436                 x.tx_flags.flags = 0;
3437
3438                 return 0;
3439         ],[
3440                 AC_MSG_RESULT(yes)
3441                 AC_DEFINE(HAVE_SKB_SHARED_INFO_UNION_TX_FLAGS, 1,
3442                           [skb_shared_info has union tx_flags])
3443         ],[
3444                 AC_MSG_RESULT(no)
3445         ])
3446
3447         AC_MSG_CHECKING([if nelems is atomic_t in struct rhashtable])
3448         LB_LINUX_TRY_COMPILE([
3449                 #include <linux/atomic.h>
3450                 #include <linux/poison.h>
3451                 #include <linux/rhashtable.h>
3452         ],[
3453                 struct rhashtable *ht;
3454                 atomic_read(&ht->nelems);
3455
3456                 return 0;
3457         ],[
3458                 AC_MSG_RESULT(yes)
3459                 AC_DEFINE(HAVE_RHASHTABLE_NELEMS_ATOMIC_T, 1,
3460                           [nelems is atomic_t in struct rhashtable])
3461         ],[
3462                 AC_MSG_RESULT(no)
3463         ])
3464
3465         LB_CHECK_SYMBOL_EXPORT([pat_enabled],
3466                 [arch/x86/mm/pat.c],
3467                 [AC_DEFINE(HAVE_PAT_ENABLED_EXPORTED, 1,
3468                         [pat_enabled is exported by the kernel])],
3469         [])
3470
3471         LB_CHECK_SYMBOL_EXPORT([xprt_put],
3472                 [net/sunrpc/xprt.c],
3473                 [AC_DEFINE(HAVE_XPRT_PUT_EXPORTED, 1,
3474                         [xprt_put is exported by the kernel])],
3475         [])
3476
3477         AC_MSG_CHECKING([if configfs.h default_groups is list_head])
3478         LB_LINUX_TRY_COMPILE([
3479                 #include <linux/configfs.h>
3480         ],[
3481                 struct config_group x = {
3482                         .group_entry = NULL,
3483                 };
3484
3485                 return 0;
3486         ],[
3487                 AC_MSG_RESULT(yes)
3488                 AC_DEFINE(HAVE_CONFIGFS_DEFAULT_GROUPS_LIST, 1,
3489                           [default_groups is list_head])
3490         ],[
3491                 AC_MSG_RESULT(no)
3492         ])
3493
3494         AC_MSG_CHECKING([if ethtool.h enum ethtool_link_mode_bit_indices has ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT])
3495         LB_LINUX_TRY_COMPILE([
3496                 #include <uapi/linux/ethtool.h>
3497         ],[
3498                 enum ethtool_link_mode_bit_indices x = ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT;
3499
3500                 return 0;
3501         ],[
3502                 AC_MSG_RESULT(yes)
3503                 AC_DEFINE(HAVE_ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT, 1,
3504                           [ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT is defined])
3505         ],[
3506                 AC_MSG_RESULT(no)
3507         ])
3508
3509         AC_MSG_CHECKING([if include/net/flow_dissector.h exists])
3510         LB_LINUX_TRY_COMPILE([
3511                 #include <net/flow_dissector.h>
3512         ],[
3513                 return 0;
3514         ],[
3515                 AC_MSG_RESULT(yes)
3516                 AC_DEFINE(HAVE_NET_FLOW_DISSECTOR_H, 1,
3517                           [include/net/flow_dissector.h exists])
3518         ],[
3519                 AC_MSG_RESULT(no)
3520         ])
3521
3522         AC_MSG_CHECKING([if include/linux/dcache.h has d_inode])
3523         LB_LINUX_TRY_COMPILE([
3524                 #include <linux/dcache.h>
3525         ],[
3526                 struct inode *inode = d_inode(NULL);
3527
3528                 return 0;
3529         ],[
3530                 AC_MSG_RESULT(yes)
3531                 AC_DEFINE(HAVE_D_INODE, 1,
3532                         [d_inode is defined in dcache.h])
3533         ],[
3534                 AC_MSG_RESULT(no)
3535         ])
3536
3537         AC_MSG_CHECKING([if net/pkt_cls.h has tcf_exts_to_list])
3538         LB_LINUX_TRY_COMPILE([
3539                 #include <net/pkt_cls.h>
3540         ],[
3541                 tcf_exts_to_list(NULL, NULL);
3542
3543                 return 0;
3544         ],[
3545                 AC_MSG_RESULT(yes)
3546                 AC_DEFINE(HAVE_TCF_EXTS_TO_LIST, 1,
3547                           [tcf_exts_to_list is defined])
3548         ],[
3549                 AC_MSG_RESULT(no)
3550         ])
3551
3552         AC_MSG_CHECKING([if net/act_api.h has tcf_action_stats_update])
3553         LB_LINUX_TRY_COMPILE([
3554                 #include <net/act_api.h>
3555         ],[
3556                 tcf_action_stats_update(NULL, 0, 0, 0);
3557
3558                 return 0;
3559         ],[
3560                 AC_MSG_RESULT(yes)
3561                 AC_DEFINE(HAVE_TCF_ACTION_STATS_UPDATE, 1,
3562                           [tcf_action_stats_update is defined])
3563         ],[
3564                 AC_MSG_RESULT(no)
3565         ])
3566
3567         AC_MSG_CHECKING([if net/tc_act/tc_mirred.h has is_tcf_mirred_redirect])
3568         LB_LINUX_TRY_COMPILE([
3569                 #include <net/tc_act/tc_mirred.h>
3570         ],[
3571                 is_tcf_mirred_redirect(NULL, 0, 0, 0);
3572
3573                 return 0;
3574         ],[
3575                 AC_MSG_RESULT(yes)
3576                 AC_DEFINE(HAVE_IS_TCF_MIRRED_REDIRECT, 1,
3577                           [is_tcf_mirred_redirect is defined])
3578         ],[
3579                 AC_MSG_RESULT(no)
3580         ])
3581
3582         AC_MSG_CHECKING([if net/tc_act/tc_mirred.h has tcf_mirred_dev])
3583         LB_LINUX_TRY_COMPILE([
3584                 #include <net/tc_act/tc_mirred.h>
3585         ],[
3586                 tcf_mirred_dev(NULL);
3587
3588                 return 0;
3589         ],[
3590                 AC_MSG_RESULT(yes)
3591                 AC_DEFINE(HAVE_TCF_MIRRED_DEV, 1,
3592                           [tcf_mirred_dev is defined])
3593         ],[
3594                 AC_MSG_RESULT(no)
3595         ])
3596
3597         AC_MSG_CHECKING([if enum tc_fl_command has TC_CLSFLOWER_STATS])
3598         LB_LINUX_TRY_COMPILE([
3599                 #include <net/pkt_cls.h>
3600         ],[
3601                 enum tc_fl_command x = TC_CLSFLOWER_STATS;
3602
3603                 return 0;
3604         ],[
3605                 AC_MSG_RESULT(yes)
3606                 AC_DEFINE(HAVE_TC_CLSFLOWER_STATS, 1,
3607                           [TC_CLSFLOWER_STATS is defined])
3608         ],[
3609                 AC_MSG_RESULT(no)
3610         ])
3611
3612         AC_MSG_CHECKING([if time64.h has ns_to_timespec64])
3613         LB_LINUX_TRY_COMPILE([
3614                 #include <linux/clocksource.h>
3615                 #include <linux/time64.h>
3616         ],[
3617                 ns_to_timespec64(0);
3618
3619                 return 0;
3620         ],[
3621                 AC_MSG_RESULT(yes)
3622                 AC_DEFINE(HAVE_NS_TO_TIMESPACE64, 1,
3623                           [ns_to_timespec64 is defined])
3624         ],[
3625                 AC_MSG_RESULT(no)
3626         ])
3627
3628         AC_MSG_CHECKING([if struct ptp_clock_info exists])
3629         LB_LINUX_TRY_COMPILE([
3630                 #include <linux/ptp_clock_kernel.h>
3631         ],[
3632                 struct ptp_clock_info info;
3633
3634                 return 0;
3635         ],[
3636                 AC_MSG_RESULT(yes)
3637                 AC_DEFINE(HAVE_PTP_CLOCK_INFO, 1,
3638                           [ptp_clock_info is defined])
3639         ],[
3640                 AC_MSG_RESULT(no)
3641         ])
3642
3643         AC_MSG_CHECKING([if struct ptp_clock_info has gettime])
3644         LB_LINUX_TRY_COMPILE([
3645                 #include <linux/ptp_clock_kernel.h>
3646         ],[
3647                 struct ptp_clock_info info = {
3648                         .gettime = NULL,
3649                 };
3650
3651                 return 0;
3652         ],[
3653                 AC_MSG_RESULT(yes)
3654                 AC_DEFINE(HAVE_PTP_CLOCK_INFO_GETTIME_32BIT, 1,
3655                           [gettime 32bit is defined])
3656         ],[
3657                 AC_MSG_RESULT(no)
3658         ])
3659
3660         AC_MSG_CHECKING([if ethtool.h has get_module_eeprom])
3661         LB_LINUX_TRY_COMPILE([
3662                 #include <linux/ethtool.h>
3663         ],[
3664                 struct ethtool_ops x = {
3665                         .get_module_eeprom = NULL,
3666                 };
3667
3668                 return 0;
3669         ],[
3670                 AC_MSG_RESULT(yes)
3671                 AC_DEFINE(HAVE_GET_MODULE_EEPROM, 1,
3672                           [HAVE_GET_MODULE_EEPROM is defined])
3673         ],[
3674                 AC_MSG_RESULT(no)
3675         ])
3676
3677         AC_MSG_CHECKING([if ethtool.h has get_module_eeprom])
3678         LB_LINUX_TRY_COMPILE([
3679                 #include <linux/ethtool.h>
3680         ],[
3681                 struct ethtool_ops_ext x = {
3682                         .get_module_eeprom = NULL,
3683                 };
3684
3685                 return 0;
3686         ],[
3687                 AC_MSG_RESULT(yes)
3688                 AC_DEFINE(HAVE_GET_MODULE_EEPROM_EXT, 1,
3689                         [HAVE_GET_MODULE_EEPROM_EXT is defined])
3690         ],[
3691                 AC_MSG_RESULT(no)
3692         ])
3693
3694         AC_MSG_CHECKING([if netdevice.h has napi_complete_done])
3695         LB_LINUX_TRY_COMPILE([
3696                 #include <linux/netdevice.h>
3697         ],[
3698                 napi_complete_done(NULL, 0);
3699
3700                 return 0;
3701         ],[
3702                 AC_MSG_RESULT(yes)
3703                 AC_DEFINE(HAVE_NAPI_COMPLETE_DONE, 1,
3704                           [napi_complete_done is defined])
3705         ],[
3706                 AC_MSG_RESULT(no)
3707         ])
3708
3709         AC_MSG_CHECKING([if ethtool_ext has set_phys_id])
3710         LB_LINUX_TRY_COMPILE([
3711                 #include <linux/ethtool.h>
3712         ],[
3713                 const struct ethtool_ops_ext en_ethtool_ops_ext = {
3714                         .set_phys_id = NULL,
3715                 };
3716
3717                 return 0;
3718         ],[
3719                 AC_MSG_RESULT(yes)
3720                 AC_DEFINE(HAVE_SET_PHYS_ID_EXT, 1,
3721                           [set_phys_id is defined in ethtool_ops_ext])
3722         ],[
3723                 AC_MSG_RESULT(no)
3724         ])
3725
3726         AC_MSG_CHECKING([if struct tc_cls_flower_offload exists])
3727         LB_LINUX_TRY_COMPILE([
3728                 #include <net/pkt_cls.h>
3729         ],[
3730                 struct tc_cls_flower_offload x;
3731                 x = x;
3732
3733                 return 0;
3734         ],[
3735                 AC_MSG_RESULT(yes)
3736                 AC_DEFINE(HAVE_TC_FLOWER_OFFLOAD, 1,
3737                           [struct tc_cls_flower_offload is defined])
3738         ],[
3739                 AC_MSG_RESULT(no)
3740         ])
3741
3742         AC_MSG_CHECKING([if if_vlan.h has vlan_features_check])
3743         LB_LINUX_TRY_COMPILE([
3744                 #include <linux/if_vlan.h>
3745         ],[
3746                 vlan_features_check(NULL, 0);
3747
3748                 return 0;
3749         ],[
3750                 AC_MSG_RESULT(yes)
3751                 AC_DEFINE(HAVE_VLAN_FEATURES_CHECK, 1,
3752                           [vlan_features_check is defined])
3753         ],[
3754                 AC_MSG_RESULT(no)
3755         ])
3756
3757         AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_iflink])
3758         LB_LINUX_TRY_COMPILE([
3759                 #include <linux/netdevice.h>
3760         ],[
3761                 struct net_device_ops x = {
3762                         .ndo_get_iflink = NULL,
3763                 };
3764
3765                 return 0;
3766         ],[
3767                 AC_MSG_RESULT(yes)
3768                 AC_DEFINE(HAVE_NDO_GET_IFLINK, 1,
3769                           [ndo_get_iflink is defined])
3770         ],[
3771                 AC_MSG_RESULT(no)
3772         ])
3773
3774         AC_MSG_CHECKING([if if_vlan.h has __vlan_get_protocol])
3775         LB_LINUX_TRY_COMPILE([
3776                 #include <linux/if_vlan.h>
3777         ],[
3778                 __vlan_get_protocol(NULL, 0, NULL);
3779
3780                 return 0;
3781         ],[
3782                 AC_MSG_RESULT(yes)
3783                 AC_DEFINE(HAVE_VLAN_GET_PROTOCOL, 1,
3784                           [__vlan_get_protocol defined])
3785         ],[
3786                 AC_MSG_RESULT(no)
3787         ])
3788
3789         AC_MSG_CHECKING([if if_vlan.h has skb_vlan_tagged])
3790         LB_LINUX_TRY_COMPILE([
3791                 #include <linux/if_vlan.h>
3792         ],[
3793                 skb_vlan_tagged(NULL);
3794
3795                 return 0;
3796         ],[
3797                 AC_MSG_RESULT(yes)
3798                 AC_DEFINE(HAVE_SKB_VLAN_TAGGED, 1,
3799                           [skb_vlan_tagged defined])
3800         ],[
3801                 AC_MSG_RESULT(no)
3802         ])
3803
3804         AC_MSG_CHECKING([if netdevice.h has netdev_notifier_changeupper_info])
3805         LB_LINUX_TRY_COMPILE([
3806                 #include <linux/netdevice.h>
3807         ],[
3808                 struct netdev_notifier_changeupper_info info;
3809
3810                 info.master = 1;
3811                 return 0;
3812         ],[
3813                 AC_MSG_RESULT(yes)
3814                 AC_DEFINE(HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO, 1,
3815                           [netdev_notifier_changeupper_info is defined])
3816         ],[
3817                 AC_MSG_RESULT(no)
3818         ])
3819
3820         AC_MSG_CHECKING([if blk-mq.h has blk_mq_unique_tag])
3821         LB_LINUX_TRY_COMPILE([
3822                 #include <blk-mq.h>
3823         ],[
3824                 blk_mq_unique_tag(NULL);
3825
3826                 return 0;
3827         ],[
3828                 AC_MSG_RESULT(yes)
3829                 AC_DEFINE(HAVE_BLK_MQ_UNIQUE_TAG, 1,
3830                                 [blk_mq_unique_tag exist])
3831         ],[
3832                 AC_MSG_RESULT(no)
3833         ])
3834
3835         AC_MSG_CHECKING([if blk_queue_virt_boundary exist])
3836         LB_LINUX_TRY_COMPILE([
3837                 #include <linux/blkdev.h>
3838         ],[
3839                 blk_queue_virt_boundary(NULL, 0);
3840                 return 0;
3841         ],[
3842                 AC_MSG_RESULT(yes)
3843                 AC_DEFINE(HAVE_BLK_QUEUE_VIRT_BOUNDARY, 1,
3844                                 [blk_queue_virt_boundary exist])
3845         ],[
3846                 AC_MSG_RESULT(no)
3847         ])
3848
3849         AC_MSG_CHECKING([if scsi_device.h has scsi_change_queue_depth])
3850         LB_LINUX_TRY_COMPILE([
3851                 #include <scsi/scsi_device.h>
3852         ],[
3853                 scsi_change_queue_depth(NULL, 0);
3854                 return 0;
3855         ],[
3856                 AC_MSG_RESULT(yes)
3857                 AC_DEFINE(HAVE_SCSCI_CHANGE_QUEUE_DEPTH, 1,
3858                         [scsi_change_queue_depth exist])
3859         ],[
3860                 AC_MSG_RESULT(no)
3861         ])
3862
3863         AC_MSG_CHECKING([if scsi_host.h struct Scsi_Host has member nr_hw_queues])
3864         LB_LINUX_TRY_COMPILE([
3865                 #include <scsi/scsi_host.h>
3866         ],[
3867                 struct Scsi_Host sh = {
3868                         .nr_hw_queues = 0,
3869                 };
3870
3871                 return 0;
3872         ],[
3873                 AC_MSG_RESULT(yes)
3874                 AC_DEFINE(HAVE_SCSI_HOST_NR_HW_QUEUES, 1,
3875                                 [Scsi_Host has members nr_hw_queues])
3876         ],[
3877                 AC_MSG_RESULT(no)
3878         ])
3879
3880         AC_MSG_CHECKING([if scsi_host.h struct scsi_host_template has member track_queue_depth])
3881         LB_LINUX_TRY_COMPILE([
3882                 #include <scsi/scsi_host.h>
3883         ],[
3884                 struct scsi_host_template sh = {
3885                         .track_queue_depth = 0,
3886                 };
3887                 return 0;
3888         ],[
3889                 AC_MSG_RESULT(yes)
3890                 AC_DEFINE(HAVE_SCSI_HOST_TEMPLATE_TRACK_QUEUE_DEPTH, 1,
3891                         [scsi_host_template has members track_queue_depth])
3892         ],[
3893                 AC_MSG_RESULT(no)
3894         ])
3895
3896         AC_MSG_CHECKING([if scsi_device.h has SCSI_SCAN_INITIAL])
3897         LB_LINUX_TRY_COMPILE([
3898                 #include <scsi/scsi_device.h>
3899         ],[
3900                 int x = SCSI_SCAN_INITIAL;
3901
3902                 return 0;
3903         ],[
3904                 AC_MSG_RESULT(yes)
3905                 AC_DEFINE(HAVE_SCSI_SCAN_INITIAL, 1,
3906                           [SCSI_SCAN_INITIAL is defined])
3907         ],[
3908                 AC_MSG_RESULT(no)
3909         ])
3910
3911         AC_MSG_CHECKING([if scsi.h has SG_MAX_SEGMENTS])
3912         LB_LINUX_TRY_COMPILE([
3913                 #include <scsi/scsi.h>
3914         ],[
3915                 int x = SG_MAX_SEGMENTS;
3916
3917                 return 0;
3918         ],[
3919                 AC_MSG_RESULT(yes)
3920                 AC_DEFINE(HAVE_SG_MAX_SEGMENTS, 1,
3921                           [SG_MAX_SEGMENTS is defined])
3922         ],[
3923                 AC_MSG_RESULT(no)
3924         ])
3925
3926         AC_MSG_CHECKING([if struct file_operations has write_iter])
3927         LB_LINUX_TRY_COMPILE([
3928                 #include <linux/fs.h>
3929         ],[
3930                 const struct file_operations fo = {
3931                         .write_iter = NULL,
3932                 };
3933
3934                 return 0;
3935         ],[
3936                 AC_MSG_RESULT(yes)
3937                 AC_DEFINE(HAVE_FILE_OPS_WRITE_ITER, 1,
3938                         [write_iter is defined])
3939         ],[
3940                 AC_MSG_RESULT(no)
3941         ])
3942
3943         AC_MSG_CHECKING([if linux/fs.h has inode_lock])
3944         LB_LINUX_TRY_COMPILE([
3945                 #include <linux/fs.h>
3946         ],[
3947                 inode_lock(NULL);
3948
3949                 return 0;
3950         ],[
3951                 AC_MSG_RESULT(yes)
3952                 AC_DEFINE(HAVE_INODE_LOCK, 1,
3953                         [inode_lock is defined in fs.h])
3954         ],[
3955                 AC_MSG_RESULT(no)
3956         ])
3957
3958         AC_MSG_CHECKING([if linux/dcache.h has simple_positive])
3959         LB_LINUX_TRY_COMPILE([
3960                 #include <linux/dcache.h>
3961         ],[
3962                 int i = simple_positive(NULL);
3963
3964                 return 0;
3965         ],[