|
@@ -488,18 +488,19 @@ rpcrdma_ia_close(struct rpcrdma_ia *ia)
|
|
|
*/
|
|
|
int
|
|
|
rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
|
|
|
- struct rpcrdma_create_data_internal *cdata)
|
|
|
+ struct rpcrdma_create_data_internal *cdata)
|
|
|
{
|
|
|
struct rpcrdma_connect_private *pmsg = &ep->rep_cm_private;
|
|
|
+ unsigned int max_qp_wr, max_sge;
|
|
|
struct ib_cq *sendcq, *recvcq;
|
|
|
- unsigned int max_qp_wr;
|
|
|
int rc;
|
|
|
|
|
|
- if (ia->ri_device->attrs.max_sge < RPCRDMA_MAX_SEND_SGES) {
|
|
|
- dprintk("RPC: %s: insufficient sge's available\n",
|
|
|
- __func__);
|
|
|
+ max_sge = min(ia->ri_device->attrs.max_sge, RPCRDMA_MAX_SEND_SGES);
|
|
|
+ if (max_sge < RPCRDMA_MIN_SEND_SGES) {
|
|
|
+ pr_warn("rpcrdma: HCA provides only %d send SGEs\n", max_sge);
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
+ ia->ri_max_send_sges = max_sge - RPCRDMA_MIN_SEND_SGES;
|
|
|
|
|
|
if (ia->ri_device->attrs.max_qp_wr <= RPCRDMA_BACKWARD_WRS) {
|
|
|
dprintk("RPC: %s: insufficient wqe's available\n",
|
|
@@ -524,7 +525,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
|
|
|
ep->rep_attr.cap.max_recv_wr = cdata->max_requests;
|
|
|
ep->rep_attr.cap.max_recv_wr += RPCRDMA_BACKWARD_WRS;
|
|
|
ep->rep_attr.cap.max_recv_wr += 1; /* drain cqe */
|
|
|
- ep->rep_attr.cap.max_send_sge = RPCRDMA_MAX_SEND_SGES;
|
|
|
+ ep->rep_attr.cap.max_send_sge = max_sge;
|
|
|
ep->rep_attr.cap.max_recv_sge = 1;
|
|
|
ep->rep_attr.cap.max_inline_data = 0;
|
|
|
ep->rep_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
|