public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch 6/7] megaraid_sas: adds tasklet for cmd completion
@ 2006-09-21  2:31 Sumant Patro
  2006-09-21 11:46 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Sumant Patro @ 2006-09-21  2:31 UTC (permalink / raw)
  To: James.Bottomley, linux-scsi; +Cc: akpm, hch, linux-kernel, Neela.Kolli, Bo.Yang

[-- Attachment #1: Type: text/plain, Size: 3351 bytes --]

This patch adds a tasklet for command completion.

Signed-off-by: Sumant Patro <Sumant.Patro@lsil.com>


diff -uprN linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.c linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.c
--- linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.c 2006-09-20 15:20:45.000000000 -0700
+++ linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.c 2006-09-20 15:22:28.000000000 -0700
@@ -1273,11 +1273,6 @@ megasas_complete_cmd(struct megasas_inst
 static int
 megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status)
 {
- u32 producer;
- u32 consumer;
- u32 context;
- struct megasas_cmd *cmd;
-
  /*
   * Check if it is our interrupt
   * Clear the interrupt 
@@ -1285,23 +1280,10 @@ megasas_deplete_reply_queue(struct megas
  if(instance->instancet->clear_intr(instance->reg_set))
   return IRQ_NONE;
 
- producer = *instance->producer;
- consumer = *instance->consumer;
-
- while (consumer != producer) {
-  context = instance->reply_queue[consumer];
-
-		cmd = instance->cmd_list[context];
-
-		megasas_complete_cmd(instance, cmd, alt_status);
-
-		consumer++;
-		if (consumer == (instance->max_fw_cmds + 1)) {
-			consumer = 0;
-		}
-	}
-
-	*instance->consumer = producer;
+        /* 
+	* Schedule the tasklet for cmd completion 
+	*/
+	tasklet_schedule(&instance->isr_tasklet);
 
 	return IRQ_HANDLED;
 }
@@ -1744,6 +1726,39 @@ megasas_get_ctrl_info(struct megasas_ins
 }
 
 /**
+ * megasas_complete_cmd_dpc	 -	Returns FW's controller structure
+ * @instance_addr:			Address of adapter soft state
+ *
+ * Tasklet to complete cmds
+ */
+void megasas_complete_cmd_dpc(unsigned long instance_addr)
+{
+	u32 producer;
+	u32 consumer;
+	u32 context;
+	struct megasas_cmd *cmd;
+	struct megasas_instance *instance = (struct megasas_instance *)instance_addr;
+
+	producer = *instance->producer;
+	consumer = *instance->consumer;
+
+	while (consumer != producer) {
+		context = instance->reply_queue[consumer];
+
+		cmd = instance->cmd_list[context];
+
+		megasas_complete_cmd(instance, cmd, DID_OK);
+
+		consumer++;
+		if (consumer == (instance->max_fw_cmds + 1)) {
+			consumer = 0;
+		}
+	}
+
+	*instance->consumer = producer;
+}
+
+/**
  * megasas_init_mfi -	Initializes the FW
  * @instance:		Adapter soft state
  *
@@ -1913,6 +1928,12 @@ static int megasas_init_mfi(struct megas
 
 	kfree(ctrl_info);
 
+        /*
+	* Setup tasklet for cmd completion
+	*/
+
+        tasklet_init(&instance->isr_tasklet, megasas_complete_cmd_dpc,
+                        (unsigned long)instance);
 	return 0;
 
       fail_fw_init:
@@ -2502,6 +2523,7 @@ static void megasas_detach_one(struct pc
 	scsi_remove_host(instance->host);
 	megasas_flush_cache(instance);
 	megasas_shutdown_controller(instance);
+	tasklet_kill(&instance->isr_tasklet);
 
 	/*
 	 * Take the instance off the instance array. Note that we will not
diff -uprN linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.h linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.h
--- linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.h	2006-09-20 15:20:45.000000000 -0700
+++ linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.h	2006-09-20 15:22:28.000000000 -0700
@@ -1102,6 +1102,7 @@ struct megasas_instance {
 	u32 hw_crit_error;
 
  struct megasas_instance_template *instancet;
+ struct tasklet_struct isr_tasklet;
 };
 
 #define MEGASAS_IS_LOGICAL(scp)						\


[-- Attachment #2: tasklet-p6.patch --]
[-- Type: text/x-patch, Size: 3245 bytes --]

diff -uprN linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.c linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.c
--- linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.c	2006-09-20 15:20:45.000000000 -0700
+++ linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.c	2006-09-20 15:22:28.000000000 -0700
@@ -1273,11 +1273,6 @@ megasas_complete_cmd(struct megasas_inst
 static int
 megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status)
 {
-	u32 producer;
-	u32 consumer;
-	u32 context;
-	struct megasas_cmd *cmd;
-
 	/*
 	 * Check if it is our interrupt
 	 * Clear the interrupt 
@@ -1285,23 +1280,10 @@ megasas_deplete_reply_queue(struct megas
 	if(instance->instancet->clear_intr(instance->reg_set))
 		return IRQ_NONE;
 
-	producer = *instance->producer;
-	consumer = *instance->consumer;
-
-	while (consumer != producer) {
-		context = instance->reply_queue[consumer];
-
-		cmd = instance->cmd_list[context];
-
-		megasas_complete_cmd(instance, cmd, alt_status);
-
-		consumer++;
-		if (consumer == (instance->max_fw_cmds + 1)) {
-			consumer = 0;
-		}
-	}
-
-	*instance->consumer = producer;
+        /* 
+	* Schedule the tasklet for cmd completion 
+	*/
+	tasklet_schedule(&instance->isr_tasklet);
 
 	return IRQ_HANDLED;
 }
@@ -1744,6 +1726,39 @@ megasas_get_ctrl_info(struct megasas_ins
 }
 
 /**
+ * megasas_complete_cmd_dpc	 -	Returns FW's controller structure
+ * @instance_addr:			Address of adapter soft state
+ *
+ * Tasklet to complete cmds
+ */
+void megasas_complete_cmd_dpc(unsigned long instance_addr)
+{
+	u32 producer;
+	u32 consumer;
+	u32 context;
+	struct megasas_cmd *cmd;
+	struct megasas_instance *instance = (struct megasas_instance *)instance_addr;
+
+	producer = *instance->producer;
+	consumer = *instance->consumer;
+
+	while (consumer != producer) {
+		context = instance->reply_queue[consumer];
+
+		cmd = instance->cmd_list[context];
+
+		megasas_complete_cmd(instance, cmd, DID_OK);
+
+		consumer++;
+		if (consumer == (instance->max_fw_cmds + 1)) {
+			consumer = 0;
+		}
+	}
+
+	*instance->consumer = producer;
+}
+
+/**
  * megasas_init_mfi -	Initializes the FW
  * @instance:		Adapter soft state
  *
@@ -1913,6 +1928,12 @@ static int megasas_init_mfi(struct megas
 
 	kfree(ctrl_info);
 
+        /*
+	* Setup tasklet for cmd completion
+	*/
+
+        tasklet_init(&instance->isr_tasklet, megasas_complete_cmd_dpc,
+                        (unsigned long)instance);
 	return 0;
 
       fail_fw_init:
@@ -2502,6 +2523,7 @@ static void megasas_detach_one(struct pc
 	scsi_remove_host(instance->host);
 	megasas_flush_cache(instance);
 	megasas_shutdown_controller(instance);
+	tasklet_kill(&instance->isr_tasklet);
 
 	/*
 	 * Take the instance off the instance array. Note that we will not
diff -uprN linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.h linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.h
--- linux-2.6-orig/drivers/scsi/megaraid/megaraid_sas.h	2006-09-20 15:20:45.000000000 -0700
+++ linux-2.6-new/drivers/scsi/megaraid/megaraid_sas.h	2006-09-20 15:22:28.000000000 -0700
@@ -1102,6 +1102,7 @@ struct megasas_instance {
 	u32 hw_crit_error;
 
 	struct megasas_instance_template *instancet;
+	struct tasklet_struct isr_tasklet;
 };
 
 #define MEGASAS_IS_LOGICAL(scp)						\

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

* Re: [Patch 6/7] megaraid_sas: adds tasklet for cmd completion
  2006-09-21  2:31 [Patch 6/7] megaraid_sas: adds tasklet for cmd completion Sumant Patro
@ 2006-09-21 11:46 ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2006-09-21 11:46 UTC (permalink / raw)
  To: Sumant Patro
  Cc: James.Bottomley, linux-scsi, akpm, hch, linux-kernel, Neela.Kolli,
	Bo.Yang

On Wed, Sep 20, 2006 at 07:31:29PM -0700, Sumant Patro wrote:
> This patch adds a tasklet for command completion.

Why would you need this?  The normal scsi command completion is offloaded
to the SCSI softirq ASAP so I don't see any point for those.  Do you see
too much time spent in completion of the internal commands?


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

* RE: [Patch 6/7] megaraid_sas: adds tasklet for cmd completion
@ 2006-09-22  1:12 Patro, Sumant
  0 siblings, 0 replies; 3+ messages in thread
From: Patro, Sumant @ 2006-09-22  1:12 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James.Bottomley, linux-scsi, akpm, hch, linux-kernel,
	Kolli, Neela, Yang, Bo

Hello Christoph,

	Thank you for the review of the patches.	
	With implementation of tasklet in the driver we see a
performance increase of about 8%, so we decided to go with it.

Regards,
Sumant

-----Original Message-----
From: Christoph Hellwig [mailto:hch@infradead.org] 
Sent: Thursday, September 21, 2006 4:46 AM
To: Patro, Sumant
Cc: James.Bottomley@SteelEye.com; linux-scsi@vger.kernel.org;
akpm@osdl.org; hch@lst.de; linux-kernel@vger.kernel.org; Kolli, Neela;
Yang, Bo
Subject: Re: [Patch 6/7] megaraid_sas: adds tasklet for cmd completion

On Wed, Sep 20, 2006 at 07:31:29PM -0700, Sumant Patro wrote:
> This patch adds a tasklet for command completion.

Why would you need this?  The normal scsi command completion is
offloaded
to the SCSI softirq ASAP so I don't see any point for those.  Do you see
too much time spent in completion of the internal commands?


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

end of thread, other threads:[~2006-09-22  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-21  2:31 [Patch 6/7] megaraid_sas: adds tasklet for cmd completion Sumant Patro
2006-09-21 11:46 ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2006-09-22  1:12 Patro, Sumant

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