IB/srpt: Set srq_type to IB_SRQT_BASIC

Since commit 96104eda0169 ("RDMA/core: Add SRQ type field"), kernel
users of SRQs need to specify srq_type = IB_SRQT_BASIC in struct
ib_srq_init_attr, or else most low-level drivers will fail in
when srpt_add_one() calls ib_create_srq() and gets -ENOSYS.

(mlx4_ib works OK nearly all of the time, because it just needs
srq_type != IB_SRQT_XRC.  And apparently nearly everyone using
ib_srpt is using mlx4 hardware)

Reported-by: Alexey Shvetsov <alexxy@gentoo.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Roland Dreier <roland@purestorage.com>
firewire: Add function to get speed from opaque struct fw_request

Sometimes it's useful to know the FireWire speed of the request that has
just come in to a fw_address_handler callback. As struct fw_request is
opaque we can't peek inside to get the speed out of the struct fw_packet
that's just inside. For example, the SBP-2 spec says:

"The speed at which the block write request to the MANAGEMENT_AGENT
register is received shall determine the speed used by the target for
all subsequent requests to read the initiator’s configuration ROM, fetch
ORB’s from initiator memory or store status at the initiator’s
status_FIFO. Command block ORB’s separately specify the speed for
requests addressed to the data buffer or page table."

[ ANSI T10/1155D Revision 4 page 53/54 ]

Signed-off-by: Chris Boot <bootc@bootc.net>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
firewire: Move fw_card kref functions into linux/firewire.h

When writing a firewire driver that doesn't deal with struct fw_device
objects (e.g. it only publishes FireWire units and doesn't subscribe to
them), you likely need to keep referenced to struct fw_card objects so
that you can send messages to other nodes. This patch moves
fw_card_put(), fw_card_get() and fw_card_release() into the public
include/linux/firewire.h header instead of drivers/firewire/core.h, and
adds EXPORT_SYMBOL_GPL(fw_card_release).

The firewire-sbp-target module requires these so it can keep a reference
to the fw_card object in order that it can fetch ORBs to execute and
read/write related data and status information.

Signed-off-by: Chris Boot <bootc@bootc.net>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
firewire-sbp-target: Initial merge into lio-core.git @ v3.4-rc2

The FireWire SBP-2 Target is a driver for using an IEEE-1394 connection
as a SCSI transport. This module uses the SCSI Target framework to
expose LUNs to other machines attached to a FireWire bus, in effect
acting as a FireWire hard disk similar to FireWire Target Disk mode on
many Apple computers.

This commit contains the squashed pull from Chris Boot's SBP-2-Target:

  https://github.com/bootc/Linux-SBP-2-Target.git patch-v3

firewire-sbp-target: Add sbp_base.h header
firewire-sbp-target: Add sbp_configfs.c
firewire-sbp-target: Add sbp_fabric.{c,h}
firewire-sbp-target: Add sbp_management_agent.{c,h}
firewire-sbp-target: Add sbp_login.{c,h}
firewire-sbp-target: Add sbp_target_agent.{c,h}
firewire-sbp-target: Add sbp_scsi_cmnd.{c,h}
firewire-sbp-target: Add to target Kconfig and Makefile

Also add bootc's entry to the MAINTAINERS file.  Great work Chris !!

Signed-off-by: Chris Boot <bootc@bootc.net>
Cc: Andy Grover <agrover@redhat.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core
sbp-target: Move to a single source/header file for mainline

This patch converts drivers/target/sbp/ to use a single sbp_target.[c,h]
source/header file following mainline convention for new target fabric
drivers.  Make as many functions as possible statically defined and add
inline protypes where necessary.

This patch also renames the sbp-target config entry from:

    FIREWIRE_SBP_TARGET -> SBP_TARGET

and also renames the final generated module name from:

    fireware-sbp-target.ko -> sbp_target.ko

Cc: Chris Boot <bootc@bootc.net>
Cc: Andy Grover <agrover@redhat.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
usb-gadget: Re-enable SGL handling in fabric.c

This patch re-enables two cases for SGL handling with SCSI WRITEs that
was missed in the original conversion patch here:

commit b2decb9c5030326d5d364ef7440a35e4b75cff69
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date:   Fri Apr 6 19:24:15 2012 -0700

    target/usb-gadget: Re-enable support for scatterlist I/O

Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
usb-gadget: Move target driver to a single source/header file for mainline

This patch converts drivers/target/usb-gadget/ to use a single usb_gadget.[c,h]
source/header file following mainline convention for new target fabric drivers.
Make as many functions as possible statically defined and add inline
protypes where necessary.

This patch also renames the tcm_usb_gadget.ko config entry from:

    TARGET_USB_GADGET -> TCM_USB_GADGET

Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
sbp-target: minor cleanups after merging into single file

Just a few minor cleanups to make a couple more elements static and
remove some extern definitions from the header which are not exported.

Signed-off-by: Chris Boot <bootc@bootc.net>
Cc: Andy Grover <agrover@redhat.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
sbp-target: update TODO file

The TODO wasn't updated after the last batch of changes before the
merge, so remove those items that have been completed. This patch also
re-orders the existing items in priority order and adds a new one.

Signed-off-by: Chris Boot <bootc@bootc.net>
Cc: Andy Grover <agrover@redhat.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Merge branch 'usb-gadget-merge'

Conflicts:
	drivers/target/Makefile
usb-gadget: Make Kconfig/Makefile use TCM_USB_GADGET

This patch converts the remaining usb-gadget Kconfig/Makefile to use

   TARGET_USB_GADGET -> TCM_USB_GADGET

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core
sbp-target: use simple assignment in tgt_agent_rw_agent_state()

There is no need to memcpy() a 32-bit integer. The data pointer is
guaranteed to be quadlet aligned by the FireWire stack so we can replace
the memcpy() with an assignment.

Thanks to Stefan Richter.

Signed-off-by: Chris Boot <bootc@bootc.net>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>