From: Madhuranath Iyengar <mni@xxxxxxxxxxxxxxxxxxxxx> This patch allows for qla2xxx to start in target-mode operation by default. This addresses a problem with local initiator port I/O timeouts between the point when the port is brought up initially in initiator mode, and then transitioned via qla2x00_abort_isp() reset logic to run in target mode. This is accomplished by the following changes: *) Prevent qla2x00_init_rings() from being called in target mode from within qla2x00_initialize_adapter(). This will be called later during qla2x00_abort_isp() -> qla2x00_restart_isp() *) Add an extra qla2xxx_wake_dpc() call and prevent scsi_scan_host() from being called in qla2x00_probe_one() when initiator mode is disabled. *) Prevent full login after initial LIP, and LIP full login from initiator in firmware bits when initiator mode is disabled in qla24xx_nvram_config() *) Also disable LIP full login from initiator and enable target PRIL control in firmware bits in qla_tgt_24xx_config_nvram_stage1() when target mode operation is enabled. Note that this patch no longer explictly sets 'Disable initial LIP' for firmware_options_1 in qla_tgt_24xx_config_nvram_stage1(), which ends up causing intermittent LIP hangs for transition into target mode during qla2x00_abort_isp() operation. Signed-off-by: Madhuranath Iyengar <mni@xxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx> Cc: Patrick Lee <patrick@xxxxxxxxxxxxxxx> Cc: Andrew Vasquez <andrew.vasquez@xxxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxxxxxxxx> --- drivers/scsi/qla2xxx/qla_init.c | 12 +++++++++++- drivers/scsi/qla2xxx/qla_os.c | 13 ++++++++++++- drivers/scsi/qla2xxx/qla_target.c | 10 +++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index c7402aa..fca50d5 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -576,7 +576,10 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha) return QLA_FUNCTION_FAILED; } } - rval = qla2x00_init_rings(vha); + + if (qla_ini_mode_enabled(vha)) + rval = qla2x00_init_rings(vha); + ha->flags.chip_reset_done = 1; if (rval == QLA_SUCCESS && IS_QLA84XX(ha)) { @@ -4515,6 +4518,13 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) rval = 1; } + if (!qla_ini_mode_enabled(vha)) { + /* Don't enable full login after initial LIP */ + nv->firmware_options_1 &= __constant_cpu_to_le32(~BIT_13); + /* Don't enable LIP full login for initiator */ + nv->host_p &= __constant_cpu_to_le32(~BIT_10); + } + qla_tgt_24xx_config_nvram_stage1(vha, nv); /* Reset Initialization control block */ diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 6680c63..2ab9564 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2276,6 +2276,14 @@ que_init: goto probe_failed; } + /* + * If we're not coming up in initiator mode, we might sit for + * a while without waking up the dpc thread, which leads to a + * stuck process warning. So just kick the dpc once here and + * let the kthread start (and go back to sleep in qla2x00_do_dpc). + */ + qla2xxx_wake_dpc(base_vha); + skip_dpc: list_add_tail(&base_vha->list, &ha->vp_list); base_vha->host->irq = ha->pdev->irq; @@ -2313,7 +2321,10 @@ skip_dpc: base_vha->flags.init_done = 1; base_vha->flags.online = 1; - scsi_scan_host(host); + if (qla_ini_mode_enabled(base_vha)) + scsi_scan_host(host); + else + qla_printk(KERN_INFO, ha, "skipping scsi_scan_host() for non-initiator port\n"); qla2x00_alloc_sysfs_attr(base_vha); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 75a466a..757e971 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -44,14 +44,14 @@ #include "qla_def.h" #include "qla_target.h" -static char *qlini_mode = QLA2X_INI_MODE_STR_EXCLUSIVE; +static char *qlini_mode = QLA2X_INI_MODE_STR_DISABLED; module_param(qlini_mode, charp, S_IRUGO); MODULE_PARM_DESC(qlini_mode, "Determines when initiator mode will be enabled. Possible values: " - "\"exclusive\" (default) - initiator mode will be enabled on load, " + "\"exclusive\" - initiator mode will be enabled on load, " "disabled on enabling target mode and then on disabling target mode " "enabled back; " - "\"disabled\" - initiator mode will never be enabled; " + "\"disabled\" (default) - initiator mode will never be enabled; " "\"enabled\" - initiator mode will always stay enabled."); static int ql2x_ini_mode = QLA2X_INI_MODE_EXCLUSIVE; @@ -5476,6 +5476,10 @@ qla_tgt_24xx_config_nvram_stage1(struct scsi_qla_host *vha, struct nvram_24xx *n nv->firmware_options_1 &= __constant_cpu_to_le32(~BIT_9); /* Enable FC tapes support */ nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_12); + /* Disable Full Login after LIP */ + nv->host_p &= __constant_cpu_to_le32(~BIT_10); + /* Enable target PRLI control */ + nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_14); } else { if (ha->saved_set) { nv->exchange_count = ha->saved_exchange_count; -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html