~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/sunrpc/xprtrdma/xprt_rdma.h

Version: ~ [ linux-5.12-rc1 ] ~ [ linux-5.11.2 ] ~ [ linux-5.10.19 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.101 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.177 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.222 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.258 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.258 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2 /*
  3  * Copyright (c) 2014-2017 Oracle.  All rights reserved.
  4  * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.
  5  *
  6  * This software is available to you under a choice of one of two
  7  * licenses.  You may choose to be licensed under the terms of the GNU
  8  * General Public License (GPL) Version 2, available from the file
  9  * COPYING in the main directory of this source tree, or the BSD-type
 10  * license below:
 11  *
 12  * Redistribution and use in source and binary forms, with or without
 13  * modification, are permitted provided that the following conditions
 14  * are met:
 15  *
 16  *      Redistributions of source code must retain the above copyright
 17  *      notice, this list of conditions and the following disclaimer.
 18  *
 19  *      Redistributions in binary form must reproduce the above
 20  *      copyright notice, this list of conditions and the following
 21  *      disclaimer in the documentation and/or other materials provided
 22  *      with the distribution.
 23  *
 24  *      Neither the name of the Network Appliance, Inc. nor the names of
 25  *      its contributors may be used to endorse or promote products
 26  *      derived from this software without specific prior written
 27  *      permission.
 28  *
 29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 40  */
 41 
 42 #ifndef _LINUX_SUNRPC_XPRT_RDMA_H
 43 #define _LINUX_SUNRPC_XPRT_RDMA_H
 44 
 45 #include <linux/wait.h>                 /* wait_queue_head_t, etc */
 46 #include <linux/spinlock.h>             /* spinlock_t, etc */
 47 #include <linux/atomic.h>               /* atomic_t, etc */
 48 #include <linux/kref.h>                 /* struct kref */
 49 #include <linux/workqueue.h>            /* struct work_struct */
 50 #include <linux/llist.h>
 51 
 52 #include <rdma/rdma_cm.h>               /* RDMA connection api */
 53 #include <rdma/ib_verbs.h>              /* RDMA verbs api */
 54 
 55 #include <linux/sunrpc/clnt.h>          /* rpc_xprt */
 56 #include <linux/sunrpc/rpc_rdma.h>      /* RPC/RDMA protocol */
 57 #include <linux/sunrpc/xprtrdma.h>      /* xprt parameters */
 58 
 59 #define RDMA_RESOLVE_TIMEOUT    (5000)  /* 5 seconds */
 60 #define RDMA_CONNECT_RETRY_MAX  (2)     /* retries if no listener backlog */
 61 
 62 #define RPCRDMA_BIND_TO         (60U * HZ)
 63 #define RPCRDMA_INIT_REEST_TO   (5U * HZ)
 64 #define RPCRDMA_MAX_REEST_TO    (30U * HZ)
 65 #define RPCRDMA_IDLE_DISC_TO    (5U * 60 * HZ)
 66 
 67 /*
 68  * RDMA Endpoint -- connection endpoint details
 69  */
 70 struct rpcrdma_ep {
 71         struct kref             re_kref;
 72         struct rdma_cm_id       *re_id;
 73         struct ib_pd            *re_pd;
 74         unsigned int            re_max_rdma_segs;
 75         unsigned int            re_max_fr_depth;
 76         bool                    re_implicit_roundup;
 77         enum ib_mr_type         re_mrtype;
 78         struct completion       re_done;
 79         unsigned int            re_send_count;
 80         unsigned int            re_send_batch;
 81         unsigned int            re_max_inline_send;
 82         unsigned int            re_max_inline_recv;
 83         int                     re_async_rc;
 84         int                     re_connect_status;
 85         struct ib_qp_init_attr  re_attr;
 86         wait_queue_head_t       re_connect_wait;
 87         struct rpc_xprt         *re_xprt;
 88         struct rpcrdma_connect_private
 89                                 re_cm_private;
 90         struct rdma_conn_param  re_remote_cma;
 91         int                     re_receive_count;
 92         unsigned int            re_max_requests; /* depends on device */
 93         unsigned int            re_inline_send; /* negotiated */
 94         unsigned int            re_inline_recv; /* negotiated */
 95 };
 96 
 97 /* Pre-allocate extra Work Requests for handling backward receives
 98  * and sends. This is a fixed value because the Work Queues are
 99  * allocated when the forward channel is set up, long before the
100  * backchannel is provisioned. This value is two times
101  * NFS4_DEF_CB_SLOT_TABLE_SIZE.
102  */
103 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
104 #define RPCRDMA_BACKWARD_WRS (32)
105 #else
106 #define RPCRDMA_BACKWARD_WRS (0)
107 #endif
108 
109 /* Registered buffer -- registered kmalloc'd memory for RDMA SEND/RECV
110  */
111 
112 struct rpcrdma_regbuf {
113         struct ib_sge           rg_iov;
114         struct ib_device        *rg_device;
115         enum dma_data_direction rg_direction;
116         void                    *rg_data;
117 };
118 
119 static inline u64 rdmab_addr(struct rpcrdma_regbuf *rb)
120 {
121         return rb->rg_iov.addr;
122 }
123 
124 static inline u32 rdmab_length(struct rpcrdma_regbuf *rb)
125 {
126         return rb->rg_iov.length;
127 }
128 
129 static inline u32 rdmab_lkey(struct rpcrdma_regbuf *rb)
130 {
131         return rb->rg_iov.lkey;
132 }
133 
134 static inline struct ib_device *rdmab_device(struct rpcrdma_regbuf *rb)
135 {
136         return rb->rg_device;
137 }
138 
139 static inline void *rdmab_data(const struct rpcrdma_regbuf *rb)
140 {
141         return rb->rg_data;
142 }
143 
144 #define RPCRDMA_DEF_GFP         (GFP_NOIO | __GFP_NOWARN)
145 
146 /* To ensure a transport can always make forward progress,
147  * the number of RDMA segments allowed in header chunk lists
148  * is capped at 16. This prevents less-capable devices from
149  * overrunning the Send buffer while building chunk lists.
150  *
151  * Elements of the Read list take up more room than the
152  * Write list or Reply chunk. 16 read segments means the
153  * chunk lists cannot consume more than
154  *
155  * ((16 + 2) * read segment size) + 1 XDR words,
156  *
157  * or about 400 bytes. The fixed part of the header is
158  * another 24 bytes. Thus when the inline threshold is
159  * 1024 bytes, at least 600 bytes are available for RPC
160  * message bodies.
161  */
162 enum {
163         RPCRDMA_MAX_HDR_SEGS = 16,
164 };
165 
166 /*
167  * struct rpcrdma_rep -- this structure encapsulates state required
168  * to receive and complete an RPC Reply, asychronously. It needs
169  * several pieces of state:
170  *
171  *   o receive buffer and ib_sge (donated to provider)
172  *   o status of receive (success or not, length, inv rkey)
173  *   o bookkeeping state to get run by reply handler (XDR stream)
174  *
175  * These structures are allocated during transport initialization.
176  * N of these are associated with a transport instance, managed by
177  * struct rpcrdma_buffer. N is the max number of outstanding RPCs.
178  */
179 
180 struct rpcrdma_rep {
181         struct ib_cqe           rr_cqe;
182         __be32                  rr_xid;
183         __be32                  rr_vers;
184         __be32                  rr_proc;
185         int                     rr_wc_flags;
186         u32                     rr_inv_rkey;
187         bool                    rr_temp;
188         struct rpcrdma_regbuf   *rr_rdmabuf;
189         struct rpcrdma_xprt     *rr_rxprt;
190         struct rpc_rqst         *rr_rqst;
191         struct xdr_buf          rr_hdrbuf;
192         struct xdr_stream       rr_stream;
193         struct llist_node       rr_node;
194         struct ib_recv_wr       rr_recv_wr;
195         struct list_head        rr_all;
196 };
197 
198 /* To reduce the rate at which a transport invokes ib_post_recv
199  * (and thus the hardware doorbell rate), xprtrdma posts Receive
200  * WRs in batches.
201  *
202  * Setting this to zero disables Receive post batching.
203  */
204 enum {
205         RPCRDMA_MAX_RECV_BATCH = 7,
206 };
207 
208 /* struct rpcrdma_sendctx - DMA mapped SGEs to unmap after Send completes
209  */
210 struct rpcrdma_req;
211 struct rpcrdma_sendctx {
212         struct ib_cqe           sc_cqe;
213         struct rpcrdma_req      *sc_req;
214         unsigned int            sc_unmap_count;
215         struct ib_sge           sc_sges[];
216 };
217 
218 /*
219  * struct rpcrdma_mr - external memory region metadata
220  *
221  * An external memory region is any buffer or page that is registered
222  * on the fly (ie, not pre-registered).
223  */
224 struct rpcrdma_frwr {
225         struct ib_mr                    *fr_mr;
226         struct ib_cqe                   fr_cqe;
227         struct completion               fr_linv_done;
228         union {
229                 struct ib_reg_wr        fr_regwr;
230                 struct ib_send_wr       fr_invwr;
231         };
232 };
233 
234 struct rpcrdma_req;
235 struct rpcrdma_mr {
236         struct list_head        mr_list;
237         struct rpcrdma_req      *mr_req;
238         struct scatterlist      *mr_sg;
239         int                     mr_nents;
240         enum dma_data_direction mr_dir;
241         struct rpcrdma_frwr     frwr;
242         struct rpcrdma_xprt     *mr_xprt;
243         u32                     mr_handle;
244         u32                     mr_length;
245         u64                     mr_offset;
246         struct list_head        mr_all;
247 };
248 
249 /*
250  * struct rpcrdma_req -- structure central to the request/reply sequence.
251  *
252  * N of these are associated with a transport instance, and stored in
253  * struct rpcrdma_buffer. N is the max number of outstanding requests.
254  *
255  * It includes pre-registered buffer memory for send AND recv.
256  * The recv buffer, however, is not owned by this structure, and
257  * is "donated" to the hardware when a recv is posted. When a
258  * reply is handled, the recv buffer used is given back to the
259  * struct rpcrdma_req associated with the request.
260  *
261  * In addition to the basic memory, this structure includes an array
262  * of iovs for send operations. The reason is that the iovs passed to
263  * ib_post_{send,recv} must not be modified until the work request
264  * completes.
265  */
266 
267 /* Maximum number of page-sized "segments" per chunk list to be
268  * registered or invalidated. Must handle a Reply chunk:
269  */
270 enum {
271         RPCRDMA_MAX_IOV_SEGS    = 3,
272         RPCRDMA_MAX_DATA_SEGS   = ((1 * 1024 * 1024) / PAGE_SIZE) + 1,
273         RPCRDMA_MAX_SEGS        = RPCRDMA_MAX_DATA_SEGS +
274                                   RPCRDMA_MAX_IOV_SEGS,
275 };
276 
277 struct rpcrdma_mr_seg {         /* chunk descriptors */
278         u32             mr_len;         /* length of chunk or segment */
279         struct page     *mr_page;       /* owning page, if any */
280         char            *mr_offset;     /* kva if no page, else offset */
281 };
282 
283 /* The Send SGE array is provisioned to send a maximum size
284  * inline request:
285  * - RPC-over-RDMA header
286  * - xdr_buf head iovec
287  * - RPCRDMA_MAX_INLINE bytes, in pages
288  * - xdr_buf tail iovec
289  *
290  * The actual number of array elements consumed by each RPC
291  * depends on the device's max_sge limit.
292  */
293 enum {
294         RPCRDMA_MIN_SEND_SGES = 3,
295         RPCRDMA_MAX_PAGE_SGES = RPCRDMA_MAX_INLINE >> PAGE_SHIFT,
296         RPCRDMA_MAX_SEND_SGES = 1 + 1 + RPCRDMA_MAX_PAGE_SGES + 1,
297 };
298 
299 struct rpcrdma_buffer;
300 struct rpcrdma_req {
301         struct list_head        rl_list;
302         struct rpc_rqst         rl_slot;
303         struct rpcrdma_rep      *rl_reply;
304         struct xdr_stream       rl_stream;
305         struct xdr_buf          rl_hdrbuf;
306         struct ib_send_wr       rl_wr;
307         struct rpcrdma_sendctx  *rl_sendctx;
308         struct rpcrdma_regbuf   *rl_rdmabuf;    /* xprt header */
309         struct rpcrdma_regbuf   *rl_sendbuf;    /* rq_snd_buf */
310         struct rpcrdma_regbuf   *rl_recvbuf;    /* rq_rcv_buf */
311 
312         struct list_head        rl_all;
313         struct kref             rl_kref;
314 
315         struct list_head        rl_free_mrs;
316         struct list_head        rl_registered;
317         struct rpcrdma_mr_seg   rl_segments[RPCRDMA_MAX_SEGS];
318 };
319 
320 static inline struct rpcrdma_req *
321 rpcr_to_rdmar(const struct rpc_rqst *rqst)
322 {
323         return container_of(rqst, struct rpcrdma_req, rl_slot);
324 }
325 
326 static inline void
327 rpcrdma_mr_push(struct rpcrdma_mr *mr, struct list_head *list)
328 {
329         list_add(&mr->mr_list, list);
330 }
331 
332 static inline struct rpcrdma_mr *
333 rpcrdma_mr_pop(struct list_head *list)
334 {
335         struct rpcrdma_mr *mr;
336 
337         mr = list_first_entry_or_null(list, struct rpcrdma_mr, mr_list);
338         if (mr)
339                 list_del_init(&mr->mr_list);
340         return mr;
341 }
342 
343 /*
344  * struct rpcrdma_buffer -- holds list/queue of pre-registered memory for
345  * inline requests/replies, and client/server credits.
346  *
347  * One of these is associated with a transport instance
348  */
349 struct rpcrdma_buffer {
350         spinlock_t              rb_lock;
351         struct list_head        rb_send_bufs;
352         struct list_head        rb_mrs;
353 
354         unsigned long           rb_sc_head;
355         unsigned long           rb_sc_tail;
356         unsigned long           rb_sc_last;
357         struct rpcrdma_sendctx  **rb_sc_ctxs;
358 
359         struct list_head        rb_allreqs;
360         struct list_head        rb_all_mrs;
361         struct list_head        rb_all_reps;
362 
363         struct llist_head       rb_free_reps;
364 
365         __be32                  rb_max_requests;
366         u32                     rb_credits;     /* most recent credit grant */
367 
368         u32                     rb_bc_srv_max_requests;
369         u32                     rb_bc_max_requests;
370 
371         struct work_struct      rb_refresh_worker;
372 };
373 
374 /*
375  * Statistics for RPCRDMA
376  */
377 struct rpcrdma_stats {
378         /* accessed when sending a call */
379         unsigned long           read_chunk_count;
380         unsigned long           write_chunk_count;
381         unsigned long           reply_chunk_count;
382         unsigned long long      total_rdma_request;
383 
384         /* rarely accessed error counters */
385         unsigned long long      pullup_copy_count;
386         unsigned long           hardway_register_count;
387         unsigned long           failed_marshal_count;
388         unsigned long           bad_reply_count;
389         unsigned long           mrs_recycled;
390         unsigned long           mrs_orphaned;
391         unsigned long           mrs_allocated;
392         unsigned long           empty_sendctx_q;
393 
394         /* accessed when receiving a reply */
395         unsigned long long      total_rdma_reply;
396         unsigned long long      fixup_copy_count;
397         unsigned long           reply_waits_for_send;
398         unsigned long           local_inv_needed;
399         unsigned long           nomsg_call_count;
400         unsigned long           bcall_count;
401 };
402 
403 /*
404  * RPCRDMA transport -- encapsulates the structures above for
405  * integration with RPC.
406  *
407  * The contained structures are embedded, not pointers,
408  * for convenience. This structure need not be visible externally.
409  *
410  * It is allocated and initialized during mount, and released
411  * during unmount.
412  */
413 struct rpcrdma_xprt {
414         struct rpc_xprt         rx_xprt;
415         struct rpcrdma_ep       *rx_ep;
416         struct rpcrdma_buffer   rx_buf;
417         struct delayed_work     rx_connect_worker;
418         struct rpc_timeout      rx_timeout;
419         struct rpcrdma_stats    rx_stats;
420 };
421 
422 #define rpcx_to_rdmax(x) container_of(x, struct rpcrdma_xprt, rx_xprt)
423 
424 static inline const char *
425 rpcrdma_addrstr(const struct rpcrdma_xprt *r_xprt)
426 {
427         return r_xprt->rx_xprt.address_strings[RPC_DISPLAY_ADDR];
428 }
429 
430 static inline const char *
431 rpcrdma_portstr(const struct rpcrdma_xprt *r_xprt)
432 {
433         return r_xprt->rx_xprt.address_strings[RPC_DISPLAY_PORT];
434 }
435 
436 /* Setting this to 0 ensures interoperability with early servers.
437  * Setting this to 1 enhances certain unaligned read/write performance.
438  * Default is 0, see sysctl entry and rpc_rdma.c rpcrdma_convert_iovs() */
439 extern int xprt_rdma_pad_optimize;
440 
441 /* This setting controls the hunt for a supported memory
442  * registration strategy.
443  */
444 extern unsigned int xprt_rdma_memreg_strategy;
445 
446 /*
447  * Endpoint calls - xprtrdma/verbs.c
448  */
449 void rpcrdma_flush_disconnect(struct ib_cq *cq, struct ib_wc *wc);
450 int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt);
451 void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt);
452 
453 int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req);
454 void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp);
455 
456 /*
457  * Buffer calls - xprtrdma/verbs.c
458  */
459 struct rpcrdma_req *rpcrdma_req_create(struct rpcrdma_xprt *r_xprt, size_t size,
460                                        gfp_t flags);
461 int rpcrdma_req_setup(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req);
462 void rpcrdma_req_destroy(struct rpcrdma_req *req);
463 int rpcrdma_buffer_create(struct rpcrdma_xprt *);
464 void rpcrdma_buffer_destroy(struct rpcrdma_buffer *);
465 struct rpcrdma_sendctx *rpcrdma_sendctx_get_locked(struct rpcrdma_xprt *r_xprt);
466 
467 struct rpcrdma_mr *rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt);
468 void rpcrdma_mr_put(struct rpcrdma_mr *mr);
469 void rpcrdma_mrs_refresh(struct rpcrdma_xprt *r_xprt);
470 
471 struct rpcrdma_req *rpcrdma_buffer_get(struct rpcrdma_buffer *);
472 void rpcrdma_buffer_put(struct rpcrdma_buffer *buffers,
473                         struct rpcrdma_req *req);
474 void rpcrdma_recv_buffer_put(struct rpcrdma_rep *);
475 
476 bool rpcrdma_regbuf_realloc(struct rpcrdma_regbuf *rb, size_t size,
477                             gfp_t flags);
478 bool __rpcrdma_regbuf_dma_map(struct rpcrdma_xprt *r_xprt,
479                               struct rpcrdma_regbuf *rb);
480 
481 /**
482  * rpcrdma_regbuf_is_mapped - check if buffer is DMA mapped
483  *
484  * Returns true if the buffer is now mapped to rb->rg_device.
485  */
486 static inline bool rpcrdma_regbuf_is_mapped(struct rpcrdma_regbuf *rb)
487 {
488         return rb->rg_device != NULL;
489 }
490 
491 /**
492  * rpcrdma_regbuf_dma_map - DMA-map a regbuf
493  * @r_xprt: controlling transport instance
494  * @rb: regbuf to be mapped
495  *
496  * Returns true if the buffer is currently DMA mapped.
497  */
498 static inline bool rpcrdma_regbuf_dma_map(struct rpcrdma_xprt *r_xprt,
499                                           struct rpcrdma_regbuf *rb)
500 {
501         if (likely(rpcrdma_regbuf_is_mapped(rb)))
502                 return true;
503         return __rpcrdma_regbuf_dma_map(r_xprt, rb);
504 }
505 
506 /*
507  * Wrappers for chunk registration, shared by read/write chunk code.
508  */
509 
510 static inline enum dma_data_direction
511 rpcrdma_data_dir(bool writing)
512 {
513         return writing ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
514 }
515 
516 /* Memory registration calls xprtrdma/frwr_ops.c
517  */
518 void frwr_reset(struct rpcrdma_req *req);
519 int frwr_query_device(struct rpcrdma_ep *ep, const struct ib_device *device);
520 int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr);
521 void frwr_release_mr(struct rpcrdma_mr *mr);
522 struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt,
523                                 struct rpcrdma_mr_seg *seg,
524                                 int nsegs, bool writing, __be32 xid,
525                                 struct rpcrdma_mr *mr);
526 int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req);
527 void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs);
528 void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req);
529 void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req);
530 
531 /*
532  * RPC/RDMA protocol calls - xprtrdma/rpc_rdma.c
533  */
534 
535 enum rpcrdma_chunktype {
536         rpcrdma_noch = 0,
537         rpcrdma_noch_pullup,
538         rpcrdma_noch_mapped,
539         rpcrdma_readch,
540         rpcrdma_areadch,
541         rpcrdma_writech,
542         rpcrdma_replych
543 };
544 
545 int rpcrdma_prepare_send_sges(struct rpcrdma_xprt *r_xprt,
546                               struct rpcrdma_req *req, u32 hdrlen,
547                               struct xdr_buf *xdr,
548                               enum rpcrdma_chunktype rtype);
549 void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc);
550 int rpcrdma_marshal_req(struct rpcrdma_xprt *r_xprt, struct rpc_rqst *rqst);
551 void rpcrdma_set_max_header_sizes(struct rpcrdma_ep *ep);
552 void rpcrdma_reset_cwnd(struct rpcrdma_xprt *r_xprt);
553 void rpcrdma_complete_rqst(struct rpcrdma_rep *rep);
554 void rpcrdma_reply_handler(struct rpcrdma_rep *rep);
555 
556 static inline void rpcrdma_set_xdrlen(struct xdr_buf *xdr, size_t len)
557 {
558         xdr->head[0].iov_len = len;
559         xdr->len = len;
560 }
561 
562 /* RPC/RDMA module init - xprtrdma/transport.c
563  */
564 extern unsigned int xprt_rdma_max_inline_read;
565 extern unsigned int xprt_rdma_max_inline_write;
566 void xprt_rdma_format_addresses(struct rpc_xprt *xprt, struct sockaddr *sap);
567 void xprt_rdma_free_addresses(struct rpc_xprt *xprt);
568 void xprt_rdma_close(struct rpc_xprt *xprt);
569 void xprt_rdma_print_stats(struct rpc_xprt *xprt, struct seq_file *seq);
570 int xprt_rdma_init(void);
571 void xprt_rdma_cleanup(void);
572 
573 /* Backchannel calls - xprtrdma/backchannel.c
574  */
575 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
576 int xprt_rdma_bc_setup(struct rpc_xprt *, unsigned int);
577 size_t xprt_rdma_bc_maxpayload(struct rpc_xprt *);
578 unsigned int xprt_rdma_bc_max_slots(struct rpc_xprt *);
579 int rpcrdma_bc_post_recv(struct rpcrdma_xprt *, unsigned int);
580 void rpcrdma_bc_receive_call(struct rpcrdma_xprt *, struct rpcrdma_rep *);
581 int xprt_rdma_bc_send_reply(struct rpc_rqst *rqst);
582 void xprt_rdma_bc_free_rqst(struct rpc_rqst *);
583 void xprt_rdma_bc_destroy(struct rpc_xprt *, unsigned int);
584 #endif  /* CONFIG_SUNRPC_BACKCHANNEL */
585 
586 extern struct xprt_class xprt_rdma_bc;
587 
588 #endif                          /* _LINUX_SUNRPC_XPRT_RDMA_H */
589 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp