Lines Matching refs:nesadapter
62 struct nes_adapter *nesadapter = nesdev->nesadapter;
80 next_stag_index %= nesadapter->max_mr;
82 ret = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
83 nesadapter->max_mr, &stag_index, &next_stag_index);
90 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
105 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
133 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
160 struct nes_adapter *nesadapter = nesdev->nesadapter;
196 nes_free_resource(nesadapter, nesadapter->allocated_mrs,
289 struct nes_adapter *nesadapter = nesdev->nesadapter;
306 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
307 if (nesadapter->free_4kpbl > 0) {
308 nesadapter->free_4kpbl--;
309 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
312 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
362 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
363 nesadapter->free_4kpbl++;
364 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
382 struct nes_adapter *nesadapter = nesdev->nesadapter;
403 next_stag_index %= nesadapter->max_mr;
405 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
406 nesadapter->max_mr, &stag_index,
413 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
433 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
521 props->fw_ver = nesdev->nesadapter->firmware_version;
522 props->device_cap_flags = nesdev->nesadapter->device_cap_flags;
523 props->vendor_id = nesdev->nesadapter->vendor_id;
524 props->vendor_part_id = nesdev->nesadapter->vendor_part_id;
525 props->hw_ver = nesdev->nesadapter->hw_rev;
528 props->max_qp_wr = nesdev->nesadapter->max_qp_wr - 2;
529 props->max_sge = nesdev->nesadapter->max_sge;
531 props->max_cqe = nesdev->nesadapter->max_cqe;
536 switch (nesdev->nesadapter->max_irrq_wr) {
641 struct nes_adapter *nesadapter = nesdev->nesadapter;
664 uresp.wq_size = nesdev->nesadapter->max_qp_wr * 2;
665 uresp.virtwq = nesadapter->virtwq;
715 /* struct nes_adapter *nesadapter = nesdev->nesadapter; */
724 index /= ((sizeof(struct nes_hw_qp_wqe) * nesdev->nesadapter->max_qp_wr * 2) +
772 struct nes_adapter *nesadapter = nesdev->nesadapter;
782 err = nes_alloc_resource(nesadapter, nesadapter->allocated_pds,
783 nesadapter->max_pd, &pd_num, &nesadapter->next_pd);
790 nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
797 nespd->pd_id = (pd_num << (PAGE_SHIFT-12)) + nesadapter->base_pd;
807 nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
815 nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
839 struct nes_adapter *nesadapter = nesdev->nesadapter;
854 nes_free_resource(nesadapter, nesadapter->allocated_pds,
855 (nespd->pd_id-nesadapter->base_pd)>>(PAGE_SHIFT-12));
913 struct nes_adapter *nesadapter = nesdev->nesadapter;
953 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
954 if (!nesadapter->free_256pbl) {
957 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
962 nesadapter->free_256pbl--;
963 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
972 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
973 nesadapter->free_256pbl++;
974 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1005 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
1006 nesadapter->free_256pbl++;
1007 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1078 struct nes_adapter *nesadapter = nesdev->nesadapter;
1083 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
1084 nesadapter->free_256pbl++;
1085 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1108 struct nes_adapter *nesadapter = nesdev->nesadapter;
1159 ret = nes_alloc_resource(nesadapter, nesadapter->allocated_qps,
1160 nesadapter->max_qp, &qp_num, &nesadapter->next_qp);
1168 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1183 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1208 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1223 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1236 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1246 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1320 ((((u32)nesadapter->max_irrq_wr) <<
1332 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1370 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1389 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1409 nesdev->nesadapter->qp_table[nesqp->hwqp.qp_id-NES_FIRST_QPN] = nesqp;
1529 struct nes_adapter *nesadapter = nesdev->nesadapter;
1545 if (entries > nesadapter->max_cqe)
1548 err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs,
1549 nesadapter->max_cq, &cq_num, &nesadapter->next_cq);
1556 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1569 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1583 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1598 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1615 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1644 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1655 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
1661 if (nesadapter->free_4kpbl == 0) {
1662 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1672 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1678 nesadapter->free_4kpbl--;
1683 if (nesadapter->free_256pbl == 0) {
1684 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1694 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1700 nesadapter->free_256pbl--;
1705 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1751 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1766 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1784 struct nes_adapter *nesadapter;
1797 nesadapter = nesdev->nesadapter;
1810 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
1812 nesadapter->free_256pbl++;
1813 if (nesadapter->free_256pbl > nesadapter->max_256pbl) {
1815 __func__, nesadapter->free_256pbl, nesadapter->max_256pbl);
1818 nesadapter->free_4kpbl++;
1819 if (nesadapter->free_4kpbl > nesadapter->max_4kpbl) {
1821 __func__, nesadapter->free_4kpbl, nesadapter->max_4kpbl);
1826 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1833 nes_free_resource(nesadapter, nesadapter->allocated_cqs, nescq->hw_cq.cq_number);
1928 struct nes_adapter *nesadapter = nesdev->nesadapter;
1949 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
1954 if (pbl_count_256 <= nesadapter->free_256pbl)
1956 else if (pbl_count_4k <= nesadapter->free_4kpbl)
1959 if (((pbl_count_4k + use_two_level) <= nesadapter->free_4kpbl) &&
1960 (nesadapter->free_4kpbl > (nesadapter->max_4kpbl >> 1))) {
1962 } else if ((pbl_count_256 + 1) <= nesadapter->free_256pbl) {
1965 } else if ((pbl_count_4k + use_two_level) <= nesadapter->free_4kpbl) {
1969 if ((pbl_count_4k + 1) <= nesadapter->free_4kpbl)
1975 nesadapter->free_256pbl -= pbl_count + use_two_level;
1978 nesadapter->free_4kpbl -= pbl_count + use_two_level;
1980 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1986 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
1994 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
1995 nesadapter->free_256pbl += pbl_count_256 + use_two_level;
2002 if ((pbl_count_4k + use_two_level) <= nesadapter->free_4kpbl) {
2003 nesadapter->free_4kpbl -= pbl_count + use_two_level;
2006 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
2060 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
2062 nesadapter->free_256pbl += pbl_count + use_two_level;
2064 nesadapter->free_4kpbl += pbl_count + use_two_level;
2065 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
2093 struct nes_adapter *nesadapter = nesdev->nesadapter;
2123 next_stag_index %= nesadapter->max_mr;
2131 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr,
2139 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2155 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2165 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2180 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2204 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2302 struct nes_adapter *nesadapter = nesdev->nesadapter;
2360 next_stag_index %= nesadapter->max_mr;
2362 err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
2363 nesadapter->max_mr, &stag_index, &next_stag_index);
2372 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2383 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2393 nes_free_resource(nesadapter, nesadapter->allocated_mrs,
2411 nes_free_resource(nesadapter,
2412 nesadapter->allocated_mrs, stag_index);
2426 nes_free_resource(nesadapter, nesadapter->allocated_mrs,
2440 nes_free_resource(nesadapter, nesadapter->allocated_mrs,
2458 nes_free_resource(nesadapter, nesadapter->allocated_mrs, stag_index);
2648 struct nes_adapter *nesadapter = nesdev->nesadapter;
2709 spin_lock_irqsave(&nesadapter->pbl_lock, flags);
2711 nesadapter->free_4kpbl += nesmr->pbls_used;
2712 if (nesadapter->free_4kpbl > nesadapter->max_4kpbl)
2715 nesadapter->free_4kpbl,
2716 nesadapter->max_4kpbl);
2718 nesadapter->free_256pbl += nesmr->pbls_used;
2719 if (nesadapter->free_256pbl > nesadapter->max_256pbl)
2722 nesadapter->free_256pbl,
2723 nesadapter->max_256pbl);
2725 spin_unlock_irqrestore(&nesadapter->pbl_lock, flags);
2727 nes_free_resource(nesadapter, nesadapter->allocated_mrs,
2747 return sprintf(buf, "%x\n", nesvnic->nesdev->nesadapter->hw_rev);
2763 (nesvnic->nesdev->nesadapter->firmware_version >> 16),
2764 (nesvnic->nesdev->nesadapter->firmware_version & 0x000000ff));
3319 if (ib_wr->num_sge > nesdev->nesadapter->max_sge) {
3342 if (ib_wr->num_sge > nesdev->nesadapter->max_sge) {
3344 ib_wr->num_sge, nesdev->nesadapter->max_sge);
3569 if (ib_wr->num_sge > nesdev->nesadapter->max_sge) {
3668 wqe_index = u32temp & (nesdev->nesadapter->max_qp_wr - 1);
3778 wqe_index = (wqe_index & (~(nesdev->nesadapter->max_qp_wr - 1))) | wq_tail;
4001 struct nes_adapter *nesadapter = nesdev->nesadapter;
4010 nesibdev->max_cq = (nesadapter->max_cq-NES_FIRST_QPN) / nesadapter->port_count;
4011 nesibdev->max_mr = nesadapter->max_mr / nesadapter->port_count;
4012 nesibdev->max_qp = (nesadapter->max_qp-NES_FIRST_QPN) / nesadapter->port_count;
4013 nesibdev->max_pd = nesadapter->max_pd / nesadapter->port_count;