From b252f4c7c39cc43c1a34c68951f98d7391a1a103 Mon Sep 17 00:00:00 2001 From: Bhanu Prakash Gollapudi Date: Tue, 26 Jul 2011 14:51:40 -0700 Subject: [SCSI] bnx2fc: Enable REC & CONF support for the session Based on PRLI response, identify if the target is FCP-2 (seq level error recovery) capable, and appropriately set the corresponding CONF, REC flags when offloading the session. Signed-off-by: Bhanu Prakash Gollapudi Signed-off-by: James Bottomley --- drivers/scsi/bnx2fc/bnx2fc.h | 2 ++ drivers/scsi/bnx2fc/bnx2fc_hwi.c | 12 ++++++++++++ drivers/scsi/bnx2fc/bnx2fc_io.c | 3 ++- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 8 ++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h index 6012317c1f2f..d38dcc7f1047 100644 --- a/drivers/scsi/bnx2fc/bnx2fc.h +++ b/drivers/scsi/bnx2fc/bnx2fc.h @@ -244,9 +244,11 @@ struct bnx2fc_rport { struct fc_rport_priv *rdata; void __iomem *ctx_base; #define DPM_TRIGER_TYPE 0x40 + u32 io_timeout; u32 fcoe_conn_id; u32 context_id; u32 sid; + int dev_type; unsigned long flags; #define BNX2FC_FLAG_SESSION_READY 0x1 diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c index ee1674b794b1..fa263b5902e1 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c @@ -279,6 +279,18 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port, ofld_req3.flags |= (((rdata->sp_features & FC_SP_FT_SEQC) ? 1 : 0) << FCOE_KWQE_CONN_OFFLOAD3_B_CONT_INCR_SEQ_CNT_SHIFT); + /* + * Info from PRLI response, this info is used for sequence level error + * recovery support + */ + if (tgt->dev_type == TYPE_TAPE) { + ofld_req3.flags |= 1 << + FCOE_KWQE_CONN_OFFLOAD3_B_CONF_REQ_SHIFT; + ofld_req3.flags |= (((rdata->flags & FC_RP_FLAGS_REC_SUPPORTED) + ? 1 : 0) << + FCOE_KWQE_CONN_OFFLOAD3_B_REC_VALID_SHIFT); + } + /* vlan flag */ ofld_req3.flags |= (interface->vlan_enabled << FCOE_KWQE_CONN_OFFLOAD3_B_VLAN_FLAG_SHIFT); diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index e711ea3dd900..72940b8625bd 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c @@ -1862,7 +1862,8 @@ static int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, } /* Time IO req */ - bnx2fc_cmd_timer_set(io_req, BNX2FC_IO_TIMEOUT); + if (tgt->io_timeout) + bnx2fc_cmd_timer_set(io_req, BNX2FC_IO_TIMEOUT); /* Obtain free SQ entry */ bnx2fc_add_2_sq(tgt, xid); diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c index 263c2678ff62..7eff269d4c41 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c @@ -353,6 +353,14 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt, tgt->rq_cons_idx = 0; atomic_set(&tgt->num_active_ios, 0); + if (rdata->flags & FC_RP_FLAGS_RETRY) { + tgt->dev_type = TYPE_TAPE; + tgt->io_timeout = 0; /* use default ULP timeout */ + } else { + tgt->dev_type = TYPE_DISK; + tgt->io_timeout = BNX2FC_IO_TIMEOUT; + } + /* initialize sq doorbell */ sq_db->header.header = B577XX_DOORBELL_HDR_DB_TYPE; sq_db->header.header |= B577XX_FCOE_CONNECTION_TYPE << -- cgit v1.2.1