Merge tag 'nfs-for-4.21-1' of git://git.linux-nfs.org/projects/anna/linux-nfs
[sfrench/cifs-2.6.git] / net / sunrpc / xprtrdma / xprt_rdma.h
index 9218dbebedce2824eaedf1cc11a20364552ea538..5a18472f2c9ce5d2f16de6209b01559c2667ebf8 100644 (file)
@@ -66,7 +66,6 @@
  * Interface Adapter -- one per transport instance
  */
 struct rpcrdma_ia {
-       const struct rpcrdma_memreg_ops *ri_ops;
        struct ib_device        *ri_device;
        struct rdma_cm_id       *ri_id;
        struct ib_pd            *ri_pd;
@@ -81,8 +80,6 @@ struct rpcrdma_ia {
        bool                    ri_implicit_roundup;
        enum ib_mr_type         ri_mrtype;
        unsigned long           ri_flags;
-       struct ib_qp_attr       ri_qp_attr;
-       struct ib_qp_init_attr  ri_qp_init_attr;
 };
 
 enum {
@@ -101,7 +98,7 @@ struct rpcrdma_ep {
        wait_queue_head_t       rep_connect_wait;
        struct rpcrdma_connect_private  rep_cm_private;
        struct rdma_conn_param  rep_remote_cma;
-       struct delayed_work     rep_disconnect_worker;
+       int                     rep_receive_count;
 };
 
 /* Pre-allocate extra Work Requests for handling backward receives
@@ -262,20 +259,12 @@ struct rpcrdma_frwr {
        };
 };
 
-struct rpcrdma_fmr {
-       struct ib_fmr           *fm_mr;
-       u64                     *fm_physaddrs;
-};
-
 struct rpcrdma_mr {
        struct list_head        mr_list;
        struct scatterlist      *mr_sg;
        int                     mr_nents;
        enum dma_data_direction mr_dir;
-       union {
-               struct rpcrdma_fmr      fmr;
-               struct rpcrdma_frwr     frwr;
-       };
+       struct rpcrdma_frwr     frwr;
        struct rpcrdma_xprt     *mr_xprt;
        u32                     mr_handle;
        u32                     mr_length;
@@ -401,20 +390,18 @@ struct rpcrdma_buffer {
        spinlock_t              rb_lock;        /* protect buf lists */
        struct list_head        rb_send_bufs;
        struct list_head        rb_recv_bufs;
+       struct list_head        rb_allreqs;
+
        unsigned long           rb_flags;
        u32                     rb_max_requests;
        u32                     rb_credits;     /* most recent credit grant */
-       int                     rb_posted_receives;
 
        u32                     rb_bc_srv_max_requests;
-       spinlock_t              rb_reqslock;    /* protect rb_allreqs */
-       struct list_head        rb_allreqs;
-
        u32                     rb_bc_max_requests;
 
+       struct workqueue_struct *rb_completion_wq;
        struct delayed_work     rb_refresh_worker;
 };
-#define rdmab_to_ia(b) (&container_of((b), struct rpcrdma_xprt, rx_buf)->rx_ia)
 
 /* rb_flags */
 enum {
@@ -464,35 +451,6 @@ struct rpcrdma_stats {
        unsigned long           bcall_count;
 };
 
-/*
- * Per-registration mode operations
- */
-struct rpcrdma_xprt;
-struct rpcrdma_memreg_ops {
-       struct rpcrdma_mr_seg *
-                       (*ro_map)(struct rpcrdma_xprt *,
-                                 struct rpcrdma_mr_seg *, int, bool,
-                                 struct rpcrdma_mr **);
-       int             (*ro_send)(struct rpcrdma_ia *ia,
-                                  struct rpcrdma_req *req);
-       void            (*ro_reminv)(struct rpcrdma_rep *rep,
-                                    struct list_head *mrs);
-       void            (*ro_unmap_sync)(struct rpcrdma_xprt *,
-                                        struct list_head *);
-       int             (*ro_open)(struct rpcrdma_ia *,
-                                  struct rpcrdma_ep *,
-                                  struct rpcrdma_create_data_internal *);
-       size_t          (*ro_maxpages)(struct rpcrdma_xprt *);
-       int             (*ro_init_mr)(struct rpcrdma_ia *,
-                                     struct rpcrdma_mr *);
-       void            (*ro_release_mr)(struct rpcrdma_mr *mr);
-       const char      *ro_displayname;
-       const int       ro_send_w_inv_ok;
-};
-
-extern const struct rpcrdma_memreg_ops rpcrdma_fmr_memreg_ops;
-extern const struct rpcrdma_memreg_ops rpcrdma_frwr_memreg_ops;
-
 /*
  * RPCRDMA transport -- encapsulates the structures above for
  * integration with RPC.
@@ -544,10 +502,6 @@ extern unsigned int xprt_rdma_memreg_strategy;
 int rpcrdma_ia_open(struct rpcrdma_xprt *xprt);
 void rpcrdma_ia_remove(struct rpcrdma_ia *ia);
 void rpcrdma_ia_close(struct rpcrdma_ia *);
-bool frwr_is_supported(struct rpcrdma_ia *);
-bool fmr_is_supported(struct rpcrdma_ia *);
-
-extern struct workqueue_struct *rpcrdma_receive_wq;
 
 /*
  * Endpoint calls - xprtrdma/verbs.c
@@ -560,13 +514,12 @@ void rpcrdma_ep_disconnect(struct rpcrdma_ep *, struct rpcrdma_ia *);
 
 int rpcrdma_ep_post(struct rpcrdma_ia *, struct rpcrdma_ep *,
                                struct rpcrdma_req *);
-void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp);
 
 /*
  * Buffer calls - xprtrdma/verbs.c
  */
 struct rpcrdma_req *rpcrdma_create_req(struct rpcrdma_xprt *);
-void rpcrdma_destroy_req(struct rpcrdma_req *);
+void rpcrdma_req_destroy(struct rpcrdma_req *req);
 int rpcrdma_buffer_create(struct rpcrdma_xprt *);
 void rpcrdma_buffer_destroy(struct rpcrdma_buffer *);
 struct rpcrdma_sendctx *rpcrdma_sendctx_get_locked(struct rpcrdma_buffer *buf);
@@ -604,9 +557,6 @@ rpcrdma_dma_map_regbuf(struct rpcrdma_ia *ia, struct rpcrdma_regbuf *rb)
        return __rpcrdma_dma_map_regbuf(ia, rb);
 }
 
-int rpcrdma_alloc_wq(void);
-void rpcrdma_destroy_wq(void);
-
 /*
  * Wrappers for chunk registration, shared by read/write chunk code.
  */
@@ -617,6 +567,23 @@ rpcrdma_data_dir(bool writing)
        return writing ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
 }
 
+/* Memory registration calls xprtrdma/frwr_ops.c
+ */
+bool frwr_is_supported(struct rpcrdma_ia *);
+int frwr_open(struct rpcrdma_ia *ia, struct rpcrdma_ep *ep,
+             struct rpcrdma_create_data_internal *cdata);
+int frwr_init_mr(struct rpcrdma_ia *ia, struct rpcrdma_mr *mr);
+void frwr_release_mr(struct rpcrdma_mr *mr);
+size_t frwr_maxpages(struct rpcrdma_xprt *r_xprt);
+struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt,
+                               struct rpcrdma_mr_seg *seg,
+                               int nsegs, bool writing, u32 xid,
+                               struct rpcrdma_mr **mr);
+int frwr_send(struct rpcrdma_ia *ia, struct rpcrdma_req *req);
+void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs);
+void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt,
+                    struct list_head *mrs);
+
 /*
  * RPC/RDMA protocol calls - xprtrdma/rpc_rdma.c
  */
@@ -653,6 +620,7 @@ static inline void rpcrdma_set_xdrlen(struct xdr_buf *xdr, size_t len)
 extern unsigned int xprt_rdma_max_inline_read;
 void xprt_rdma_format_addresses(struct rpc_xprt *xprt, struct sockaddr *sap);
 void xprt_rdma_free_addresses(struct rpc_xprt *xprt);
+void xprt_rdma_close(struct rpc_xprt *xprt);
 void xprt_rdma_print_stats(struct rpc_xprt *xprt, struct seq_file *seq);
 int xprt_rdma_init(void);
 void xprt_rdma_cleanup(void);