Commit dea26209 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

IB/srpt: Change default behavior from using SRQ to using RC

Although in the RC mode more resources are needed that mode has three
advantages over SRQ:
- It works with all RDMA adapters, even those that do not support
  SRQ.
- Posting WRs and polling WCs does not trigger lock contention
  because only one thread at a time accesses a WR or WC queue in
  non-SRQ mode.
- The end-to-end flow control mechanism is used.

>From the IB spec:

    C9-150.2.1: For QPs that are not associated with an SRQ, each HCA
    receive queue shall generate end-to-end flow control credits. If
    a QP is associated with an SRQ, the HCA receive queue shall not
    generate end-to-end flow control credits.

Add new configfs attributes that allow to configure which mode to use
(/sys/kernel/config/target/srpt/$GUID/$GUID/attrib/use_srq). Note:
only the attribute for port 1 is relevant on multi-port adapters.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 74333f12
This diff is collapsed.
...@@ -252,6 +252,7 @@ enum rdma_ch_state { ...@@ -252,6 +252,7 @@ enum rdma_ch_state {
* @free_list: Head of list with free send I/O contexts. * @free_list: Head of list with free send I/O contexts.
* @state: channel state. See also enum rdma_ch_state. * @state: channel state. See also enum rdma_ch_state.
* @ioctx_ring: Send ring. * @ioctx_ring: Send ring.
* @ioctx_recv_ring: Receive I/O context ring.
* @list: Node for insertion in the srpt_device.rch_list list. * @list: Node for insertion in the srpt_device.rch_list list.
* @cmd_wait_list: List of SCSI commands that arrived before the RTU event. This * @cmd_wait_list: List of SCSI commands that arrived before the RTU event. This
* list contains struct srpt_ioctx elements and is protected * list contains struct srpt_ioctx elements and is protected
...@@ -281,6 +282,7 @@ struct srpt_rdma_ch { ...@@ -281,6 +282,7 @@ struct srpt_rdma_ch {
struct list_head free_list; struct list_head free_list;
enum rdma_ch_state state; enum rdma_ch_state state;
struct srpt_send_ioctx **ioctx_ring; struct srpt_send_ioctx **ioctx_ring;
struct srpt_recv_ioctx **ioctx_recv_ring;
struct list_head list; struct list_head list;
struct list_head cmd_wait_list; struct list_head cmd_wait_list;
struct se_session *sess; struct se_session *sess;
...@@ -295,11 +297,13 @@ struct srpt_rdma_ch { ...@@ -295,11 +297,13 @@ struct srpt_rdma_ch {
* @srp_max_rdma_size: Maximum size of SRP RDMA transfers for new connections. * @srp_max_rdma_size: Maximum size of SRP RDMA transfers for new connections.
* @srp_max_rsp_size: Maximum size of SRP response messages in bytes. * @srp_max_rsp_size: Maximum size of SRP response messages in bytes.
* @srp_sq_size: Shared receive queue (SRQ) size. * @srp_sq_size: Shared receive queue (SRQ) size.
* @use_srq: Whether or not to use SRQ.
*/ */
struct srpt_port_attrib { struct srpt_port_attrib {
u32 srp_max_rdma_size; u32 srp_max_rdma_size;
u32 srp_max_rsp_size; u32 srp_max_rsp_size;
u32 srp_sq_size; u32 srp_sq_size;
bool use_srq;
}; };
/** /**
...@@ -347,6 +351,7 @@ struct srpt_port { ...@@ -347,6 +351,7 @@ struct srpt_port {
* @srq: Per-HCA SRQ (shared receive queue). * @srq: Per-HCA SRQ (shared receive queue).
* @cm_id: Connection identifier. * @cm_id: Connection identifier.
* @srq_size: SRQ size. * @srq_size: SRQ size.
* @use_srq: Whether or not to use SRQ.
* @ioctx_ring: Per-HCA SRQ. * @ioctx_ring: Per-HCA SRQ.
* @rch_list: Per-device channel list -- see also srpt_rdma_ch.list. * @rch_list: Per-device channel list -- see also srpt_rdma_ch.list.
* @ch_releaseQ: Enables waiting for removal from rch_list. * @ch_releaseQ: Enables waiting for removal from rch_list.
...@@ -362,6 +367,7 @@ struct srpt_device { ...@@ -362,6 +367,7 @@ struct srpt_device {
struct ib_srq *srq; struct ib_srq *srq;
struct ib_cm_id *cm_id; struct ib_cm_id *cm_id;
int srq_size; int srq_size;
bool use_srq;
struct srpt_recv_ioctx **ioctx_ring; struct srpt_recv_ioctx **ioctx_ring;
struct list_head rch_list; struct list_head rch_list;
wait_queue_head_t ch_releaseQ; wait_queue_head_t ch_releaseQ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment