NFSoRDMA client updates for 5.1 New features: - Convert rpc auth layer to use xdr_streams - Config option to disable insecure enctypes - Reduce size of RPC receive buffers Bugfixes and cleanups: - Fix sparse warnings - Check inline size before providing a write chunk - Reduce the receive doorbell rate - Various tracepoint improvements [Trond: Fix up merge conflicts] Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Showing the changes to include/linux (5 of 47 files). Show all
Unified · Split
| @@ -74,14 +74,12 @@ struct rpc_cred_cache; · 73 unmodified lines | |||
| 74 | struct rpc_authops; | 74 | struct rpc_authops; |
| 75 | struct rpc_auth { | 75 | struct rpc_auth { |
| 76 | unsigned int au_cslack; /* call cred size estimate */ | 76 | unsigned int au_cslack; /* call cred size estimate */ |
| 77 | /* guess at number of u32's auth adds before | 77 | unsigned int au_rslack; /* reply cred size estimate */ |
| 78 | * reply data; normally the verifier size: */ | 78 | unsigned int au_verfsize; /* size of reply verifier */ |
| 79 | unsigned int au_rslack; | 79 | unsigned int au_ralign; /* words before UL header */ |
| 80 | /* for gss, used to calculate au_rslack: */ | 80 | |
| 81 | unsigned int au_verfsize; | 81 | unsigned int au_flags; |
| 82 | 82 | const struct rpc_authops *au_ops; | |
| 83 | unsigned int au_flags; /* various flags */ | ||
| 84 | const struct rpc_authops *au_ops; /* operations */ | ||
| 85 | rpc_authflavor_t au_flavor; /* pseudoflavor (note may | 83 | rpc_authflavor_t au_flavor; /* pseudoflavor (note may |
| 86 | * differ from the flavor in | 84 | * differ from the flavor in |
| 87 | * au_ops->au_flavor in gss | 85 | * au_ops->au_flavor in gss |
| @@ -131,13 +129,15 @@ struct rpc_credops { · 43 unmodified lines | |||
| 131 | void (*crdestroy)(struct rpc_cred *); | 129 | void (*crdestroy)(struct rpc_cred *); |
| 132 | 130 | ||
| 133 | int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); | 131 | int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); |
| 134 | __be32 * (*crmarshal)(struct rpc_task *, __be32 *); | 132 | int (*crmarshal)(struct rpc_task *task, |
| 133 | struct xdr_stream *xdr); | ||
| 135 | int (*crrefresh)(struct rpc_task *); | 134 | int (*crrefresh)(struct rpc_task *); |
| 136 | __be32 * (*crvalidate)(struct rpc_task *, __be32 *); | 135 | int (*crvalidate)(struct rpc_task *task, |
| 137 | int (*crwrap_req)(struct rpc_task *, kxdreproc_t, | 136 | struct xdr_stream *xdr); |
| 138 | void *, __be32 *, void *); | 137 | int (*crwrap_req)(struct rpc_task *task, |
| 139 | int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t, | 138 | struct xdr_stream *xdr); |
| 140 | void *, __be32 *, void *); | 139 | int (*crunwrap_resp)(struct rpc_task *task, |
| 140 | struct xdr_stream *xdr); | ||
| 141 | int (*crkey_timeout)(struct rpc_cred *); | 141 | int (*crkey_timeout)(struct rpc_cred *); |
| 142 | char * (*crstringify_acceptor)(struct rpc_cred *); | 142 | char * (*crstringify_acceptor)(struct rpc_cred *); |
| 143 | bool (*crneed_reencode)(struct rpc_task *); | 143 | bool (*crneed_reencode)(struct rpc_task *); |
| @@ -165,10 +165,18 @@ struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred * · 21 unmodified lines | |||
| 165 | void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); | 165 | void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); |
| 166 | struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); | 166 | struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); |
| 167 | void put_rpccred(struct rpc_cred *); | 167 | void put_rpccred(struct rpc_cred *); |
| 168 | __be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); | 168 | int rpcauth_marshcred(struct rpc_task *task, |
| 169 | __be32 * rpcauth_checkverf(struct rpc_task *, __be32 *); | 169 | struct xdr_stream *xdr); |
| 170 | int rpcauth_wrap_req(struct rpc_task *task, kxdreproc_t encode, void *rqstp, __be32 *data, void *obj); | 170 | int rpcauth_checkverf(struct rpc_task *task, |
| 171 | int rpcauth_unwrap_resp(struct rpc_task *task, kxdrdproc_t decode, void *rqstp, __be32 *data, void *obj); | 171 | struct xdr_stream *xdr); |
| 172 | int rpcauth_wrap_req_encode(struct rpc_task *task, | ||
| 173 | struct xdr_stream *xdr); | ||
| 174 | int rpcauth_wrap_req(struct rpc_task *task, | ||
| 175 | struct xdr_stream *xdr); | ||
| 176 | int rpcauth_unwrap_resp_decode(struct rpc_task *task, | ||
| 177 | struct xdr_stream *xdr); | ||
| 178 | int rpcauth_unwrap_resp(struct rpc_task *task, | ||
| 179 | struct xdr_stream *xdr); | ||
| 172 | bool rpcauth_xmit_need_reencode(struct rpc_task *task); | 180 | bool rpcauth_xmit_need_reencode(struct rpc_task *task); |
| 173 | int rpcauth_refreshcred(struct rpc_task *); | 181 | int rpcauth_refreshcred(struct rpc_task *); |
| 174 | void rpcauth_invalcred(struct rpc_task *); | 182 | void rpcauth_invalcred(struct rpc_task *); |
| @@ -169,6 +169,9 @@ int rpcb_v4_register(struct net *net, const u32 program, · 168 unmodified lines | |||
| 169 | const char *netid); | 169 | const char *netid); |
| 170 | void rpcb_getport_async(struct rpc_task *); | 170 | void rpcb_getport_async(struct rpc_task *); |
| 171 | 171 | ||
| 172 | void rpc_prepare_reply_pages(struct rpc_rqst *req, struct page **pages, | ||
| 173 | unsigned int base, unsigned int len, | ||
| 174 | unsigned int hdrsize); | ||
| 172 | void rpc_call_start(struct rpc_task *); | 175 | void rpc_call_start(struct rpc_task *); |
| 173 | int rpc_call_async(struct rpc_clnt *clnt, | 176 | int rpc_call_async(struct rpc_clnt *clnt, |
| 174 | const struct rpc_message *msg, int flags, | 177 | const struct rpc_message *msg, int flags, |
| @@ -1,4 +1,44 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 1 | /* | 2 | /* |
| 2 | * Dumb way to share this static piece of information with nfsd | 3 | * Define the string that exports the set of kernel-supported |
| 4 | * Kerberos enctypes. This list is sent via upcall to gssd, and | ||
| 5 | * is also exposed via the nfsd /proc API. The consumers generally | ||
| 6 | * treat this as an ordered list, where the first item in the list | ||
| 7 | * is the most preferred. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef _LINUX_SUNRPC_GSS_KRB5_ENCTYPES_H | ||
| 11 | #define _LINUX_SUNRPC_GSS_KRB5_ENCTYPES_H | ||
| 12 | |||
| 13 | #ifdef CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES | ||
| 14 | |||
| 15 | /* | ||
| 16 | * NB: This list includes encryption types that were deprecated | ||
| 17 | * by RFC 8429 (DES3_CBC_SHA1 and ARCFOUR_HMAC). | ||
| 18 | * | ||
| 19 | * ENCTYPE_AES256_CTS_HMAC_SHA1_96 | ||
| 20 | * ENCTYPE_AES128_CTS_HMAC_SHA1_96 | ||
| 21 | * ENCTYPE_DES3_CBC_SHA1 | ||
| 22 | * ENCTYPE_ARCFOUR_HMAC | ||
| 23 | */ | ||
| 24 | #define KRB5_SUPPORTED_ENCTYPES "18,17,16,23" | ||
| 25 | |||
| 26 | #else /* CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES */ | ||
| 27 | |||
| 28 | /* | ||
| 29 | * NB: This list includes encryption types that were deprecated | ||
| 30 | * by RFC 8429 and RFC 6649. | ||
| 31 | * | ||
| 32 | * ENCTYPE_AES256_CTS_HMAC_SHA1_96 | ||
| 33 | * ENCTYPE_AES128_CTS_HMAC_SHA1_96 | ||
| 34 | * ENCTYPE_DES3_CBC_SHA1 | ||
| 35 | * ENCTYPE_ARCFOUR_HMAC | ||
| 36 | * ENCTYPE_DES_CBC_MD5 | ||
| 37 | * ENCTYPE_DES_CBC_CRC | ||
| 38 | * ENCTYPE_DES_CBC_MD4 | ||
| 3 | */ | 39 | */ |
| 4 | #define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2" | 40 | #define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2" |
| 41 | |||
| 42 | #endif /* CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES */ | ||
| 43 | |||
| 44 | #endif /* _LINUX_SUNRPC_GSS_KRB5_ENCTYPES_H */ | ||
| @@ -87,6 +87,16 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) · 86 unmodified lines | |||
| 87 | #define xdr_one cpu_to_be32(1) | 87 | #define xdr_one cpu_to_be32(1) |
| 88 | #define xdr_two cpu_to_be32(2) | 88 | #define xdr_two cpu_to_be32(2) |
| 89 | 89 | ||
| 90 | #define rpc_auth_null cpu_to_be32(RPC_AUTH_NULL) | ||
| 91 | #define rpc_auth_unix cpu_to_be32(RPC_AUTH_UNIX) | ||
| 92 | #define rpc_auth_short cpu_to_be32(RPC_AUTH_SHORT) | ||
| 93 | #define rpc_auth_gss cpu_to_be32(RPC_AUTH_GSS) | ||
| 94 | |||
| 95 | #define rpc_call cpu_to_be32(RPC_CALL) | ||
| 96 | #define rpc_reply cpu_to_be32(RPC_REPLY) | ||
| 97 | |||
| 98 | #define rpc_msg_accepted cpu_to_be32(RPC_MSG_ACCEPTED) | ||
| 99 | |||
| 90 | #define rpc_success cpu_to_be32(RPC_SUCCESS) | 100 | #define rpc_success cpu_to_be32(RPC_SUCCESS) |
| 91 | #define rpc_prog_unavail cpu_to_be32(RPC_PROG_UNAVAIL) | 101 | #define rpc_prog_unavail cpu_to_be32(RPC_PROG_UNAVAIL) |
| 92 | #define rpc_prog_mismatch cpu_to_be32(RPC_PROG_MISMATCH) | 102 | #define rpc_prog_mismatch cpu_to_be32(RPC_PROG_MISMATCH) |
| @@ -95,6 +105,9 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) · 2 unmodified lines | |||
| 95 | #define rpc_system_err cpu_to_be32(RPC_SYSTEM_ERR) | 105 | #define rpc_system_err cpu_to_be32(RPC_SYSTEM_ERR) |
| 96 | #define rpc_drop_reply cpu_to_be32(RPC_DROP_REPLY) | 106 | #define rpc_drop_reply cpu_to_be32(RPC_DROP_REPLY) |
| 97 | 107 | ||
| 108 | #define rpc_mismatch cpu_to_be32(RPC_MISMATCH) | ||
| 109 | #define rpc_auth_error cpu_to_be32(RPC_AUTH_ERROR) | ||
| 110 | |||
| 98 | #define rpc_auth_ok cpu_to_be32(RPC_AUTH_OK) | 111 | #define rpc_auth_ok cpu_to_be32(RPC_AUTH_OK) |
| 99 | #define rpc_autherr_badcred cpu_to_be32(RPC_AUTH_BADCRED) | 112 | #define rpc_autherr_badcred cpu_to_be32(RPC_AUTH_BADCRED) |
| 100 | #define rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED) | 113 | #define rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED) |
| @@ -103,7 +116,6 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) · 2 unmodified lines | |||
| 103 | #define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK) | 116 | #define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK) |
| 104 | #define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM) | 117 | #define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM) |
| 105 | #define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM) | 118 | #define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM) |
| 106 | #define rpc_autherr_oldseqnum cpu_to_be32(101) | ||
| 107 | 119 | ||
| 108 | /* | 120 | /* |
| 109 | * Miscellaneous XDR helper functions | 121 | * Miscellaneous XDR helper functions |
| @@ -167,7 +179,6 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p) · 57 unmodified lines | |||
| 167 | extern void xdr_shift_buf(struct xdr_buf *, size_t); | 179 | extern void xdr_shift_buf(struct xdr_buf *, size_t); |
| 168 | extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); | 180 | extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); |
| 169 | extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int); | 181 | extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int); |
| 170 | extern void xdr_buf_trim(struct xdr_buf *, unsigned int); | ||
| 171 | extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, unsigned int); | 182 | extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, unsigned int); |
| 172 | extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); | 183 | extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); |
| 173 | extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); | 184 | extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); |
| @@ -217,6 +228,8 @@ struct xdr_stream { · 43 unmodified lines | |||
| 217 | struct kvec scratch; /* Scratch buffer */ | 228 | struct kvec scratch; /* Scratch buffer */ |
| 218 | struct page **page_ptr; /* pointer to the current page */ | 229 | struct page **page_ptr; /* pointer to the current page */ |
| 219 | unsigned int nwords; /* Remaining decode buffer length */ | 230 | unsigned int nwords; /* Remaining decode buffer length */ |
| 231 | |||
| 232 | struct rpc_rqst *rqst; /* For debugging */ | ||
| 220 | }; | 233 | }; |
| 221 | 234 | ||
| 222 | /* | 235 | /* |
| @@ -227,7 +240,8 @@ typedef void (*kxdreproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr, · 4 unmodified lines | |||
| 227 | typedef int (*kxdrdproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | 240 | typedef int (*kxdrdproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr, |
| 228 | void *obj); | 241 | void *obj); |
| 229 | 242 | ||
| 230 | extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); | 243 | extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, |
| 244 | __be32 *p, struct rpc_rqst *rqst); | ||
| 231 | extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); | 245 | extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); |
| 232 | extern void xdr_commit_encode(struct xdr_stream *xdr); | 246 | extern void xdr_commit_encode(struct xdr_stream *xdr); |
| 233 | extern void xdr_truncate_encode(struct xdr_stream *xdr, size_t len); | 247 | extern void xdr_truncate_encode(struct xdr_stream *xdr, size_t len); |
| @@ -235,7 +249,8 @@ extern int xdr_restrict_buflen(struct xdr_stream *xdr, int newbuflen); · 1 unmodified line | |||
| 235 | extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, | 249 | extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, |
| 236 | unsigned int base, unsigned int len); | 250 | unsigned int base, unsigned int len); |
| 237 | extern unsigned int xdr_stream_pos(const struct xdr_stream *xdr); | 251 | extern unsigned int xdr_stream_pos(const struct xdr_stream *xdr); |
| 238 | extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); | 252 | extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, |
| 253 | __be32 *p, struct rpc_rqst *rqst); | ||
| 239 | extern void xdr_init_decode_pages(struct xdr_stream *xdr, struct xdr_buf *buf, | 254 | extern void xdr_init_decode_pages(struct xdr_stream *xdr, struct xdr_buf *buf, |
| 240 | struct page **pages, unsigned int len); | 255 | struct page **pages, unsigned int len); |
| 241 | extern void xdr_set_scratch_buffer(struct xdr_stream *xdr, void *buf, size_t buflen); | 256 | extern void xdr_set_scratch_buffer(struct xdr_stream *xdr, void *buf, size_t buflen); |
| @@ -196,8 +196,6 @@ struct rpc_xprt { · 195 unmodified lines | |||
| 196 | 196 | ||
| 197 | size_t max_payload; /* largest RPC payload size, | 197 | size_t max_payload; /* largest RPC payload size, |
| 198 | in bytes */ | 198 | in bytes */ |
| 199 | unsigned int tsh_size; /* size of transport specific | ||
| 200 | header */ | ||
| 201 | 199 | ||
| 202 | struct rpc_wait_queue binding; /* requests waiting on rpcbind */ | 200 | struct rpc_wait_queue binding; /* requests waiting on rpcbind */ |
| 203 | struct rpc_wait_queue sending; /* requests waiting to send */ | 201 | struct rpc_wait_queue sending; /* requests waiting to send */ |
| @@ -362,11 +360,6 @@ struct rpc_xprt * xprt_alloc(struct net *net, size_t size, · 158 unmodified lines | |||
| 362 | unsigned int max_req); | 360 | unsigned int max_req); |
| 363 | void xprt_free(struct rpc_xprt *); | 361 | void xprt_free(struct rpc_xprt *); |
| 364 | 362 | ||
| 365 | static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) | ||
| 366 | { | ||
| 367 | return p + xprt->tsh_size; | ||
| 368 | } | ||
| 369 | |||
| 370 | static inline int | 363 | static inline int |
| 371 | xprt_enable_swap(struct rpc_xprt *xprt) | 364 | xprt_enable_swap(struct rpc_xprt *xprt) |
| 372 | { | 365 | { |