From b82c6ca251fa2108dd934d2d1cb47e61afb0da8f Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Mon, 21 May 2007 13:17:54 +0000 Subject: [PATCH] Add it_nexus support for scsi-target. * debian/changelog: Update. * debian/patches/features/all/drivers-scsi-target-it_nexus-1.patch, debian/patches/features/all/drivers-scsi-target-it_nexus-2.patch: Add. * debian/patches/series/1~experimental.1: Update. svn path=/dists/trunk/linux-2.6/; revision=8653 --- debian/changelog | 3 +- .../all/drivers-scsi-target-it_nexus-1.patch | 418 ++++++++++++++++++ .../all/drivers-scsi-target-it_nexus-2.patch | 135 ++++++ debian/patches/series/1~experimental.1 | 2 + 4 files changed, 557 insertions(+), 1 deletion(-) create mode 100644 debian/patches/features/all/drivers-scsi-target-it_nexus-1.patch create mode 100644 debian/patches/features/all/drivers-scsi-target-it_nexus-2.patch diff --git a/debian/changelog b/debian/changelog index 7c3872e47..8f0e654fa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ linux-2.6 (2.6.22~rc2-1~experimental.1) UNRELEASED; urgency=low * [powerpc]: Disable prep. * [powerpc]: Disable apm emulation. + * Add it_nexus support for scsi-target. - -- Bastian Blank Sun, 20 May 2007 14:16:47 +0200 + -- Bastian Blank Sun, 20 May 2007 22:15:47 +0200 linux-2.6 (2.6.21-3) UNRELEASED; urgency=low diff --git a/debian/patches/features/all/drivers-scsi-target-it_nexus-1.patch b/debian/patches/features/all/drivers-scsi-target-it_nexus-1.patch new file mode 100644 index 000000000..71bcaff78 --- /dev/null +++ b/debian/patches/features/all/drivers-scsi-target-it_nexus-1.patch @@ -0,0 +1,418 @@ +# Status: Waiting in linux-2.6-target tree + +diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c +index ca22ddf..9815a1a 100644 +--- a/drivers/scsi/scsi_tgt_if.c ++++ b/drivers/scsi/scsi_tgt_if.c +@@ -102,7 +102,8 @@ static int tgt_uspace_send_event(u32 type, struct tgt_event *p) + return 0; + } + +-int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, u64 tag) ++int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, u64 itn_id, ++ struct scsi_lun *lun, u64 tag) + { + struct Scsi_Host *shost = scsi_tgt_cmd_to_host(cmd); + struct tgt_event ev; +@@ -110,6 +111,7 @@ int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, u64 ta + + memset(&ev, 0, sizeof(ev)); + ev.p.cmd_req.host_no = shost->host_no; ++ ev.p.cmd_req.itn_id = itn_id; + ev.p.cmd_req.data_len = cmd->request_bufflen; + memcpy(ev.p.cmd_req.scb, cmd->cmnd, sizeof(ev.p.cmd_req.scb)); + memcpy(ev.p.cmd_req.lun, lun, sizeof(ev.p.cmd_req.lun)); +@@ -127,7 +129,7 @@ int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, u64 ta + return err; + } + +-int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag) ++int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 itn_id, u64 tag) + { + struct Scsi_Host *shost = scsi_tgt_cmd_to_host(cmd); + struct tgt_event ev; +@@ -135,6 +137,7 @@ int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag) + + memset(&ev, 0, sizeof(ev)); + ev.p.cmd_done.host_no = shost->host_no; ++ ev.p.cmd_done.itn_id = itn_id; + ev.p.cmd_done.tag = tag; + ev.p.cmd_done.result = cmd->result; + +@@ -149,14 +152,15 @@ int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag) + return err; + } + +-int scsi_tgt_uspace_send_tsk_mgmt(int host_no, int function, u64 tag, +- struct scsi_lun *scsilun, void *data) ++int scsi_tgt_uspace_send_tsk_mgmt(int host_no, u64 itn_id, int function, ++ u64 tag, struct scsi_lun *scsilun, void *data) + { + struct tgt_event ev; + int err; + + memset(&ev, 0, sizeof(ev)); + ev.p.tsk_mgmt_req.host_no = host_no; ++ ev.p.tsk_mgmt_req.itn_id = itn_id; + ev.p.tsk_mgmt_req.function = function; + ev.p.tsk_mgmt_req.tag = tag; + memcpy(ev.p.tsk_mgmt_req.lun, scsilun, sizeof(ev.p.tsk_mgmt_req.lun)); +@@ -172,6 +176,29 @@ int scsi_tgt_uspace_send_tsk_mgmt(int host_no, int function, u64 tag, + return err; + } + ++int scsi_tgt_uspace_send_it_nexus_request(int host_no, u64 itn_id, ++ int function, char *initiator_id) ++{ ++ struct tgt_event ev; ++ int err; ++ ++ memset(&ev, 0, sizeof(ev)); ++ ev.p.it_nexus_req.host_no = host_no; ++ ev.p.it_nexus_req.function = function; ++ ev.p.it_nexus_req.itn_id = itn_id; ++ if (initiator_id) ++ strncpy(ev.p.it_nexus_req.initiator_id, initiator_id, ++ sizeof(ev.p.it_nexus_req.initiator_id)); ++ ++ dprintk("%d %x %llx\n", host_no, function, (unsigned long long)itn_id); ++ ++ err = tgt_uspace_send_event(TGT_KEVENT_IT_NEXUS_REQ, &ev); ++ if (err) ++ eprintk("tx buf is full, could not send\n"); ++ ++ return err; ++} ++ + static int event_recv_msg(struct tgt_event *ev) + { + int err = 0; +@@ -179,6 +206,7 @@ static int event_recv_msg(struct tgt_event *ev) + switch (ev->hdr.type) { + case TGT_UEVENT_CMD_RSP: + err = scsi_tgt_kspace_exec(ev->p.cmd_rsp.host_no, ++ ev->p.cmd_rsp.itn_id, + ev->p.cmd_rsp.result, + ev->p.cmd_rsp.tag, + ev->p.cmd_rsp.uaddr, +@@ -189,9 +217,15 @@ static int event_recv_msg(struct tgt_event *ev) + break; + case TGT_UEVENT_TSK_MGMT_RSP: + err = scsi_tgt_kspace_tsk_mgmt(ev->p.tsk_mgmt_rsp.host_no, ++ ev->p.tsk_mgmt_rsp.itn_id, + ev->p.tsk_mgmt_rsp.mid, + ev->p.tsk_mgmt_rsp.result); + break; ++ case TGT_UEVENT_IT_NEXUS_RSP: ++ err = scsi_tgt_kspace_it_nexus_rsp(ev->p.it_nexus_rsp.host_no, ++ ev->p.it_nexus_rsp.itn_id, ++ ev->p.it_nexus_rsp.result); ++ break; + default: + eprintk("unknown type %d\n", ev->hdr.type); + err = -EINVAL; +diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c +index 2570f48..f16621c 100644 +--- a/drivers/scsi/scsi_tgt_lib.c ++++ b/drivers/scsi/scsi_tgt_lib.c +@@ -46,6 +46,7 @@ struct scsi_tgt_cmd { + + struct list_head hash_list; + struct request *rq; ++ u64 itn_id; + u64 tag; + }; + +@@ -185,12 +186,13 @@ static void scsi_tgt_cmd_destroy(struct work_struct *work) + } + + static void init_scsi_tgt_cmd(struct request *rq, struct scsi_tgt_cmd *tcmd, +- u64 tag) ++ u64 itn_id, u64 tag) + { + struct scsi_tgt_queuedata *qdata = rq->q->queuedata; + unsigned long flags; + struct list_head *head; + ++ tcmd->itn_id = itn_id; + tcmd->tag = tag; + tcmd->bio = NULL; + INIT_WORK(&tcmd->work, scsi_tgt_cmd_destroy); +@@ -301,14 +303,14 @@ EXPORT_SYMBOL_GPL(scsi_tgt_cmd_to_host); + * @scsilun: scsi lun + * @tag: unique value to identify this command for tmf + */ +-int scsi_tgt_queue_command(struct scsi_cmnd *cmd, struct scsi_lun *scsilun, +- u64 tag) ++int scsi_tgt_queue_command(struct scsi_cmnd *cmd, u64 itn_id, ++ struct scsi_lun *scsilun, u64 tag) + { + struct scsi_tgt_cmd *tcmd = cmd->request->end_io_data; + int err; + +- init_scsi_tgt_cmd(cmd->request, tcmd, tag); +- err = scsi_tgt_uspace_send_cmd(cmd, scsilun, tag); ++ init_scsi_tgt_cmd(cmd->request, tcmd, itn_id, tag); ++ err = scsi_tgt_uspace_send_cmd(cmd, itn_id, scsilun, tag); + if (err) + cmd_hashlist_del(cmd); + +@@ -326,7 +328,7 @@ static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd) + + dprintk("cmd %p %lu\n", cmd, rq_data_dir(cmd->request)); + +- scsi_tgt_uspace_send_status(cmd, tcmd->tag); ++ scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag); + + if (cmd->request_buffer) + scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len); +@@ -459,7 +461,7 @@ static struct request *tgt_cmd_hash_lookup(struct request_queue *q, u64 tag) + return rq; + } + +-int scsi_tgt_kspace_exec(int host_no, int result, u64 tag, ++int scsi_tgt_kspace_exec(int host_no, u64 itn_id, int result, u64 tag, + unsigned long uaddr, u32 len, unsigned long sense_uaddr, + u32 sense_len, u8 rw) + { +@@ -541,21 +543,22 @@ done: + return err; + } + +-int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *shost, int function, u64 tag, +- struct scsi_lun *scsilun, void *data) ++int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *shost, u64 itn_id, ++ int function, u64 tag, struct scsi_lun *scsilun, ++ void *data) + { + int err; + + /* TODO: need to retry if this fails. */ +- err = scsi_tgt_uspace_send_tsk_mgmt(shost->host_no, function, +- tag, scsilun, data); ++ err = scsi_tgt_uspace_send_tsk_mgmt(shost->host_no, itn_id, ++ function, tag, scsilun, data); + if (err < 0) + eprintk("The task management request lost!\n"); + return err; + } + EXPORT_SYMBOL_GPL(scsi_tgt_tsk_mgmt_request); + +-int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 mid, int result) ++int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 itn_id, u64 mid, int result) + { + struct Scsi_Host *shost; + int err = -EINVAL; +@@ -573,7 +576,60 @@ int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 mid, int result) + goto done; + } + +- err = shost->hostt->tsk_mgmt_response(mid, result); ++ err = shost->hostt->tsk_mgmt_response(shost, itn_id, mid, result); ++done: ++ scsi_host_put(shost); ++ return err; ++} ++ ++int scsi_tgt_it_nexus_create(struct Scsi_Host *shost, u64 itn_id, ++ char *initiator) ++{ ++ int err; ++ ++ /* TODO: need to retry if this fails. */ ++ err = scsi_tgt_uspace_send_it_nexus_request(shost->host_no, itn_id, 0, ++ initiator); ++ if (err < 0) ++ eprintk("The i_t_neuxs request lost, %d %llx!\n", ++ shost->host_no, (unsigned long long)itn_id); ++ return err; ++} ++EXPORT_SYMBOL_GPL(scsi_tgt_it_nexus_create); ++ ++int scsi_tgt_it_nexus_destroy(struct Scsi_Host *shost, u64 itn_id) ++{ ++ int err; ++ ++ /* TODO: need to retry if this fails. */ ++ err = scsi_tgt_uspace_send_it_nexus_request(shost->host_no, ++ itn_id, 1, NULL); ++ if (err < 0) ++ eprintk("The i_t_neuxs request lost, %d %llx!\n", ++ shost->host_no, (unsigned long long)itn_id); ++ return err; ++} ++EXPORT_SYMBOL_GPL(scsi_tgt_it_nexus_destroy); ++ ++int scsi_tgt_kspace_it_nexus_rsp(int host_no, u64 itn_id, int result) ++{ ++ struct Scsi_Host *shost; ++ int err = -EINVAL; ++ ++ dprintk("%d %d %llx\n", host_no, result, (unsigned long long) mid); ++ ++ shost = scsi_host_lookup(host_no); ++ if (IS_ERR(shost)) { ++ printk(KERN_ERR "Could not find host no %d\n", host_no); ++ return err; ++ } ++ ++ if (!shost->uspace_req_q) { ++ printk(KERN_ERR "Not target scsi host %d\n", host_no); ++ goto done; ++ } ++ ++ err = shost->hostt->it_nexus_response(shost, itn_id, result); + done: + scsi_host_put(shost); + return err; +diff --git a/drivers/scsi/scsi_tgt_priv.h b/drivers/scsi/scsi_tgt_priv.h +index e9e6db1..cb92888 100644 +--- a/drivers/scsi/scsi_tgt_priv.h ++++ b/drivers/scsi/scsi_tgt_priv.h +@@ -15,12 +15,18 @@ do { \ + extern void scsi_tgt_if_exit(void); + extern int scsi_tgt_if_init(void); + +-extern int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, struct scsi_lun *lun, +- u64 tag); +-extern int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 tag); +-extern int scsi_tgt_kspace_exec(int host_no, int result, u64 tag, +- unsigned long uaddr, u32 len, unsigned long sense_uaddr, +- u32 sense_len, u8 rw); +-extern int scsi_tgt_uspace_send_tsk_mgmt(int host_no, int function, u64 tag, ++extern int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, u64 it_nexus_id, ++ struct scsi_lun *lun, u64 tag); ++extern int scsi_tgt_uspace_send_status(struct scsi_cmnd *cmd, u64 it_nexus_id, ++ u64 tag); ++extern int scsi_tgt_kspace_exec(int host_no, u64 it_nexus_id, int result, u64 tag, ++ unsigned long uaddr, u32 len, ++ unsigned long sense_uaddr, u32 sense_len, u8 rw); ++extern int scsi_tgt_uspace_send_tsk_mgmt(int host_no, u64 it_nexus_id, ++ int function, u64 tag, + struct scsi_lun *scsilun, void *data); +-extern int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 mid, int result); ++extern int scsi_tgt_kspace_tsk_mgmt(int host_no, u64 it_nexus_id, ++ u64 mid, int result); ++extern int scsi_tgt_uspace_send_it_nexus_request(int host_no, u64 it_nexus_id, ++ int function, char *initiator); ++extern int scsi_tgt_kspace_it_nexus_rsp(int host_no, u64 it_nexus_id, int result); +diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h +index 68f461b..5530bc2 100644 +--- a/include/scsi/scsi_host.h ++++ b/include/scsi/scsi_host.h +@@ -146,7 +146,10 @@ struct scsi_host_template { + void (*done)(struct scsi_cmnd *)); + + /* Used as callback for the completion of task management request. */ +- int (* tsk_mgmt_response)(u64 mid, int result); ++ int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64 mid, int result); ++ ++ /* Used as callback for the completion of i_t_nexus request. */ ++ int (* it_nexus_response)(struct Scsi_Host *, u64, int); + + /* + * This is an error handling strategy routine. You don't need to +diff --git a/include/scsi/scsi_tgt.h b/include/scsi/scsi_tgt.h +index 4f44279..d0fefb9 100644 +--- a/include/scsi/scsi_tgt.h ++++ b/include/scsi/scsi_tgt.h +@@ -11,9 +11,11 @@ struct scsi_lun; + extern struct Scsi_Host *scsi_tgt_cmd_to_host(struct scsi_cmnd *); + extern int scsi_tgt_alloc_queue(struct Scsi_Host *); + extern void scsi_tgt_free_queue(struct Scsi_Host *); +-extern int scsi_tgt_queue_command(struct scsi_cmnd *, struct scsi_lun *, u64); +-extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, int, u64, struct scsi_lun *, +- void *); ++extern int scsi_tgt_queue_command(struct scsi_cmnd *, u64, struct scsi_lun *, u64); ++extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, u64, int, u64, ++ struct scsi_lun *, void *); + extern struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *, + enum dma_data_direction, gfp_t); + extern void scsi_host_put_command(struct Scsi_Host *, struct scsi_cmnd *); ++extern int scsi_tgt_it_nexus_create(struct Scsi_Host *, u64, char *); ++extern int scsi_tgt_it_nexus_destroy(struct Scsi_Host *, u64); +diff --git a/include/scsi/scsi_tgt_if.h b/include/scsi/scsi_tgt_if.h +index 4cf9dff..f2ee7c2 100644 +--- a/include/scsi/scsi_tgt_if.h ++++ b/include/scsi/scsi_tgt_if.h +@@ -23,13 +23,15 @@ + #define __SCSI_TARGET_IF_H + + /* user -> kernel */ +-#define TGT_UEVENT_CMD_RSP 0x0001 +-#define TGT_UEVENT_TSK_MGMT_RSP 0x0002 ++#define TGT_UEVENT_CMD_RSP 0x0001 ++#define TGT_UEVENT_IT_NEXUS_RSP 0x0002 ++#define TGT_UEVENT_TSK_MGMT_RSP 0x0003 + + /* kernel -> user */ +-#define TGT_KEVENT_CMD_REQ 0x1001 +-#define TGT_KEVENT_CMD_DONE 0x1002 +-#define TGT_KEVENT_TSK_MGMT_REQ 0x1003 ++#define TGT_KEVENT_CMD_REQ 0x1001 ++#define TGT_KEVENT_CMD_DONE 0x1002 ++#define TGT_KEVENT_IT_NEXUS_REQ 0x1003 ++#define TGT_KEVENT_TSK_MGMT_REQ 0x1004 + + struct tgt_event_hdr { + uint16_t version; +@@ -46,6 +48,7 @@ struct tgt_event { + struct { + int host_no; + int result; ++ aligned_u64 itn_id; + aligned_u64 tag; + aligned_u64 uaddr; + aligned_u64 sense_uaddr; +@@ -55,15 +58,22 @@ struct tgt_event { + } cmd_rsp; + struct { + int host_no; +- aligned_u64 mid; + int result; ++ aligned_u64 itn_id; ++ aligned_u64 mid; + } tsk_mgmt_rsp; +- ++ struct { ++ __s32 host_no; ++ __s32 result; ++ aligned_u64 itn_id; ++ __u32 function; ++ } it_nexus_rsp; + + /* kernel -> user */ + struct { + int host_no; + uint32_t data_len; ++ aligned_u64 itn_id; + uint8_t scb[16]; + uint8_t lun[8]; + int attribute; +@@ -71,16 +81,25 @@ struct tgt_event { + } cmd_req; + struct { + int host_no; +- aligned_u64 tag; + int result; ++ aligned_u64 itn_id; ++ aligned_u64 tag; + } cmd_done; + struct { + int host_no; + int function; ++ aligned_u64 itn_id; + aligned_u64 tag; + uint8_t lun[8]; + aligned_u64 mid; + } tsk_mgmt_req; ++ struct { ++ __s32 host_no; ++ __u32 function; ++ aligned_u64 itn_id; ++ __u32 max_cmds; ++ __u8 initiator_id[16]; ++ } it_nexus_req; + } p; + } __attribute__ ((aligned (sizeof(uint64_t)))); + diff --git a/debian/patches/features/all/drivers-scsi-target-it_nexus-2.patch b/debian/patches/features/all/drivers-scsi-target-it_nexus-2.patch new file mode 100644 index 000000000..5ac312f07 --- /dev/null +++ b/debian/patches/features/all/drivers-scsi-target-it_nexus-2.patch @@ -0,0 +1,135 @@ +# Status: Waiting in linux-2.6-target tree + +diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c +index 6d223dd..ee4fb8d 100644 +--- a/drivers/scsi/ibmvscsi/ibmvstgt.c ++++ b/drivers/scsi/ibmvscsi/ibmvstgt.c +@@ -68,6 +68,8 @@ struct vio_port { + unsigned long liobn; + unsigned long riobn; + struct srp_target *target; ++ ++ u64 itn_id; + }; + + static struct workqueue_struct *vtgtd; +@@ -200,7 +202,8 @@ retry: + if (!test_and_set_bit(V_FLYING, &iue->flags)) { + spin_unlock_irqrestore(&target->lock, flags); + cmd = iue->sbuf->buf; +- err = srp_cmd_queue(shost, cmd, iue, 0); ++ err = srp_cmd_queue(shost, cmd, iue, ++ (unsigned long)shost, 0); + if (err) { + eprintk("cannot queue cmd %p %d\n", cmd, err); + srp_iu_put(iue); +@@ -359,6 +362,16 @@ static void process_login(struct iu_entry *iue) + union viosrp_iu *iu = vio_iu(iue); + struct srp_login_rsp *rsp = &iu->srp.login_rsp; + uint64_t tag = iu->srp.rsp.tag; ++ int ret; ++ struct Scsi_Host *shost = iue->target->shost; ++ struct srp_target *target = host_to_srp_target(shost); ++ struct vio_port *vport = target_to_port(target); ++ ++ if (!vport->itn_id) { ++ ret = scsi_tgt_it_nexus_create(shost, (unsigned long) shost, NULL); ++ if (!ret) ++ vport->itn_id = (unsigned long) shost; ++ } + + /* TODO handle case that requested size is wrong and + * buffer format is wrong +@@ -412,7 +425,9 @@ static int process_tsk_mgmt(struct iu_entry *iue) + fn = 0; + } + if (fn) +- scsi_tgt_tsk_mgmt_request(iue->target->shost, fn, ++ scsi_tgt_tsk_mgmt_request(iue->target->shost, ++ (unsigned long)iue->target->shost, ++ fn, + iu->srp.tsk_mgmt.task_tag, + (struct scsi_lun *) &iu->srp.tsk_mgmt.lun, + iue); +@@ -721,7 +736,8 @@ static int ibmvstgt_eh_abort_handler(struct scsi_cmnd *sc) + return 0; + } + +-static int ibmvstgt_tsk_mgmt_response(u64 mid, int result) ++static int ibmvstgt_tsk_mgmt_response(struct Scsi_Host *shost, ++ u64 itn_id, u64 mid, int result) + { + struct iu_entry *iue = (struct iu_entry *) ((void *) mid); + union viosrp_iu *iu = vio_iu(iue); +@@ -747,6 +763,17 @@ static int ibmvstgt_tsk_mgmt_response(u64 mid, int result) + return 0; + } + ++static int ibmvstgt_it_nexus_response(struct Scsi_Host *shost, u64 itn_id, ++ int result) ++{ ++ struct srp_target *target = host_to_srp_target(shost); ++ struct vio_port *vport = target_to_port(target); ++ ++ if (result) ++ vport->itn_id = 0; ++ return 0; ++} ++ + static ssize_t system_id_show(struct class_device *cdev, char *buf) + { + return snprintf(buf, PAGE_SIZE, "%s\n", system_id); +@@ -786,6 +813,7 @@ static struct scsi_host_template ibmvstgt_sht = { + .transfer_response = ibmvstgt_cmd_done, + .eh_abort_handler = ibmvstgt_eh_abort_handler, + .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response, ++ .it_nexus_response = ibmvstgt_it_nexus_response, + .shost_attrs = ibmvstgt_attrs, + .proc_name = TGT_NAME, + }; +@@ -837,8 +865,8 @@ static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id) + err = scsi_add_host(shost, target->dev); + if (err) + goto destroy_queue; +- return 0; + ++ return 0; + destroy_queue: + crq_queue_destroy(target); + free_srp_target: +diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c +index 5631c19..70fad38 100644 +--- a/drivers/scsi/libsrp.c ++++ b/drivers/scsi/libsrp.c +@@ -391,7 +391,7 @@ static int vscsis_data_length(struct srp_cmd *cmd, enum dma_data_direction dir) + } + + int srp_cmd_queue(struct Scsi_Host *shost, struct srp_cmd *cmd, void *info, +- u64 addr) ++ u64 itn_id, u64 addr) + { + enum dma_data_direction dir; + struct scsi_cmnd *sc; +@@ -427,7 +427,8 @@ int srp_cmd_queue(struct Scsi_Host *shost, struct srp_cmd *cmd, void *info, + sc->request_bufflen = len; + sc->request_buffer = (void *) (unsigned long) addr; + sc->tag = tag; +- err = scsi_tgt_queue_command(sc, (struct scsi_lun *) &cmd->lun, cmd->tag); ++ err = scsi_tgt_queue_command(sc, itn_id, (struct scsi_lun *)&cmd->lun, ++ cmd->tag); + if (err) + scsi_host_put_command(shost, sc); + +diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h +index d143171..ba615e4 100644 +--- a/include/scsi/libsrp.h ++++ b/include/scsi/libsrp.h +@@ -59,7 +59,7 @@ extern void srp_target_free(struct srp_target *); + extern struct iu_entry *srp_iu_get(struct srp_target *); + extern void srp_iu_put(struct iu_entry *); + +-extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64); ++extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64, u64); + extern int srp_transfer_data(struct scsi_cmnd *, struct srp_cmd *, + srp_rdma_t, int, int); + diff --git a/debian/patches/series/1~experimental.1 b/debian/patches/series/1~experimental.1 index 98a372b96..fc203283d 100644 --- a/debian/patches/series/1~experimental.1 +++ b/debian/patches/series/1~experimental.1 @@ -38,3 +38,5 @@ + features/fintek-f75375.patch + features/alpha/isa-mapping-support.patch + bugfix/powerpc/libgcc-__ucmpdi2.patch ++ features/all/drivers-scsi-target-it_nexus-1.patch ++ features/all/drivers-scsi-target-it_nexus-2.patch