public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] be2iscsi: Adding a shutdown Routine
       [not found] <1314032910-2304-1-git-send-email-jayamohan.kallickal@emulex.com>
@ 2011-08-22 17:08 ` Jayamohan Kallickal
  2011-08-23 21:20   ` Mike Christie
  2011-08-22 17:08 ` [PATCH 3/3] be2iscsi: Add pci_disable device Jayamohan Kallickal
  2011-08-22 17:08 ` be2iscsi: Patches for inclusion Jayamohan Kallickal
  2 siblings, 1 reply; 5+ messages in thread
From: Jayamohan Kallickal @ 2011-08-22 17:08 UTC (permalink / raw)
  To: James.Bottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal

This patch adds a shutdown routine. It fixes a bug where when be2net
and be2iscsi are both used be2iscsi was not cleaning up its resources
properly causing be2net to fail to get loaded when the system is
rebooted.

Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
 drivers/scsi/be2iscsi/be_main.c |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 92b9a10..4fef262 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4118,9 +4118,8 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
 	return beiscsi_iotask(task, sg, num_sg, xferlen, writedir);
 }
 
-static void beiscsi_remove(struct pci_dev *pcidev)
+static void beiscsi_quiesce(struct beiscsi_hba *phba)
 {
-	struct beiscsi_hba *phba = NULL;
 	struct hwi_controller *phwi_ctrlr;
 	struct hwi_context_memory *phwi_context;
 	struct be_eq_obj *pbe_eq;
@@ -4128,12 +4127,6 @@ static void beiscsi_remove(struct pci_dev *pcidev)
 	u8 *real_offset = 0;
 	u32 value = 0;
 
-	phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
-	if (!phba) {
-		dev_err(&pcidev->dev, "beiscsi_remove called with no phba\n");
-		return;
-	}
-
 	phwi_ctrlr = phba->phwi_ctrlr;
 	phwi_context = phwi_ctrlr->phwi_ctxt;
 	hwi_disable_intr(phba);
@@ -4169,12 +4162,40 @@ static void beiscsi_remove(struct pci_dev *pcidev)
 			    phba->ctrl.mbox_mem_alloced.size,
 			    phba->ctrl.mbox_mem_alloced.va,
 			    phba->ctrl.mbox_mem_alloced.dma);
+}
+
+static void beiscsi_remove(struct pci_dev *pcidev)
+{
+
+	struct beiscsi_hba *phba = NULL;
+
+	phba = pci_get_drvdata(pcidev);
+	if (!phba) {
+		dev_err(&pcidev->dev, "beiscsi_remove called with no phba\n");
+		return;
+	}
+
+	beiscsi_quiesce(phba);
 	iscsi_boot_destroy_kset(phba->boot_kset);
 	iscsi_host_remove(phba->shost);
 	pci_dev_put(phba->pcidev);
 	iscsi_host_free(phba->shost);
 }
 
+static void beiscsi_shutdown(struct pci_dev *pcidev)
+{
+
+	struct beiscsi_hba *phba = NULL;
+
+	phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
+	if (!phba) {
+		dev_err(&pcidev->dev, "beiscsi_shutdown called with no phba\n");
+		return;
+	}
+
+	beiscsi_quiesce(phba);
+}
+
 static void beiscsi_msix_enable(struct beiscsi_hba *phba)
 {
 	int i, status;
@@ -4435,6 +4456,7 @@ static struct pci_driver beiscsi_pci_driver = {
 	.name = DRV_NAME,
 	.probe = beiscsi_dev_probe,
 	.remove = beiscsi_remove,
+	.shutdown = beiscsi_shutdown,
 	.id_table = beiscsi_pci_id_table
 };
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] be2iscsi: Add pci_disable device
       [not found] <1314032910-2304-1-git-send-email-jayamohan.kallickal@emulex.com>
  2011-08-22 17:08 ` [PATCH 2/3] be2iscsi: Adding a shutdown Routine Jayamohan Kallickal
@ 2011-08-22 17:08 ` Jayamohan Kallickal
  2011-08-22 17:08 ` be2iscsi: Patches for inclusion Jayamohan Kallickal
  2 siblings, 0 replies; 5+ messages in thread
From: Jayamohan Kallickal @ 2011-08-22 17:08 UTC (permalink / raw)
  To: James.Bottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal

  This patch adds call to pci_disable_device during
rmmod and shutdown. The lack of this call was causing hang in
insmod - rmmod loop test

Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
---
 drivers/scsi/be2iscsi/be_main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 4fef262..7bcbeca 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4180,6 +4180,7 @@ static void beiscsi_remove(struct pci_dev *pcidev)
 	iscsi_host_remove(phba->shost);
 	pci_dev_put(phba->pcidev);
 	iscsi_host_free(phba->shost);
+	pci_disable_device(pcidev);
 }
 
 static void beiscsi_shutdown(struct pci_dev *pcidev)
@@ -4194,6 +4195,7 @@ static void beiscsi_shutdown(struct pci_dev *pcidev)
 	}
 
 	beiscsi_quiesce(phba);
+	pci_disable_device(pcidev);
 }
 
 static void beiscsi_msix_enable(struct beiscsi_hba *phba)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* be2iscsi: Patches for inclusion
       [not found] <1314032910-2304-1-git-send-email-jayamohan.kallickal@emulex.com>
  2011-08-22 17:08 ` [PATCH 2/3] be2iscsi: Adding a shutdown Routine Jayamohan Kallickal
  2011-08-22 17:08 ` [PATCH 3/3] be2iscsi: Add pci_disable device Jayamohan Kallickal
@ 2011-08-22 17:08 ` Jayamohan Kallickal
  2 siblings, 0 replies; 5+ messages in thread
From: Jayamohan Kallickal @ 2011-08-22 17:08 UTC (permalink / raw)
  To: James.Bottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal

Hi

  	These set of patches have been made on 
latest scsi-misc tree

Jayamohan Kallickal (3):
	be2iscsi: Fixing the /proc/interrupts problem to avoid
		  corruption in /proc/interrupts
	be2iscsi: Adding a shutdown routine as be2iscsi was not doing a
		  cleanup during kexec
	be2iscsi: Add call to pci_disable device during rmmod and shutdown

Thanks
Jayamohan Kallickal

Signed off by:  Jayamohan Kallickal <jayamohan.kallickal@emulex.com>

---


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] be2iscsi: Adding a shutdown Routine
  2011-08-22 17:08 ` [PATCH 2/3] be2iscsi: Adding a shutdown Routine Jayamohan Kallickal
@ 2011-08-23 21:20   ` Mike Christie
  2011-08-24  8:53     ` Rolf Eike Beer
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Christie @ 2011-08-23 21:20 UTC (permalink / raw)
  To: Jayamohan Kallickal; +Cc: James.Bottomley, linux-scsi

On 08/22/2011 12:08 PM, Jayamohan Kallickal wrote:
> +static void beiscsi_remove(struct pci_dev *pcidev)
> +{
> +
> +	struct beiscsi_hba *phba = NULL;
> +
> +	phba = pci_get_drvdata(pcidev);


> +static void beiscsi_shutdown(struct pci_dev *pcidev)
> +{
> +
> +	struct beiscsi_hba *phba = NULL;
> +
> +	phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);


No need for casting.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] be2iscsi: Adding a shutdown Routine
  2011-08-23 21:20   ` Mike Christie
@ 2011-08-24  8:53     ` Rolf Eike Beer
  0 siblings, 0 replies; 5+ messages in thread
From: Rolf Eike Beer @ 2011-08-24  8:53 UTC (permalink / raw)
  To: Mike Christie; +Cc: Jayamohan Kallickal, james.bottomley, linux-scsi

> On 08/22/2011 12:08 PM, Jayamohan Kallickal wrote:
>> +static void beiscsi_remove(struct pci_dev *pcidev)
>> +{
>> +
>> +	struct beiscsi_hba *phba = NULL;
>> +
>> +	phba = pci_get_drvdata(pcidev);
>
>
>> +static void beiscsi_shutdown(struct pci_dev *pcidev)
>> +{
>> +
>> +	struct beiscsi_hba *phba = NULL;
>> +
>> +	phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
>
>
> No need for casting.

And no need to initialize to NULL either. Best would be

struct beiscsi_hba *phba = pci_get_drvdata(pcidev);

in both cases.

Eike

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-24  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1314032910-2304-1-git-send-email-jayamohan.kallickal@emulex.com>
2011-08-22 17:08 ` [PATCH 2/3] be2iscsi: Adding a shutdown Routine Jayamohan Kallickal
2011-08-23 21:20   ` Mike Christie
2011-08-24  8:53     ` Rolf Eike Beer
2011-08-22 17:08 ` [PATCH 3/3] be2iscsi: Add pci_disable device Jayamohan Kallickal
2011-08-22 17:08 ` be2iscsi: Patches for inclusion Jayamohan Kallickal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox