]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/sunrpc/svc_rdma.h
svcrdma: Use reply and chunk map for RDMA_READ processing
[linux-2.6-omap-h63xx.git] / include / linux / sunrpc / svc_rdma.h
index c11bbcc081f9d0cba45821a30315a43ab8cc047e..fd5e8a1c17de1f59b813d11c32c99643fd72c206 100644 (file)
@@ -71,7 +71,9 @@ extern atomic_t rdma_stat_sq_prod;
  * completes.
  */
 struct svc_rdma_op_ctxt {
-       struct svc_rdma_op_ctxt *next;
+       struct svc_rdma_op_ctxt *read_hdr;
+       int hdr_count;
+       struct list_head free_list;
        struct xdr_buf arg;
        struct list_head dto_q;
        enum ib_wr_opcode wr_op;
@@ -85,7 +87,31 @@ struct svc_rdma_op_ctxt {
        struct page *pages[RPCSVC_MAXPAGES];
 };
 
-#define RDMACTXT_F_READ_DONE   1
+/*
+ * NFS_ requests are mapped on the client side by the chunk lists in
+ * the RPCRDMA header. During the fetching of the RPC from the client
+ * and the writing of the reply to the client, the memory in the
+ * client and the memory in the server must be mapped as contiguous
+ * vaddr/len for access by the hardware. These data strucures keep
+ * these mappings.
+ *
+ * For an RDMA_WRITE, the 'sge' maps the RPC REPLY. For RDMA_READ, the
+ * 'sge' in the svc_rdma_req_map maps the server side RPC reply and the
+ * 'ch' field maps the read-list of the RPCRDMA header to the 'sge'
+ * mapping of the reply.
+ */
+struct svc_rdma_chunk_sge {
+       int start;              /* sge no for this chunk */
+       int count;              /* sge count for this chunk */
+};
+struct svc_rdma_req_map {
+       unsigned long count;
+       union {
+               struct kvec sge[RPCSVC_MAXPAGES];
+               struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES];
+       };
+};
+
 #define RDMACTXT_F_LAST_CTXT   2
 
 struct svcxprt_rdma {
@@ -104,7 +130,8 @@ struct svcxprt_rdma {
 
        struct ib_pd         *sc_pd;
 
-       struct svc_rdma_op_ctxt  *sc_ctxt_head;
+       atomic_t             sc_ctxt_used;
+       struct list_head     sc_ctxt_free;
        int                  sc_ctxt_cnt;
        int                  sc_ctxt_bump;
        int                  sc_ctxt_max;
@@ -123,6 +150,7 @@ struct svcxprt_rdma {
        struct list_head     sc_dto_q;          /* DTO tasklet I/O pending Q */
        struct list_head     sc_read_complete_q;
        spinlock_t           sc_read_complete_lock;
+       struct work_struct   sc_work;
 };
 /* sc_flags */
 #define RDMAXPRT_RQ_PENDING    1
@@ -164,13 +192,15 @@ extern int svc_rdma_sendto(struct svc_rqst *);
 
 /* svc_rdma_transport.c */
 extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *);
-extern int svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
-                              enum rpcrdma_errcode);
+extern void svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
+                               enum rpcrdma_errcode);
 struct page *svc_rdma_get_page(void);
 extern int svc_rdma_post_recv(struct svcxprt_rdma *);
 extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
 extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
 extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
+extern struct svc_rdma_req_map *svc_rdma_get_req_map(void);
+extern void svc_rdma_put_req_map(struct svc_rdma_req_map *);
 extern void svc_sq_reap(struct svcxprt_rdma *);
 extern void svc_rq_reap(struct svcxprt_rdma *);
 extern struct svc_xprt_class svc_rdma_class;