ib_srpt: Merge performance improvements and bug fixes from trunk (up to and including r4041).

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4042 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2011-12-29 14:26:18 +00:00
parent a597a9e292
commit dca262062d
8 changed files with 669 additions and 650 deletions

View File

@@ -5,6 +5,7 @@ Changes compared to version 2.1.0:
- Changed default value of the kernel module parameter srp_max_req_size from
2116 into 4148. That last value corresponds to a table size of 255 elements.
- "make debug2release" etc. now also affects ib_srpt.
- Removed "thread" kernel module parameter.
- Slightly reduced the number of IB interrupts caused by SRP traffic.
- Fixed a bug that could cause valid logins to be rejected. The message that
is logged in the system log if this happens is:
@@ -62,17 +63,17 @@ Changes compared to version 1.0.0:
Asynchronous events are triggered by e.g. resetting an InfiniBand switch or
reconnecting an InfiniBand cable (r878:880). The call stack of the oops is
as follows:
queue_work+0x1a/0x20
schedule_work+0x16/0x20
srpt_event_handler+0xda/0xe0 [ib_srpt]
ib_dispatch_event+0x39/0x70 [ib_core]
mlx4_ib_process_mad+0x3e6/0x430 [mlx4_ib]
ib_post_send_mad+0x374/0x6f0 [ib_mad]
? futex_wake+0x105/0x120
ib_umad_write+0x4a8/0x5c0 [ib_umad]
vfs_write+0xcb/0x170
sys_write+0x50/0x90
system_call_fastpath+0x16/0x1b
queue_work+0x1a/0x20
schedule_work+0x16/0x20
srpt_event_handler+0xda/0xe0 [ib_srpt]
ib_dispatch_event+0x39/0x70 [ib_core]
mlx4_ib_process_mad+0x3e6/0x430 [mlx4_ib]
ib_post_send_mad+0x374/0x6f0 [ib_mad]
? futex_wake+0x105/0x120
ib_umad_write+0x4a8/0x5c0 [ib_umad]
vfs_write+0xcb/0x170
sys_write+0x50/0x90
system_call_fastpath+0x16/0x1b
- The login information for HCA's with more than two ports is now displayed
correctly. Note: no such devices exist yet (r799).

View File

@@ -2,7 +2,9 @@
# Makefile for ib_srpt.ko.
#
SCST_DIR := $(shell pwd)/../scst/src
SCST_SYMVERS_DIR := $(shell if [ -e $$PWD/../scst ]; then \
echo $$PWD/../scst/src; \
else echo /usr/local/include/scst; fi)
SUBDIRS := $(shell pwd)
ifeq ($(KVER),)
@@ -56,7 +58,7 @@ install: all src/ib_srpt.ko
$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra/ib_srpt.ko
-/sbin/depmod -aq $(KVER)
src/Module.symvers src/Modules.symvers: $(SCST_DIR)/$(MODULE_SYMVERS)
src/Module.symvers src/Modules.symvers: $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS)
@if $(OFED_KERNEL_IB_RPM_INSTALLED); then \
if ! $(OFED_KERNEL_IB_DEVEL_RPM_INSTALLED); then \
echo "Error: the OFED package kernel-ib-devel has not yet been" \
@@ -104,15 +106,18 @@ extraclean: clean
rm -f *.orig *.rej
release2debug perf2debug:
-make clean
-$(MAKE) clean
$(call set_var,build_mode,BUILDMODE,)
debug2release:
-make clean
-$(MAKE) clean
$(call set_var,build_mode,BUILDMODE,RELEASE)
debug2perf:
-make clean
-$(MAKE) clean
$(call set_var,build_mode,BUILDMODE,PERF)
release-archive:
@version="$$(sed -n 's/^#define DRV_VERSION[ ]*\"\([0-9.]*\).*/\1/p' src/ib_srpt.c)"; tar --owner=root --group=root --transform="s|^|srpt-$$version/|" -cjf srpt-$$version.tar.bz2 $$(svn status -v -q | grep -v '^D' | cut -c11- | while read rev1 rev2 user path; do [ -d "$$path" ] || echo "$$path"; done) && ls -l srpt-$$version.tar.bz2
.PHONY: all install clean extraclean 2debug 2release 2perf

View File

@@ -34,8 +34,7 @@ Target system software:
Target system software configuration:
* Runlevel: 3.
* ib_srpt kernel module was loaded with these kernel module parameters:
srp_max_req_size=4200 thread=1
* ib_srpt kernel module was loaded with the parameter srp_max_req_size=4200.
* A 1 GB file residing on a tmpfs filesystem was exported towards the
initiator system. From scst.conf:
HANDLER vdisk_fileio {
@@ -50,23 +49,23 @@ Measurement results
===================
Numer of read IOPS reported by fio with block size 4 KB and I/O depth 32:
195000
197000
+ blockdev-perftest -f -j -d -s 30 -m 12 /dev/sdb
blocksize W W W W(avg, W(std, W R R R R(avg, R(std, R
(bytes) (s) (s) (s) MB/s) MB/s) (IOPS) (s) (s) (s) MB/s) MB/s) (IOPS)
67108864 0.564 0.559 0.569 1815.698 13.143 28.370 0.372 0.371 0.372 2755.161 3.498 43.049
33554432 0.558 0.558 0.565 1827.547 10.718 57.111 0.373 0.372 0.374 2745.321 6.010 85.791
16777216 0.552 0.548 0.552 1859.586 6.383 116.224 0.385 0.382 0.383 2671.333 8.681 166.958
8388608 0.523 0.525 0.527 1950.495 6.067 243.812 0.412 0.408 0.411 2495.575 10.360 311.947
4194304 0.545 0.544 0.543 1882.357 2.825 470.589 0.432 0.436 0.431 2364.955 11.764 591.239
2097152 0.597 0.606 0.610 1694.567 15.304 847.283 0.520 0.512 0.513 1988.444 13.679 994.222
1048576 0.699 0.695 0.697 1469.162 3.442 1469.162 0.589 0.588 0.582 1746.496 9.239 1746.496
524288 0.948 0.955 0.955 1074.890 3.732 2149.781 0.815 0.794 0.796 1277.515 14.960 2555.031
262144 1.096 1.084 1.105 935.218 7.357 3740.870 0.994 0.897 0.895 1105.299 53.127 4421.198
131072 1.258 1.280 1.249 811.282 8.329 6490.257 1.083 1.066 1.069 954.676 6.566 7637.404
65536 1.601 1.609 1.641 633.343 6.726 10133.494 1.383 1.308 1.383 754.571 20.014 12073.138
32768 2.318 2.312 2.333 441.196 1.676 14118.257 1.960 1.957 1.892 528.975 8.669 16927.201
16384 3.769 3.776 3.779 271.283 0.301 17362.084 3.092 3.010 3.096 334.042 4.357 21378.686
8192 6.807 6.728 6.827 150.875 0.954 19312.035 5.256 5.225 5.282 194.891 0.865 24945.996
4096 12.260 12.277 12.258 83.490 0.058 21373.349 9.851 9.737 9.587 105.309 1.173 26959.019
blocksize W W W W(avg, W(std, W R R R R(avg, R(std, R
(bytes) (s) (s) (s) MB/s) MB/s) (IOPS) (s) (s) (s) MB/s) MB/s) (IOPS)
67108864 0.568 0.573 0.572 1793.371 6.800 28.021 0.373 0.372 0.372 2750.228 3.479 42.972
33554432 0.553 0.570 0.563 1822.346 22.683 56.948 0.374 0.374 0.373 2740.415 3.460 85.638
16777216 0.552 0.554 0.552 1852.840 3.157 115.803 0.387 0.384 0.384 2659.776 9.745 166.236
8388608 0.525 0.526 0.525 1949.240 1.748 243.655 0.411 0.409 0.410 2497.571 4.974 312.196
4194304 0.542 0.540 0.541 1892.795 2.857 473.199 0.433 0.437 0.428 2366.890 20.165 591.722
2097152 0.611 0.610 0.612 1675.944 2.240 837.972 0.517 0.512 0.511 1994.857 10.167 997.429
1048576 0.678 0.691 0.684 1496.437 11.609 1496.437 0.588 0.597 0.586 1734.727 13.989 1734.727
524288 0.946 0.941 0.947 1083.989 3.017 2167.977 0.808 0.784 0.788 1290.981 16.943 2581.961
262144 1.102 1.167 1.152 898.524 22.201 3594.096 0.968 0.964 0.970 1058.587 2.732 4234.349
131072 1.289 1.239 1.249 813.581 13.820 6508.648 1.076 1.074 1.071 953.745 1.826 7629.957
65536 1.599 1.604 1.608 638.540 1.466 10216.641 1.389 1.396 1.405 733.190 3.436 11731.045
32768 2.300 2.319 2.309 443.423 1.490 14189.537 1.976 2.004 1.967 516.595 4.088 16531.055
16384 3.780 3.777 3.788 270.780 0.332 17329.951 3.210 3.086 3.050 328.854 7.147 21046.655
8192 6.800 6.406 6.560 155.512 3.804 19905.533 5.409 5.250 5.272 192.865 2.533 24686.738
4096 12.368 12.240 11.924 84.111 1.298 21532.302 9.561 9.847 9.559 106.072 1.472 27154.518

View File

@@ -87,22 +87,6 @@ The ib_srpt kernel module supports the following parameters:
for a credit limit of 128. Changing this parameter to a smaller value may
cause RDMA requests to be retried and hence may slow down data transfer
severely.
* thread (0, 1 or 2, default 1)
Defines the context on which SRP requests are processed:
* thread=0: do as much processing in IRQ context as possible. Results in
lower latency than the other two modes but may trigger soft lockup
complaints when multiple initiators are simultaneously processing
workloads with large I/O depths. Scalability of this mode is limited
- it exploits only a fraction of the power available on multiprocessor
systems.
* thread=1: dedicates one kernel thread per initiator. Scales well on
multiprocessor systems. This is the recommended mode when multiple
initiator systems are accessing the same target system simultaneously.
* thread=2: makes one CPU process all IB completions and defer further
processing to kernel thread context. Scales better than mode thread=0 but
not as good as mode thread=1. May trigger soft lockup complaints when
multiple initiators are simultaneously processing workloads with large I/O
depths.
* trace_flag (unsigned integer, only available in debug builds)
The individual bits of the trace_flag parameter define which categories of
trace messages should be sent to the kernel log and which ones not.
@@ -257,6 +241,20 @@ $ ls /sys/bus/scst_target/drivers/ib_srpt/*/sessions
0x00000000000000000002c9030005f34b
Adding and Removing LUNs Dynamically
------------------------------------
It is possible to add and/or remove LUNs on the target without restarting
target or initiator. This can be done either via scstadmin or directly via the
sysfs interface. Although the SCST core will notify the initiator about LUN
changes, Linux initiators will ignore these notifications. In order to bring a
Linux initiator again in sync after a LUN change, the initiator has to be told
to rescan SCSI devices. Rescanning SCSI devices is e.g. possible via the
rescsan-scsi-bus.sh script that can be found here:
http://www.garloff.de/kurt/linux/#rescan-scsi. An example:
$ rescan-scsi-bus --hosts=${srp_host_id} --channels=0 --ids=0 --luns=0-31
High availability
-----------------
@@ -293,6 +291,16 @@ Notes about ib_srpt
that time CPU usage will be high.
Performance Notes - Target Side
-------------------------------
When using high-latency storage devices (hard disks), the default value
choosen by SCST for DEVICE.threads_num should be fine. When using low-latency
storage devices though (SSDs), DEVICE.threads_num should be set to 1 or 2 in
/etc/scst.conf in order to reach optimal performance for small block sizes
(e.g. 4 KB).
Performance Notes - Initiator Side
----------------------------------

View File

@@ -62,12 +62,19 @@ Index: srpt/src/ib_srpt.c
/* create cm reply */
* Verify that a SCSI reset works properly by running the following command
on an initiator system (note: even with the latest Linux SRP initiator, the
command below triggers a kernel bug -- see also
on an initiator system (note: with kernel version 2.6.37 and before the
command below triggers a bug in the Linux SRP initiator -- see also
https://bugzilla.kernel.org/show_bug.cgi?id=13893):
(target)
echo add debug > /sys/kernel/scst_tgt/targets/ib_srpt/trace_level
(initiator)
sg_reset -d ${initiator_device}
Verify that the target logged that it has processed a SRP_TSK_LUN_RESET
message.
* Run the following command on a target system:
while true; do /etc/init.d/scst stop; sleep 3; /etc/init.d/scst start; sleep 5; done
@@ -121,5 +128,16 @@ Index: srpt/src/ib_srpt.c
--norandommap --ioengine=aio --directory=/mnt --name=test --thread \
--numjobs=80 --runtime=30
* Test whether aborting multipart RDMA transfers works correctly as follows:
- On the target, reload ib_srpt with srpt_sq_size set to 64.
- On the initiator, run a direct I/O test with large block sizes, e.g. 128 KB.
- Verify that on the target kernel messages similar to the following are
logged frequently:
ib_srpt: ***ERROR***: srpt_perform_rdmas[2966]: ib_post_send() returned
-12 for 1/2
- On the target, unload and reload the ib_srpt kernel module.
- Verify that no kernel crash occurs on the target.
- Repeat the above a few times.
* Repeat the above tests for all three threading modes: thread=0, thread=1
and thread=2.

View File

@@ -1,12 +1,16 @@
-include $(SUBDIRS)/../build_mode
SCST_INC_DIR := $(shell d="$(dir $(lastword $(MAKEFILE_LIST)))"; \
if [ -e "$$d../../scst" ]; \
then echo "$$d../../scst/include"; \
else echo "/usr/local/include/scst"; fi)
EXTRA_CFLAGS += -I$(SCST_INC_DIR)
SCST_INC_DIR := $(SUBDIRS)/../../scst/include/
-include $(SUBDIRS)/../build_mode
SRPTFLAGS = -DCONFIG_SCST_TRACING -DCONFIG_SCST_DEBUG \
-DCONFIG_SCST_EXTRACHECKS -fno-inline -fno-inline-functions
SRPTFLAGSRELEASE = -DCONFIG_SCST_TRACING
SRPTFLAGSPERF =
EXTRA_CFLAGS += -I$(SCST_INC_DIR) $(SRPTFLAGS$(BUILDMODE))
EXTRA_CFLAGS += $(SRPTFLAGS$(BUILDMODE))
#EXTRA_CFLAGS += -Wextra -Wno-unused-parameter

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2006 - 2009 Mellanox Technology Inc. All rights reserved.
* Copyright (C) 2009 - 2010 Bart Van Assche <bvanassche@acm.org>
* Copyright (C) 2009 - 2011 Bart Van Assche <bvanassche@acm.org>.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
@@ -37,25 +37,22 @@
#include <linux/types.h>
#include <linux/list.h>
#include <linux/wait.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_sa.h>
#include <rdma/ib_cm.h>
#include <scsi/srp.h>
#if defined(INSIDE_KERNEL_TREE)
#include <scst/scst.h>
#else
#include <linux/version.h>
#include <scst.h>
#endif
#include "ib_dm_mad.h"
/*
* The prefix the ServiceName field must start with in the device management
* ServiceEntries attribute pair. See also the SRP r16a document.
* ServiceEntries attribute pair. See also the SRP specification.
*/
#define SRP_SERVICE_NAME_PREFIX "SRP.T10:"
@@ -63,7 +60,7 @@ enum {
/*
* SRP IOControllerProfile attributes for SRP target ports that have
* not been defined in <scsi/srp.h>. Source: section B.7, table B.7
* in the SRP r16a document.
* in the SRP specification.
*/
SRP_PROTOCOL = 0x0108,
SRP_PROTOCOL_VERSION = 0x0001,
@@ -84,23 +81,23 @@ enum {
/*
* srp_cmd.sol_nt / srp_tsk_mgmt.sol_not bitmasks. See also tables
* 18 and 20 in the T10 r16a document.
* 18 and 20 in the SRP specification.
*/
SRP_SCSOLNT = 0x02, /* SCSOLNT = successful solicited notification */
SRP_UCSOLNT = 0x04, /* UCSOLNT = unsuccessful solicited notification */
/*
* srp_rsp.sol_not / srp_t_logout.sol_not bitmasks. See also tables
* 16 and 22 in the T10 r16a document.
* 16 and 22 in the SRP specification.
*/
SRP_SOLNT = 0x01, /* SOLNT = solicited notification */
/* See also table 24 in the T10 r16a document. */
/* See also table 24 in the SRP specification. */
SRP_TSK_MGMT_SUCCESS = 0x00,
SRP_TSK_MGMT_FUNC_NOT_SUPP = 0x04,
SRP_TSK_MGMT_FAILED = 0x05,
/* See also table 21 in the T10 r16a document. */
/* See also table 21 in the SRP specification. */
SRP_CMD_SIMPLE_Q = 0x0,
SRP_CMD_HEAD_OF_Q = 0x1,
SRP_CMD_ORDERED_Q = 0x2,
@@ -111,7 +108,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,
@@ -144,11 +140,19 @@ enum srpt_opcode {
};
static inline u64 encode_wr_id(enum srpt_opcode opcode, u32 idx)
{ return ((u64)opcode << 32) | idx; }
{
return ((u64)opcode << 32) | idx;
}
static inline enum srpt_opcode opcode_from_wr_id(u64 wr_id)
{ return wr_id >> 32; }
{
return wr_id >> 32;
}
static inline u32 idx_from_wr_id(u64 wr_id)
{ return (u32)wr_id; }
{
return (u32)wr_id;
}
struct rdma_iu {
u64 raddr;
@@ -165,18 +169,20 @@ struct rdma_iu {
* @SRPT_STATE_DATA_IN: Data for the write or bidir command arrived and is
* being processed.
* @SRPT_STATE_CMD_RSP_SENT: SRP_RSP for SRP_CMD has been sent.
* @SRPT_STATE_MGMT: Processing a SCSI task management command.
* @SRPT_STATE_MGMT_RSP_SENT: SRP_RSP for SRP_TSK_MGMT has been sent.
* @SRPT_STATE_DONE: Command processing finished successfully, command
* processing has been aborted or command processing
* failed.
*/
enum srpt_command_state {
SRPT_STATE_NEW = 0,
SRPT_STATE_NEED_DATA = 1,
SRPT_STATE_DATA_IN = 2,
SRPT_STATE_CMD_RSP_SENT = 3,
SRPT_STATE_MGMT_RSP_SENT = 4,
SRPT_STATE_DONE = 5,
SRPT_STATE_NEW = 0,
SRPT_STATE_NEED_DATA = 1,
SRPT_STATE_DATA_IN = 2,
SRPT_STATE_CMD_RSP_SENT = 3,
SRPT_STATE_MGMT = 4,
SRPT_STATE_MGMT_RSP_SENT = 5,
SRPT_STATE_DONE = 6,
};
/**
@@ -201,11 +207,37 @@ struct srpt_recv_ioctx {
struct list_head wait_list;
};
/**
* struct srpt_tsk_mgmt - SCST management command context information.
* @tag: SCSI tag of the management command.
*/
struct srpt_tsk_mgmt {
u64 tag;
};
/**
* struct srpt_send_ioctx - SRPT send I/O context.
* @ioctx: See above.
* @free_list: Allows to make this struct an entry in srpt_rdma_ch.free_list.
* @state: I/O context state. See also enum srpt_command_state.
* @ioctx: See above.
* @ch: Channel pointer.
* @rdma_ius: Array with information about the RDMA mapping.
* @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.
* @spinlock: Protects 'state'.
* @state: I/O context state.
* @rdma_aborted: If initiating a multipart RDMA transfer failed, whether
* the already initiated transfers have finished.
* @scmnd: SCST command data structure.
* @dir:
* @free_list: Node in srpt_rdma_ch.free_list.
* @sg_cnt: SG-list size.
* @mapped_sg_count: ib_dma_map_sg() return value.
* @n_rdma_ius: Size of the rdma_ius array.
* @n_rdma: Number of elements used of the rdma_ius array.
* @n_rbuf: Number of data buffers in the received SRP command.
* @req_lim_delta: Value of the req_lim_delta value field in the latest
* SRP response sent.
* @tsk_mgmt:
*/
struct srpt_send_ioctx {
struct srpt_ioctx ioctx;
@@ -215,26 +247,21 @@ struct srpt_send_ioctx {
struct srp_direct_buf single_rbuf;
struct scatterlist *sg;
struct list_head free_list;
spinlock_t spinlock;
enum srpt_command_state state;
bool rdma_aborted;
struct scst_cmd *scmnd;
scst_data_direction dir;
int sg_cnt;
int mapped_sg_count;
u16 n_rdma_ius;
u8 n_rdma;
u8 n_rbuf;
struct scst_cmd *scmnd;
scst_data_direction dir;
atomic_t state;
bool rdma_aborted;
};
/**
* struct srpt_mgmt_ioctx - SCST management command context information.
* @ioctx: SRPT I/O context associated with the management command.
* @tag: SCSI tag of the management command.
*/
struct srpt_mgmt_ioctx {
struct srpt_send_ioctx *ioctx;
u64 tag;
int req_lim_delta;
struct srpt_tsk_mgmt tsk_mgmt;
u8 rdma_ius_buf[2 * sizeof(struct rdma_iu)
+ 2 * sizeof(struct ib_sge)]
__aligned(sizeof(uint64_t));
};
/**
@@ -244,15 +271,13 @@ struct srpt_mgmt_ioctx {
* @CH_DISCONNECTING: DREQ has been received and waiting for DREP or DREQ has
* been sent and waiting for DREP or channel is being closed
* for another reason.
* @CH_DRAINING: QP is in ERR state; waiting for last WQE event.
* @CH_RELEASING: Last WQE event has been received; releasing resources.
* @CH_DRAINING: QP is in ERR state.
*/
enum rdma_ch_state {
CH_CONNECTING,
CH_LIVE,
CH_DISCONNECTING,
CH_DRAINING,
CH_RELEASING
};
/**
@@ -260,25 +285,30 @@ enum rdma_ch_state {
* @thread: Kernel thread that processes the IB queues associated with
* the channel.
* @cm_id: IB CM ID associated with the channel.
* @rq_size: IB receive queue size.
* @qp: IB queue pair used for communicating over this channel.
* @sq_wr_avail: number of work requests available in the send queue.
* @cq: IB completion queue for this channel.
* @rq_size: IB receive queue size.
* @max_sge: Maximum length of RDMA scatter list.
* @sq_wr_avail: number of work requests available in the send queue.
* @sport: pointer to the information of the HCA port used by this
* channel.
* @i_port_id: 128-bit initiator port identifier copied from SRP_LOGIN_REQ.
* @t_port_id: 128-bit target port identifier copied from SRP_LOGIN_REQ.
* @max_ti_iu_len: maximum target-to-initiator information unit length.
* @supports_cred_req: whether or not the initiator supports SRP_CRED_REQ.
* @req_lim: request limit: maximum number of requests that may be sent
* by the initiator without having received a response.
* @req_lim_delta: One less than the req_lim_delta value that will be included
* in the next reply sent to the initiator. See also the SRP
* credit algorithm in the SRP spec.
* @spinlock: Protects free_list.
* @free_list: Head of list with free send I/O contexts.
* @ioctx_ring:
* @wc:
* @state: channel state. See also enum rdma_ch_state.
* @list: node for insertion in the srpt_device.rch_list list.
* @cmd_wait_list: list of SCST commands that arrived before the RTU event. This
* list contains struct srpt_ioctx elements and is protected
* against concurrent modification by the cm_id spinlock.
* @spinlock: Protects free_list.
* @free_list: Head of list with free send I/O contexts.
* @scst_sess: SCST session information associated with this SRP channel.
* @sess_name: SCST session name.
*/
@@ -286,25 +316,26 @@ struct srpt_rdma_ch {
struct task_struct *thread;
struct ib_cm_id *cm_id;
struct ib_qp *qp;
int rq_size;
struct ib_cq *cq;
atomic_t sq_wr_avail;
int rq_size;
int max_sge;
int max_rsp_size;
int sq_wr_avail;
struct srpt_port *sport;
u8 i_port_id[16];
u8 t_port_id[16];
int max_ti_iu_len;
atomic_t req_lim;
atomic_t req_lim_delta;
int req_lim;
int req_lim_delta;
spinlock_t spinlock;
struct list_head free_list;
struct srpt_send_ioctx **ioctx_ring;
struct ib_wc wc[16];
atomic_t state;
enum rdma_ch_state state;
wait_queue_head_t state_wq;
struct list_head list;
struct list_head cmd_wait_list;
bool last_wqe_received;
struct work_struct unreg_work;
struct scst_session *scst_sess;
u8 sess_name[36];
@@ -332,45 +363,47 @@ struct srpt_port {
/**
* struct srpt_device - Information associated by SRPT with a single HCA.
* @device: backpointer to the struct ib_device managed by the IB core.
* @device: Backpointer to the struct ib_device managed by the IB core.
* @pd: IB protection domain.
* @mr: L_Key (local key) with write access to all local memory.
* @srq: Per-HCA SRQ (shared receive queue).
* @cm_id: connection identifier.
* @dev_attr: attributes of the InfiniBand device as obtained during the
* @cm_id: Connection identifier.
* @dev_attr: Attributes of the InfiniBand device as obtained during the
* ib_client.add() callback.
* @ioctx_ring: Per-HCA I/O context ring.
* @rch_list: per-device channel list -- see also srpt_rdma_ch.list.
* @spinlock: protects rch_list.
* @srpt_port: information about the ports owned by this HCA.
* @event_handler: per-HCA asynchronous IB event handler.
* @dev: per-port srpt-<portname> device instance.
* @srq_size: SRQ size.
* @ioctx_ring: Per-HCA SRQ.
* @rch_list: Per-device channel list -- see also srpt_rdma_ch.list.
* @ch_releaseQ: Enables waiting for removal from rch_list.
* @spinlock: Protects rch_list.
* @port: Information about the ports owned by this HCA.
* @event_handler: Per-HCA asynchronous IB event handler.
* @dev: Per-port srpt-<portname> device instance.
* @scst_tgt: SCST target information associated with this HCA.
* @enabled: Whether or not this SCST target is enabled.
*/
struct srpt_device {
struct ib_device *device;
struct ib_pd *pd;
struct ib_mr *mr;
struct ib_srq *srq;
struct ib_cm_id *cm_id;
struct ib_device_attr dev_attr;
int srq_size;
struct srpt_recv_ioctx **ioctx_ring;
struct list_head rch_list;
wait_queue_head_t ch_releaseQ;
spinlock_t spinlock;
struct srpt_port port[2];
struct ib_event_handler event_handler;
struct ib_device *device;
struct ib_pd *pd;
struct ib_mr *mr;
struct ib_srq *srq;
struct ib_cm_id *cm_id;
struct ib_device_attr dev_attr;
int srq_size;
struct srpt_recv_ioctx **ioctx_ring;
struct list_head rch_list;
wait_queue_head_t ch_releaseQ;
spinlock_t spinlock;
struct srpt_port port[2];
struct ib_event_handler event_handler;
#ifdef CONFIG_SCST_PROC
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
struct class_device dev;
struct class_device dev;
#else
struct device dev;
struct device dev;
#endif
#endif /*CONFIG_SCST_PROC*/
struct scst_tgt *scst_tgt;
bool enabled;
struct scst_tgt *scst_tgt;
bool enabled;
};
#endif /* IB_SRPT_H */