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 attr_is_visible])
350 LB_LINUX_TRY_COMPILE([
351 #include <scsi/scsi_transport_iscsi.h>
353 static struct iscsi_transport iscsi_iser_transport = {
354 .attr_is_visible = NULL,
360 AC_DEFINE(HAVE_ISCSI_ATTR_IS_VISIBLE, 1,
361 [attr_is_visible is defined])
366 AC_MSG_CHECKING([if struct iscsi_transport has get_ep_param])
367 LB_LINUX_TRY_COMPILE([
368 #include <scsi/scsi_transport_iscsi.h>
370 static struct iscsi_transport iscsi_iser_transport = {
371 .get_ep_param = NULL,
377 AC_DEFINE(HAVE_ISCSI_GET_EP_PARAM, 1,
378 [get_ep_param is defined])
383 AC_MSG_CHECKING([if struct iscsi_transport has check_protection])
384 LB_LINUX_TRY_COMPILE([
385 #include <scsi/scsi_transport_iscsi.h>
387 static struct iscsi_transport iscsi_iser_transport = {
388 .check_protection = NULL,
394 AC_DEFINE(HAVE_ISCSI_CHECK_PROTECTION, 1,
395 [check_protection is defined])
400 AC_MSG_CHECKING([if iscsi_proto.h has struct iscsi_scsi_req])
401 LB_LINUX_TRY_COMPILE([
402 #include <scsi/iscsi_proto.h>
404 struct iscsi_scsi_req *req = NULL;
409 AC_DEFINE(HAVE_ISCSI_SCSI_REQ, 1,
410 [struct iscsi_scsi_req is defined])
415 AC_MSG_CHECKING([if netdevice.h has select_queue_fallback_t])
416 LB_LINUX_TRY_COMPILE([
417 #include <linux/netdevice.h>
419 select_queue_fallback_t fallback;
426 AC_DEFINE(HAVE_SELECT_QUEUE_FALLBACK_T, 1,
427 [select_queue_fallback_t is defined])
432 AC_MSG_CHECKING([if skbuff.h has skb_set_hash])
433 LB_LINUX_TRY_COMPILE([
434 #include <linux/netdevice.h>
436 skb_set_hash(NULL, 0, PKT_HASH_TYPE_L3);
441 AC_DEFINE(HAVE_SKB_SET_HASH, 1,
442 [skb_set_hash is defined])
447 AC_MSG_CHECKING([if sockios.h has SIOCGHWTSTAMP])
448 LB_LINUX_TRY_COMPILE([
449 #include <linux/sockios.h>
451 int x = SIOCGHWTSTAMP;
456 AC_DEFINE(HAVE_SIOCGHWTSTAMP, 1,
457 [SIOCGHWTSTAMP is defined])
462 AC_MSG_CHECKING([if ip.h inet_get_local_port_range has 3 parameters])
463 LB_LINUX_TRY_COMPILE([
466 inet_get_local_port_range(NULL, NULL, NULL);
471 AC_DEFINE(HAVE_INET_GET_LOCAL_PORT_RANGE_3_PARAMS, 1,
472 [inet_get_local_port_range has 3 parameters])
477 AC_MSG_CHECKING([if net.h has net_get_random_once])
478 LB_LINUX_TRY_COMPILE([
479 #include <linux/net.h>
481 net_get_random_once(NULL, 0);
486 AC_DEFINE(HAVE_NET_GET_RANDOM_ONCE, 1,
487 [net_get_random_once is defined])
492 AC_MSG_CHECKING([if inet_sock.h has __inet_ehashfn])
493 LB_LINUX_TRY_COMPILE([
494 #include <net/inet_sock.h>
496 __inet_ehashfn(0, 0, 0, 0, 0);
501 AC_DEFINE(HAVE_INET_EHASHFN, 1,
502 [__inet_ehashfn is defined])
507 AC_MSG_CHECKING([if err.h has PTR_ERR_OR_ZERO])
508 LB_LINUX_TRY_COMPILE([
509 #include <linux/err.h>
511 int x = PTR_ERR_OR_ZERO(NULL);
516 AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
517 [PTR_ERR_OR_ZERO is defined])
522 AC_MSG_CHECKING([if struct iscsi_session has discovery_sess])
523 LB_LINUX_TRY_COMPILE([
524 #include <scsi/libiscsi.h>
526 struct iscsi_session session;
527 session.discovery_sess = 0;
532 AC_DEFINE(HAVE_ISCSI_DISCOVERY_SESS, 1,
533 [discovery_sess is defined])
538 AC_MSG_CHECKING([if enum iscsi_param has ISCSI_PARAM_DISCOVERY_SESS])
539 LB_LINUX_TRY_COMPILE([
540 #include <scsi/iscsi_if.h>
542 int x = ISCSI_PARAM_DISCOVERY_SESS;
547 AC_DEFINE(HAVE_ISCSI_PARAM_DISCOVERY_SESS, 1,
548 [ISCSI_PARAM_DISCOVERY_SESS is defined])
553 AC_MSG_CHECKING([if pci.h has enum pcie_link_width])
554 LB_LINUX_TRY_COMPILE([
555 #include <linux/pci.h>
557 enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
562 AC_DEFINE(HAVE_PCIE_LINK_WIDTH, 1,
563 [pcie_link_width is defined])
568 AC_MSG_CHECKING([if pci.h has enum pci_bus_speed])
569 LB_LINUX_TRY_COMPILE([
570 #include <linux/pci.h>
572 enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
577 AC_DEFINE(HAVE_PCI_BUS_SPEED, 1,
578 [pci_bus_speed is defined])
583 AC_MSG_CHECKING([if netdevice.h has struct netdev_phys_port_id])
584 LB_LINUX_TRY_COMPILE([
585 #include <linux/netdevice.h>
587 struct netdev_phys_port_id *x = NULL;
592 AC_DEFINE(HAVE_NETDEV_PHYS_PORT_ID, 1,
593 [netdev_phys_port_id is defined])
598 AC_MSG_CHECKING([if struct ifla_vf_info has linkstate])
599 LB_LINUX_TRY_COMPILE([
600 #include <linux/if_link.h>
602 struct struct ifla_vf_info x;
608 AC_DEFINE(HAVE_LINKSTATE, 1,
609 [linkstate is defined])
614 AC_MSG_CHECKING([if busy_poll.h has skb_mark_napi_id])
615 LB_LINUX_TRY_COMPILE([
616 #include <net/busy_poll.h>
618 skb_mark_napi_id(NULL, NULL);
623 AC_DEFINE(HAVE_SKB_MARK_NAPI_ID, 1,
624 [skb_mark_napi_id is defined])
629 AC_MSG_CHECKING([if netdevice.h has napi_hash_add])
630 LB_LINUX_TRY_COMPILE([
631 #include <linux/netdevice.h>
638 AC_DEFINE(HAVE_NAPI_HASH_ADD, 1,
639 [napi_hash_add is defined])
644 AC_MSG_CHECKING([if netdevice.h has netif_keep_dst])
645 LB_LINUX_TRY_COMPILE([
646 #include <linux/netdevice.h>
648 netif_keep_dst(NULL);
653 AC_DEFINE(HAVE_NETIF_KEEP_DST, 1,
654 [netif_keep_dst is defined])
659 AC_MSG_CHECKING([if mm.h has kvfree])
660 LB_LINUX_TRY_COMPILE([
661 #include <linux/mm.h>
668 AC_DEFINE(HAVE_KVFREE, 1,
674 AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any])
675 LB_LINUX_TRY_COMPILE([
676 #include <linux/netdevice.h>
678 dev_consume_skb_any(NULL);
683 AC_DEFINE(HAVE_DEV_CONSUME_SKB_ANY, 1,
684 [dev_consume_skb_any is defined])
689 AC_MSG_CHECKING([if netdevice.h has netdev_txq_bql_complete_prefetchw])
690 LB_LINUX_TRY_COMPILE([
691 #include <linux/netdevice.h>
693 netdev_txq_bql_complete_prefetchw(NULL);
694 netdev_txq_bql_enqueue_prefetchw(NULL);
699 AC_DEFINE(HAVE_NETDEV_TXQ_BQL_PREFETCHW, 1,
700 [netdev_txq_bql_complete_prefetchw is defined])
705 AC_MSG_CHECKING([if struct sk_buff has xmit_more])
706 LB_LINUX_TRY_COMPILE([
707 #include <linux/skbuff.h>
715 AC_DEFINE(HAVE_SK_BUFF_XMIT_MORE, 1,
716 [xmit_more is defined])
721 AC_MSG_CHECKING([if struct sk_buff has encapsulation])
722 LB_LINUX_TRY_COMPILE([
723 #include <linux/skbuff.h>
726 skb->encapsulation = 0;
731 AC_DEFINE(HAVE_SK_BUFF_ENCAPSULATION, 1,
732 [encapsulation is defined])
737 AC_MSG_CHECKING([if etherdevice.h has eth_get_headlen])
738 LB_LINUX_TRY_COMPILE([
739 #include <linux/etherdevice.h>
741 eth_get_headlen(NULL, 0);
746 AC_DEFINE(HAVE_ETH_GET_HEADLEN, 1,
747 [eth_get_headlen is defined])
752 AC_MSG_CHECKING([if struct sk_buff has csum_level])
753 LB_LINUX_TRY_COMPILE([
754 #include <linux/skbuff.h>
762 AC_DEFINE(HAVE_SK_BUFF_CSUM_LEVEL, 1,
763 [csum_level is defined])
768 AC_MSG_CHECKING([if struct skbuff.h has skb_inner_transport_header])
769 LB_LINUX_TRY_COMPILE([
770 #include <linux/skbuff.h>
772 skb_inner_transport_header(NULL);
777 AC_DEFINE(HAVE_SKB_INNER_TRANSPORT_HEADER, 1,
778 [skb_inner_transport_header is defined])
783 AC_MSG_CHECKING([if struct skbuff.h has skb_inner_network_header])
784 LB_LINUX_TRY_COMPILE([
785 #include <linux/skbuff.h>
787 skb_inner_network_header(NULL);
792 AC_DEFINE(HAVE_SKB_INNER_NETWORK_HEADER, 1,
793 [skb_inner_network_header is defined])
798 AC_MSG_CHECKING([if if_vlan.h has vlan_dev_get_egress_qos_mask])
799 LB_LINUX_TRY_COMPILE([
800 #include <linux/if_vlan.h>
802 vlan_dev_get_egress_qos_mask(NULL, 0);
807 AC_DEFINE(HAVE_VLAN_DEV_GET_EGRESS_QOS_MASK, 1,
808 [vlan_dev_get_egress_qos_mask is defined])
813 AC_MSG_CHECKING([if netdevice.h has netdev_get_prio_tc_map])
814 LB_LINUX_TRY_COMPILE([
815 #include <linux/netdevice.h>
817 netdev_get_prio_tc_map(NULL, 0);
822 AC_DEFINE(HAVE_NETDEV_GET_PRIO_TC_MAP, 1,
823 [netdev_get_prio_tc_map is defined])
828 AC_MSG_CHECKING([if if_vlan.h has __vlan_find_dev_deep_rcu])
829 LB_LINUX_TRY_COMPILE([
830 #include <linux/if_vlan.h>
832 __vlan_find_dev_deep_rcu(NULL, 0, 0);
837 AC_DEFINE(HAVE___VLAN_FIND_DEV_DEEP_RCU, 1,
838 [__vlan_find_dev_deep_rcu is defined])
843 AC_MSG_CHECKING([if ndo_select_queue has accel_priv])
844 LB_LINUX_TRY_COMPILE([
845 #include <linux/netdevice.h>
847 static u16 select_queue(struct net_device *dev, struct sk_buff *skb,
853 struct net_device_opts ndops;
855 ndops.ndo_select_queue = select_queue;
860 AC_DEFINE(NDO_SELECT_QUEUE_HAS_ACCEL_PRIV, 1,
861 [ndo_select_queue has accel_priv])
866 AC_MSG_CHECKING([if drivers/net/bonding/bonding.h exists])
867 LB_LINUX_TRY_COMPILE([
868 #include "../drivers/net/bonding/bonding.h"
873 AC_DEFINE(HAVE_BONDING_H, 1,
874 [drivers/net/bonding/bonding.h exists])
879 AC_MSG_CHECKING([if bonding.h bond_for_each_slave has 3 parameters])
880 LB_LINUX_TRY_COMPILE([
881 #include "../drivers/net/bonding/bonding.h"
883 struct bonding *bond = NULL;
884 struct list_head *iter = NULL;
885 struct slave *slave = NULL;
887 bond_for_each_slave(bond, slave, iter) ;
892 AC_DEFINE(HAVE_BOND_FOR_EACH_SLAVE_3_PARAMS, 1,
893 [bond_for_each_slave has 3 parameters])
899 AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_init])
900 LB_LINUX_TRY_COMPILE([
901 #include <linux/u64_stats_sync.h>
903 struct u64_stats_sync sync;
904 u64_stats_init(&sync);
909 AC_DEFINE(HAVE_U64_STATS_SYNC, 1,
910 [u64_stats_sync is defined])
915 AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_fetch_begin_irq])
916 LB_LINUX_TRY_COMPILE([
917 #include <linux/u64_stats_sync.h>
919 struct u64_stats_sync sync;
920 u64_stats_fetch_begin_irq(&sync);
925 AC_DEFINE(HAVE_U64_STATS_FETCH_BEGIN_IRQ, 1,
926 [u64_stats_fetch_begin_irq is defined])
930 AC_MSG_CHECKING([if etherdevice.h has ether_addr_copy])
931 LB_LINUX_TRY_COMPILE([
932 #include <linux/etherdevice.h>
934 char dest[6], src[6];
935 ether_addr_copy(&dest, &src);
940 AC_DEFINE(HAVE_ETHER_ADDR_COPY, 1,
941 [ether_addr_copy is defined])
946 AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_vf_rate])
947 LB_LINUX_TRY_COMPILE([
948 #include <linux/netdevice.h>
950 int set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
956 struct net_device_ops netdev_ops;
958 netdev_ops.ndo_set_vf_rate = set_vf_rate;
962 AC_DEFINE(HAVE_SET_VF_RATE, 1,
963 [ndo_set_vf_rate is defined])
968 AC_MSG_CHECKING([if netdev_extended has hw_features])
969 LB_LINUX_TRY_COMPILE([
970 #include <linux/netdevice.h>
972 struct net_device *dev = NULL;
974 netdev_extended(dev)->hw_features = 0;
979 AC_DEFINE(HAVE_NETDEV_EXTENDED_HW_FEATURES, 1,
985 AC_MSG_CHECKING([if net_device_extended has _tx_ext])
986 LB_LINUX_TRY_COMPILE([
987 #include <linux/netdevice.h>
989 struct net_device *dev = NULL;
991 netdev_extended(dev)->_tx_ext = NULL;
996 AC_DEFINE(HAVE_NET_DEVICE_EXTENDED_TX_EXT, 1,
1002 AC_MSG_CHECKING([if net_device_extended has ndo_busy_poll])
1003 LB_LINUX_TRY_COMPILE([
1004 #include <linux/netdevice.h>
1006 int busy_poll(struct napi_struct *napi)
1011 struct net_device *dev = NULL;
1013 netdev_extended(dev)->ndo_busy_poll = busy_poll;
1018 AC_DEFINE(HAVE_NETDEV_EXTENDED_NDO_BUSY_POLL, 1,
1024 AC_MSG_CHECKING([if netdevice.h has set_netdev_hw_features])
1025 LB_LINUX_TRY_COMPILE([
1026 #include <linux/netdevice.h>
1028 struct net_device *dev = NULL;
1030 set_netdev_hw_features(dev, 0);
1035 AC_DEFINE(HAVE_SET_NETDEV_HW_FEATURES, 1,
1041 AC_MSG_CHECKING([if netdevice.h has netif_set_xps_queue])
1042 LB_LINUX_TRY_COMPILE([
1043 #include <linux/netdevice.h>
1045 struct net_device *dev = NULL;
1047 netif_set_xps_queue(dev, NULL, 0);
1052 AC_DEFINE(HAVE_NETIF_SET_XPS_QUEUE, 1,
1059 AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_features])
1060 LB_LINUX_TRY_COMPILE([
1061 #include <linux/netdevice.h>
1063 int set_features(struct net_device *dev, netdev_features_t features)
1068 struct net_device_ops netdev_ops;
1070 netdev_ops.ndo_set_features = set_features;
1074 AC_DEFINE(HAVE_NDO_SET_FEATURES, 1,
1075 [ndo_set_features is defined])
1080 AC_MSG_CHECKING([if struct net_device_ops has *ndo_setup_tc])
1081 LB_LINUX_TRY_COMPILE([
1082 #include <linux/netdevice.h>
1084 int setup_tc(struct net_device *dev, , u8 tc)
1089 struct net_device_ops netdev_ops;
1091 netdev_ops.ndo_setup_tc = setup_tc;
1095 AC_DEFINE(HAVE_NDO_SETUP_TC, 1,
1096 [ndo_setup_tc is defined])
1101 AC_MSG_CHECKING([if struct net_device_ops has *ndo_rx_flow_steer])
1102 LB_LINUX_TRY_COMPILE([
1103 #include <linux/netdevice.h>
1105 int rx_flow_steer(struct net_device *dev,
1106 const struct sk_buff *skb,
1113 struct net_device_ops netdev_ops;
1115 netdev_ops.ndo_rx_flow_steer = rx_flow_steer;
1119 AC_DEFINE(HAVE_NDO_RX_FLOW_STEER, 1,
1120 [ndo_rx_flow_steer is defined])
1125 AC_MSG_CHECKING([if struct net_device has priv_flags])
1126 LB_LINUX_TRY_COMPILE([
1127 #include <linux/netdevice.h>
1129 struct net_device *netdev;
1130 netdev->priv_flags = 0;
1135 AC_DEFINE(HAVE_NET_DEVICE_PRIV_FLAGS, 1,
1136 [priv_flags is defined])
1141 AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_stats64])
1142 LB_LINUX_TRY_COMPILE([
1143 #include <linux/netdevice.h>
1145 struct rtnl_link_stats64* get_stats_64(struct net_device *dev,
1146 struct rtnl_link_stats64 *storage)
1148 struct rtnl_link_stats64 stats_64;
1152 struct net_device_ops netdev_ops;
1154 netdev_ops.ndo_get_stats64 = get_stats_64;
1159 AC_DEFINE(HAVE_NDO_GET_STATS64, 1,
1160 [ndo_get_stats64 is defined])
1164 AC_MSG_CHECKING([if struct net_device_ops has ndo_bridge_set/getlink])
1165 LB_LINUX_TRY_COMPILE([
1166 #include <linux/netdevice.h>
1168 struct net_device_ops netdev_ops = {
1169 .ndo_bridge_setlink = NULL,
1170 .ndo_bridge_getlink = NULL,
1176 AC_DEFINE(HAVE_NDO_BRIDGE_SET_GET_LINK, 1,
1177 [ndo_bridge_set/getlink is defined])
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>
1186 int vlan_rx_add_vid(struct net_device *dev,__be16 proto, u16 vid)
1191 struct net_device_ops netdev_ops;
1193 netdev_ops.ndo_vlan_rx_add_vid = vlan_rx_add_vid;
1198 AC_DEFINE(HAVE_NDO_RX_ADD_VID_HAS_3_PARAMS, 1,
1199 [ndo_vlan_rx_add_vid has 3 parameters])
1204 AC_MSG_CHECKING([if net_device_ops has ndo_get_phys_port_id])
1205 LB_LINUX_TRY_COMPILE([
1206 #include <linux/netdevice.h>
1208 int get_phys_port_id(struct net_device *dev,
1209 struct netdev_phys_port_id *ppid)
1214 struct net_device_ops netdev_ops;
1216 netdev_ops.ndo_get_phys_port_id = get_phys_port_id;
1221 AC_DEFINE(HAVE_NETDEV_NDO_GET_PHYS_PORT_ID, 1,
1227 AC_MSG_CHECKING([if struct net_device_ops_ext exist])
1228 LB_LINUX_TRY_COMPILE([
1229 #include <linux/netdevice.h>
1231 struct net_device_ops_ext netdev_ops_ext;
1232 struct net_device_ops_ext netdev_ops__ext = {
1233 .size = sizeof(struct net_device_ops_ext),
1239 AC_DEFINE(HAVE_NET_DEVICE_OPS_EXT, 1,
1240 [struct net_device_ops_ext is defined])
1245 AC_MSG_CHECKING([if net_device_ops_ext has ndo_get_phys_port_id])
1246 LB_LINUX_TRY_COMPILE([
1247 #include <linux/netdevice.h>
1249 int get_phys_port_id(struct net_device *dev,
1250 struct netdev_phys_port_id *ppid)
1255 struct net_device_ops_ext netdev_ops_ext;
1257 netdev_ops_ext.ndo_get_phys_port_id = get_phys_port_id;
1262 AC_DEFINE(HAVE_NETDEV_EXT_NDO_GET_PHYS_PORT_ID, 1,
1263 [ndo_get_phys_port_id is defined])
1268 AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_spoofchk])
1269 LB_LINUX_TRY_COMPILE([
1270 #include <linux/netdevice.h>
1272 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1277 struct net_device_ops netdev_ops;
1279 netdev_ops.ndo_set_vf_spoofchk = set_vf_spoofchk;
1284 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_SPOOFCHK, 1,
1285 [ndo_set_vf_spoofchk is defined in net_device_ops])
1290 AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_spoofchk])
1291 LB_LINUX_TRY_COMPILE([
1292 #include <linux/netdevice.h>
1294 int set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
1299 struct net_device_ops_ext netdev_ops_ext;
1301 netdev_ops_ext.ndo_set_vf_spoofchk = set_vf_spoofchk;
1306 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_SPOOFCHK, 1,
1307 [ndo_set_vf_spoofchk is defined in net_device_ops_ext])
1312 AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_link_state])
1313 LB_LINUX_TRY_COMPILE([
1314 #include <linux/netdevice.h>
1316 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1321 struct net_device_ops netdev_ops;
1323 netdev_ops.ndo_set_vf_link_state = set_vf_link_state;
1328 AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_LINK_STATE, 1,
1329 [ndo_set_vf_link_state is defined in net_device_ops])
1334 AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_link_state])
1335 LB_LINUX_TRY_COMPILE([
1336 #include <linux/netdevice.h>
1338 int set_vf_link_state(struct net_device *dev, int vf, int link_state)
1343 struct net_device_ops_ext netdev_ops_ext;
1345 netdev_ops_ext.ndo_set_vf_link_state = set_vf_link_state;
1350 AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_LINK_STATE, 1,
1351 [ndo_set_vf_link_state is defined])
1357 AC_MSG_CHECKING([if netdevice.h netif_set_real_num_tx_queues returns int])
1358 LB_LINUX_TRY_COMPILE([
1359 #include <linux/netdevice.h>
1361 struct net_device dev;
1363 ret = netif_set_real_num_tx_queues(&dev, 2);
1367 AC_DEFINE(HAVE_RETURN_INT_FOR_SET_NUM_TX_QUEUES, 1,
1368 [netif_set_real_num_tx_queues returns int])
1373 AC_MSG_CHECKING([if struct netdevice.h has struct xps_map])
1374 LB_LINUX_TRY_COMPILE([
1375 #include <linux/netdevice.h>
1383 AC_DEFINE(HAVE_XPS_MAP, 1,
1384 [struct xps_map is defined])
1389 AC_MSG_CHECKING([if struct ethtool_ops has set_phys_id])
1390 LB_LINUX_TRY_COMPILE([
1391 #include <linux/ethtool.h>
1393 const struct ethtool_ops en_ethtool_ops = {
1400 AC_DEFINE(HAVE_SET_PHYS_ID, 1,
1401 [set_phys_id is defined])
1406 AC_MSG_CHECKING([if struct ethtool_ops has get/set_channels])
1407 LB_LINUX_TRY_COMPILE([
1408 #include <linux/ethtool.h>
1410 const struct ethtool_ops en_ethtool_ops = {
1411 .get_channels = NULL,
1412 .set_channels = NULL,
1418 AC_DEFINE(HAVE_GET_SET_CHANNELS, 1,
1419 [get/set_channels is defined])
1424 AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_channels])
1425 LB_LINUX_TRY_COMPILE([
1426 #include <linux/ethtool.h>
1428 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1429 .get_channels = NULL,
1430 .set_channels = NULL,
1436 AC_DEFINE(HAVE_GET_SET_CHANNELS_EXT, 1,
1437 [get/set_channels is defined in ethtool_ops_ext])
1442 AC_MSG_CHECKING([if struct ethtool_ops has get_ts_info])
1443 LB_LINUX_TRY_COMPILE([
1444 #include <linux/ethtool.h>
1446 const struct ethtool_ops en_ethtool_ops = {
1447 .get_ts_info = NULL,
1453 AC_DEFINE(HAVE_GET_TS_INFO, 1,
1454 [get_ts_info is defined])
1459 AC_MSG_CHECKING([if struct ethtool_ops_ext has get_ts_info])
1460 LB_LINUX_TRY_COMPILE([
1461 #include <linux/ethtool.h>
1463 const struct ethtool_ops_ext en_ethtool_ops_ext = {
1464 .get_ts_info = NULL,
1470 AC_DEFINE(HAVE_GET_TS_INFO_EXT, 1,
1471 [get_ts_info is defined in ethtool_ops_ext])
1476 AC_MSG_CHECKING([if struct ethtool_flow_ext has h_dest])
1477 LB_LINUX_TRY_COMPILE([
1478 #include <linux/ethtool.h>
1480 unsigned char mac[ETH_ALEN];
1481 struct ethtool_flow_ext h_ext;
1483 memcpy(&mac, h_ext.h_dest, ETH_ALEN);
1488 AC_DEFINE(HAVE_ETHTOOL_FLOW_EXT_H_DEST, 1,
1489 [ethtool_flow_ext has h_dest])
1494 AC_MSG_CHECKING([if netdevice.h has struct netdev_hw_addr])
1495 LB_LINUX_TRY_COMPILE([
1496 #include <linux/netdevice.h>
1498 struct netdev_hw_addr addr;
1502 AC_DEFINE(HAVE_NETDEV_HW_ADDR, 1,
1503 [netdev_hw_addr is defined])
1508 AC_MSG_CHECKING([if pci.h has pci_vfs_assigned])
1509 LB_LINUX_TRY_COMPILE([
1510 #include <linux/pci.h>
1512 struct pci_dev pdev;
1513 pci_vfs_assigned(&pdev);
1517 AC_DEFINE(HAVE_PCI_VF_ASSIGNED, 1,
1518 [pci_vfs_assigned is defined])
1522 AC_MSG_CHECKING([if __vlan_put_tag has 3 parameters])
1523 LB_LINUX_TRY_COMPILE([
1524 #include <linux/if_vlan.h>
1526 struct sk_buff *skb;
1527 __vlan_put_tag(skb, 0, 0);
1532 AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_PUT_TAG, 1,
1533 [__vlan_put_tag has 3 parameters])
1538 AC_MSG_CHECKING([if __vlan_hwaccel_put_tag has 3 parameters])
1539 LB_LINUX_TRY_COMPILE([
1540 #include <linux/if_vlan.h>
1542 struct sk_buff *skb;
1543 __vlan_hwaccel_put_tag(skb, 0, 0);
1548 AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_HWACCEL_PUT_TAG, 1,
1549 [__vlan_hwaccel_put_tag has 3 parameters])
1554 AC_MSG_CHECKING([if struct net_device has hw_features])
1555 LB_LINUX_TRY_COMPILE([
1556 #include <linux/netdevice.h>
1558 struct net_device dev;
1559 dev.hw_features = 0;
1564 AC_DEFINE(HAVE_NETDEV_HW_FEATURES, 1,
1565 [hw_features is defined])
1570 AC_MSG_CHECKING([if struct net_device has hw_enc_features])
1571 LB_LINUX_TRY_COMPILE([
1572 #include <linux/netdevice.h>
1574 struct net_device dev;
1575 dev.hw_enc_features = 0;
1580 AC_DEFINE(HAVE_NETDEV_HW_ENC_FEATURES, 1,
1581 [hw_enc_features is defined])
1586 AC_MSG_CHECKING([if struct net_device has rx_cpu_rmap])
1587 LB_LINUX_TRY_COMPILE([
1588 #include <linux/netdevice.h>
1590 struct net_device dev;
1591 dev.rx_cpu_rmap = NULL;
1596 AC_DEFINE(HAVE_NETDEV_RX_CPU_RMAP, 1,
1597 [rx_cpu_rmap is defined])
1602 AC_MSG_CHECKING([if if_vlan.h has vlan_hwaccel_receive_skb])
1603 LB_LINUX_TRY_COMPILE([
1604 #include <linux/if_vlan.h>
1606 struct sk_buff *skb;
1607 vlan_hwaccel_receive_skb(skb,0,0);
1611 AC_DEFINE(HAVE_VLAN_HWACCEL_RECEIVE_SKB, 1,
1612 [vlan_hwaccel_receive_skb is defined])
1617 AC_MSG_CHECKING([if irqdesc.h has irq_desc_get_irq_data])
1618 LB_LINUX_TRY_COMPILE([
1619 #include <linux/irqdesc.h>
1621 struct irq_data *data = irq_desc_get_irq_data(NULL);
1625 AC_DEFINE(HAVE_IRQ_DESC_GET_IRQ_DATA, 1,
1626 [irq_desc_get_irq_data is defined])
1632 AC_MSG_CHECKING([if pci_dev has pcie_mpss])
1633 LB_LINUX_TRY_COMPILE([
1634 #include <linux/pci.h>
1636 struct pci_dev pdev;
1638 pdev->pcie_mpss = 0;
1642 AC_DEFINE(HAVE_PCI_DEV_PCIE_MPSS, 1,
1643 [pcie_mpss is defined])
1648 AC_MSG_CHECKING([if uapi/linux/if_ether.h exist])
1649 LB_LINUX_TRY_COMPILE([
1650 #include <uapi/linux/if_ether.h>
1655 AC_DEFINE(HAVE_UAPI_LINUX_IF_ETHER_H, 1,
1656 [uapi/linux/if_ether.h exist])
1661 AC_MSG_CHECKING([if ifla_vf_info has spoofchk])
1662 LB_LINUX_TRY_COMPILE([
1663 #include <linux/if_link.h>
1665 struct ifla_vf_info *ivf;
1671 AC_DEFINE(HAVE_VF_INFO_SPOOFCHK, 1,
1672 [spoofchk is defined])
1677 AC_MSG_CHECKING([if dst.h has dst_get_neighbour])
1678 LB_LINUX_TRY_COMPILE([
1679 #include <net/dst.h>
1681 struct neighbour *neigh = dst_get_neighbour(NULL);
1686 AC_DEFINE(HAVE_DST_GET_NEIGHBOUR, 1,
1692 AC_MSG_CHECKING([if netlink_dump_start has 6 parameters])
1693 LB_LINUX_TRY_COMPILE([
1694 #include <linux/netlink.h>
1696 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL, 0);
1701 AC_DEFINE(HAVE_NETLINK_DUMP_START_6P, 1,
1707 AC_MSG_CHECKING([if netlink_dump_start has 5 parameters])
1708 LB_LINUX_TRY_COMPILE([
1709 #include <linux/netlink.h>
1711 int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL);
1716 AC_DEFINE(HAVE_NETLINK_DUMP_START_5P, 1,
1722 AC_MSG_CHECKING([if struct dcbnl_rtnl_ops has ieee_getmaxrate/ieee_setmaxrate])
1723 LB_LINUX_TRY_COMPILE([
1724 #include <net/dcbnl.h>
1726 const struct dcbnl_rtnl_ops en_dcbnl_ops = {
1727 .ieee_getmaxrate = NULL,
1728 .ieee_setmaxrate = NULL,
1734 AC_DEFINE(HAVE_IEEE_GET_SET_MAXRATE, 1,
1735 [ieee_getmaxrate/ieee_setmaxrate is defined])
1741 # COMPAT_CONFIG_HEADERS
1743 # add -include config.h
1745 AC_DEFUN([COMPAT_CONFIG_HEADERS],[
1746 AC_CONFIG_HEADERS([config.h])
1747 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
1748 AC_SUBST(EXTRA_KCFLAGS)
1751 AC_DEFUN([OFA_PROG_LINUX],
1756 LB_LINUX_CONFIG([MODULES],[],[
1757 AC_MSG_ERROR([module support is required to build mlnx kernel modules.])
1759 LB_LINUX_CONFIG([MODVERSIONS])
1760 LB_LINUX_CONFIG([KALLSYMS],[],[
1761 AC_MSG_ERROR([compat_mlnx requires that CONFIG_KALLSYMS is enabled in your kernel.])
1765 COMPAT_CONFIG_HEADERS