RE: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

2007-11-09 Thread Yang, Bo
James,

We are re-submitting those patches with the two patches (patch [2/8]--
"add module param fast_load" and patch [3/8] -- "add module param
max_sectors, cmd_per_lun" ) droped for now.  Later on we may implement
the module params as suggested by the community members.

Regards.

Bo Yang   


-Original Message-
From: Christoph Hellwig [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 07, 2007 12:40 PM
To: Yang, Bo
Cc: Christoph Hellwig; linux-scsi@vger.kernel.org;
[EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

On Tue, Nov 06, 2007 at 12:04:31PM -0700, Yang, Bo wrote:
> I see that scsi_scan_host_selected is in scsi_priv.h and currently is 
> not used by any other driver. The scsi_priv.h is not part of the 
> include dir (/include/scsi). One of the major Linux distro's don't 
> even include this file in /usr/src/kernels. Also it looks like at this

> time this function may not be available (not exported?) for driver
modules to use.
> Even if I include scsi_priv.h I get "unknown symbol" for this function

> while loading.

Yes, it would have to be exported and moved to a public header.

> May be in the long run we can solve all these issues to call 
> scsi_scan_host_selected. However, the current implementation works 
> fine and has been tested by LSI and others. This implementation 
> doesn't break any protocol nor does it adversely affect any driver
functionality.

Your implementation adds state to scanning that could easily break and
makes the driver complex for things that don't belong into a driver, so
there's a clear NACK for this from me.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

2007-11-07 Thread Christoph Hellwig
On Tue, Nov 06, 2007 at 12:04:31PM -0700, Yang, Bo wrote:
> I see that scsi_scan_host_selected is in scsi_priv.h and currently is
> not used by any other driver. The scsi_priv.h is not part of the include
> dir (/include/scsi). One of the major Linux distro's don't even include
> this file in /usr/src/kernels. Also it looks like at this time this
> function may not be available (not exported?) for driver modules to use.
> Even if I include scsi_priv.h I get "unknown symbol" for this function
> while loading.

Yes, it would have to be exported and moved to a public header.

> May be in the long run we can solve all these issues to call
> scsi_scan_host_selected. However, the current implementation works fine
> and has been tested by LSI and others. This implementation doesn't break
> any protocol nor does it adversely affect any driver functionality.

Your implementation adds state to scanning that could easily break and
makes the driver complex for things that don't belong into a driver,
so there's a clear NACK for this from me.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

2007-11-06 Thread Yang, Bo

Re-Sending:

Christoph,

The e-mail I sent out on Oct. 31st was bounced back, I re-send it again.
 
I see that scsi_scan_host_selected is in scsi_priv.h and currently is
not used by any other driver. The scsi_priv.h is not part of the include
dir (/include/scsi). One of the major Linux distro's don't even include
this file in /usr/src/kernels. Also it looks like at this time this
function may not be available (not exported?) for driver modules to use.
Even if I include scsi_priv.h I get "unknown symbol" for this function
while loading.
May be in the long run we can solve all these issues to call
scsi_scan_host_selected. However, the current implementation works fine
and has been tested by LSI and others. This implementation doesn't break
any protocol nor does it adversely affect any driver functionality.

In a future update soon I will modify the comment on proc/scsi and
remove the extra braces you have pointed out. Please accept the current
implementation/patches. 

Regards, 
 
Bo Yang

 
From: Yang, Bo 
Sent: Wednesday, October 31, 2007 9:46 AM
To: Christoph Hellwig
Cc: linux-scsi@vger.kernel.org; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]; Patro, Sumant; Kolli, Neela
Subject: RE: PATCH [2/8] scsi: megaraid_sas - add module param fast_load


Christoph,

I see that scsi_scan_host_selected is in scsi_priv.h and currently is
not used by any other driver. The scsi_priv.h is not part of the include
dir (/include/scsi). One of the major Linux distro's don't even include
this file in /usr/src/kernels. Also it looks like at this time this
function may not be available (not exported?) for driver modules to use.
Even if I include scsi_priv.h I get "unknown symbol" for this function
while loading.
May be in the long run we can solve all these issues to call
scsi_scan_host_selected. However, the current implementation works fine
and has been tested by LSI and others. This implementation doesn't break
any protocol nor does it adversely affect any driver functionality.

In a future update soon I will modify the comment on proc/scsi and
remove the extra braces you have pointed out. Please accept the current
implementation/patches. 

Regards, 

Bo Yang

-Original Message-
From: Christoph Hellwig [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 30, 2007 1:37 PM
To: Yang, Bo
Cc: linux-scsi@vger.kernel.org; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]; Patro, Sumant
Subject: Re: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

On Mon, Oct 01, 2007 at 11:46:51AM -0400, bo yang wrote:
> +/*
> + * Fast driver load option, skip scanning for physical devices during
> + * load.  This would result in physical devices being skipped during
> + * driver load time. These can be later added though,
> + * using /proc/scsi/scsi
> + */

/proc/scsi/scsi is deprecated, so please don't recommend it here.
The proper way is the scan attribute of the scsi host.

> +static unsigned int fast_load;
> +module_param_named(fast_load, fast_load, int, 0); 
> +MODULE_PARM_DESC(fast_load,
> + "megasas: Faster loading of the driver, skips physical devices!
"\
> + "(default = 0)");

This should show up in sysfs.

> +static struct megasas_instance *megasas_lookup_instance(u16 host_no) 
> +{
> + int i;
> +
> + for (i = 0; i < megasas_mgmt_info.max_index; i++) {
> + if ((megasas_mgmt_info.instance[i]) &&
> + (megasas_mgmt_info.instance[i]->host->host_no
> + == host_no))

no need for the braces here.  This should be:

if (megasas_mgmt_info.instance[i] &&
megasas_mgmt_info.instance[i]->host->host_no ==
host_no)

> +static int megasas_slave_alloc(struct scsi_device *sdev) {
> + struct megasas_instance *instance;
> + int tmp_fastload = fast_load;
> +
> + instance = megasas_lookup_instance(sdev->host->host_no);
> +
> + if (tmp_fastload && sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
> + if ((sdev->id == MEGASAS_MAX_DEV_PER_CHANNEL -1) &&
> + (sdev->channel == MEGASAS_MAX_PD_CHANNELS - 1))
{
> +
> + /*
> +  * If fast load option was set and scan for last device
is
> +  * over, reset the fast_load flag so that during a
possible
> +  * next scan, devices can be made available
> +  */
> + fast_load = 0;
> + }
> + return -ENXIO;
> + }
> +
> + return 0;
> +}

This is a rather complicated and fragile way to implement this feature.

I'd recomment to change the call to scsi_scan_host in megas

Re: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

2007-10-30 Thread Christoph Hellwig
On Mon, Oct 01, 2007 at 11:46:51AM -0400, bo yang wrote:
> +/*
> + * Fast driver load option, skip scanning for physical devices during
> + * load.  This would result in physical devices being skipped during
> + * driver load time. These can be later added though,
> + * using /proc/scsi/scsi
> + */

/proc/scsi/scsi is deprecated, so please don't recommend it here.
The proper way is the scan attribute of the scsi host.

> +static unsigned int fast_load;
> +module_param_named(fast_load, fast_load, int, 0);
> +MODULE_PARM_DESC(fast_load,
> + "megasas: Faster loading of the driver, skips physical devices! "\
> + "(default = 0)");

This should show up in sysfs.

> +static struct megasas_instance *megasas_lookup_instance(u16 host_no)
> +{
> + int i;
> +
> + for (i = 0; i < megasas_mgmt_info.max_index; i++) {
> + if ((megasas_mgmt_info.instance[i]) &&
> + (megasas_mgmt_info.instance[i]->host->host_no
> + == host_no))

no need for the braces here.  This should be:

if (megasas_mgmt_info.instance[i] &&
megasas_mgmt_info.instance[i]->host->host_no == host_no)

> +static int megasas_slave_alloc(struct scsi_device *sdev)
> +{
> + struct megasas_instance *instance;
> + int tmp_fastload = fast_load;
> +
> + instance = megasas_lookup_instance(sdev->host->host_no);
> +
> + if (tmp_fastload && sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
> + if ((sdev->id == MEGASAS_MAX_DEV_PER_CHANNEL -1) &&
> + (sdev->channel == MEGASAS_MAX_PD_CHANNELS - 1)) {
> +
> + /*
> +  * If fast load option was set and scan for last device is
> +  * over, reset the fast_load flag so that during a possible
> +  * next scan, devices can be made available
> +  */
> + fast_load = 0;
> + }
> + return -ENXIO;
> + }
> +
> + return 0;
> +}

This is a rather complicated and fragile way to implement this feature.

I'd recomment to change the call to scsi_scan_host in megasas_io_attach
to something like:

if (fast_load) {
int channel;

for (channel = 0; channel < MEGASAS_MAX_PD_CHANNELS;
 channel++) {
scsi_scan_host_selected(host, channel, SCAN_WILD_CARD,
SCAN_WILD_CARD, 0);
}
} else {
scsi_scan_host(host);
}

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


PATCH [2/8] scsi: megaraid_sas - add module param fast_load

2007-10-03 Thread bo yang
Driver will skip physical devices scan for the first time if the fast_load is 
set. This is to reduce time for loading driver.

Signed-off-by: Bo Yang <[EMAIL PROTECTED]>

---
 drivers/scsi/megaraid/megaraid_sas.c |   69 +++--
 1 files changed, 55 insertions(+), 14 deletions(-)

diff -uprN linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c 
linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c
--- linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c  2007-10-01 
00:03:59.0 -0700
+++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c   2007-10-01 
00:12:54.0 -0700
@@ -46,6 +46,22 @@
 #include 
 #include "megaraid_sas.h"
 
+/*
+ * Module parameters
+ */
+
+/*
+ * Fast driver load option, skip scanning for physical devices during
+ * load.  This would result in physical devices being skipped during
+ * driver load time. These can be later added though,
+ * using /proc/scsi/scsi
+ */
+static unsigned int fast_load;
+module_param_named(fast_load, fast_load, int, 0);
+MODULE_PARM_DESC(fast_load,
+   "megasas: Faster loading of the driver, skips physical devices! "\
+   "(default = 0)");
+
 MODULE_LICENSE("GPL");
 MODULE_VERSION(MEGASAS_VERSION);
 MODULE_AUTHOR("[EMAIL PROTECTED]");
@@ -1094,6 +1110,44 @@ megasas_service_aen(struct megasas_insta
megasas_return_cmd(instance, cmd);
 }
 
+static struct megasas_instance *megasas_lookup_instance(u16 host_no)
+{
+   int i;
+
+   for (i = 0; i < megasas_mgmt_info.max_index; i++) {
+   if ((megasas_mgmt_info.instance[i]) &&
+   (megasas_mgmt_info.instance[i]->host->host_no
+   == host_no))
+   return megasas_mgmt_info.instance[i];
+   }
+
+   return NULL;
+}
+
+static int megasas_slave_alloc(struct scsi_device *sdev)
+{
+   struct megasas_instance *instance;
+   int tmp_fastload = fast_load;
+
+   instance = megasas_lookup_instance(sdev->host->host_no);
+
+   if (tmp_fastload && sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
+   if ((sdev->id == MEGASAS_MAX_DEV_PER_CHANNEL -1) &&
+   (sdev->channel == MEGASAS_MAX_PD_CHANNELS - 1)) {
+
+   /*
+* If fast load option was set and scan for last device is
+* over, reset the fast_load flag so that during a possible
+* next scan, devices can be made available
+*/
+   fast_load = 0;
+   }
+   return -ENXIO;
+   }
+
+   return 0;
+}
+
 /*
  * Scsi host template for megaraid_sas driver
  */
@@ -1103,6 +1157,7 @@ static struct scsi_host_template megasas
.name = "LSI Logic SAS based MegaRAID driver",
.proc_name = "megaraid_sas",
.slave_configure = megasas_slave_configure,
+   .slave_alloc = megasas_slave_alloc,
.queuecommand = megasas_queue_command,
.eh_device_reset_handler = megasas_reset_device,
.eh_bus_reset_handler = megasas_reset_bus_host,
@@ -2961,20 +3016,6 @@ megasas_mgmt_fw_ioctl(struct megasas_ins
return error;
 }
 
-static struct megasas_instance *megasas_lookup_instance(u16 host_no)
-{
-   int i;
-
-   for (i = 0; i < megasas_mgmt_info.max_index; i++) {
-
-   if ((megasas_mgmt_info.instance[i]) &&
-   (megasas_mgmt_info.instance[i]->host->host_no == host_no))
-   return megasas_mgmt_info.instance[i];
-   }
-
-   return NULL;
-}
-
 static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
 {
struct megasas_iocpacket __user *user_ioc =


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


Re: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

2007-09-28 Thread Randy Dunlap
On Wed, 26 Sep 2007 11:22:10 -0400 bo yang wrote:

> Driver will skip physical devices scan for the first time if the fast_load is 
> set. This is to reduce time for loading driver.
> 
> Signed-off-by: Bo Yang <[EMAIL PROTECTED]>
> 
> ---
>  drivers/scsi/megaraid/megaraid_sas.c |   69 +++--
>  1 files changed, 55 insertions(+), 14 deletions(-)
> 
> diff -rupN linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c 
> linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c
> --- linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c2007-09-26 
> 16:19:18.321402040 -0400
> +++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c 2007-09-26 
> 16:20:52.915021624 -0400
> @@ -46,6 +46,22 @@
>  #include 
>  #include "megaraid_sas.h"
>  
> +/*
> + * Module parameters
> + */
> +
> +/*
> + * Fast driver load option, skip scanning for physical devices during
> + * load.  This would result in physical devices being skipped during
> + * driver load time. These can be later added though,
> + * using /proc/scsi/scsi
> + */
> +static unsigned int fast_load;
> +module_param_named(fast_load, fast_load, int, 0);
> +MODULE_PARM_DESC(fast_load,
> + "megasas: Faster loading of the driver, skips physical devices! \
> +  (default = 0)");

The continuation line begins with an unwanted tab that is inside the
"string".  How about like this?  (untested)


MODULE_PARM_DESC(fast_load,
"megasas: Faster loading of the driver, skips physical devices! "\
"(default = 0)");


> +
>  MODULE_LICENSE("GPL");
>  MODULE_VERSION(MEGASAS_VERSION);
>  MODULE_AUTHOR("[EMAIL PROTECTED]");


---
~Randy
Phaedrus says that Quality is about caring.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


PATCH [2/8] scsi: megaraid_sas - add module param fast_load

2007-09-28 Thread bo yang
Driver will skip physical devices scan for the first time if the fast_load is 
set. This is to reduce time for loading driver.

Signed-off-by: Bo Yang <[EMAIL PROTECTED]>

---
 drivers/scsi/megaraid/megaraid_sas.c |   69 +++--
 1 files changed, 55 insertions(+), 14 deletions(-)

diff -rupN linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c 
linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c
--- linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c  2007-09-26 
16:19:18.321402040 -0400
+++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c   2007-09-26 
16:20:52.915021624 -0400
@@ -46,6 +46,22 @@
 #include 
 #include "megaraid_sas.h"
 
+/*
+ * Module parameters
+ */
+
+/*
+ * Fast driver load option, skip scanning for physical devices during
+ * load.  This would result in physical devices being skipped during
+ * driver load time. These can be later added though,
+ * using /proc/scsi/scsi
+ */
+static unsigned int fast_load;
+module_param_named(fast_load, fast_load, int, 0);
+MODULE_PARM_DESC(fast_load,
+   "megasas: Faster loading of the driver, skips physical devices! \
+(default = 0)");
+
 MODULE_LICENSE("GPL");
 MODULE_VERSION(MEGASAS_VERSION);
 MODULE_AUTHOR("[EMAIL PROTECTED]");
@@ -1094,6 +1110,44 @@ megasas_service_aen(struct megasas_insta
megasas_return_cmd(instance, cmd);
 }
 
+static struct megasas_instance *megasas_lookup_instance(u16 host_no)
+{
+   int i;
+
+   for (i = 0; i < megasas_mgmt_info.max_index; i++) {
+   if ((megasas_mgmt_info.instance[i]) &&
+   (megasas_mgmt_info.instance[i]->host->host_no
+   == host_no))
+   return megasas_mgmt_info.instance[i];
+   }
+
+   return NULL;
+}
+
+static int megasas_slave_alloc(struct scsi_device *sdev)
+{
+   struct megasas_instance *instance;
+   int tmp_fastload = fast_load;
+
+   instance = megasas_lookup_instance(sdev->host->host_no);
+
+   if (tmp_fastload && sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
+   if ((sdev->id == MEGASAS_MAX_DEV_PER_CHANNEL -1) &&
+   (sdev->channel == MEGASAS_MAX_PD_CHANNELS - 1)) {
+
+   /*
+* If fast load option was set and scan for last device is
+* over, reset the fast_load flag so that during a possible
+* next scan, devices can be made available
+*/
+   fast_load = 0;
+   }
+   return -ENXIO;
+   }
+
+   return 0;
+}
+
 /*
  * Scsi host template for megaraid_sas driver
  */
@@ -1103,6 +1157,7 @@ static struct scsi_host_template megasas
.name = "LSI Logic SAS based MegaRAID driver",
.proc_name = "megaraid_sas",
.slave_configure = megasas_slave_configure,
+   .slave_alloc = megasas_slave_alloc,
.queuecommand = megasas_queue_command,
.eh_device_reset_handler = megasas_reset_device,
.eh_bus_reset_handler = megasas_reset_bus_host,
@@ -2961,20 +3016,6 @@ megasas_mgmt_fw_ioctl(struct megasas_ins
return error;
 }
 
-static struct megasas_instance *megasas_lookup_instance(u16 host_no)
-{
-   int i;
-
-   for (i = 0; i < megasas_mgmt_info.max_index; i++) {
-
-   if ((megasas_mgmt_info.instance[i]) &&
-   (megasas_mgmt_info.instance[i]->host->host_no == host_no))
-   return megasas_mgmt_info.instance[i];
-   }
-
-   return NULL;
-}
-
 static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
 {
struct megasas_iocpacket __user *user_ioc =

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