Lines Matching +full:rpc +full:- +full:if

1 /* SPDX-License-Identifier: GPL-2.0 */
5 * RPC server declarations.
34 * RPC service thread pool.
37 * a single one of these per RPC service, but on NUMA machines those
39 * have one pool per NUMA node. This optimisation reduces cross-
40 * node traffic on multi-node NUMA NFS servers.
49 #define SP_TASK_PENDING (0) /* still work to do even if no
75 * RPC service.
77 * An RPC service is a ``daemon,'' possibly multithreaded, which
78 * receives and processes incoming RPC messages.
82 * We currently do not support more than one RPC program per daemon.
85 struct svc_program * sv_program; /* RPC program */
86 struct svc_stat * sv_stats; /* RPC statistics */
106 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
111 wait_queue_head_t sv_cb_waitq; /* sleep here if there are no
125 serv->sv_nrthreads++; in svc_get()
129 * Maximum payload size supported by a kernel RPC server.
137 * For UDP transports, a block plus NFS,RPC, and UDP headers
156 * RPC Requsts and replies are stored in one or more pages.
161 * Pages are sent using ->sendpage so each server thread needs to
174 * This assumes that the non-page part of an rpc reply will fit
175 * in a page - NFSd ensures this. lockd also has no trouble.
179 * We using ->sendfile to return read data, we might need one extra page
180 * if the request is not page-aligned. So add another '1'.
182 #define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE \
188 vp = iov->iov_base; in svc_getnl()
190 iov->iov_base = (void*)vp; in svc_getnl()
191 iov->iov_len -= sizeof(__be32); in svc_getnl()
197 __be32 *vp = iov->iov_base + iov->iov_len; in svc_putnl()
199 iov->iov_len += sizeof(__be32); in svc_putnl()
205 vp = iov->iov_base; in svc_getu32()
207 iov->iov_base = (void*)vp; in svc_getu32()
208 iov->iov_len -= sizeof(__be32); in svc_getu32()
214 __be32 *vp = (__be32 *)iov->iov_base; in svc_ungetu32()
215 iov->iov_base = (void *)(vp - 1); in svc_ungetu32()
216 iov->iov_len += sizeof(*vp); in svc_ungetu32()
221 __be32 *vp = iov->iov_base + iov->iov_len; in svc_putu32()
223 iov->iov_len += sizeof(__be32); in svc_putu32()
238 * - reply from here */
241 struct svc_serv * rq_server; /* RPC service definition */
285 void * rq_auth_data; /* flavor-specific data */
300 struct auth_domain * rq_client; /* RPC peer info */
301 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
304 spinlock_t rq_lock; /* per-request lock */
311 #define SVC_NET(rqst) (rqst->rq_xprt ? rqst->rq_xprt->xpt_net : rqst->rq_bc_net)
318 return (struct sockaddr_in *) &rqst->rq_addr; in svc_addr_in()
323 return (struct sockaddr_in6 *) &rqst->rq_addr; in svc_addr_in6()
328 return (struct sockaddr *) &rqst->rq_addr; in svc_addr()
333 return (struct sockaddr_in *) &rqst->rq_daddr; in svc_daddr_in()
338 return (struct sockaddr_in6 *) &rqst->rq_daddr; in svc_daddr_in6()
343 return (struct sockaddr *) &rqst->rq_daddr; in svc_daddr()
353 struct kvec *vec = &rqstp->rq_arg.head[0]; in xdr_argsize_check()
354 return cp >= (char*)vec->iov_base in xdr_argsize_check()
355 && cp <= (char*)vec->iov_base + vec->iov_len; in xdr_argsize_check()
361 struct kvec *vec = &rqstp->rq_res.head[0]; in xdr_ressize_check()
364 vec->iov_len = cp - (char*)vec->iov_base; in xdr_ressize_check()
366 return vec->iov_len <= PAGE_SIZE; in xdr_ressize_check()
371 while (rqstp->rq_next_page != rqstp->rq_respages) { in svc_free_res_pages()
372 struct page **pp = --rqstp->rq_next_page; in svc_free_res_pages()
373 if (*pp) { in svc_free_res_pages()
404 * List of RPC programs on the same transport endpoint
415 struct svc_stat * pg_stats; /* rpc statistics */
428 * RPC program version
433 const struct svc_procedure *vs_proc; /* per-procedure info */
440 /* Don't care if the rpcbind registration fails */
454 * RPC procedure info
476 SVC_POOL_AUTO = -1, /* choose one of the others */
565 svc_reserve(rqstp, space + rqstp->rq_auth_slack); in svc_reserve_auth()
569 * svcxdr_init_decode - Prepare an xdr_stream for svc Call decoding
570 * @rqstp: controlling server RPC transaction context
575 struct xdr_stream *xdr = &rqstp->rq_arg_stream; in svcxdr_init_decode()
576 struct kvec *argv = rqstp->rq_arg.head; in svcxdr_init_decode()
578 xdr_init_decode(xdr, &rqstp->rq_arg, argv->iov_base, NULL); in svcxdr_init_decode()
579 xdr_set_scratch_page(xdr, rqstp->rq_scratch_page); in svcxdr_init_decode()
583 * svcxdr_init_encode - Prepare an xdr_stream for svc Reply encoding
584 * @rqstp: controlling server RPC transaction context
589 struct xdr_stream *xdr = &rqstp->rq_res_stream; in svcxdr_init_encode()
590 struct xdr_buf *buf = &rqstp->rq_res; in svcxdr_init_encode()
591 struct kvec *resv = buf->head; in svcxdr_init_encode()
595 xdr->buf = buf; in svcxdr_init_encode()
596 xdr->iov = resv; in svcxdr_init_encode()
597 xdr->p = resv->iov_base + resv->iov_len; in svcxdr_init_encode()
598 xdr->end = resv->iov_base + PAGE_SIZE - rqstp->rq_auth_slack; in svcxdr_init_encode()
599 buf->len = resv->iov_len; in svcxdr_init_encode()
600 xdr->page_ptr = buf->pages - 1; in svcxdr_init_encode()
601 buf->buflen = PAGE_SIZE * (1 + rqstp->rq_page_end - buf->pages); in svcxdr_init_encode()
602 buf->buflen -= rqstp->rq_auth_slack; in svcxdr_init_encode()
603 xdr->rqst = NULL; in svcxdr_init_encode()