Merged revisions 5667-5670,5672-5686,5698,5700-5722,5724-5737 via svnmerge from

svn+ssh://yanb123@svn.code.sf.net/p/scst/svn/trunk

........
  r5667 | bvassche | 2014-07-08 18:11:58 +0300 (Tue, 08 Jul 2014) | 1 line
  
  nightly build: Update kernel versions
........
  r5668 | vlnb | 2014-07-10 04:00:29 +0300 (Thu, 10 Jul 2014) | 3 lines
  
  Make SCST interface compatibility more robust
........
  r5669 | bvassche | 2014-07-10 09:17:57 +0300 (Thu, 10 Jul 2014) | 1 line
  
  scst/Makefile: Create /var/lib/scst/vdev_mode_pages while installing SCST
........
  r5670 | bvassche | 2014-07-10 09:18:58 +0300 (Thu, 10 Jul 2014) | 1 line
  
  scst.spec.in: Create /var/lib/scst/pr and /var/lib/scst/vdev_mode_pages when installing the SCST RPM
........
  r5672 | bvassche | 2014-07-10 15:29:59 +0300 (Thu, 10 Jul 2014) | 2 lines
  
  scripts/rebuild-rhel-kernel-rpm: Move code for downloading a RHEL (clone) RPM into a separate file
........
  r5673 | bvassche | 2014-07-11 09:48:49 +0300 (Fri, 11 Jul 2014) | 1 line
  
  scripts/generate-kernel-patch: Also generate scst-itf-ver.h
........
  r5674 | bvassche | 2014-07-11 10:54:19 +0300 (Fri, 11 Jul 2014) | 1 line
  
  scripts/generate-kernel-patch: Remove trailing whitespace
........
  r5675 | vlnb | 2014-07-12 03:53:46 +0300 (Sat, 12 Jul 2014) | 3 lines
  
  BLOCKIO microoptimization: use per-device biosets
........
  r5676 | bvassche | 2014-07-13 10:15:05 +0300 (Sun, 13 Jul 2014) | 1 line
  
  nightly build: Update kernel versions
........
  r5677 | vlnb | 2014-07-16 06:27:20 +0300 (Wed, 16 Jul 2014) | 3 lines
  
  Install scst_itf_ver.h as well
........
  r5678 | bvassche | 2014-07-16 08:35:40 +0300 (Wed, 16 Jul 2014) | 1 line
  
  scst-devel rpm: Include /usr/include/scst/scst_itf_ver.h
........
  r5679 | bvassche | 2014-07-16 11:29:16 +0300 (Wed, 16 Jul 2014) | 6 lines
  
  ib_srpt: Fix Mellanox OFED build
  
  Use the proper include directory when building against Mellanox OFED.
  Do not require to remove /lib/modules/$(KVER)/kernel/drivers/infiniband
  before building ib_srpt.
........
  r5680 | bvassche | 2014-07-18 12:27:41 +0300 (Fri, 18 Jul 2014) | 1 line
  
  srpt/Makefile: Remove a superfluous assignment statement
........
  r5681 | bvassche | 2014-07-18 12:28:22 +0300 (Fri, 18 Jul 2014) | 1 line
  
  srpt/Makefile: SLES + Mellanox OFED build fix
........
  r5682 | bvassche | 2014-07-18 12:30:25 +0300 (Fri, 18 Jul 2014) | 1 line
  
  srpt/README: Fix SLES patch instructions
........
  r5683 | vlnb | 2014-07-19 06:54:33 +0300 (Sat, 19 Jul 2014) | 11 lines
  
  iscsi-scst: Handle data buffers with non-zero offset correctly
  
  Start at the proper offset in the receive buffer if sg[0].offset != 0.
  Return the proper data to the initiator if sg[0].offset != 0.
  
  This patch reworks trunk r5281, "iscsi-scst: fix offset
  calculation", February 13, 2014.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5684 | vlnb | 2014-07-19 07:08:30 +0300 (Sat, 19 Jul 2014) | 10 lines
  
  scst: Clean up scst_process_active_cmd()
  
  Since inside scst_process_active_cmd() cmd->state can only change after
  cmd has been added back to the command list it is safe to perform the
  cmd->state check without holding the command list lock. Hence move the
  perform the cmd->state check without holding the command list lock.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5685 | vlnb | 2014-07-19 07:11:39 +0300 (Sat, 19 Jul 2014) | 7 lines
  
  scst: Introduce scst_set_thr_cpu_mask()
  
  This patch does not change any functionality.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5686 | vlnb | 2014-07-19 07:13:24 +0300 (Sat, 19 Jul 2014) | 8 lines
  
  scst_vdisk: Micro-optimize the zero-copy check
  
  Only evaluate the SCSI command type if virt_dev->zero_copy has been
  set instead of always checking the SCSI command type.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5698 | bvassche | 2014-07-20 11:37:58 +0300 (Sun, 20 Jul 2014) | 1 line
  
  nightly build: Update kernel versions
........
  r5700 | vlnb | 2014-07-22 02:04:18 +0300 (Tue, 22 Jul 2014) | 3 lines
  
  Web updates
........
  r5701 | vlnb | 2014-07-22 03:22:06 +0300 (Tue, 22 Jul 2014) | 8 lines
  
  scst: Make scst_cmd_threads.threads_list locking more fine-grained
  
  Introduce a new synchronization object, namely scst_cmd_threads.thr_lock,
  to protect scst_cmd_threads.threads_list.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5702 | vlnb | 2014-07-23 05:00:06 +0300 (Wed, 23 Jul 2014) | 7 lines
  
  Prevent possible collisions between saved PR and mode pages backup files
  
  From now on '.' is illegal character in SCST device names
  
  Reported-by Ken Raeburn <raeburn@permabit.com>
........
  r5703 | vlnb | 2014-07-23 05:49:50 +0300 (Wed, 23 Jul 2014) | 5 lines
  
  Review of host_status handling (pass-through mode)
  
  Inspired by Dave Butler <tears.the@gmail.com> and Bart Van Assche <bvanassche@acm.org>
........
  r5704 | vlnb | 2014-07-26 03:04:51 +0300 (Sat, 26 Jul 2014) | 3 lines
  
  Internal REQUEST SENSE: NO SENSE is also valid sense
........
  r5705 | vlnb | 2014-07-29 02:11:14 +0300 (Tue, 29 Jul 2014) | 3 lines
  
  Print initiator and target in the abort messages
........
  r5706 | vlnb | 2014-07-30 05:27:10 +0300 (Wed, 30 Jul 2014) | 3 lines
  
  Minor logging improvements
........
  r5707 | vlnb | 2014-07-30 05:52:26 +0300 (Wed, 30 Jul 2014) | 3 lines
  
  Follow up for r5704: NO SENSE is also valid sense
........
  r5708 | vlnb | 2014-07-30 05:53:07 +0300 (Wed, 30 Jul 2014) | 3 lines
  
  Minor fix
........
  r5709 | bvassche | 2014-08-06 20:40:30 +0300 (Wed, 06 Aug 2014) | 1 line
  
  nightly build: Update kernel versions
........
  r5710 | bvassche | 2014-08-07 10:20:08 +0300 (Thu, 07 Aug 2014) | 1 line
  
  RHEL 7: Add scst_exec_req_fifo and put_page_callback patches
........
  r5711 | bvassche | 2014-08-07 11:12:22 +0300 (Thu, 07 Aug 2014) | 1 line
  
  Rename the two RHEL 7 scst_exec_req_fifo patches
........
  r5712 | bvassche | 2014-08-07 11:38:19 +0300 (Thu, 07 Aug 2014) | 1 line
  
  scripts/rebuild-rhel-kernel-rpm: Add RHEL 7 support
........
  r5713 | bvassche | 2014-08-08 13:37:17 +0300 (Fri, 08 Aug 2014) | 1 line
  
  nightly build: Update kernel versions
........
  r5714 | bvassche | 2014-08-09 14:02:19 +0300 (Sat, 09 Aug 2014) | 1 line
  
  scripts/rebuild-rhel-kernel-rpm: Install more prerequisites
........
  r5715 | bvassche | 2014-08-15 10:49:07 +0300 (Fri, 15 Aug 2014) | 1 line
  
  nightly build: Update kernel versions
........
  r5716 | vlnb | 2014-08-16 02:44:33 +0300 (Sat, 16 Aug 2014) | 3 lines
  
  Fix blockio bioset for older kernels, which need explicit bio destructors
........
  r5717 | vlnb | 2014-08-20 00:52:31 +0300 (Wed, 20 Aug 2014) | 3 lines
  
  Update for kernels 3.16
........
  r5718 | vlnb | 2014-08-20 05:24:08 +0300 (Wed, 20 Aug 2014) | 12 lines
  
  Fix Coverity warning of q2t_ctio_to_cmd() dead code
  
  Coverity warns that 'handle == Q2T_SKIP_HANDLE' can never occur, because
  code preceding the test has masked out a handle bit that would be
  required for the test to succeed.
  
  Fix that by extending Q2T_SKIP_HANDLE to incorporate
  CTIO_INTERMEDIATE_HANDLE_MARK as well.
  
  Reported-by: Steven J. Magnani <steve@digidescorp.com>
........
  r5719 | bvassche | 2014-08-20 09:55:04 +0300 (Wed, 20 Aug 2014) | 1 line
  
  nightly build: Add kernel 3.16 nightly build infrastructure
........
  r5720 | bvassche | 2014-08-20 09:57:04 +0300 (Wed, 20 Aug 2014) | 1 line
  
  nightly build: Add kernel version 3.16.1
........
  r5721 | vlnb | 2014-08-21 08:17:47 +0300 (Thu, 21 Aug 2014) | 5 lines
  
  Fix incorrect address computation during receive PDUs preparations
  
  Found and fix suggested by Кирилл Тюшев <kirill.tyushev8@gmail.com>
........
  r5722 | vlnb | 2014-08-21 08:18:43 +0300 (Thu, 21 Aug 2014) | 3 lines
  
  Integration of the QLogic git's qla2x00t into the SCST tree
........
  r5724 | bvassche | 2014-08-22 10:19:55 +0300 (Fri, 22 Aug 2014) | 9 lines
  
  Fix a kernel 3.16 checkpatch complaint about trailing semicolons
  
  Avoid that the checkpatch tool included in Linux kernel v3.16 reports the
  following warning:
  
      macros should not use a trailing semicolon
  
  This patch does not change any functionality.
........
  r5725 | bvassche | 2014-08-25 14:36:33 +0300 (Mon, 25 Aug 2014) | 1 line
  
  ib_srpt: Kernel v3.17 build fix
........
  r5726 | bvassche | 2014-08-25 14:41:55 +0300 (Mon, 25 Aug 2014) | 1 line
  
  ib_srpt: Log QPN next to session name
........
  r5727 | bvassche | 2014-08-25 14:46:43 +0300 (Mon, 25 Aug 2014) | 6 lines
  
  ib_srpt: Speed up kernel driver unloading after a cable pull
  
  When unloading the ib_srpt kernel module, instead of waiting until
  all connected queue pairs have left the TimeWait state, destroy
  these queue pairs immediately.
........
  r5728 | bvassche | 2014-08-25 15:50:19 +0300 (Mon, 25 Aug 2014) | 8 lines
  
  ib_srpt: Make the completion vector configurable
  
  Allow a set of completion vectors to be associated with each InfiniBand
  HCA port and allocate the completion vector for each session in a
  round-robin fashion from the per-port set. This helps to spread the
  InfiniBand interrupt workload over multiple CPU's, at least if different
  InfiniBand MSI-X vectors are associated with different CPU's.
........
  r5729 | vlnb | 2014-08-26 06:21:07 +0300 (Tue, 26 Aug 2014) | 7 lines
  
  scst_vdisk: Make vdisk_sup_vpd() easier to extend
  
  This patch doesn't change any functionality.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5730 | vlnb | 2014-08-26 06:44:23 +0300 (Tue, 26 Aug 2014) | 12 lines
  
  scst_vdisk: Make EUI-64 and NAA IDs configurable
  
  Make the SCSI device identification page (83h) EUI-64 and NAA
  IDs configurable. If neither the eui64_id nor the naa_id sysfs
  attribute has been set, export the first eight bytes of the
  t10_dev_id as an EUI-64 ID. If the NAA ID but not the EUI-64 ID
  has been set, report the NAA ID only. If both IDs have been set,
  report both.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5731 | bvassche | 2014-08-26 12:56:54 +0300 (Tue, 26 Aug 2014) | 1 line
  
  scstadmin: Avoid that the Perl interpreter prints a warning message about using an undefined variable on Fedora systems
........
  r5732 | vlnb | 2014-08-27 05:41:40 +0300 (Wed, 27 Aug 2014) | 9 lines
  
  iscsi-scst: Build fix for IPV6=n
  
  Ensure that iscsi-scst builds properly against a kernel with CONFIG_IPV6=n.
  
  Reported by Igor Novgorodov <igor@novg.net> on June 7, 2014.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5733 | vlnb | 2014-08-27 05:42:35 +0300 (Wed, 27 Aug 2014) | 9 lines
  
  scst_pres: Make a few error messages more clear
  
  Make it possible to figure out what went wrong from inspecting the
  system log only by mentioning the incorrect filename in the system
  log.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5734 | vlnb | 2014-08-27 05:43:50 +0300 (Wed, 27 Aug 2014) | 8 lines
  
  scst: Remove set_cpus_allowed() invocations
  
  Since scst.h contains a backport of the definition of set_cpus_allowed_ptr(),
  the set_cpus_allowed() invocations are superfluous. Hence remove these.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5735 | vlnb | 2014-08-27 05:55:28 +0300 (Wed, 27 Aug 2014) | 8 lines
  
  iscsi-scst: Micro-optimize cmnd_prepare_recv_pdu()
  
  Instead of adding sg[idx].offset to addr and immediately subtracting
  sg[idx].offset again, leave out both arithmetic operations.
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5736 | vlnb | 2014-08-27 06:00:44 +0300 (Wed, 27 Aug 2014) | 5 lines
  
  scst/include/scst.h: Document on_abort_cmd() further
  
  Signed-off-by: Bart Van Assche <bvanassche@acm.org>
........
  r5737 | bvassche | 2014-08-27 09:33:02 +0300 (Wed, 27 Aug 2014) | 1 line
  
  scst_vdisk: Build fix for kernel 3.1.x
........


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5738 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Yan Burman
2014-08-27 13:26:02 +00:00
parent e4c7d430c1
commit d7e6569b1a
45 changed files with 3060 additions and 310 deletions
+15 -14
View File
@@ -11,7 +11,6 @@ SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \
SCST_SYMVERS_DIR := $(shell if [ -e $$PWD/../scst ]; then \
echo $$PWD/../scst/src; \
else echo $(DESTDIR)$(PREFIX)/include/scst; fi)
SUBDIRS := $(shell pwd)
ifeq ($(KVER),)
ifeq ($(KDIR),)
@@ -61,18 +60,21 @@ ifeq ($(OFED_KERNEL_IB_RPM),compat-rdma)
OFED_KERNEL_DIR:=/usr/src/compat-rdma
OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include
else
OFED_KERNEL_DIR:=/usr/src/ofa_kernel
ifeq ($(OFED_FLAVOR),MOFED)
# Mellanox OFED with or without kernel-ib RPM
OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include
# Mellanox OFED with or without kernel-ib RPM. Since several MOFED backport
# header files use the LINUX_BACKPORT() macro without including
# <linux/compat-2.6.h>, include that header file explicitly.
OFED_KERNEL_DIR:=/usr/src/ofa_kernel/default
OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include -include linux/compat-2.6.h
else
# OFED 1.5
OFED_KERNEL_DIR:=/usr/src/ofa_kernel
include $(OFED_KERNEL_DIR)/config.mk
OFED_CFLAGS:=$(BACKPORT_INCLUDES) -I$(OFED_KERNEL_DIR)/include
endif
endif
# Any OFED version
OFED_MODULE_SYMVERS:=$(OFED_KERNEL_DIR)/Module.symvers
OFED_MODULE_SYMVERS:=$(OFED_KERNEL_DIR)/$(MODULE_SYMVERS)
endif
HAVE_KCFLAGS = $(shell $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/conftest/kcflags KCFLAGS=-DKCFLAGS_MACRO=1 >/dev/null 2>&1 && echo true || echo false)
@@ -98,7 +100,8 @@ uninstall:
rm -f $(INSTALL_DIR)/ib_srpt.ko
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
src/Module.symvers src/Modules.symvers: $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS)
src/$(MODULE_SYMVERS): $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS) \
$(OFED_MODULE_SYMVERS)
@if [ "$(HAVE_KCFLAGS)" = false -a "$(HAVE_PRE_CFLAGS)" = false -a \
-n "$(AUTOCONF_FLAGS)" ]; then \
echo "Error: the kernel build system has not yet been patched.";\
@@ -109,11 +112,6 @@ src/Module.symvers src/Modules.symvers: $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS)
echo "Error: the OFED package $(OFED_KERNEL_IB_RPM)-devel has" \
"not yet been installed."; \
false; \
elif [ -e /lib/modules/$(KVER)/kernel/drivers/infiniband ]; then \
echo "Error: the distro-provided InfiniBand kernel drivers" \
"must be removed first" \
" (/lib/modules/$(KVER)/kernel/drivers/infiniband)."; \
false; \
elif [ "$(HAVE_PRE_CFLAGS)" = false ]; then \
echo "Error: the kernel build system has not yet been patched.";\
false; \
@@ -121,7 +119,11 @@ src/Module.symvers src/Modules.symvers: $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS)
echo " Building against $(OFED_FLAVOR) $(OFED_KERNEL_IB_RPM)" \
"InfiniBand kernel headers."; \
( \
grep -v drivers/infiniband/ $<; \
cat $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS) | \
grep -v 'drivers/infiniband/' | \
grep -v 'net/sunrpc/xprtrdma/' | \
grep -v 'net/rds/' | \
grep -v 'extra/ib_srpt'; \
cat $(OFED_MODULE_SYMVERS) \
) >$@; \
fi \
@@ -138,8 +140,7 @@ src/Module.symvers src/Modules.symvers: $(SCST_SYMVERS_DIR)/$(MODULE_SYMVERS)
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)/src clean
rm -f src/Modules.symvers src/Module.symvers src/Module.markers \
src/modules.order
rm -f src/$(MODULE_SYMVERS) src/Module.markers src/modules.order
extraclean: clean
rm -f *.orig *.rej
+1 -1
View File
@@ -61,7 +61,7 @@ the variable PRE_CFLAGS:
if [ -e /lib/modules/$(uname -r)/build/scripts/Makefile.lib ]; then
cd /lib/modules/$(uname -r)/build
else
cd /usr/src/linux-$(uname -r)
cd /usr/src/linux-$(uname -r | sed 's/\(-default\|-trace\|-xen\)$//;s/\.[0-9]\+\.[0-9]\+\.[0-9]\+\.PTF$//')
fi
patch -p1 < ${SCST_DIR}/srpt/patches/kernel-${KV}-pre-cflags.patch
+12
View File
@@ -0,0 +1,12 @@
diff --git a/Makefile b/Makefile
index 540f7b2..078307f 100644
--- a/Makefile
+++ b/Makefile
@@ -361,6 +361,7 @@ USERINCLUDE := \
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
LINUXINCLUDE := \
+ $(PRE_CFLAGS) \
-I$(srctree)/arch/$(hdr-arch)/include \
-Iarch/$(hdr-arch)/include/generated \
$(if $(KBUILD_SRC), -I$(srctree)/include) \
+153 -31
View File
@@ -348,8 +348,8 @@ static const char *get_ch_state_name(enum rdma_ch_state s)
*/
static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
{
TRACE_DBG("QP event %d on ch=%p sess_name=%s state=%s",
event->event, ch, ch->sess_name,
TRACE_DBG("QP event %d on ch=%p sess_name=%s-%d state=%s",
event->event, ch, ch->sess_name, ch->qp->qp_num,
get_ch_state_name(ch->state));
switch (event->event) {
@@ -366,8 +366,9 @@ static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
#endif
break;
case IB_EVENT_QP_LAST_WQE_REACHED:
TRACE_DBG("%s, state %s: received Last WQE event.",
ch->sess_name, get_ch_state_name(ch->state));
TRACE_DBG("%s-%d, state %s: received Last WQE event.",
ch->sess_name, ch->qp->qp_num,
get_ch_state_name(ch->state));
break;
default:
PRINT_ERROR("received unrecognized IB QP event %d",
@@ -690,7 +691,11 @@ static int srpt_refresh_port(struct srpt_port *sport)
&reg_req, 0,
srpt_mad_send_handler,
srpt_mad_recv_handler,
sport);
sport
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
, 0
#endif
);
if (IS_ERR(sport->mad_agent)) {
ret = PTR_ERR(sport->mad_agent);
sport->mad_agent = NULL;
@@ -1941,8 +1946,8 @@ static void srpt_process_send_completion(struct ib_cq *cq,
srpt_handle_rdma_comp(ch, ch->ioctx_ring[index], opcode,
srpt_xmt_rsp_context);
} else if (opcode == SRPT_RDMA_ZEROLENGTH_WRITE) {
WARN_ONCE(true, "%s: QP not in error state\n",
ch->sess_name);
WARN_ONCE(true, "%s-%d: QP not in error state\n",
ch->sess_name, ch->qp->qp_num);
WARN_ON_ONCE(!srpt_set_ch_state(ch, CH_DISCONNECTED));
} else {
WARN(true, "unexpected opcode %d\n", opcode);
@@ -2096,8 +2101,8 @@ static int srpt_compl_thread(void *arg)
}
set_current_state(TASK_RUNNING);
TRACE_DBG("ch %s: about to invoke scst_unregister_session()",
ch->sess_name);
TRACE_DBG("%s-%d: about to invoke scst_unregister_session()",
ch->sess_name, ch->qp->qp_num);
scst_unregister_session(ch->scst_sess, false, srpt_unreg_sess);
while (!kthread_should_stop())
@@ -2128,12 +2133,12 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
ch->rq_size + srpt_sq_size);
#else
ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
ch->rq_size + srpt_sq_size, 0);
ch->rq_size + srpt_sq_size, ch->comp_vector);
#endif
if (IS_ERR(ch->cq)) {
ret = PTR_ERR(ch->cq);
PRINT_ERROR("failed to create CQ cqe= %d ret= %d",
ch->rq_size + srpt_sq_size, ret);
PRINT_ERROR("failed to create CQ: cqe %d; c.v. %d; ret %d",
ch->rq_size + srpt_sq_size, ch->comp_vector, ret);
goto out;
}
@@ -2227,13 +2232,13 @@ static bool srpt_close_ch(struct srpt_rdma_ch *ch)
ret = srpt_ch_qp_err(ch);
if (ret < 0)
PRINT_ERROR("%s: changing queue pair into error state"
" failed: %d", ch->sess_name, ret);
PRINT_ERROR("%s-%d: changing queue pair into error state"
" failed: %d", ch->sess_name, ch->qp->qp_num, ret);
ret = srpt_zerolength_write(ch);
if (ret < 0) {
PRINT_ERROR("%s: queuing zero-length write failed: %d",
ch->sess_name, ret);
PRINT_ERROR("%s-%d: queuing zero-length write failed: %d",
ch->sess_name, ch->qp->qp_num, ret);
WARN_ON_ONCE(!srpt_set_ch_state(ch, CH_DISCONNECTED));
}
@@ -2281,15 +2286,28 @@ static void __srpt_close_all_ch(struct srpt_tgt *srpt_tgt)
list_for_each_entry(nexus, &srpt_tgt->nexus_list, entry) {
list_for_each_entry(ch, &nexus->ch_list, list) {
if (srpt_disconnect_ch(ch) < 0)
continue;
PRINT_INFO("Closing channel %s because target %s has"
" been disabled", ch->sess_name,
srpt_tgt->scst_tgt->tgt_name);
if (srpt_disconnect_ch(ch) >= 0)
PRINT_INFO("Closing channel %s-%d because"
" target %s has been disabled",
ch->sess_name, ch->qp->qp_num,
srpt_tgt->scst_tgt->tgt_name);
srpt_close_ch(ch);
}
}
}
static struct srpt_device *srpt_convert_to_sdev(struct scst_tgt *scst_tgt)
{
struct srpt_port *sport;
if (one_target_per_port) {
sport = scst_tgt_get_tgt_priv(scst_tgt);
return sport ? sport->sdev : NULL;
} else {
return scst_tgt_get_tgt_priv(scst_tgt);
}
}
static struct srpt_tgt *srpt_convert_scst_tgt(struct scst_tgt *scst_tgt)
{
struct srpt_device *sdev;
@@ -2388,6 +2406,26 @@ static bool srpt_is_target_enabled(struct scst_tgt *scst_tgt)
}
#endif
/*
* srpt_next_comp_vector() - Next completion vector >= srpt_tgt->comp_vector
*/
static u8 srpt_next_comp_vector(struct srpt_tgt *srpt_tgt)
{
u8 comp_vector;
mutex_lock(&srpt_tgt->mutex);
comp_vector = find_next_bit(srpt_tgt->comp_v_mask, COMP_V_MASK_SIZE,
srpt_tgt->comp_vector);
if (comp_vector >= COMP_V_MASK_SIZE)
comp_vector = find_next_bit(srpt_tgt->comp_v_mask,
COMP_V_MASK_SIZE, 0);
sBUG_ON(comp_vector >= COMP_V_MASK_SIZE);
srpt_tgt->comp_vector = comp_vector + 1;
mutex_unlock(&srpt_tgt->mutex);
return comp_vector;
}
/**
* srpt_cm_req_recv() - Process the event IB_CM_REQ_RECEIVED.
*
@@ -2550,6 +2588,8 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,
list_add_tail(&ch->ioctx_ring[i]->free_list, &ch->free_list);
}
ch->comp_vector = srpt_next_comp_vector(srpt_tgt);
ret = srpt_create_ch_ib(ch);
if (ret) {
rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
@@ -2829,7 +2869,8 @@ static int srpt_rdma_cm_req_recv(struct rdma_cm_id *cm_id,
static void srpt_cm_rej_recv(struct srpt_rdma_ch *ch)
{
PRINT_INFO("Received CM REJ for ch %s.", ch->sess_name);
PRINT_INFO("Received CM REJ for ch %s-%d.", ch->sess_name,
ch->qp->qp_num);
}
static void srpt_check_timeout(struct srpt_rdma_ch *ch)
@@ -2856,9 +2897,9 @@ static void srpt_check_timeout(struct srpt_rdma_ch *ch)
do_div(max_compl_time_ms, 1000000);
T_tr_ms = T_tr_ns;
do_div(T_tr_ms, 1000000);
TRACE_DBG("Session %s: QP local ack timeout = %d or T_tr ="
TRACE_DBG("%s-%d: QP local ack timeout = %d or T_tr ="
" %u ms; retry_cnt = %d; max compl. time = %d ms",
ch->sess_name, attr.timeout, T_tr_ms,
ch->sess_name, ch->qp->qp_num, attr.timeout, T_tr_ms,
attr.retry_cnt, (unsigned)max_compl_time_ms);
if (max_compl_time_ms >= RDMA_COMPL_TIMEOUT_S * 1000) {
@@ -2882,7 +2923,8 @@ static void srpt_cm_rtu_recv(struct srpt_rdma_ch *ch)
ret = ch->using_rdma_cm ? 0 : srpt_ch_qp_rts(ch, ch->qp);
if (ret < 0) {
PRINT_ERROR("%s: QP transition to RTS failed", ch->sess_name);
PRINT_ERROR("%s-%d: QP transition to RTS failed",
ch->sess_name, ch->qp->qp_num);
srpt_close_ch(ch);
return;
}
@@ -2895,19 +2937,21 @@ static void srpt_cm_rtu_recv(struct srpt_rdma_ch *ch)
* already been invoked from another thread.
*/
if (!srpt_set_ch_state(ch, CH_LIVE))
PRINT_ERROR("%s: Channel transition to LIVE state failed",
ch->sess_name);
PRINT_ERROR("%s-%d: channel transition to LIVE state failed",
ch->sess_name, ch->qp->qp_num);
}
static void srpt_cm_timewait_exit(struct srpt_rdma_ch *ch)
{
PRINT_INFO("Received CM TimeWait exit for ch %s.", ch->sess_name);
PRINT_INFO("Received CM TimeWait exit for ch %s-%d.", ch->sess_name,
ch->qp->qp_num);
srpt_close_ch(ch);
}
static void srpt_cm_rep_error(struct srpt_rdma_ch *ch)
{
PRINT_INFO("Received CM REP error for ch %s.", ch->sess_name);
PRINT_INFO("Received CM REP error for ch %s-%d.", ch->sess_name,
ch->qp->qp_num);
}
/**
@@ -2924,7 +2968,8 @@ static int srpt_cm_dreq_recv(struct srpt_rdma_ch *ch)
*/
static void srpt_cm_drep_recv(struct srpt_rdma_ch *ch)
{
PRINT_INFO("Received CM DREP message for ch %s.", ch->sess_name);
PRINT_INFO("Received CM DREP message for ch %s-%d.", ch->sess_name,
ch->qp->qp_num);
srpt_close_ch(ch);
}
@@ -3714,8 +3759,9 @@ static int srpt_release_sport(struct srpt_tgt *srpt_tgt)
mutex_lock(&srpt_tgt->mutex);
list_for_each_entry(nexus, &srpt_tgt->nexus_list, entry) {
list_for_each_entry(ch, &nexus->ch_list, list) {
PRINT_INFO("%s: state %s; %d commands in"
PRINT_INFO("%s-%d: state %s; %d commands in"
" progress", ch->sess_name,
ch->qp->qp_num,
get_ch_state_name(ch->state),
atomic_read(&ch->scst_sess->sess_cmd_count));
}
@@ -3770,6 +3816,57 @@ static uint16_t srpt_get_scsi_transport_version(struct scst_tgt *scst_tgt)
}
#if !defined(CONFIG_SCST_PROC)
static ssize_t show_comp_v_mask(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
struct scst_tgt *scst_tgt = container_of(kobj, struct scst_tgt,
tgt_kobj);
struct srpt_tgt *srpt_tgt = srpt_convert_scst_tgt(scst_tgt);
int res = -E_TGT_PRIV_NOT_YET_SET;
if (!srpt_tgt)
goto out;
res = sprintf(buf, "%#lx\n%s", srpt_tgt->comp_v_mask[0],
SCST_SYSFS_KEY_MARK "\n");
out:
return res;
}
static ssize_t store_comp_v_mask(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf,
size_t count)
{
struct scst_tgt *scst_tgt = container_of(kobj, struct scst_tgt,
tgt_kobj);
struct srpt_tgt *srpt_tgt = srpt_convert_scst_tgt(scst_tgt);
struct srpt_device *sdev = srpt_convert_to_sdev(scst_tgt);
int res = -E_TGT_PRIV_NOT_YET_SET;
unsigned long mask;
if (!srpt_tgt)
goto out;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buf, 16, &mask);
#else
res = strict_strtoul(buf, 16, &mask);
#endif
if (res)
goto out;
res = -EINVAL;
if (mask == 0 || mask >= (1ULL << sdev->device->num_comp_vectors))
goto out;
srpt_tgt->comp_v_mask[0] = mask;
res = count;
out:
return res;
}
static struct kobj_attribute srpt_show_comp_v_mask_attr =
__ATTR(comp_v_mask, S_IRUGO | S_IWUSR, show_comp_v_mask,
store_comp_v_mask);
static ssize_t srpt_show_device(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
@@ -3861,6 +3958,7 @@ static struct kobj_attribute srpt_show_login_info_attr =
__ATTR(login_info, S_IRUGO, show_login_info, NULL);
static const struct attribute *srpt_tgt_attrs[] = {
&srpt_show_comp_v_mask_attr.attr,
&srpt_device_attr.attr,
&srpt_show_login_info_attr.attr,
NULL
@@ -3905,17 +4003,37 @@ static ssize_t show_ch_state(struct kobject *kobj, struct kobj_attribute *attr,
return sprintf(buf, "%s\n", get_ch_state_name(ch->state));
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) || defined(RHEL_RELEASE_CODE)
static ssize_t show_comp_vector(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
struct scst_session *scst_sess;
struct srpt_rdma_ch *ch;
scst_sess = container_of(kobj, struct scst_session, sess_kobj);
ch = scst_sess_get_tgt_priv(scst_sess);
return ch ? sprintf(buf, "%u\n", ch->comp_vector) : -ENOENT;
}
#endif
static const struct kobj_attribute srpt_req_lim_attr =
__ATTR(req_lim, S_IRUGO, show_req_lim, NULL);
static const struct kobj_attribute srpt_req_lim_delta_attr =
__ATTR(req_lim_delta, S_IRUGO, show_req_lim_delta, NULL);
static const struct kobj_attribute srpt_ch_state_attr =
__ATTR(ch_state, S_IRUGO, show_ch_state, NULL);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) || defined(RHEL_RELEASE_CODE)
static const struct kobj_attribute srpt_comp_vector_attr =
__ATTR(comp_vector, S_IRUGO, show_comp_vector, NULL);
#endif
static const struct attribute *srpt_sess_attrs[] = {
&srpt_req_lim_attr.attr,
&srpt_req_lim_delta_attr.attr,
&srpt_ch_state_attr.attr,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) || defined(RHEL_RELEASE_CODE)
&srpt_comp_vector_attr.attr,
#endif
NULL
};
#endif
@@ -3974,9 +4092,13 @@ static struct scst_proc_data srpt_log_proc_data = {
/* Note: the caller must have zero-initialized *@srpt_tgt. */
static void srpt_init_tgt(struct srpt_tgt *srpt_tgt)
{
int i;
INIT_LIST_HEAD(&srpt_tgt->nexus_list);
init_waitqueue_head(&srpt_tgt->ch_releaseQ);
mutex_init(&srpt_tgt->mutex);
for (i = 0; i < COMP_V_MASK_SIZE; i++)
__set_bit(i, srpt_tgt->comp_v_mask);
}
/**
+10
View File
@@ -139,6 +139,8 @@ enum {
DEFAULT_MAX_RDMA_SIZE = 65536,
RDMA_COMPL_TIMEOUT_S = 80,
COMP_V_MASK_SIZE = 64,
};
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) && \
@@ -334,6 +336,7 @@ enum rdma_ch_state {
* list contains struct srpt_ioctx elements and is protected
* against concurrent modification by the cm_id spinlock.
* @pkey: P_Key of the IB partition for this SRP channel.
* @comp_vector: Completion vector assigned to the QP.
* @scst_sess: SCST session information associated with this SRP channel.
* @sess_name: SCST session name.
*/
@@ -368,6 +371,9 @@ struct srpt_rdma_ch {
struct list_head list;
struct list_head cmd_wait_list;
uint16_t pkey;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) || defined(RHEL_RELEASE_CODE)
u8 comp_vector;
#endif
bool using_rdma_cm;
bool processing_wait_list;
@@ -395,6 +401,8 @@ struct srpt_nexus {
* @mutex: Protects @nexus_list and srpt_nexus.ch_list.
* @nexus_list: Per-device I_T nexus list.
* @scst_tgt: SCST target information associated with this HCA.
* @comp_v_mask: Bitmask with one bit per allowed completion vector.
* @comp_vector: Completion vector from where searching will start.
* @enabled: Whether or not this SCST target is enabled.
*/
struct srpt_tgt {
@@ -402,6 +410,8 @@ struct srpt_tgt {
struct mutex mutex;
struct list_head nexus_list;
struct scst_tgt *scst_tgt;
DECLARE_BITMAP(comp_v_mask, COMP_V_MASK_SIZE);
u8 comp_vector;
bool enabled;
};