[PATCH] qla_target: Convert to qlini_mode='enabled' by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

This patch for lio-core/target-pending changes the qlini_mode
module parameter in qla_target.c to by default enable initiator mode
operation in qla2xxx.ko LLD.  This means that target mode cannot not
be enabled with tcm_qla2xxx.ko code unless qlini_mode='disabled' is
explictly set at modprobe qla2xxx time.

It also changes struct qla_tgt setup from qla2x00_probe_one() to now
be skipped in initiator mode, and will set the following bit at runtime
if necessary in qla_tgt_add_target():

+       if (!(base_vha->host->hostt->supported_mode & MODE_TARGET))
+               base_vha->host->hostt->supported_mode |= MODE_TARGET;
+

in order for tcm_qla2xxx_make_lport() -> qla_tgt_lport_register()
to pickup MODE_TARGET when walking qla_tgt_glist for a matching
entry during /sys/kernel/config/target/qla2xxx/$LPORT_WWPN/ ->
scsi_qla_host registration.

Cc: Andrew Vasquez <andrew.vasquez@xxxxxxxxxx>
Cc: Arun Easi <arun.easi@xxxxxxxxxx>
Cc: Giridhar Malavali <giridhar.malavali@xxxxxxxxxx>
Cc: Roland Dreier <roland@xxxxxxxxxxxxxxx>
Cc: James Bottomley <JBottomley@xxxxxxxxxxxxx
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Joern Engel <joern@xxxxxxxxx>
Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_os.c     |    2 +-
 drivers/scsi/qla2xxx/qla_target.c |   17 ++++++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index f6c86a9..9759682 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -263,7 +263,7 @@ struct scsi_host_template qla2xxx_driver_template = {
 	.max_sectors		= 0xFFFF,
 	.shost_attrs		= qla2x00_host_attrs,
 
-	.supported_mode		= MODE_INITIATOR | MODE_TARGET,
+	.supported_mode		= MODE_INITIATOR,
 };
 
 static struct scsi_transport_template *qla2xxx_transport_template = NULL;
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 72b2fc4..cbbb627 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -43,15 +43,15 @@
 #include "qla_def.h"
 #include "qla_target.h"
 
-static char *qlini_mode = QLA2XXX_INI_MODE_STR_DISABLED;
+static char *qlini_mode = QLA2XXX_INI_MODE_STR_ENABLED;
 module_param(qlini_mode, charp, S_IRUGO);
 MODULE_PARM_DESC(qlini_mode,
 	"Determines when initiator mode will be enabled. Possible values: "
 	"\"exclusive\" - initiator mode will be enabled on load, "
 	"disabled on enabling target mode and then on disabling target mode "
 	"enabled back; "
-	"\"disabled\" (default) - initiator mode will never be enabled; "
-	"\"enabled\" - initiator mode will always stay enabled.");
+	"\"disabled\" - initiator mode will never be enabled; "
+	"\"enabled\" (default) - initiator mode will always stay enabled.");
 
 static int ql2x_ini_mode = QLA2XXX_INI_MODE_EXCLUSIVE;
 
@@ -4113,6 +4113,9 @@ int qla_tgt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha)
 {
 	struct qla_tgt *tgt;
 
+	if (ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED)
+		return 0;
+
 	ql_dbg(ql_dbg_tgt, base_vha, 0xe036, "Registering target for host %ld(%p)",
 			base_vha->host_no, ha);
 
@@ -4124,6 +4127,9 @@ int qla_tgt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha)
 		return -ENOMEM;
 	}
 
+	if (!(base_vha->host->hostt->supported_mode & MODE_TARGET))
+		base_vha->host->hostt->supported_mode |= MODE_TARGET;
+
 	tgt->ha = ha;
 	tgt->vha = base_vha;
 	init_waitqueue_head(&tgt->waitQ);
@@ -4160,11 +4166,8 @@ int qla_tgt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha)
 /* Must be called under tgt_host_action_mutex */
 int qla_tgt_remove_target(struct qla_hw_data *ha, struct scsi_qla_host *vha)
 {
-	if (!ha->qla_tgt) {
-		printk(KERN_ERR "qla_target(%d): Can't remove "
-			"existing target", vha->vp_idx);
+	if (!ha->qla_tgt)
 		return 0;
-	}
 
 	mutex_lock(&qla_tgt_mutex);
 	list_del(&ha->qla_tgt->tgt_list_entry);
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux