diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2007-12-30 22:07:25 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-02-01 16:42:08 -0500 |
commit | 5148bf4ebc1f59dc6a0ec43a220c55ff0771246e (patch) | |
tree | d7ba46947483308dc77736335b05d1124befa7c4 | |
parent | 5d137990f5860451a6e0428e0903f62933d05287 (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>
-rw-r--r-- | include/linux/sunrpc/svc.h | 2 | ||||
-rw-r--r-- | include/linux/sunrpc/svc_xprt.h | 1 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 17 |
3 files changed, 11 insertions, 9 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 37f7448c997..cfb2652f6f8 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -217,7 +217,7 @@ struct svc_rqst { | |||
217 | struct auth_ops * rq_authop; /* authentication flavour */ | 217 | struct auth_ops * rq_authop; /* authentication flavour */ |
218 | u32 rq_flavor; /* pseudoflavor */ | 218 | u32 rq_flavor; /* pseudoflavor */ |
219 | struct svc_cred rq_cred; /* auth info */ | 219 | struct svc_cred rq_cred; /* auth info */ |
220 | struct sk_buff * rq_skbuff; /* fast recv inet buffer */ | 220 | void * rq_xprt_ctxt; /* transport specific context ptr */ |
221 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ | 221 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ |
222 | 222 | ||
223 | struct xdr_buf rq_arg; | 223 | struct xdr_buf rq_arg; |
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index 7ae6c857b05..01ee7bc2c37 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h | |||
@@ -12,6 +12,7 @@ | |||
12 | struct svc_xprt_ops { | 12 | struct svc_xprt_ops { |
13 | int (*xpo_recvfrom)(struct svc_rqst *); | 13 | int (*xpo_recvfrom)(struct svc_rqst *); |
14 | int (*xpo_sendto)(struct svc_rqst *); | 14 | int (*xpo_sendto)(struct svc_rqst *); |
15 | void (*xpo_release_rqst)(struct svc_rqst *); | ||
15 | }; | 16 | }; |
16 | 17 | ||
17 | struct svc_xprt_class { | 18 | struct svc_xprt_class { |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 7817c7eea75..d46abc89b99 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 | */ |
188 | static inline void | 188 | static void svc_release_skb(struct svc_rqst *rqstp) |
189 | svc_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) | |||
903 | static struct svc_xprt_ops svc_udp_ops = { | 902 | static 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 | ||
908 | static struct svc_xprt_class svc_udp_class = { | 908 | static 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) | |||
1357 | static struct svc_xprt_ops svc_tcp_ops = { | 1357 | static 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 | ||
1362 | static struct svc_xprt_class svc_tcp_class = { | 1363 | static 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; |