From: bo yang <bo.yang@lsi.com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: linux-scsi@vger.kernel.org, akpm@osdl.org,
linux-kernel@vger.kernel.org, "Patro,
Sumant" <Sumant.Patro@lsi.com>,
neela.kolli@lsi.com
Subject: [PATCH 2/4] scsi: megaraid_sas - Fix the frame count calculation
Date: Mon, 17 Mar 2008 03:36:43 -0400 [thread overview]
Message-ID: <1205739403.7479.9.camel@pcp021067pcs.se.lsil.com> (raw)
In-Reply-To: <1205824386.7238.7.camel@pcp021067pcs.se.lsil.com>
Driver sent the wrong frame count to firmware. This patch fixed the frame count calculation.
Signed-off-by Bo Yang<bo.yang@lsi.com>
---
drivers/scsi/megaraid/megaraid_sas.c | 31 ++++++++++++++++---------
drivers/scsi/megaraid/megaraid_sas.h | 4 +++
2 files changed, 25 insertions(+), 10 deletions(-)
diff -rupN linux-2.6.24_orig/drivers/scsi/megaraid/megaraid_sas.c linux-2.6.24_new/drivers/scsi/megaraid/megaraid_sas.c
--- linux-2.6.24_orig/drivers/scsi/megaraid/megaraid_sas.c 2008-03-17 13:51:18.000000000 -0400
+++ linux-2.6.24_new/drivers/scsi/megaraid/megaraid_sas.c 2008-03-17 13:50:39.000000000 -0400
@@ -488,12 +488,13 @@ megasas_make_sgl64(struct megasas_instan
/**
* megasas_get_frame_count - Computes the number of frames
+ * @frame_type : type of frame- io or pthru frame
* @sge_count : number of sg elements
*
* Returns the number of frames required for numnber of sge's (sge_count)
*/
-static u32 megasas_get_frame_count(u8 sge_count)
+static u32 megasas_get_frame_count(u8 sge_count, u8 frame_type)
{
int num_cnt;
int sge_bytes;
@@ -504,13 +505,22 @@ static u32 megasas_get_frame_count(u8 sg
sizeof(struct megasas_sge32);
/*
- * Main frame can contain 2 SGEs for 64-bit SGLs and
- * 3 SGEs for 32-bit SGLs
- */
- if (IS_DMA64)
- num_cnt = sge_count - 2;
- else
- num_cnt = sge_count - 3;
+ * Main frame can contain 2 SGEs for 64-bit SGLs and
+ * 3 SGEs for 32-bit SGLs for ldio &
+ * 1 SGEs for 64-bit SGLs and
+ * 2 SGEs for 32-bit SGLs for pthru frame
+ */
+ if (unlikely(frame_type == PTHRU_FRAME)) {
+ if (IS_DMA64)
+ num_cnt = sge_count - 1;
+ else
+ num_cnt = sge_count - 2;
+ } else {
+ if (IS_DMA64)
+ num_cnt = sge_count - 2;
+ else
+ num_cnt = sge_count - 3;
+ }
if(num_cnt>0){
sge_bytes = sge_sz * num_cnt;
@@ -592,7 +602,8 @@ megasas_build_dcdb(struct megasas_instan
* Compute the total number of frames this command consumes. FW uses
* this number to pull sufficient number of frames from host memory.
*/
- cmd->frame_count = megasas_get_frame_count(pthru->sge_count);
+ cmd->frame_count = megasas_get_frame_count(pthru->sge_count,
+ PTHRU_FRAME);
return cmd->frame_count;
}
@@ -709,7 +720,7 @@ megasas_build_ldio(struct megasas_instan
* Compute the total number of frames this command consumes. FW uses
* this number to pull sufficient number of frames from host memory.
*/
- cmd->frame_count = megasas_get_frame_count(ldio->sge_count);
+ cmd->frame_count = megasas_get_frame_count(ldio->sge_count, IO_FRAME);
return cmd->frame_count;
}
diff -rupN linux-2.6.24_orig/drivers/scsi/megaraid/megaraid_sas.h linux-2.6.24_new/drivers/scsi/megaraid/megaraid_sas.h
--- linux-2.6.24_orig/drivers/scsi/megaraid/megaraid_sas.h 2008-03-07 13:45:43.000000000 -0500
+++ linux-2.6.24_new/drivers/scsi/megaraid/megaraid_sas.h 2008-03-07 14:03:41.000000000 -0500
@@ -542,6 +542,10 @@ struct megasas_ctrl_info {
#define MEGASAS_FW_BUSY 1
+/* Frame Type */
+#define IO_FRAME 0
+#define PTHRU_FRAME 1
+
/*
* When SCSI mid-layer calls driver's reset routine, driver waits for
* MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note
next prev parent reply other threads:[~2008-03-17 19:57 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-07 17:09 [PATCH 1/6] scsi: megaraid_sas - add hibernation support bo yang
2007-11-16 21:31 ` Yang, Bo
2007-11-16 22:18 ` James Bottomley
[not found] ` <9738BCBE884FDB42801FAD8A7769C26501C9A4AF@NAMAIL1.ad.lsil.com>
2008-03-18 7:13 ` [PATCH 1/4] scsi: megaraid_sas - Rollback the sense info implementation bo yang
2008-03-17 7:36 ` bo yang [this message]
2008-03-17 8:13 ` [PATCH 3/4] scsi: megaraid_sas - Add the new controller Support to Driver bo yang
2008-08-01 16:48 ` [PATCH 2/4] scsi: megaraid_sas - Add the shutdown DCMD cmd to driver shutdown routine Yang, Bo
2008-08-01 21:17 ` [PATCH 3/4] scsi: megaraid_sas - Add the new controllers support Yang, Bo
2008-08-01 21:25 ` [PATCH 4/4] scsi: megaraid_sas - Version and Documentation Update Yang, Bo
2008-03-17 8:18 ` [PATCH 4/4] scsi: megaraid_sas - Update the Version and Changelog bo yang
2008-03-17 20:54 ` James Bottomley
2008-03-17 21:00 ` [PATCH 4/4] scsi: megaraid_sas - Update the Version andChangelog Yang, Bo
2009-02-17 14:44 ` [PATCH 1/9] scsi: megaraid_sas - Fix the tape drive support Yang, Bo
2009-02-17 15:25 ` [PATCH 2/9] scsi: megaraid_sas - Add poll wait support to megaraid sas driver - I Yang, Bo
2009-02-17 15:36 ` [PATCH 3/9] scsi: megaraid_sas - Add poll wait support to megaraid sas driver - II Yang, Bo
2009-02-17 15:51 ` [PATCH 4/9] scsi: megaraid_sas - Add new controller 0x73(new SAS2) support to the driver Yang, Bo
2009-02-17 16:37 ` [PATCH 5/9] scsi: megaraid_sas - Add memory support required by 0x73 controller Yang, Bo
2009-02-17 17:09 ` [PATCH 6/9] scsi: megaraid_sas - Report the unconfigured PD (system PD) to OS Yang, Bo
2009-02-17 17:21 ` [PATCH 7/9] scsi: megaraid_sas - Resign the Application cmds to 0x73 (new SAS2) controller Yang, Bo
2009-02-17 17:31 ` [PATCH 8/9] scsi: megaraid_sas - Add the IEEE SGL support to the driver Yang, Bo
2009-02-17 17:50 ` [PATCH 9/9] scsi: megaraid_sas - Update the Version and ChangeLog Yang, Bo
2009-02-19 0:38 ` [PATCH 8/9] scsi: megaraid_sas - Add the IEEE SGL support to the driver Andrew Morton
2009-02-19 0:30 ` [PATCH 5/9] scsi: megaraid_sas - Add memory support required by 0x73 controller Andrew Morton
2009-02-19 0:21 ` [PATCH 2/9] scsi: megaraid_sas - Add poll wait support to megaraid sas driver - I Andrew Morton
2009-02-19 13:55 ` Yang, Bo
2009-05-05 23:55 ` [PATCH 1/10] scsi: megaraid_sas - tape drive support fix Yang, Bo
2009-05-06 0:25 ` [PATCH 2/10] scsi: megaraid_sas - Add Poll Wait mechanism to MegaRAID SAS driver (PART-I) Yang, Bo
2009-05-06 0:41 ` [PATCH 3/10] scsi: megaraid_sas - Add Poll Wait mechanism to MegaRAID SAS driver (PART-II) Yang, Bo
2009-05-06 1:11 ` [PATCH 4/10] scsi: megaraid_sas - Add New SAS 2 (iMR) controller support to the driver Yang, Bo
2009-05-06 1:24 ` [PATCH 5/10] scsi: megaraid_sas - Fixed load/unload issue and Fire the system pd DCDB cmd to MegaRAID SAS FW to get the system PDs Yang, Bo
2009-05-06 1:35 ` [PATCH 6/10] scsi: megaraid_sas - Report the Unconfigured PD (system PD) to OS Yang, Bo
2009-05-06 1:43 ` [PATCH 7/10] scsi: megaraid_sas - Re-assign the Cmds to Application for the iMR controller Yang, Bo
2009-05-06 1:52 ` [PATCH 8/10] scsi: megaraid_sas - Driver adds the IEEE SGE format to support SAS 2 controller Yang, Bo
2009-05-06 2:08 ` [PATCH 9/10] scsi: megaraid_sas - Fixed the logic drives deleted and cmds pending in FW issue Yang, Bo
2009-05-06 2:12 ` [PATCH 10/10] scsi: megaraid_sas - Version and Documentation update Yang, Bo
2009-05-06 21:20 ` [PATCH 5/10] scsi: megaraid_sas - Fixed load/unload issue and Fire the system pd DCDB cmd to MegaRAID SAS FW to get the system PDs Andrew Morton
2009-05-07 15:05 ` Yang, Bo
2009-05-06 21:19 ` [PATCH 3/10] scsi: megaraid_sas - Add Poll Wait mechanism to MegaRAID SAS driver (PART-II) Andrew Morton
2009-05-06 21:17 ` [PATCH 2/10] scsi: megaraid_sas - Add Poll Wait mechanism to MegaRAID SAS driver (PART-I) Andrew Morton
2009-05-07 14:56 ` Yang, Bo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1205739403.7479.9.camel@pcp021067pcs.se.lsil.com \
--to=bo.yang@lsi.com \
--cc=James.Bottomley@SteelEye.com \
--cc=Sumant.Patro@lsi.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=neela.kolli@lsi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®