39 #include <linux/errno.h>
41 #include <linux/export.h>
42 #include <linux/string.h>
43 #include <linux/slab.h>
163 return pd->
device->dealloc_pd(pd);
173 ah = pd->
device->create_ah(pd, ah_attr);
193 memset(ah_attr, 0,
sizeof *ah_attr);
195 ah_attr->
sl = wc->
sl;
208 ah_attr->
grh.sgid_index = (
u8) gid_index;
210 ah_attr->
grh.flow_label = flow_class & 0xFFFFF;
211 ah_attr->
grh.hop_limit = 0xFF;
212 ah_attr->
grh.traffic_class = (flow_class >> 20) & 0xFF;
234 return ah->
device->modify_ah ?
235 ah->
device->modify_ah(ah, ah_attr) :
242 return ah->
device->query_ah ?
243 ah->
device->query_ah(ah, ah_attr) :
254 ret = ah->
device->destroy_ah(ah);
269 if (!pd->
device->create_srq)
272 srq = pd->
device->create_srq(pd, srq_init_attr,
NULL);
299 return srq->
device->modify_srq ?
300 srq->
device->modify_srq(srq, srq_attr, srq_attr_mask,
NULL) :
308 return srq->
device->query_srq ?
331 ret = srq->
device->destroy_srq(srq);
357 list_add(&qp->xrcd_list, &xrcd->tgt_qp_list);
382 spin_unlock_irqrestore(&real_qp->
device->event_handler_lock, flags);
415 device = pd ? pd->
device : qp_init_attr->
xrcd->device;
439 __ib_insert_xrcd_qp(qp_init_attr->
xrcd, real_qp);
441 real_qp->
device->destroy_qp(real_qp);
451 qp->
srq = qp_init_attr->
srq;
469 static const struct {
779 if (cur_state < 0 || cur_state >
IB_QPS_ERR ||
788 if (!qp_state_table[cur_state][next_state].
valid)
791 req_param = qp_state_table[cur_state][
next_state].req_param[
type];
792 opt_param = qp_state_table[cur_state][
next_state].opt_param[
type];
794 if ((mask & req_param) != req_param)
817 return qp->
device->query_qp ?
818 qp->
device->query_qp(qp->
real_qp, qp_attr, qp_attr_mask, qp_init_attr) :
834 spin_unlock_irqrestore(&real_qp->
device->event_handler_lock, flags);
843 static int __ib_destroy_shared_qp(
struct ib_qp *qp)
850 xrcd = real_qp->
xrcd;
865 __ib_insert_xrcd_qp(xrcd, real_qp);
882 return __ib_destroy_shared_qp(qp);
889 ret = qp->
device->destroy_qp(qp);
931 return cq->
device->modify_cq ?
932 cq->
device->modify_cq(cq, cq_count, cq_period) : -
ENOSYS;
941 return cq->
device->destroy_cq(cq);
947 return cq->
device->resize_cq ?
958 mr = pd->
device->get_dma_mr(pd, mr_access_flags);
980 if (!pd->
device->reg_phys_mr)
983 mr = pd->
device->reg_phys_mr(pd, phys_buf_array, num_phys_buf,
984 mr_access_flags, iova_start);
1003 int mr_access_flags,
1006 struct ib_pd *old_pd;
1009 if (!mr->
device->rereg_phys_mr)
1017 ret = mr->
device->rereg_phys_mr(mr, mr_rereg_mask, pd,
1018 phys_buf_array, num_phys_buf,
1019 mr_access_flags, iova_start);
1032 return mr->
device->query_mr ?
1046 ret = mr->
device->dereg_mr(mr);
1058 if (!pd->
device->alloc_fast_reg_mr)
1061 mr = pd->
device->alloc_fast_reg_mr(pd, max_page_list_len);
1085 if (!IS_ERR(page_list)) {
1096 page_list->
device->free_fast_reg_page_list(page_list);
1106 if (!pd->
device->alloc_mw)
1109 mw = pd->
device->alloc_mw(pd);
1127 ret = mw->
device->dealloc_mw(mw);
1138 int mr_access_flags,
1143 if (!pd->
device->alloc_fmr)
1146 fmr = pd->
device->alloc_fmr(pd, mr_access_flags, fmr_attr);
1161 if (list_empty(fmr_list))
1165 return fmr->
device->unmap_fmr(fmr_list);
1175 ret = fmr->
device->dealloc_fmr(fmr);
1189 if (!qp->
device->attach_mcast)
1194 ret = qp->
device->attach_mcast(qp, gid, lid);
1205 if (!qp->
device->detach_mcast)
1210 ret = qp->
device->detach_mcast(qp, gid, lid);
1225 if (!IS_ERR(xrcd)) {
1252 return xrcd->
device->dealloc_xrcd(xrcd);