Lines Matching full:rf
16 struct irdma_pci_f *rf = iwdev->rf; in irdma_query_device() local
17 struct pci_dev *pcidev = iwdev->rf->pcidev; in irdma_query_device()
18 struct irdma_hw_attrs *hw_attrs = &rf->sc_dev.hw_attrs; in irdma_query_device()
25 props->fw_ver = (u64)irdma_fw_major_ver(&rf->sc_dev) << 32 | in irdma_query_device()
26 irdma_fw_minor_ver(&rf->sc_dev); in irdma_query_device()
31 props->hw_ver = rf->pcidev->revision; in irdma_query_device()
34 props->max_qp = rf->max_qp - rf->used_qps; in irdma_query_device()
38 props->max_cq = rf->max_cq - rf->used_cqs; in irdma_query_device()
39 props->max_cqe = rf->max_cqe; in irdma_query_device()
40 props->max_mr = rf->max_mr - rf->used_mrs; in irdma_query_device()
42 props->max_pd = rf->max_pd - rf->used_pds; in irdma_query_device()
48 props->max_ah = rf->max_ah; in irdma_query_device()
49 props->max_mcast_grp = rf->max_mcg; in irdma_query_device()
51 props->max_total_mcast_qp_attach = rf->max_qp * IRDMA_MAX_MGS_PER_CTX; in irdma_query_device()
129 props->max_msg_sz = iwdev->rf->sc_dev.hw_attrs.max_hw_outbound_msg_size; in irdma_query_port()
151 pfn = ((uintptr_t)ucontext->iwdev->rf->sc_dev.hw_regs[IRDMA_DB_ADDR_OFFSET] + in irdma_mmap_legacy()
152 pci_resource_start(ucontext->iwdev->rf->pcidev, 0)) >> PAGE_SHIFT; in irdma_mmap_legacy()
222 pci_resource_start(ucontext->iwdev->rf->pcidev, 0)) >> PAGE_SHIFT; in irdma_mmap()
260 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_alloc_push_page()
272 cqp_info->in.u.manage_push_page.cqp = &iwdev->rf->cqp.sc_cqp; in irdma_alloc_push_page()
275 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_alloc_push_page()
277 iwdev->rf->sc_dev.hw_attrs.max_hw_device_pages) { in irdma_alloc_push_page()
282 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_alloc_push_page()
312 uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; in irdma_alloc_ucontext()
319 uresp.max_qps = iwdev->rf->max_qp; in irdma_alloc_ucontext()
320 uresp.max_pds = iwdev->rf->sc_dev.hw_attrs.max_hw_pds; in irdma_alloc_ucontext()
321 uresp.wq_size = iwdev->rf->sc_dev.hw_attrs.max_qp_wr * 2; in irdma_alloc_ucontext()
327 u64 bar_off = (uintptr_t)iwdev->rf->sc_dev.hw_regs[IRDMA_DB_ADDR_OFFSET]; in irdma_alloc_ucontext()
388 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_alloc_pd()
389 struct irdma_pci_f *rf = iwdev->rf; in irdma_alloc_pd() local
395 err = irdma_alloc_rsrc(rf, rf->allocated_pds, rf->max_pd, &pd_id, in irdma_alloc_pd()
396 &rf->next_pd); in irdma_alloc_pd()
418 irdma_free_rsrc(rf, rf->allocated_pds, pd_id); in irdma_alloc_pd()
433 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_pds, iwpd->sc_pd.pd_id); in irdma_dealloc_pd()
496 bar_off = (uintptr_t)iwdev->rf->sc_dev.hw_regs[IRDMA_DB_ADDR_OFFSET]; in irdma_setup_push_mmap_entries()
538 irdma_cqp_qp_destroy_cmd(&iwdev->rf->sc_dev, &iwqp->sc_qp); in irdma_destroy_qp()
596 struct irdma_uk_attrs *uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; in irdma_setup_kmode_qp()
638 mem->va = dma_alloc_coherent(iwdev->rf->hw.device, mem->size, in irdma_setup_kmode_qp()
666 struct irdma_pci_f *rf = iwqp->iwdev->rf; in irdma_cqp_create_qp_cmd() local
672 cqp_request = irdma_alloc_and_get_cqp_request(&rf->cqp, true); in irdma_cqp_create_qp_cmd()
687 status = irdma_handle_cqp_op(rf, cqp_request); in irdma_cqp_create_qp_cmd()
688 irdma_put_cqp_request(&rf->cqp, cqp_request); in irdma_cqp_create_qp_cmd()
697 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_roce_fill_and_set_qpctx_info()
737 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_iw_fill_and_set_qpctx_info()
766 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_validate_qp_attrs()
803 struct irdma_pci_f *rf = iwdev->rf; in irdma_create_qp() local
813 struct irdma_sc_dev *dev = &rf->sc_dev; in irdma_create_qp()
857 err_code = irdma_alloc_rsrc(rf, rf->allocated_qps, rf->max_qp, in irdma_create_qp()
858 &qp_num, &rf->next_qp); in irdma_create_qp()
963 rf->qp_table[qp_num] = iwqp; in irdma_create_qp()
969 irdma_cqp_qp_destroy_cmd(&rf->sc_dev, &iwqp->sc_qp); in irdma_create_qp()
1111 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_modify_qp_roce()
1214 udp_info->arp_idx = irdma_arp_table(iwdev->rf, in irdma_modify_qp_roce()
1236 irdma_add_arp(iwdev->rf, local_ip, udp_info->ipv4, in irdma_modify_qp_roce()
1453 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_modify_qp()
1680 * @rf: RDMA PCI function
1683 static void irdma_cq_free_rsrc(struct irdma_pci_f *rf, struct irdma_cq *iwcq) in irdma_cq_free_rsrc() argument
1688 dma_free_coherent(rf->sc_dev.hw->device, iwcq->kmem.size, in irdma_cq_free_rsrc()
1691 dma_free_coherent(rf->sc_dev.hw->device, in irdma_cq_free_rsrc()
1697 irdma_free_rsrc(rf, rf->allocated_cqs, cq->cq_uk.cq_id); in irdma_cq_free_rsrc()
1761 irdma_cq_wq_destroy(iwdev->rf, cq); in irdma_destroy_cq()
1762 irdma_cq_free_rsrc(iwdev->rf, iwcq); in irdma_destroy_cq()
1790 struct irdma_pci_f *rf; in irdma_resize_cq() local
1797 rf = iwdev->rf; in irdma_resize_cq()
1799 if (!(rf->sc_dev.hw_attrs.uk_attrs.feature_flags & in irdma_resize_cq()
1803 if (entries > rf->max_cqe) in irdma_resize_cq()
1808 if (rf->sc_dev.hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) in irdma_resize_cq()
1868 cqp_request = irdma_alloc_and_get_cqp_request(&rf->cqp, true); in irdma_resize_cq()
1885 status = irdma_handle_cqp_op(rf, cqp_request); in irdma_resize_cq()
1886 irdma_put_cqp_request(&rf->cqp, cqp_request); in irdma_resize_cq()
1939 struct irdma_pci_f *rf = iwdev->rf; in irdma_create_cq() local
1943 struct irdma_sc_dev *dev = &rf->sc_dev; in irdma_create_cq()
1956 err_code = irdma_alloc_rsrc(rf, rf->allocated_cqs, rf->max_cq, &cq_num, in irdma_create_cq()
1957 &rf->next_cq); in irdma_create_cq()
1969 if (attr->comp_vector < rf->ceqs_count) in irdma_create_cq()
2007 if (rf->sc_dev.hw_attrs.uk_attrs.feature_flags & in irdma_create_cq()
2037 if (entries < 1 || entries > rf->max_cqe) { in irdma_create_cq()
2083 cqp_request = irdma_alloc_and_get_cqp_request(&rf->cqp, true); in irdma_create_cq()
2095 status = irdma_handle_cqp_op(rf, cqp_request); in irdma_create_cq()
2096 irdma_put_cqp_request(&rf->cqp, cqp_request); in irdma_create_cq()
2117 irdma_cq_wq_destroy(rf, cq); in irdma_create_cq()
2119 irdma_cq_free_rsrc(rf, iwcq); in irdma_create_cq()
2156 stag_idx = (stag & iwdev->rf->mr_stagmask) >> IRDMA_CQPSQ_STAG_IDX_S; in irdma_free_stag()
2157 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_mrs, stag_idx); in irdma_free_stag()
2177 driver_key = random & ~iwdev->rf->mr_stagmask; in irdma_create_stag()
2178 next_stag_index = (random & iwdev->rf->mr_stagmask) >> 8; in irdma_create_stag()
2179 next_stag_index %= iwdev->rf->max_mr; in irdma_create_stag()
2181 ret = irdma_alloc_rsrc(iwdev->rf, iwdev->rf->allocated_mrs, in irdma_create_stag()
2182 iwdev->rf->max_mr, &stag_index, in irdma_create_stag()
2298 * @rf: RDMA PCI function
2302 static int irdma_setup_pbles(struct irdma_pci_f *rf, struct irdma_mr *iwmr, in irdma_setup_pbles() argument
2313 status = irdma_get_pble(rf->pble_rsrc, palloc, iwmr->page_cnt, in irdma_setup_pbles()
2357 err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles); in irdma_handle_q_mem()
2362 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_handle_q_mem()
2416 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_handle_q_mem()
2436 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_hw_alloc_mw()
2452 cqp_info->in.u.mw_alloc.dev = &iwdev->rf->sc_dev; in irdma_hw_alloc_mw()
2454 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_hw_alloc_mw()
2455 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_hw_alloc_mw()
2502 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_dealloc_mw()
2514 cqp_info->in.u.dealloc_stag.dev = &iwdev->rf->sc_dev; in irdma_dealloc_mw()
2516 irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_dealloc_mw()
2517 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_dealloc_mw()
2538 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_hw_alloc_stag()
2552 cqp_info->in.u.alloc_stag.dev = &iwdev->rf->sc_dev; in irdma_hw_alloc_stag()
2554 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_hw_alloc_stag()
2555 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_hw_alloc_stag()
2599 status = irdma_get_pble(iwdev->rf->pble_rsrc, palloc, iwmr->page_cnt, in irdma_alloc_mr()
2612 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_alloc_mr()
2677 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_hwreg_mr()
2710 cqp_info->in.u.mr_reg_non_shared.dev = &iwdev->rf->sc_dev; in irdma_hwreg_mr()
2712 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_hwreg_mr()
2713 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_hwreg_mr()
2747 if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size) in irdma_reg_user_mr()
2814 if (iwdev->rf->sc_dev.hw_attrs.uk_attrs.feature_flags & IRDMA_FEATURE_CQ_RESIZE) in irdma_reg_user_mr()
2837 err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles); in irdma_reg_user_mr()
2845 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_reg_user_mr()
2876 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_reg_user_mr()
3014 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_dereg_mr()
3029 cqp_info->in.u.dealloc_stag.dev = &iwdev->rf->sc_dev; in irdma_dereg_mr()
3031 irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_dereg_mr()
3032 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_dereg_mr()
3036 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_dereg_mr()
3084 dev = &iwqp->iwdev->rf->sc_dev; in irdma_post_send()
3744 irdma_fw_major_ver(&iwdev->rf->sc_dev), in irdma_get_dev_fw_str()
3745 irdma_fw_minor_ver(&iwdev->rf->sc_dev)); in irdma_get_dev_fw_str()
3781 if (iwdev->rf->rdma_ver >= IRDMA_GEN_2) in irdma_get_hw_stats()
3782 irdma_cqp_gather_stats_cmd(&iwdev->rf->sc_dev, iwdev->vsi.pestat, true); in irdma_get_hw_stats()
3784 irdma_cqp_gather_stats_gen1(&iwdev->rf->sc_dev, iwdev->vsi.pestat); in irdma_get_hw_stats()
3811 * @rf: RDMA PCI function
3814 static void mcast_list_add(struct irdma_pci_f *rf, in mcast_list_add() argument
3817 list_add(&new_elem->list, &rf->mc_qht_list.list); in mcast_list_add()
3832 * @rf: RDMA PCI function
3835 static struct mc_table_list *mcast_list_lookup_ip(struct irdma_pci_f *rf, in mcast_list_lookup_ip() argument
3841 list_for_each_safe (pos, q, &rf->mc_qht_list.list) { in mcast_list_lookup_ip()
3866 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_mcast_cqp_op()
3875 cqp_info->in.u.mc_create.cqp = &iwdev->rf->cqp.sc_cqp; in irdma_mcast_cqp_op()
3876 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_mcast_cqp_op()
3877 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_mcast_cqp_op()
3927 struct irdma_pci_f *rf = iwdev->rf; in irdma_attach_mcast() local
3965 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_attach_mcast()
3966 mc_qht_elem = mcast_list_lookup_ip(rf, ip_addr); in irdma_attach_mcast()
3970 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_attach_mcast()
3978 ret = irdma_alloc_rsrc(rf, rf->allocated_mcgs, rf->max_mcg, in irdma_attach_mcast()
3979 &mgn, &rf->next_mcg); in irdma_attach_mcast()
3989 dma_mem_mc->va = dma_alloc_coherent(rf->hw.device, in irdma_attach_mcast()
3994 irdma_free_rsrc(rf, rf->allocated_mcgs, mgn); in irdma_attach_mcast()
4011 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4012 mcast_list_add(rf, mc_qht_elem); in irdma_attach_mcast()
4016 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4024 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4046 dma_free_coherent(rf->hw.device, in irdma_attach_mcast()
4051 irdma_free_rsrc(rf, rf->allocated_mcgs, in irdma_attach_mcast()
4071 struct irdma_pci_f *rf = iwdev->rf; in irdma_detach_mcast() local
4090 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4091 mc_qht_elem = mcast_list_lookup_ip(rf, ip_addr); in irdma_detach_mcast()
4093 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4103 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4109 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4110 mcast_list_add(rf, mc_qht_elem); in irdma_detach_mcast()
4111 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4115 dma_free_coherent(rf->hw.device, in irdma_detach_mcast()
4120 irdma_free_rsrc(rf, rf->allocated_mcgs, in irdma_detach_mcast()
4124 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4154 struct irdma_pci_f *rf = iwdev->rf; in irdma_create_ah() local
4167 err = irdma_alloc_rsrc(rf, rf->allocated_ahs, rf->max_ah, &ah_id, in irdma_create_ah()
4168 &rf->next_ah); in irdma_create_ah()
4176 irdma_sc_init_ah(&rf->sc_dev, sc_ah); in irdma_create_ah()
4226 ah_info->dst_arpindex = irdma_add_arp(iwdev->rf, ah_info->dest_ip_addr, in irdma_create_ah()
4243 err = irdma_ah_cqp_op(iwdev->rf, sc_ah, IRDMA_OP_AH_CREATE, in irdma_create_ah()
4257 irdma_cqp_ce_handler(rf, &rf->ccq.sc_cq); in irdma_create_ah()
4277 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_ahs, ah_id); in irdma_create_ah()
4292 irdma_ah_cqp_op(iwdev->rf, &ah->sc_ah, IRDMA_OP_AH_DESTROY, in irdma_destroy_ah()
4295 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_ahs, in irdma_destroy_ah()
4453 struct pci_dev *pcidev = iwdev->rf->pcidev; in irdma_init_rdma_device()
4464 iwdev->ibdev.num_comp_vectors = iwdev->rf->ceqs_count; in irdma_init_rdma_device()
4513 dma_set_max_seg_size(iwdev->rf->hw.device, UINT_MAX); in irdma_ib_register_device()
4514 ret = ib_register_device(&iwdev->ibdev, "irdma%d", iwdev->rf->hw.device); in irdma_ib_register_device()
4542 irdma_ctrl_deinit_hw(iwdev->rf); in irdma_ib_dealloc_device()
4543 kfree(iwdev->rf); in irdma_ib_dealloc_device()