Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89693
b: refs/heads/master
c: d532dbe
h: refs/heads/master
i:
  89691: 6163f0c
v: v3
  • Loading branch information
bo yang authored and James Bottomley committed Apr 7, 2008
1 parent 7849f84 commit ddcbceb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b70a41e077b3405d4b41d34db31b39c05bf142b5
refs/heads/master: d532dbe2cb71586ab520dbef732d1af54a689313
31 changes: 21 additions & 10 deletions trunk/drivers/scsi/megaraid/megaraid_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,13 @@ megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp,

/**
* 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;
Expand All @@ -504,13 +505,22 @@ static u32 megasas_get_frame_count(u8 sge_count)
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;
Expand Down Expand Up @@ -592,7 +602,8 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
* 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;
}
Expand Down Expand Up @@ -709,7 +720,7 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
* 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;
}
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/scsi/megaraid/megaraid_sas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ddcbceb

Please sign in to comment.