Commit 88a678bb authored by Bryant G. Ly's avatar Bryant G. Ly Committed by Nicholas Bellinger

ibmvscsis: Initial commit of IBM VSCSI Tgt Driver

This driver is a pick up of the old IBM VIO scsi Target Driver
that was started by Nick and Fujita 2-4 years ago.
http://comments.gmane.org/gmane.linux.scsi/90119

The driver provides a virtual SCSI device on IBM Power Servers.

This patch contains the fifth version for an initial merge of the
tcm ibmvscsis driver. More information on this driver and config
can be found:

https://github.com/powervm/ibmvscsis/wiki/Configuration
http://www.linux-iscsi.org/wiki/IBM_vSCSI

(Drop extra libsrp review breakage + Fix kconfig typo - nab)
Signed-off-by: default avatarSteven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Cyr <mikecyr@linux.vnet.ibm.com>
Signed-off-by: default avatarBryant G. Ly <bryantly@linux.vnet.ibm.com>
Cc: FUJITA Tomonori <tomof@acm.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 410c29df
......@@ -5680,7 +5680,15 @@ M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
L: linux-scsi@vger.kernel.org
S: Supported
F: drivers/scsi/ibmvscsi/ibmvscsi*
F: drivers/scsi/ibmvscsi/viosrp.h
F: include/scsi/viosrp.h
IBM Power Virtual SCSI Device Target Driver
M: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
M: Michael Cyr <mikecyr@linux.vnet.ibm.com>
L: linux-scsi@vger.kernel.org
L: target-devel@vger.kernel.org
S: Supported
F: drivers/scsi/ibmvscsi_tgt/
IBM Power Virtual FC Device Drivers
M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
......
......@@ -838,6 +838,23 @@ config SCSI_IBMVSCSI
To compile this driver as a module, choose M here: the
module will be called ibmvscsi.
config SCSI_IBMVSCSIS
tristate "IBM Virtual SCSI Server support"
depends on PPC_PSERIES && TARGET_CORE && SCSI && PCI
help
This is the IBM POWER Virtual SCSI Target Server
This driver uses the SRP protocol for communication betwen servers
guest and/or the host that run on the same server.
More information on VSCSI protocol can be found at www.power.org
The userspace configuration needed to initialize the driver can be
be found here:
https://github.com/powervm/ibmvscsis/wiki/Configuration
To compile this driver as a module, choose M here: the
module will be called ibmvscsis.
config SCSI_IBMVFC
tristate "IBM Virtual FC support"
depends on PPC_PSERIES && SCSI
......
......@@ -128,6 +128,7 @@ obj-$(CONFIG_SCSI_SNI_53C710) += 53c700.o sni_53c710.o
obj-$(CONFIG_SCSI_NSP32) += nsp32.o
obj-$(CONFIG_SCSI_IPR) += ipr.o
obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsi/
obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvscsi_tgt/
obj-$(CONFIG_SCSI_IBMVFC) += ibmvscsi/
obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o
obj-$(CONFIG_SCSI_STEX) += stex.o
......
......@@ -26,7 +26,7 @@
#include <linux/list.h>
#include <linux/types.h>
#include "viosrp.h"
#include <scsi/viosrp.h>
#define IBMVFC_NAME "ibmvfc"
#define IBMVFC_DRIVER_VERSION "1.0.11"
......
......@@ -33,7 +33,7 @@
#include <linux/list.h>
#include <linux/completion.h>
#include <linux/interrupt.h>
#include "viosrp.h"
#include <scsi/viosrp.h>
struct scsi_cmnd;
struct Scsi_Host;
......
obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvscsis.o
ibmvscsis-y := libsrp.o ibmvscsi_tgt.o
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
#ifndef __LIBSRP_H__
#define __LIBSRP_H__
#include <linux/list.h>
#include <linux/kfifo.h>
#include <scsi/srp.h>
enum srp_valid {
INVALIDATE_CMD_RESP_EL = 0,
VALID_CMD_RESP_EL = 0x80,
VALID_INIT_MSG = 0xC0,
VALID_TRANS_EVENT = 0xFF
};
enum srp_format {
SRP_FORMAT = 1,
MAD_FORMAT = 2,
OS400_FORMAT = 3,
AIX_FORMAT = 4,
LINUX_FORMAT = 5,
MESSAGE_IN_CRQ = 6
};
enum srp_init_msg {
INIT_MSG = 1,
INIT_COMPLETE_MSG = 2
};
enum srp_trans_event {
UNUSED_FORMAT = 0,
PARTNER_FAILED = 1,
PARTNER_DEREGISTER = 2,
MIGRATED = 6
};
enum srp_status {
HEADER_DESCRIPTOR = 0xF1,
PING = 0xF5,
PING_RESPONSE = 0xF6
};
enum srp_mad_version {
MAD_VERSION_1 = 1
};
enum srp_os_type {
OS400 = 1,
LINUX = 2,
AIX = 3,
OFW = 4
};
enum srp_task_attributes {
SRP_SIMPLE_TASK = 0,
SRP_HEAD_TASK = 1,
SRP_ORDERED_TASK = 2,
SRP_ACA_TASK = 4
};
enum {
SRP_TASK_MANAGEMENT_FUNCTION_COMPLETE = 0,
SRP_REQUEST_FIELDS_INVALID = 2,
SRP_TASK_MANAGEMENT_FUNCTION_NOT_SUPPORTED = 4,
SRP_TASK_MANAGEMENT_FUNCTION_FAILED = 5
};
struct srp_buf {
dma_addr_t dma;
void *buf;
};
struct srp_queue {
void *pool;
void *items;
struct kfifo queue;
spinlock_t lock;
};
struct srp_target {
struct device *dev;
spinlock_t lock;
struct list_head cmd_queue;
size_t srp_iu_size;
struct srp_queue iu_queue;
size_t rx_ring_size;
struct srp_buf **rx_ring;
void *ldata;
};
struct iu_entry {
struct srp_target *target;
struct list_head ilist;
dma_addr_t remote_token;
unsigned long flags;
struct srp_buf *sbuf;
u16 iu_len;
};
struct ibmvscsis_cmd;
typedef int (srp_rdma_t)(struct ibmvscsis_cmd *, struct scatterlist *, int,
struct srp_direct_buf *, int,
enum dma_data_direction, unsigned int);
int srp_target_alloc(struct srp_target *, struct device *, size_t, size_t);
void srp_target_free(struct srp_target *);
struct iu_entry *srp_iu_get(struct srp_target *);
void srp_iu_put(struct iu_entry *);
int srp_transfer_data(struct ibmvscsis_cmd *, struct srp_cmd *,
srp_rdma_t, int, int);
u64 srp_data_length(struct srp_cmd *cmd, enum dma_data_direction dir);
int srp_get_desc_table(struct srp_cmd *srp_cmd, enum dma_data_direction *dir,
u64 *data_len);
static inline int srp_cmd_direction(struct srp_cmd *cmd)
{
return (cmd->buf_fmt >> 4) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
}
#endif
......@@ -15,11 +15,6 @@
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/* */
/* This file contains structures and definitions for IBM RPA (RS/6000 */
/* platform architecture) implementation of the SRP (SCSI RDMA Protocol) */
/* standard. SRP is used on IBM iSeries and pSeries platforms to send SCSI */
......@@ -93,7 +88,7 @@ struct viosrp_crq {
};
/* MADs are Management requests above and beyond the IUs defined in the SRP
* standard.
* standard.
*/
enum viosrp_mad_types {
VIOSRP_EMPTY_IU_TYPE = 0x01,
......@@ -131,7 +126,7 @@ enum viosrp_capability_flag {
CAP_LIST_DATA = 0x08,
};
/*
/*
* Common MAD header
*/
struct mad_common {
......@@ -146,7 +141,7 @@ struct mad_common {
* client to the server. There is no way for the server to send
* an asynchronous message back to the client. The Empty IU is used
* to hang out a meaningless request to the server so that it can respond
* asynchrouously with something like a SCSI AER
* asynchrouously with something like a SCSI AER
*/
struct viosrp_empty_iu {
struct mad_common common;
......@@ -189,7 +184,7 @@ struct mad_migration_cap {
__be32 ecl;
};
struct capabilities{
struct capabilities {
__be32 flags;
char name[SRP_MAX_LOC_LEN];
char loc[SRP_MAX_LOC_LEN];
......
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