diff mbox

[13/14] qla2xxx: Restore physical port WWPN only, when port down detected for FA-WWPN port.

Message ID 1428606008-14976-14-git-send-email-himanshu.madhani@qlogic.com (mailing list archive)
State New, archived
Headers show

Commit Message

Himanshu Madhani April 9, 2015, 7 p.m. UTC
From: Sawan Chandak <sawan.chandak@qlogic.com>

For FA-WWPN is enabled port, if NPIV created on that port and,
if port link is brought down, then WWPN was restored from flash for both
physical and NPIV port. This will result in NPIV port and physical port
sharing same WWPN. Any application refreshing ports information  will
not be able to scan NPIV port because of this behavior. So while restoring WWPN,
only restore physical port WWPN.

Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_isr.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

Comments

Hannes Reinecke April 10, 2015, 6:39 a.m. UTC | #1
On 04/09/2015 09:00 PM, Himanshu Madhani wrote:
> From: Sawan Chandak <sawan.chandak@qlogic.com>
> 
> For FA-WWPN is enabled port, if NPIV created on that port and,
> if port link is brought down, then WWPN was restored from flash for both
> physical and NPIV port. This will result in NPIV port and physical port
> sharing same WWPN. Any application refreshing ports information  will
> not be able to scan NPIV port because of this behavior. So while restoring WWPN,
> only restore physical port WWPN.
> 
> Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com>
> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
> ---
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 72dfbc1..6dc14cd 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -756,14 +756,23 @@  skip_rio:
 			/*
 			 * In case of loop down, restore WWPN from
 			 * NVRAM in case of FA-WWPN capable ISP
+			 * Restore for Physical Port only
 			 */
-			if (ha->flags.fawwpn_enabled) {
-				void *wwpn = ha->init_cb->port_name;
+			if (!vha->vp_idx) {
+				if (ha->flags.fawwpn_enabled) {
+					void *wwpn = ha->init_cb->port_name;
+					memcpy(vha->port_name, wwpn, WWN_SIZE);
+					fc_host_port_name(vha->host) =
+					    wwn_to_u64(vha->port_name);
+					ql_dbg(ql_dbg_init + ql_dbg_verbose,
+					    vha, 0x0144, "LOOP DOWN detected,"
+					    "restore WWPN %016llx\n",
+					    wwn_to_u64(vha->port_name));
+				}
 
-				memcpy(vha->port_name, wwpn, WWN_SIZE);
+				clear_bit(VP_CONFIG_OK, &vha->vp_flags);
 			}
 
-			clear_bit(VP_CONFIG_OK, &vha->vp_flags);
 			vha->device_flags |= DFLG_NO_CABLE;
 			qla2x00_mark_all_devices_lost(vha, 1);
 		}