* [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
@ 2011-03-14 5:24 Vikas Chaudhary
2011-03-14 22:07 ` Mike Christie
0 siblings, 1 reply; 11+ messages in thread
From: Vikas Chaudhary @ 2011-03-14 5:24 UTC (permalink / raw)
To: James Bottomley
Cc: linux-scsi@vger.kernel.org, Vikas Chaudhary, Ravi Anand,
Lalit Chandivade, Karen Higgins, Mike Christie
From: Karen Higgins <karen.higgins@qlogic.com>
remove ha flag AF_HBA_GOING_AWAY and added flag AF_HA_REMOVAL
to mark the other ISP-4xxx port to indicate that the driver is
being removed, so that the other port will not re-initialize
while in the process of removing the ha due to driver unload
or hba hotplug.
Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_def.h | 3 +-
drivers/scsi/qla4xxx/ql4_isr.c | 2 +-
drivers/scsi/qla4xxx/ql4_mbx.c | 2 +-
drivers/scsi/qla4xxx/ql4_os.c | 62 +++++++++++++++++++++++++++++++--------
4 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 7aa60ee..b5fb245 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -358,6 +358,7 @@ struct isp_operations {
* Linux Host Adapter structure
*/
struct scsi_qla_host {
+ struct klist_node node;
/* Linux adapter configuration data */
unsigned long flags;
@@ -371,7 +372,7 @@ struct scsi_qla_host {
#define AF_LINK_UP 8 /* 0x00000100 */
#define AF_IRQ_ATTACHED 10 /* 0x00000400 */
#define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
-#define AF_HBA_GOING_AWAY 12 /* 0x00001000 */
+#define AF_HA_REMOVAL 12 /* 0x00001000 */
#define AF_INTx_ENABLED 15 /* 0x00008000 */
#define AF_MSI_ENABLED 16 /* 0x00010000 */
#define AF_MSIX_ENABLED 17 /* 0x00020000 */
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 2ef1a98..2f40ac7 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -801,7 +801,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
&ha->reg->ctrl_status);
readl(&ha->reg->ctrl_status);
- if (!test_bit(AF_HBA_GOING_AWAY, &ha->flags))
+ if (!test_bit(AF_HA_REMOVAL, &ha->flags))
set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
break;
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 379df2b..199fa64 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -151,7 +151,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
if (test_bit(AF_IRQ_ATTACHED, &ha->flags) &&
test_bit(AF_INTERRUPTS_ON, &ha->flags) &&
test_bit(AF_ONLINE, &ha->flags) &&
- !test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
+ !test_bit(AF_HA_REMOVAL, &ha->flags)) {
/* Do not poll for completion. Use completion queue */
set_bit(AF_MBOX_COMMAND_NOPOLL, &ha->flags);
wait_for_completion_timeout(&ha->mbx_intr_comp, MBOX_TOV * HZ);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 6068f80..59c5552 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -27,6 +27,11 @@ static char qla4xxx_version_str[40];
static struct kmem_cache *srb_cachep;
/*
+ * List of host adapters
+ */
+static struct klist qla4xxx_hostlist;
+
+/*
* Module parameter information and variables
*/
int ql4xdontresethba = 0;
@@ -749,12 +754,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
if (!pci_channel_offline(ha->pdev))
pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
- DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING AWAY\n",
- __func__));
- return;
- }
-
if (is_qla8022(ha)) {
qla4_8xxx_watchdog(ha);
}
@@ -1063,7 +1062,6 @@ void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha)
/* Disable the board */
ql4_printk(KERN_INFO, ha, "Disabling the board\n");
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT << 16);
qla4xxx_mark_all_devices_missing(ha);
@@ -1255,11 +1253,6 @@ static void qla4xxx_do_dpc(struct work_struct *work)
goto do_dpc_exit;
}
- /* HBA is in the process of being permanently disabled.
- * Don't process anything */
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags))
- return;
-
if (is_qla8022(ha)) {
if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) {
qla4_8xxx_idc_lock(ha);
@@ -1808,6 +1801,10 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
ha->host_no, ha->firmware_version[0], ha->firmware_version[1],
ha->patch_number, ha->build_number);
scsi_scan_host(host);
+
+ /* Insert new entry into the list of adapters. */
+ klist_add_tail(&ha->node, &qla4xxx_hostlist);
+
return 0;
probe_failed:
@@ -1824,6 +1821,41 @@ probe_disable_device:
}
/**
+ * qla4xxx_prevent_other_port_reinit - Mark the other ISP-4xxx port to indicate
+ * that the driver is being removed, so that the other port will not
+ * re-initialize while in the process of removing the ha due to driver unload
+ * or hba hotplug.
+ * @ha: pointer to adapter structure
+ **/
+static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
+{
+ struct scsi_qla_host *ha_listp;
+ struct klist_iter i;
+ struct klist_node *n;
+
+ klist_iter_init(&qla4xxx_hostlist, &i);
+ while ((n = klist_next(&i)) != NULL) {
+ ha_listp = container_of(n, struct scsi_qla_host, node);
+ if (ha == ha_listp)
+ continue;
+
+ if ((pci_domain_nr(ha->pdev->bus) ==
+ pci_domain_nr(ha_listp->pdev->bus)) &&
+ (ha->pdev->bus->number ==
+ ha_listp->pdev->bus->number) &&
+ (PCI_SLOT(ha->pdev->devfn) ==
+ PCI_SLOT(ha_listp->pdev->devfn))) {
+
+ set_bit(AF_HA_REMOVAL, &ha_listp->flags);
+ DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Prevent %s "
+ "reinit\n", __func__,
+ dev_name(&ha_listp->pdev->dev)));
+ }
+ }
+ klist_iter_exit(&i);
+}
+
+/**
* qla4xxx_remove_adapter - calback function to remove adapter.
* @pci_dev: PCI device pointer
**/
@@ -1833,7 +1865,10 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev)
ha = pci_get_drvdata(pdev);
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
+ if (!is_qla8022(ha))
+ qla4xxx_prevent_other_port_reinit(ha);
+
+ klist_remove(&ha->node);
/* remove devs from iscsi_sessions to scsi_devices */
qla4xxx_free_ddb_list(ha);
@@ -2546,6 +2581,7 @@ static int __init qla4xxx_module_init(void)
{
int ret;
+ klist_init(&qla4xxx_hostlist, NULL, NULL);
/* Allocate cache for SRBs. */
srb_cachep = kmem_cache_create("qla4xxx_srbs", sizeof(struct srb), 0,
SLAB_HWCACHE_ALIGN, NULL);
--
1.7.3.2
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
2011-03-14 5:24 [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter Vikas Chaudhary
@ 2011-03-14 22:07 ` Mike Christie
2011-03-15 9:21 ` Vikas Chaudhary
0 siblings, 1 reply; 11+ messages in thread
From: Mike Christie @ 2011-03-14 22:07 UTC (permalink / raw)
To: Vikas Chaudhary
Cc: James Bottomley, linux-scsi@vger.kernel.org, Ravi Anand,
Lalit Chandivade, Karen Higgins
On 03/14/2011 12:24 AM, Vikas Chaudhary wrote:
> index 6068f80..59c5552 100644
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -27,6 +27,11 @@ static char qla4xxx_version_str[40];
> static struct kmem_cache *srb_cachep;
>
> /*
> + * List of host adapters
> + */
> +static struct klist qla4xxx_hostlist;
> +
>
> /**
> + * qla4xxx_prevent_other_port_reinit - Mark the other ISP-4xxx port to indicate
> + * that the driver is being removed, so that the other port will not
> + * re-initialize while in the process of removing the ha due to driver unload
> + * or hba hotplug.
For docbook comments you use a one line description on the first line,
then add more informative stuff after the params.
> + * @ha: pointer to adapter structure
> + **/
> +static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
> +{
> + struct scsi_qla_host *ha_listp;
> + struct klist_iter i;
> + struct klist_node *n;
> +
> + klist_iter_init(&qla4xxx_hostlist,&i);
> + while ((n = klist_next(&i)) != NULL) {
> + ha_listp = container_of(n, struct scsi_qla_host, node);
> + if (ha == ha_listp)
> + continue;
> +
> + if ((pci_domain_nr(ha->pdev->bus) ==
> + pci_domain_nr(ha_listp->pdev->bus))&&
> + (ha->pdev->bus->number ==
> + ha_listp->pdev->bus->number)&&
> + (PCI_SLOT(ha->pdev->devfn) ==
> + PCI_SLOT(ha_listp->pdev->devfn))) {
> +
Is there a qla4xxx specific reason why you need to prevent other ports
from re-initing when removing a port? Does the hardware cause the other
ports to be disrupted and that causes them to run the re-init code?
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
2011-03-14 22:07 ` Mike Christie
@ 2011-03-15 9:21 ` Vikas Chaudhary
2011-03-16 1:21 ` Mike Christie
0 siblings, 1 reply; 11+ messages in thread
From: Vikas Chaudhary @ 2011-03-15 9:21 UTC (permalink / raw)
To: Mike Christie
Cc: James Bottomley, linux-scsi@vger.kernel.org, Ravi Anand,
Lalit Chandivade, Karen Higgins
>-----Original Message-----
>From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
>owner@vger.kernel.org] On Behalf Of Mike Christie
>Sent: Tuesday, March 15, 2011 3:37 AM
>To: Vikas Chaudhary
>Cc: James Bottomley; linux-scsi@vger.kernel.org; Ravi Anand; Lalit
>Chandivade; Karen Higgins
>Subject: Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization
>during remove_adapter
>
>On 03/14/2011 12:24 AM, Vikas Chaudhary wrote:
>> index 6068f80..59c5552 100644
>> --- a/drivers/scsi/qla4xxx/ql4_os.c
>> +++ b/drivers/scsi/qla4xxx/ql4_os.c
>> @@ -27,6 +27,11 @@ static char qla4xxx_version_str[40];
>> static struct kmem_cache *srb_cachep;
>>
>> /*
>> + * List of host adapters
>> + */
>> +static struct klist qla4xxx_hostlist;
>> +
>
>
>
>>
>> /**
>> + * qla4xxx_prevent_other_port_reinit - Mark the other ISP-4xxx port to
>indicate
>> + * that the driver is being removed, so that the other port will not
>> + * re-initialize while in the process of removing the ha due to driver
>unload
>> + * or hba hotplug.
>
>For docbook comments you use a one line description on the first line,
>then add more informative stuff after the params.
>
Ok, I will be sending updated patch in next email.
>
>> + * @ha: pointer to adapter structure
>> + **/
>> +static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
>> +{
>> + struct scsi_qla_host *ha_listp;
>> + struct klist_iter i;
>> + struct klist_node *n;
>> +
>> + klist_iter_init(&qla4xxx_hostlist,&i);
>> + while ((n = klist_next(&i)) != NULL) {
>> + ha_listp = container_of(n, struct scsi_qla_host, node);
>> + if (ha == ha_listp)
>> + continue;
>> +
>> + if ((pci_domain_nr(ha->pdev->bus) ==
>> + pci_domain_nr(ha_listp->pdev->bus))&&
>> + (ha->pdev->bus->number ==
>> + ha_listp->pdev->bus->number)&&
>> + (PCI_SLOT(ha->pdev->devfn) ==
>> + PCI_SLOT(ha_listp->pdev->devfn))) {
>> +
>
>Is there a qla4xxx specific reason why you need to prevent other ports
>from re-initing when removing a port? Does the hardware cause the other
>ports to be disrupted and that causes them to run the re-init code?
Yes, its ISP40XX specific. While unloading driver we make call to function
"qla4xxx_hw_reset" from "qla4xxx_free_adapter". When driver do hw_reset
for one port, hardware will generate interrupt for other ports to inform
reset is about to happen. After this interrupt driver will schedule reset
for other port by setting dpc flag "DPC_RESET_HA_INTR" in function
"qla4xxx_intr_handler" this will cause re-initialization of other port
after reset, but while unloading driver we don't want to schedule reset
for the other port as other port does not need re-initialization".
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
@ 2011-03-15 9:23 Vikas Chaudhary
0 siblings, 0 replies; 11+ messages in thread
From: Vikas Chaudhary @ 2011-03-15 9:23 UTC (permalink / raw)
To: James Bottomley
Cc: linux-scsi@vger.kernel.org, Vikas Chaudhary, Lalit Chandivade,
Ravi Anand, Karen Higgins, Mike Christie
From: Karen Higgins <karen.higgins@qlogic.com>
remove ha flag AF_HBA_GOING_AWAY and added flag AF_HA_REMOVAL
to mark the other ISP-4xxx port to indicate that the driver is
being removed, so that the other port will not re-initialize
while in the process of removing the ha due to driver unload
or hba hotplug.
Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_def.h | 3 +-
drivers/scsi/qla4xxx/ql4_isr.c | 2 +-
drivers/scsi/qla4xxx/ql4_mbx.c | 2 +-
drivers/scsi/qla4xxx/ql4_os.c | 63 +++++++++++++++++++++++++++++++--------
4 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 7aa60ee..b5fb245 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -358,6 +358,7 @@ struct isp_operations {
* Linux Host Adapter structure
*/
struct scsi_qla_host {
+ struct klist_node node;
/* Linux adapter configuration data */
unsigned long flags;
@@ -371,7 +372,7 @@ struct scsi_qla_host {
#define AF_LINK_UP 8 /* 0x00000100 */
#define AF_IRQ_ATTACHED 10 /* 0x00000400 */
#define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
-#define AF_HBA_GOING_AWAY 12 /* 0x00001000 */
+#define AF_HA_REMOVAL 12 /* 0x00001000 */
#define AF_INTx_ENABLED 15 /* 0x00008000 */
#define AF_MSI_ENABLED 16 /* 0x00010000 */
#define AF_MSIX_ENABLED 17 /* 0x00020000 */
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 2ef1a98..2f40ac7 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -801,7 +801,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
&ha->reg->ctrl_status);
readl(&ha->reg->ctrl_status);
- if (!test_bit(AF_HBA_GOING_AWAY, &ha->flags))
+ if (!test_bit(AF_HA_REMOVAL, &ha->flags))
set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
break;
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 379df2b..199fa64 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -151,7 +151,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
if (test_bit(AF_IRQ_ATTACHED, &ha->flags) &&
test_bit(AF_INTERRUPTS_ON, &ha->flags) &&
test_bit(AF_ONLINE, &ha->flags) &&
- !test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
+ !test_bit(AF_HA_REMOVAL, &ha->flags)) {
/* Do not poll for completion. Use completion queue */
set_bit(AF_MBOX_COMMAND_NOPOLL, &ha->flags);
wait_for_completion_timeout(&ha->mbx_intr_comp, MBOX_TOV * HZ);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 6068f80..78329a2 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -27,6 +27,11 @@ static char qla4xxx_version_str[40];
static struct kmem_cache *srb_cachep;
/*
+ * List of host adapters
+ */
+static struct klist qla4xxx_hostlist;
+
+/*
* Module parameter information and variables
*/
int ql4xdontresethba = 0;
@@ -749,12 +754,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
if (!pci_channel_offline(ha->pdev))
pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
- DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING AWAY\n",
- __func__));
- return;
- }
-
if (is_qla8022(ha)) {
qla4_8xxx_watchdog(ha);
}
@@ -1063,7 +1062,6 @@ void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha)
/* Disable the board */
ql4_printk(KERN_INFO, ha, "Disabling the board\n");
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT << 16);
qla4xxx_mark_all_devices_missing(ha);
@@ -1255,11 +1253,6 @@ static void qla4xxx_do_dpc(struct work_struct *work)
goto do_dpc_exit;
}
- /* HBA is in the process of being permanently disabled.
- * Don't process anything */
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags))
- return;
-
if (is_qla8022(ha)) {
if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) {
qla4_8xxx_idc_lock(ha);
@@ -1808,6 +1801,10 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
ha->host_no, ha->firmware_version[0], ha->firmware_version[1],
ha->patch_number, ha->build_number);
scsi_scan_host(host);
+
+ /* Insert new entry into the list of adapters. */
+ klist_add_tail(&ha->node, &qla4xxx_hostlist);
+
return 0;
probe_failed:
@@ -1824,6 +1821,42 @@ probe_disable_device:
}
/**
+ * qla4xxx_prevent_other_port_reinit - prevent other port from re-initialize
+ * @ha: pointer to adapter structure
+ *
+ * Mark the other ISP-4xxx port to indicate that the driver is being removed,
+ * so that the other port will not re-initialize while in the process of
+ * removing the ha due to driver unload or hba hotplug.
+ **/
+static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
+{
+ struct scsi_qla_host *ha_listp;
+ struct klist_iter i;
+ struct klist_node *n;
+
+ klist_iter_init(&qla4xxx_hostlist, &i);
+ while ((n = klist_next(&i)) != NULL) {
+ ha_listp = container_of(n, struct scsi_qla_host, node);
+ if (ha == ha_listp)
+ continue;
+
+ if ((pci_domain_nr(ha->pdev->bus) ==
+ pci_domain_nr(ha_listp->pdev->bus)) &&
+ (ha->pdev->bus->number ==
+ ha_listp->pdev->bus->number) &&
+ (PCI_SLOT(ha->pdev->devfn) ==
+ PCI_SLOT(ha_listp->pdev->devfn))) {
+
+ set_bit(AF_HA_REMOVAL, &ha_listp->flags);
+ DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Prevent %s "
+ "reinit\n", __func__,
+ dev_name(&ha_listp->pdev->dev)));
+ }
+ }
+ klist_iter_exit(&i);
+}
+
+/**
* qla4xxx_remove_adapter - calback function to remove adapter.
* @pci_dev: PCI device pointer
**/
@@ -1833,7 +1866,10 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev)
ha = pci_get_drvdata(pdev);
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
+ if (!is_qla8022(ha))
+ qla4xxx_prevent_other_port_reinit(ha);
+
+ klist_remove(&ha->node);
/* remove devs from iscsi_sessions to scsi_devices */
qla4xxx_free_ddb_list(ha);
@@ -2546,6 +2582,7 @@ static int __init qla4xxx_module_init(void)
{
int ret;
+ klist_init(&qla4xxx_hostlist, NULL, NULL);
/* Allocate cache for SRBs. */
srb_cachep = kmem_cache_create("qla4xxx_srbs", sizeof(struct srb), 0,
SLAB_HWCACHE_ALIGN, NULL);
--
1.7.3.2
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
2011-03-15 9:21 ` Vikas Chaudhary
@ 2011-03-16 1:21 ` Mike Christie
2011-03-16 12:27 ` Vikas Chaudhary
0 siblings, 1 reply; 11+ messages in thread
From: Mike Christie @ 2011-03-16 1:21 UTC (permalink / raw)
To: Vikas Chaudhary
Cc: James Bottomley, linux-scsi@vger.kernel.org, Ravi Anand,
Lalit Chandivade, Karen Higgins
On 03/15/2011 04:21 AM, Vikas Chaudhary wrote:
>> -----Original Message-----
>> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
>> owner@vger.kernel.org] On Behalf Of Mike Christie
>> Sent: Tuesday, March 15, 2011 3:37 AM
>> To: Vikas Chaudhary
>> Cc: James Bottomley; linux-scsi@vger.kernel.org; Ravi Anand; Lalit
>> Chandivade; Karen Higgins
>> Subject: Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization
>> during remove_adapter
>>
>> On 03/14/2011 12:24 AM, Vikas Chaudhary wrote:
>>> index 6068f80..59c5552 100644
>>> --- a/drivers/scsi/qla4xxx/ql4_os.c
>>> +++ b/drivers/scsi/qla4xxx/ql4_os.c
>>> @@ -27,6 +27,11 @@ static char qla4xxx_version_str[40];
>>> static struct kmem_cache *srb_cachep;
>>>
>>> /*
>>> + * List of host adapters
>>> + */
>>> +static struct klist qla4xxx_hostlist;
>>> +
>>
>>
>>
>>>
>>> /**
>>> + * qla4xxx_prevent_other_port_reinit - Mark the other ISP-4xxx port to
>> indicate
>>> + * that the driver is being removed, so that the other port will not
>>> + * re-initialize while in the process of removing the ha due to driver
>> unload
>>> + * or hba hotplug.
>>
>> For docbook comments you use a one line description on the first line,
>> then add more informative stuff after the params.
>>
>
> Ok, I will be sending updated patch in next email.
>
>>
>>> + * @ha: pointer to adapter structure
>>> + **/
>>> +static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
>>> +{
>>> + struct scsi_qla_host *ha_listp;
>>> + struct klist_iter i;
>>> + struct klist_node *n;
>>> +
>>> + klist_iter_init(&qla4xxx_hostlist,&i);
>>> + while ((n = klist_next(&i)) != NULL) {
>>> + ha_listp = container_of(n, struct scsi_qla_host, node);
>>> + if (ha == ha_listp)
>>> + continue;
>>> +
>>> + if ((pci_domain_nr(ha->pdev->bus) ==
>>> + pci_domain_nr(ha_listp->pdev->bus))&&
>>> + (ha->pdev->bus->number ==
>>> + ha_listp->pdev->bus->number)&&
>>> + (PCI_SLOT(ha->pdev->devfn) ==
>>> + PCI_SLOT(ha_listp->pdev->devfn))) {
>>> +
>>
>> Is there a qla4xxx specific reason why you need to prevent other ports
>>from re-initing when removing a port? Does the hardware cause the other
>> ports to be disrupted and that causes them to run the re-init code?
>
> Yes, its ISP40XX specific. While unloading driver we make call to function
> "qla4xxx_hw_reset" from "qla4xxx_free_adapter". When driver do hw_reset
> for one port, hardware will generate interrupt for other ports to inform
> reset is about to happen. After this interrupt driver will schedule reset
> for other port by setting dpc flag "DPC_RESET_HA_INTR" in function
> "qla4xxx_intr_handler" this will cause re-initialization of other port
> after reset, but while unloading driver we don't want to schedule reset
> for the other port as other port does not need re-initialization".
>
Ok.
I think that the driver should not be needing to manage a list of hosts
though. We have the driver model related lists already. There is also
the pci bus stuff. So I think you should be using one of those.
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
2011-03-16 1:21 ` Mike Christie
@ 2011-03-16 12:27 ` Vikas Chaudhary
0 siblings, 0 replies; 11+ messages in thread
From: Vikas Chaudhary @ 2011-03-16 12:27 UTC (permalink / raw)
To: Mike Christie
Cc: James Bottomley, linux-scsi@vger.kernel.org, Ravi Anand,
Lalit Chandivade, Karen Higgins
>-----Original Message-----
>From: Mike Christie [mailto:michaelc@cs.wisc.edu]
>Sent: Wednesday, March 16, 2011 6:51 AM
>To: Vikas Chaudhary
>Cc: James Bottomley; linux-scsi@vger.kernel.org; Ravi Anand; Lalit
>Chandivade; Karen Higgins
>Subject: Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization
>during remove_adapter
>
>On 03/15/2011 04:21 AM, Vikas Chaudhary wrote:
>>> -----Original Message-----
>>> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
>>> owner@vger.kernel.org] On Behalf Of Mike Christie
>>> Sent: Tuesday, March 15, 2011 3:37 AM
>>> To: Vikas Chaudhary
>>> Cc: James Bottomley; linux-scsi@vger.kernel.org; Ravi Anand; Lalit
>>> Chandivade; Karen Higgins
>>> Subject: Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization
>>> during remove_adapter
>>>
>>> On 03/14/2011 12:24 AM, Vikas Chaudhary wrote:
>>>> index 6068f80..59c5552 100644
>>>> --- a/drivers/scsi/qla4xxx/ql4_os.c
>>>> +++ b/drivers/scsi/qla4xxx/ql4_os.c
>>>> @@ -27,6 +27,11 @@ static char qla4xxx_version_str[40];
>>>> static struct kmem_cache *srb_cachep;
>>>>
>>>> /*
>>>> + * List of host adapters
>>>> + */
>>>> +static struct klist qla4xxx_hostlist;
>>>> +
>>>
>>>
>>>
>>>>
>>>> /**
>>>> + * qla4xxx_prevent_other_port_reinit - Mark the other ISP-4xxx port to
>>> indicate
>>>> + * that the driver is being removed, so that the other port will not
>>>> + * re-initialize while in the process of removing the ha due to driver
>>> unload
>>>> + * or hba hotplug.
>>>
>>> For docbook comments you use a one line description on the first line,
>>> then add more informative stuff after the params.
>>>
>>
>> Ok, I will be sending updated patch in next email.
>>
>>>
>>>> + * @ha: pointer to adapter structure
>>>> + **/
>>>> +static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host
>*ha)
>>>> +{
>>>> + struct scsi_qla_host *ha_listp;
>>>> + struct klist_iter i;
>>>> + struct klist_node *n;
>>>> +
>>>> + klist_iter_init(&qla4xxx_hostlist,&i);
>>>> + while ((n = klist_next(&i)) != NULL) {
>>>> + ha_listp = container_of(n, struct scsi_qla_host, node);
>>>> + if (ha == ha_listp)
>>>> + continue;
>>>> +
>>>> + if ((pci_domain_nr(ha->pdev->bus) ==
>>>> + pci_domain_nr(ha_listp->pdev->bus))&&
>>>> + (ha->pdev->bus->number ==
>>>> + ha_listp->pdev->bus->number)&&
>>>> + (PCI_SLOT(ha->pdev->devfn) ==
>>>> + PCI_SLOT(ha_listp->pdev->devfn))) {
>>>> +
>>>
>>> Is there a qla4xxx specific reason why you need to prevent other ports
>>>from re-initing when removing a port? Does the hardware cause the other
>>> ports to be disrupted and that causes them to run the re-init code?
>>
>> Yes, its ISP40XX specific. While unloading driver we make call to
>function
>> "qla4xxx_hw_reset" from "qla4xxx_free_adapter". When driver do hw_reset
>> for one port, hardware will generate interrupt for other ports to inform
>> reset is about to happen. After this interrupt driver will schedule reset
>> for other port by setting dpc flag "DPC_RESET_HA_INTR" in function
>> "qla4xxx_intr_handler" this will cause re-initialization of other port
>> after reset, but while unloading driver we don't want to schedule reset
>> for the other port as other port does not need re-initialization".
>>
>
>Ok.
>
>I think that the driver should not be needing to manage a list of hosts
>though. We have the driver model related lists already. There is also
>the pci bus stuff. So I think you should be using one of those.
Agreed. Sending modified patch in next email.
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
@ 2011-03-16 12:29 Vikas Chaudhary
2011-03-16 19:23 ` Mike Christie
0 siblings, 1 reply; 11+ messages in thread
From: Vikas Chaudhary @ 2011-03-16 12:29 UTC (permalink / raw)
To: James Bottomley
Cc: linux-scsi@vger.kernel.org, Vikas Chaudhary, Lalit Chandivade,
Ravi Anand, Karen Higgins, Mike Christie
From: Karen Higgins <karen.higgins@qlogic.com>
remove ha flag AF_HBA_GOING_AWAY and added flag AF_HA_REMOVAL
to mark the other ISP-4xxx port to indicate that the driver is
being removed, so that the other port will not re-initialize
while in the process of removing the ha due to driver unload
or hba hotplug.
Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_def.h | 5 +++-
drivers/scsi/qla4xxx/ql4_isr.c | 2 +-
drivers/scsi/qla4xxx/ql4_mbx.c | 2 +-
drivers/scsi/qla4xxx/ql4_os.c | 51 +++++++++++++++++++++++++++++----------
4 files changed, 44 insertions(+), 16 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 7aa60ee..c1f8d1b 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -53,6 +53,9 @@
#define PCI_DEVICE_ID_QLOGIC_ISP8022 0x8022
#endif
+#define ISP4XXX_PCI_FN_1 0x1
+#define ISP4XXX_PCI_FN_2 0x3
+
#define QLA_SUCCESS 0
#define QLA_ERROR 1
@@ -371,7 +374,7 @@ struct scsi_qla_host {
#define AF_LINK_UP 8 /* 0x00000100 */
#define AF_IRQ_ATTACHED 10 /* 0x00000400 */
#define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
-#define AF_HBA_GOING_AWAY 12 /* 0x00001000 */
+#define AF_HA_REMOVAL 12 /* 0x00001000 */
#define AF_INTx_ENABLED 15 /* 0x00008000 */
#define AF_MSI_ENABLED 16 /* 0x00010000 */
#define AF_MSIX_ENABLED 17 /* 0x00020000 */
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 2ef1a98..2f40ac7 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -801,7 +801,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
&ha->reg->ctrl_status);
readl(&ha->reg->ctrl_status);
- if (!test_bit(AF_HBA_GOING_AWAY, &ha->flags))
+ if (!test_bit(AF_HA_REMOVAL, &ha->flags))
set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
break;
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 379df2b..199fa64 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -151,7 +151,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
if (test_bit(AF_IRQ_ATTACHED, &ha->flags) &&
test_bit(AF_INTERRUPTS_ON, &ha->flags) &&
test_bit(AF_ONLINE, &ha->flags) &&
- !test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
+ !test_bit(AF_HA_REMOVAL, &ha->flags)) {
/* Do not poll for completion. Use completion queue */
set_bit(AF_MBOX_COMMAND_NOPOLL, &ha->flags);
wait_for_completion_timeout(&ha->mbx_intr_comp, MBOX_TOV * HZ);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 6068f80..3ab4618 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -749,12 +749,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
if (!pci_channel_offline(ha->pdev))
pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
- DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING AWAY\n",
- __func__));
- return;
- }
-
if (is_qla8022(ha)) {
qla4_8xxx_watchdog(ha);
}
@@ -1063,7 +1057,6 @@ void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha)
/* Disable the board */
ql4_printk(KERN_INFO, ha, "Disabling the board\n");
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT << 16);
qla4xxx_mark_all_devices_missing(ha);
@@ -1255,11 +1248,6 @@ static void qla4xxx_do_dpc(struct work_struct *work)
goto do_dpc_exit;
}
- /* HBA is in the process of being permanently disabled.
- * Don't process anything */
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags))
- return;
-
if (is_qla8022(ha)) {
if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) {
qla4_8xxx_idc_lock(ha);
@@ -1824,6 +1812,42 @@ probe_disable_device:
}
/**
+ * qla4xxx_prevent_other_port_reinit - prevent other port from re-initialize
+ * @ha: pointer to adapter structure
+ *
+ * Mark the other ISP-4xxx port to indicate that the driver is being removed,
+ * so that the other port will not re-initialize while in the process of
+ * removing the ha due to driver unload or hba hotplug.
+ **/
+static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
+{
+ struct scsi_qla_host *other_ha = NULL;
+ struct pci_dev *other_pdev = NULL;
+ int fn = ISP4XXX_PCI_FN_2;
+
+ /*iscsi function numbers for ISP4xxx is 1 and 3*/
+ if (PCI_FUNC(ha->pdev->devfn) & BIT_1)
+ fn = ISP4XXX_PCI_FN_1;
+
+ other_pdev =
+ pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus),
+ ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn),
+ fn));
+
+ /* Get other_ha if other_pdev state is enable*/
+ if (atomic_read(&other_pdev->enable_cnt)) {
+ other_ha = pci_get_drvdata(other_pdev);
+ if (other_ha) {
+ set_bit(AF_HA_REMOVAL, &other_ha->flags);
+ DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Prevent %s "
+ "reinit\n", __func__,
+ dev_name(&other_ha->pdev->dev)));
+ pci_dev_put(other_pdev);
+ }
+ }
+}
+
+/**
* qla4xxx_remove_adapter - calback function to remove adapter.
* @pci_dev: PCI device pointer
**/
@@ -1833,7 +1857,8 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev)
ha = pci_get_drvdata(pdev);
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
+ if (!is_qla8022(ha))
+ qla4xxx_prevent_other_port_reinit(ha);
/* remove devs from iscsi_sessions to scsi_devices */
qla4xxx_free_ddb_list(ha);
--
1.7.3.2
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
2011-03-16 12:29 Vikas Chaudhary
@ 2011-03-16 19:23 ` Mike Christie
2011-03-17 8:44 ` Vikas Chaudhary
0 siblings, 1 reply; 11+ messages in thread
From: Mike Christie @ 2011-03-16 19:23 UTC (permalink / raw)
To: Vikas Chaudhary
Cc: James Bottomley, linux-scsi@vger.kernel.org, Lalit Chandivade,
Ravi Anand, Karen Higgins
On 03/16/2011 07:29 AM, Vikas Chaudhary wrote:
> From: Karen Higgins<karen.higgins@qlogic.com>
>
> remove ha flag AF_HBA_GOING_AWAY and added flag AF_HA_REMOVAL
> to mark the other ISP-4xxx port to indicate that the driver is
> being removed, so that the other port will not re-initialize
> while in the process of removing the ha due to driver unload
> or hba hotplug.
>
> Signed-off-by: Karen Higgins<karen.higgins@qlogic.com>
> Signed-off-by: Vikas Chaudhary<vikas.chaudhary@qlogic.com>
> ---
> drivers/scsi/qla4xxx/ql4_def.h | 5 +++-
> drivers/scsi/qla4xxx/ql4_isr.c | 2 +-
> drivers/scsi/qla4xxx/ql4_mbx.c | 2 +-
> drivers/scsi/qla4xxx/ql4_os.c | 51 +++++++++++++++++++++++++++++----------
> 4 files changed, 44 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
> index 7aa60ee..c1f8d1b 100644
> --- a/drivers/scsi/qla4xxx/ql4_def.h
> +++ b/drivers/scsi/qla4xxx/ql4_def.h
> @@ -53,6 +53,9 @@
> #define PCI_DEVICE_ID_QLOGIC_ISP8022 0x8022
> #endif
>
> +#define ISP4XXX_PCI_FN_1 0x1
> +#define ISP4XXX_PCI_FN_2 0x3
> +
> #define QLA_SUCCESS 0
> #define QLA_ERROR 1
>
> @@ -371,7 +374,7 @@ struct scsi_qla_host {
> #define AF_LINK_UP 8 /* 0x00000100 */
> #define AF_IRQ_ATTACHED 10 /* 0x00000400 */
> #define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
> -#define AF_HBA_GOING_AWAY 12 /* 0x00001000 */
> +#define AF_HA_REMOVAL 12 /* 0x00001000 */
> #define AF_INTx_ENABLED 15 /* 0x00008000 */
> #define AF_MSI_ENABLED 16 /* 0x00010000 */
> #define AF_MSIX_ENABLED 17 /* 0x00020000 */
> diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
> index 2ef1a98..2f40ac7 100644
> --- a/drivers/scsi/qla4xxx/ql4_isr.c
> +++ b/drivers/scsi/qla4xxx/ql4_isr.c
> @@ -801,7 +801,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
> &ha->reg->ctrl_status);
> readl(&ha->reg->ctrl_status);
>
> - if (!test_bit(AF_HBA_GOING_AWAY,&ha->flags))
> + if (!test_bit(AF_HA_REMOVAL,&ha->flags))
> set_bit(DPC_RESET_HA_INTR,&ha->dpc_flags);
>
> break;
> diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
> index 379df2b..199fa64 100644
> --- a/drivers/scsi/qla4xxx/ql4_mbx.c
> +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
> @@ -151,7 +151,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
> if (test_bit(AF_IRQ_ATTACHED,&ha->flags)&&
> test_bit(AF_INTERRUPTS_ON,&ha->flags)&&
> test_bit(AF_ONLINE,&ha->flags)&&
> - !test_bit(AF_HBA_GOING_AWAY,&ha->flags)) {
> + !test_bit(AF_HA_REMOVAL,&ha->flags)) {
> /* Do not poll for completion. Use completion queue */
> set_bit(AF_MBOX_COMMAND_NOPOLL,&ha->flags);
> wait_for_completion_timeout(&ha->mbx_intr_comp, MBOX_TOV * HZ);
> diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
> index 6068f80..3ab4618 100644
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -749,12 +749,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
> if (!pci_channel_offline(ha->pdev))
> pci_read_config_word(ha->pdev, PCI_VENDOR_ID,&w);
>
> - if (test_bit(AF_HBA_GOING_AWAY,&ha->flags)) {
> - DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING AWAY\n",
> - __func__));
> - return;
> - }
> -
> if (is_qla8022(ha)) {
> qla4_8xxx_watchdog(ha);
> }
> @@ -1063,7 +1057,6 @@ void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha)
>
> /* Disable the board */
> ql4_printk(KERN_INFO, ha, "Disabling the board\n");
> - set_bit(AF_HBA_GOING_AWAY,&ha->flags);
>
> qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT<< 16);
> qla4xxx_mark_all_devices_missing(ha);
> @@ -1255,11 +1248,6 @@ static void qla4xxx_do_dpc(struct work_struct *work)
> goto do_dpc_exit;
> }
>
> - /* HBA is in the process of being permanently disabled.
> - * Don't process anything */
> - if (test_bit(AF_HBA_GOING_AWAY,&ha->flags))
> - return;
> -
> if (is_qla8022(ha)) {
> if (test_bit(DPC_HA_UNRECOVERABLE,&ha->dpc_flags)) {
> qla4_8xxx_idc_lock(ha);
> @@ -1824,6 +1812,42 @@ probe_disable_device:
> }
>
> /**
> + * qla4xxx_prevent_other_port_reinit - prevent other port from re-initialize
> + * @ha: pointer to adapter structure
> + *
> + * Mark the other ISP-4xxx port to indicate that the driver is being removed,
> + * so that the other port will not re-initialize while in the process of
> + * removing the ha due to driver unload or hba hotplug.
> + **/
> +static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
> +{
> + struct scsi_qla_host *other_ha = NULL;
> + struct pci_dev *other_pdev = NULL;
> + int fn = ISP4XXX_PCI_FN_2;
> +
> + /*iscsi function numbers for ISP4xxx is 1 and 3*/
> + if (PCI_FUNC(ha->pdev->devfn)& BIT_1)
> + fn = ISP4XXX_PCI_FN_1;
> +
> + other_pdev =
> + pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus),
> + ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn),
> + fn));
> +
Is there ever going to be a single port on these cards? If so then a
null check is needed right?
> + /* Get other_ha if other_pdev state is enable*/
> + if (atomic_read(&other_pdev->enable_cnt)) {
> + other_ha = pci_get_drvdata(other_pdev);
> + if (other_ha) {
> + set_bit(AF_HA_REMOVAL,&other_ha->flags);
> + DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Prevent %s "
> + "reinit\n", __func__,
> + dev_name(&other_ha->pdev->dev)));
> + pci_dev_put(other_pdev);
I think if pci_get_domain_bus_and_slot returns a device then it always
has a refcount taken. If that is right then I think you need to move
this pci_dev_put outside of these if chunks, so that pci_dev_put is
called if a other_pdev is non-null.
> + }
> + }
> +}
> +
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
2011-03-16 19:23 ` Mike Christie
@ 2011-03-17 8:44 ` Vikas Chaudhary
0 siblings, 0 replies; 11+ messages in thread
From: Vikas Chaudhary @ 2011-03-17 8:44 UTC (permalink / raw)
To: Mike Christie
Cc: James Bottomley, linux-scsi@vger.kernel.org, Lalit Chandivade,
Ravi Anand, Karen Higgins
>-----Original Message-----
>From: Mike Christie [mailto:michaelc@cs.wisc.edu]
>Sent: Thursday, March 17, 2011 12:54 AM
>To: Vikas Chaudhary
>Cc: James Bottomley; linux-scsi@vger.kernel.org; Lalit Chandivade; Ravi
>Anand; Karen Higgins
>Subject: Re: [PATCH 06/13] qla4xxx: Prevent other port reinitialization
>during remove_adapter
>
>On 03/16/2011 07:29 AM, Vikas Chaudhary wrote:
>> From: Karen Higgins<karen.higgins@qlogic.com>
>>
>> remove ha flag AF_HBA_GOING_AWAY and added flag AF_HA_REMOVAL
>> to mark the other ISP-4xxx port to indicate that the driver is
>> being removed, so that the other port will not re-initialize
>> while in the process of removing the ha due to driver unload
>> or hba hotplug.
>>
>> Signed-off-by: Karen Higgins<karen.higgins@qlogic.com>
>> Signed-off-by: Vikas Chaudhary<vikas.chaudhary@qlogic.com>
>> ---
>> drivers/scsi/qla4xxx/ql4_def.h | 5 +++-
>> drivers/scsi/qla4xxx/ql4_isr.c | 2 +-
>> drivers/scsi/qla4xxx/ql4_mbx.c | 2 +-
>> drivers/scsi/qla4xxx/ql4_os.c | 51 +++++++++++++++++++++++++++++----
>------
>> 4 files changed, 44 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/scsi/qla4xxx/ql4_def.h
>b/drivers/scsi/qla4xxx/ql4_def.h
>> index 7aa60ee..c1f8d1b 100644
>> --- a/drivers/scsi/qla4xxx/ql4_def.h
>> +++ b/drivers/scsi/qla4xxx/ql4_def.h
>> @@ -53,6 +53,9 @@
>> #define PCI_DEVICE_ID_QLOGIC_ISP8022 0x8022
>> #endif
>>
>> +#define ISP4XXX_PCI_FN_1 0x1
>> +#define ISP4XXX_PCI_FN_2 0x3
>> +
>> #define QLA_SUCCESS 0
>> #define QLA_ERROR 1
>>
>> @@ -371,7 +374,7 @@ struct scsi_qla_host {
>> #define AF_LINK_UP 8 /* 0x00000100 */
>> #define AF_IRQ_ATTACHED 10 /* 0x00000400 */
>> #define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
>> -#define AF_HBA_GOING_AWAY 12 /* 0x00001000 */
>> +#define AF_HA_REMOVAL 12 /* 0x00001000 */
>> #define AF_INTx_ENABLED 15 /* 0x00008000 */
>> #define AF_MSI_ENABLED 16 /* 0x00010000 */
>> #define AF_MSIX_ENABLED 17 /* 0x00020000 */
>> diff --git a/drivers/scsi/qla4xxx/ql4_isr.c
>b/drivers/scsi/qla4xxx/ql4_isr.c
>> index 2ef1a98..2f40ac7 100644
>> --- a/drivers/scsi/qla4xxx/ql4_isr.c
>> +++ b/drivers/scsi/qla4xxx/ql4_isr.c
>> @@ -801,7 +801,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void
>*dev_id)
>> &ha->reg->ctrl_status);
>> readl(&ha->reg->ctrl_status);
>>
>> - if (!test_bit(AF_HBA_GOING_AWAY,&ha->flags))
>> + if (!test_bit(AF_HA_REMOVAL,&ha->flags))
>> set_bit(DPC_RESET_HA_INTR,&ha-
>>dpc_flags);
>>
>> break;
>> diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c
>b/drivers/scsi/qla4xxx/ql4_mbx.c
>> index 379df2b..199fa64 100644
>> --- a/drivers/scsi/qla4xxx/ql4_mbx.c
>> +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
>> @@ -151,7 +151,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha,
>uint8_t inCount,
>> if (test_bit(AF_IRQ_ATTACHED,&ha->flags)&&
>> test_bit(AF_INTERRUPTS_ON,&ha->flags)&&
>> test_bit(AF_ONLINE,&ha->flags)&&
>> - !test_bit(AF_HBA_GOING_AWAY,&ha->flags)) {
>> + !test_bit(AF_HA_REMOVAL,&ha->flags)) {
>> /* Do not poll for completion. Use completion queue */
>> set_bit(AF_MBOX_COMMAND_NOPOLL,&ha->flags);
>> wait_for_completion_timeout(&ha->mbx_intr_comp, MBOX_TOV
>* HZ);
>> diff --git a/drivers/scsi/qla4xxx/ql4_os.c
>b/drivers/scsi/qla4xxx/ql4_os.c
>> index 6068f80..3ab4618 100644
>> --- a/drivers/scsi/qla4xxx/ql4_os.c
>> +++ b/drivers/scsi/qla4xxx/ql4_os.c
>> @@ -749,12 +749,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
>> if (!pci_channel_offline(ha->pdev))
>> pci_read_config_word(ha->pdev, PCI_VENDOR_ID,&w);
>>
>> - if (test_bit(AF_HBA_GOING_AWAY,&ha->flags)) {
>> - DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING
>AWAY\n",
>> - __func__));
>> - return;
>> - }
>> -
>> if (is_qla8022(ha)) {
>> qla4_8xxx_watchdog(ha);
>> }
>> @@ -1063,7 +1057,6 @@ void qla4xxx_dead_adapter_cleanup(struct
>scsi_qla_host *ha)
>>
>> /* Disable the board */
>> ql4_printk(KERN_INFO, ha, "Disabling the board\n");
>> - set_bit(AF_HBA_GOING_AWAY,&ha->flags);
>>
>> qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT<< 16);
>> qla4xxx_mark_all_devices_missing(ha);
>> @@ -1255,11 +1248,6 @@ static void qla4xxx_do_dpc(struct work_struct
>*work)
>> goto do_dpc_exit;
>> }
>>
>> - /* HBA is in the process of being permanently disabled.
>> - * Don't process anything */
>> - if (test_bit(AF_HBA_GOING_AWAY,&ha->flags))
>> - return;
>> -
>> if (is_qla8022(ha)) {
>> if (test_bit(DPC_HA_UNRECOVERABLE,&ha->dpc_flags)) {
>> qla4_8xxx_idc_lock(ha);
>> @@ -1824,6 +1812,42 @@ probe_disable_device:
>> }
>>
>> /**
>> + * qla4xxx_prevent_other_port_reinit - prevent other port from re-
>initialize
>> + * @ha: pointer to adapter structure
>> + *
>> + * Mark the other ISP-4xxx port to indicate that the driver is being
>removed,
>> + * so that the other port will not re-initialize while in the process of
>> + * removing the ha due to driver unload or hba hotplug.
>> + **/
>> +static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
>> +{
>> + struct scsi_qla_host *other_ha = NULL;
>> + struct pci_dev *other_pdev = NULL;
>> + int fn = ISP4XXX_PCI_FN_2;
>> +
>> + /*iscsi function numbers for ISP4xxx is 1 and 3*/
>> + if (PCI_FUNC(ha->pdev->devfn)& BIT_1)
>> + fn = ISP4XXX_PCI_FN_1;
>> +
>> + other_pdev =
>> + pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus),
>> + ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev-
>>devfn),
>> + fn));
>> +
>
>Is there ever going to be a single port on these cards? If so then a
>null check is needed right?
>
>
>> + /* Get other_ha if other_pdev state is enable*/
>> + if (atomic_read(&other_pdev->enable_cnt)) {
>> + other_ha = pci_get_drvdata(other_pdev);
>> + if (other_ha) {
>> + set_bit(AF_HA_REMOVAL,&other_ha->flags);
>> + DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Prevent %s
>"
>> + "reinit\n", __func__,
>> + dev_name(&other_ha->pdev->dev)));
>> + pci_dev_put(other_pdev);
>
>I think if pci_get_domain_bus_and_slot returns a device then it always
>has a refcount taken. If that is right then I think you need to move
>this pci_dev_put outside of these if chunks, so that pci_dev_put is
>called if a other_pdev is non-null.
Yes. I modified the patch as per comments and sending new patch in next email.
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
@ 2011-03-17 8:44 Vikas Chaudhary
0 siblings, 0 replies; 11+ messages in thread
From: Vikas Chaudhary @ 2011-03-17 8:44 UTC (permalink / raw)
To: James Bottomley
Cc: linux-scsi@vger.kernel.org, Vikas Chaudhary, Ravi Anand,
Lalit Chandivade, Karen Higgins, Mike Christie
From: Karen Higgins <karen.higgins@qlogic.com>
remove ha flag AF_HBA_GOING_AWAY and added flag AF_HA_REMOVAL
to mark the other ISP-4xxx port to indicate that the driver is
being removed, so that the other port will not re-initialize
while in the process of removing the ha due to driver unload
or hba hotplug.
Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_def.h | 5 +++-
drivers/scsi/qla4xxx/ql4_isr.c | 2 +-
drivers/scsi/qla4xxx/ql4_mbx.c | 2 +-
drivers/scsi/qla4xxx/ql4_os.c | 53 ++++++++++++++++++++++++++++++----------
4 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 7aa60ee..c1f8d1b 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -53,6 +53,9 @@
#define PCI_DEVICE_ID_QLOGIC_ISP8022 0x8022
#endif
+#define ISP4XXX_PCI_FN_1 0x1
+#define ISP4XXX_PCI_FN_2 0x3
+
#define QLA_SUCCESS 0
#define QLA_ERROR 1
@@ -371,7 +374,7 @@ struct scsi_qla_host {
#define AF_LINK_UP 8 /* 0x00000100 */
#define AF_IRQ_ATTACHED 10 /* 0x00000400 */
#define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
-#define AF_HBA_GOING_AWAY 12 /* 0x00001000 */
+#define AF_HA_REMOVAL 12 /* 0x00001000 */
#define AF_INTx_ENABLED 15 /* 0x00008000 */
#define AF_MSI_ENABLED 16 /* 0x00010000 */
#define AF_MSIX_ENABLED 17 /* 0x00020000 */
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 2ef1a98..2f40ac7 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -801,7 +801,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
&ha->reg->ctrl_status);
readl(&ha->reg->ctrl_status);
- if (!test_bit(AF_HBA_GOING_AWAY, &ha->flags))
+ if (!test_bit(AF_HA_REMOVAL, &ha->flags))
set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
break;
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 379df2b..199fa64 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -151,7 +151,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
if (test_bit(AF_IRQ_ATTACHED, &ha->flags) &&
test_bit(AF_INTERRUPTS_ON, &ha->flags) &&
test_bit(AF_ONLINE, &ha->flags) &&
- !test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
+ !test_bit(AF_HA_REMOVAL, &ha->flags)) {
/* Do not poll for completion. Use completion queue */
set_bit(AF_MBOX_COMMAND_NOPOLL, &ha->flags);
wait_for_completion_timeout(&ha->mbx_intr_comp, MBOX_TOV * HZ);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 6068f80..d7c220a 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -749,12 +749,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
if (!pci_channel_offline(ha->pdev))
pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
- DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING AWAY\n",
- __func__));
- return;
- }
-
if (is_qla8022(ha)) {
qla4_8xxx_watchdog(ha);
}
@@ -1063,7 +1057,6 @@ void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha)
/* Disable the board */
ql4_printk(KERN_INFO, ha, "Disabling the board\n");
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT << 16);
qla4xxx_mark_all_devices_missing(ha);
@@ -1255,11 +1248,6 @@ static void qla4xxx_do_dpc(struct work_struct *work)
goto do_dpc_exit;
}
- /* HBA is in the process of being permanently disabled.
- * Don't process anything */
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags))
- return;
-
if (is_qla8022(ha)) {
if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) {
qla4_8xxx_idc_lock(ha);
@@ -1824,6 +1812,44 @@ probe_disable_device:
}
/**
+ * qla4xxx_prevent_other_port_reinit - prevent other port from re-initialize
+ * @ha: pointer to adapter structure
+ *
+ * Mark the other ISP-4xxx port to indicate that the driver is being removed,
+ * so that the other port will not re-initialize while in the process of
+ * removing the ha due to driver unload or hba hotplug.
+ **/
+static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
+{
+ struct scsi_qla_host *other_ha = NULL;
+ struct pci_dev *other_pdev = NULL;
+ int fn = ISP4XXX_PCI_FN_2;
+
+ /*iscsi function numbers for ISP4xxx is 1 and 3*/
+ if (PCI_FUNC(ha->pdev->devfn) & BIT_1)
+ fn = ISP4XXX_PCI_FN_1;
+
+ other_pdev =
+ pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus),
+ ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn),
+ fn));
+
+ /* Get other_ha if other_pdev is valid and state is enable*/
+ if (other_pdev) {
+ if (atomic_read(&other_pdev->enable_cnt)) {
+ other_ha = pci_get_drvdata(other_pdev);
+ if (other_ha) {
+ set_bit(AF_HA_REMOVAL, &other_ha->flags);
+ DEBUG2(ql4_printk(KERN_INFO, ha, "%s: "
+ "Prevent %s reinit\n", __func__,
+ dev_name(&other_ha->pdev->dev)));
+ }
+ }
+ pci_dev_put(other_pdev);
+ }
+}
+
+/**
* qla4xxx_remove_adapter - calback function to remove adapter.
* @pci_dev: PCI device pointer
**/
@@ -1833,7 +1859,8 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev)
ha = pci_get_drvdata(pdev);
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
+ if (!is_qla8022(ha))
+ qla4xxx_prevent_other_port_reinit(ha);
/* remove devs from iscsi_sessions to scsi_devices */
qla4xxx_free_ddb_list(ha);
--
1.7.3.2
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter
2011-03-21 10:34 [PATCH 01/13] qla4xxx: cleanup qla4xxx_initialize_ddb_list() vikas.chaudhary
@ 2011-03-21 10:34 ` vikas.chaudhary
0 siblings, 0 replies; 11+ messages in thread
From: vikas.chaudhary @ 2011-03-21 10:34 UTC (permalink / raw)
To: James.Bottomley
Cc: linux-scsi, ravi.anand, lalit.chandivade, vikas.chaudhary,
Karen Higgins
From: Karen Higgins <karen.higgins@qlogic.com>
remove ha flag AF_HBA_GOING_AWAY and added flag AF_HA_REMOVAL
to mark the other ISP-4xxx port to indicate that the driver is
being removed, so that the other port will not re-initialize
while in the process of removing the ha due to driver unload
or hba hotplug.
Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_def.h | 5 +++-
drivers/scsi/qla4xxx/ql4_isr.c | 2 +-
drivers/scsi/qla4xxx/ql4_mbx.c | 2 +-
drivers/scsi/qla4xxx/ql4_os.c | 53 ++++++++++++++++++++++++++++++----------
4 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 7aa60ee..c1f8d1b 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -53,6 +53,9 @@
#define PCI_DEVICE_ID_QLOGIC_ISP8022 0x8022
#endif
+#define ISP4XXX_PCI_FN_1 0x1
+#define ISP4XXX_PCI_FN_2 0x3
+
#define QLA_SUCCESS 0
#define QLA_ERROR 1
@@ -371,7 +374,7 @@ struct scsi_qla_host {
#define AF_LINK_UP 8 /* 0x00000100 */
#define AF_IRQ_ATTACHED 10 /* 0x00000400 */
#define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
-#define AF_HBA_GOING_AWAY 12 /* 0x00001000 */
+#define AF_HA_REMOVAL 12 /* 0x00001000 */
#define AF_INTx_ENABLED 15 /* 0x00008000 */
#define AF_MSI_ENABLED 16 /* 0x00010000 */
#define AF_MSIX_ENABLED 17 /* 0x00020000 */
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 2ef1a98..2f40ac7 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -801,7 +801,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
&ha->reg->ctrl_status);
readl(&ha->reg->ctrl_status);
- if (!test_bit(AF_HBA_GOING_AWAY, &ha->flags))
+ if (!test_bit(AF_HA_REMOVAL, &ha->flags))
set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
break;
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 379df2b..199fa64 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -151,7 +151,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
if (test_bit(AF_IRQ_ATTACHED, &ha->flags) &&
test_bit(AF_INTERRUPTS_ON, &ha->flags) &&
test_bit(AF_ONLINE, &ha->flags) &&
- !test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
+ !test_bit(AF_HA_REMOVAL, &ha->flags)) {
/* Do not poll for completion. Use completion queue */
set_bit(AF_MBOX_COMMAND_NOPOLL, &ha->flags);
wait_for_completion_timeout(&ha->mbx_intr_comp, MBOX_TOV * HZ);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 6068f80..277c45f 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -749,12 +749,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
if (!pci_channel_offline(ha->pdev))
pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags)) {
- DEBUG2(ql4_printk(KERN_INFO, ha, "%s exited. HBA GOING AWAY\n",
- __func__));
- return;
- }
-
if (is_qla8022(ha)) {
qla4_8xxx_watchdog(ha);
}
@@ -1063,7 +1057,6 @@ void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha)
/* Disable the board */
ql4_printk(KERN_INFO, ha, "Disabling the board\n");
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
qla4xxx_abort_active_cmds(ha, DID_NO_CONNECT << 16);
qla4xxx_mark_all_devices_missing(ha);
@@ -1255,11 +1248,6 @@ static void qla4xxx_do_dpc(struct work_struct *work)
goto do_dpc_exit;
}
- /* HBA is in the process of being permanently disabled.
- * Don't process anything */
- if (test_bit(AF_HBA_GOING_AWAY, &ha->flags))
- return;
-
if (is_qla8022(ha)) {
if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) {
qla4_8xxx_idc_lock(ha);
@@ -1824,6 +1812,44 @@ probe_disable_device:
}
/**
+ * qla4xxx_prevent_other_port_reinit - prevent other port from re-initialize
+ * @ha: pointer to adapter structure
+ *
+ * Mark the other ISP-4xxx port to indicate that the driver is being removed,
+ * so that the other port will not re-initialize while in the process of
+ * removing the ha due to driver unload or hba hotplug.
+ **/
+static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
+{
+ struct scsi_qla_host *other_ha = NULL;
+ struct pci_dev *other_pdev = NULL;
+ int fn = ISP4XXX_PCI_FN_2;
+
+ /*iscsi function numbers for ISP4xxx is 1 and 3*/
+ if (PCI_FUNC(ha->pdev->devfn) & BIT_1)
+ fn = ISP4XXX_PCI_FN_1;
+
+ other_pdev =
+ pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus),
+ ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn),
+ fn));
+
+ /* Get other_ha if other_pdev is valid and state is enable*/
+ if (other_pdev) {
+ if (atomic_read(&other_pdev->enable_cnt)) {
+ other_ha = pci_get_drvdata(other_pdev);
+ if (other_ha) {
+ set_bit(AF_HA_REMOVAL, &other_ha->flags);
+ DEBUG2(ql4_printk(KERN_INFO, ha, "%s: "
+ "Prevent %s reinit\n", __func__,
+ dev_name(&other_ha->pdev->dev)));
+ }
+ }
+ pci_dev_put(other_pdev);
+ }
+}
+
+/**
* qla4xxx_remove_adapter - calback function to remove adapter.
* @pci_dev: PCI device pointer
**/
@@ -1833,7 +1859,8 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev)
ha = pci_get_drvdata(pdev);
- set_bit(AF_HBA_GOING_AWAY, &ha->flags);
+ if (!is_qla8022(ha))
+ qla4xxx_prevent_other_port_reinit(ha);
/* remove devs from iscsi_sessions to scsi_devices */
qla4xxx_free_ddb_list(ha);
--
1.7.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-03-21 10:46 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-14 5:24 [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter Vikas Chaudhary
2011-03-14 22:07 ` Mike Christie
2011-03-15 9:21 ` Vikas Chaudhary
2011-03-16 1:21 ` Mike Christie
2011-03-16 12:27 ` Vikas Chaudhary
-- strict thread matches above, loose matches on Subject: below --
2011-03-15 9:23 Vikas Chaudhary
2011-03-16 12:29 Vikas Chaudhary
2011-03-16 19:23 ` Mike Christie
2011-03-17 8:44 ` Vikas Chaudhary
2011-03-17 8:44 Vikas Chaudhary
2011-03-21 10:34 [PATCH 01/13] qla4xxx: cleanup qla4xxx_initialize_ddb_list() vikas.chaudhary
2011-03-21 10:34 ` [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter vikas.chaudhary
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).