diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-01 22:31:28 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-01 22:31:28 -0500 |
| commit | 63e9b66e29357dd12e8b1d3ebf7036e7591f81e3 (patch) | |
| tree | 5aa6a70a8f4bbf306e2825a1e2fa2660c2c1c187 /include/linux | |
| parent | 687fcdf741e4a268c2c7bac8b3734de761bb9719 (diff) | |
| parent | ea339d46b93c7b16e067a29aad1812f7a389815a (diff) | |
Merge branch 'for-linus' of git://linux-nfs.org/~bfields/linux
* 'for-linus' of git://linux-nfs.org/~bfields/linux: (100 commits)
SUNRPC: RPC program information is stored in unsigned integers
SUNRPC: Move exported symbol definitions after function declaration part 2
NLM: tear down RPC clients in nlm_shutdown_hosts
SUNRPC: spin svc_rqst initialization to its own function
nfsd: more careful input validation in nfsctl write methods
lockd: minor log message fix
knfsd: don't bother mapping putrootfh enoent to eperm
rdma: makefile
rdma: ONCRPC RDMA protocol marshalling
rdma: SVCRDMA sendto
rdma: SVCRDMA recvfrom
rdma: SVCRDMA Core Transport Services
rdma: SVCRDMA Transport Module
rdma: SVCRMDA Header File
svc: Add svc_xprt_names service to replace svc_sock_names
knfsd: Support adding transports by writing portlist file
svc: Add svc API that queries for a transport instance
svc: Add /proc/sys/sunrpc/transport files
svc: Add transport hdr size for defer/revisit
svc: Move the xprt independent code to the svc_xprt.c file
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/lockd/lockd.h | 9 | ||||
| -rw-r--r-- | include/linux/lockd/xdr.h | 4 | ||||
| -rw-r--r-- | include/linux/nfsd/Kbuild | 1 | ||||
| -rw-r--r-- | include/linux/nfsd/auth.h | 27 | ||||
| -rw-r--r-- | include/linux/nfsd/cache.h | 4 | ||||
| -rw-r--r-- | include/linux/nfsd/export.h | 2 | ||||
| -rw-r--r-- | include/linux/nfsd/nfsd.h | 5 | ||||
| -rw-r--r-- | include/linux/nfsd/syscall.h | 1 | ||||
| -rw-r--r-- | include/linux/nfsd/xdr.h | 14 | ||||
| -rw-r--r-- | include/linux/nfsd/xdr3.h | 16 | ||||
| -rw-r--r-- | include/linux/nfsd/xdr4.h | 2 | ||||
| -rw-r--r-- | include/linux/nfsd_idmap.h | 11 | ||||
| -rw-r--r-- | include/linux/sunrpc/cache.h | 4 | ||||
| -rw-r--r-- | include/linux/sunrpc/debug.h | 2 | ||||
| -rw-r--r-- | include/linux/sunrpc/svc.h | 10 | ||||
| -rw-r--r-- | include/linux/sunrpc/svc_rdma.h | 262 | ||||
| -rw-r--r-- | include/linux/sunrpc/svc_xprt.h | 159 | ||||
| -rw-r--r-- | include/linux/sunrpc/svcsock.h | 43 | ||||
| -rw-r--r-- | include/linux/sunrpc/xdr.h | 3 |
19 files changed, 475 insertions, 104 deletions
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index e2d1ce36b367..4babb2a129ac 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
| @@ -173,14 +173,17 @@ void nlmclnt_next_cookie(struct nlm_cookie *); | |||
| 173 | /* | 173 | /* |
| 174 | * Host cache | 174 | * Host cache |
| 175 | */ | 175 | */ |
| 176 | struct nlm_host * nlmclnt_lookup_host(const struct sockaddr_in *, int, int, const char *, int); | 176 | struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *, int, int, |
| 177 | struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *, const char *, int); | 177 | const char *, unsigned int); |
| 178 | struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *, | ||
| 179 | unsigned int); | ||
| 178 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); | 180 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); |
| 179 | void nlm_rebind_host(struct nlm_host *); | 181 | void nlm_rebind_host(struct nlm_host *); |
| 180 | struct nlm_host * nlm_get_host(struct nlm_host *); | 182 | struct nlm_host * nlm_get_host(struct nlm_host *); |
| 181 | void nlm_release_host(struct nlm_host *); | 183 | void nlm_release_host(struct nlm_host *); |
| 182 | void nlm_shutdown_hosts(void); | 184 | void nlm_shutdown_hosts(void); |
| 183 | extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, int, u32); | 185 | extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, |
| 186 | unsigned int, u32); | ||
| 184 | void nsm_release(struct nsm_handle *); | 187 | void nsm_release(struct nsm_handle *); |
| 185 | 188 | ||
| 186 | 189 | ||
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index 83a1f9f6237b..df18fa053bcd 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h | |||
| @@ -29,7 +29,7 @@ struct svc_rqst; | |||
| 29 | /* Lock info passed via NLM */ | 29 | /* Lock info passed via NLM */ |
| 30 | struct nlm_lock { | 30 | struct nlm_lock { |
| 31 | char * caller; | 31 | char * caller; |
| 32 | int len; /* length of "caller" */ | 32 | unsigned int len; /* length of "caller" */ |
| 33 | struct nfs_fh fh; | 33 | struct nfs_fh fh; |
| 34 | struct xdr_netobj oh; | 34 | struct xdr_netobj oh; |
| 35 | u32 svid; | 35 | u32 svid; |
| @@ -78,7 +78,7 @@ struct nlm_res { | |||
| 78 | */ | 78 | */ |
| 79 | struct nlm_reboot { | 79 | struct nlm_reboot { |
| 80 | char * mon; | 80 | char * mon; |
| 81 | int len; | 81 | unsigned int len; |
| 82 | u32 state; | 82 | u32 state; |
| 83 | __be32 addr; | 83 | __be32 addr; |
| 84 | __be32 vers; | 84 | __be32 vers; |
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild index d9c5455808e5..e726fc3a4375 100644 --- a/include/linux/nfsd/Kbuild +++ b/include/linux/nfsd/Kbuild | |||
| @@ -4,4 +4,3 @@ unifdef-y += stats.h | |||
| 4 | unifdef-y += syscall.h | 4 | unifdef-y += syscall.h |
| 5 | unifdef-y += nfsfh.h | 5 | unifdef-y += nfsfh.h |
| 6 | unifdef-y += debug.h | 6 | unifdef-y += debug.h |
| 7 | unifdef-y += auth.h | ||
diff --git a/include/linux/nfsd/auth.h b/include/linux/nfsd/auth.h deleted file mode 100644 index 0fb9f7212195..000000000000 --- a/include/linux/nfsd/auth.h +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/linux/nfsd/auth.h | ||
| 3 | * | ||
| 4 | * nfsd-specific authentication stuff. | ||
| 5 | * uid/gid mapping not yet implemented. | ||
| 6 | * | ||
| 7 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef LINUX_NFSD_AUTH_H | ||
| 11 | #define LINUX_NFSD_AUTH_H | ||
| 12 | |||
| 13 | #ifdef __KERNEL__ | ||
| 14 | |||
| 15 | #define nfsd_luid(rq, uid) ((u32)(uid)) | ||
| 16 | #define nfsd_lgid(rq, gid) ((u32)(gid)) | ||
| 17 | #define nfsd_ruid(rq, uid) ((u32)(uid)) | ||
| 18 | #define nfsd_rgid(rq, gid) ((u32)(gid)) | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Set the current process's fsuid/fsgid etc to those of the NFS | ||
| 22 | * client user | ||
| 23 | */ | ||
| 24 | int nfsd_setuser(struct svc_rqst *, struct svc_export *); | ||
| 25 | |||
| 26 | #endif /* __KERNEL__ */ | ||
| 27 | #endif /* LINUX_NFSD_AUTH_H */ | ||
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h index 007480cd6a60..7b5d784cc858 100644 --- a/include/linux/nfsd/cache.h +++ b/include/linux/nfsd/cache.h | |||
| @@ -72,8 +72,8 @@ enum { | |||
| 72 | */ | 72 | */ |
| 73 | #define RC_DELAY (HZ/5) | 73 | #define RC_DELAY (HZ/5) |
| 74 | 74 | ||
| 75 | void nfsd_cache_init(void); | 75 | int nfsd_reply_cache_init(void); |
| 76 | void nfsd_cache_shutdown(void); | 76 | void nfsd_reply_cache_shutdown(void); |
| 77 | int nfsd_cache_lookup(struct svc_rqst *, int); | 77 | int nfsd_cache_lookup(struct svc_rqst *, int); |
| 78 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); | 78 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); |
| 79 | 79 | ||
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index bcb7abafbca9..3a1687251367 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h | |||
| @@ -122,7 +122,7 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp); | |||
| 122 | /* | 122 | /* |
| 123 | * Function declarations | 123 | * Function declarations |
| 124 | */ | 124 | */ |
| 125 | void nfsd_export_init(void); | 125 | int nfsd_export_init(void); |
| 126 | void nfsd_export_shutdown(void); | 126 | void nfsd_export_shutdown(void); |
| 127 | void nfsd_export_flush(void); | 127 | void nfsd_export_flush(void); |
| 128 | void exp_readlock(void); | 128 | void exp_readlock(void); |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 604a0d786bc6..8caf4c4f64e6 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <linux/nfsd/debug.h> | 20 | #include <linux/nfsd/debug.h> |
| 21 | #include <linux/nfsd/nfsfh.h> | 21 | #include <linux/nfsd/nfsfh.h> |
| 22 | #include <linux/nfsd/export.h> | 22 | #include <linux/nfsd/export.h> |
| 23 | #include <linux/nfsd/auth.h> | ||
| 24 | #include <linux/nfsd/stats.h> | 23 | #include <linux/nfsd/stats.h> |
| 25 | /* | 24 | /* |
| 26 | * nfsd version | 25 | * nfsd version |
| @@ -70,9 +69,9 @@ void nfsd_racache_shutdown(void); | |||
| 70 | int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, | 69 | int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, |
| 71 | struct svc_export **expp); | 70 | struct svc_export **expp); |
| 72 | __be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, | 71 | __be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, |
| 73 | const char *, int, struct svc_fh *); | 72 | const char *, unsigned int, struct svc_fh *); |
| 74 | __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, | 73 | __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, |
| 75 | const char *, int, | 74 | const char *, unsigned int, |
| 76 | struct svc_export **, struct dentry **); | 75 | struct svc_export **, struct dentry **); |
| 77 | __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, | 76 | __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, |
| 78 | struct iattr *, int, time_t); | 77 | struct iattr *, int, time_t); |
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index 8bcddccb6c42..4e439765b705 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <linux/nfsd/const.h> | 18 | #include <linux/nfsd/const.h> |
| 19 | #include <linux/nfsd/export.h> | 19 | #include <linux/nfsd/export.h> |
| 20 | #include <linux/nfsd/nfsfh.h> | 20 | #include <linux/nfsd/nfsfh.h> |
| 21 | #include <linux/nfsd/auth.h> | ||
| 22 | 21 | ||
| 23 | /* | 22 | /* |
| 24 | * Version of the syscall interface | 23 | * Version of the syscall interface |
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h index 67885d5e6e50..a0132ef58f21 100644 --- a/include/linux/nfsd/xdr.h +++ b/include/linux/nfsd/xdr.h | |||
| @@ -23,7 +23,7 @@ struct nfsd_sattrargs { | |||
| 23 | struct nfsd_diropargs { | 23 | struct nfsd_diropargs { |
| 24 | struct svc_fh fh; | 24 | struct svc_fh fh; |
| 25 | char * name; | 25 | char * name; |
| 26 | int len; | 26 | unsigned int len; |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | struct nfsd_readargs { | 29 | struct nfsd_readargs { |
| @@ -43,17 +43,17 @@ struct nfsd_writeargs { | |||
| 43 | struct nfsd_createargs { | 43 | struct nfsd_createargs { |
| 44 | struct svc_fh fh; | 44 | struct svc_fh fh; |
| 45 | char * name; | 45 | char * name; |
| 46 | int len; | 46 | unsigned int len; |
| 47 | struct iattr attrs; | 47 | struct iattr attrs; |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | struct nfsd_renameargs { | 50 | struct nfsd_renameargs { |
| 51 | struct svc_fh ffh; | 51 | struct svc_fh ffh; |
| 52 | char * fname; | 52 | char * fname; |
| 53 | int flen; | 53 | unsigned int flen; |
| 54 | struct svc_fh tfh; | 54 | struct svc_fh tfh; |
| 55 | char * tname; | 55 | char * tname; |
| 56 | int tlen; | 56 | unsigned int tlen; |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | struct nfsd_readlinkargs { | 59 | struct nfsd_readlinkargs { |
| @@ -65,15 +65,15 @@ struct nfsd_linkargs { | |||
| 65 | struct svc_fh ffh; | 65 | struct svc_fh ffh; |
| 66 | struct svc_fh tfh; | 66 | struct svc_fh tfh; |
| 67 | char * tname; | 67 | char * tname; |
| 68 | int tlen; | 68 | unsigned int tlen; |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | struct nfsd_symlinkargs { | 71 | struct nfsd_symlinkargs { |
| 72 | struct svc_fh ffh; | 72 | struct svc_fh ffh; |
| 73 | char * fname; | 73 | char * fname; |
| 74 | int flen; | 74 | unsigned int flen; |
| 75 | char * tname; | 75 | char * tname; |
| 76 | int tlen; | 76 | unsigned int tlen; |
| 77 | struct iattr attrs; | 77 | struct iattr attrs; |
| 78 | }; | 78 | }; |
| 79 | 79 | ||
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h index 89d9d6061a62..421eddd65a25 100644 --- a/include/linux/nfsd/xdr3.h +++ b/include/linux/nfsd/xdr3.h | |||
| @@ -21,7 +21,7 @@ struct nfsd3_sattrargs { | |||
| 21 | struct nfsd3_diropargs { | 21 | struct nfsd3_diropargs { |
| 22 | struct svc_fh fh; | 22 | struct svc_fh fh; |
| 23 | char * name; | 23 | char * name; |
| 24 | int len; | 24 | unsigned int len; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | struct nfsd3_accessargs { | 27 | struct nfsd3_accessargs { |
| @@ -48,7 +48,7 @@ struct nfsd3_writeargs { | |||
| 48 | struct nfsd3_createargs { | 48 | struct nfsd3_createargs { |
| 49 | struct svc_fh fh; | 49 | struct svc_fh fh; |
| 50 | char * name; | 50 | char * name; |
| 51 | int len; | 51 | unsigned int len; |
| 52 | int createmode; | 52 | int createmode; |
| 53 | struct iattr attrs; | 53 | struct iattr attrs; |
| 54 | __be32 * verf; | 54 | __be32 * verf; |
| @@ -57,7 +57,7 @@ struct nfsd3_createargs { | |||
| 57 | struct nfsd3_mknodargs { | 57 | struct nfsd3_mknodargs { |
| 58 | struct svc_fh fh; | 58 | struct svc_fh fh; |
| 59 | char * name; | 59 | char * name; |
| 60 | int len; | 60 | unsigned int len; |
| 61 | __u32 ftype; | 61 | __u32 ftype; |
| 62 | __u32 major, minor; | 62 | __u32 major, minor; |
| 63 | struct iattr attrs; | 63 | struct iattr attrs; |
| @@ -66,10 +66,10 @@ struct nfsd3_mknodargs { | |||
| 66 | struct nfsd3_renameargs { | 66 | struct nfsd3_renameargs { |
| 67 | struct svc_fh ffh; | 67 | struct svc_fh ffh; |
| 68 | char * fname; | 68 | char * fname; |
| 69 | int flen; | 69 | unsigned int flen; |
| 70 | struct svc_fh tfh; | 70 | struct svc_fh tfh; |
| 71 | char * tname; | 71 | char * tname; |
| 72 | int tlen; | 72 | unsigned int tlen; |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | struct nfsd3_readlinkargs { | 75 | struct nfsd3_readlinkargs { |
| @@ -81,15 +81,15 @@ struct nfsd3_linkargs { | |||
| 81 | struct svc_fh ffh; | 81 | struct svc_fh ffh; |
| 82 | struct svc_fh tfh; | 82 | struct svc_fh tfh; |
| 83 | char * tname; | 83 | char * tname; |
| 84 | int tlen; | 84 | unsigned int tlen; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | struct nfsd3_symlinkargs { | 87 | struct nfsd3_symlinkargs { |
| 88 | struct svc_fh ffh; | 88 | struct svc_fh ffh; |
| 89 | char * fname; | 89 | char * fname; |
| 90 | int flen; | 90 | unsigned int flen; |
| 91 | char * tname; | 91 | char * tname; |
| 92 | int tlen; | 92 | unsigned int tlen; |
| 93 | struct iattr attrs; | 93 | struct iattr attrs; |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index b0ddfb41c790..27bd3e38ec5a 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h | |||
| @@ -441,7 +441,7 @@ void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); | |||
| 441 | void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); | 441 | void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); |
| 442 | __be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | 442 | __be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, |
| 443 | struct dentry *dentry, __be32 *buffer, int *countp, | 443 | struct dentry *dentry, __be32 *buffer, int *countp, |
| 444 | u32 *bmval, struct svc_rqst *); | 444 | u32 *bmval, struct svc_rqst *, int ignore_crossmnt); |
| 445 | extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, | 445 | extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, |
| 446 | struct nfsd4_compound_state *, | 446 | struct nfsd4_compound_state *, |
| 447 | struct nfsd4_setclientid *setclid); | 447 | struct nfsd4_setclientid *setclid); |
diff --git a/include/linux/nfsd_idmap.h b/include/linux/nfsd_idmap.h index e82746fcad14..d4a2ac18bd4c 100644 --- a/include/linux/nfsd_idmap.h +++ b/include/linux/nfsd_idmap.h | |||
| @@ -44,11 +44,16 @@ | |||
| 44 | #define IDMAP_NAMESZ 128 | 44 | #define IDMAP_NAMESZ 128 |
| 45 | 45 | ||
| 46 | #ifdef CONFIG_NFSD_V4 | 46 | #ifdef CONFIG_NFSD_V4 |
| 47 | void nfsd_idmap_init(void); | 47 | int nfsd_idmap_init(void); |
| 48 | void nfsd_idmap_shutdown(void); | 48 | void nfsd_idmap_shutdown(void); |
| 49 | #else | 49 | #else |
| 50 | static inline void nfsd_idmap_init(void) {}; | 50 | static inline int nfsd_idmap_init(void) |
| 51 | static inline void nfsd_idmap_shutdown(void) {}; | 51 | { |
| 52 | return 0; | ||
| 53 | } | ||
| 54 | static inline void nfsd_idmap_shutdown(void) | ||
| 55 | { | ||
| 56 | } | ||
| 52 | #endif | 57 | #endif |
| 53 | 58 | ||
| 54 | int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); | 59 | int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); |
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index bd7a6b0a87af..03547d6abee5 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
| @@ -169,8 +169,8 @@ extern int cache_check(struct cache_detail *detail, | |||
| 169 | extern void cache_flush(void); | 169 | extern void cache_flush(void); |
| 170 | extern void cache_purge(struct cache_detail *detail); | 170 | extern void cache_purge(struct cache_detail *detail); |
| 171 | #define NEVER (0x7FFFFFFF) | 171 | #define NEVER (0x7FFFFFFF) |
| 172 | extern void cache_register(struct cache_detail *cd); | 172 | extern int cache_register(struct cache_detail *cd); |
| 173 | extern int cache_unregister(struct cache_detail *cd); | 173 | extern void cache_unregister(struct cache_detail *cd); |
| 174 | 174 | ||
| 175 | extern void qword_add(char **bpp, int *lp, char *str); | 175 | extern void qword_add(char **bpp, int *lp, char *str); |
| 176 | extern void qword_addhex(char **bpp, int *lp, char *buf, int blen); | 176 | extern void qword_addhex(char **bpp, int *lp, char *buf, int blen); |
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index 3912cf16361e..10709cbe96fd 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #define RPCDBG_BIND 0x0020 | 20 | #define RPCDBG_BIND 0x0020 |
| 21 | #define RPCDBG_SCHED 0x0040 | 21 | #define RPCDBG_SCHED 0x0040 |
| 22 | #define RPCDBG_TRANS 0x0080 | 22 | #define RPCDBG_TRANS 0x0080 |
| 23 | #define RPCDBG_SVCSOCK 0x0100 | 23 | #define RPCDBG_SVCXPRT 0x0100 |
| 24 | #define RPCDBG_SVCDSP 0x0200 | 24 | #define RPCDBG_SVCDSP 0x0200 |
| 25 | #define RPCDBG_MISC 0x0400 | 25 | #define RPCDBG_MISC 0x0400 |
| 26 | #define RPCDBG_CACHE 0x0800 | 26 | #define RPCDBG_CACHE 0x0800 |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 8531a70da73d..64c771056187 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
| @@ -204,7 +204,7 @@ union svc_addr_u { | |||
| 204 | struct svc_rqst { | 204 | struct svc_rqst { |
| 205 | struct list_head rq_list; /* idle list */ | 205 | struct list_head rq_list; /* idle list */ |
| 206 | struct list_head rq_all; /* all threads list */ | 206 | struct list_head rq_all; /* all threads list */ |
| 207 | struct svc_sock * rq_sock; /* socket */ | 207 | struct svc_xprt * rq_xprt; /* transport ptr */ |
| 208 | struct sockaddr_storage rq_addr; /* peer address */ | 208 | struct sockaddr_storage rq_addr; /* peer address */ |
| 209 | size_t rq_addrlen; | 209 | size_t rq_addrlen; |
| 210 | 210 | ||
| @@ -214,9 +214,10 @@ struct svc_rqst { | |||
| 214 | struct auth_ops * rq_authop; /* authentication flavour */ | 214 | struct auth_ops * rq_authop; /* authentication flavour */ |
| 215 | u32 rq_flavor; /* pseudoflavor */ | 215 | u32 rq_flavor; /* pseudoflavor */ |
| 216 | struct svc_cred rq_cred; /* auth info */ | 216 | struct svc_cred rq_cred; /* auth info */ |
| 217 | struct sk_buff * rq_skbuff; /* fast recv inet buffer */ | 217 | void * rq_xprt_ctxt; /* transport specific context ptr */ |
| 218 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ | 218 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ |
| 219 | 219 | ||
| 220 | size_t rq_xprt_hlen; /* xprt header len */ | ||
| 220 | struct xdr_buf rq_arg; | 221 | struct xdr_buf rq_arg; |
| 221 | struct xdr_buf rq_res; | 222 | struct xdr_buf rq_res; |
| 222 | struct page * rq_pages[RPCSVC_MAXPAGES]; | 223 | struct page * rq_pages[RPCSVC_MAXPAGES]; |
| @@ -317,11 +318,12 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp) | |||
| 317 | 318 | ||
| 318 | struct svc_deferred_req { | 319 | struct svc_deferred_req { |
| 319 | u32 prot; /* protocol (UDP or TCP) */ | 320 | u32 prot; /* protocol (UDP or TCP) */ |
| 320 | struct svc_sock *svsk; | 321 | struct svc_xprt *xprt; |
| 321 | struct sockaddr_storage addr; /* where reply must go */ | 322 | struct sockaddr_storage addr; /* where reply must go */ |
| 322 | size_t addrlen; | 323 | size_t addrlen; |
| 323 | union svc_addr_u daddr; /* where reply must come from */ | 324 | union svc_addr_u daddr; /* where reply must come from */ |
| 324 | struct cache_deferred_req handle; | 325 | struct cache_deferred_req handle; |
| 326 | size_t xprt_hlen; | ||
| 325 | int argslen; | 327 | int argslen; |
| 326 | __be32 args[0]; | 328 | __be32 args[0]; |
| 327 | }; | 329 | }; |
| @@ -382,6 +384,8 @@ struct svc_procedure { | |||
| 382 | */ | 384 | */ |
| 383 | struct svc_serv * svc_create(struct svc_program *, unsigned int, | 385 | struct svc_serv * svc_create(struct svc_program *, unsigned int, |
| 384 | void (*shutdown)(struct svc_serv*)); | 386 | void (*shutdown)(struct svc_serv*)); |
| 387 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, | ||
| 388 | struct svc_pool *pool); | ||
| 385 | int svc_create_thread(svc_thread_fn, struct svc_serv *); | 389 | int svc_create_thread(svc_thread_fn, struct svc_serv *); |
| 386 | void svc_exit_thread(struct svc_rqst *); | 390 | void svc_exit_thread(struct svc_rqst *); |
| 387 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | 391 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, |
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h new file mode 100644 index 000000000000..c11bbcc081f9 --- /dev/null +++ b/include/linux/sunrpc/svc_rdma.h | |||
| @@ -0,0 +1,262 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved. | ||
| 3 | * | ||
| 4 | * This software is available to you under a choice of one of two | ||
| 5 | * licenses. You may choose to be licensed under the terms of the GNU | ||
| 6 | * General Public License (GPL) Version 2, available from the file | ||
| 7 | * COPYING in the main directory of this source tree, or the BSD-type | ||
| 8 | * license below: | ||
| 9 | * | ||
| 10 | * Redistribution and use in source and binary forms, with or without | ||
| 11 | * modification, are permitted provided that the following conditions | ||
| 12 | * are met: | ||
| 13 | * | ||
| 14 | * Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions and the following disclaimer. | ||
| 16 | * | ||
| 17 | * Redistributions in binary form must reproduce the above | ||
| 18 | * copyright notice, this list of conditions and the following | ||
| 19 | * disclaimer in the documentation and/or other materials provided | ||
| 20 | * with the distribution. | ||
| 21 | * | ||
| 22 | * Neither the name of the Network Appliance, Inc. nor the names of | ||
| 23 | * its contributors may be used to endorse or promote products | ||
| 24 | * derived from this software without specific prior written | ||
| 25 | * permission. | ||
| 26 | * | ||
| 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 38 | * | ||
| 39 | * Author: Tom Tucker <tom@opengridcomputing.com> | ||
| 40 | */ | ||
| 41 | |||
| 42 | #ifndef SVC_RDMA_H | ||
| 43 | #define SVC_RDMA_H | ||
| 44 | #include <linux/sunrpc/xdr.h> | ||
| 45 | #include <linux/sunrpc/svcsock.h> | ||
| 46 | #include <linux/sunrpc/rpc_rdma.h> | ||
| 47 | #include <rdma/ib_verbs.h> | ||
| 48 | #include <rdma/rdma_cm.h> | ||
| 49 | #define SVCRDMA_DEBUG | ||
| 50 | |||
| 51 | /* RPC/RDMA parameters and stats */ | ||
| 52 | extern unsigned int svcrdma_ord; | ||
| 53 | extern unsigned int svcrdma_max_requests; | ||
| 54 | extern unsigned int svcrdma_max_req_size; | ||
| 55 | |||
| 56 | extern atomic_t rdma_stat_recv; | ||
| 57 | extern atomic_t rdma_stat_read; | ||
| 58 | extern atomic_t rdma_stat_write; | ||
| 59 | extern atomic_t rdma_stat_sq_starve; | ||
| 60 | extern atomic_t rdma_stat_rq_starve; | ||
| 61 | extern atomic_t rdma_stat_rq_poll; | ||
| 62 | extern atomic_t rdma_stat_rq_prod; | ||
| 63 | extern atomic_t rdma_stat_sq_poll; | ||
| 64 | extern atomic_t rdma_stat_sq_prod; | ||
| 65 | |||
| 66 | #define RPCRDMA_VERSION 1 | ||
| 67 | |||
| 68 | /* | ||
| 69 | * Contexts are built when an RDMA request is created and are a | ||
| 70 | * record of the resources that can be recovered when the request | ||
| 71 | * completes. | ||
| 72 | */ | ||
| 73 | struct svc_rdma_op_ctxt { | ||
| 74 | struct svc_rdma_op_ctxt *next; | ||
| 75 | struct xdr_buf arg; | ||
| 76 | struct list_head dto_q; | ||
| 77 | enum ib_wr_opcode wr_op; | ||
| 78 | enum ib_wc_status wc_status; | ||
| 79 | u32 byte_len; | ||
| 80 | struct svcxprt_rdma *xprt; | ||
| 81 | unsigned long flags; | ||
| 82 | enum dma_data_direction direction; | ||
| 83 | int count; | ||
| 84 | struct ib_sge sge[RPCSVC_MAXPAGES]; | ||
| 85 | struct page *pages[RPCSVC_MAXPAGES]; | ||
| 86 | }; | ||
| 87 | |||
| 88 | #define RDMACTXT_F_READ_DONE 1 | ||
| 89 | #define RDMACTXT_F_LAST_CTXT 2 | ||
| 90 | |||
| 91 | struct svcxprt_rdma { | ||
| 92 | struct svc_xprt sc_xprt; /* SVC transport structure */ | ||
| 93 | struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ | ||
| 94 | struct list_head sc_accept_q; /* Conn. waiting accept */ | ||
| 95 | int sc_ord; /* RDMA read limit */ | ||
| 96 | wait_queue_head_t sc_read_wait; | ||
| 97 | int sc_max_sge; | ||
| 98 | |||
| 99 | int sc_sq_depth; /* Depth of SQ */ | ||
| 100 | atomic_t sc_sq_count; /* Number of SQ WR on queue */ | ||
| 101 | |||
| 102 | int sc_max_requests; /* Depth of RQ */ | ||
| 103 | int sc_max_req_size; /* Size of each RQ WR buf */ | ||
| 104 | |||
| 105 | struct ib_pd *sc_pd; | ||
| 106 | |||
| 107 | struct svc_rdma_op_ctxt *sc_ctxt_head; | ||
| 108 | int sc_ctxt_cnt; | ||
| 109 | int sc_ctxt_bump; | ||
| 110 | int sc_ctxt_max; | ||
| 111 | spinlock_t sc_ctxt_lock; | ||
| 112 | struct list_head sc_rq_dto_q; | ||
| 113 | spinlock_t sc_rq_dto_lock; | ||
| 114 | struct ib_qp *sc_qp; | ||
| 115 | struct ib_cq *sc_rq_cq; | ||
| 116 | struct ib_cq *sc_sq_cq; | ||
| 117 | struct ib_mr *sc_phys_mr; /* MR for server memory */ | ||
| 118 | |||
| 119 | spinlock_t sc_lock; /* transport lock */ | ||
| 120 | |||
| 121 | wait_queue_head_t sc_send_wait; /* SQ exhaustion waitlist */ | ||
| 122 | unsigned long sc_flags; | ||
| 123 | struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */ | ||
| 124 | struct list_head sc_read_complete_q; | ||
| 125 | spinlock_t sc_read_complete_lock; | ||
| 126 | }; | ||
| 127 | /* sc_flags */ | ||
| 128 | #define RDMAXPRT_RQ_PENDING 1 | ||
| 129 | #define RDMAXPRT_SQ_PENDING 2 | ||
| 130 | #define RDMAXPRT_CONN_PENDING 3 | ||
| 131 | |||
| 132 | #define RPCRDMA_LISTEN_BACKLOG 10 | ||
| 133 | /* The default ORD value is based on two outstanding full-size writes with a | ||
| 134 | * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */ | ||
| 135 | #define RPCRDMA_ORD (64/4) | ||
| 136 | #define RPCRDMA_SQ_DEPTH_MULT 8 | ||
| 137 | #define RPCRDMA_MAX_THREADS 16 | ||
| 138 | #define RPCRDMA_MAX_REQUESTS 16 | ||
| 139 | #define RPCRDMA_MAX_REQ_SIZE 4096 | ||
| 140 | |||
| 141 | /* svc_rdma_marshal.c */ | ||
| 142 | extern void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *, | ||
| 143 | int *, int *); | ||
| 144 | extern int svc_rdma_xdr_decode_req(struct rpcrdma_msg **, struct svc_rqst *); | ||
| 145 | extern int svc_rdma_xdr_decode_deferred_req(struct svc_rqst *); | ||
| 146 | extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *, | ||
| 147 | struct rpcrdma_msg *, | ||
| 148 | enum rpcrdma_errcode, u32 *); | ||
| 149 | extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int); | ||
| 150 | extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int); | ||
| 151 | extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int, | ||
| 152 | u32, u64, u32); | ||
| 153 | extern void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *, | ||
| 154 | struct rpcrdma_msg *, | ||
| 155 | struct rpcrdma_msg *, | ||
| 156 | enum rpcrdma_proc); | ||
| 157 | extern int svc_rdma_xdr_get_reply_hdr_len(struct rpcrdma_msg *); | ||
| 158 | |||
| 159 | /* svc_rdma_recvfrom.c */ | ||
| 160 | extern int svc_rdma_recvfrom(struct svc_rqst *); | ||
| 161 | |||
| 162 | /* svc_rdma_sendto.c */ | ||
| 163 | extern int svc_rdma_sendto(struct svc_rqst *); | ||
| 164 | |||
| 165 | /* svc_rdma_transport.c */ | ||
| 166 | extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *); | ||
| 167 | extern int svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *, | ||
| 168 | enum rpcrdma_errcode); | ||
| 169 | struct page *svc_rdma_get_page(void); | ||
| 170 | extern int svc_rdma_post_recv(struct svcxprt_rdma *); | ||
| 171 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); | ||
| 172 | extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); | ||
| 173 | extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); | ||
| 174 | extern void svc_sq_reap(struct svcxprt_rdma *); | ||
| 175 | extern void svc_rq_reap(struct svcxprt_rdma *); | ||
| 176 | extern struct svc_xprt_class svc_rdma_class; | ||
| 177 | extern void svc_rdma_prep_reply_hdr(struct svc_rqst *); | ||
| 178 | |||
| 179 | /* svc_rdma.c */ | ||
| 180 | extern int svc_rdma_init(void); | ||
| 181 | extern void svc_rdma_cleanup(void); | ||
| 182 | |||
| 183 | /* | ||
| 184 | * Returns the address of the first read chunk or <nul> if no read chunk is | ||
| 185 | * present | ||
| 186 | */ | ||
| 187 | static inline struct rpcrdma_read_chunk * | ||
| 188 | svc_rdma_get_read_chunk(struct rpcrdma_msg *rmsgp) | ||
| 189 | { | ||
| 190 | struct rpcrdma_read_chunk *ch = | ||
| 191 | (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; | ||
| 192 | |||
| 193 | if (ch->rc_discrim == 0) | ||
| 194 | return NULL; | ||
| 195 | |||
| 196 | return ch; | ||
| 197 | } | ||
| 198 | |||
| 199 | /* | ||
| 200 | * Returns the address of the first read write array element or <nul> if no | ||
| 201 | * write array list is present | ||
| 202 | */ | ||
| 203 | static inline struct rpcrdma_write_array * | ||
| 204 | svc_rdma_get_write_array(struct rpcrdma_msg *rmsgp) | ||
| 205 | { | ||
| 206 | if (rmsgp->rm_body.rm_chunks[0] != 0 | ||
| 207 | || rmsgp->rm_body.rm_chunks[1] == 0) | ||
| 208 | return NULL; | ||
| 209 | |||
| 210 | return (struct rpcrdma_write_array *)&rmsgp->rm_body.rm_chunks[1]; | ||
| 211 | } | ||
| 212 | |||
| 213 | /* | ||
| 214 | * Returns the address of the first reply array element or <nul> if no | ||
| 215 | * reply array is present | ||
| 216 | */ | ||
| 217 | static inline struct rpcrdma_write_array * | ||
| 218 | svc_rdma_get_reply_array(struct rpcrdma_msg *rmsgp) | ||
| 219 | { | ||
| 220 | struct rpcrdma_read_chunk *rch; | ||
| 221 | struct rpcrdma_write_array *wr_ary; | ||
| 222 | struct rpcrdma_write_array *rp_ary; | ||
| 223 | |||
| 224 | /* XXX: Need to fix when reply list may occur with read-list and/or | ||
| 225 | * write list */ | ||
| 226 | if (rmsgp->rm_body.rm_chunks[0] != 0 || | ||
| 227 | rmsgp->rm_body.rm_chunks[1] != 0) | ||
| 228 | return NULL; | ||
| 229 | |||
| 230 | rch = svc_rdma_get_read_chunk(rmsgp); | ||
| 231 | if (rch) { | ||
| 232 | while (rch->rc_discrim) | ||
| 233 | rch++; | ||
| 234 | |||
| 235 | /* The reply list follows an empty write array located | ||
| 236 | * at 'rc_position' here. The reply array is at rc_target. | ||
| 237 | */ | ||
| 238 | rp_ary = (struct rpcrdma_write_array *)&rch->rc_target; | ||
| 239 | |||
| 240 | goto found_it; | ||
| 241 | } | ||
| 242 | |||
| 243 | wr_ary = svc_rdma_get_write_array(rmsgp); | ||
| 244 | if (wr_ary) { | ||
| 245 | rp_ary = (struct rpcrdma_write_array *) | ||
| 246 | &wr_ary-> | ||
| 247 | wc_array[wr_ary->wc_nchunks].wc_target.rs_length; | ||
| 248 | |||
| 249 | goto found_it; | ||
| 250 | } | ||
| 251 | |||
| 252 | /* No read list, no write list */ | ||
| 253 | rp_ary = (struct rpcrdma_write_array *) | ||
| 254 | &rmsgp->rm_body.rm_chunks[2]; | ||
| 255 | |||
| 256 | found_it: | ||
| 257 | if (rp_ary->wc_discrim == 0) | ||
| 258 | return NULL; | ||
| 259 | |||
| 260 | return rp_ary; | ||
| 261 | } | ||
| 262 | #endif | ||
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h new file mode 100644 index 000000000000..6fd7b016517f --- /dev/null +++ b/include/linux/sunrpc/svc_xprt.h | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/sunrpc/svc_xprt.h | ||
| 3 | * | ||
| 4 | * RPC server transport I/O | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef SUNRPC_SVC_XPRT_H | ||
| 8 | #define SUNRPC_SVC_XPRT_H | ||
| 9 | |||
| 10 | #include <linux/sunrpc/svc.h> | ||
| 11 | #include <linux/module.h> | ||
| 12 | |||
| 13 | struct svc_xprt_ops { | ||
| 14 | struct svc_xprt *(*xpo_create)(struct svc_serv *, | ||
| 15 | struct sockaddr *, int, | ||
| 16 | int); | ||
| 17 | struct svc_xprt *(*xpo_accept)(struct svc_xprt *); | ||
| 18 | int (*xpo_has_wspace)(struct svc_xprt *); | ||
| 19 | int (*xpo_recvfrom)(struct svc_rqst *); | ||
| 20 | void (*xpo_prep_reply_hdr)(struct svc_rqst *); | ||
| 21 | int (*xpo_sendto)(struct svc_rqst *); | ||
| 22 | void (*xpo_release_rqst)(struct svc_rqst *); | ||
| 23 | void (*xpo_detach)(struct svc_xprt *); | ||
| 24 | void (*xpo_free)(struct svc_xprt *); | ||
| 25 | }; | ||
| 26 | |||
| 27 | struct svc_xprt_class { | ||
| 28 | const char *xcl_name; | ||
| 29 | struct module *xcl_owner; | ||
| 30 | struct svc_xprt_ops *xcl_ops; | ||
| 31 | struct list_head xcl_list; | ||
| 32 | u32 xcl_max_payload; | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct svc_xprt { | ||
| 36 | struct svc_xprt_class *xpt_class; | ||
| 37 | struct svc_xprt_ops *xpt_ops; | ||
| 38 | struct kref xpt_ref; | ||
| 39 | struct list_head xpt_list; | ||
| 40 | struct list_head xpt_ready; | ||
| 41 | unsigned long xpt_flags; | ||
| 42 | #define XPT_BUSY 0 /* enqueued/receiving */ | ||
| 43 | #define XPT_CONN 1 /* conn pending */ | ||
| 44 | #define XPT_CLOSE 2 /* dead or dying */ | ||
| 45 | #define XPT_DATA 3 /* data pending */ | ||
| 46 | #define XPT_TEMP 4 /* connected transport */ | ||
| 47 | #define XPT_DEAD 6 /* transport closed */ | ||
| 48 | #define XPT_CHNGBUF 7 /* need to change snd/rcv buf sizes */ | ||
| 49 | #define XPT_DEFERRED 8 /* deferred request pending */ | ||
| 50 | #define XPT_OLD 9 /* used for xprt aging mark+sweep */ | ||
| 51 | #define XPT_DETACHED 10 /* detached from tempsocks list */ | ||
| 52 | #define XPT_LISTENER 11 /* listening endpoint */ | ||
| 53 | #define XPT_CACHE_AUTH 12 /* cache auth info */ | ||
| 54 | |||
| 55 | struct svc_pool *xpt_pool; /* current pool iff queued */ | ||
| 56 | struct svc_serv *xpt_server; /* service for transport */ | ||
| 57 | atomic_t xpt_reserved; /* space on outq that is rsvd */ | ||
| 58 | struct mutex xpt_mutex; /* to serialize sending data */ | ||
| 59 | spinlock_t xpt_lock; /* protects sk_deferred | ||
| 60 | * and xpt_auth_cache */ | ||
| 61 | void *xpt_auth_cache;/* auth cache */ | ||
| 62 | struct list_head xpt_deferred; /* deferred requests that need | ||
| 63 | * to be revisted */ | ||
| 64 | struct sockaddr_storage xpt_local; /* local address */ | ||
| 65 | size_t xpt_locallen; /* length of address */ | ||
| 66 | struct sockaddr_storage xpt_remote; /* remote peer's address */ | ||
| 67 | size_t xpt_remotelen; /* length of address */ | ||
| 68 | }; | ||
| 69 | |||
| 70 | int svc_reg_xprt_class(struct svc_xprt_class *); | ||
| 71 | void svc_unreg_xprt_class(struct svc_xprt_class *); | ||
| 72 | void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, | ||
| 73 | struct svc_serv *); | ||
| 74 | int svc_create_xprt(struct svc_serv *, char *, unsigned short, int); | ||
| 75 | void svc_xprt_enqueue(struct svc_xprt *xprt); | ||
| 76 | void svc_xprt_received(struct svc_xprt *); | ||
| 77 | void svc_xprt_put(struct svc_xprt *xprt); | ||
| 78 | void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt); | ||
| 79 | void svc_close_xprt(struct svc_xprt *xprt); | ||
| 80 | void svc_delete_xprt(struct svc_xprt *xprt); | ||
| 81 | int svc_port_is_privileged(struct sockaddr *sin); | ||
| 82 | int svc_print_xprts(char *buf, int maxlen); | ||
| 83 | struct svc_xprt *svc_find_xprt(struct svc_serv *, char *, int, int); | ||
| 84 | int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen); | ||
| 85 | |||
| 86 | static inline void svc_xprt_get(struct svc_xprt *xprt) | ||
| 87 | { | ||
| 88 | kref_get(&xprt->xpt_ref); | ||
| 89 | } | ||
| 90 | static inline void svc_xprt_set_local(struct svc_xprt *xprt, | ||
| 91 | struct sockaddr *sa, int salen) | ||
| 92 | { | ||
| 93 | memcpy(&xprt->xpt_local, sa, salen); | ||
| 94 | xprt->xpt_locallen = salen; | ||
| 95 | } | ||
| 96 | static inline void svc_xprt_set_remote(struct svc_xprt *xprt, | ||
| 97 | struct sockaddr *sa, int salen) | ||
| 98 | { | ||
| 99 | memcpy(&xprt->xpt_remote, sa, salen); | ||
| 100 | xprt->xpt_remotelen = salen; | ||
| 101 | } | ||
| 102 | static inline unsigned short svc_addr_port(struct sockaddr *sa) | ||
| 103 | { | ||
| 104 | unsigned short ret = 0; | ||
| 105 | switch (sa->sa_family) { | ||
| 106 | case AF_INET: | ||
| 107 | ret = ntohs(((struct sockaddr_in *)sa)->sin_port); | ||
| 108 | break; | ||
| 109 | case AF_INET6: | ||
| 110 | ret = ntohs(((struct sockaddr_in6 *)sa)->sin6_port); | ||
| 111 | break; | ||
| 112 | } | ||
| 113 | return ret; | ||
| 114 | } | ||
| 115 | |||
| 116 | static inline size_t svc_addr_len(struct sockaddr *sa) | ||
| 117 | { | ||
| 118 | switch (sa->sa_family) { | ||
| 119 | case AF_INET: | ||
| 120 | return sizeof(struct sockaddr_in); | ||
| 121 | case AF_INET6: | ||
| 122 | return sizeof(struct sockaddr_in6); | ||
| 123 | } | ||
| 124 | return -EAFNOSUPPORT; | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline unsigned short svc_xprt_local_port(struct svc_xprt *xprt) | ||
| 128 | { | ||
| 129 | return svc_addr_port((struct sockaddr *)&xprt->xpt_local); | ||
| 130 | } | ||
| 131 | |||
| 132 | static inline unsigned short svc_xprt_remote_port(struct svc_xprt *xprt) | ||
| 133 | { | ||
| 134 | return svc_addr_port((struct sockaddr *)&xprt->xpt_remote); | ||
| 135 | } | ||
| 136 | |||
| 137 | static inline char *__svc_print_addr(struct sockaddr *addr, | ||
| 138 | char *buf, size_t len) | ||
| 139 | { | ||
| 140 | switch (addr->sa_family) { | ||
| 141 | case AF_INET: | ||
| 142 | snprintf(buf, len, "%u.%u.%u.%u, port=%u", | ||
| 143 | NIPQUAD(((struct sockaddr_in *) addr)->sin_addr), | ||
| 144 | ntohs(((struct sockaddr_in *) addr)->sin_port)); | ||
| 145 | break; | ||
| 146 | |||
| 147 | case AF_INET6: | ||
| 148 | snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u", | ||
| 149 | NIP6(((struct sockaddr_in6 *) addr)->sin6_addr), | ||
| 150 | ntohs(((struct sockaddr_in6 *) addr)->sin6_port)); | ||
| 151 | break; | ||
| 152 | |||
| 153 | default: | ||
| 154 | snprintf(buf, len, "unknown address type: %d", addr->sa_family); | ||
| 155 | break; | ||
| 156 | } | ||
| 157 | return buf; | ||
| 158 | } | ||
| 159 | #endif /* SUNRPC_SVC_XPRT_H */ | ||
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index a53e0fa855d2..206f092ad4c7 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
| @@ -10,42 +10,16 @@ | |||
| 10 | #define SUNRPC_SVCSOCK_H | 10 | #define SUNRPC_SVCSOCK_H |
| 11 | 11 | ||
| 12 | #include <linux/sunrpc/svc.h> | 12 | #include <linux/sunrpc/svc.h> |
| 13 | #include <linux/sunrpc/svc_xprt.h> | ||
| 13 | 14 | ||
| 14 | /* | 15 | /* |
| 15 | * RPC server socket. | 16 | * RPC server socket. |
| 16 | */ | 17 | */ |
| 17 | struct svc_sock { | 18 | struct svc_sock { |
| 18 | struct list_head sk_ready; /* list of ready sockets */ | 19 | struct svc_xprt sk_xprt; |
| 19 | struct list_head sk_list; /* list of all sockets */ | ||
| 20 | struct socket * sk_sock; /* berkeley socket layer */ | 20 | struct socket * sk_sock; /* berkeley socket layer */ |
| 21 | struct sock * sk_sk; /* INET layer */ | 21 | struct sock * sk_sk; /* INET layer */ |
| 22 | 22 | ||
| 23 | struct svc_pool * sk_pool; /* current pool iff queued */ | ||
| 24 | struct svc_serv * sk_server; /* service for this socket */ | ||
| 25 | atomic_t sk_inuse; /* use count */ | ||
| 26 | unsigned long sk_flags; | ||
| 27 | #define SK_BUSY 0 /* enqueued/receiving */ | ||
| 28 | #define SK_CONN 1 /* conn pending */ | ||
| 29 | #define SK_CLOSE 2 /* dead or dying */ | ||
| 30 | #define SK_DATA 3 /* data pending */ | ||
| 31 | #define SK_TEMP 4 /* temp (TCP) socket */ | ||
| 32 | #define SK_DEAD 6 /* socket closed */ | ||
| 33 | #define SK_CHNGBUF 7 /* need to change snd/rcv buffer sizes */ | ||
| 34 | #define SK_DEFERRED 8 /* request on sk_deferred */ | ||
| 35 | #define SK_OLD 9 /* used for temp socket aging mark+sweep */ | ||
| 36 | #define SK_DETACHED 10 /* detached from tempsocks list */ | ||
| 37 | |||
| 38 | atomic_t sk_reserved; /* space on outq that is reserved */ | ||
| 39 | |||
| 40 | spinlock_t sk_lock; /* protects sk_deferred and | ||
| 41 | * sk_info_authunix */ | ||
| 42 | struct list_head sk_deferred; /* deferred requests that need to | ||
| 43 | * be revisted */ | ||
| 44 | struct mutex sk_mutex; /* to serialize sending data */ | ||
| 45 | |||
| 46 | int (*sk_recvfrom)(struct svc_rqst *rqstp); | ||
| 47 | int (*sk_sendto)(struct svc_rqst *rqstp); | ||
| 48 | |||
| 49 | /* We keep the old state_change and data_ready CB's here */ | 23 | /* We keep the old state_change and data_ready CB's here */ |
| 50 | void (*sk_ostate)(struct sock *); | 24 | void (*sk_ostate)(struct sock *); |
| 51 | void (*sk_odata)(struct sock *, int bytes); | 25 | void (*sk_odata)(struct sock *, int bytes); |
| @@ -54,21 +28,12 @@ struct svc_sock { | |||
| 54 | /* private TCP part */ | 28 | /* private TCP part */ |
| 55 | int sk_reclen; /* length of record */ | 29 | int sk_reclen; /* length of record */ |
| 56 | int sk_tcplen; /* current read length */ | 30 | int sk_tcplen; /* current read length */ |
| 57 | time_t sk_lastrecv; /* time of last received request */ | ||
| 58 | |||
| 59 | /* cache of various info for TCP sockets */ | ||
| 60 | void *sk_info_authunix; | ||
| 61 | |||
| 62 | struct sockaddr_storage sk_local; /* local address */ | ||
| 63 | struct sockaddr_storage sk_remote; /* remote peer's address */ | ||
| 64 | int sk_remotelen; /* length of address */ | ||
| 65 | }; | 31 | }; |
| 66 | 32 | ||
| 67 | /* | 33 | /* |
| 68 | * Function prototypes. | 34 | * Function prototypes. |
| 69 | */ | 35 | */ |
| 70 | int svc_makesock(struct svc_serv *, int, unsigned short, int flags); | 36 | void svc_close_all(struct list_head *); |
| 71 | void svc_force_close_socket(struct svc_sock *); | ||
| 72 | int svc_recv(struct svc_rqst *, long); | 37 | int svc_recv(struct svc_rqst *, long); |
| 73 | int svc_send(struct svc_rqst *); | 38 | int svc_send(struct svc_rqst *); |
| 74 | void svc_drop(struct svc_rqst *); | 39 | void svc_drop(struct svc_rqst *); |
| @@ -78,6 +43,8 @@ int svc_addsock(struct svc_serv *serv, | |||
| 78 | int fd, | 43 | int fd, |
| 79 | char *name_return, | 44 | char *name_return, |
| 80 | int *proto); | 45 | int *proto); |
| 46 | void svc_init_xprt_sock(void); | ||
| 47 | void svc_cleanup_xprt_sock(void); | ||
| 81 | 48 | ||
| 82 | /* | 49 | /* |
| 83 | * svc_makesock socket characteristics | 50 | * svc_makesock socket characteristics |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 0751c9464d0f..e4057d729f03 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
| @@ -112,7 +112,8 @@ struct xdr_buf { | |||
| 112 | __be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len); | 112 | __be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len); |
| 113 | __be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len); | 113 | __be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len); |
| 114 | __be32 *xdr_encode_string(__be32 *p, const char *s); | 114 | __be32 *xdr_encode_string(__be32 *p, const char *s); |
| 115 | __be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen); | 115 | __be32 *xdr_decode_string_inplace(__be32 *p, char **sp, unsigned int *lenp, |
| 116 | unsigned int maxlen); | ||
| 116 | __be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *); | 117 | __be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *); |
| 117 | __be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *); | 118 | __be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *); |
| 118 | 119 | ||
