hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/sunrpc/svc_rdma.h
....@@ -42,15 +42,17 @@
4242
4343 #ifndef SVC_RDMA_H
4444 #define SVC_RDMA_H
45
+#include <linux/llist.h>
4546 #include <linux/sunrpc/xdr.h>
4647 #include <linux/sunrpc/svcsock.h>
4748 #include <linux/sunrpc/rpc_rdma.h>
49
+#include <linux/sunrpc/rpc_rdma_cid.h>
4850 #include <rdma/ib_verbs.h>
4951 #include <rdma/rdma_cm.h>
50
-#define SVCRDMA_DEBUG
5152
5253 /* Default and maximum inline threshold sizes */
5354 enum {
55
+ RPCRDMA_PULLUP_THRESH = RPCRDMA_V1_DEF_INLINE_SIZE >> 1,
5456 RPCRDMA_DEF_INLINE_THRESH = 4096,
5557 RPCRDMA_MAX_INLINE_THRESH = 65536
5658 };
....@@ -107,40 +109,54 @@
107109 struct list_head sc_read_complete_q;
108110 struct work_struct sc_work;
109111
110
- spinlock_t sc_recv_lock;
111
- struct list_head sc_recv_ctxts;
112
+ struct llist_head sc_recv_ctxts;
113
+
114
+ atomic_t sc_completion_ids;
112115 };
113116 /* sc_flags */
114117 #define RDMAXPRT_CONN_PENDING 3
115118
116
-#define RPCRDMA_LISTEN_BACKLOG 10
117
-#define RPCRDMA_MAX_REQUESTS 32
118
-
119
-/* Typical ULP usage of BC requests is NFSv4.1 backchannel. Our
120
- * current NFSv4.1 implementation supports one backchannel slot.
119
+/*
120
+ * Default connection parameters
121121 */
122
-#define RPCRDMA_MAX_BC_REQUESTS 2
122
+enum {
123
+ RPCRDMA_LISTEN_BACKLOG = 10,
124
+ RPCRDMA_MAX_REQUESTS = 64,
125
+ RPCRDMA_MAX_BC_REQUESTS = 2,
126
+};
123127
124128 #define RPCSVC_MAXPAYLOAD_RDMA RPCSVC_MAXPAYLOAD
125129
126130 struct svc_rdma_recv_ctxt {
131
+ struct llist_node rc_node;
127132 struct list_head rc_list;
128133 struct ib_recv_wr rc_recv_wr;
129134 struct ib_cqe rc_cqe;
135
+ struct rpc_rdma_cid rc_cid;
130136 struct ib_sge rc_recv_sge;
131137 void *rc_recv_buf;
132138 struct xdr_buf rc_arg;
139
+ struct xdr_stream rc_stream;
133140 bool rc_temp;
134141 u32 rc_byte_len;
135142 unsigned int rc_page_count;
136143 unsigned int rc_hdr_count;
144
+ u32 rc_inv_rkey;
145
+ __be32 *rc_write_list;
146
+ __be32 *rc_reply_chunk;
147
+ unsigned int rc_read_payload_offset;
148
+ unsigned int rc_read_payload_length;
137149 struct page *rc_pages[RPCSVC_MAXPAGES];
138150 };
139151
140152 struct svc_rdma_send_ctxt {
141153 struct list_head sc_list;
154
+ struct rpc_rdma_cid sc_cid;
155
+
142156 struct ib_send_wr sc_send_wr;
143157 struct ib_cqe sc_cqe;
158
+ struct xdr_buf sc_hdrbuf;
159
+ struct xdr_stream sc_stream;
144160 void *sc_xprt_buf;
145161 int sc_page_count;
146162 int sc_cur_sge_no;
....@@ -149,9 +165,8 @@
149165 };
150166
151167 /* svc_rdma_backchannel.c */
152
-extern int svc_rdma_handle_bc_reply(struct rpc_xprt *xprt,
153
- __be32 *rdma_resp,
154
- struct xdr_buf *rcvbuf);
168
+extern void svc_rdma_handle_bc_reply(struct svc_rqst *rqstp,
169
+ struct svc_rdma_recv_ctxt *rctxt);
155170
156171 /* svc_rdma_recvfrom.c */
157172 extern void svc_rdma_recv_ctxts_destroy(struct svcxprt_rdma *rdma);
....@@ -168,9 +183,11 @@
168183 struct svc_rqst *rqstp,
169184 struct svc_rdma_recv_ctxt *head, __be32 *p);
170185 extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma,
171
- __be32 *wr_ch, struct xdr_buf *xdr);
186
+ __be32 *wr_ch, struct xdr_buf *xdr,
187
+ unsigned int offset,
188
+ unsigned long length);
172189 extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
173
- __be32 *rp_ch, bool writelist,
190
+ const struct svc_rdma_recv_ctxt *rctxt,
174191 struct xdr_buf *xdr);
175192
176193 /* svc_rdma_sendto.c */
....@@ -179,28 +196,27 @@
179196 svc_rdma_send_ctxt_get(struct svcxprt_rdma *rdma);
180197 extern void svc_rdma_send_ctxt_put(struct svcxprt_rdma *rdma,
181198 struct svc_rdma_send_ctxt *ctxt);
182
-extern int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr);
183
-extern void svc_rdma_sync_reply_hdr(struct svcxprt_rdma *rdma,
184
- struct svc_rdma_send_ctxt *ctxt,
185
- unsigned int len);
199
+extern int svc_rdma_send(struct svcxprt_rdma *rdma,
200
+ struct svc_rdma_send_ctxt *ctxt);
186201 extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,
187
- struct svc_rdma_send_ctxt *ctxt,
188
- struct xdr_buf *xdr, __be32 *wr_lst);
202
+ struct svc_rdma_send_ctxt *sctxt,
203
+ const struct svc_rdma_recv_ctxt *rctxt,
204
+ struct xdr_buf *xdr);
205
+extern void svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
206
+ struct svc_rdma_send_ctxt *sctxt,
207
+ struct svc_rdma_recv_ctxt *rctxt,
208
+ int status);
189209 extern int svc_rdma_sendto(struct svc_rqst *);
210
+extern int svc_rdma_read_payload(struct svc_rqst *rqstp, unsigned int offset,
211
+ unsigned int length);
190212
191213 /* svc_rdma_transport.c */
192
-extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
193
-extern void svc_sq_reap(struct svcxprt_rdma *);
194
-extern void svc_rq_reap(struct svcxprt_rdma *);
195
-extern void svc_rdma_prep_reply_hdr(struct svc_rqst *);
196
-
197214 extern struct svc_xprt_class svc_rdma_class;
198215 #ifdef CONFIG_SUNRPC_BACKCHANNEL
199216 extern struct svc_xprt_class svc_rdma_bc_class;
200217 #endif
201218
202219 /* svc_rdma.c */
203
-extern struct workqueue_struct *svc_rdma_wq;
204220 extern int svc_rdma_init(void);
205221 extern void svc_rdma_cleanup(void);
206222