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: 's avatarSteven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: 's avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: 's avatarMichael Cyr <mikecyr@linux.vnet.ibm.com>
Signed-off-by: 's avatarBryant G. Ly <bryantly@linux.vnet.ibm.com>
Cc: FUJITA Tomonori <tomof@acm.org>
Signed-off-by: 's 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.
/*******************************************************************************
* IBM Virtual SCSI Target Driver
* Copyright (C) 2003-2005 Dave Boutcher (boutcher@us.ibm.com) IBM Corp.
* Santiago Leon (santil@us.ibm.com) IBM Corp.
* Linda Xie (lxie@us.ibm.com) IBM Corp.
*
* Copyright (C) 2005-2011 FUJITA Tomonori <tomof@acm.org>
* Copyright (C) 2010 Nicholas A. Bellinger <nab@kernel.org>
* Copyright (C) 2016 Bryant G. Ly <bryantly@linux.vnet.ibm.com> IBM Corp.
*
* Authors: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
* Authors: Michael Cyr <mikecyr@linux.vnet.ibm.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
****************************************************************************/
#ifndef __H_IBMVSCSI_TGT
#define __H_IBMVSCSI_TGT
#include "libsrp.h"
#define SYS_ID_NAME_LEN 64
#define PARTITION_NAMELEN 96
#define IBMVSCSIS_NAMELEN 32
#define MSG_HI 0
#define MSG_LOW 1
#define MAX_CMD_Q_PAGES 4
#define CRQ_PER_PAGE (PAGE_SIZE / sizeof(struct viosrp_crq))
/* in terms of number of elements */
#define DEFAULT_CMD_Q_SIZE CRQ_PER_PAGE
#define MAX_CMD_Q_SIZE (DEFAULT_CMD_Q_SIZE * MAX_CMD_Q_PAGES)
#define SRP_VIOLATION 0x102 /* general error code */
/*
* SRP buffer formats defined as of 16.a supported by this driver.
*/
#define SUPPORTED_FORMATS ((SRP_DATA_DESC_DIRECT << 1) | \
(SRP_DATA_DESC_INDIRECT << 1))
#define SCSI_LUN_ADDR_METHOD_FLAT 1
struct dma_window {
u32 liobn; /* Unique per vdevice */
u64 tce_base; /* Physical location of the TCE table */
u64 tce_size; /* Size of the TCE table in bytes */
};
struct target_dds {
u64 unit_id; /* 64 bit will force alignment */
#define NUM_DMA_WINDOWS 2
#define LOCAL 0
#define REMOTE 1
struct dma_window window[NUM_DMA_WINDOWS];
/* root node property "ibm,partition-no" */
uint partition_num;
char partition_name[PARTITION_NAMELEN];
};
#define MAX_NUM_PORTS 1
#define MAX_H_COPY_RDMA (128 * 1024)
#define MAX_EYE 64
/* Return codes */
#define ADAPT_SUCCESS 0L
/* choose error codes that do not conflict with PHYP */
#define ERROR -40L
struct format_code {
u8 reserved;
u8 buffers;
};
struct client_info {
#define SRP_VERSION "16.a"
char srp_version[8];
/* root node property ibm,partition-name */
char partition_name[PARTITION_NAMELEN];
/* root node property ibm,partition-no */
u32 partition_number;
/* initially 1 */
u32 mad_version;
u32 os_type;
};
/*
* Changing this constant changes the number of seconds to wait before
* considering the client will never service its queue again.
*/
#define SECONDS_TO_CONSIDER_FAILED 30
/*
* These constants set the polling period used to determine if the client
* has freed at least one element in the response queue.
*/
#define WAIT_SECONDS 1
#define WAIT_NANO_SECONDS 5000
#define MAX_TIMER_POPS ((1000000 / WAIT_NANO_SECONDS) * \
SECONDS_TO_CONSIDER_FAILED)
/*
* general purpose timer control block
* which can be used for multiple functions
*/
struct timer_cb {
struct hrtimer timer;
/*
* how long has it been since the client
* serviced the queue. The variable is incrmented
* in the service_wait_q routine and cleared
* in send messages
*/
int timer_pops;
/* the timer is started */
bool started;
};
struct cmd_queue {
/* kva */
struct viosrp_crq *base_addr;
dma_addr_t crq_token;
/* used to maintain index */
uint mask;
/* current element */
uint index;
int size;
};
#define SCSOLNT_RESP_SHIFT 1
#define UCSOLNT_RESP_SHIFT 2
#define SCSOLNT BIT(SCSOLNT_RESP_SHIFT)
#define UCSOLNT BIT(UCSOLNT_RESP_SHIFT)
enum cmd_type {
SCSI_CDB = 0x01,
TASK_MANAGEMENT = 0x02,
/* MAD or addressed to port 0 */
ADAPTER_MAD = 0x04,
UNSET_TYPE = 0x08,
};
struct iu_rsp {
u8 format;
u8 sol_not;
u16 len;
/* tag is just to help client identify cmd, so don't translate be/le */
u64 tag;
};
struct ibmvscsis_cmd {
struct list_head list;
/* Used for TCM Core operations */
struct se_cmd se_cmd;
struct iu_entry *iue;
struct iu_rsp rsp;
struct work_struct work;
struct scsi_info *adapter;
/* Sense buffer that will be mapped into outgoing status */
unsigned char sense_buf[TRANSPORT_SENSE_BUFFER];
u64 init_time;
#define CMD_FAST_FAIL BIT(0)
u32 flags;
char type;
};
struct ibmvscsis_nexus {
struct se_session *se_sess;
};
struct ibmvscsis_tport {
/* SCSI protocol the tport is providing */
u8 tport_proto_id;
/* ASCII formatted WWPN for SRP Target port */
char tport_name[IBMVSCSIS_NAMELEN];
/* Returned by ibmvscsis_make_tport() */
struct se_wwn tport_wwn;
/* Returned by ibmvscsis_make_tpg() */
struct se_portal_group se_tpg;
/* ibmvscsis port target portal group tag for TCM */
u16 tport_tpgt;
/* Pointer to TCM session for I_T Nexus */
struct ibmvscsis_nexus *ibmv_nexus;
bool enabled;
bool releasing;
};
struct scsi_info {
struct list_head list;
char eye[MAX_EYE];
/* commands waiting for space on repsonse queue */
struct list_head waiting_rsp;
#define NO_QUEUE 0x00
#define WAIT_ENABLED 0X01
/* driver has received an initialize command */
#define PART_UP_WAIT_ENAB 0x02
#define WAIT_CONNECTION 0x04
/* have established a connection */
#define CONNECTED 0x08
/* at least one port is processing SRP IU */
#define SRP_PROCESSING 0x10
/* remove request received */
#define UNCONFIGURING 0x20
/* disconnect by letting adapter go idle, no error */
#define WAIT_IDLE 0x40
/* disconnecting to clear an error */
#define ERR_DISCONNECT 0x80
/* disconnect to clear error state, then come back up */
#define ERR_DISCONNECT_RECONNECT 0x100
/* disconnected after clearing an error */
#define ERR_DISCONNECTED 0x200
/* A series of errors caused unexpected errors */
#define UNDEFINED 0x400
u16 state;
int fast_fail;
struct target_dds dds;
char *cmd_pool;
/* list of free commands */
struct list_head free_cmd;
/* command elements ready for scheduler */
struct list_head schedule_q;
/* commands sent to TCM */
struct list_head active_q;
caddr_t *map_buf;
/* ioba of map buffer */
dma_addr_t map_ioba;
/* allowable number of outstanding SRP requests */
int request_limit;
/* extra credit */
int credit;
/* outstanding transactions against credit limit */
int debit;
/* allow only one outstanding mad request */
#define PROCESSING_MAD 0x00002
/* Waiting to go idle */
#define WAIT_FOR_IDLE 0x00004
/* H_REG_CRQ called */
#define CRQ_CLOSED 0x00010
/* detected that client has failed */
#define CLIENT_FAILED 0x00040
/* detected that transport event occurred */
#define TRANS_EVENT 0x00080
/* don't attempt to send anything to the client */
#define RESPONSE_Q_DOWN 0x00100
/* request made to schedule disconnect handler */
#define SCHEDULE_DISCONNECT 0x00400
/* disconnect handler is scheduled */
#define DISCONNECT_SCHEDULED 0x00800
u32 flags;
/* adapter lock */
spinlock_t intr_lock;
/* information needed to manage command queue */
struct cmd_queue cmd_q;
/* used in hcall to copy response back into srp buffer */
u64 empty_iu_id;
/* used in crq, to tag what iu the response is for */
u64 empty_iu_tag;
uint new_state;
/* control block for the response queue timer */
struct timer_cb rsp_q_timer;
/* keep last client to enable proper accounting */
struct client_info client_data;
/* what can this client do */
u32 client_cap;
/*
* The following two fields capture state and flag changes that
* can occur when the lock is given up. In the orginal design,
* the lock was held during calls into phyp;
* however, phyp did not meet PAPR architecture. This is
* a work around.
*/
u16 phyp_acr_state;
u32 phyp_acr_flags;
struct workqueue_struct *work_q;
struct completion wait_idle;
struct device dev;
struct vio_dev *dma_dev;
struct srp_target target;
struct ibmvscsis_tport tport;
struct tasklet_struct work_task;
struct work_struct proc_work;
};
/*
* Provide a constant that allows software to detect the adapter is
* disconnecting from the client from one of several states.
*/
#define IS_DISCONNECTING (UNCONFIGURING | ERR_DISCONNECT_RECONNECT | \
ERR_DISCONNECT)
/*
* Provide a constant that can be used with interrupt handling that
* essentially lets the interrupt handler know that all requests should
* be thrown out,
*/
#define DONT_PROCESS_STATE (IS_DISCONNECTING | UNDEFINED | \
ERR_DISCONNECTED | WAIT_IDLE)
/*
* If any of these flag bits are set then do not allow the interrupt
* handler to schedule the off level handler.
*/
#define BLOCK (DISCONNECT_SCHEDULED)
/* State and transition events that stop the interrupt handler */
#define TARGET_STOP(VSCSI) (long)(((VSCSI)->state & DONT_PROCESS_STATE) | \
((VSCSI)->flags & BLOCK))
/* flag bit that are not reset during disconnect */
#define PRESERVE_FLAG_FIELDS 0
#define vio_iu(IUE) ((union viosrp_iu *)((IUE)->sbuf->buf))
#define READ_CMD(cdb) (((cdb)[0] & 0x1F) == 8)
#define WRITE_CMD(cdb) (((cdb)[0] & 0x1F) == 0xA)
#ifndef H_GET_PARTNER_INFO
#define H_GET_PARTNER_INFO 0x0000000000000008LL
#endif
#define h_copy_rdma(l, sa, sb, da, db) \
plpar_hcall_norets(H_COPY_RDMA, l, sa, sb, da, db)
#define h_vioctl(u, o, a, u1, u2, u3, u4) \
plpar_hcall_norets(H_VIOCTL, u, o, a, u1, u2)
#define h_reg_crq(ua, tok, sz) \
plpar_hcall_norets(H_REG_CRQ, ua, tok, sz)
#define h_free_crq(ua) \
plpar_hcall_norets(H_FREE_CRQ, ua)
#define h_send_crq(ua, d1, d2) \
plpar_hcall_norets(H_SEND_CRQ, ua, d1, d2)
#endif
/*******************************************************************************
* SCSI RDMA Protocol lib functions
*
* Copyright (C) 2006 FUJITA Tomonori <tomof@acm.org>
* Copyright (C) 2016 Bryant G. Ly <bryantly@linux.vnet.ibm.com> IBM Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
***********************************************************************/
#define pr_fmt(fmt) "libsrp: " fmt
#include <linux/printk.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/kfifo.h>
#include <linux/scatterlist.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <scsi/srp.h>
#include <target/target_core_base.h>
#include "libsrp.h"
#include "ibmvscsi_tgt.h"
static int srp_iu_pool_alloc(struct srp_queue *q, size_t max,
struct srp_buf **ring)
{
struct iu_entry *iue;
int i;
q->pool = kcalloc(max, sizeof(struct iu_entry *), GFP_KERNEL);
if (!q->pool)
return -ENOMEM;
q->items = kcalloc(max, sizeof(struct iu_entry), GFP_KERNEL);
if (!q->items)
goto free_pool;
spin_lock_init(&q->lock);
kfifo_init(&q->queue, (void *)q->pool, max * sizeof(void *));
for (i = 0, iue = q->items; i < max; i++) {
kfifo_in(&q->queue, (void *)&iue, sizeof(void *));
iue->sbuf = ring[i];
iue++;
}
return 0;
free_pool:
kfree(q->pool);
return -ENOMEM;
}
static void srp_iu_pool_free(struct srp_queue *q)
{
kfree(q->items);
kfree(q->pool);
}
static struct srp_buf **srp_ring_alloc(struct device *dev,
size_t max, size_t size)
{
struct srp_buf **ring;
int i;
ring = kcalloc(max, sizeof(struct srp_buf *), GFP_KERNEL);
if (!ring)
return NULL;
for (i = 0; i < max; i++) {
ring[i] = kzalloc(sizeof(*ring[i]), GFP_KERNEL);
if (!ring[i])
goto out;
ring[i]->buf = dma_alloc_coherent(dev, size, &ring[i]->dma,
GFP_KERNEL);
if (!ring[i]->buf)
goto out;
}
return ring;
out:
for (i = 0; i < max && ring[i]; i++) {
if (ring[i]->buf) {
dma_free_coherent(dev, size, ring[i]->buf,
ring[i]->dma);
}
kfree(ring[i]);
}
kfree(ring);
return NULL;
}
static void srp_ring_free(struct device *dev, struct srp_buf **ring,
size_t max, size_t size)
{
int i;
for (i = 0; i < max; i++) {
dma_free_coherent(dev, size, ring[i]->buf, ring[i]->dma);
kfree(ring[i]);
}
kfree(ring);
}
int srp_target_alloc(struct srp_target *target, struct device *dev,
size_t nr, size_t iu_size)
{
int err;
spin_lock_init(&target->lock);
target->dev = dev;
target->srp_iu_size = iu_size;
target->rx_ring_size = nr;
target->rx_ring = srp_ring_alloc(target->dev, nr, iu_size);
if (!target->rx_ring)
return -ENOMEM;
err = srp_iu_pool_alloc(&target->iu_queue, nr, target->rx_ring);
if (err)
goto free_ring;
dev_set_drvdata(target->dev, target);
return 0;
free_ring:
srp_ring_free(target->dev, target->rx_ring, nr, iu_size);
return -ENOMEM;
}
void srp_target_free(struct srp_target *target)
{
dev_set_drvdata(target->dev, NULL);
srp_ring_free(target->dev, target->rx_ring, target->rx_ring_size,
target->srp_iu_size);
srp_iu_pool_free(&target->iu_queue);
}
struct iu_entry *srp_iu_get(struct srp_target *target)
{
struct iu_entry *iue = NULL;
if (kfifo_out_locked(&target->iu_queue.queue, (void *)&iue,
sizeof(void *),
&target->iu_queue.lock) != sizeof(void *)) {
WARN_ONCE(1, "unexpected fifo state");
return NULL;
}
if (!iue)
return iue;
iue->target = target;
iue->flags = 0;
return iue;
}
void srp_iu_put(struct iu_entry *iue)
{
kfifo_in_locked(&iue->target->iu_queue.queue, (void *)&iue,
sizeof(void *), &iue->target->iu_queue.lock);
}
static int srp_direct_data(struct ibmvscsis_cmd *cmd, struct srp_direct_buf *md,
enum dma_data_direction dir, srp_rdma_t rdma_io,
int dma_map, int ext_desc)
{
struct iu_entry *iue = NULL;
struct scatterlist *sg = NULL;
int err, nsg = 0, len;
if (dma_map) {
iue = cmd->iue;
sg = cmd->se_cmd.t_data_sg;
nsg = dma_map_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents,
DMA_BIDIRECTIONAL);
if (!nsg) {
pr_err("fail to map %p %d\n", iue,
cmd->se_cmd.t_data_nents);
return 0;
}
len = min(cmd->se_cmd.data_length, be32_to_cpu(md->len));
} else {
len = be32_to_cpu(md->len);
}
err = rdma_io(cmd, sg, nsg, md, 1, dir, len);
if (dma_map)
dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL);
return err;
}
static int srp_indirect_data(struct ibmvscsis_cmd *cmd, struct srp_cmd *srp_cmd,
struct srp_indirect_buf *id,
enum dma_data_direction dir, srp_rdma_t rdma_io,
int dma_map, int ext_desc)
{
struct iu_entry *iue = NULL;
struct srp_direct_buf *md = NULL;
struct scatterlist dummy, *sg = NULL;
dma_addr_t token = 0;
int err = 0;
int nmd, nsg = 0, len;
if (dma_map || ext_desc) {
iue = cmd->iue;
sg = cmd->se_cmd.t_data_sg;
}
nmd = be32_to_cpu(id->table_desc.len) / sizeof(struct srp_direct_buf);
if ((dir == DMA_FROM_DEVICE && nmd == srp_cmd->data_in_desc_cnt) ||
(dir == DMA_TO_DEVICE && nmd == srp_cmd->data_out_desc_cnt)) {
md = &id->desc_list[0];
goto rdma;
}
if (ext_desc && dma_map) {
md = dma_alloc_coherent(iue->target->dev,
be32_to_cpu(id->table_desc.len),
&token, GFP_KERNEL);
if (!md) {
pr_err("Can't get dma memory %u\n",
be32_to_cpu(id->table_desc.len));
return -ENOMEM;
}
sg_init_one(&dummy, md, be32_to_cpu(id->table_desc.len));
sg_dma_address(&dummy) = token;
sg_dma_len(&dummy) = be32_to_cpu(id->table_desc.len);
err = rdma_io(cmd, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE,
be32_to_cpu(id->table_desc.len));
if (err) {
pr_err("Error copying indirect table %d\n", err);
goto free_mem;
}
} else {
pr_err("This command uses external indirect buffer\n");
return -EINVAL;
}
rdma:
if (dma_map) {
nsg = dma_map_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents,
DMA_BIDIRECTIONAL);
if (!nsg) {
pr_err("fail to map %p %d\n", iue,
cmd->se_cmd.t_data_nents);
err = -EIO;
goto free_mem;
}
len = min(cmd->se_cmd.data_length, be32_to_cpu(id->len));
} else {
len = be32_to_cpu(id->len);
}
err = rdma_io(cmd, sg, nsg, md, nmd, dir, len);
if (dma_map)
dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL);
free_mem:
if (token && dma_map) {
dma_free_coherent(iue->target->dev,
be32_to_cpu(id->table_desc.len), md, token);
}
return err;
}
static int data_out_desc_size(struct srp_cmd *cmd)
{
int size = 0;
u8 fmt = cmd->buf_fmt >> 4;
switch (fmt) {
case SRP_NO_DATA_DESC:
break;
case SRP_DATA_DESC_DIRECT:
size = sizeof(struct srp_direct_buf);
break;
case SRP_DATA_DESC_INDIRECT:
size = sizeof(struct srp_indirect_buf) +
sizeof(struct srp_direct_buf) * cmd->data_out_desc_cnt;
break;
default:
pr_err("client error. Invalid data_out_format %x\n", fmt);
break;
}
return size;
}
/*
* TODO: this can be called multiple times for a single command if it
* has very long data.
*/
int srp_transfer_data(struct ibmvscsis_cmd *cmd, struct srp_cmd *srp_cmd,
srp_rdma_t rdma_io, int dma_map, int ext_desc)
{
struct srp_direct_buf *md;
struct srp_indirect_buf *id;
enum dma_data_direction dir;
int offset, err = 0;
u8 format;