git: bbe35708ad03 - main - qlnx: purge EOL release compatibility
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 04 Feb 2023 16:20:24 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bbe35708ad0313769ae71fdd43b573e6fffce587 commit bbe35708ad0313769ae71fdd43b573e6fffce587 Author: Elliott Mitchell <ehem+freebsd@m5p.com> AuthorDate: 2022-06-23 00:53:47 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-02-04 16:13:08 +0000 qlnx: purge EOL release compatibility Drop code that supproted FreeBSD 10 and 11. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/603 Differential Revision: https://reviews.freebsd.org/D35560 --- sys/dev/qlnx/qlnxe/bcm_osal.h | 31 -- sys/dev/qlnx/qlnxe/qlnx_def.h | 13 - sys/dev/qlnx/qlnxe/qlnx_os.c | 102 +----- sys/dev/qlnx/qlnxe/qlnx_os.h | 4 - sys/dev/qlnx/qlnxr/qlnxr_cm.c | 12 - sys/dev/qlnx/qlnxr/qlnxr_cm.h | 10 - sys/dev/qlnx/qlnxr/qlnxr_def.h | 17 - sys/dev/qlnx/qlnxr/qlnxr_os.c | 38 +-- sys/dev/qlnx/qlnxr/qlnxr_verbs.c | 715 +-------------------------------------- sys/dev/qlnx/qlnxr/qlnxr_verbs.h | 46 --- 10 files changed, 8 insertions(+), 980 deletions(-) diff --git a/sys/dev/qlnx/qlnxe/bcm_osal.h b/sys/dev/qlnx/qlnxe/bcm_osal.h index c39b9df46cb7..07b0fe47ea36 100644 --- a/sys/dev/qlnx/qlnxe/bcm_osal.h +++ b/sys/dev/qlnx/qlnxe/bcm_osal.h @@ -35,16 +35,7 @@ #include <sys/bitstring.h> #include <linux/types.h> - -#if __FreeBSD_version >= 1200032 #include <linux/bitmap.h> -#else -#if __FreeBSD_version >= 1100090 -#include <compat/linuxkpi/common/include/linux/bitops.h> -#else -#include <ofed/include/linux/bitops.h> -#endif -#endif #define OSAL_NUM_CPUS() mp_ncpus /* @@ -481,34 +472,12 @@ qlnx_test_and_change_bit(long bit, volatile unsigned long *var) val = *var; -#if __FreeBSD_version >= 1100000 if (val & bit) return (test_and_clear_bit(bit, var)); return (test_and_set_bit(bit, var)); -#else - if (val & bit) - return (test_and_clear_bit(bit, (long *)var)); - - return (test_and_set_bit(bit, (long *)var)); - -#endif } -#if __FreeBSD_version < 1100000 -static inline unsigned -bitmap_weight(unsigned long *bitmap, unsigned nbits) -{ - unsigned bit; - unsigned retval = 0; - - for_each_set_bit(bit, bitmap, nbits) - retval++; - return (retval); -} - -#endif - #define OSAL_TEST_AND_FLIP_BIT qlnx_test_and_change_bit #define OSAL_TEST_AND_CLEAR_BIT test_and_clear_bit #define OSAL_MEMCMP memcmp diff --git a/sys/dev/qlnx/qlnxe/qlnx_def.h b/sys/dev/qlnx/qlnxe/qlnx_def.h index 7b5f6bdc25f3..87ef7985647d 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_def.h +++ b/sys/dev/qlnx/qlnxe/qlnx_def.h @@ -715,17 +715,6 @@ extern int qlnx_alloc_mem_sb(qlnx_host_t *ha, struct ecore_sb_info *sb_info, #define QLNX_IFM_25G_CR IFM_UNKNOWN #endif /* #if (defined IFM_25G_SR) */ -#if __FreeBSD_version < 1100000 - -#define QLNX_INC_IERRORS(ifp) ifp->if_ierrors++ -#define QLNX_INC_IQDROPS(ifp) ifp->if_iqdrops++ -#define QLNX_INC_IPACKETS(ifp) ifp->if_ipackets++ -#define QLNX_INC_OPACKETS(ifp) ifp->if_opackets++ -#define QLNX_INC_OBYTES(ifp, len) ifp->if_obytes += len -#define QLNX_INC_IBYTES(ifp, len) ifp->if_ibytes += len - -#else - #define QLNX_INC_IERRORS(ifp) if_inc_counter(ifp, IFCOUNTER_IERRORS, 1) #define QLNX_INC_IQDROPS(ifp) if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1) #define QLNX_INC_IPACKETS(ifp) if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1) @@ -736,8 +725,6 @@ extern int qlnx_alloc_mem_sb(qlnx_host_t *ha, struct ecore_sb_info *sb_info, #define QLNX_INC_IBYTES(ifp, len) \ if_inc_counter(ha->ifp, IFCOUNTER_IBYTES, len) -#endif /* #if __FreeBSD_version < 1100000 */ - #define CQE_L3_PACKET(flags) \ ((((flags) & PARSING_AND_ERR_FLAGS_L3TYPE_MASK) == e_l3_type_ipv4) || \ (((flags) & PARSING_AND_ERR_FLAGS_L3TYPE_MASK) == e_l3_type_ipv6)) diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 80056215f7a9..9d31024c29c1 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -152,9 +152,7 @@ static int qlnx_alloc_tpa_mbuf(qlnx_host_t *ha, uint16_t rx_buf_size, struct qlnx_agg_info *tpa); static void qlnx_free_tpa_mbuf(qlnx_host_t *ha, struct qlnx_agg_info *tpa); -#if __FreeBSD_version >= 1100000 static uint64_t qlnx_get_counter(if_t ifp, ift_counter cnt); -#endif /* * Hooks to the Operating Systems @@ -274,12 +272,6 @@ SYSCTL_NODE(_hw, OID_AUTO, qlnxe, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, /* Number of Queues: 0 (Auto) or 1 to 32 (fixed queue number) */ static int qlnxe_queue_count = QLNX_DEFAULT_RSS; -#if __FreeBSD_version < 1100000 - -TUNABLE_INT("hw.qlnxe.queue_count", &qlnxe_queue_count); - -#endif - SYSCTL_INT(_hw_qlnxe, OID_AUTO, queue_count, CTLFLAG_RDTUN, &qlnxe_queue_count, 0, "Multi-Queue queue count"); @@ -304,20 +296,9 @@ SYSCTL_INT(_hw_qlnxe, OID_AUTO, queue_count, CTLFLAG_RDTUN, /* RDMA configuration; 64bit field allows setting for 16 physical functions*/ static uint64_t qlnxe_rdma_configuration = 0x22222222; -#if __FreeBSD_version < 1100000 - -TUNABLE_QUAD("hw.qlnxe.rdma_configuration", &qlnxe_rdma_configuration); - -SYSCTL_UQUAD(_hw_qlnxe, OID_AUTO, rdma_configuration, CTLFLAG_RDTUN, - &qlnxe_rdma_configuration, 0, "RDMA Configuration"); - -#else - SYSCTL_U64(_hw_qlnxe, OID_AUTO, rdma_configuration, CTLFLAG_RDTUN, &qlnxe_rdma_configuration, 0, "RDMA Configuration"); -#endif /* #if __FreeBSD_version < 1100000 */ - int qlnx_vf_device(qlnx_host_t *ha) { @@ -2333,8 +2314,6 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) device_id = pci_get_device(ha->pci_dev); -#if __FreeBSD_version >= 1000000 - if (device_id == QLOGIC_PCI_DEVICE_ID_1634) ifp->if_baudrate = IF_Gbps(40); else if ((device_id == QLOGIC_PCI_DEVICE_ID_1656) || @@ -2346,11 +2325,6 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) ifp->if_baudrate = IF_Gbps(100); ifp->if_capabilities = IFCAP_LINKSTATE; -#else - ifp->if_mtu = ETHERMTU; - ifp->if_baudrate = (1 * 1000 * 1000 *1000); - -#endif /* #if __FreeBSD_version >= 1000000 */ ifp->if_init = qlnx_init; ifp->if_softc = ha; @@ -2363,9 +2337,7 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) ifp->if_snd.ifq_drv_maxlen = qlnx_get_ifq_snd_maxlen(ha); IFQ_SET_READY(&ifp->if_snd); -#if __FreeBSD_version >= 1100036 if_setgetcounterfn(ifp, qlnx_get_counter); -#endif ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; @@ -2789,8 +2761,6 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) VLAN_CAPABILITIES(ifp); break; -#if (__FreeBSD_version >= 1100101) - case SIOCGI2C: { struct ifi2creq i2c; @@ -2838,7 +2808,6 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) i2c.data[4], i2c.data[5], i2c.data[6], i2c.data[7]); break; } -#endif /* #if (__FreeBSD_version >= 1100101) */ default: QL_DPRINT4(ha, "default (0x%lx)\n", cmd); @@ -3085,11 +3054,7 @@ qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) QL_DPRINT2(ha, "enter\n"); -#if __FreeBSD_version >= 1100000 if (M_HASHTYPE_GET(mp) != M_HASHTYPE_NONE) -#else - if (mp->m_flags & M_FLOWID) -#endif rss_id = (mp->m_pkthdr.flowid % ECORE_RSS_IND_TABLE_SIZE) % ha->num_rss; @@ -3971,9 +3936,7 @@ qlnx_tpa_start(qlnx_host_t *ha, bus_dmamap_t map; struct eth_rx_bd *rx_bd; int i; -#if __FreeBSD_version >= 1100000 uint8_t hash_type; -#endif /* #if __FreeBSD_version >= 1100000 */ agg_index = cqe->tpa_agg_index; @@ -4225,8 +4188,6 @@ qlnx_tpa_start(qlnx_host_t *ha, //mp->m_pkthdr.flowid = fp->rss_id; mp->m_pkthdr.flowid = cqe->rss_hash; -#if __FreeBSD_version >= 1100000 - hash_type = cqe->bitfields & (ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE_MASK << ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE_SHIFT); @@ -4253,10 +4214,6 @@ qlnx_tpa_start(qlnx_host_t *ha, break; } -#else - mp->m_flags |= M_FLOWID; -#endif - mp->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR); @@ -4600,9 +4557,7 @@ qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, enum eth_rx_cqe_type cqe_type; uint16_t len, pad, len_on_first_bd; uint8_t *data; -#if __FreeBSD_version >= 1100000 uint8_t hash_type; -#endif /* #if __FreeBSD_version >= 1100000 */ /* Get the CQE from the completion ring */ cqe = (union eth_rx_cqe *) @@ -4742,8 +4697,6 @@ qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, mp->m_pkthdr.flowid = fp_cqe->rss_hash; -#if __FreeBSD_version >= 1100000 - hash_type = fp_cqe->bitfields & (ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE_MASK << ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE_SHIFT); @@ -4770,10 +4723,6 @@ qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, break; } -#else - mp->m_flags |= M_FLOWID; -#endif - if (CQE_L3_PACKET(fp_cqe->pars_flags.flags)) { mp->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; } @@ -4797,22 +4746,10 @@ qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, QLNX_INC_IBYTES(ifp, len); #ifdef QLNX_SOFT_LRO - - if (lro_enable) { -#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - + if (lro_enable) tcp_lro_queue_mbuf(lro, mp); - -#else - - if (tcp_lro_rx(lro, mp, 0)) - (*ifp->if_input)(ifp, mp); - -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ - - } else { + else (*ifp->if_input)(ifp, mp); - } #else (*ifp->if_input)(ifp, mp); @@ -4932,7 +4869,6 @@ qlnx_fp_isr(void *arg) lro = &fp->rxq->lro; if (lro_enable && total_rx_count) { -#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) #ifdef QLNX_TRACE_LRO_CNT if (lro->lro_mbuf_count & ~1023) @@ -4948,17 +4884,6 @@ qlnx_fp_isr(void *arg) #endif /* #ifdef QLNX_TRACE_LRO_CNT */ tcp_lro_flush_all(lro); - -#else - struct lro_entry *queued; - - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, \ - next); - tcp_lro_flush(lro, queued); - } -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ } } #endif /* #ifdef QLNX_SOFT_LRO */ @@ -6287,19 +6212,11 @@ qlnx_alloc_mem_rxq(qlnx_host_t *ha, struct qlnx_rx_queue *rxq) lro = &rxq->lro; -#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) if (tcp_lro_init_args(lro, ifp, 0, rxq->num_rx_buffers)) { QL_DPRINT1(ha, "tcp_lro_init[%d] failed\n", rxq->rxq_id); goto err; } -#else - if (tcp_lro_init(lro)) { - QL_DPRINT1(ha, "tcp_lro_init[%d] failed\n", - rxq->rxq_id); - goto err; - } -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ lro->ifp = ha->ifp; } @@ -7197,7 +7114,6 @@ qlnx_set_link(qlnx_host_t *ha, bool link_up) return (rc); } -#if __FreeBSD_version >= 1100000 static uint64_t qlnx_get_counter(if_t ifp, ift_counter cnt) { @@ -7262,7 +7178,6 @@ qlnx_get_counter(if_t ifp, ift_counter cnt) } return (count); } -#endif static void qlnx_timer(void *arg) @@ -7382,20 +7297,7 @@ qlnx_drain_soft_lro(qlnx_host_t *ha) lro = &fp->rxq->lro; -#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - tcp_lro_flush_all(lro); - -#else - struct lro_entry *queued; - - while ((!SLIST_EMPTY(&lro->lro_active))){ - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } - -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ } } diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.h b/sys/dev/qlnx/qlnxe/qlnx_os.h index 9f4176f9f29f..f7111f5e3f4b 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.h +++ b/sys/dev/qlnx/qlnxe/qlnx_os.h @@ -50,10 +50,6 @@ #include <machine/_inttypes.h> #include <sys/conf.h> -#if __FreeBSD_version < 1000000 -#error FreeBSD Version not supported - use version >= 1000000 -#endif - #include <net/if.h> #include <net/if_var.h> #include <net/if_arp.h> diff --git a/sys/dev/qlnx/qlnxr/qlnxr_cm.c b/sys/dev/qlnx/qlnxr/qlnxr_cm.c index 7d2bff15c491..2a36e7412f2d 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_cm.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_cm.c @@ -494,11 +494,9 @@ qlnxr_gsi_build_header(struct qlnxr_dev *dev, u16 vlan_id = 0; u16 ether_type; -#if __FreeBSD_version >= 1102000 int rc = 0; int ip_ver = 0; bool has_udp = false; -#endif /* #if __FreeBSD_version >= 1102000 */ #if !DEFINE_IB_AH_ATTR_WITH_DMAC u8 mac[ETH_ALEN]; @@ -517,8 +515,6 @@ qlnxr_gsi_build_header(struct qlnxr_dev *dev, else sgid = dev->sgid_tbl[0]; -#if __FreeBSD_version >= 1102000 - rc = ib_ud_header_init(send_size, false /* LRH */, true /* ETH */, has_vlan, has_grh_ipv6, ip_ver, has_udp, 0 /* immediate */, udh); @@ -528,12 +524,6 @@ qlnxr_gsi_build_header(struct qlnxr_dev *dev, return rc; } -#else - ib_ud_header_init(send_size, false /* LRH */, true /* ETH */, - has_vlan, has_grh_ipv6, 0 /* immediate */, udh); - -#endif /* #if __FreeBSD_version >= 1102000 */ - /* ENET + VLAN headers*/ #if DEFINE_IB_AH_ATTR_WITH_DMAC memcpy(udh->eth.dmac_h, ah_attr->dmac, ETH_ALEN); @@ -846,7 +836,6 @@ qlnxr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) wc[i].byte_len = qp->rqe_wr_id[qp->rq.cons].sg_list[0].length; wc[i].wc_flags |= IB_WC_GRH | IB_WC_IP_CSUM_OK; -#if __FreeBSD_version >= 1100000 memcpy(&wc[i].smac, qp->rqe_wr_id[qp->rq.cons].smac, ETH_ALEN); wc[i].wc_flags |= IB_WC_WITH_SMAC; @@ -855,7 +844,6 @@ qlnxr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) wc[i].vlan_id = qp->rqe_wr_id[qp->rq.cons].vlan_id; } -#endif qlnxr_inc_sw_cons(&qp->rq); i++; } diff --git a/sys/dev/qlnx/qlnxr/qlnxr_cm.h b/sys/dev/qlnx/qlnxr/qlnxr_cm.h index 530a42833e95..72956a858bfc 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_cm.h +++ b/sys/dev/qlnx/qlnxr/qlnxr_cm.h @@ -42,20 +42,10 @@ #define ETH_P_ROCE (0x8915) #define QLNXR_ROCE_V2_UDP_SPORT (0000) -#if __FreeBSD_version >= 1102000 - #define rdma_wr(_wr) rdma_wr(_wr) #define ud_wr(_wr) ud_wr(_wr) #define atomic_wr(_wr) atomic_wr(_wr) -#else - -#define rdma_wr(_wr) (&(_wr->wr.rdma)) -#define ud_wr(_wr) (&(_wr->wr.ud)) -#define atomic_wr(_wr) (&(_wr->wr.atomic)) - -#endif /* #if __FreeBSD_version >= 1102000 */ - static inline u32 qlnxr_get_ipv4_from_gid(u8 *gid) { return *(u32 *)(void *)&gid[12]; diff --git a/sys/dev/qlnx/qlnxr/qlnxr_def.h b/sys/dev/qlnx/qlnxr/qlnxr_def.h index 2b9b378a1468..2d67a881da06 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_def.h +++ b/sys/dev/qlnx/qlnxr/qlnxr_def.h @@ -67,10 +67,6 @@ #include <rdma/ib_sa.h> #include <rdma/uverbs_ioctl.h> -#if __FreeBSD_version < 1100000 -#undef MODULE_VERSION -#endif - #include "qlnx_os.h" #include "bcm_osal.h" @@ -627,11 +623,7 @@ struct mr_info { u32 completed_handled; }; -#if __FreeBSD_version < 1102000 -#define DEFINE_IB_FAST_REG -#else #define DEFINE_ALLOC_MR -#endif #ifdef DEFINE_IB_FAST_REG struct qlnxr_fast_reg_page_list { @@ -649,11 +641,7 @@ struct qlnxr_qp { u32 max_inline_data; -#if __FreeBSD_version >= 1100000 spinlock_t q_lock ____cacheline_aligned; -#else - spinlock_t q_lock; -#endif struct qlnxr_cq *sq_cq; struct qlnxr_cq *rq_cq; @@ -899,12 +887,7 @@ extern int qlnx_rdma_ll2_set_mac_filter(void *rdma_ctx, uint8_t *old_mac_address #define QLNXR_ROCE_PKEY_TABLE_LEN 1 #define QLNXR_ROCE_PKEY_DEFAULT 0xffff -#if __FreeBSD_version < 1100000 -#define DEFINE_IB_AH_ATTR_WITH_DMAC (0) -#define DEFINE_IB_UMEM_WITH_CHUNK (1) -#else #define DEFINE_IB_AH_ATTR_WITH_DMAC (1) -#endif #define QLNX_IS_IWARP(rdev) IS_IWARP(ECORE_LEADING_HWFN(rdev->cdev)) #define QLNX_IS_ROCE(rdev) IS_ROCE(ECORE_LEADING_HWFN(rdev->cdev)) diff --git a/sys/dev/qlnx/qlnxr/qlnxr_os.c b/sys/dev/qlnx/qlnxr/qlnxr_os.c index b4771e97b705..aa8386808ebb 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_os.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_os.c @@ -248,16 +248,9 @@ qlnxr_register_device(qlnxr_dev_t *dev) ibdev->dereg_mr = qlnxr_dereg_mr; ibdev->reg_user_mr = qlnxr_reg_user_mr; -#if __FreeBSD_version >= 1102000 ibdev->alloc_mr = qlnxr_alloc_mr; ibdev->map_mr_sg = qlnxr_map_mr_sg; ibdev->get_port_immutable = qlnxr_get_port_immutable; -#else - ibdev->reg_phys_mr = qlnxr_reg_kernel_mr; - ibdev->alloc_fast_reg_mr = qlnxr_alloc_frmr; - ibdev->alloc_fast_reg_page_list = qlnxr_alloc_frmr_page_list; - ibdev->free_fast_reg_page_list = qlnxr_free_frmr_page_list; -#endif /* #if __FreeBSD_version >= 1102000 */ ibdev->poll_cq = qlnxr_poll_cq; ibdev->post_send = qlnxr_post_send; @@ -281,14 +274,9 @@ qlnxr_register_device(qlnxr_dev_t *dev) iwcm->accept = qlnxr_iw_accept; iwcm->reject = qlnxr_iw_reject; -#if (__FreeBSD_version >= 1004000) && (__FreeBSD_version < 1102000) - - iwcm->create_listen_ep = qlnxr_iw_create_listen; - iwcm->destroy_listen_ep = qlnxr_iw_destroy_listen; -#else iwcm->create_listen = qlnxr_iw_create_listen; iwcm->destroy_listen = __qlnxr_iw_destroy_listen; -#endif + iwcm->add_ref = qlnxr_iw_qp_add_ref; iwcm->rem_ref = qlnxr_iw_qp_rem_ref; iwcm->get_qp = qlnxr_iw_get_qp; @@ -949,27 +937,6 @@ static bool qlnxr_del_sgid(struct qlnxr_dev *dev, union ib_gid *gid) return found; } -#if __FreeBSD_version < 1100000 - -static inline int -is_vlan_dev(struct ifnet *ifp) -{ - return (ifp->if_type == IFT_L2VLAN); -} - -static inline uint16_t -vlan_dev_vlan_id(struct ifnet *ifp) -{ - uint16_t vtag; - - if (VLAN_TAG(ifp, &vtag) == 0) - return (vtag); - - return (0); -} - -#endif /* #if __FreeBSD_version < 1100000 */ - static void qlnxr_add_sgids(struct qlnxr_dev *dev) { @@ -1342,9 +1309,6 @@ static moduledata_t qlnxr_mod_info = { MODULE_VERSION(qlnxr, 1); MODULE_DEPEND(qlnxr, if_qlnxe, 1, 1, 1); MODULE_DEPEND(qlnxr, ibcore, 1, 1, 1); - -#if __FreeBSD_version >= 1100000 MODULE_DEPEND(qlnxr, linuxkpi, 1, 1, 1); -#endif /* #if __FreeBSD_version >= 1100000 */ DECLARE_MODULE(qlnxr, qlnxr_mod_info, SI_SUB_LAST, SI_ORDER_ANY); diff --git a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c index c4affef7955c..1100a81891c2 100644 --- a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c +++ b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c @@ -469,13 +469,8 @@ qlnxr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, } int -#if __FreeBSD_version < 1102000 -qlnxr_query_device(struct ib_device *ibdev, struct ib_device_attr *attr) -#else qlnxr_query_device(struct ib_device *ibdev, struct ib_device_attr *attr, struct ib_udata *udata) -#endif /* #if __FreeBSD_version < 1102000 */ - { struct qlnxr_dev *dev; struct ecore_rdma_device *qattr; @@ -486,10 +481,8 @@ qlnxr_query_device(struct ib_device *ibdev, struct ib_device_attr *attr, QL_DPRINT12(ha, "enter\n"); -#if __FreeBSD_version > 1102000 if (udata->inlen || udata->outlen) return -EINVAL; -#endif /* #if __FreeBSD_version > 1102000 */ if (dev->rdma_ctx == NULL) { return -EINVAL; @@ -820,16 +813,14 @@ qlnxr_get_vlan_id_qp(qlnx_host_t *ha, struct ib_qp_attr *attr, int attr_mask, { bool ret = false; - QL_DPRINT12(ha, "enter \n"); - - *vlan_id = 0; - -#if __FreeBSD_version >= 1100000 u16 tmp_vlan_id; -#if __FreeBSD_version >= 1102000 union ib_gid *dgid; + QL_DPRINT12(ha, "enter \n"); + + *vlan_id = 0; + dgid = &attr->ah_attr.grh.dgid; tmp_vlan_id = (dgid->raw[11] << 8) | dgid->raw[12]; @@ -837,20 +828,6 @@ qlnxr_get_vlan_id_qp(qlnx_host_t *ha, struct ib_qp_attr *attr, int attr_mask, *vlan_id = tmp_vlan_id; ret = true; } -#else - tmp_vlan_id = attr->vlan_id; - - if ((attr_mask & IB_QP_VID) && (!(tmp_vlan_id & ~EVL_VLID_MASK))) { - *vlan_id = tmp_vlan_id; - ret = true; - } - -#endif /* #if __FreeBSD_version > 1102000 */ - -#else - ret = true; - -#endif /* #if __FreeBSD_version >= 1100000 */ QL_DPRINT12(ha, "exit vlan_id = 0x%x ret = %d \n", *vlan_id, ret); @@ -1060,11 +1037,7 @@ qlnxr_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) ha = dev->ha; -#if __FreeBSD_version > 1102000 unmapped_db = dev->db_phys_addr + (ucontext->dpi * ucontext->dpi_size); -#else - unmapped_db = dev->db_phys_addr; -#endif /* #if __FreeBSD_version > 1102000 */ QL_DPRINT12(ha, "qedr_mmap enter vm_page=0x%lx" " vm_pgoff=0x%lx unmapped_db=0x%llx db_size=%x, len=%lx\n", @@ -1087,8 +1060,6 @@ qlnxr_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) QL_DPRINT12(ha, "Mapping doorbell bar\n"); -#if __FreeBSD_version > 1102000 - if ((vm_page < unmapped_db) || ((vm_page + len) > (unmapped_db + ucontext->dpi_size))) { QL_DPRINT11(ha, "failed pages are outside of dpi;" @@ -1106,24 +1077,6 @@ qlnxr_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) rc = io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, len, vma->vm_page_prot); -#else - - if ((vm_page >= unmapped_db) && (vm_page <= (unmapped_db + - dev->db_size))) { - QL_DPRINT12(ha, "Mapping doorbell bar\n"); - - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); - - rc = io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, - PAGE_SIZE, vma->vm_page_prot); - } else { - QL_DPRINT12(ha, "Mapping chains\n"); - rc = io_remap_pfn_range(vma, vma->vm_start, - vma->vm_pgoff, len, vma->vm_page_prot); - } - -#endif /* #if __FreeBSD_version > 1102000 */ - QL_DPRINT12(ha, "exit [%d]\n", rc); return rc; } @@ -1514,13 +1467,8 @@ done: } struct ib_mr * -#if __FreeBSD_version >= 1102000 qlnxr_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len, u64 usr_addr, int acc, struct ib_udata *udata) -#else -qlnxr_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len, - u64 usr_addr, int acc, struct ib_udata *udata, int mr_id) -#endif /* #if __FreeBSD_version >= 1102000 */ { int rc = -ENOMEM; struct qlnxr_dev *dev = get_qlnxr_dev((ibpd->device)); @@ -1592,11 +1540,7 @@ qlnxr_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len, mr->hw_mr.pbl_page_size_log = ilog2(mr->info.pbl_info.pbl_size); mr->hw_mr.page_size_log = ilog2(mr->umem->page_size); /* for the MR pages */ -#if __FreeBSD_version >= 1102000 mr->hw_mr.fbo = ib_umem_offset(mr->umem); -#else - mr->hw_mr.fbo = mr->umem->offset; -#endif mr->hw_mr.length = len; mr->hw_mr.vaddr = usr_addr; mr->hw_mr.zbva = false; /* TBD figure when this should be true */ @@ -1802,10 +1746,8 @@ qlnxr_create_cq(struct ib_cq *ibcq, struct ecore_rdma_create_cq_in_params params; struct qlnxr_create_cq_ureq ureq; -#if __FreeBSD_version >= 1100000 int vector = attr->comp_vector; int entries = attr->cqe; -#endif struct qlnxr_cq *cq = get_qlnxr_cq(ibcq); int chain_entries, rc, page_cnt; u64 pbl_ptr; @@ -2030,10 +1972,6 @@ qlnxr_check_qp_attrs(struct ib_pd *ibpd, QL_DPRINT12(ha, "attrs->qp_type = %d\n", attrs->qp_type); QL_DPRINT12(ha, "attrs->create_flags = %d\n", attrs->create_flags); -#if __FreeBSD_version < 1102000 - QL_DPRINT12(ha, "attrs->qpg_type = %d\n", attrs->qpg_type); -#endif - QL_DPRINT12(ha, "attrs->port_num = %d\n", attrs->port_num); QL_DPRINT12(ha, "attrs->cap.max_send_wr = 0x%x\n", attrs->cap.max_send_wr); QL_DPRINT12(ha, "attrs->cap.max_recv_wr = 0x%x\n", attrs->cap.max_recv_wr); @@ -2042,11 +1980,6 @@ qlnxr_check_qp_attrs(struct ib_pd *ibpd, QL_DPRINT12(ha, "attrs->cap.max_inline_data = 0x%x\n", attrs->cap.max_inline_data); -#if __FreeBSD_version < 1102000 - QL_DPRINT12(ha, "attrs->cap.qpg_tss_mask_sz = 0x%x\n", - attrs->cap.qpg_tss_mask_sz); -#endif - QL_DPRINT12(ha, "\n\nqattr->vendor_id = 0x%x\n", qattr->vendor_id); QL_DPRINT12(ha, "qattr->vendor_part_id = 0x%x\n", qattr->vendor_part_id); QL_DPRINT12(ha, "qattr->hw_ver = 0x%x\n", qattr->hw_ver); @@ -4225,8 +4158,6 @@ qlnx_handle_completed_mrs(struct qlnxr_dev *dev, struct mr_info *info) return; } -#if __FreeBSD_version >= 1102000 - static int qlnxr_prepare_reg(struct qlnxr_qp *qp, struct rdma_sq_fmr_wqe_1st *fwqe1, const struct ib_reg_wr *wr) @@ -4265,163 +4196,6 @@ static int qlnxr_prepare_reg(struct qlnxr_qp *qp, return 0; } -#else - -static void -build_frmr_pbes(struct qlnxr_dev *dev, const struct ib_send_wr *wr, - struct mr_info *info) -{ - int i; - u64 buf_addr = 0; - int num_pbes, total_num_pbes = 0; - struct regpair *pbe; - struct qlnxr_pbl *pbl_tbl = info->pbl_table; - struct qlnxr_pbl_info *pbl_info = &info->pbl_info; - qlnx_host_t *ha; - - ha = dev->ha; - - QL_DPRINT12(ha, "enter\n"); - - pbe = (struct regpair *)pbl_tbl->va; - num_pbes = 0; - - for (i = 0; i < wr->wr.fast_reg.page_list_len; i++) { - buf_addr = wr->wr.fast_reg.page_list->page_list[i]; - pbe->lo = cpu_to_le32((u32)buf_addr); - pbe->hi = cpu_to_le32((u32)upper_32_bits(buf_addr)); - - num_pbes += 1; - pbe++; - total_num_pbes++; - - if (total_num_pbes == pbl_info->num_pbes) - return; - - /* if the given pbl is full storing the pbes, - * move to next pbl. - */ - if (num_pbes == - (pbl_info->pbl_size / sizeof(u64))) { - pbl_tbl++; - pbe = (struct regpair *)pbl_tbl->va; - num_pbes = 0; - } - } - QL_DPRINT12(ha, "exit\n"); - - return; -} - -static int -qlnxr_prepare_safe_pbl(struct qlnxr_dev *dev, struct mr_info *info) -{ - int rc = 0; - qlnx_host_t *ha; - - ha = dev->ha; - - QL_DPRINT12(ha, "enter\n"); - - if (info->completed == 0) { - //DP_VERBOSE(dev, QLNXR_MSG_MR, "First FMR\n"); - /* first fmr */ - return 0; - } - - qlnx_handle_completed_mrs(dev, info); - - list_add_tail(&info->pbl_table->list_entry, &info->inuse_pbl_list); - - if (list_empty(&info->free_pbl_list)) { - info->pbl_table = qlnxr_alloc_pbl_tbl(dev, &info->pbl_info, - GFP_ATOMIC); - } else { - info->pbl_table = list_first_entry(&info->free_pbl_list, - struct qlnxr_pbl, - list_entry); - list_del(&info->pbl_table->list_entry); - } - - if (!info->pbl_table) - rc = -ENOMEM; - - QL_DPRINT12(ha, "exit\n"); - return rc; -} - -static inline int -qlnxr_prepare_fmr(struct qlnxr_qp *qp, - struct rdma_sq_fmr_wqe_1st *fwqe1, - const struct ib_send_wr *wr) -{ - struct qlnxr_dev *dev = qp->dev; - u64 fbo; - struct qlnxr_fast_reg_page_list *frmr_list = - get_qlnxr_frmr_list(wr->wr.fast_reg.page_list); - struct rdma_sq_fmr_wqe *fwqe2 = - (struct rdma_sq_fmr_wqe *)ecore_chain_produce(&qp->sq.pbl); - int rc = 0; - qlnx_host_t *ha; - - ha = dev->ha; - - QL_DPRINT12(ha, "enter\n"); - - if (wr->wr.fast_reg.page_list_len == 0) - BUG(); - - rc = qlnxr_prepare_safe_pbl(dev, &frmr_list->info); - if (rc) - return rc; - - fwqe1->addr.hi = upper_32_bits(wr->wr.fast_reg.iova_start); - fwqe1->addr.lo = lower_32_bits(wr->wr.fast_reg.iova_start); - fwqe1->l_key = wr->wr.fast_reg.rkey; - - SET_FIELD2(fwqe2->access_ctrl, RDMA_SQ_FMR_WQE_REMOTE_READ, - !!(wr->wr.fast_reg.access_flags & IB_ACCESS_REMOTE_READ)); - SET_FIELD2(fwqe2->access_ctrl, RDMA_SQ_FMR_WQE_REMOTE_WRITE, - !!(wr->wr.fast_reg.access_flags & IB_ACCESS_REMOTE_WRITE)); - SET_FIELD2(fwqe2->access_ctrl, RDMA_SQ_FMR_WQE_ENABLE_ATOMIC, - !!(wr->wr.fast_reg.access_flags & IB_ACCESS_REMOTE_ATOMIC)); - SET_FIELD2(fwqe2->access_ctrl, RDMA_SQ_FMR_WQE_LOCAL_READ, 1); - SET_FIELD2(fwqe2->access_ctrl, RDMA_SQ_FMR_WQE_LOCAL_WRITE, - !!(wr->wr.fast_reg.access_flags & IB_ACCESS_LOCAL_WRITE)); - - fwqe2->fmr_ctrl = 0; - - SET_FIELD2(fwqe2->fmr_ctrl, RDMA_SQ_FMR_WQE_2ND_PAGE_SIZE_LOG, - ilog2(1 << wr->wr.fast_reg.page_shift) - 12); - SET_FIELD2(fwqe2->fmr_ctrl, RDMA_SQ_FMR_WQE_2ND_ZERO_BASED, 0); - - fwqe2->length_hi = 0; /* Todo - figure this out... why length is only 32bit.. */ - fwqe2->length_lo = wr->wr.fast_reg.length; - fwqe2->pbl_addr.hi = upper_32_bits(frmr_list->info.pbl_table->pa); - fwqe2->pbl_addr.lo = lower_32_bits(frmr_list->info.pbl_table->pa); - - /* produce another wqe for fwqe3 */ - ecore_chain_produce(&qp->sq.pbl); - - fbo = wr->wr.fast_reg.iova_start - - (wr->wr.fast_reg.page_list->page_list[0] & PAGE_MASK); - - QL_DPRINT12(ha, "wr.fast_reg.iova_start = %p rkey=%x addr=%x:%x" - " length = %x pbl_addr %x:%x\n", - wr->wr.fast_reg.iova_start, wr->wr.fast_reg.rkey, - fwqe1->addr.hi, fwqe1->addr.lo, fwqe2->length_lo, - fwqe2->pbl_addr.hi, fwqe2->pbl_addr.lo); - - build_frmr_pbes(dev, wr, &frmr_list->info); - - qp->wqe_wr_id[qp->sq.prod].frmr = frmr_list; - - QL_DPRINT12(ha, "exit\n"); - return 0; -} - -#endif /* #if __FreeBSD_version >= 1102000 */ - static enum ib_wc_opcode qlnxr_ib_to_wc_opcode(enum ib_wr_opcode opcode) { @@ -4439,15 +4213,8 @@ qlnxr_ib_to_wc_opcode(enum ib_wr_opcode opcode) return IB_WC_COMP_SWAP; case IB_WR_ATOMIC_FETCH_AND_ADD: return IB_WC_FETCH_ADD; - -#if __FreeBSD_version >= 1102000 case IB_WR_REG_MR: return IB_WC_REG_MR; -#else - case IB_WR_FAST_REG_MR: - return IB_WC_FAST_REG_MR; -#endif /* #if __FreeBSD_version >= 1102000 */ - case IB_WR_LOCAL_INV: return IB_WC_LOCAL_INV; default: @@ -4784,8 +4551,6 @@ qlnxr_post_send(struct ib_qp *ibqp, break; -#if __FreeBSD_version >= 1102000 - case IB_WR_REG_MR: *** 736 LINES SKIPPED ***