1 dnl Checks for the in-box ib_core
2 AC_DEFUN([RDMA_CONFIG_COMPAT],
4 AC_MSG_CHECKING([if ib_verbs has ib_dma_map_single])
6 #include <linux/version.h>
9 #include <rdma/ib_verbs.h>
11 ib_dma_map_single(NULL, NULL, 0, 0);
15 AC_DEFINE(HAVE_INBOX_IB_DMA_MAP, 1,
16 [ib_dma_map_single defined])
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>
28 ib_create_cq(NULL, NULL, NULL, NULL, 0, 0);
32 AC_DEFINE(HAVE_INBOX_IB_COMP_VECTOR, 1,
33 [has completion vector])
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>
45 return (RDMA_CM_EVENT_ADDR_CHANGE == 0);
48 AC_DEFINE(HAVE_INBOX_RDMA_CMEV_ADDRCHANGE, 1,
49 [has completion vector])
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>
61 return (RDMA_CM_EVENT_TIMEWAIT_EXIT == 0);
64 AC_DEFINE(HAVE_INBOX_RDMA_CMEV_TIMEWAIT_EXIT, 1,
65 [has completion vector])
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>
77 rdma_set_reuseaddr(NULL, 1);
81 AC_DEFINE(HAVE_INBOX_RDMA_SET_REUSEADDR, 1,
82 [rdma_set_reuse defined])
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>
98 AC_DEFINE(HAVE_INBOX_IB_WC_TS, 1,
99 [ib_wc has member named ts])
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>
109 struct ib_ah_attr *ah_attr;
110 memset(ah_attr->dmac, 0, 6);
115 AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_DMAC, 1,
116 [ah_attr has member named dmac])
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>
126 struct ib_ah_attr *ah_attr;
127 ah_attr->vlan_id = 0;
132 AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_VLAN_ID, 1,
133 [ah_attr has member named vlan_id])
139 dnl Examine kernel functionality
140 AC_DEFUN([LINUX_CONFIG_COMPAT],
142 AC_MSG_CHECKING([if kernel has ktime_get_ns])
143 LB_LINUX_TRY_COMPILE([
144 #include <linux/ktime.h>
146 unsigned long long ns;
152 AC_DEFINE(HAVE_KTIME_GET_NS, 1,
153 [ktime_get_ns defined])
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>
163 struct svc_xprt_class svc_rdma_class = {
164 .xcl_ident = XPRT_TRANSPORT_RDMA,
169 AC_DEFINE(HAVE_XCL_IDENT, 1,
175 AC_MSG_CHECKING([if struct ifla_vf_info has max_tx_rate])
176 LB_LINUX_TRY_COMPILE([
177 #include <linux/if_link.h>
179 struct ifla_vf_info *ivf;
181 ivf->max_tx_rate = 0;
182 ivf->min_tx_rate = 0;
187 AC_DEFINE(HAVE_TX_RATE_LIMIT, 1,
188 [max_tx_rate is defined])
193 AC_MSG_CHECKING([if struct ethtool_ops has get/set_rxfh])
194 LB_LINUX_TRY_COMPILE([
195 #include <linux/ethtool.h>
197 const struct ethtool_ops en_ethtool_ops = {
198 .get_rxfh_indir_size = NULL,
206 AC_DEFINE(HAVE_GET_SET_RXFH, 1,
207 [get/set_rxfh is defined])
213 AC_MSG_CHECKING([if struct ethtool_ops has get/set_tunable])
214 LB_LINUX_TRY_COMPILE([
215 #include <linux/ethtool.h>
217 const struct ethtool_ops en_ethtool_ops = {
225 AC_DEFINE(HAVE_GET_SET_TUNABLE, 1,
226 [get/set_tunable is defined])
231 AC_MSG_CHECKING([if exist struct ethtool_ops_ext])
232 LB_LINUX_TRY_COMPILE([
233 #include <linux/ethtool.h>
235 const struct ethtool_ops_ext en_ethtool_ops_ext = {
236 .size = sizeof(struct ethtool_ops_ext),
242 AC_DEFINE(HAVE_ETHTOOL_OPS_EXT, 1,
243 [struct ethtool_ops_ext is defined])
248 AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_rxfh])
249 LB_LINUX_TRY_COMPILE([
250 #include <linux/ethtool.h>
252 const struct ethtool_ops_ext en_ethtool_ops_ext = {
253 .get_rxfh_indir_size = NULL,
261 AC_DEFINE(HAVE_GET_SET_RXFH_OPS_EXT, 1,
262 [get/set_rxfh is defined])
267 AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_rxfh_indir])
268 LB_LINUX_TRY_COMPILE([
269 #include <linux/ethtool.h>
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,
280 AC_DEFINE(HAVE_GET_SET_RXFH_INDIR, 1,
281 [get/set_rxfh_indir is defined])
286 AC_MSG_CHECKING([if struct net_device has dev_port])
287 LB_LINUX_TRY_COMPILE([
288 #include <linux/netdevice.h>
290 struct net_device *dev = NULL;
297 AC_DEFINE(HAVE_NET_DEVICE_DEV_PORT, 1,
298 [dev_port is defined])
303 AC_MSG_CHECKING([if struct ptp_clock_info has n_pins])
304 LB_LINUX_TRY_COMPILE([
305 #include <linux/ptp_clock_kernel.h>
307 struct ptp_clock_info *info;
313 AC_DEFINE(HAVE_PTP_CLOCK_INFO_N_PINS, 1,
319 AC_MSG_CHECKING([if pci.h pci_enable_msi_exact])
320 LB_LINUX_TRY_COMPILE([
321 #include <linux/pci.h>
323 int x = pci_enable_msi_exact(NULL, 0);
328 AC_DEFINE(HAVE_PCI_ENABLE_MSI_EXACT, 1,
329 [pci_enable_msi_exact is defined])
334 AC_MSG_CHECKING([if pci.h pci_enable_msix_range])
335 LB_LINUX_TRY_COMPILE([
336 #include <linux/pci.h>
338 int x = pci_enable_msix_range(NULL, 0, 0, 0);
343 AC_DEFINE(HAVE_PCI_ENABLE_MSIX_RANGE, 1,
344 [pci_enable_msix_range is defined])
349 AC_MSG_CHECKING([if struct iscsi_transport has check_protection])
350 LB_LINUX_TRY_COMPILE([
351 #include <scsi/scsi_transport_iscsi.h>
353 static struct iscsi_transport iscsi_iser_transport = {
354 .check_protection = NULL,
360 AC_DEFINE(HAVE_ISCSI_CHECK_PROTECTION, 1,
361 [check_protection is defined])
366 AC_MSG_CHECKING([if netdevice.h has select_queue_fallback_t])
367 LB_LINUX_TRY_COMPILE([
368 #include <linux/netdevice.h>
370 select_queue_fallback_t fallback;
377 AC_DEFINE(HAVE_SELECT_QUEUE_FALLBACK_T, 1,
378 [select_queue_fallback_t is defined])
383 AC_MSG_CHECKING([if skbuff.h has skb_set_hash])
384 LB_LINUX_TRY_COMPILE([
385 #include <linux/netdevice.h>
387 skb_set_hash(NULL, 0, PKT_HASH_TYPE_L3);
392 AC_DEFINE(HAVE_SKB_SET_HASH, 1,
393 [skb_set_hash is defined])
398 AC_MSG_CHECKING([if sockios.h has SIOCGHWTSTAMP])
399 LB_LINUX_TRY_COMPILE([
400 #include <linux/sockios.h>
402 int x = SIOCGHWTSTAMP;
407 AC_DEFINE(HAVE_SIOCGHWTSTAMP, 1,
408 [SIOCGHWTSTAMP is defined])
413 AC_MSG_CHECKING([if ip.h inet_get_local_port_range has 3 parameters])
414 LB_LINUX_TRY_COMPILE([
417 inet_get_local_port_range(NULL, NULL, NULL);
422 AC_DEFINE(HAVE_INET_GET_LOCAL_PORT_RANGE_3_PARAMS, 1,
423 [inet_get_local_port_range has 3 parameters])
428 AC_MSG_CHECKING([if net.h has net_get_random_once])
429 LB_LINUX_TRY_COMPILE([
430 #include <linux/net.h>
432 net_get_random_once(NULL, 0);
437 AC_DEFINE(HAVE_NET_GET_RANDOM_ONCE, 1,
438 [net_get_random_once is defined])
443 AC_MSG_CHECKING([if inet_sock.h has __inet_ehashfn])
444 LB_LINUX_TRY_COMPILE([
445 #include <net/inet_sock.h>
447 __inet_ehashfn(0, 0, 0, 0, 0);
452 AC_DEFINE(HAVE_INET_EHASHFN, 1,
453 [__inet_ehashfn is defined])
458 AC_MSG_CHECKING([if err.h has PTR_ERR_OR_ZERO])
459 LB_LINUX_TRY_COMPILE([
460 #include <linux/err.h>
462 int x = PTR_ERR_OR_ZERO(NULL);
467 AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
468 [PTR_ERR_OR_ZERO is defined])
473 AC_MSG_CHECKING([if struct iscsi_session has discovery_sess])
474 LB_LINUX_TRY_COMPILE([
475 #include <scsi/libiscsi.h>
477 struct iscsi_session session;
478 session.discovery_sess = 0;
483 AC_DEFINE(HAVE_ISCSI_DISCOVERY_SESS, 1,
484 [discovery_sess is defined])
489 AC_MSG_CHECKING([if enum iscsi_param has ISCSI_PARAM_DISCOVERY_SESS])
490 LB_LINUX_TRY_COMPILE([
491 #include <scsi/iscsi_if.h>
493 int x = ISCSI_PARAM_DISCOVERY_SESS;
498 AC_DEFINE(HAVE_ISCSI_PARAM_DISCOVERY_SESS, 1,
499 [ISCSI_PARAM_DISCOVERY_SESS is defined])
504 AC_MSG_CHECKING([if pci.h has enum pcie_link_width])
505 LB_LINUX_TRY_COMPILE([
506 #include <linux/pci.h>
508 enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
513 AC_DEFINE(HAVE_PCIE_LINK_WIDTH, 1,
514 [pcie_link_width is defined])
519 AC_MSG_CHECKING([if pci.h has enum pci_bus_speed])
520 LB_LINUX_TRY_COMPILE([
521 #include <linux/pci.h>
523 enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
528 AC_DEFINE(HAVE_PCI_BUS_SPEED, 1,
529 [pci_bus_speed is defined])
534 AC_MSG_CHECKING([if netdevice.h has struct netdev_phys_port_id])
535 LB_LINUX_TRY_COMPILE([
536 #include <linux/netdevice.h>
538 struct netdev_phys_port_id *x = NULL;
543 AC_DEFINE(HAVE_NETDEV_PHYS_PORT_ID, 1,
544 [netdev_phys_port_id is defined])
549 AC_MSG_CHECKING([if struct ifla_vf_info has linkstate])
550 LB_LINUX_TRY_COMPILE([
551 #include <linux/if_link.h>
553 struct struct ifla_vf_info x;
559 AC_DEFINE(HAVE_LINKSTATE, 1,
560 [linkstate is defined])
565 AC_MSG_CHECKING([if busy_poll.h has skb_mark_napi_id])
566 LB_LINUX_TRY_COMPILE([
567 #include <net/busy_poll.h>
569 skb_mark_napi_id(NULL, NULL);
574 AC_DEFINE(HAVE_SKB_MARK_NAPI_ID, 1,
575 [skb_mark_napi_id is defined])
580 AC_MSG_CHECKING([if netdevice.h has napi_hash_add])
581 LB_LINUX_TRY_COMPILE([
582 #include <linux/netdevice.h>
589 AC_DEFINE(HAVE_NAPI_HASH_ADD, 1,
590 [napi_hash_add is defined])
595 AC_MSG_CHECKING([if netdevice.h has netif_keep_dst])
596 LB_LINUX_TRY_COMPILE([
597 #include <linux/netdevice.h>
599 netif_keep_dst(NULL);
604 AC_DEFINE(HAVE_NETIF_KEEP_DST, 1,
605 [netif_keep_dst is defined])
610 AC_MSG_CHECKING([if mm.h has kvfree])
611 LB_LINUX_TRY_COMPILE([
612 #include <linux/mm.h>
619 AC_DEFINE(HAVE_KVFREE, 1,
625 AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any])
626 LB_LINUX_TRY_COMPILE([
627 #include <linux/netdevice.h>
629 dev_consume_skb_any(NULL);
634 AC_DEFINE(HAVE_DEV_CONSUME_SKB_ANY, 1,
635 [dev_consume_skb_any is defined])
640 AC_MSG_CHECKING([if netdevice.h has netdev_txq_bql_complete_prefetchw])
641 LB_LINUX_TRY_COMPILE([
642 #include <linux/netdevice.h>
644 netdev_txq_bql_complete_prefetchw(NULL);
645 netdev_txq_bql_enqueue_prefetchw(NULL);
650 AC_DEFINE(HAVE_NETDEV_TXQ_BQL_PREFETCHW, 1,
651 [netdev_txq_bql_complete_prefetchw is defined])
656 AC_MSG_CHECKING([if struct sk_buff has xmit_more])
657 LB_LINUX_TRY_COMPILE([
658 #include <linux/skbuff.h>
666 AC_DEFINE(HAVE_SK_BUFF_XMIT_MORE, 1,
667 [xmit_more is defined])
672 AC_MSG_CHECKING([if struct sk_buff has encapsulation])
673 LB_LINUX_TRY_COMPILE([
674 #include <linux/skbuff.h>
677 skb->encapsulation = 0;
682 AC_DEFINE(HAVE_SK_BUFF_ENCAPSULATION, 1,
683 [encapsulation is defined])
688 AC_MSG_CHECKING([if etherdevice.h has eth_get_headlen])
689 LB_LINUX_TRY_COMPILE([
690 #include <linux/etherdevice.h>
692 eth_get_headlen(NULL, 0);
697 AC_DEFINE(HAVE_ETH_GET_HEADLEN, 1,
698 [eth_get_headlen is defined])
703 AC_MSG_CHECKING([if struct sk_buff has csum_level])
704 LB_LINUX_TRY_COMPILE([
705 #include <linux/skbuff.h>
713 AC_DEFINE(HAVE_SK_BUFF_CSUM_LEVEL, 1,
714 [csum_level is defined])
719 AC_MSG_CHECKING([if struct skbuff.h has skb_inner_transport_header])
720 LB_LINUX_TRY_COMPILE([
721 #include <linux/skbuff.h>
723 skb_inner_transport_header(NULL);
728 AC_DEFINE(HAVE_SKB_INNER_TRANSPORT_HEADER, 1,
729 [skb_inner_transport_header is defined])
734 AC_MSG_CHECKING([if struct skbuff.h has skb_inner_network_header])
735 LB_LINUX_TRY_COMPILE([
736 #include <linux/skbuff.h>
738 skb_inner_network_header(NULL);
743 AC_DEFINE(HAVE_SKB_INNER_NETWORK_HEADER, 1,
744 [skb_inner_network_header is defined])
749 AC_MSG_CHECKING([if if_vlan.h has vlan_dev_get_egress_qos_mask])
750 LB_LINUX_TRY_COMPILE([
751 #include <linux/if_vlan.h>
753 vlan_dev_get_egress_qos_mask(NULL, 0);
758 AC_DEFINE(HAVE_VLAN_DEV_GET_EGRESS_QOS_MASK, 1,
759 [vlan_dev_get_egress_qos_mask is defined])
764 AC_MSG_CHECKING([if netdevice.h has netdev_get_prio_tc_map])
765 LB_LINUX_TRY_COMPILE([
766 #include <linux/netdevice.h>
768 netdev_get_prio_tc_map(NULL, 0);
773 AC_DEFINE(HAVE_NETDEV_GET_PRIO_TC_MAP, 1,
774 [netdev_get_prio_tc_map is defined])
779 AC_MSG_CHECKING([if if_vlan.h has __vlan_find_dev_deep_rcu])
780 LB_LINUX_TRY_COMPILE([
781 #include <linux/if_vlan.h>
783 __vlan_find_dev_deep_rcu(NULL, 0, 0);
788 AC_DEFINE(HAVE___VLAN_FIND_DEV_DEEP_RCU, 1,
789 [__vlan_find_dev_deep_rcu is defined])
794 AC_MSG_CHECKING([if ndo_select_queue has accel_priv])
795 LB_LINUX_TRY_COMPILE([
796 #include <linux/netdevice.h>
798 static u16 select_queue(struct net_device *dev, struct sk_buff *skb,
804 struct net_device_opts ndops;
806 ndops.ndo_select_queue = select_queue;
811 AC_DEFINE(NDO_SELECT_QUEUE_HAS_ACCEL_PRIV, 1,
812 [ndo_select_queue has accel_priv])
817 AC_MSG_CHECKING([if drivers/net/bonding/bonding.h exists])
818 LB_LINUX_TRY_COMPILE([
819 #include "../drivers/net/bonding/bonding.h"
824 AC_DEFINE(HAVE_BONDING_H, 1,
825 [drivers/net/bonding/bonding.h exists])
830 AC_MSG_CHECKING([if bonding.h bond_for_each_slave has 3 parameters])
831 LB_LINUX_TRY_COMPILE([
832 #include "../drivers/net/bonding/bonding.h"
834 struct bonding *bond = NULL;
835 struct list_head *iter = NULL;
836 struct slave *slave = NULL;
838 bond_for_each_slave(bond, slave, iter) ;
843 AC_DEFINE(HAVE_BOND_FOR_EACH_SLAVE_3_PARAMS, 1,
844 [bond_for_each_slave has 3 parameters])
850 AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_init])
851 LB_LINUX_TRY_COMPILE([
852 #include <linux/u64_stats_sync.h>
854 struct u64_stats_sync sync;
855 u64_stats_init(&sync);
860 AC_DEFINE(HAVE_U64_STATS_SYNC, 1,
861 [u64_stats_sync is defined])
866 AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_fetch_begin_irq])
867 LB_LINUX_TRY_COMPILE([
868 #include <linux/u64_stats_sync.h>
870 struct u64_stats_sync sync;
871 u64_stats_fetch_begin_irq(&sync);
876 AC_DEFINE(HAVE_U64_STATS_FETCH_BEGIN_IRQ, 1,
877 [u64_stats_fetch_begin_irq is defined])
881 AC_MSG_CHECKING([if etherdevice.h has ether_addr_copy])
882 LB_LINUX_TRY_COMPILE([
883 #include <linux/etherdevice.h>
885 char dest[6], src[6];
886 ether_addr_copy(&dest, &src);
891 AC_DEFINE(HAVE_ETHER_ADDR_COPY, 1,
892 [ether_addr_copy is defined])
897 AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_vf_rate])
898 LB_LINUX_TRY_COMPILE([
899 #include <linux/netdevice.h>
901 int set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
907 struct net_device_ops netdev_ops;
909 netdev_ops.ndo_set_vf_rate = set_vf_rate;
913 AC_DEFINE(HAVE_SET_VF_RATE, 1,
914 [ndo_set_vf_rate is defined])
919 AC_MSG_CHECKING([if netdev_extended has hw_features])
920 LB_LINUX_TRY_COMPILE([
921 #include <linux/netdevice.h>
923 struct net_device *dev = NULL;
925 netdev_extended(dev)->hw_features = 0;
930 AC_DEFINE(HAVE_NETDEV_EXTENDED_HW_FEATURES, 1,
936 AC_MSG_CHECKING([if net_device_extended has _tx_ext])
937 LB_LINUX_TRY_COMPILE([
938 #include <linux/netdevice.h>
940 struct net_device *dev = NULL;
942 netdev_extended(dev)->_tx_ext = NULL;
947 AC_DEFINE(HAVE_NET_DEVICE_EXTENDED_TX_EXT, 1,
953 AC_MSG_CHECKING([if net_device_extended has ndo_busy_poll])
954 LB_LINUX_TRY_COMPILE([
955 #include <linux/netdevice.h>
957 int busy_poll(struct napi_struct *napi)
962 struct net_device *dev = NULL;
964 netdev_extended(dev)->ndo_busy_poll = busy_poll;
969 AC_DEFINE(HAVE_NETDEV_EXTENDED_NDO_BUSY_POLL, 1,
975 AC_MSG_CHECKING([if netdevice.h has set_netdev_hw_features])
976 LB_LINUX_TRY_COMPILE([
977 #include <linux/netdevice.h>
979 struct net_device *dev = NULL;
981 set_netdev_hw_features(dev, 0);
986 AC_DEFINE(HAVE_SET_NETDEV_HW_FEATURES, 1,
992 AC_MSG_CHECKING([if netdevice.h has netif_set_xps_queue])
993 LB_LINUX_TRY_COMPILE([
994 #include <linux/netdevice.h>
996 struct net_device *dev = NULL;
998 netif_set_xps_queue(dev, NULL, 0);
1003 AC_DEFINE(HAVE_NETIF_SET_XPS_QUEUE, 1,
1010 AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_features])
1011 LB_LINUX_TRY_COMPILE([
1012 #include <linux/netdevice.h>
1014 int set_features(struct net_device *dev, netdev_features_t features)
1019 struct net_device_ops netdev_ops;
1021 netdev_ops.ndo_set_features = set_features;
1025 AC_DEFINE(HAVE_NDO_SET_FEATURES, 1,
1026 [ndo_set_features is defined])
1031 AC_MSG_CHECKING([if struct net_device_ops has *ndo_setup_tc])
1032 LB_LINUX_TRY_COMPILE([
1033 #include <linux/netdevice.h>
1035 int setup_tc(struct net_device *dev, , u8 tc)
1040 struct net_device_ops netdev_ops;
1042 netdev_ops.ndo_setup_tc = setup_tc;
1046 AC_DEFINE(HAVE_NDO_SETUP_TC, 1,
1047 [ndo_setup_tc is defined])
1052 AC_MSG_CHECKING([if struct net_device_ops has *ndo_rx_flow_steer])
1053 LB_LINUX_TRY_COMPILE([
1054 #include <linux/netdevice.h>
1056 int rx_flow_steer(struct net_device *dev,
1057 const struct sk_buff *skb,
1064 struct net_device_ops netdev_ops;
1066 netdev_ops.ndo_rx_flow_steer = rx_flow_steer;
1070 AC_DEFINE(HAVE_NDO_RX_FLOW_STEER, 1,
1071 [ndo_rx_flow_steer is defined])
1076 AC_MSG_CHECKING([if struct net_device has priv_flags])
1077 LB_LINUX_TRY_COMPILE([
1078 #include <linux/netdevice.h>
1080 struct net_device *netdev;
1081 netdev->priv_flags = 0;
1086 AC_DEFINE(HAVE_NET_DEVICE_PRIV_FLAGS, 1,
1087 [priv_flags is defined])
1092 AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_stats64])
1093 LB_LINUX_TRY_COMPILE([
1094 #include <linux/netdevice.h>
1096 struct rtnl_link_stats64* get_stats_64(struct net_device *dev,
1097 struct rtnl_link_stats64 *storage)
1099 struct rtnl_link_stats64 stats_64;
1103 struct net_device_ops netdev_ops;
1105 netdev_ops.ndo_get_stats64 = get_stats_64;
1110 AC_DEFINE(HAVE_NDO_GET_STATS64, 1,
1111 [ndo_get_stats64 is defined])
1115 AC_MSG_CHECKING([if struct net_device_ops has ndo_bridge_set/getlink])
1116 LB_LINUX_TRY_COMPILE([
1117 #include <linux/netdevice.h>
1119 struct net_device_ops netdev_ops = {
1120 .ndo_bridge_setlink = NULL,
1121 .ndo_bridge_getlink = NULL,
1127 AC_DEFINE(HAVE_NDO_BRIDGE_SET_GET_LINK, 1,
1128 [ndo_bridge_set/getlink is defined])
1133 AC_MSG_CHECKING([if struct net_device_ops ndo_vlan_rx_add_vid has 3 parameters ])
1134 LB_LINUX_TRY_COMPILE([
1135 #include <linux/netdevice.h>
1137 int vlan_rx_add_vid(struct net_device *dev,__be16 proto, u16 vid)
1142 struct net_device_ops netdev_ops;
1144 netdev_ops.ndo_vlan_rx_add_vid = vlan_rx_add_vid;
1149 AC_DEFINE(HAVE_NDO_RX_ADD_VID_HAS_3_PARAMS, 1,
1150 [ndo_vlan_rx_add_vid has 3 parameters])
1155 AC_MSG_CHECKING([if net_device_ops has ndo_get_phys_port_id])
1156 LB_LINUX_TRY_COMPILE([
1157 #include <linux/netdevice.h>
1159 int get_phys_port_id(struct net_device *dev,
1160 struct netdev_phys_port_id *ppid)
1165 struct net_device_ops netdev_ops;
1167 netdev_ops.ndo_get_phys_port_id = get_phys_port_id;
1172 AC_DEFINE(HAVE_NETDEV_NDO_GET_PHYS_PORT_ID, 1,
1178 AC_MSG_CHECKING([if struct net_device_ops_ext exist])
1179 LB_LINUX_TRY_COMPILE([
1180 #include <linux/netdevice.h>
1182 struct net_device_ops_ext netdev_ops_ext;
1183 struct net_device_ops_ext netdev_ops__ext = {
1184 .size = sizeof(struct net_device_ops_ext),
1190 AC_DEFINE(HAVE_NET_DEVICE_OPS_EXT, 1,
1191 [struct net_device_ops_ext is defined])
1196 AC_MSG_CHECKING([if net_device_ops_ext has ndo_get_phys_port_id])
1197 LB_LINUX_TRY_COMPILE([
1198 #include <linux/netdevice.h>
1200 int get_phys_port_id(struct net_device *dev,
1201 struct netdev_phys_port_id *ppid)
1206 struct net_device_ops_ext netdev_ops_ext;
1208 netdev_ops_ext.ndo_get_phys_port_id = get_phys_port_id;
1213 AC_DEFINE(HAVE_NETDEV_EXT_NDO_GET_PHYS_PORT_ID, 1,
1214 [ndo_get_phys_port_id is defined])
1219 AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_spoofchk])
1220 LB_LINUX_TRY_COMPILE([
1221 #include <linux/netdevice.h>
1223 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1228 struct net_device_ops netdev_ops;
1230 netdev_ops.ndo_set_vf_spoofchk = set_vf_spoofchk;
1235 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_SPOOFCHK, 1,
1236 [ndo_set_vf_spoofchk is defined in net_device_ops])
1241 AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_spoofchk])
1242 LB_LINUX_TRY_COMPILE([
1243 #include <linux/netdevice.h>
1245 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1250 struct net_device_ops_ext netdev_ops_ext;
1252 netdev_ops_ext.ndo_set_vf_spoofchk = set_vf_spoofchk;
1257 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_SPOOFCHK, 1,
1258 [ndo_set_vf_spoofchk is defined in net_device_ops_ext])
1263 AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_link_state])
1264 LB_LINUX_TRY_COMPILE([
1265 #include <linux/netdevice.h>
1267 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1272 struct net_device_ops netdev_ops;
1274 netdev_ops.ndo_set_vf_link_state = set_vf_link_state;
1279 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_LINK_STATE, 1,
1280 [ndo_set_vf_link_state is defined in net_device_ops])
1285 AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_link_state])
1286 LB_LINUX_TRY_COMPILE([
1287 #include <linux/netdevice.h>
1289 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1294 struct net_device_ops_ext netdev_ops_ext;
1296 netdev_ops_ext.ndo_set_vf_link_state = set_vf_link_state;
1301 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_LINK_STATE, 1,
1302 [ndo_set_vf_link_state is defined])
1308 AC_MSG_CHECKING([if netdevice.h netif_set_real_num_tx_queues returns int])
1309 LB_LINUX_TRY_COMPILE([
1310 #include <linux/netdevice.h>
1312 struct net_device dev;
1314 ret = netif_set_real_num_tx_queues(&dev, 2);
1318 AC_DEFINE(HAVE_RETURN_INT_FOR_SET_NUM_TX_QUEUES, 1,
1319 [netif_set_real_num_tx_queues returns int])
1324 AC_MSG_CHECKING([if struct netdevice.h has struct xps_map])
1325 LB_LINUX_TRY_COMPILE([
1326 #include <linux/netdevice.h>
1334 AC_DEFINE(HAVE_XPS_MAP, 1,
1335 [struct xps_map is defined])
1340 AC_MSG_CHECKING([if struct ethtool_ops has set_phys_id])
1341 LB_LINUX_TRY_COMPILE([
1342 #include <linux/ethtool.h>
1344 const struct ethtool_ops en_ethtool_ops = {
1351 AC_DEFINE(HAVE_SET_PHYS_ID, 1,
1352 [set_phys_id is defined])
1357 AC_MSG_CHECKING([if struct ethtool_ops has get/set_channels])
1358 LB_LINUX_TRY_COMPILE([
1359 #include <linux/ethtool.h>
1361 const struct ethtool_ops en_ethtool_ops = {
1362 .get_channels = NULL,
1363 .set_channels = NULL,
1369 AC_DEFINE(HAVE_GET_SET_CHANNELS, 1,
1370 [get/set_channels is defined])
1375 AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_channels])
1376 LB_LINUX_TRY_COMPILE([
1377 #include <linux/ethtool.h>
1379 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1380 .get_channels = NULL,
1381 .set_channels = NULL,
1387 AC_DEFINE(HAVE_GET_SET_CHANNELS_EXT, 1,
1388 [get/set_channels is defined in ethtool_ops_ext])
1393 AC_MSG_CHECKING([if struct ethtool_ops has get_ts_info])
1394 LB_LINUX_TRY_COMPILE([
1395 #include <linux/ethtool.h>
1397 const struct ethtool_ops en_ethtool_ops = {
1398 .get_ts_info = NULL,
1404 AC_DEFINE(HAVE_GET_TS_INFO, 1,
1405 [get_ts_info is defined])
1410 AC_MSG_CHECKING([if struct ethtool_ops_ext has get_ts_info])
1411 LB_LINUX_TRY_COMPILE([
1412 #include <linux/ethtool.h>
1414 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1415 .get_ts_info = NULL,
1421 AC_DEFINE(HAVE_GET_TS_INFO_EXT, 1,
1422 [get_ts_info is defined in ethtool_ops_ext])
1427 AC_MSG_CHECKING([if struct ethtool_flow_ext has h_dest])
1428 LB_LINUX_TRY_COMPILE([
1429 #include <linux/ethtool.h>
1431 unsigned char mac[ETH_ALEN];
1432 struct ethtool_flow_ext h_ext;
1434 memcpy(&mac, h_ext.h_dest, ETH_ALEN);
1439 AC_DEFINE(HAVE_ETHTOOL_FLOW_EXT_H_DEST, 1,
1440 [ethtool_flow_ext has h_dest])
1445 AC_MSG_CHECKING([if netdevice.h has struct netdev_hw_addr])
1446 LB_LINUX_TRY_COMPILE([
1447 #include <linux/netdevice.h>
1449 struct netdev_hw_addr addr;
1453 AC_DEFINE(HAVE_NETDEV_HW_ADDR, 1,
1454 [netdev_hw_addr is defined])
1459 AC_MSG_CHECKING([if pci.h has pci_vfs_assigned])
1460 LB_LINUX_TRY_COMPILE([
1461 #include <linux/pci.h>
1463 struct pci_dev pdev;
1464 pci_vfs_assigned(&pdev);
1468 AC_DEFINE(HAVE_PCI_VF_ASSIGNED, 1,
1469 [pci_vfs_assigned is defined])
1473 AC_MSG_CHECKING([if __vlan_put_tag has 3 parameters])
1474 LB_LINUX_TRY_COMPILE([
1475 #include <linux/if_vlan.h>
1477 struct sk_buff *skb;
1478 __vlan_put_tag(skb, 0, 0);
1483 AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_PUT_TAG, 1,
1484 [__vlan_put_tag has 3 parameters])
1489 AC_MSG_CHECKING([if __vlan_hwaccel_put_tag has 3 parameters])
1490 LB_LINUX_TRY_COMPILE([
1491 #include <linux/if_vlan.h>
1493 struct sk_buff *skb;
1494 __vlan_hwaccel_put_tag(skb, 0, 0);
1499 AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_HWACCEL_PUT_TAG, 1,
1500 [__vlan_hwaccel_put_tag has 3 parameters])
1505 AC_MSG_CHECKING([if struct net_device has hw_features])
1506 LB_LINUX_TRY_COMPILE([
1507 #include <linux/netdevice.h>
1509 struct net_device dev;
1510 dev.hw_features = 0;
1515 AC_DEFINE(HAVE_NETDEV_HW_FEATURES, 1,
1516 [hw_features is defined])
1521 AC_MSG_CHECKING([if struct net_device has hw_enc_features])
1522 LB_LINUX_TRY_COMPILE([
1523 #include <linux/netdevice.h>
1525 struct net_device dev;
1526 dev.hw_enc_features = 0;
1531 AC_DEFINE(HAVE_NETDEV_HW_ENC_FEATURES, 1,
1532 [hw_enc_features is defined])
1537 AC_MSG_CHECKING([if struct net_device has rx_cpu_rmap])
1538 LB_LINUX_TRY_COMPILE([
1539 #include <linux/netdevice.h>
1541 struct net_device dev;
1542 dev.rx_cpu_rmap = NULL;
1547 AC_DEFINE(HAVE_NETDEV_RX_CPU_RMAP, 1,
1548 [rx_cpu_rmap is defined])
1553 AC_MSG_CHECKING([if if_vlan.h has vlan_hwaccel_receive_skb])
1554 LB_LINUX_TRY_COMPILE([
1555 #include <linux/if_vlan.h>
1557 struct sk_buff *skb;
1558 vlan_hwaccel_receive_skb(skb,0,0);
1562 AC_DEFINE(HAVE_VLAN_HWACCEL_RECEIVE_SKB, 1,
1563 [vlan_hwaccel_receive_skb is defined])
1568 AC_MSG_CHECKING([if irqdesc.h has irq_desc_get_irq_data])
1569 LB_LINUX_TRY_COMPILE([
1570 #include <linux/irqdesc.h>
1572 struct irq_data *data = irq_desc_get_irq_data(NULL);
1576 AC_DEFINE(HAVE_IRQ_DESC_GET_IRQ_DATA, 1,
1577 [irq_desc_get_irq_data is defined])
1583 AC_MSG_CHECKING([if pci_dev has pcie_mpss])
1584 LB_LINUX_TRY_COMPILE([
1585 #include <linux/pci.h>
1587 struct pci_dev pdev;
1589 pdev->pcie_mpss = 0;
1593 AC_DEFINE(HAVE_PCI_DEV_PCIE_MPSS, 1,
1594 [pcie_mpss is defined])
1599 AC_MSG_CHECKING([if uapi/linux/if_ether.h exist])
1600 LB_LINUX_TRY_COMPILE([
1601 #include <uapi/linux/if_ether.h>
1606 AC_DEFINE(HAVE_UAPI_LINUX_IF_ETHER_H, 1,
1607 [uapi/linux/if_ether.h exist])
1612 AC_MSG_CHECKING([if ifla_vf_info has spoofchk])
1613 LB_LINUX_TRY_COMPILE([
1614 #include <linux/if_link.h>
1616 struct ifla_vf_info *ivf;
1622 AC_DEFINE(HAVE_VF_INFO_SPOOFCHK, 1,
1623 [spoofchk is defined])
1628 AC_MSG_CHECKING([if dst.h has dst_get_neighbour])
1629 LB_LINUX_TRY_COMPILE([
1630 #include <net/dst.h>
1632 struct neighbour *neigh = dst_get_neighbour(NULL);
1637 AC_DEFINE(HAVE_DST_GET_NEIGHBOUR, 1,
1643 AC_MSG_CHECKING([if netlink_dump_start has 6 parameters])
1644 LB_LINUX_TRY_COMPILE([
1645 #include <linux/netlink.h>
1647 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL, 0);
1652 AC_DEFINE(HAVE_NETLINK_DUMP_START_6P, 1,
1658 AC_MSG_CHECKING([if netlink_dump_start has 5 parameters])
1659 LB_LINUX_TRY_COMPILE([
1660 #include <linux/netlink.h>
1662 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL);
1667 AC_DEFINE(HAVE_NETLINK_DUMP_START_5P, 1,
1673 AC_MSG_CHECKING([if struct dcbnl_rtnl_ops has ieee_getmaxrate/ieee_setmaxrate])
1674 LB_LINUX_TRY_COMPILE([
1675 #include <net/dcbnl.h>
1677 const struct dcbnl_rtnl_ops en_dcbnl_ops = {
1678 .ieee_getmaxrate = NULL,
1679 .ieee_setmaxrate = NULL,
1685 AC_DEFINE(HAVE_IEEE_GET_SET_MAXRATE, 1,
1686 [ieee_getmaxrate/ieee_setmaxrate is defined])
1692 # COMPAT_CONFIG_HEADERS
1694 # add -include config.h
1696 AC_DEFUN([COMPAT_CONFIG_HEADERS],[
1697 AC_CONFIG_HEADERS([config.h])
1698 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
1699 AC_SUBST(EXTRA_KCFLAGS)
1702 AC_DEFUN([OFA_PROG_LINUX],
1707 LB_LINUX_CONFIG([MODULES],[],[
1708 AC_MSG_ERROR([module support is required to build mlnx kernel modules.])
1710 LB_LINUX_CONFIG([MODVERSIONS])
1711 LB_LINUX_CONFIG([KALLSYMS],[],[
1712 AC_MSG_ERROR([compat_mlnx requires that CONFIG_KALLSYMS is enabled in your kernel.])
1716 COMPAT_CONFIG_HEADERS