Lines Matching refs: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()
26 props->fw_ver = (u64)irdma_fw_major_ver(&rf->sc_dev) << 32 | in irdma_query_device()
27 irdma_fw_minor_ver(&rf->sc_dev); in irdma_query_device()
34 props->hw_ver = rf->pcidev->revision; in irdma_query_device()
37 props->max_qp = rf->max_qp - rf->used_qps; in irdma_query_device()
41 props->max_cq = rf->max_cq - rf->used_cqs; in irdma_query_device()
42 props->max_cqe = rf->max_cqe - 1; in irdma_query_device()
43 props->max_mr = rf->max_mr - rf->used_mrs; in irdma_query_device()
45 props->max_pd = rf->max_pd - rf->used_pds; in irdma_query_device()
54 props->max_ah = rf->max_ah; in irdma_query_device()
55 props->max_mcast_grp = rf->max_mcg; in irdma_query_device()
57 props->max_total_mcast_qp_attach = rf->max_qp * IRDMA_MAX_MGS_PER_CTX; in irdma_query_device()
106 props->max_msg_sz = iwdev->rf->sc_dev.hw_attrs.max_hw_outbound_msg_size; in irdma_query_port()
128 pfn = ((uintptr_t)ucontext->iwdev->rf->sc_dev.hw_regs[IRDMA_DB_ADDR_OFFSET] + in irdma_mmap_legacy()
129 pci_resource_start(ucontext->iwdev->rf->pcidev, 0)) >> PAGE_SHIFT; in irdma_mmap_legacy()
199 pci_resource_start(ucontext->iwdev->rf->pcidev, 0)) >> PAGE_SHIFT; in irdma_mmap()
237 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_alloc_push_page()
249 cqp_info->in.u.manage_push_page.cqp = &iwdev->rf->cqp.sc_cqp; in irdma_alloc_push_page()
252 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_alloc_push_page()
254 iwdev->rf->sc_dev.hw_attrs.max_hw_device_pages) { in irdma_alloc_push_page()
259 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_alloc_push_page()
295 uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; in irdma_alloc_ucontext()
302 uresp.max_qps = iwdev->rf->max_qp; in irdma_alloc_ucontext()
303 uresp.max_pds = iwdev->rf->sc_dev.hw_attrs.max_hw_pds; in irdma_alloc_ucontext()
304 uresp.wq_size = iwdev->rf->sc_dev.hw_attrs.max_qp_wr * 2; in irdma_alloc_ucontext()
310 u64 bar_off = (uintptr_t)iwdev->rf->sc_dev.hw_regs[IRDMA_DB_ADDR_OFFSET]; in irdma_alloc_ucontext()
372 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_alloc_pd()
373 struct irdma_pci_f *rf = iwdev->rf; in irdma_alloc_pd() local
382 err = irdma_alloc_rsrc(rf, rf->allocated_pds, rf->max_pd, &pd_id, in irdma_alloc_pd()
383 &rf->next_pd); in irdma_alloc_pd()
405 irdma_free_rsrc(rf, rf->allocated_pds, pd_id); in irdma_alloc_pd()
420 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_pds, iwpd->sc_pd.pd_id); in irdma_dealloc_pd()
483 bar_off = (uintptr_t)iwdev->rf->sc_dev.hw_regs[IRDMA_DB_ADDR_OFFSET]; in irdma_setup_push_mmap_entries()
528 irdma_cqp_qp_destroy_cmd(&iwdev->rf->sc_dev, &iwqp->sc_qp); in irdma_destroy_qp()
586 struct irdma_uk_attrs *uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; in irdma_setup_kmode_qp()
628 mem->va = dma_alloc_coherent(iwdev->rf->hw.device, mem->size, in irdma_setup_kmode_qp()
656 struct irdma_pci_f *rf = iwqp->iwdev->rf; in irdma_cqp_create_qp_cmd() local
662 cqp_request = irdma_alloc_and_get_cqp_request(&rf->cqp, true); in irdma_cqp_create_qp_cmd()
677 status = irdma_handle_cqp_op(rf, cqp_request); in irdma_cqp_create_qp_cmd()
678 irdma_put_cqp_request(&rf->cqp, cqp_request); in irdma_cqp_create_qp_cmd()
687 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_roce_fill_and_set_qpctx_info()
727 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_iw_fill_and_set_qpctx_info()
756 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
812 struct irdma_sc_dev *dev = &rf->sc_dev; in irdma_create_qp()
859 err_code = irdma_alloc_rsrc(rf, rf->allocated_qps, rf->max_qp, in irdma_create_qp()
860 &qp_num, &rf->next_qp); in irdma_create_qp()
965 rf->qp_table[qp_num] = iwqp; in irdma_create_qp()
971 irdma_cqp_qp_destroy_cmd(&rf->sc_dev, &iwqp->sc_qp); in irdma_create_qp()
1115 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_modify_qp_roce()
1229 udp_info->arp_idx = irdma_arp_table(iwdev->rf, in irdma_modify_qp_roce()
1251 irdma_add_arp(iwdev->rf, local_ip, udp_info->ipv4, in irdma_modify_qp_roce()
1470 struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; in irdma_modify_qp()
1707 static void irdma_cq_free_rsrc(struct irdma_pci_f *rf, struct irdma_cq *iwcq) in irdma_cq_free_rsrc() argument
1712 dma_free_coherent(rf->sc_dev.hw->device, iwcq->kmem.size, in irdma_cq_free_rsrc()
1715 dma_free_coherent(rf->sc_dev.hw->device, in irdma_cq_free_rsrc()
1721 irdma_free_rsrc(rf, rf->allocated_cqs, cq->cq_uk.cq_id); in irdma_cq_free_rsrc()
1787 irdma_cq_wq_destroy(iwdev->rf, cq); in irdma_destroy_cq()
1792 irdma_cq_free_rsrc(iwdev->rf, iwcq); in irdma_destroy_cq()
1817 struct irdma_pci_f *rf; in irdma_resize_cq() local
1823 rf = iwdev->rf; in irdma_resize_cq()
1825 if (!(rf->sc_dev.hw_attrs.uk_attrs.feature_flags & in irdma_resize_cq()
1832 if (entries > rf->max_cqe) in irdma_resize_cq()
1837 if (rf->sc_dev.hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) in irdma_resize_cq()
1897 cqp_request = irdma_alloc_and_get_cqp_request(&rf->cqp, true); in irdma_resize_cq()
1914 ret = irdma_handle_cqp_op(rf, cqp_request); in irdma_resize_cq()
1915 irdma_put_cqp_request(&rf->cqp, cqp_request); in irdma_resize_cq()
1968 struct irdma_pci_f *rf = iwdev->rf; in irdma_create_cq() local
1972 struct irdma_sc_dev *dev = &rf->sc_dev; in irdma_create_cq()
1989 err_code = irdma_alloc_rsrc(rf, rf->allocated_cqs, rf->max_cq, &cq_num, in irdma_create_cq()
1990 &rf->next_cq); in irdma_create_cq()
2003 if (attr->comp_vector < rf->ceqs_count) in irdma_create_cq()
2041 if (rf->sc_dev.hw_attrs.uk_attrs.feature_flags & in irdma_create_cq()
2071 if (entries < 1 || entries > rf->max_cqe) { in irdma_create_cq()
2117 cqp_request = irdma_alloc_and_get_cqp_request(&rf->cqp, true); in irdma_create_cq()
2129 err_code = irdma_handle_cqp_op(rf, cqp_request); in irdma_create_cq()
2130 irdma_put_cqp_request(&rf->cqp, cqp_request); in irdma_create_cq()
2149 irdma_cq_wq_destroy(rf, cq); in irdma_create_cq()
2151 irdma_cq_free_rsrc(rf, iwcq); in irdma_create_cq()
2188 stag_idx = (stag & iwdev->rf->mr_stagmask) >> IRDMA_CQPSQ_STAG_IDX_S; in irdma_free_stag()
2189 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_mrs, stag_idx); in irdma_free_stag()
2209 driver_key = random & ~iwdev->rf->mr_stagmask; in irdma_create_stag()
2210 next_stag_index = (random & iwdev->rf->mr_stagmask) >> 8; in irdma_create_stag()
2211 next_stag_index %= iwdev->rf->max_mr; in irdma_create_stag()
2213 ret = irdma_alloc_rsrc(iwdev->rf, iwdev->rf->allocated_mrs, in irdma_create_stag()
2214 iwdev->rf->max_mr, &stag_index, in irdma_create_stag()
2335 static int irdma_setup_pbles(struct irdma_pci_f *rf, struct irdma_mr *iwmr, in irdma_setup_pbles() argument
2346 status = irdma_get_pble(rf->pble_rsrc, palloc, iwmr->page_cnt, in irdma_setup_pbles()
2390 err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles, true); in irdma_handle_q_mem()
2443 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_handle_q_mem()
2463 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_hw_alloc_mw()
2479 cqp_info->in.u.mw_alloc.dev = &iwdev->rf->sc_dev; in irdma_hw_alloc_mw()
2481 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_hw_alloc_mw()
2482 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_hw_alloc_mw()
2529 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_dealloc_mw()
2541 cqp_info->in.u.dealloc_stag.dev = &iwdev->rf->sc_dev; in irdma_dealloc_mw()
2543 irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_dealloc_mw()
2544 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_dealloc_mw()
2564 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_hw_alloc_stag()
2578 cqp_info->in.u.alloc_stag.dev = &iwdev->rf->sc_dev; in irdma_hw_alloc_stag()
2580 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_hw_alloc_stag()
2581 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_hw_alloc_stag()
2622 err_code = irdma_get_pble(iwdev->rf->pble_rsrc, palloc, iwmr->page_cnt, in irdma_alloc_mr()
2635 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_alloc_mr()
2707 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_hwreg_mr()
2740 cqp_info->in.u.mr_reg_non_shared.dev = &iwdev->rf->sc_dev; in irdma_hwreg_mr()
2742 ret = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_hwreg_mr()
2743 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_hwreg_mr()
2758 err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles, false); in irdma_reg_user_mr_type_mem()
2766 irdma_free_pble(iwdev->rf->pble_rsrc, &iwpbl->pble_alloc); in irdma_reg_user_mr_type_mem()
2791 irdma_free_pble(iwdev->rf->pble_rsrc, &iwpbl->pble_alloc); in irdma_reg_user_mr_type_mem()
2818 iwdev->rf->sc_dev.hw_attrs.page_size_cap : PAGE_SIZE; in irdma_alloc_iwmr()
2883 if (iwdev->rf->sc_dev.hw_attrs.uk_attrs.feature_flags & IRDMA_FEATURE_CQ_RESIZE) in irdma_reg_user_mr_type_cq()
2924 if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size) in irdma_reg_user_mr()
2990 if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size) in irdma_reg_user_mr_dmabuf()
3151 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_dereg_mr()
3166 cqp_info->in.u.dealloc_stag.dev = &iwdev->rf->sc_dev; in irdma_dereg_mr()
3168 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_dereg_mr()
3169 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_dereg_mr()
3176 irdma_free_pble(iwdev->rf->pble_rsrc, palloc); in irdma_dereg_mr()
3204 dev = &iwqp->iwdev->rf->sc_dev; in irdma_post_send()
3801 irdma_fw_major_ver(&iwdev->rf->sc_dev), in irdma_get_dev_fw_str()
3802 irdma_fw_minor_ver(&iwdev->rf->sc_dev)); in irdma_get_dev_fw_str()
3838 if (iwdev->rf->rdma_ver >= IRDMA_GEN_2) in irdma_get_hw_stats()
3839 irdma_cqp_gather_stats_cmd(&iwdev->rf->sc_dev, iwdev->vsi.pestat, true); in irdma_get_hw_stats()
3841 irdma_cqp_gather_stats_gen1(&iwdev->rf->sc_dev, iwdev->vsi.pestat); in irdma_get_hw_stats()
3871 static void mcast_list_add(struct irdma_pci_f *rf, in mcast_list_add() argument
3874 list_add(&new_elem->list, &rf->mc_qht_list.list); in mcast_list_add()
3892 static struct mc_table_list *mcast_list_lookup_ip(struct irdma_pci_f *rf, in mcast_list_lookup_ip() argument
3898 list_for_each_safe (pos, q, &rf->mc_qht_list.list) { in mcast_list_lookup_ip()
3923 cqp_request = irdma_alloc_and_get_cqp_request(&iwdev->rf->cqp, true); in irdma_mcast_cqp_op()
3932 cqp_info->in.u.mc_create.cqp = &iwdev->rf->cqp.sc_cqp; in irdma_mcast_cqp_op()
3933 status = irdma_handle_cqp_op(iwdev->rf, cqp_request); in irdma_mcast_cqp_op()
3934 irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); in irdma_mcast_cqp_op()
3982 struct irdma_pci_f *rf = iwdev->rf; in irdma_attach_mcast() local
4016 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4017 mc_qht_elem = mcast_list_lookup_ip(rf, ip_addr); in irdma_attach_mcast()
4021 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4029 ret = irdma_alloc_rsrc(rf, rf->allocated_mcgs, rf->max_mcg, in irdma_attach_mcast()
4030 &mgn, &rf->next_mcg); in irdma_attach_mcast()
4040 dma_mem_mc->va = dma_alloc_coherent(rf->hw.device, in irdma_attach_mcast()
4045 irdma_free_rsrc(rf, rf->allocated_mcgs, mgn); in irdma_attach_mcast()
4062 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4063 mcast_list_add(rf, mc_qht_elem); in irdma_attach_mcast()
4067 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4075 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_attach_mcast()
4097 dma_free_coherent(rf->hw.device, in irdma_attach_mcast()
4102 irdma_free_rsrc(rf, rf->allocated_mcgs, in irdma_attach_mcast()
4122 struct irdma_pci_f *rf = iwdev->rf; in irdma_detach_mcast() local
4137 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4138 mc_qht_elem = mcast_list_lookup_ip(rf, ip_addr); in irdma_detach_mcast()
4140 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4150 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4156 spin_lock_irqsave(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4157 mcast_list_add(rf, mc_qht_elem); in irdma_detach_mcast()
4158 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4162 dma_free_coherent(rf->hw.device, in irdma_detach_mcast()
4167 irdma_free_rsrc(rf, rf->allocated_mcgs, in irdma_detach_mcast()
4171 spin_unlock_irqrestore(&rf->qh_list_lock, flags); in irdma_detach_mcast()
4186 struct irdma_pci_f *rf = iwdev->rf; in irdma_create_hw_ah() local
4189 err = irdma_alloc_rsrc(rf, rf->allocated_ahs, rf->max_ah, &ah->sc_ah.ah_info.ah_idx, in irdma_create_hw_ah()
4190 &rf->next_ah); in irdma_create_hw_ah()
4194 err = irdma_ah_cqp_op(rf, &ah->sc_ah, IRDMA_OP_AH_CREATE, sleep, in irdma_create_hw_ah()
4206 irdma_cqp_ce_handler(rf, &rf->ccq.sc_cq); in irdma_create_hw_ah()
4219 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_ahs, ah->sc_ah.ah_info.ah_idx); in irdma_create_hw_ah()
4231 struct irdma_pci_f *rf = iwdev->rf; in irdma_setup_ah() local
4241 irdma_sc_init_ah(&rf->sc_dev, sc_ah); in irdma_setup_ah()
4288 ah_info->dst_arpindex = irdma_add_arp(iwdev->rf, ah_info->dest_ip_addr, in irdma_setup_ah()
4358 irdma_ah_cqp_op(iwdev->rf, &ah->sc_ah, IRDMA_OP_AH_DESTROY, in irdma_destroy_ah()
4361 irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_ahs, in irdma_destroy_ah()
4582 struct pci_dev *pcidev = iwdev->rf->pcidev; in irdma_init_rdma_device()
4593 iwdev->ibdev.num_comp_vectors = iwdev->rf->ceqs_count; in irdma_init_rdma_device()
4642 dma_set_max_seg_size(iwdev->rf->hw.device, UINT_MAX); in irdma_ib_register_device()
4643 ret = ib_register_device(&iwdev->ibdev, "irdma%d", iwdev->rf->hw.device); in irdma_ib_register_device()
4671 irdma_ctrl_deinit_hw(iwdev->rf); in irdma_ib_dealloc_device()
4672 kfree(iwdev->rf); in irdma_ib_dealloc_device()