bnx2fc: Replace scsi_dma_map() with dma_map_sg().
Subsystems (2)
PATCH 1/3 bnx2fc: Replace scsi_dma_map() with dma_map_sg().
scsi_dma_map doesn't work for NPIV since vport dev isn't fully initialized.
For more details: http://marc.info/?l=linux-scsi&m=118312448030633&w=2 and commit - c59fd9ebc46da8d48b76955d4d48e3597f8c8726.
Signed-off-by Nithin Sujir <[email protected]>
Signed-off-by Bhanu Prakash Gollapudi <[email protected]>
--- drivers/scsi/bnx2fc/bnx2fc_io.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +4 -1
@@ -1568,6 +1568,8 @@ static int bnx2fc_split_bd(struct bnx2fc_cmd *io_req, u64 addr, int sg_len,static int bnx2fc_map_sg (struct bnx2fc_cmd *io_req) { +struct bnx2fc_interface *interface = io_req->port->priv; +struct bnx2fc_hba *hba = interface->hba;struct scsi_cmnd *sc = io_req->sc_cmd;struct fcoe_bd_ctx *bd = io_req->bd_tbl->bd_tbl;struct scatterlist *sg;
@@ -1579,7 +1581,8 @@ static int bnx2fc_map_sg(struct bnx2fc_cmd *io_req)u64 addr;int i; - sg_count =scsi_dma_map (sc); + sg_count =dma_map_sg (&hba->pcidev->dev,scsi_sglist (sc), +scsi_sg_count (sc), sc->sc_data_direction);scsi_for_each_sg (sc, sg, sg_count, i) { sg_len =sg_dma_len (sg); addr =sg_dma_address (sg);
Signature · 1 line
1.7.0.6
PATCH 2/3 bnx2fc: Handle bnx2fc_map_sg failure
Gracefully handle bnx2fc_map_sg failure, so that queuecommand returns host busy and SCSI-ml can retry the IO.
Signed-off-by Bhanu Prakash Gollapudi <[email protected]>
--- drivers/scsi/bnx2fc/bnx2fc_io.c | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +15 -5
@@ -17,7 +17,7 @@static int bnx2fc_split_bd (struct bnx2fc_cmd *io_req,u64 addr,int sg_len,int bd_index);static int bnx2fc_map_sg (struct bnx2fc_cmd *io_req); -static void bnx2fc_build_bd_list_from_sg (struct bnx2fc_cmd *io_req); +static int bnx2fc_build_bd_list_from_sg (struct bnx2fc_cmd *io_req);static void bnx2fc_unmap_sg_list (struct bnx2fc_cmd *io_req);static void bnx2fc_free_mp_resc (struct bnx2fc_cmd *io_req); static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
@@ -1607,20 +1607,24 @@ static int bnx2fc_map_sg(struct bnx2fc_cmd *io_req)return bd_count; } -static void bnx2fc_build_bd_list_from_sg (struct bnx2fc_cmd *io_req) +static int bnx2fc_build_bd_list_from_sg (struct bnx2fc_cmd *io_req) {struct scsi_cmnd *sc = io_req->sc_cmd;struct fcoe_bd_ctx *bd = io_req->bd_tbl->bd_tbl;int bd_count; -if (scsi_sg_count (sc)) +if (scsi_sg_count (sc)) { bd_count =bnx2fc_map_sg (io_req); -else { +if (bd_count ==0 ) +return -ENOMEM ; + }else { bd_count =0 ; bd[0 ].buf_addr_lo = bd[0 ].buf_addr_hi =0 ; bd[0 ].buf_len = bd[0 ].flags =0 ; } io_req->bd_tbl->bd_valid = bd_count; + +return 0 ; }static void bnx2fc_unmap_sg_list (struct bnx2fc_cmd *io_req)
@@ -1942,7 +1946,13 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, xid = io_req->xid;/* Build buffer descriptor list for firmware from sg list */ -bnx2fc_build_bd_list_from_sg (io_req); +if (bnx2fc_build_bd_list_from_sg (io_req)) { + printk(KERN_ERR PFX "BD list creation failed\n"); +spin_lock_bh (&tgt->tgt_lock); +kref_put (&io_req->refcount, bnx2fc_cmd_release); +spin_unlock_bh (&tgt->tgt_lock); +return -EAGAIN ; + } task_idx = xid /BNX2FC_TASKS_PER_PAGE ; index = xid %BNX2FC_TASKS_PER_PAGE ;
Signature · 1 line
1.7.0.6
PATCH 3/3 bnx2fc: Bumped version to 1.0.7
In reply to Bhanu Prakash GollapudiSigned-off-by Bhanu Prakash Gollapudi <[email protected]>
--- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
@@ -62,7 +62,7 @@#include "bnx2fc_constants.h" #define BNX2FC_NAME "bnx2fc" -#define BNX2FC_VERSION "1.0.6" +#define BNX2FC_VERSION "1.0.7"#define PFX "bnx2fc: "
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -1
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);#define DRV_MODULE_NAME "bnx2fc"#define DRV_MODULE_VERSION BNX2FC_VERSION -#define DRV_MODULE_RELDATE "Aug 30, 2011" +#define DRV_MODULE_RELDATE "Sep 19, 2011" static char version[] __devinitdata =
Signature · 1 line
1.7.0.6