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