From: Chuck Lever Date: Wed, 26 Aug 2015 20:26:17 +0000 (-0600) Subject: svcrdma: Define maximum number of backchannel requests X-Git-Tag: v4.1.12-92~278^2^2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=79fb23957d401d7d61f6e8b5b13055f347ddfb4c;p=users%2Fjedix%2Flinux-maple.git svcrdma: Define maximum number of backchannel requests [ Proposed for v4.4 ] Extra resources for handling backchannel requests have to be pre-allocated when a transport instance is created. Set a limit. Signed-off-by: Chuck Lever --- diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index c60173048786d..a91f760254d9e 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h @@ -179,6 +179,11 @@ struct svcxprt_rdma { #define RPCRDMA_SQ_DEPTH_MULT 8 #define RPCRDMA_MAX_REQUESTS 32 #define RPCRDMA_MAX_REQ_SIZE 4096 +#if defined(CONFIG_SUNRPC_BACKCHANNEL) +#define RPCRDMA_MAX_BC_REQUESTS 8 +#else +#define RPCRDMA_MAX_BC_REQUESTS 0 +#endif #define RPCSVC_MAXPAYLOAD_RDMA RPCSVC_MAXPAYLOAD diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index ac4b718c57466..e35cf9c5fe813 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -923,8 +923,10 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) * capabilities of this particular device */ newxprt->sc_max_sge = min((size_t)devattr.max_sge, (size_t)RPCSVC_MAXPAGES); + /* XXX: what if HCA can't support enough WRs for bc operation? */ newxprt->sc_max_requests = min((size_t)devattr.max_qp_wr, - (size_t)svcrdma_max_requests); + (size_t)(svcrdma_max_requests + + RPCRDMA_MAX_BC_REQUESTS)); newxprt->sc_sq_depth = RPCRDMA_SQ_DEPTH_MULT * newxprt->sc_max_requests; /* @@ -964,7 +966,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) qp_attr.event_handler = qp_event_handler; qp_attr.qp_context = &newxprt->sc_xprt; qp_attr.cap.max_send_wr = newxprt->sc_sq_depth; - qp_attr.cap.max_recv_wr = newxprt->sc_max_requests; + qp_attr.cap.max_recv_wr = newxprt->sc_max_requests + + RPCRDMA_MAX_BC_REQUESTS; qp_attr.cap.max_send_sge = newxprt->sc_max_sge; qp_attr.cap.max_recv_sge = newxprt->sc_max_sge; qp_attr.sq_sig_type = IB_SIGNAL_REQ_WR;