Re: [PATCH] lpfc: convert to use the data buffer accessors - part 2

2007-07-03 Thread James Smart

ACK - missed in our merge. Thank You...

-- james s

Boaz Harrosh wrote:

 This is an addendum to:
 commit a0b4f78f9a4c869e9b29f254054ad7441cb40bbf
 Author: FUJITA Tomonori <[EMAIL PROTECTED]>
[SCSI] lpfc: convert to use the data buffer accessors

 One place was missed in the merge

 Signed-off-by: Boaz Harrosh <[EMAIL PROTECTED]>
---
 drivers/scsi/lpfc/lpfc_scsi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 5d2e3de..3d35eae 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -506,7 +506,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct 
lpfc_scsi_buf *lpfc_cmd,
"underrun converted to error "
"Data: x%x x%x x%x\n",
phba->brd_no, vpi, cmnd->cmnd[0],
-   cmnd->request_bufflen,
+   scsi_bufflen(cmnd),
scsi_get_resid(cmnd), cmnd->underflow);
host_status = DID_ERROR;
}

-
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: Some NCQ numbers...

2007-07-03 Thread Tejun Heo
Hello,

Michael Tokarev wrote:
> Well.  It looks like the results does not depend on the
> elevator.  Originally I tried with deadline, and just
> re-ran the test with noop (hence the long delay with
> the answer) - changing linux elevator changes almost
> nothing in the results - modulo some random "fluctuations".

I see.  Thanks for testing.

> In any case, NCQ - at least in this drive - just does
> not work.  Linux with its I/O elevator may help to
> speed things up a bit, but the disk does nothing in
> this area.  NCQ doesn't slow things down either - it
> just does not work.
> 
> The same's for ST3250620NS "enterprise" drives.
> 
> By the way, Seagate announced Barracuda ES 2 series
> (in range 500..1200Gb if memory serves) - maybe with
> those, NCQ will work better?

No one would know without testing.

> Or maybe it's libata which does not implement NCQ
> "properly"?  (As I shown before, with almost all
> ol'good SCSI drives TCQ helps alot - up to 2x the
> difference and more - with multiple I/O threads)

Well, what the driver does is minimal.  It just passes through all the
commands to the harddrive.  After all, NCQ/TCQ gives the harddrive more
responsibility regarding request scheduling.

-- 
tejun
-
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 1/4] scsi: megaraid_sas -- add hibernation support

2007-07-03 Thread Andrew Morton
On Sun, 01 Jul 2007 12:31:23 -0400
bo yang <[EMAIL PROTECTED]> wrote:

> The megaraid_sas driver doesn't support the hibernation, the
> suspend/resume routine implemented to support the hibernation.
> 
> Signed-off-by: Bo Yang <[EMAIL PROTECTED]>
> 
> ---
> 
> drivers/scsi/megaraid/megaraid_sas.c |  308 +++--
> drivers/scsi/megaraid/megaraid_sas.h |1
> 2 files changed, 239 insertions(+), 70 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-06-20
> 02:18:24.0 -0400
> +++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c 2007-06-30
> 03:21:27.0 -0400

wordwrapped.

> @@ -1804,6 +1804,81 @@ static void megasas_complete_cmd_dpc(uns
>  }
>  
>  /**
> + * megasas_issue_init_mfi - Initializes the FW
> + * @instance:  Adapter soft state
> + *
> + * Issues the INIT MFI cmd
> + */
> +static int
> +megasas_issue_init_mfi(struct megasas_instance *instance)
> +{
> + u32 context;
> +
> + struct megasas_cmd *cmd;
> +
> + struct megasas_init_frame *init_frame;
> + struct megasas_init_queue_info *initq_info;
> + dma_addr_t init_frame_h;
> + dma_addr_t initq_info_h;

Please use tabs, not spaces.

> + /*
> +  * Prepare a init frame. Note the init frame points to queue info
> +  * structure. Each frame has SGL allocated after first 64 bytes. For
> +  * this frame - since we don't need any SGL - we use SGL's space as
> +  * queue info structure
> +  *
> +  * We will not get a NULL command below. We just created the pool.
> +  */
> + cmd = megasas_get_cmd(instance);
> +
> + init_frame = (struct megasas_init_frame *)cmd->frame;
> + initq_info = (struct megasas_init_queue_info *)
> + ((unsigned long)init_frame + 64);
> +
> + init_frame_h = cmd->frame_phys_addr;
> + initq_info_h = init_frame_h + 64;
> +
> + context = init_frame->context;
> + memset(init_frame, 0, MEGAMFI_FRAME_SIZE);
> + memset(initq_info, 0, sizeof(struct megasas_init_queue_info));
> + init_frame->context = context;
> +
> + initq_info->reply_queue_entries = instance->max_fw_cmds + 1;
> + initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h;
> +
> + initq_info->producer_index_phys_addr_lo = instance->producer_h;
> + initq_info->consumer_index_phys_addr_lo = instance->consumer_h;
> +
> + init_frame->cmd = MFI_CMD_INIT;
> + init_frame->cmd_status = 0xFF;
> + init_frame->queue_info_new_phys_addr_lo = initq_info_h;
> +
> + init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info);
> +
> + /*
> +  * disable the intr before firing the init frame to FW
> +  */
> + instance->instancet->disable_intr(instance->reg_set);
> +
> + /*
> +  * Issue the init frame in polled mode
> +  */
> +
> + if (megasas_issue_polled(instance, cmd)) {
> + printk(KERN_DEBUG "megasas: Failed to init firmware\n");

I'd have though KERN_ERR was appropriate here?

> + megasas_return_cmd(instance, cmd);
> + goto fail_fw_init;
> + }
> +
> + megasas_return_cmd(instance, cmd);
> +
> + return 0;
> +
> + fail_fw_init:
> + return -EINVAL;
> +}
>
> ..
>
> - if (megasas_issue_polled(instance, cmd)) {
> - printk(KERN_DEBUG "megasas: Failed to init firmware\n");

hm, it was KERN_DEBUG before.  Perhaps that was wrong.

> +static int
> +megasas_set_dma_mask(struct pci_dev *pdev)
> +{
> + /*
> +  * All our contollers are capable of performing 64-bit DMA
> +  */
> + if (IS_DMA64) {

Bah.

#define IS_DMA64 (sizeof(dma_addr_t) == 8)

that should not be in a driver-private header file.

> +
> +  fail_irq:
> +  fail_init_mfi:

Opinions vary, but we usually indent labels by zero or one spaces.


-
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 1/4] scsi: megaraid_sas -- add hibernation support

2007-07-03 Thread bo yang
The megaraid_sas driver doesn't support the hibernation, the
suspend/resume routine implemented to support the hibernation.

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

---

drivers/scsi/megaraid/megaraid_sas.c |  308 +++--
drivers/scsi/megaraid/megaraid_sas.h |1
2 files changed, 239 insertions(+), 70 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-06-20
02:18:24.0 -0400
+++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c 2007-06-30
03:21:27.0 -0400
@@ -1804,6 +1804,81 @@ static void megasas_complete_cmd_dpc(uns
 }
 
 /**
+ * megasas_issue_init_mfi - Initializes the FW
+ * @instance:  Adapter soft state
+ *
+ * Issues the INIT MFI cmd
+ */
+static int
+megasas_issue_init_mfi(struct megasas_instance *instance)
+{
+ u32 context;
+
+ struct megasas_cmd *cmd;
+
+ struct megasas_init_frame *init_frame;
+ struct megasas_init_queue_info *initq_info;
+ dma_addr_t init_frame_h;
+ dma_addr_t initq_info_h;
+
+   /*
+* Prepare a init frame. Note the init frame points to queue info
+* structure. Each frame has SGL allocated after first 64 bytes. For
+* this frame - since we don't need any SGL - we use SGL's space as
+* queue info structure
+*
+* We will not get a NULL command below. We just created the pool.
+*/
+   cmd = megasas_get_cmd(instance);
+
+   init_frame = (struct megasas_init_frame *)cmd->frame;
+   initq_info = (struct megasas_init_queue_info *)
+   ((unsigned long)init_frame + 64);
+
+   init_frame_h = cmd->frame_phys_addr;
+   initq_info_h = init_frame_h + 64;
+
+   context = init_frame->context;
+   memset(init_frame, 0, MEGAMFI_FRAME_SIZE);
+   memset(initq_info, 0, sizeof(struct megasas_init_queue_info));
+   init_frame->context = context;
+
+   initq_info->reply_queue_entries = instance->max_fw_cmds + 1;
+   initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h;
+
+   initq_info->producer_index_phys_addr_lo = instance->producer_h;
+   initq_info->consumer_index_phys_addr_lo = instance->consumer_h;
+
+   init_frame->cmd = MFI_CMD_INIT;
+   init_frame->cmd_status = 0xFF;
+   init_frame->queue_info_new_phys_addr_lo = initq_info_h;
+
+   init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info);
+
+   /*
+* disable the intr before firing the init frame to FW
+*/
+   instance->instancet->disable_intr(instance->reg_set);
+
+   /*
+* Issue the init frame in polled mode
+*/
+
+   if (megasas_issue_polled(instance, cmd)) {
+   printk(KERN_DEBUG "megasas: Failed to init firmware\n");
+   megasas_return_cmd(instance, cmd);
+   goto fail_fw_init;
+   }
+
+   megasas_return_cmd(instance, cmd);
+
+   return 0;
+
+   fail_fw_init:
+   return -EINVAL;
+}
+
+/**
  * megasas_init_mfi -  Initializes the FW
  * @instance:  Adapter soft state
  *
@@ -1816,15 +1891,7 @@ static int megasas_init_mfi(struct megas
u32 max_sectors_1;
u32 max_sectors_2;
struct megasas_register_set __iomem *reg_set;
-
-   struct megasas_cmd *cmd;
struct megasas_ctrl_info *ctrl_info;
-
-   struct megasas_init_frame *init_frame;
-   struct megasas_init_queue_info *initq_info;
-   dma_addr_t init_frame_h;
-   dma_addr_t initq_info_h;
-
/*
 * Map the message registers
 */
@@ -1901,52 +1968,8 @@ static int megasas_init_mfi(struct megas
goto fail_reply_queue;
}
 
-   /*
-* Prepare a init frame. Note the init frame points to queue info
-* structure. Each frame has SGL allocated after first 64 bytes. For
-* this frame - since we don't need any SGL - we use SGL's space as
-* queue info structure
-*
-* We will not get a NULL command below. We just created the pool.
-*/
-   cmd = megasas_get_cmd(instance);
-
-   init_frame = (struct megasas_init_frame *)cmd->frame;
-   initq_info = (struct megasas_init_queue_info *)
-   ((unsigned long)init_frame + 64);
-
-   init_frame_h = cmd->frame_phys_addr;
-   initq_info_h = init_frame_h + 64;
-
-   memset(init_frame, 0, MEGAMFI_FRAME_SIZE);
-   memset(initq_info, 0, sizeof(struct megasas_init_queue_info));
-
-   initq_info->reply_queue_entries = instance->max_fw_cmds + 1;
-   initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h;
-
-   initq_info->producer_index_phys_addr_lo = instance->producer_h;
-   initq_info->consumer_index_phys_addr_lo = instance->consumer_h;
-
-   init_frame->cmd = MFI_CMD_INIT;
-   init_frame->cmd_status = 0xFF;
-   init_frame->queue_info_new_phys_addr_lo = initq_info_h;
-
-   init_fram

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

2007-07-03 Thread Andrew Morton
On Sun, 01 Jul 2007 12:42:33 -0400
bo yang <[EMAIL PROTECTED]> wrote:

> Driver will skip physical devices scan for the first time if the
> fast_load is set.
> 

All your patches are wordwrapped and will need to be resent.

Also, there are multiple trivial errors in here, pretty much all of which
would have been detected had you run scripts/checkpatch.pl across the
diffs:

> + */
> +static unsigned int fast_load = 0;

Unneeded initialisation

> +static int megasas_slave_alloc(struct scsi_device *sdev) {

Missing newline

> + struct megasas_instance *instance ;

unneeded space

> + int tmp_fastload = fast_load;
> + instance = megasas_lookup_instance(sdev->host->host_no);

Missing blank line.

> + 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;
> +}
> +

-
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 4/4] scsi: megaraid_sas - update version and Changelog

2007-07-03 Thread bo yang
Update version and Changelog

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

---

Documentation/scsi/ChangeLog.megaraid_sas |  211 
drivers/scsi/megaraid/megaraid_sas.c  |2
drivers/scsi/megaraid/megaraid_sas.h  |6
3 files changed, 215 insertions(+), 4 deletions(-)

diff -rupN linux-2.6.22_orig/Documentation/scsi/ChangeLog.megaraid_sas 
linux-2.6.22_new/Documentation/scsi/ChangeLog.megaraid_sas
--- linux-2.6.22_orig/Documentation/scsi/ChangeLog.megaraid_sas 2007-07-02 
21:37:20.229689864 -0400
+++ linux-2.6.22_new/Documentation/scsi/ChangeLog.megaraid_sas 2007-07-02 
21:37:20.149702024 -0400
@@ -1,3 +1,239 @@
+1 Release Date: Wed. June 20 11:25:21 PDT 2007 -
+   (emaild-id:[EMAIL PROTECTED])
+
+2 Current Version : 00.00.03.14-RC1
+3 Older Version   : 00.00.03.13
+
+1. convert to use the data buffer accessors
+
+>From: James Bottomley [mailto:[EMAIL PROTECTED]
+>Sent: Thursday, May 31, 2007 3:40 PM
+>To: FUJITA Tomonori; Patro, Sumant; James Bottomley
+>Subject: Patch added to scsi-misc-2.6: [SCSI] megaraid_sas: convert to use 
the data buffer accessors  
+- remove the unnecessary map_single path.
+- convert to use the new accessors for the sg lists and the
+parameters.
+   
+2. Clean up the codes and take off the compile warning.
+
+1 Release Date: Thu. May. 31 11:25:21 PDT 2007 -
+   (emaild-id:[EMAIL PROTECTED])
+
+2 Current Version : 00.00.03.13
+3 Older Version   : 00.00.03.12
+
+1. Added the megasas_reset_timer routine to intercept cmd timeout 
+   and throttle io.
+
+On Fri, 2007-03-16 at 16:44 -0600, James Bottomley wrote:
+It looks like megaraid_sas at least needs this to throttle its commands
+> as they begin to time out.  The code keeps the existing transport
+> template use of eh_timed_out (and allows the transport to override the
+> host if they both have this callback).
+> 
+> James
+
+1 Release Date: Sat. May. 14 16:30:43 PST 2007 -
+   (emaild-id:[EMAIL PROTECTED])
+   Sumant Patro
+   Bo Yang 
+
+2 Current Version : 00.00.03.12
+3 Older Version   : 00.00.03.11
+
+1.  When MegaSAS driver receives reset call from OS, driver waits in reset
+routine for max 3 minutes for all pending command completion. Now driver will
+call completion routine every 5 seconds from the reset routine instead of
+waiting for cmd completion from isr path.
+
+1 Release Date: Mon Apr. 30 10:25:52 PST 2007 -
+   (emaild-id:[EMAIL PROTECTED])
+   Sumant Patro
+   Bo Yang 
+
+2 Current Version : 00.00.03.11
+3 Older Version   : 00.00.03.10
+
+   1. Following module parameters added -
+   fast_load: Faster loading of the driver, skips physical devices
+   cmd_per_lun: Maximum number of commands per logical unit
+   max_sectors: Maximum number of sectors per IO command
+   2. Hibernation support added
+   3. Performing diskdump while running IO in RHEL 4 was failing. Fixed.
+   
+1 Release Date: Wed Mar. 28 10:25:52 PST 2007
+2 Current Version : 00.00.03.10
+3 Older Version   : 00.00.03.09
+
+i. Replaced pci_alloc_consistent with dma_alloc_coherent in ioctl path
+ii.eh_timed_out call back (megasas_reset_timer) is now used to throttle io 
to the
+   adapter when it is called the first time for a scmd.
+   The MEGASAS_FW_BUSY flag is set and can_queue reduced to 16. The 
can_queue is
+   restored from completion routine in following two conditions :
+   5 seconds has elapsed and the # of outstanding cmds in FW is < 17.
+   This implementation replaces the throttling mechanism of 3.08 ver.
+
+On Thu, 2007-02-15 at 19:53 -0700, Patro, Sumant wrote:
+> Hello James,
+>
+>   I re-submitted the patch yesterday with the "space" issue fixed
+> (adhering to coding guideline).
+>
+>   I will check for alternative to calculate the time driver have
+> been sending host busy to OS. Will check with time_before() as you have
+> suggested.
+>
+>   Throttling from megasas_generic_reset() handler did not help.
+> megaraid does not have feature to abort cmds. So, in the generic reset
+> routine, the driver just waits for cmd completion by FW. These timed-out
+> cmds gets retried by mid-layer with "retries" incremented by 1.
+> Eventually we see retries equals max_allowed followed by SCSI error with
+> "DRIVER_TIMEOUT".
+
+That's rather what worries me.  When the error handler activates (which
+it will on the first timeout), it waits for all commands to complete or
+time out before running.  Your reset handler does nothing other than
+wait for the firmware to complete the commands (now uselessly), so we
+now wait for the entire firmware command queue to drain, then you tell
+the mid layer everything is OK, so it loads you up again with all the
+commands plus a few test unit readies for good measure, then you
+throttle.
+
+You really want 

[PATCH 3/4] scsi: megaraid_sas - add module param max_sectors, cmd_per_lun

2007-07-03 Thread bo yang
Adding module parameters to configure max sectors per request & # of cmds for 
each lun.

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

---

drivers/scsi/megaraid/megaraid_sas.c |   87 -
drivers/scsi/megaraid/megaraid_sas.h |2
 2 files changed, 88 insertions(+), 1 deletion(-)

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-06-30
04:02:02.0 -0400
+++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c 2007-06-30
08:07:16.0 -0400
@@ -61,6 +61,23 @@ MODULE_PARM_DESC(fast_load,
  "megasas: Faster loading of the driver, skips physical devices! \
   (default=0)");
 
+/*
+ * Number of sectors per IO command
+ * Will be set in megasas_init_mfi if user does not provide
+ */
+static unsigned int max_sectors = 0;
+module_param_named(max_sectors, max_sectors, int, 0);
+MODULE_PARM_DESC(max_sectors,
+ "Maximum number of sectors per IO command");
+
+/*
+ * Number of cmds per logical unit
+ */
+static unsigned int cmd_per_lun = MEGASAS_DEFAULT_CMD_PER_LUN;
+module_param_named(cmd_per_lun, cmd_per_lun, int, 0);
+MODULE_PARM_DESC(cmd_per_lun,
+ "Maximum number of commands per logical unit (default=128)");
+
 MODULE_LICENSE("GPL");
 MODULE_VERSION(MEGASAS_VERSION);
 MODULE_AUTHOR("[EMAIL PROTECTED]");
@@ -2298,6 +2315,30 @@ static int megasas_start_aen(struct mega
class_locale.word);
 }
 
+static ssize_t
+sysfs_max_sectors_read(struct kobject *kobj, char *buf,
+   loff_t off, size_t count)
+{
+   struct Scsi_Host *host = class_to_shost(container_of(kobj,
+   struct class_device, kobj));
+   struct megasas_instance *instance = 
+   (struct megasas_instance *)host->hostdata;
+
+   count = sprintf(buf,"%u\n", instance->max_sectors_per_req);
+
+   return count+1;
+}
+
+static struct bin_attribute sysfs_max_sectors_attr = {
+   .attr = {
+   .name = "max_sectors",
+   .mode = S_IRUSR|S_IRGRP|S_IROTH,
+   .owner = THIS_MODULE,
+   },
+   .size = 7,
+   .read = sysfs_max_sectors_read,
+};
+
 /**
  * megasas_io_attach - Attaches this driver to SCSI mid-layer
  * @instance:  Adapter soft state
@@ -2305,6 +2346,7 @@ static int megasas_start_aen(struct mega
 static int megasas_io_attach(struct megasas_instance *instance)
 {
struct Scsi_Host *host = instance->host;
+   int error;
 
/*
 * Export parameters required by SCSI mid-layer
@@ -2314,8 +2356,35 @@ static int megasas_io_attach(struct mega
host->can_queue = instance->max_fw_cmds - MEGASAS_INT_CMDS;
host->this_id = instance->init_id;
host->sg_tablesize = instance->max_num_sge;
+
+   /*
+* Check if the module parameter value for max_sectors can be used
+*/
+   if (max_sectors && max_sectors <= instance->max_sectors_per_req)
+   instance->max_sectors_per_req = max_sectors;
+   else {
+   if(max_sectors)
+   printk(KERN_INFO "megasas: max_sectors should be > 0 
and"
+   "<= %d\n",instance->max_sectors_per_req);
+   }
+
host->max_sectors = instance->max_sectors_per_req;
-   host->cmd_per_lun = 128;
+
+   /*
+* Check if the module parameter value for cmd_per_lun can be used
+*/
+   instance->cmd_per_lun = MEGASAS_DEFAULT_CMD_PER_LUN;
+   if (cmd_per_lun && cmd_per_lun <= MEGASAS_DEFAULT_CMD_PER_LUN)
+   instance->cmd_per_lun = cmd_per_lun;
+   else
+   printk(KERN_INFO "megasas: cmd_per_lun should be > 0 and"
+   "<= %d\n",MEGASAS_DEFAULT_CMD_PER_LUN);
+
+   host->cmd_per_lun = instance->cmd_per_lun;
+
+   printk(KERN_DEBUG "megasas: max_sectors : 0x%x, cmd_per_lun : 0x%x\n",
+   instance->max_sectors_per_req, instance->cmd_per_lun);
+
host->max_channel = MEGASAS_MAX_CHANNELS - 1;
host->max_id = MEGASAS_MAX_DEV_PER_CHANNEL;
host->max_lun = MEGASAS_MAX_LUN;
@@ -2330,10 +2399,25 @@ static int megasas_io_attach(struct mega
}
 
/*
+* Create sysfs entries for module paramaters
+*/
+   error = sysfs_create_bin_file(&instance->host->shost_classdev.kobj,
+   &sysfs_max_sectors_attr);
+   if (error) {
+   printk(KERN_INFO "megasas: Error in creating the sysfs entry"
+   " max_sectors.\n");
+   goto out_remove_host;
+   }
+
+   /*
 * Trigger SCSI to scan our drives
 */
scsi_scan_host(host);
return 0;
+
+out_remove_host:
+   scsi_remove_host(host);
+   return error;
 }
 
 static int
@@ -2753,6 +2837,7 @@ static void megasas_detach_one(struct pc
instance = pci_get_d

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

2007-07-03 Thread bo yang
Driver will skip physical devices scan for the first time if the
fast_load is set.

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

---

drivers/scsi/megaraid/megaraid_sas.c |   64 +++--
 1 files changed, 50 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-06-30
03:36:39.0 -0400
+++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c 2007-06-30
03:59:27.0 -0400
@@ -46,6 +46,21 @@
 #include 
 #include "megaraid_sas.h"
 
+/*
+ * Modules 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 = 0;
+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 +1109,40 @@ 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 +1152,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,
@@ -2969,20 +3019,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


[PATCH 1/4] scsi: megaraid_sas -- add hibernation support

2007-07-03 Thread bo yang

The megaraid_sas driver doesn't support the hibernation, the
suspend/resume routine implemented to support the hibernation.

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

---

 drivers/scsi/megaraid/megaraid_sas.c |  308 +++--
 drivers/scsi/megaraid/megaraid_sas.h |1
 2 files changed, 239 insertions(+), 70 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-06-20
02:18:24.0 -0400
+++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c 2007-06-30
03:21:27.0 -0400
@@ -1804,6 +1804,81 @@ static void megasas_complete_cmd_dpc(uns
 }
 
 /**
+ * megasas_issue_init_mfi - Initializes the FW
+ * @instance:  Adapter soft state
+ *
+ * Issues the INIT MFI cmd
+ */
+static int
+megasas_issue_init_mfi(struct megasas_instance *instance)
+{
+ u32 context;
+
+ struct megasas_cmd *cmd;
+
+ struct megasas_init_frame *init_frame;
+ struct megasas_init_queue_info *initq_info;
+ dma_addr_t init_frame_h;
+ dma_addr_t initq_info_h;
+
+   /*
+* Prepare a init frame. Note the init frame points to queue info
+* structure. Each frame has SGL allocated after first 64 bytes. For
+* this frame - since we don't need any SGL - we use SGL's space as
+* queue info structure
+*
+* We will not get a NULL command below. We just created the pool.
+*/
+   cmd = megasas_get_cmd(instance);
+
+   init_frame = (struct megasas_init_frame *)cmd->frame;
+   initq_info = (struct megasas_init_queue_info *)
+   ((unsigned long)init_frame + 64);
+
+   init_frame_h = cmd->frame_phys_addr;
+   initq_info_h = init_frame_h + 64;
+
+   context = init_frame->context;
+   memset(init_frame, 0, MEGAMFI_FRAME_SIZE);
+   memset(initq_info, 0, sizeof(struct megasas_init_queue_info));
+   init_frame->context = context;
+
+   initq_info->reply_queue_entries = instance->max_fw_cmds + 1;
+   initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h;
+
+   initq_info->producer_index_phys_addr_lo = instance->producer_h;
+   initq_info->consumer_index_phys_addr_lo = instance->consumer_h;
+
+   init_frame->cmd = MFI_CMD_INIT;
+   init_frame->cmd_status = 0xFF;
+   init_frame->queue_info_new_phys_addr_lo = initq_info_h;
+
+   init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info);
+
+   /*
+* disable the intr before firing the init frame to FW
+*/
+   instance->instancet->disable_intr(instance->reg_set);
+
+   /*
+* Issue the init frame in polled mode
+*/
+
+   if (megasas_issue_polled(instance, cmd)) {
+   printk(KERN_DEBUG "megasas: Failed to init firmware\n");
+   megasas_return_cmd(instance, cmd);
+   goto fail_fw_init;
+   }
+
+   megasas_return_cmd(instance, cmd);
+
+   return 0;
+
+   fail_fw_init:
+   return -EINVAL;
+}
+
+/**
  * megasas_init_mfi -  Initializes the FW
  * @instance:  Adapter soft state
  *
@@ -1816,15 +1891,7 @@ static int megasas_init_mfi(struct megas
u32 max_sectors_1;
u32 max_sectors_2;
struct megasas_register_set __iomem *reg_set;
-
-   struct megasas_cmd *cmd;
struct megasas_ctrl_info *ctrl_info;
-
-   struct megasas_init_frame *init_frame;
-   struct megasas_init_queue_info *initq_info;
-   dma_addr_t init_frame_h;
-   dma_addr_t initq_info_h;
-
/*
 * Map the message registers
 */
@@ -1901,52 +1968,8 @@ static int megasas_init_mfi(struct megas
goto fail_reply_queue;
}
 
-   /*
-* Prepare a init frame. Note the init frame points to queue info
-* structure. Each frame has SGL allocated after first 64 bytes. For
-* this frame - since we don't need any SGL - we use SGL's space as
-* queue info structure
-*
-* We will not get a NULL command below. We just created the pool.
-*/
-   cmd = megasas_get_cmd(instance);
-
-   init_frame = (struct megasas_init_frame *)cmd->frame;
-   initq_info = (struct megasas_init_queue_info *)
-   ((unsigned long)init_frame + 64);
-
-   init_frame_h = cmd->frame_phys_addr;
-   initq_info_h = init_frame_h + 64;
-
-   memset(init_frame, 0, MEGAMFI_FRAME_SIZE);
-   memset(initq_info, 0, sizeof(struct megasas_init_queue_info));
-
-   initq_info->reply_queue_entries = instance->max_fw_cmds + 1;
-   initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h;
-
-   initq_info->producer_index_phys_addr_lo = instance->producer_h;
-   initq_info->consumer_index_phys_addr_lo = instance->consumer_h;
-
-   init_frame->cmd = MFI_CMD_INIT;
-   init_frame->cmd_status = 0xFF;
-   init_frame->queue_info_new_phys_addr_lo = initq_info_h;
-
-   init

Re: Some NCQ numbers...

2007-07-03 Thread Michael Tokarev
Tejun Heo wrote:
> Michael Tokarev wrote:
[]
>> A test drive is Seagate Barracuda ST3250620AS "desktop" drive,
>> 250Gb, cache size is 16Mb, 7200RPM.
[test shows that NCQ makes no difference whatsoever]

> And which elevator?

Well.  It looks like the results does not depend on the
elevator.  Originally I tried with deadline, and just
re-ran the test with noop (hence the long delay with
the answer) - changing linux elevator changes almost
nothing in the results - modulo some random "fluctuations".

In any case, NCQ - at least in this drive - just does
not work.  Linux with its I/O elevator may help to
speed things up a bit, but the disk does nothing in
this area.  NCQ doesn't slow things down either - it
just does not work.

The same's for ST3250620NS "enterprise" drives.

By the way, Seagate announced Barracuda ES 2 series
(in range 500..1200Gb if memory serves) - maybe with
those, NCQ will work better?

Or maybe it's libata which does not implement NCQ
"properly"?  (As I shown before, with almost all
ol'good SCSI drives TCQ helps alot - up to 2x the
difference and more - with multiple I/O threads)

/mjt
-
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: NPIV mapping problems (was Re: [PATCH 1/19] add data buffer accessors)

2007-07-03 Thread Seokmann Ju
On Fri, 29 June 2007, Andrew Vasquez wrote:
> On Sat, 12 May 2007, James Bottomley wrote:
> 
> > On Sat, 2007-05-12 at 19:05 +0900, FUJITA Tomonori wrote:
> > > Add a set of accessors for the scsi data buffer. This is in 
> > > preparation for chaining sg lists and bidirectional requests (and 
> > > possibly, the mid-layer dma mapping).
> > > 
> > > Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
> > > ---
> > >  drivers/scsi/scsi_lib.c  |   26 ++
> > >  include/scsi/scsi_cmnd.h |   11 +++
> > >  2 files changed, 37 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/scsi/scsi_lib.c 
> b/drivers/scsi/scsi_lib.c index 
> > > 1f5a07b..a2ebe61 100644
> > > --- a/drivers/scsi/scsi_lib.c
> > > +++ b/drivers/scsi/scsi_lib.c
> > > @@ -2290,3 +2290,29 @@ void scsi_kunmap_atomic_sg(void *virt)
> > >   kunmap_atomic(virt, KM_BIO_SRC_IRQ);  }  
> > > EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
> > > +
> > > +int scsi_dma_map(struct device *dev, struct scsi_cmnd *cmd)
> > 
> > Actually, this is redundant.  We make sure the
> > shost->shost_gendev.parent is the device which should have 
> been passed
> > in to scsi_add_host().
> 
> Well, there's perhaps an unintended side-effect with this 
> assumption, NPIV-based 'vports' (and their subsequent 'struct 
> device' members) are not fully initialized objects.
> 
> This is what we've run into while working on our NPIV (based) 
> driver with the 'data buffer' accessors works, while queueing 
> the first command to an sdev of a freshly created vport:
> ... 
> One possiblity (the least intrusive) would be to add a
> scsi_dma_map_with_device() function which takes the proper (LLD
> defined) 'struct device' as a parameter, as was originally 
> proposed, and have NPIV-aware drivers call that function 
> during the mappings of physical *and* virtual dma-mappings.
As a one possible solution, scsi_dma_map_with_device() has added.
With this change, the QLogic NPIV enabled driver has tested and it works
fine.
With the patch attached, would like to stroke this thread so that it can
move forward.

Thank you,
Seokmann
---
>From cddc43e416deeb875982f371d27c4fb074d5970e Mon Sep 17 00:00:00 2001
From: Seokmann Ju <[EMAIL PROTECTED]>
Date: Tue, 3 Jul 2007 11:53:34 -0700
Subject: [PATCH] add data buffer accessor with device structure.

- in addition to scsi_dma_map(), scsi_dma_map_with_device() has added.
- this addition is for not fully instantiated host, like virtual hosts
on
  NPIV based implementation.

Signed-off-by: Seokmann Ju <[EMAIL PROTECTED]>
---
 drivers/scsi/scsi_lib.c  |   22 ++
 include/scsi/scsi_cmnd.h |1 +
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 70454b4..90601ed 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2315,6 +2315,28 @@ int scsi_dma_map(struct scsi_cmnd *cmd)
 EXPORT_SYMBOL(scsi_dma_map);

 /**
+ * scsi_dma_map_with_device - perform DMA mapping against command's sg
lists
+ * @dev:   device structure
+ * @cmd:   scsi command
+ *
+ * Returns the number of sg lists actually used, zero if the sg lists
+ * is NULL, or -ENOMEM if the mapping failed.
+ */
+int scsi_dma_map_with_device(struct device *dev, struct scsi_cmnd *cmd)
+{
+   int nseg = 0;
+
+   if (scsi_sg_count(cmd)) {
+   nseg = dma_map_sg(dev, scsi_sglist(cmd),
scsi_sg_count(cmd),
+ cmd->sc_data_direction);
+   if (unlikely(!nseg))
+   return -ENOMEM;
+   }
+   return nseg;
+}
+EXPORT_SYMBOL(scsi_dma_map_with_device);
+
+/**
  * scsi_dma_unmap - unmap command's sg lists mapped by scsi_dma_map
  * @cmd:   scsi command
  */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 53e1705..a223331 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -136,6 +136,7 @@ extern struct scatterlist *scsi_alloc_sgtable(struct
scsi_cmnd *, gfp_t);
 extern void scsi_free_sgtable(struct scatterlist *, int);

 extern int scsi_dma_map(struct scsi_cmnd *cmd);
+extern int scsi_dma_map_with_device(struct device *dev, struct
scsi_cmnd *cmd);
 extern void scsi_dma_unmap(struct scsi_cmnd *cmd);

 #define scsi_sg_count(cmd) ((cmd)->use_sg)
--
1.5.2.2.603.g7c851
---


0001-add-data-buffer-accessor-with-device-structure.patch
Description: 0001-add-data-buffer-accessor-with-device-structure.patch


RE: [PATCH 1/5] use mutex instead of semaphore in Megaraid Mailbox driver

2007-07-03 Thread Patro, Sumant

Thank you Matthias for the patch.

Regards,

Sumant

-Original Message-
From: Matthias Kaehlcke [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 01, 2007 9:29 AM
To: DL-MegaRAID Linux; linux-scsi@vger.kernel.org
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PATCH 1/5] use mutex instead of semaphore in Megaraid Mailbox
driver

The Megaraid Mailbox driver uses a semaphore as mutex. Use the mutex API
instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <[EMAIL PROTECTED]>

--

diff --git a/drivers/scsi/megaraid/mega_common.h
b/drivers/scsi/megaraid/mega_common.h
index 26e1e6c..fef9ac9 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c
b/drivers/scsi/megaraid/megaraid_mbox.c
index 04d0b69..2cecc64 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3957,7 +3957,7 @@ megaraid_sysfs_alloc_resources(adapter_t *adapter)
megaraid_sysfs_free_resources(adapter);
}
 
-   sema_init(&raid_dev->sysfs_sem, 1);
+   mutex_init(&raid_dev->sysfs_mtx);
 
init_waitqueue_head(&raid_dev->sysfs_wait_q);
 
@@ -4058,7 +4058,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
/*
 * Allow only one read at a time to go through the sysfs
attributes
 */
-   down(&raid_dev->sysfs_sem);
+   mutex_lock(&raid_dev->sysfs_mtx);
 
uioc= raid_dev->sysfs_uioc;
mbox64  = raid_dev->sysfs_mbox64;
@@ -4134,7 +4134,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
 
del_timer_sync(timerp);
 
-   up(&raid_dev->sysfs_sem);
+   mutex_unlock(&raid_dev->sysfs_mtx);
 
return rval;
 }
diff --git a/drivers/scsi/megaraid/megaraid_mbox.h
b/drivers/scsi/megaraid/megaraid_mbox.h
index 9de803c..626459d 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.h
+++ b/drivers/scsi/megaraid/megaraid_mbox.h
@@ -168,7 +168,7 @@ typedef struct {
  * @hw_error   : set if FW not responding
  * @fast_load  : If set, skip physical device scanning
  * @channel_class  : channel class, RAID or SCSI
- * @sysfs_sem  : semaphore to serialize access to sysfs
res.
+ * @sysfs_mtx  : mutex to serialize access to sysfs
res.
  * @sysfs_uioc : management packet to issue FW calls
from sysfs
  * @sysfs_mbox64   : mailbox packet to issue FW calls from
sysfs
  * @sysfs_buffer   : data buffer for FW commands issued
from sysfs
@@ -208,7 +208,7 @@ typedef struct {
int hw_error;
int fast_load;
uint8_t channel_class;
-   struct semaphoresysfs_sem;
+   struct mutexsysfs_mtx;
uioc_t  *sysfs_uioc;
mbox64_t*sysfs_mbox64;
caddr_t sysfs_buffer;

--
Matthias Kaehlcke
Linux Application Developer
Barcelona

 An ounce of practice is worth more than tons of preaching
(Mahatma Gandhi)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
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]mpt fusion: add sysfs attributes to display IOC parameters

2007-07-03 Thread Patrick_Boyd
>diff -Naurp b/drivers/message/fusion/mptbase.h
a/drivers/message/fusion/mptbase.h
>--- b/drivers/message/fusion/mptbase.h 2007-07-02 16:20:46.0
+0530
>+++ a/drivers/message/fusion/mptbase.h 2007-07-03 18:13:28.0
+0530
>@@ -78,6 +78,10 @@
> #define MPT_LINUX_VERSION_COMMON  "3.04.05"
> #define MPT_LINUX_PACKAGE_NAME"@(#)mptlinux-3.04.05"
> #define WHAT_MAGIC_STRING "@" "(" "#" ")"
>+#define MPT_LINUX_MAJOR_VERSION   3
>+#define MPT_LINUX_MINOR_VERSION   04
>+#define MPT_LINUX_BUILD_VERSION   05
>+#define MPT_LINUX_RELEASE_VERSION 00

You have the version information listed 3 times. Can't you just build
MPT_LINUX_VERSION_COMMON and MPT_LINUX_PACKAGE_NAME?
-
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


mpt boot trouble 2.6.21, 2.6.22-rcX regression

2007-07-03 Thread maximilian attems
forwarding latest message to this boot trouble report
http://bugs.debian.org/425851

- Forwarded message from Frans Pop <[EMAIL PROTECTED]> -
Subject: Bug#425851: Processed: (no subject)
From: Frans Pop <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Tue, 3 Jul 2007 16:29:24 +0200
Cc: Olaf van der Spek <[EMAIL PROTECTED]>

tags 425851 + upstream d-i
forwarded 425851 http://bugzilla.kernel.org/show_bug.cgi?id=8710
thanks

On Tuesday 03 July 2007 12:34, Olaf van der Spek wrote:
> I've installed 2.6.21 on two different VMware Workstation guests
> running on two different hosts and both fail to boot.

I've seen the same issue while installing D-I in vmware.

I've just run a git bisect and identified the commit that caused the 
regression. I've also verified that 2.6.22-rc7 has the same issue.

See the upstream BR for details.

Cheers,
FJP

- End forwarded message -
-
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] lpfc: convert to use the data buffer accessors - part 2

2007-07-03 Thread Boaz Harrosh

 This is an addendum to:
 commit a0b4f78f9a4c869e9b29f254054ad7441cb40bbf
 Author: FUJITA Tomonori <[EMAIL PROTECTED]>
[SCSI] lpfc: convert to use the data buffer accessors

 One place was missed in the merge

 Signed-off-by: Boaz Harrosh <[EMAIL PROTECTED]>
---
 drivers/scsi/lpfc/lpfc_scsi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 5d2e3de..3d35eae 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -506,7 +506,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct 
lpfc_scsi_buf *lpfc_cmd,
"underrun converted to error "
"Data: x%x x%x x%x\n",
phba->brd_no, vpi, cmnd->cmnd[0],
-   cmnd->request_bufflen,
+   scsi_bufflen(cmnd),
scsi_get_resid(cmnd), cmnd->underflow);
host_status = DID_ERROR;
}
-- 
1.5.2.2.249.g45fd


-
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


Is scsi_reset_provider() overdoing it?

2007-07-03 Thread Boaz Harrosh

In scsi_error.c at scsi_reset_provider()
 Why do we need the uninitialized struct request hanging on
 the reset scsi_cmnd? It looks like we are bypassing block
 queues and directly going to llds. It also looks like llds
 understand not to touch any garbage request's fields during
 reset. Would it not be better to Just put a NULL instead?
 And while at it can I just put a DMA_NONE on this No-Data
 command?

Boaz

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 9adb64a..4f6026d 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1662,11 +1662,10 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
 {
struct scsi_cmnd *scmd = scsi_get_command(dev, GFP_KERNEL);
struct Scsi_Host *shost = dev->host;
-   struct request req;
unsigned long flags;
int rtn;
 
-   scmd->request = &req;
+   scmd->request = NULL;
memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout));
 
memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd));
@@ -1678,7 +1677,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
 
scmd->cmd_len   = 0;
 
-   scmd->sc_data_direction = DMA_BIDIRECTIONAL;
+   scmd->sc_data_direction = DMA_NONE;
 
init_timer(&scmd->eh_timeout);
 
-
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]mpt fusion: add sysfs attributes to display IOC parameters

2007-07-03 Thread Brian King
Prakash, Sathya wrote: 
> +static void
> +mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc)
> +{

> +
> + memcpy(ioc->board_name, pbuf->BoardName, 16);
> + memcpy(ioc->board_assembly, pbuf->BoardAssembly, 16);
> + memcpy(ioc->board_tracer, pbuf->BoardTracerNumber, 16);

Are these guaranteed to be NULL terminated? The code below appears to
assume they are. Also you might want to use sizeof instead of hardcoding
16 here.

> +static ssize_t
> +mptscsih_version_driver_show(struct class_device *cdev, char *buf)
> +{
> + return snprintf(buf, PAGE_SIZE, "%02d.%02d.%02d.%02d\n",
> + MPT_LINUX_MAJOR_VERSION, MPT_LINUX_MINOR_VERSION,
> + MPT_LINUX_BUILD_VERSION, MPT_LINUX_RELEASE_VERSION);
> +}
> +static CLASS_DEVICE_ATTR(version_driver, S_IRUGO, 
> mptscsih_version_driver_show, NULL);

You should be using the MODULE_VERSION macro instead of this. This results
in the version showing up in /sys/module/mpt_fusion/version

> +
> +static ssize_t
> +mptscsih_io_delay_show(struct class_device *cdev, char *buf)
> +{
> + struct Scsi_Host *host = class_to_shost(cdev);
> + MPT_SCSI_HOST   *hd = (MPT_SCSI_HOST *)host->hostdata;
> + MPT_ADAPTER *ioc = hd->ioc;
> + char delay_str[30];
> +
> + sprintf(delay_str, "%02d", ioc->io_missing_delay);
> + return snprintf(buf, PAGE_SIZE, "%s\n", delay_str);
> +}

Why not just do:

return snprintf(buf, PAGE_SIZE, "%02d", ioc->io_missing_delay);

and get rid of the delay_str on the stack? In fact you have a lot
of double sprintf's which seem like they could be just a single snprintf.


-Brian

-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
-
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]mpt fusion: add sysfs attributes to display IOC parameters

2007-07-03 Thread Prakash, Sathya
New sysfs scsi_host attributes are added to provide information about, 
Firmware version, BIOS version, Driver version, MPI version and other 
product related information.

Signed-off-by: Sathya Prakash <[EMAIL PROTECTED]>
---

diff -Naurp b/drivers/message/fusion/mptbase.c 
a/drivers/message/fusion/mptbase.c
--- b/drivers/message/fusion/mptbase.c  2007-07-02 16:20:46.0 +0530
+++ a/drivers/message/fusion/mptbase.c  2007-07-03 17:11:14.0 +0530
@@ -161,6 +161,7 @@ static int  mpt_readScsiDevicePageHeaders
 static voidmpt_read_ioc_pg_1(MPT_ADAPTER *ioc);
 static voidmpt_read_ioc_pg_4(MPT_ADAPTER *ioc);
 static voidmpt_timer_expired(unsigned long data);
+static voidmpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc);
 static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch);
 static int SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp);
 static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 
access_control_value, int sleepFlag);
@@ -1880,6 +1881,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u3
}
 
GetIoUnitPage2(ioc);
+   mpt_get_manufacturing_pg_0(ioc);
}
 
/*
@@ -5190,6 +5192,49 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
return;
 }
 
+static void
+mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc)
+{
+   CONFIGPARMS cfg;
+   ConfigPageHeader_t  hdr;
+   dma_addr_t  buf_dma;
+   ManufacturingPage0_t*pbuf = NULL;
+
+   memset(&cfg, 0 , sizeof(CONFIGPARMS));
+   memset(&hdr, 0 , sizeof(ConfigPageHeader_t));
+
+   hdr.PageType = MPI_CONFIG_PAGETYPE_MANUFACTURING;
+   cfg.cfghdr.hdr = &hdr;
+   cfg.physAddr = -1;
+   cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
+   cfg.timeout = 10;
+
+   if (mpt_config(ioc, &cfg) != 0)
+   goto out;
+
+   if (!cfg.cfghdr.hdr->PageLength)
+   goto out;
+
+   cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
+   pbuf = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, &buf_dma);
+   if (!pbuf)
+   goto out;
+
+   cfg.physAddr = buf_dma;
+
+   if (mpt_config(ioc, &cfg) != 0)
+   goto out;
+
+   memcpy(ioc->board_name, pbuf->BoardName, 16);
+   memcpy(ioc->board_assembly, pbuf->BoardAssembly, 16);
+   memcpy(ioc->board_tracer, pbuf->BoardTracerNumber, 16);
+
+   out:
+
+   if (pbuf)
+   pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, 
buf_dma);
+}
+
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  * SendEventNotification - Send EventNotification (on or off) request to 
adapter
diff -Naurp b/drivers/message/fusion/mptbase.h 
a/drivers/message/fusion/mptbase.h
--- b/drivers/message/fusion/mptbase.h  2007-07-02 16:20:46.0 +0530
+++ a/drivers/message/fusion/mptbase.h  2007-07-03 18:13:28.0 +0530
@@ -78,6 +78,10 @@
 #define MPT_LINUX_VERSION_COMMON   "3.04.05"
 #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.05"
 #define WHAT_MAGIC_STRING  "@" "(" "#" ")"
+#define MPT_LINUX_MAJOR_VERSION3
+#define MPT_LINUX_MINOR_VERSION04
+#define MPT_LINUX_BUILD_VERSION05
+#define MPT_LINUX_RELEASE_VERSION  00
 
 #define show_mptmod_ver(s,ver)  \
printk(KERN_INFO "%s %s\n", s, ver);
@@ -538,6 +542,13 @@ typedef struct _MPT_ADAPTER
int  pci_irq;   /* This irq   */
char name[MPT_NAME_LENGTH]; /* "iocN" */
char*prod_name; /* "LSIFC9x9" */
+   char board_name[16];
+   char board_assembly[16];
+   char board_tracer[16];
+   u16  nvdata_version_persistent;
+   u16  nvdata_version_default;
+   u8   io_missing_delay;
+   u8   device_missing_delay;
SYSIF_REGS __iomem  *chip;  /* == c8817000 (mmap) */
SYSIF_REGS __iomem  *pio_chip;  /* Programmed IO (downloadboot) 
*/
u8   bus_type;
diff -Naurp b/drivers/message/fusion/mptfc.c a/drivers/message/fusion/mptfc.c
--- b/drivers/message/fusion/mptfc.c2007-07-02 16:20:46.0 +0530
+++ a/drivers/message/fusion/mptfc.c2007-07-03 16:28:14.0 +0530
@@ -130,6 +130,7 @@ static struct scsi_host_template mptfc_d
.max_sectors= 8192,
.cmd_per_lun= 7,
.use_clustering = ENABLE_CLUSTERING,
+   .shost_attrs= mptscsih_host_attrs,
 };
 
 /
diff -Naurp b/drivers/message/fusion/mptsas.c a/drivers/message/fusion/mptsas.c
--- b/drivers/message/fusion/mptsas.c   2007-07-02 16:20:46.0 +0

Re: Some NCQ numbers...

2007-07-03 Thread Tejun Heo
Michael Tokarev wrote:
> [Offtopic notice: For the first time I demonstrated some
> speed testing results on linux-ide mailinglist, as a
> demonstration how [NT]CQ can help.  But later, someone
> becomes curious and posted that email to lkml, asking
> for more details.  Since that, I become more curious
> as well, and decided to look at it more closely.
> Here it goes...]
> 
> A test drive is Seagate Barracuda ST3250620AS "desktop" drive,
> 250Gb, cache size is 16Mb, 7200RPM.

And which elevator?

-- 
tejun
-
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