aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/srpt/ib_srpt.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-05-03 18:01:11 +0200
committerDoug Ledford <dledford@redhat.com>2016-05-13 13:37:20 -0400
commitb99f8e4d7bcd3bfbb3cd965918523299370d0cb2 (patch)
treeb9f389ea80f027140019ec2807eb0cdd48bfeb8b /drivers/infiniband/ulp/srpt/ib_srpt.h
parenttarget: enhance and export target_alloc_sgl/target_free_sgl (diff)
downloadlinux-dev-b99f8e4d7bcd3bfbb3cd965918523299370d0cb2.tar.xz
linux-dev-b99f8e4d7bcd3bfbb3cd965918523299370d0cb2.zip
IB/srpt: convert to the generic RDMA READ/WRITE API
Replace the homegrown RDMA READ/WRITE code in srpt with the generic API. The only real twist here is that we need to allocate one Linux scatterlist per direct buffer in the SRP command, and chain them before handing them off to the target core. As a side-effect of the conversion the driver will also chain the SEND of the SRP response to the RDMA WRITE WRs for a DATA OUT command, and properly account for RDMA WRITE WRs instead of just for RDMA READ WRs like the driver previously did. We now allocate half of the SQ size to RDMA READ/WRITE contexts, assuming by default one RDMA READ or WRITE operation per command. If a command has multiple operations it will eat into the budget but will still succeed, possible after waiting for WQEs to be available. Also ensure the QPs request the maximum allowed SGEs so that RDMA R/W API works correctly. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp/srpt/ib_srpt.h')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.h31
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h
index af9b8b527340..fee6bfd7ca21 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -42,6 +42,7 @@
#include <rdma/ib_verbs.h>
#include <rdma/ib_sa.h>
#include <rdma/ib_cm.h>
+#include <rdma/rw.h>
#include <scsi/srp.h>
@@ -105,7 +106,6 @@ enum {
SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2,
SRPT_DEF_SG_TABLESIZE = 128,
- SRPT_DEF_SG_PER_WQE = 16,
MIN_SRPT_SQ_SIZE = 16,
DEF_SRPT_SQ_SIZE = 4096,
@@ -174,21 +174,17 @@ struct srpt_recv_ioctx {
struct srpt_ioctx ioctx;
struct list_head wait_list;
};
+
+struct srpt_rw_ctx {
+ struct rdma_rw_ctx rw;
+ struct scatterlist *sg;
+ unsigned int nents;
+};
/**
* struct srpt_send_ioctx - SRPT send I/O context.
* @ioctx: See above.
* @ch: Channel pointer.
- * @free_list: Node in srpt_rdma_ch.free_list.
- * @n_rbuf: Number of data buffers in the received SRP command.
- * @rbufs: Pointer to SRP data buffer array.
- * @single_rbuf: SRP data buffer if the command has only a single buffer.
- * @sg: Pointer to sg-list associated with this I/O context.
- * @sg_cnt: SG-list size.
- * @mapped_sg_count: ib_dma_map_sg() return value.
- * @n_rdma_wrs: Number of elements in the rdma_wrs array.
- * @rdma_wrs: Array with information about the RDMA mapping.
- * @tag: Tag of the received SRP information unit.
* @spinlock: Protects 'state'.
* @state: I/O context state.
* @cmd: Target core command data structure.
@@ -197,21 +193,18 @@ struct srpt_recv_ioctx {
struct srpt_send_ioctx {
struct srpt_ioctx ioctx;
struct srpt_rdma_ch *ch;
- struct ib_rdma_wr *rdma_wrs;
+
+ struct srpt_rw_ctx s_rw_ctx;
+ struct srpt_rw_ctx *rw_ctxs;
+
struct ib_cqe rdma_cqe;
- struct srp_direct_buf *rbufs;
- struct srp_direct_buf single_rbuf;
- struct scatterlist *sg;
struct list_head free_list;
spinlock_t spinlock;
enum srpt_command_state state;
struct se_cmd cmd;
struct completion tx_done;
- int sg_cnt;
- int mapped_sg_count;
- u16 n_rdma_wrs;
u8 n_rdma;
- u8 n_rbuf;
+ u8 n_rw_ctx;
bool queue_status_only;
u8 sense_data[TRANSPORT_SENSE_BUFFER];
};