RE: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling
Hi James, We have taken care the review comments and re-submitted the patch a while ago. http://marc.info/?l=linux-scsim=135063478232396w=2 Tomas has provided Acked-by to the patch. http://marc.info/?l=linux-scsim=135065706307974w=2 Thanks, Mahesh -Original Message- From: James Bottomley [mailto:jbottom...@parallels.com] Sent: Wednesday, November 14, 2012 12:33 PM To: Tomas Henzl Cc: Mahesh Rajashekhara; linux-scsi@vger.kernel.org; aacr...@pmc-sierra.com; Achim Leubner; Tony Ruiz Subject: Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling On Tue, 2012-10-16 at 23:34 +0200, Tomas Henzl wrote: On 10/16/2012 10:59 PM, Mahesh Rajashekhara wrote: This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). This patch is created against current upstream kernel. Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 63 +++- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..efa2900 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -971,6 +971,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + unsigned long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +983,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; Hi Mahesh, 'ret' is 'unsigned', the above test will not work. Tomas Ping on this please Mahesh? The criticism seems completely valid to me. James N�r��yb�X��ǧv�^�){.n�+{{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj��!�i
Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling
On Tue, 2012-10-16 at 23:34 +0200, Tomas Henzl wrote: On 10/16/2012 10:59 PM, Mahesh Rajashekhara wrote: This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). This patch is created against current upstream kernel. Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 63 +++- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..efa2900 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -971,6 +971,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + unsigned long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +983,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; Hi Mahesh, 'ret' is 'unsigned', the above test will not work. Tomas Ping on this please Mahesh? The criticism seems completely valid to me. James N�r��yb�X��ǧv�^�){.n�+{{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj��!�i
RE: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling
Hello James, Can you please let us know the status of this patch. Can we get a sign-off/approval of this patch. Thanks, Mahesh -Original Message- From: Tomas Henzl [mailto:the...@redhat.com] Sent: Friday, October 19, 2012 8:00 PM To: Mahesh Rajashekhara Cc: jbottom...@parallels.com; linux-scsi@vger.kernel.org; aacr...@pmc-sierra.com; Achim Leubner; Tony Ruiz Subject: Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling On 10/19/2012 03:51 PM, Mahesh Rajashekhara wrote: Hi James, We've incorporated the changes suggested by Tomas in this driver patch. I would request you to please consider this patch. Please let us know your comments if any. Patch Description: This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com Acked-by: Tomas Henzl the...@redhat.com Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] aacraid: SCSI dma mapping failure case handling
Hi James, We've incorporated the changes suggested by Tomas in this driver patch. I would request you to please consider this patch. Please let us know your comments if any. Patch Description: This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 87 +-- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..681434e 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -132,11 +132,13 @@ struct inquiry_data { * M O D U L E G L O B A L S */ -static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); -static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); -static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); -static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max); -static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new); +static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap); +static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg); +static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg); +static long aac_build_sgraw2(struct scsi_cmnd *scsicmd, + struct aac_raw_io2 *rio2, int sg_max); +static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, + int pages, int nseg, int nseg_new); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); #ifdef AAC_DETAILED_STATUS_INFO static char *aac_get_status_string(u32 status); @@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd-flags = cpu_to_le16(RIO_TYPE_READ); readcmd-bpTotal = 0; readcmd-bpComplete = 0; - aac_build_sgraw(cmd, readcmd-sg); + ret = aac_build_sgraw(cmd, readcmd-sg); + if (ret 0) + return ret; command = ContainerRawIo; fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct sgentryraw)); @@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { u16 fibsize; struct aac_read64 *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read64 *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtHostRead64); @@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u readcmd-pad = 0; readcmd-flags = 0; - aac_build_sg64(cmd, readcmd-sg); + ret = aac_build_sg64(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry64)); @@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 { u16 fibsize; struct aac_read *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtBlockRead); @@ -1057,7 +1071,9 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 readcmd-block = cpu_to_le32((u32)(lba0x)); readcmd-count = cpu_to_le32(count * 512); - aac_build_sg(cmd, readcmd-sg); + ret = aac_build_sg(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize =
Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling
On 10/19/2012 03:51 PM, Mahesh Rajashekhara wrote: Hi James, We've incorporated the changes suggested by Tomas in this driver patch. I would request you to please consider this patch. Please let us know your comments if any. Patch Description: This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com Acked-by: Tomas Henzl the...@redhat.com Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] aacraid: SCSI dma mapping failure case handling
From: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com Hi Tomas, Thanks for the correction. I have changed 'ret' is of type 'long' now. Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 87 +-- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..681434e 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -132,11 +132,13 @@ struct inquiry_data { * M O D U L E G L O B A L S */ -static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); -static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); -static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); -static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max); -static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new); +static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap); +static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg); +static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg); +static long aac_build_sgraw2(struct scsi_cmnd *scsicmd, + struct aac_raw_io2 *rio2, int sg_max); +static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, + int pages, int nseg, int nseg_new); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); #ifdef AAC_DETAILED_STATUS_INFO static char *aac_get_status_string(u32 status); @@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd-flags = cpu_to_le16(RIO_TYPE_READ); readcmd-bpTotal = 0; readcmd-bpComplete = 0; - aac_build_sgraw(cmd, readcmd-sg); + ret = aac_build_sgraw(cmd, readcmd-sg); + if (ret 0) + return ret; command = ContainerRawIo; fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct sgentryraw)); @@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { u16 fibsize; struct aac_read64 *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read64 *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtHostRead64); @@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u readcmd-pad = 0; readcmd-flags = 0; - aac_build_sg64(cmd, readcmd-sg); + ret = aac_build_sg64(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry64)); @@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 { u16 fibsize; struct aac_read *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtBlockRead); @@ -1057,7 +1071,9 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 readcmd-block = cpu_to_le32((u32)(lba0x)); readcmd-count = cpu_to_le32(count * 512); - aac_build_sg(cmd, readcmd-sg); + ret = aac_build_sg(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry)); @@ -1079,6 +1095,7 @@ static
Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling
On 10/17/2012 06:15 PM, Mahesh Rajashekhara wrote: From: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com Hi Tomas, Thanks for the correction. I have changed 'ret' is of type 'long' now. I think that more than that is needed, all the aac_build_... functions prototypes are declared as of type 'unsigned long' and they return 'byte_count' which again is 'unsigned'. Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 87 +-- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..681434e 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -132,11 +132,13 @@ struct inquiry_data { * M O D U L E G L O B A L S */ -static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); -static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); -static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); -static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max); -static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new); +static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap); +static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg); +static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg); +static long aac_build_sgraw2(struct scsi_cmnd *scsicmd, + struct aac_raw_io2 *rio2, int sg_max); +static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, + int pages, int nseg, int nseg_new); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); #ifdef AAC_DETAILED_STATUS_INFO static char *aac_get_status_string(u32 status); @@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd-flags = cpu_to_le16(RIO_TYPE_READ); readcmd-bpTotal = 0; readcmd-bpComplete = 0; - aac_build_sgraw(cmd, readcmd-sg); + ret = aac_build_sgraw(cmd, readcmd-sg); + if (ret 0) + return ret; command = ContainerRawIo; fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct sgentryraw)); @@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { u16 fibsize; struct aac_read64 *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read64 *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtHostRead64); @@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u readcmd-pad = 0; readcmd-flags = 0; - aac_build_sg64(cmd, readcmd-sg); + ret = aac_build_sg64(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry64)); @@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 { u16 fibsize; struct aac_read *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtBlockRead); @@ -1057,7 +1071,9 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 readcmd-block = cpu_to_le32((u32)(lba0x)); readcmd-count = cpu_to_le32(count * 512); - aac_build_sg(cmd, readcmd-sg); + ret = aac_build_sg(cmd,
[PATCH 1/1] aacraid: SCSI dma mapping failure case handling
I have changed all aac_build_... function prototypes as of type 'long' and they return 'byte_count' is of type 'long'. Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 95 --- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 69 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..0371f80 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -132,11 +132,13 @@ struct inquiry_data { * M O D U L E G L O B A L S */ -static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); -static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); -static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); -static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max); -static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new); +static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap); +static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg); +static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg); +static long aac_build_sgraw2(struct scsi_cmnd *scsicmd, + struct aac_raw_io2 *rio2, int sg_max); +static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, + int pages, int nseg, int nseg_new); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); #ifdef AAC_DETAILED_STATUS_INFO static char *aac_get_status_string(u32 status); @@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd-flags = cpu_to_le16(RIO_TYPE_READ); readcmd-bpTotal = 0; readcmd-bpComplete = 0; - aac_build_sgraw(cmd, readcmd-sg); + ret = aac_build_sgraw(cmd, readcmd-sg); + if (ret 0) + return ret; command = ContainerRawIo; fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct sgentryraw)); @@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { u16 fibsize; struct aac_read64 *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read64 *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtHostRead64); @@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u readcmd-pad = 0; readcmd-flags = 0; - aac_build_sg64(cmd, readcmd-sg); + ret = aac_build_sg64(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry64)); @@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 { u16 fibsize; struct aac_read *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtBlockRead); @@ -1057,7 +1071,9 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 readcmd-block = cpu_to_le32((u32)(lba0x)); readcmd-count = cpu_to_le32(count * 512); - aac_build_sg(cmd, readcmd-sg); + ret = aac_build_sg(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry)); @@ -1079,6 +1095,7 @@ static int
Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling
On 10/17/2012 07:54 PM, Mahesh Rajashekhara wrote: I have changed all aac_build_... function prototypes as of type 'long' and they return 'byte_count' is of type 'long'. The code changed, it returns 'nseg' in case of an error, so the change from unsigned to signed for byte_count was likely not needed. I'm sorry, I haven't noticed that sooner. The change of the function prototypes is welcomed. Maybe you could reconsider reusing the patch description you used in the V1 of your patch. This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). instead of what is in the message body now. Maybe James can handle this without reposting a new patch. Thanks Tomas Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 95 --- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 69 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..0371f80 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -132,11 +132,13 @@ struct inquiry_data { * M O D U L E G L O B A L S */ -static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); -static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); -static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); -static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct aac_raw_io2 *rio2, int sg_max); -static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int nseg_new); +static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap); +static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg); +static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg); +static long aac_build_sgraw2(struct scsi_cmnd *scsicmd, + struct aac_raw_io2 *rio2, int sg_max); +static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, + int pages, int nseg, int nseg_new); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); #ifdef AAC_DETAILED_STATUS_INFO static char *aac_get_status_string(u32 status); @@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd-flags = cpu_to_le16(RIO_TYPE_READ); readcmd-bpTotal = 0; readcmd-bpComplete = 0; - aac_build_sgraw(cmd, readcmd-sg); + ret = aac_build_sgraw(cmd, readcmd-sg); + if (ret 0) + return ret; command = ContainerRawIo; fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct sgentryraw)); @@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { u16 fibsize; struct aac_read64 *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read64 *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtHostRead64); @@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u readcmd-pad = 0; readcmd-flags = 0; - aac_build_sg64(cmd, readcmd-sg); + ret = aac_build_sg64(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry64)); @@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 { u16 fibsize; struct aac_read *readcmd; + long ret; + aac_fib_init(fib); readcmd = (struct aac_read *) fib_data(fib);
[PATCH 1/1] aacraid: SCSI dma mapping failure case handling
This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). This patch is created against current upstream kernel. Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 63 +++- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..efa2900 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -971,6 +971,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + unsigned long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +983,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -996,7 +1000,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd-flags = cpu_to_le16(RIO_TYPE_READ); readcmd-bpTotal = 0; readcmd-bpComplete = 0; - aac_build_sgraw(cmd, readcmd-sg); + ret = aac_build_sgraw(cmd, readcmd-sg); + if (ret 0) + return ret; command = ContainerRawIo; fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct sgentryraw)); @@ -1019,6 +1025,7 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { u16 fibsize; struct aac_read64 *readcmd; + unsigned long ret; aac_fib_init(fib); readcmd = (struct aac_read64 *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtHostRead64); @@ -1028,7 +1035,9 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u readcmd-pad = 0; readcmd-flags = 0; - aac_build_sg64(cmd, readcmd-sg); + ret = aac_build_sg64(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry64)); @@ -1050,6 +1059,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 { u16 fibsize; struct aac_read *readcmd; + unsigned long ret; + aac_fib_init(fib); readcmd = (struct aac_read *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtBlockRead); @@ -1057,7 +1068,9 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 readcmd-block = cpu_to_le32((u32)(lba0x)); readcmd-count = cpu_to_le32(count * 512); - aac_build_sg(cmd, readcmd-sg); + ret = aac_build_sg(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry)); @@ -1079,6 +1092,7 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { struct aac_dev *dev = fib-dev; u16 fibsize, command; + unsigned long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -1093,7 +1107,10 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u (((aac_cache 5) != 5) || !fib-dev-cache_protected)) ? cpu_to_le16(RIO2_IO_TYPE_WRITE|RIO2_IO_SUREWRITE) : cpu_to_le16(RIO2_IO_TYPE_WRITE); - aac_build_sgraw2(cmd, writecmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, writecmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(writecmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -1110,7 +1127,9 @@ static int
Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling
On 10/16/2012 10:59 PM, Mahesh Rajashekhara wrote: This patch handles SCSI dma mapping failure case. Reporting error code to the upper layer instead of BUG_ON(). This patch is created against current upstream kernel. Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com --- drivers/scsi/aacraid/aachba.c | 63 +++- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index d79457a..efa2900 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -971,6 +971,7 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 { struct aac_dev *dev = fib-dev; u16 fibsize, command; + unsigned long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -982,7 +983,10 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd2-byteCount = cpu_to_le32(count9); readcmd2-cid = cpu_to_le16(scmd_id(cmd)); readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ); - aac_build_sgraw2(cmd, readcmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, readcmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; Hi Mahesh, 'ret' is 'unsigned', the above test will not work. Tomas command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) + ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct sge_ieee1212)); @@ -996,7 +1000,9 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 readcmd-flags = cpu_to_le16(RIO_TYPE_READ); readcmd-bpTotal = 0; readcmd-bpComplete = 0; - aac_build_sgraw(cmd, readcmd-sg); + ret = aac_build_sgraw(cmd, readcmd-sg); + if (ret 0) + return ret; command = ContainerRawIo; fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct sgentryraw)); @@ -1019,6 +1025,7 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { u16 fibsize; struct aac_read64 *readcmd; + unsigned long ret; aac_fib_init(fib); readcmd = (struct aac_read64 *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtHostRead64); @@ -1028,7 +1035,9 @@ static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u readcmd-pad = 0; readcmd-flags = 0; - aac_build_sg64(cmd, readcmd-sg); + ret = aac_build_sg64(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry64)); @@ -1050,6 +1059,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 { u16 fibsize; struct aac_read *readcmd; + unsigned long ret; + aac_fib_init(fib); readcmd = (struct aac_read *) fib_data(fib); readcmd-command = cpu_to_le32(VM_CtBlockRead); @@ -1057,7 +1068,9 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 readcmd-block = cpu_to_le32((u32)(lba0x)); readcmd-count = cpu_to_le32(count * 512); - aac_build_sg(cmd, readcmd-sg); + ret = aac_build_sg(cmd, readcmd-sg); + if (ret 0) + return ret; fibsize = sizeof(struct aac_read) + ((le32_to_cpu(readcmd-sg.count) - 1) * sizeof (struct sgentry)); @@ -1079,6 +1092,7 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u { struct aac_dev *dev = fib-dev; u16 fibsize, command; + unsigned long ret; aac_fib_init(fib); if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2 !dev-sync_mode) { @@ -1093,7 +1107,10 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u (((aac_cache 5) != 5) || !fib-dev-cache_protected)) ? cpu_to_le16(RIO2_IO_TYPE_WRITE|RIO2_IO_SUREWRITE) : cpu_to_le16(RIO2_IO_TYPE_WRITE); - aac_build_sgraw2(cmd, writecmd2, dev-scsi_host_ptr-sg_tablesize); + ret = aac_build_sgraw2(cmd, writecmd2, + dev-scsi_host_ptr-sg_tablesize); + if (ret 0) + return ret; command = ContainerRawIo2; fibsize = sizeof(struct aac_raw_io2) +