@@ -990,6 +990,9 @@ static struct scsi_host_template iscsi_iser_sht = {
.proc_name = "iscsi_iser",
.this_id = -1,
.track_queue_depth = 1,
+ .cmd_size = sizeof(struct iscsi_iser_task) +
+ sizeof(struct iscsi_task),
+ .init_cmd_priv = iscsi_init_cmd_priv,
};
static struct iscsi_transport iscsi_iser_transport = {
@@ -402,6 +402,8 @@ static struct scsi_host_template beiscsi_sht = {
.cmd_per_lun = BEISCSI_CMD_PER_LUN,
.vendor_id = SCSI_NL_VID_TYPE_PCI | BE_VENDOR_ID,
.track_queue_depth = 1,
+ .cmd_size = sizeof(struct beiscsi_io_task) + sizeof(struct iscsi_task),
+ .init_cmd_priv = iscsi_init_cmd_priv,
};
static struct scsi_transport_template *beiscsi_scsi_transport;
@@ -2850,6 +2850,23 @@ static void iscsi_host_dec_session_cnt(struct Scsi_Host *shost)
scsi_host_put(shost);
}
+static void iscsi_init_task(struct iscsi_task *task)
+{
+ task->dd_data = &task[1];
+ task->itt = ISCSI_RESERVED_TAG;
+ task->state = ISCSI_TASK_FREE;
+ INIT_LIST_HEAD(&task->running);
+}
+
+int iscsi_init_cmd_priv(struct Scsi_Host *shost, struct scsi_cmnd *sc)
+{
+ struct iscsi_task *task = scsi_cmd_priv(sc);
+
+ iscsi_init_task(task);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(iscsi_init_cmd_priv);
+
/**
* iscsi_session_setup - create iscsi cls session and host and session
* @iscsit: iscsi transport template
@@ -239,6 +239,9 @@ static struct scsi_host_template qla4xxx_driver_template = {
.this_id = -1,
.cmd_per_lun = 3,
.sg_tablesize = SG_ALL,
+ .cmd_size = sizeof(struct ql4_task_data) +
+ sizeof(struct iscsi_task),
+ .init_cmd_priv = iscsi_init_cmd_priv,
.max_sectors = 0xFFFF,
.shost_attrs = qla4xxx_host_attrs,
@@ -467,6 +467,7 @@ extern void __iscsi_put_task(struct iscsi_task *task);
extern void __iscsi_get_task(struct iscsi_task *task);
extern void iscsi_complete_scsi_task(struct iscsi_task *task,
uint32_t exp_cmdsn, uint32_t max_cmdsn);
+extern int iscsi_init_cmd_priv(struct Scsi_Host *shost, struct scsi_cmnd *cmd);
/*
* generic helpers
Use scsi_host_template cmd_size so the block/scsi-ml layers allocate the iscsi structs for the driver. This patch includes the easy drivers that just needed to set the size and a helper to init the iscsi task. Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/infiniband/ulp/iser/iscsi_iser.c | 3 +++ drivers/scsi/be2iscsi/be_main.c | 2 ++ drivers/scsi/libiscsi.c | 17 +++++++++++++++++ drivers/scsi/qla4xxx/ql4_os.c | 3 +++ include/scsi/libiscsi.h | 1 + 5 files changed, 26 insertions(+)