aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2fc/bnx2fc_io.c
diff options
context:
space:
mode:
authorSaurav Kashyap <skashyap@marvell.com>2019-06-24 01:29:59 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2019-06-26 22:42:45 -0400
commit3c97b569505f0d467a7fd544b05f1e122c08db67 (patch)
tree7d3192697e0e99e6ce59a7b52c50f7d5524e440a /drivers/scsi/bnx2fc/bnx2fc_io.c
parentscsi: bnx2fc: Do not allow both a cleanup completion and abort completion for the same request (diff)
downloadlinux-dev-3c97b569505f0d467a7fd544b05f1e122c08db67.tar.xz
linux-dev-3c97b569505f0d467a7fd544b05f1e122c08db67.zip
scsi: bnx2fc: Limit the IO size according to the FW capability
- Reduce the sg_tablesize to 255. - Reduce the MAX BDs firmware can handle to 255. - Return IO to ML if BD goes more then 255 after split. - Correct the size of each BD split to 0xffff. Signed-off-by: Saurav Kashyap <skashyap@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to '')
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index d7eb5e16efd3..9e50e5b53763 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1660,6 +1660,7 @@ static int bnx2fc_map_sg(struct bnx2fc_cmd *io_req)
u64 addr;
int i;
+ WARN_ON(scsi_sg_count(sc) > BNX2FC_MAX_BDS_PER_CMD);
/*
* Use dma_map_sg directly to ensure we're using the correct
* dev struct off of pcidev.
@@ -1707,6 +1708,16 @@ static int bnx2fc_build_bd_list_from_sg(struct bnx2fc_cmd *io_req)
}
io_req->bd_tbl->bd_valid = bd_count;
+ /*
+ * Return the command to ML if BD count exceeds the max number
+ * that can be handled by FW.
+ */
+ if (bd_count > BNX2FC_FW_MAX_BDS_PER_CMD) {
+ pr_err("bd_count = %d exceeded FW supported max BD(255), task_id = 0x%x\n",
+ bd_count, io_req->xid);
+ return -ENOMEM;
+ }
+
return 0;
}