aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTom Tucker <tom@opengridcomputing.com>2007-12-30 22:07:25 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-01 16:42:08 -0500
commit5148bf4ebc1f59dc6a0ec43a220c55ff0771246e (patch)
treed7ba46947483308dc77736335b05d1124befa7c4 /net
parent5d137990f5860451a6e0428e0903f62933d05287 (diff)
svc: Add transport specific xpo_release function
The svc_sock_release function releases pages allocated to a thread. For UDP this frees the receive skb. For RDMA it will post a receive WR and bump the client credit count. Signed-off-by: Tom Tucker <tom@opengridcomputing.com> Acked-by: Neil Brown <neilb@suse.de> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Greg Banks <gnb@sgi.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svcsock.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 7817c7eea753..d46abc89b99a 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -185,14 +185,13 @@ svc_thread_dequeue(struct svc_pool *pool, struct svc_rqst *rqstp)
185/* 185/*
186 * Release an skbuff after use 186 * Release an skbuff after use
187 */ 187 */
188static inline void 188static void svc_release_skb(struct svc_rqst *rqstp)
189svc_release_skb(struct svc_rqst *rqstp)
190{ 189{
191 struct sk_buff *skb = rqstp->rq_skbuff; 190 struct sk_buff *skb = rqstp->rq_xprt_ctxt;
192 struct svc_deferred_req *dr = rqstp->rq_deferred; 191 struct svc_deferred_req *dr = rqstp->rq_deferred;
193 192
194 if (skb) { 193 if (skb) {
195 rqstp->rq_skbuff = NULL; 194 rqstp->rq_xprt_ctxt = NULL;
196 195
197 dprintk("svc: service %p, releasing skb %p\n", rqstp, skb); 196 dprintk("svc: service %p, releasing skb %p\n", rqstp, skb);
198 skb_free_datagram(rqstp->rq_sock->sk_sk, skb); 197 skb_free_datagram(rqstp->rq_sock->sk_sk, skb);
@@ -395,7 +394,7 @@ svc_sock_release(struct svc_rqst *rqstp)
395{ 394{
396 struct svc_sock *svsk = rqstp->rq_sock; 395 struct svc_sock *svsk = rqstp->rq_sock;
397 396
398 svc_release_skb(rqstp); 397 rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
399 398
400 svc_free_res_pages(rqstp); 399 svc_free_res_pages(rqstp);
401 rqstp->rq_res.page_len = 0; 400 rqstp->rq_res.page_len = 0;
@@ -867,7 +866,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
867 skb_free_datagram(svsk->sk_sk, skb); 866 skb_free_datagram(svsk->sk_sk, skb);
868 return 0; 867 return 0;
869 } 868 }
870 rqstp->rq_skbuff = skb; 869 rqstp->rq_xprt_ctxt = skb;
871 } 870 }
872 871
873 rqstp->rq_arg.page_base = 0; 872 rqstp->rq_arg.page_base = 0;
@@ -903,6 +902,7 @@ svc_udp_sendto(struct svc_rqst *rqstp)
903static struct svc_xprt_ops svc_udp_ops = { 902static struct svc_xprt_ops svc_udp_ops = {
904 .xpo_recvfrom = svc_udp_recvfrom, 903 .xpo_recvfrom = svc_udp_recvfrom,
905 .xpo_sendto = svc_udp_sendto, 904 .xpo_sendto = svc_udp_sendto,
905 .xpo_release_rqst = svc_release_skb,
906}; 906};
907 907
908static struct svc_xprt_class svc_udp_class = { 908static struct svc_xprt_class svc_udp_class = {
@@ -1291,7 +1291,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
1291 rqstp->rq_arg.page_len = len - rqstp->rq_arg.head[0].iov_len; 1291 rqstp->rq_arg.page_len = len - rqstp->rq_arg.head[0].iov_len;
1292 } 1292 }
1293 1293
1294 rqstp->rq_skbuff = NULL; 1294 rqstp->rq_xprt_ctxt = NULL;
1295 rqstp->rq_prot = IPPROTO_TCP; 1295 rqstp->rq_prot = IPPROTO_TCP;
1296 1296
1297 /* Reset TCP read info */ 1297 /* Reset TCP read info */
@@ -1357,6 +1357,7 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
1357static struct svc_xprt_ops svc_tcp_ops = { 1357static struct svc_xprt_ops svc_tcp_ops = {
1358 .xpo_recvfrom = svc_tcp_recvfrom, 1358 .xpo_recvfrom = svc_tcp_recvfrom,
1359 .xpo_sendto = svc_tcp_sendto, 1359 .xpo_sendto = svc_tcp_sendto,
1360 .xpo_release_rqst = svc_release_skb,
1360}; 1361};
1361 1362
1362static struct svc_xprt_class svc_tcp_class = { 1363static struct svc_xprt_class svc_tcp_class = {
@@ -1578,7 +1579,7 @@ svc_send(struct svc_rqst *rqstp)
1578 } 1579 }
1579 1580
1580 /* release the receive skb before sending the reply */ 1581 /* release the receive skb before sending the reply */
1581 svc_release_skb(rqstp); 1582 rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
1582 1583
1583 /* calculate over-all length */ 1584 /* calculate over-all length */
1584 xb = & rqstp->rq_res; 1585 xb = & rqstp->rq_res;