dnl Checks for the in-box ib_core AC_DEFUN([RDMA_CONFIG_COMPAT], [ AC_MSG_CHECKING([if ib_verbs has ib_dma_map_single]) LB_LINUX_TRY_COMPILE([ #include #include #include #include ],[ ib_dma_map_single(NULL, NULL, 0, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_IB_DMA_MAP, 1, [ib_dma_map_single defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if ib_create_cq wants comp_vector]) LB_LINUX_TRY_COMPILE([ #include #include #include #include ],[ ib_create_cq(NULL, NULL, NULL, NULL, 0, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_IB_COMP_VECTOR, 1, [has completion vector]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if rdma_cm has RDMA_CM_EVENT_ADDR_CHANGE]) LB_LINUX_TRY_COMPILE([ #include #include #include #include ],[ return (RDMA_CM_EVENT_ADDR_CHANGE == 0); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_RDMA_CMEV_ADDRCHANGE, 1, [has completion vector]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if rdma_cm has RDMA_CM_EVENT_TIMEWAIT_EXIT]) LB_LINUX_TRY_COMPILE([ #include #include #include #include ],[ return (RDMA_CM_EVENT_TIMEWAIT_EXIT == 0); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_RDMA_CMEV_TIMEWAIT_EXIT, 1, [has completion vector]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if rdma_cm has rdma_set_reuseaddr]) LB_LINUX_TRY_COMPILE([ #include #include #include #include ],[ rdma_set_reuseaddr(NULL, 1); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_RDMA_SET_REUSEADDR, 1, [rdma_set_reuse defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ib_wc has member named ts]) LB_LINUX_TRY_COMPILE([ #include #include ],[ struct ib_wc wc; wc->ts.timestamp = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_IB_WC_TS, 1, [ib_wc has member named ts]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ib_ah_attr has member named dmac]) LB_LINUX_TRY_COMPILE([ #include #include ],[ struct ib_ah_attr *ah_attr; memset(ah_attr->dmac, 0, 6); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_DMAC, 1, [ah_attr has member named dmac]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ib_ah_attr has member named vlan_id]) LB_LINUX_TRY_COMPILE([ #include #include ],[ struct ib_ah_attr *ah_attr; ah_attr->vlan_id = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INBOX_IB_AH_ATTR_VLAN_ID, 1, [ah_attr has member named vlan_id]) ],[ AC_MSG_RESULT(no) ]) ]) dnl Examine kernel functionality AC_DEFUN([LINUX_CONFIG_COMPAT], [ AC_MSG_CHECKING([if kernel has ktime_get_ns]) LB_LINUX_TRY_COMPILE([ #include ],[ unsigned long long ns; ns = ktime_get_ns(); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_KTIME_GET_NS, 1, [ktime_get_ns defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if svc_xprt_class has xcl_ident]) LB_LINUX_TRY_COMPILE([ #include #include ],[ struct svc_xprt_class svc_rdma_class = { .xcl_ident = XPRT_TRANSPORT_RDMA, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_XCL_IDENT, 1, [xcl_ident defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ifla_vf_info has max_tx_rate]) LB_LINUX_TRY_COMPILE([ #include ],[ struct ifla_vf_info *ivf; ivf->max_tx_rate = 0; ivf->min_tx_rate = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_TX_RATE_LIMIT, 1, [max_tx_rate is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops has get/set_rxfh]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops en_ethtool_ops = { .get_rxfh_indir_size = NULL, .get_rxfh = NULL, .set_rxfh = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_SET_RXFH, 1, [get/set_rxfh is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops has get/set_tunable]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops en_ethtool_ops = { .get_tunable = NULL, .set_tunable = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_SET_TUNABLE, 1, [get/set_tunable is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if exist struct ethtool_ops_ext]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops_ext en_ethtool_ops_ext = { .size = sizeof(struct ethtool_ops_ext), }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ETHTOOL_OPS_EXT, 1, [struct ethtool_ops_ext is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_rxfh]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops_ext en_ethtool_ops_ext = { .get_rxfh_indir_size = NULL, .get_rxfh = NULL, .set_rxfh = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_SET_RXFH_OPS_EXT, 1, [get/set_rxfh is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_rxfh_indir]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops_ext en_ethtool_ops_ext = { .get_rxfh_indir_size = NULL, .get_rxfh_indir = NULL, .set_rxfh_indir = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_SET_RXFH_INDIR, 1, [get/set_rxfh_indir is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device has dev_port]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device *dev = NULL; dev->dev_port = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NET_DEVICE_DEV_PORT, 1, [dev_port is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ptp_clock_info has n_pins]) LB_LINUX_TRY_COMPILE([ #include ],[ struct ptp_clock_info *info; info->n_pins = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PTP_CLOCK_INFO_N_PINS, 1, [n_pins is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if pci.h pci_enable_msi_exact]) LB_LINUX_TRY_COMPILE([ #include ],[ int x = pci_enable_msi_exact(NULL, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCI_ENABLE_MSI_EXACT, 1, [pci_enable_msi_exact is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if pci.h pci_enable_msix_range]) LB_LINUX_TRY_COMPILE([ #include ],[ int x = pci_enable_msix_range(NULL, 0, 0, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCI_ENABLE_MSIX_RANGE, 1, [pci_enable_msix_range is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct iscsi_transport has attr_is_visible]) LB_LINUX_TRY_COMPILE([ #include ],[ static struct iscsi_transport iscsi_iser_transport = { .attr_is_visible = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISCSI_ATTR_IS_VISIBLE, 1, [attr_is_visible is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct iscsi_transport has get_ep_param]) LB_LINUX_TRY_COMPILE([ #include ],[ static struct iscsi_transport iscsi_iser_transport = { .get_ep_param = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISCSI_GET_EP_PARAM, 1, [get_ep_param is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct iscsi_transport has check_protection]) LB_LINUX_TRY_COMPILE([ #include ],[ static struct iscsi_transport iscsi_iser_transport = { .check_protection = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISCSI_CHECK_PROTECTION, 1, [check_protection is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if iscsi_proto.h has struct iscsi_scsi_req]) LB_LINUX_TRY_COMPILE([ #include ],[ struct iscsi_scsi_req *req = NULL; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISCSI_SCSI_REQ, 1, [struct iscsi_scsi_req is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has select_queue_fallback_t]) LB_LINUX_TRY_COMPILE([ #include ],[ select_queue_fallback_t fallback; fallback = NULL; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SELECT_QUEUE_FALLBACK_T, 1, [select_queue_fallback_t is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if skbuff.h has skb_set_hash]) LB_LINUX_TRY_COMPILE([ #include ],[ skb_set_hash(NULL, 0, PKT_HASH_TYPE_L3); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SKB_SET_HASH, 1, [skb_set_hash is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if sockios.h has SIOCGHWTSTAMP]) LB_LINUX_TRY_COMPILE([ #include ],[ int x = SIOCGHWTSTAMP; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SIOCGHWTSTAMP, 1, [SIOCGHWTSTAMP is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if ip.h inet_get_local_port_range has 3 parameters]) LB_LINUX_TRY_COMPILE([ #include ],[ inet_get_local_port_range(NULL, NULL, NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INET_GET_LOCAL_PORT_RANGE_3_PARAMS, 1, [inet_get_local_port_range has 3 parameters]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net.h has net_get_random_once]) LB_LINUX_TRY_COMPILE([ #include ],[ net_get_random_once(NULL, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NET_GET_RANDOM_ONCE, 1, [net_get_random_once is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if inet_sock.h has __inet_ehashfn]) LB_LINUX_TRY_COMPILE([ #include ],[ __inet_ehashfn(0, 0, 0, 0, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INET_EHASHFN, 1, [__inet_ehashfn is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if err.h has PTR_ERR_OR_ZERO]) LB_LINUX_TRY_COMPILE([ #include ],[ int x = PTR_ERR_OR_ZERO(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1, [PTR_ERR_OR_ZERO is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct iscsi_session has discovery_sess]) LB_LINUX_TRY_COMPILE([ #include ],[ struct iscsi_session session; session.discovery_sess = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISCSI_DISCOVERY_SESS, 1, [discovery_sess is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if enum iscsi_param has ISCSI_PARAM_DISCOVERY_SESS]) LB_LINUX_TRY_COMPILE([ #include ],[ int x = ISCSI_PARAM_DISCOVERY_SESS; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISCSI_PARAM_DISCOVERY_SESS, 1, [ISCSI_PARAM_DISCOVERY_SESS is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if pci.h has enum pcie_link_width]) LB_LINUX_TRY_COMPILE([ #include ],[ enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCIE_LINK_WIDTH, 1, [pcie_link_width is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if pci.h has enum pci_bus_speed]) LB_LINUX_TRY_COMPILE([ #include ],[ enum pci_bus_speed speed = PCI_SPEED_UNKNOWN; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCI_BUS_SPEED, 1, [pci_bus_speed is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has struct netdev_phys_port_id]) LB_LINUX_TRY_COMPILE([ #include ],[ struct netdev_phys_port_id *x = NULL; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_PHYS_PORT_ID, 1, [netdev_phys_port_id is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ifla_vf_info has linkstate]) LB_LINUX_TRY_COMPILE([ #include ],[ struct struct ifla_vf_info x; x->linkstate = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_LINKSTATE, 1, [linkstate is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if busy_poll.h has skb_mark_napi_id]) LB_LINUX_TRY_COMPILE([ #include ],[ skb_mark_napi_id(NULL, NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SKB_MARK_NAPI_ID, 1, [skb_mark_napi_id is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has napi_hash_add]) LB_LINUX_TRY_COMPILE([ #include ],[ napi_hash_add(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NAPI_HASH_ADD, 1, [napi_hash_add is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has netif_keep_dst]) LB_LINUX_TRY_COMPILE([ #include ],[ netif_keep_dst(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETIF_KEEP_DST, 1, [netif_keep_dst is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if mm.h has kvfree]) LB_LINUX_TRY_COMPILE([ #include ],[ kvfree(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_KVFREE, 1, [kvfree is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has dev_consume_skb_any]) LB_LINUX_TRY_COMPILE([ #include ],[ dev_consume_skb_any(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DEV_CONSUME_SKB_ANY, 1, [dev_consume_skb_any is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has netdev_txq_bql_complete_prefetchw]) LB_LINUX_TRY_COMPILE([ #include ],[ netdev_txq_bql_complete_prefetchw(NULL); netdev_txq_bql_enqueue_prefetchw(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_TXQ_BQL_PREFETCHW, 1, [netdev_txq_bql_complete_prefetchw is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct sk_buff has xmit_more]) LB_LINUX_TRY_COMPILE([ #include ],[ struct sk_buff *skb; skb->xmit_more = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SK_BUFF_XMIT_MORE, 1, [xmit_more is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct sk_buff has encapsulation]) LB_LINUX_TRY_COMPILE([ #include ],[ struct sk_buff *skb; skb->encapsulation = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SK_BUFF_ENCAPSULATION, 1, [encapsulation is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if etherdevice.h has eth_get_headlen]) LB_LINUX_TRY_COMPILE([ #include ],[ eth_get_headlen(NULL, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ETH_GET_HEADLEN, 1, [eth_get_headlen is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct sk_buff has csum_level]) LB_LINUX_TRY_COMPILE([ #include ],[ struct sk_buff *skb; skb->csum_level = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SK_BUFF_CSUM_LEVEL, 1, [csum_level is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct skbuff.h has skb_inner_transport_header]) LB_LINUX_TRY_COMPILE([ #include ],[ skb_inner_transport_header(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SKB_INNER_TRANSPORT_HEADER, 1, [skb_inner_transport_header is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct skbuff.h has skb_inner_network_header]) LB_LINUX_TRY_COMPILE([ #include ],[ skb_inner_network_header(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SKB_INNER_NETWORK_HEADER, 1, [skb_inner_network_header is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if if_vlan.h has vlan_dev_get_egress_qos_mask]) LB_LINUX_TRY_COMPILE([ #include ],[ vlan_dev_get_egress_qos_mask(NULL, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_VLAN_DEV_GET_EGRESS_QOS_MASK, 1, [vlan_dev_get_egress_qos_mask is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has netdev_get_prio_tc_map]) LB_LINUX_TRY_COMPILE([ #include ],[ netdev_get_prio_tc_map(NULL, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_GET_PRIO_TC_MAP, 1, [netdev_get_prio_tc_map is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if if_vlan.h has __vlan_find_dev_deep_rcu]) LB_LINUX_TRY_COMPILE([ #include ],[ __vlan_find_dev_deep_rcu(NULL, 0, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE___VLAN_FIND_DEV_DEEP_RCU, 1, [__vlan_find_dev_deep_rcu is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if ndo_select_queue has accel_priv]) LB_LINUX_TRY_COMPILE([ #include static u16 select_queue(struct net_device *dev, struct sk_buff *skb, void *accel_priv) { return 0; } ],[ struct net_device_opts ndops; ndops.ndo_select_queue = select_queue; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(NDO_SELECT_QUEUE_HAS_ACCEL_PRIV, 1, [ndo_select_queue has accel_priv]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if drivers/net/bonding/bonding.h exists]) LB_LINUX_TRY_COMPILE([ #include "../drivers/net/bonding/bonding.h" ],[ return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_BONDING_H, 1, [drivers/net/bonding/bonding.h exists]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if bonding.h bond_for_each_slave has 3 parameters]) LB_LINUX_TRY_COMPILE([ #include "../drivers/net/bonding/bonding.h" ],[ struct bonding *bond = NULL; struct list_head *iter = NULL; struct slave *slave = NULL; bond_for_each_slave(bond, slave, iter) ; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_BOND_FOR_EACH_SLAVE_3_PARAMS, 1, [bond_for_each_slave has 3 parameters]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_init]) LB_LINUX_TRY_COMPILE([ #include ],[ struct u64_stats_sync sync; u64_stats_init(&sync); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_U64_STATS_SYNC, 1, [u64_stats_sync is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if u64_stats_sync.h has u64_stats_fetch_begin_irq]) LB_LINUX_TRY_COMPILE([ #include ],[ struct u64_stats_sync sync; u64_stats_fetch_begin_irq(&sync); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_U64_STATS_FETCH_BEGIN_IRQ, 1, [u64_stats_fetch_begin_irq is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if etherdevice.h has ether_addr_copy]) LB_LINUX_TRY_COMPILE([ #include ],[ char dest[6], src[6]; ether_addr_copy(&dest, &src); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ETHER_ADDR_COPY, 1, [ether_addr_copy is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_vf_rate]) LB_LINUX_TRY_COMPILE([ #include int set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, int max_tx_rate) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_set_vf_rate = set_vf_rate; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SET_VF_RATE, 1, [ndo_set_vf_rate is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdev_extended has hw_features]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device *dev = NULL; netdev_extended(dev)->hw_features = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_EXTENDED_HW_FEATURES, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_extended has _tx_ext]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device *dev = NULL; netdev_extended(dev)->_tx_ext = NULL; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NET_DEVICE_EXTENDED_TX_EXT, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_extended has ndo_busy_poll]) LB_LINUX_TRY_COMPILE([ #include int busy_poll(struct napi_struct *napi) { return 0; } ],[ struct net_device *dev = NULL; netdev_extended(dev)->ndo_busy_poll = busy_poll; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_EXTENDED_NDO_BUSY_POLL, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has set_netdev_hw_features]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device *dev = NULL; set_netdev_hw_features(dev, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SET_NETDEV_HW_FEATURES, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has netif_set_xps_queue]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device *dev = NULL; netif_set_xps_queue(dev, NULL, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETIF_SET_XPS_QUEUE, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops has *ndo_set_features]) LB_LINUX_TRY_COMPILE([ #include int set_features(struct net_device *dev, netdev_features_t features) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_set_features = set_features; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NDO_SET_FEATURES, 1, [ndo_set_features is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops has *ndo_setup_tc]) LB_LINUX_TRY_COMPILE([ #include int setup_tc(struct net_device *dev, , u8 tc) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_setup_tc = setup_tc; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NDO_SETUP_TC, 1, [ndo_setup_tc is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops has *ndo_rx_flow_steer]) LB_LINUX_TRY_COMPILE([ #include int rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, u16 rxq_index, u32 flow_id) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_rx_flow_steer = rx_flow_steer; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NDO_RX_FLOW_STEER, 1, [ndo_rx_flow_steer is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device has priv_flags]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device *netdev; netdev->priv_flags = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NET_DEVICE_PRIV_FLAGS, 1, [priv_flags is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_stats64]) LB_LINUX_TRY_COMPILE([ #include struct rtnl_link_stats64* get_stats_64(struct net_device *dev, struct rtnl_link_stats64 *storage) { struct rtnl_link_stats64 stats_64; return &stats_64; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_get_stats64 = get_stats_64; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NDO_GET_STATS64, 1, [ndo_get_stats64 is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops has ndo_bridge_set/getlink]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device_ops netdev_ops = { .ndo_bridge_setlink = NULL, .ndo_bridge_getlink = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NDO_BRIDGE_SET_GET_LINK, 1, [ndo_bridge_set/getlink is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops ndo_vlan_rx_add_vid has 3 parameters ]) LB_LINUX_TRY_COMPILE([ #include int vlan_rx_add_vid(struct net_device *dev,__be16 proto, u16 vid) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_vlan_rx_add_vid = vlan_rx_add_vid; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NDO_RX_ADD_VID_HAS_3_PARAMS, 1, [ndo_vlan_rx_add_vid has 3 parameters]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_ops has ndo_get_phys_port_id]) LB_LINUX_TRY_COMPILE([ #include int get_phys_port_id(struct net_device *dev, struct netdev_phys_port_id *ppid) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_get_phys_port_id = get_phys_port_id; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_NDO_GET_PHYS_PORT_ID, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device_ops_ext exist]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device_ops_ext netdev_ops_ext; struct net_device_ops_ext netdev_ops__ext = { .size = sizeof(struct net_device_ops_ext), }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NET_DEVICE_OPS_EXT, 1, [struct net_device_ops_ext is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_ops_ext has ndo_get_phys_port_id]) LB_LINUX_TRY_COMPILE([ #include int get_phys_port_id(struct net_device *dev, struct netdev_phys_port_id *ppid) { return 0; } ],[ struct net_device_ops_ext netdev_ops_ext; netdev_ops_ext.ndo_get_phys_port_id = get_phys_port_id; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_EXT_NDO_GET_PHYS_PORT_ID, 1, [ndo_get_phys_port_id is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_spoofchk]) LB_LINUX_TRY_COMPILE([ #include int set_vf_spoofchk(struct net_device *dev, int vf, bool setting) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_set_vf_spoofchk = set_vf_spoofchk; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_SPOOFCHK, 1, [ndo_set_vf_spoofchk is defined in net_device_ops]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_spoofchk]) LB_LINUX_TRY_COMPILE([ #include int set_vf_spoofchk(struct net_device *dev, int vf, bool setting) { return 0; } ],[ struct net_device_ops_ext netdev_ops_ext; netdev_ops_ext.ndo_set_vf_spoofchk = set_vf_spoofchk; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_SPOOFCHK, 1, [ndo_set_vf_spoofchk is defined in net_device_ops_ext]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_ops has ndo_set_vf_link_state]) LB_LINUX_TRY_COMPILE([ #include int set_vf_link_state(struct net_device *dev, int vf, int link_state) { return 0; } ],[ struct net_device_ops netdev_ops; netdev_ops.ndo_set_vf_link_state = set_vf_link_state; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_OPS_NDO_SET_VF_LINK_STATE, 1, [ndo_set_vf_link_state is defined in net_device_ops]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if net_device_ops_ext has ndo_set_vf_link_state]) LB_LINUX_TRY_COMPILE([ #include int set_vf_link_state(struct net_device *dev, int vf, int link_state) { return 0; } ],[ struct net_device_ops_ext netdev_ops_ext; netdev_ops_ext.ndo_set_vf_link_state = set_vf_link_state; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_OPS_EXT_NDO_SET_VF_LINK_STATE, 1, [ndo_set_vf_link_state is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h netif_set_real_num_tx_queues returns int]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device dev; int ret; ret = netif_set_real_num_tx_queues(&dev, 2); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_RETURN_INT_FOR_SET_NUM_TX_QUEUES, 1, [netif_set_real_num_tx_queues returns int]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct netdevice.h has struct xps_map]) LB_LINUX_TRY_COMPILE([ #include ],[ struct xps_map map; map.len = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_XPS_MAP, 1, [struct xps_map is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops has set_phys_id]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops en_ethtool_ops = { .set_phys_id= NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SET_PHYS_ID, 1, [set_phys_id is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops has get/set_channels]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops en_ethtool_ops = { .get_channels = NULL, .set_channels = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_SET_CHANNELS, 1, [get/set_channels is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops_ext has get/set_channels]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops_ext en_ethtool_ops_ext = { .get_channels = NULL, .set_channels = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_SET_CHANNELS_EXT, 1, [get/set_channels is defined in ethtool_ops_ext]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops has get_ts_info]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops en_ethtool_ops = { .get_ts_info = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_TS_INFO, 1, [get_ts_info is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_ops_ext has get_ts_info]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct ethtool_ops_ext en_ethtool_ops_ext = { .get_ts_info = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GET_TS_INFO_EXT, 1, [get_ts_info is defined in ethtool_ops_ext]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct ethtool_flow_ext has h_dest]) LB_LINUX_TRY_COMPILE([ #include ],[ unsigned char mac[ETH_ALEN]; struct ethtool_flow_ext h_ext; memcpy(&mac, h_ext.h_dest, ETH_ALEN); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ETHTOOL_FLOW_EXT_H_DEST, 1, [ethtool_flow_ext has h_dest]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netdevice.h has struct netdev_hw_addr]) LB_LINUX_TRY_COMPILE([ #include ],[ struct netdev_hw_addr addr; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_HW_ADDR, 1, [netdev_hw_addr is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if pci.h has pci_vfs_assigned]) LB_LINUX_TRY_COMPILE([ #include ],[ struct pci_dev pdev; pci_vfs_assigned(&pdev); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCI_VF_ASSIGNED, 1, [pci_vfs_assigned is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if __vlan_put_tag has 3 parameters]) LB_LINUX_TRY_COMPILE([ #include ],[ struct sk_buff *skb; __vlan_put_tag(skb, 0, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_PUT_TAG, 1, [__vlan_put_tag has 3 parameters]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if __vlan_hwaccel_put_tag has 3 parameters]) LB_LINUX_TRY_COMPILE([ #include ],[ struct sk_buff *skb; __vlan_hwaccel_put_tag(skb, 0, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_3_PARAMS_FOR_VLAN_HWACCEL_PUT_TAG, 1, [__vlan_hwaccel_put_tag has 3 parameters]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device has hw_features]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device dev; dev.hw_features = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_HW_FEATURES, 1, [hw_features is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device has hw_enc_features]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device dev; dev.hw_enc_features = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_HW_ENC_FEATURES, 1, [hw_enc_features is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct net_device has rx_cpu_rmap]) LB_LINUX_TRY_COMPILE([ #include ],[ struct net_device dev; dev.rx_cpu_rmap = NULL; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETDEV_RX_CPU_RMAP, 1, [rx_cpu_rmap is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if if_vlan.h has vlan_hwaccel_receive_skb]) LB_LINUX_TRY_COMPILE([ #include ],[ struct sk_buff *skb; vlan_hwaccel_receive_skb(skb,0,0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_VLAN_HWACCEL_RECEIVE_SKB, 1, [vlan_hwaccel_receive_skb is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if irqdesc.h has irq_desc_get_irq_data]) LB_LINUX_TRY_COMPILE([ #include ],[ struct irq_data *data = irq_desc_get_irq_data(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_IRQ_DESC_GET_IRQ_DATA, 1, [irq_desc_get_irq_data is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if pci_dev has pcie_mpss]) LB_LINUX_TRY_COMPILE([ #include ],[ struct pci_dev pdev; pdev->pcie_mpss = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCI_DEV_PCIE_MPSS, 1, [pcie_mpss is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if uapi/linux/if_ether.h exist]) LB_LINUX_TRY_COMPILE([ #include ],[ return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_UAPI_LINUX_IF_ETHER_H, 1, [uapi/linux/if_ether.h exist]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if ifla_vf_info has spoofchk]) LB_LINUX_TRY_COMPILE([ #include ],[ struct ifla_vf_info *ivf; ivf->spoofchk = 0; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_VF_INFO_SPOOFCHK, 1, [spoofchk is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if dst.h has dst_get_neighbour]) LB_LINUX_TRY_COMPILE([ #include ],[ struct neighbour *neigh = dst_get_neighbour(NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DST_GET_NEIGHBOUR, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netlink_dump_start has 6 parameters]) LB_LINUX_TRY_COMPILE([ #include ],[ int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL, 0); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETLINK_DUMP_START_6P, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if netlink_dump_start has 5 parameters]) LB_LINUX_TRY_COMPILE([ #include ],[ int ret = netlink_dump_start(NULL, NULL, NULL, NULL, NULL); return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NETLINK_DUMP_START_5P, 1, [ is defined]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([if struct dcbnl_rtnl_ops has ieee_getmaxrate/ieee_setmaxrate]) LB_LINUX_TRY_COMPILE([ #include ],[ const struct dcbnl_rtnl_ops en_dcbnl_ops = { .ieee_getmaxrate = NULL, .ieee_setmaxrate = NULL, }; return 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_IEEE_GET_SET_MAXRATE, 1, [ieee_getmaxrate/ieee_setmaxrate is defined]) ],[ AC_MSG_RESULT(no) ]) ]) # # COMPAT_CONFIG_HEADERS # # add -include config.h # AC_DEFUN([COMPAT_CONFIG_HEADERS],[ AC_CONFIG_HEADERS([config.h]) EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS" AC_SUBST(EXTRA_KCFLAGS) ]) AC_DEFUN([OFA_PROG_LINUX], [ LB_LINUX_PATH LB_LINUX_SYMVERFILE LB_LINUX_CONFIG([MODULES],[],[ AC_MSG_ERROR([module support is required to build mlnx kernel modules.]) ]) LB_LINUX_CONFIG([MODVERSIONS]) LB_LINUX_CONFIG([KALLSYMS],[],[ AC_MSG_ERROR([compat_mlnx requires that CONFIG_KALLSYMS is enabled in your kernel.]) ]) LINUX_CONFIG_COMPAT COMPAT_CONFIG_HEADERS ])