All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 06/40] svc: Add transport specific xpo_release function
Date: Sun, 30 Dec 2007 21:07:25 -0600	[thread overview]
Message-ID: <20071231030725.8430.56046.stgit@dell3.ogc.int> (raw)
In-Reply-To: <20071231030712.8430.45576.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>


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>
---

 include/linux/sunrpc/svc.h      |    2 +-
 include/linux/sunrpc/svc_xprt.h |    1 +
 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 37f7448..cfb2652 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -217,7 +217,7 @@ struct svc_rqst {
 	struct auth_ops *	rq_authop;	/* authentication flavour */
 	u32			rq_flavor;	/* pseudoflavor */
 	struct svc_cred		rq_cred;	/* auth info */
-	struct sk_buff *	rq_skbuff;	/* fast recv inet buffer */
+	void *			rq_xprt_ctxt;	/* transport specific context ptr */
 	struct svc_deferred_req*rq_deferred;	/* deferred request we are replaying */
 
 	struct xdr_buf		rq_arg;
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 7ae6c85..01ee7bc 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -12,6 +12,7 @@
 struct svc_xprt_ops {
 	int		(*xpo_recvfrom)(struct svc_rqst *);
 	int		(*xpo_sendto)(struct svc_rqst *);
+	void		(*xpo_release_rqst)(struct svc_rqst *);
 };
 
 struct svc_xprt_class {
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 7817c7e..d46abc8 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)
 /*
  * Release an skbuff after use
  */
-static inline void
-svc_release_skb(struct svc_rqst *rqstp)
+static void svc_release_skb(struct svc_rqst *rqstp)
 {
-	struct sk_buff *skb = rqstp->rq_skbuff;
+	struct sk_buff *skb = rqstp->rq_xprt_ctxt;
 	struct svc_deferred_req *dr = rqstp->rq_deferred;
 
 	if (skb) {
-		rqstp->rq_skbuff = NULL;
+		rqstp->rq_xprt_ctxt = NULL;
 
 		dprintk("svc: service %p, releasing skb %p\n", rqstp, skb);
 		skb_free_datagram(rqstp->rq_sock->sk_sk, skb);
@@ -395,7 +394,7 @@ svc_sock_release(struct svc_rqst *rqstp)
 {
 	struct svc_sock	*svsk = rqstp->rq_sock;
 
-	svc_release_skb(rqstp);
+	rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
 
 	svc_free_res_pages(rqstp);
 	rqstp->rq_res.page_len = 0;
@@ -867,7 +866,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
 			skb_free_datagram(svsk->sk_sk, skb);
 			return 0;
 		}
-		rqstp->rq_skbuff = skb;
+		rqstp->rq_xprt_ctxt = skb;
 	}
 
 	rqstp->rq_arg.page_base = 0;
@@ -903,6 +902,7 @@ svc_udp_sendto(struct svc_rqst *rqstp)
 static struct svc_xprt_ops svc_udp_ops = {
 	.xpo_recvfrom = svc_udp_recvfrom,
 	.xpo_sendto = svc_udp_sendto,
+	.xpo_release_rqst = svc_release_skb,
 };
 
 static struct svc_xprt_class svc_udp_class = {
@@ -1291,7 +1291,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
 		rqstp->rq_arg.page_len = len - rqstp->rq_arg.head[0].iov_len;
 	}
 
-	rqstp->rq_skbuff      = NULL;
+	rqstp->rq_xprt_ctxt   = NULL;
 	rqstp->rq_prot	      = IPPROTO_TCP;
 
 	/* Reset TCP read info */
@@ -1357,6 +1357,7 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
 static struct svc_xprt_ops svc_tcp_ops = {
 	.xpo_recvfrom = svc_tcp_recvfrom,
 	.xpo_sendto = svc_tcp_sendto,
+	.xpo_release_rqst = svc_release_skb,
 };
 
 static struct svc_xprt_class svc_tcp_class = {
@@ -1578,7 +1579,7 @@ svc_send(struct svc_rqst *rqstp)
 	}
 
 	/* release the receive skb before sending the reply */
-	svc_release_skb(rqstp);
+	rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
 
 	/* calculate over-all length */
 	xb = & rqstp->rq_res;

  parent reply	other threads:[~2007-12-31  3:07 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-31  3:07 [PATCH 00/40] svc: SVC Transport Switch Tom Tucker
     [not found] ` <20071231030712.8430.45576.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-31  3:07   ` [PATCH 01/40] svc: Add an svc transport class Tom Tucker
2007-12-31  3:07   ` [PATCH 02/40] svc: Make svc_sock the tcp/udp transport Tom Tucker
2007-12-31  3:07   ` [PATCH 03/40] svc: Change the svc_sock in the rqstp structure to a transport Tom Tucker
2007-12-31  3:07   ` [PATCH 04/40] svc: Add a max payload value to the transport Tom Tucker
2007-12-31  3:07   ` [PATCH 05/40] svc: Move sk_sendto and sk_recvfrom to svc_xprt_class Tom Tucker
2007-12-31  3:07   ` Tom Tucker [this message]
2007-12-31  3:07   ` [PATCH 07/40] svc: Add per-transport delete functions Tom Tucker
2007-12-31  3:07   ` [PATCH 08/40] svc: Add xpo_prep_reply_hdr Tom Tucker
2007-12-31  3:07   ` [PATCH 09/40] svc: Add a transport function that checks for write space Tom Tucker
2007-12-31  3:07   ` [PATCH 10/40] svc: Move close processing to a single place Tom Tucker
2007-12-31  3:07   ` [PATCH 11/40] svc: Add xpo_accept transport function Tom Tucker
2007-12-31  3:07   ` [PATCH 12/40] svc: Remove unnecessary call to svc_sock_enqueue Tom Tucker
2007-12-31  3:07   ` [PATCH 13/40] svc: Move connection limit checking to its own function Tom Tucker
2007-12-31  3:07   ` [PATCH 14/40] svc: Add a generic transport svc_create_xprt function Tom Tucker
2007-12-31  3:07   ` [PATCH 15/40] svc: Change services to use new svc_create_xprt service Tom Tucker
2007-12-31  3:07   ` [PATCH 16/40] svc: Change sk_inuse to a kref Tom Tucker
2007-12-31  3:07   ` [PATCH 17/40] svc: Move sk_flags to the svc_xprt structure Tom Tucker
2007-12-31  3:07   ` [PATCH 18/40] svc: Move sk_server and sk_pool to svc_xprt Tom Tucker
2007-12-31  3:07   ` [PATCH 19/40] svc: Make close transport independent Tom Tucker
2007-12-31  3:07   ` [PATCH 20/40] svc: Move sk_reserved to svc_xprt Tom Tucker
2007-12-31  3:07   ` [PATCH 21/40] svc: Make the enqueue service transport neutral and export it Tom Tucker
2007-12-31  3:07   ` [PATCH 22/40] svc: Make svc_send transport neutral Tom Tucker
2007-12-31  3:08   ` [PATCH 23/40] svc: Change svc_sock_received to svc_xprt_received and export it Tom Tucker
2007-12-31  3:08   ` [PATCH 24/40] svc: Move accept call to svc_xprt_received to common code Tom Tucker
2007-12-31  3:08   ` [PATCH 25/40] svc: Remove sk_lastrecv Tom Tucker
2007-12-31  3:08   ` [PATCH 26/40] svc: Move the authinfo cache to svc_xprt Tom Tucker
2007-12-31  3:08   ` [PATCH 27/40] svc: Make deferral processing xprt independent Tom Tucker
2007-12-31  3:08   ` [PATCH 28/40] svc: Move the sockaddr information to svc_xprt Tom Tucker
2007-12-31  3:08   ` [PATCH 29/40] svc: Make svc_sock_release svc_xprt_release Tom Tucker
2007-12-31  3:08   ` [PATCH 30/40] svc: Make svc_recv transport neutral Tom Tucker
2007-12-31  3:08   ` [PATCH 31/40] svc: Make svc_age_temp_sockets svc_age_temp_transports Tom Tucker
2007-12-31  3:08   ` [PATCH 32/40] svc: Move create logic to common code Tom Tucker
2007-12-31  3:08   ` [PATCH 33/40] svc: Removing remaining references to rq_sock in rqstp Tom Tucker
2007-12-31  3:08   ` [PATCH 34/40] svc: Make svc_check_conn_limits xprt independent Tom Tucker
2007-12-31  3:08   ` [PATCH 35/40] svc: Move the xprt independent code to the svc_xprt.c file Tom Tucker
     [not found]     ` <20071231030827.8430.76850.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-31 22:14       ` J. Bruce Fields
2007-12-31  3:08   ` [PATCH 36/40] svc: Add transport hdr size for defer/revisit Tom Tucker
2007-12-31  3:08   ` [PATCH 37/40] svc: Add /proc/sys/sunrpc/transport files Tom Tucker
2007-12-31  3:08   ` [PATCH 38/40] svc: Add svc API that queries for a transport instance Tom Tucker
2007-12-31  3:08   ` [PATCH 39/40] knfsd: Support adding transports by writing portlist file Tom Tucker
2007-12-31  3:08   ` [PATCH 40/40] svc: Add svc_xprt_names service to replace svc_sock_names Tom Tucker
2007-12-31 22:13   ` [PATCH 00/40] svc: SVC Transport Switch J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071231030725.8430.56046.stgit@dell3.ogc.int \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.