[PATCH v2] scsi: bfa: Increase requested firmware version to 3.2.5.1
bna & bfa firmware version 3.2.5.1 was submitted to linux-firmware on Feb 17 19:10:20 2015 -0500 in 0ab54ff1dc ("linux-firmware: Add QLogic BR Series Adapter Firmware"). bna was updated to use the newer firmware on Feb 19 16:02:32 2015 -0500 in 3f307c3d70 ("bna: Update the Driver and Firmware Version") bfa was not updated. I presume this was an oversight but it broke support for bfa+bna cards such as the following 04:00.0 Fibre Channel [0c04]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) 04:00.1 Fibre Channel [0c04]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) 04:00.2 Ethernet controller [0200]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) 04:00.3 Ethernet controller [0200]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) Currently, if the bfa module is loaded first, bna fails to probe the respective devices with [ 215.026787] bna: QLogic BR-series 10G Ethernet driver - version: 3.2.25.1 [ 215.043707] bna :04:00.2: bar0 mapped to c90001fc, len 262144 [ 215.060656] bna :04:00.2: initialization failed err=1 [ 215.073893] bna :04:00.3: bar0 mapped to c9000204, len 262144 [ 215.090644] bna :04:00.3: initialization failed err=1 Whereas if bna is loaded first, bfa fails with [ 249.592109] QLogic BR-series BFA FC/FCOE SCSI driver - version: 3.2.25.0 [ 249.610738] bfa :04:00.0: Running firmware version is incompatible with the driver version [ 249.833513] bfa :04:00.0: bfa init failed [ 249.833919] scsi host6: QLogic BR-series FC/FCOE Adapter, hwpath: :04:00.0 driver: 3.2.25.0 [ 249.841446] bfa :04:00.1: Running firmware version is incompatible with the driver version [ 250.045449] bfa :04:00.1: bfa init failed [ 250.045962] scsi host7: QLogic BR-series FC/FCOE Adapter, hwpath: :04:00.1 driver: 3.2.25.0 Increase bfa's requested firmware version. Also increase the driver version. I only tested that all of the devices probe without error. Reported-by: Tim EhlersSigned-off-by: Benjamin Poirier Acked-by: Rasesh Mody --- drivers/scsi/bfa/bfad.c | 6 +++--- drivers/scsi/bfa/bfad_drv.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) Changes v1-v2: Also increase the driver version diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 9d253cb..e70410b 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -64,9 +64,9 @@ int max_rport_logins = BFA_FCS_MAX_RPORT_LOGINS; u32bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size; u32*bfi_image_cb, *bfi_image_ct, *bfi_image_ct2; -#define BFAD_FW_FILE_CB"cbfw-3.2.3.0.bin" -#define BFAD_FW_FILE_CT"ctfw-3.2.3.0.bin" -#define BFAD_FW_FILE_CT2 "ct2fw-3.2.3.0.bin" +#define BFAD_FW_FILE_CB"cbfw-3.2.5.1.bin" +#define BFAD_FW_FILE_CT"ctfw-3.2.5.1.bin" +#define BFAD_FW_FILE_CT2 "ct2fw-3.2.5.1.bin" static u32 *bfad_load_fwimg(struct pci_dev *pdev); static void bfad_free_fwimg(void); diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index f9e8620..cfcfff4 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h @@ -58,7 +58,7 @@ #ifdef BFA_DRIVER_VERSION #define BFAD_DRIVER_VERSIONBFA_DRIVER_VERSION #else -#define BFAD_DRIVER_VERSION"3.2.25.0" +#define BFAD_DRIVER_VERSION"3.2.25.1" #endif #define BFAD_PROTO_NAME FCPI_NAME -- 2.10.2 -- 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 00/11] qla2xxx: Feature updates for target.
Hi Bart, Christoph, We have added new features to the qla2xxx target driver. This patch series enables simultaneous initiator and target mode in the driver. As part of supporting simultaneous initator and target mode we also improved Fabric discovery which relies heavily on newly added dual mode code. We also have improved RSCN handling in fabric mode. To support simplified fabric discovery we restructured I-T nexus into single fc_port struct, so that we can manage fc_port more efficiently in the driver, while operating in an initator, target or dual mode. Asynchronous fabric discovery patch also prepared code for simultaneous intiator and target mode enablement in the driver. Also with addition of dual mode support, I have added a seperate patch which cleans up unused reverse_ini_mode(). SRR related code cleanup was submitted earlier as part of another patch. I have now split SRR cleanup into patch by itself and have included here for cosiderations. Trace readabilty improvement is a small subset which was missed in earlier bug-fixes patch series. I've included that as part of this series. This patch series is based on the earlier bug-fixes series that I posted today. Here's link for that series http://marc.info/?l=linux-scsi=148254518825278=2 Please consider this series for target-pending. Thanks, Himanshu Himanshu Madhani (2): qla2xxx: Cleanup SRR code. qla2xxx: Remove unused reverse_ini_mode. Quinn Tran (9): qla2xxx: Remove direct access of scsi_status field in se_cmd qla2xxx: Cleanup TMF code translation from qla_target. qla2xxx: Make trace flags more readable. qla2xxx: Fix wrong argument in sp done callback. qla2xxx: Use d_id instead of s_id for more clarity. qla2xxx: Track I-T nexus as single fc_port struct. qla2xxx: Add framework for Async fabric discovery. qla2xxx: Add Dual mode support in the driver qla2xxx: Improve RSCN handling in driver drivers/scsi/qla2xxx/qla_attr.c|3 + drivers/scsi/qla2xxx/qla_def.h | 221 +++- drivers/scsi/qla2xxx/qla_dfs.c | 10 +- drivers/scsi/qla2xxx/qla_fw.h | 90 +- drivers/scsi/qla2xxx/qla_gbl.h | 58 +- drivers/scsi/qla2xxx/qla_gs.c | 726 +-- drivers/scsi/qla2xxx/qla_init.c| 1547 +-- drivers/scsi/qla2xxx/qla_inline.h |7 +- drivers/scsi/qla2xxx/qla_iocb.c| 73 +- drivers/scsi/qla2xxx/qla_isr.c | 290 +++-- drivers/scsi/qla2xxx/qla_mbx.c | 214 ++-- drivers/scsi/qla2xxx/qla_mr.c |6 +- drivers/scsi/qla2xxx/qla_os.c | 296 +++-- drivers/scsi/qla2xxx/qla_target.c | 2359 +--- drivers/scsi/qla2xxx/qla_target.h | 176 +-- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 238 ++-- drivers/scsi/qla2xxx/tcm_qla2xxx.h |4 +- 17 files changed, 4042 insertions(+), 2276 deletions(-) -- 1.8.3.1 -- 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 06/11] qla2xxx: Use d_id instead of s_id for more clarity.
From: Quinn TranUpdated code with d_id from s_id for better readabilty and clarity. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dfs.c | 6 +++--- drivers/scsi/qla2xxx/qla_target.c | 24 drivers/scsi/qla2xxx/qla_target.h | 2 +- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 32 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 34272fd..46697de 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -28,9 +28,9 @@ spin_lock_irqsave(>tgt.sess_lock, flags); list_for_each_entry(sess, >sess_list, sess_list_entry) { seq_printf(s, "%02x:%02x:%02x %8phC %d\n", - sess->s_id.b.domain,sess->s_id.b.area, - sess->s_id.b.al_pa, sess->port_name, - sess->loop_id); + sess->d_id.b.domain,sess->d_id.b.area, + sess->d_id.b.al_pa,sess->port_name, + sess->loop_id); } spin_unlock_irqrestore(>tgt.sess_lock, flags); } diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 8a10f93..890c53b 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -530,7 +530,7 @@ static void qlt_free_session_done(struct work_struct *work) "%s: se_sess %p / sess %p from port %8phC loop_id %#04x" " s_id %02x:%02x:%02x logout %d keep %d els_logo %d\n", __func__, sess->se_sess, sess, sess->port_name, sess->loop_id, - sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa, + sess->d_id.b.domain, sess->d_id.b.area, sess->d_id.b.al_pa, sess->logout_on_delete, sess->keep_nport_handle, sess->send_els_logo); @@ -538,7 +538,7 @@ static void qlt_free_session_done(struct work_struct *work) if (sess->send_els_logo) { qlt_port_logo_t logo; - logo.id = sess->s_id; + logo.id = sess->d_id; logo.cmd_count = 0; qlt_send_first_logo(vha, ); } @@ -548,7 +548,7 @@ static void qlt_free_session_done(struct work_struct *work) memset(, 0, sizeof(fcport)); fcport.loop_id = sess->loop_id; - fcport.d_id = sess->s_id; + fcport.d_id = sess->d_id; memcpy(fcport.port_name, sess->port_name, WWN_SIZE); fcport.vha = vha; fcport.tgt_session = sess; @@ -757,7 +757,7 @@ static void qlt_schedule_sess_for_deletion(struct qla_tgt_sess *sess, "qla_target(%d): session for port %8phC (loop ID %d s_id %02x:%02x:%02x)" " scheduled for deletion in %u secs (expires: %lu) immed: %d, logout: %d, gen: %#x\n", sess->vha->vp_idx, sess->port_name, sess->loop_id, - sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa, + sess->d_id.b.domain, sess->d_id.b.area, sess->d_id.b.al_pa, dev_loss_tmo, sess->expires, immediate, sess->logout_on_delete, sess->generation); @@ -892,8 +892,8 @@ static struct qla_tgt_sess *qlt_create_sess( ql_dbg(ql_dbg_tgt_mgt, vha, 0xf005, "Double sess %p found (s_id %x:%x:%x, " "loop_id %d), updating to d_id %x:%x:%x, " - "loop_id %d", sess, sess->s_id.b.domain, - sess->s_id.b.al_pa, sess->s_id.b.area, + "loop_id %d", sess, sess->d_id.b.domain, + sess->d_id.b.al_pa, sess->d_id.b.area, sess->loop_id, fcport->d_id.b.domain, fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); @@ -943,7 +943,7 @@ static struct qla_tgt_sess *qlt_create_sess( } sess->tgt = vha->vha_tgt.qla_tgt; sess->vha = vha; - sess->s_id = fcport->d_id; + sess->d_id = fcport->d_id; sess->loop_id = fcport->loop_id; sess->local = local; kref_init(>sess_kref); @@ -974,8 +974,8 @@ static struct qla_tgt_sess *qlt_create_sess( "qla_target(%d): %ssession for wwn %8phC (loop_id %d, " "s_id %x:%x:%x, confirmed completion %ssupported) added\n", vha->vp_idx, local ? "local " : "", fcport->port_name, - fcport->loop_id, sess->s_id.b.domain, sess->s_id.b.area, - sess->s_id.b.al_pa, sess->conf_compl_supported ? "" : "not "); + fcport->loop_id, sess->d_id.b.domain,
[PATCH 07/11] qla2xxx: Track I-T nexus as single fc_port struct.
From: Quinn TranCurrent code merges qla_tgt_sess and fc_port structure into single fc_port structure represeting same I-T nexus. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 32 drivers/scsi/qla2xxx/qla_dfs.c | 4 +- drivers/scsi/qla2xxx/qla_init.c| 12 -- drivers/scsi/qla2xxx/qla_iocb.c| 2 +- drivers/scsi/qla2xxx/qla_target.c | 317 - drivers/scsi/qla2xxx/qla_target.h | 72 ++--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 130 --- drivers/scsi/qla2xxx/tcm_qla2xxx.h | 4 +- 8 files changed, 227 insertions(+), 346 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 1196150..4e88c85 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2035,6 +2035,19 @@ struct mbx_entry { FCT_TARGET } fc_port_type_t; +typedef enum { + QLT_PLOGI_LINK_SAME_WWN, + QLT_PLOGI_LINK_CONFLICT, + QLT_PLOGI_LINK_MAX +} qlt_plogi_link_t; + +typedef struct { + struct list_headlist; + u8 iocb[64]; /* imm_ntfy_from_isp */ + port_id_t id; + int ref_count; +} qlt_plogi_ack_t; + /* * Fibre channel port structure. */ @@ -2048,6 +2061,25 @@ struct mbx_entry { uint16_t loop_id; uint16_t old_loop_id; + unsigned int conf_compl_supported:1; + unsigned int deleted:2; + unsigned int local:1; + unsigned int logout_on_delete:1; + unsigned int keep_nport_handle:1; + unsigned int send_els_logo:1; + + unsigned char logout_completed; + int generation; + + struct se_session *se_sess; + struct kref sess_kref; + struct qla_tgt *tgt; + unsigned long expires; + struct list_head del_list_entry; + struct work_struct free_work; + + qlt_plogi_ack_t* plogi_link[QLT_PLOGI_LINK_MAX]; + uint16_t tgt_id; uint16_t old_tgt_id; diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 46697de..c54d5e8 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -18,7 +18,7 @@ scsi_qla_host_t *vha = s->private; struct qla_hw_data *ha = vha->hw; unsigned long flags; - struct qla_tgt_sess *sess = NULL; + struct fc_port *sess = NULL; struct qla_tgt *tgt= vha->vha_tgt.qla_tgt; seq_printf(s, "%s\n",vha->host_str); @@ -26,7 +26,7 @@ seq_printf(s, "Port ID Port NameHandle\n"); spin_lock_irqsave(>tgt.sess_lock, flags); - list_for_each_entry(sess, >sess_list, sess_list_entry) { + list_for_each_entry(sess, >vp_fcports, list) { seq_printf(s, "%02x:%02x:%02x %8phC %d\n", sess->d_id.b.domain,sess->d_id.b.area, sess->d_id.b.al_pa,sess->port_name, diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 7b6317c..5978b79 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3352,12 +3352,6 @@ static void qla2xxx_nvram_wwn_from_ofw(scsi_qla_host_t *vha, nvram_t *nv) "Unable to allocate fc remote port.\n"); return; } - /* -* Create target mode FC NEXUS in qla_target.c if target mode is -* enabled.. -*/ - - qlt_fc_port_added(vha, fcport); spin_lock_irqsave(fcport->vha->host->host_lock, flags); *((fc_port_t **)rport->dd_data) = fcport; @@ -3407,12 +3401,6 @@ static void qla2xxx_nvram_wwn_from_ofw(scsi_qla_host_t *vha, nvram_t *nv) reg_port: if (qla_ini_mode_enabled(vha)) qla2x00_reg_remote_port(vha, fcport); - else { - /* -* Create target mode FC NEXUS in qla_target.c -*/ - qlt_fc_port_added(vha, fcport); - } } /* diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 58e49a3..834e221 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2248,7 +2248,7 @@ struct fw_dif_context { logio->control_flags = cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO); if (!sp->fcport->tgt_session || - !sp->fcport->tgt_session->keep_nport_handle) + !sp->fcport->keep_nport_handle) logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT); logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); logio->port_id[0] = sp->fcport->d_id.b.al_pa; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 890c53b..4c71856 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -102,7 +102,7 @@
[PATCH 11/11] qla2xxx: Improve RSCN handling in driver
From: Quinn TranCurrent code blindly does State Change Registration when the link is up. Move SCR behind fabric scan, so that arbitrated loop scan would not get erroneous error message. Some of the other improvements are as follows - Add session deletion for TPRLO and send acknowledgement for TPRLO. - Enable FW option to move ABTS, RIDA & PUREX from RSPQ to ATIOQ. - Save NPort ID early in link init. - Move ABTS & RIDA to ATIOQ helps in keeping command ordering and link up sequence ordering. - Save Nport ID and update VP map so that SCSI CMD/ATIO won't be dropped. - fcport alloc does the initializes memory to zero. Remove memset to zero since It might corrupt link list. - Turn off Registration for State Change MB in loop mode. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h| 11 +- drivers/scsi/qla2xxx/qla_fw.h | 59 +++--- drivers/scsi/qla2xxx/qla_gbl.h| 2 + drivers/scsi/qla2xxx/qla_gs.c | 4 +- drivers/scsi/qla2xxx/qla_init.c | 147 +++- drivers/scsi/qla2xxx/qla_isr.c| 4 - drivers/scsi/qla2xxx/qla_mbx.c| 126 + drivers/scsi/qla2xxx/qla_os.c | 48 drivers/scsi/qla2xxx/qla_target.c | 228 ++ 9 files changed, 490 insertions(+), 139 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index d85066f..9828fe7 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2148,6 +2148,13 @@ enum fcport_mgt_event { FCME_DELETE_DONE, }; +enum rscn_addr_format { + RSCN_PORT_ADDR, + RSCN_AREA_ADDR, + RSCN_DOM_ADDR, + RSCN_FAB_ADDR, +}; + /* * Fibre channel port structure. */ @@ -3879,7 +3886,7 @@ struct qla_tgt_counters { #define FCOE_CTX_RESET_NEEDED 18 /* Initiate FCoE context reset */ #define MPI_RESET_NEEDED 19 /* Initiate MPI FW reset */ #define ISP_QUIESCE_NEEDED 20 /* Driver need some quiescence */ -#define SCR_PENDING21 /* SCR in target mode */ +#define FREE_BIT 21 #define PORT_UPDATE_NEEDED 22 #define FX00_RESET_RECOVERY23 #define FX00_TARGET_SCAN 24 @@ -3933,7 +3940,9 @@ struct qla_tgt_counters { /* list of commands waiting on workqueue */ struct list_headqla_cmd_list; struct list_headqla_sess_op_cmd_list; + struct list_head unknown_atio_list; spinlock_t cmd_list_lock; + struct delayed_work unknown_atio_work; /* Counter to detect races between ELS and RSCN events */ atomic_tgeneration_tick; diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index ee135cf..24606d6 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -1301,27 +1301,60 @@ struct vp_config_entry_24xx { }; #define VP_RPT_ID_IOCB_TYPE0x32/* Report ID Acquisition entry. */ +enum VP_STATUS { + VP_STAT_COMPL, + VP_STAT_FAIL, + VP_STAT_ID_CHG, + VP_STAT_SNS_TO, /* timeout */ + VP_STAT_SNS_RJT, + VP_STAT_SCR_TO, /* timeout */ + VP_STAT_SCR_RJT, +}; + +enum VP_FLAGS { + VP_FLAGS_CON_FLOOP = 1, + VP_FLAGS_CON_P2P = 2, + VP_FLAGS_CON_FABRIC = 3, + VP_FLAGS_NAME_VALID = BIT_5, +}; + struct vp_rpt_id_entry_24xx { uint8_t entry_type; /* Entry type. */ uint8_t entry_count;/* Entry count. */ uint8_t sys_define; /* System defined. */ uint8_t entry_status; /* Entry Status. */ - - uint32_t handle;/* System handle. */ - - uint16_t vp_count; /* Format 0 -- | VP setup | VP acq |. */ - /* Format 1 -- | VP count |. */ - uint16_t vp_idx;/* Format 0 -- Reserved. */ - /* Format 1 -- VP status and index. */ + uint32_t resv1; + uint8_t vp_acquired; + uint8_t vp_setup; + uint8_t vp_idx; /* Format 0=reserved */ + uint8_t vp_status; /* Format 0=reserved */ uint8_t port_id[3]; uint8_t format; - - uint8_t vp_idx_map[16]; - - uint8_t reserved_4[24]; - uint16_t bbcr; - uint8_t reserved_5[6]; + union { + struct { + /* format 0 loop */ + uint8_t vp_idx_map[16]; + uint8_t reserved_4[32]; + } f0; + struct { + /* format 1 fabric */ + uint8_t vpstat1_subcode;/* vp_status=1 subcode */ + uint8_t flags; + uint16_t fip_flags; + uint8_t rsv2[12]; + +
[PATCH 10/11] qla2xxx: Remove unused reverse_ini_mode.
With support for dual mode in the driver, this mode becomes dead code. Remove reverse_ini_mode from code. Signed-off-by: Himanshu Madhani--- drivers/scsi/qla2xxx/qla_def.h| 1 - drivers/scsi/qla2xxx/qla_target.c | 10 -- drivers/scsi/qla2xxx/qla_target.h | 8 3 files changed, 19 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index ce3b946..d85066f 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3160,7 +3160,6 @@ struct qlt_hw_data { /* Protected by hw lock */ uint32_t enable_class_2:1; uint32_t enable_explicit_conf:1; - uint32_t ini_mode_force_reverse:1; uint32_t node_name_set:1; dma_addr_t atio_dma;/* Physical address. */ diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 0fc6da5..d2ca518 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -5865,8 +5865,6 @@ void qlt_lport_deregister(struct scsi_qla_host *vha) /* Must be called under HW lock */ static void qlt_set_mode(struct scsi_qla_host *vha) { - struct qla_hw_data *ha = vha->hw; - switch (ql2x_ini_mode) { case QLA2XXX_INI_MODE_DISABLED: case QLA2XXX_INI_MODE_EXCLUSIVE: @@ -5881,16 +5879,11 @@ static void qlt_set_mode(struct scsi_qla_host *vha) default: break; } - - if (ha->tgt.ini_mode_force_reverse) - qla_reverse_ini_mode(vha); } /* Must be called under HW lock */ static void qlt_clear_mode(struct scsi_qla_host *vha) { - struct qla_hw_data *ha = vha->hw; - switch (ql2x_ini_mode) { case QLA2XXX_INI_MODE_DISABLED: vha->host->active_mode = MODE_UNKNOWN; @@ -5905,9 +5898,6 @@ static void qlt_clear_mode(struct scsi_qla_host *vha) default: break; } - - if (ha->tgt.ini_mode_force_reverse) - qla_reverse_ini_mode(vha); } /* diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 5ebd7fb..2569216 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -1073,14 +1073,6 @@ static inline bool qla_dual_mode_enabled(struct scsi_qla_host *ha) return (ha->host->active_mode == MODE_DUAL); } -static inline void qla_reverse_ini_mode(struct scsi_qla_host *ha) -{ - if (ha->host->active_mode & MODE_INITIATOR) - ha->host->active_mode &= ~MODE_INITIATOR; - else - ha->host->active_mode |= MODE_INITIATOR; -} - static inline uint32_t sid_to_key(const uint8_t *s_id) { uint32_t key; -- 1.8.3.1 -- 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 01/11] qla2xxx: Remove direct access of scsi_status field in se_cmd
From: Quinn TranReviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h| 1 + drivers/scsi/qla2xxx/qla_target.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 1f7c6d2..1196150 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -1794,6 +1794,7 @@ struct crc_context { #define SS_RESIDUAL_OVER BIT_10 #define SS_SENSE_LEN_VALID BIT_9 #define SS_RESPONSE_INFO_LEN_VALID BIT_8 +#define SS_SCSI_STATUS_BYTE0xff #define SS_RESERVE_CONFLICT(BIT_4 | BIT_3) #define SS_BUSY_CONDITION BIT_3 diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 9c6cb75..47acc26 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -2288,7 +2288,7 @@ static void qlt_24xx_init_ctio_to_isp(struct ctio7_to_24xx *ctio, int i; if (qlt_need_explicit_conf(prm->tgt->ha, prm->cmd, 1)) { - if (prm->cmd->se_cmd.scsi_status != 0) { + if ((prm->rq_result & SS_SCSI_STATUS_BYTE) != 0) { ql_dbg(ql_dbg_tgt, prm->cmd->vha, 0xe017, "Skipping EXPLICIT_CONFORM and " "CTIO7_FLAGS_CONFORM_REQ for FCP READ w/ " -- 1.8.3.1 -- 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 02/11] qla2xxx: Cleanup TMF code translation from qla_target.
From: Quinn TranMove code code which converts Task Mgmt Command flags for ATIO to TCM #defines, from qla2xxx driver to tcm_qla2xxx driver. Reviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 75 -- drivers/scsi/qla2xxx/qla_target.h | 6 ++- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 39 +++- 3 files changed, 49 insertions(+), 71 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 47acc26..6e58848 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1592,8 +1592,9 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha, mcmd->sess = sess; memcpy(>orig_iocb.abts, abts, sizeof(mcmd->orig_iocb.abts)); mcmd->reset_count = vha->hw->chip_reset; + mcmd->tmr_func = QLA_TGT_ABTS; - rc = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, TMR_ABORT_TASK, + rc = ha->tgt.tgt_ops->handle_tmr(mcmd, 0, mcmd->tmr_func, abts->exchange_addr_to_abort); if (rc != 0) { ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052, @@ -4048,7 +4049,6 @@ static int qlt_issue_task_mgmt(struct qla_tgt_sess *sess, uint32_t lun, struct qla_tgt_mgmt_cmd *mcmd; struct atio_from_isp *a = (struct atio_from_isp *)iocb; int res; - uint8_t tmr_func; mcmd = mempool_alloc(qla_tgt_mgmt_cmd_mempool, GFP_ATOMIC); if (!mcmd) { @@ -4070,74 +4070,12 @@ static int qlt_issue_task_mgmt(struct qla_tgt_sess *sess, uint32_t lun, mcmd->reset_count = vha->hw->chip_reset; switch (fn) { - case QLA_TGT_CLEAR_ACA: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x1, - "qla_target(%d): CLEAR_ACA received\n", sess->vha->vp_idx); - tmr_func = TMR_CLEAR_ACA; - break; - - case QLA_TGT_TARGET_RESET: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10001, - "qla_target(%d): TARGET_RESET received\n", - sess->vha->vp_idx); - tmr_func = TMR_TARGET_WARM_RESET; - break; - case QLA_TGT_LUN_RESET: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10002, - "qla_target(%d): LUN_RESET received\n", sess->vha->vp_idx); - tmr_func = TMR_LUN_RESET; - abort_cmds_for_lun(vha, lun, a->u.isp24.fcp_hdr.s_id); - break; - - case QLA_TGT_CLEAR_TS: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10003, - "qla_target(%d): CLEAR_TS received\n", sess->vha->vp_idx); - tmr_func = TMR_CLEAR_TASK_SET; - break; - - case QLA_TGT_ABORT_TS: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10004, - "qla_target(%d): ABORT_TS received\n", sess->vha->vp_idx); - tmr_func = TMR_ABORT_TASK_SET; - break; -#if 0 - case QLA_TGT_ABORT_ALL: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10005, - "qla_target(%d): Doing ABORT_ALL_TASKS\n", - sess->vha->vp_idx); - tmr_func = 0; - break; - - case QLA_TGT_ABORT_ALL_SESS: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10006, - "qla_target(%d): Doing ABORT_ALL_TASKS_SESS\n", - sess->vha->vp_idx); - tmr_func = 0; - break; - - case QLA_TGT_NEXUS_LOSS_SESS: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10007, - "qla_target(%d): Doing NEXUS_LOSS_SESS\n", - sess->vha->vp_idx); - tmr_func = 0; - break; - - case QLA_TGT_NEXUS_LOSS: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x10008, - "qla_target(%d): Doing NEXUS_LOSS\n", sess->vha->vp_idx); - tmr_func = 0; - break; -#endif - default: - ql_dbg(ql_dbg_tgt_tmr, vha, 0x1000a, - "qla_target(%d): Unknown task mgmt fn 0x%x\n", - sess->vha->vp_idx, fn); - mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool); - return -ENOSYS; + abort_cmds_for_lun(vha, lun, a->u.isp24.fcp_hdr.s_id); + break; } - res = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, tmr_func, 0); + res = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, mcmd->tmr_func, 0); if (res != 0) { ql_dbg(ql_dbg_tgt_tmr, vha, 0x1000b, "qla_target(%d): tgt.tgt_ops->handle_tmr() failed: %d\n", @@ -4212,8 +4150,9 @@ static int __qlt_abort_task(struct scsi_qla_host *vha, lun = a->u.isp24.fcp_cmnd.lun; unpacked_lun = scsilun_to_int((struct scsi_lun *)); mcmd->reset_count = vha->hw->chip_reset; + mcmd->tmr_func = QLA_TGT_2G_ABORT_TASK; - rc =
[PATCH 05/11] qla2xxx: Fix wrong argument in sp done callback.
From: Quinn TranCallback for sp->done expects scsi_qla_host is passed in as argument, Instead qla_hw_data is passed in. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c | 8 drivers/scsi/qla2xxx/qla_mr.c | 6 +++--- drivers/scsi/qla2xxx/qla_os.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index eefcf2f..d745307 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1215,7 +1215,7 @@ static void qla_irq_affinity_notify(struct irq_affinity_notify *, req->outstanding_cmds[index] = NULL; /* Save ISP completion status */ - sp->done(ha, sp, DID_OK << 16); + sp->done(vha, sp, DID_OK << 16); } else { ql_log(ql_log_warn, vha, 0x3016, "Invalid SCSI SRB.\n"); @@ -2408,7 +2408,7 @@ struct scsi_dif_tuple { resid_len, fw_resid_len, sp, cp); if (rsp->status_srb == NULL) - sp->done(ha, sp, res); + sp->done(vha, sp, res); } /** @@ -2465,7 +2465,7 @@ struct scsi_dif_tuple { /* Place command on done queue. */ if (sense_len == 0) { rsp->status_srb = NULL; - sp->done(ha, sp, cp->result); + sp->done(vha, sp, cp->result); } } @@ -2501,7 +2501,7 @@ struct scsi_dif_tuple { sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); if (sp) { - sp->done(ha, sp, res); + sp->done(vha, sp, res); return; } fatal: diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index 02f1de1..d38bc64 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -2537,7 +2537,7 @@ par_sense_len, rsp_info_len); if (rsp->status_srb == NULL) - sp->done(ha, sp, res); + sp->done(vha, sp, res); } /** @@ -2614,7 +2614,7 @@ /* Place command on done queue. */ if (sense_len == 0) { rsp->status_srb = NULL; - sp->done(ha, sp, cp->result); + sp->done(vha, sp, cp->result); } } @@ -2695,7 +2695,7 @@ sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); if (sp) { - sp->done(ha, sp, res); + sp->done(vha, sp, res); return; } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 074dcca..65eca89 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1203,7 +1203,7 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) } spin_lock_irqsave(>hardware_lock, flags); - sp->done(ha, sp, 0); + sp->done(vha, sp, 0); spin_unlock_irqrestore(>hardware_lock, flags); /* Did the command return during mailbox execution? */ -- 1.8.3.1 -- 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 09/11] qla2xxx: Add Dual mode support in the driver
From: Quinn TranAdd switch to allow both Initiator Mode & Target mode to operate at the same time. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_init.c| 3 +- drivers/scsi/qla2xxx/qla_isr.c | 19 ++- drivers/scsi/qla2xxx/qla_target.c | 113 +++-- drivers/scsi/qla2xxx/qla_target.h | 6 +- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 +- 6 files changed, 124 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 2d3bc22..ce3b946 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3312,6 +3312,7 @@ struct qla_hw_data { #define FLOGI_SP_SUPPORTBIT_13 uint8_t port_no;/* Physical port of adapter */ + uint8_t exch_starvation; /* Timeout timers. */ uint8_t loop_down_abort_time;/* port down timer */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index e0ca193..9da537c 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3997,7 +3997,8 @@ static void qla2xxx_nvram_wwn_from_ofw(scsi_qla_host_t *vha, nvram_t *nv) * Process any ATIO queue entries that came in * while we weren't online. */ - if (qla_tgt_mode_enabled(vha)) { + if (qla_tgt_mode_enabled(vha) || + qla_dual_mode_enabled(vha)) { if (IS_QLA27XX(ha) || IS_QLA83XX(ha)) { spin_lock_irqsave(>tgt.atio_lock, flags); diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 36cc19f..2d47728 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1028,7 +1028,8 @@ static void qla_irq_affinity_notify(struct irq_affinity_notify *, qla2x00_mark_all_devices_lost(vha, 1); - if (vha->vp_idx == 0 && !qla_ini_mode_enabled(vha)) + if (vha->vp_idx == 0 && + (qla_tgt_mode_enabled(vha) || qla_dual_mode_enabled(vha))) set_bit(SCR_PENDING, >dpc_flags); set_bit(LOOP_RESYNC_NEEDED, >dpc_flags); @@ -1643,6 +1644,7 @@ static void qla_irq_affinity_notify(struct irq_affinity_notify *, fcport->d_id.b.area, fcport->d_id.b.al_pa, le32_to_cpu(logio->io_parameter[0])); + vha->hw->exch_starvation = 0; data[0] = MBS_COMMAND_COMPLETE; if (sp->type != SRB_LOGIN_CMD) goto logio_done; @@ -1678,6 +1680,21 @@ static void qla_irq_affinity_notify(struct irq_affinity_notify *, case LSC_SCODE_NPORT_USED: data[0] = MBS_LOOP_ID_USED; break; + case LSC_SCODE_NOXCB: + vha->hw->exch_starvation++; + if (vha->hw->exch_starvation > 5) { + ql_log(ql_log_warn, vha, 0x, + "Exchange starvation. Reseting RISC\n"); + + vha->hw->exch_starvation = 0; + + if (IS_P3P_TYPE(vha->hw)) + set_bit(FCOE_CTX_RESET_NEEDED, >dpc_flags); + else + set_bit(ISP_ABORT_NEEDED, >dpc_flags); + qla2xxx_wake_dpc(vha); + } + /* drop through */ default: data[0] = MBS_COMMAND_ERROR; break; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index b697ba5..0fc6da5 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -55,8 +55,17 @@ "disabled on enabling target mode and then on disabling target mode " "enabled back; " "\"disabled\" - initiator mode will never be enabled; " + "\"dual\" - Initiator Modes will be enabled. Target Mode can be activated " + "when ready " "\"enabled\" (default) - initiator mode will always stay enabled."); +static int ql_dm_tgt_ex_pct = 50; +module_param(ql_dm_tgt_ex_pct, int, S_IRUGO|S_IWUSR); +MODULE_PARM_DESC(ql_dm_tgt_ex_pct, + "For Dual Mode (qlini_mode=dual), this parameter determines " + "the percentage of exchanges/cmds FW will allocate resources " + "for Target mode."); + int ql2x_ini_mode = QLA2XXX_INI_MODE_EXCLUSIVE; static int temp_sam_status = SAM_STAT_BUSY; @@ -1302,7 +1311,8 @@ int qlt_stop_phase1(struct qla_tgt *tgt) wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); /* Big hammer */ - if (!ha->flags.host_shutting_down &&
[PATCH 03/11] qla2xxx: Make trace flags more readable.
From: Quinn TranThis patch does not change any functionality. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 27 +-- drivers/scsi/qla2xxx/qla_target.h | 54 +- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 35 3 files changed, 54 insertions(+), 62 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 6e58848..c9e6a8b 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -3294,7 +3294,6 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd) return EIO; } cmd->aborted = 1; - cmd->cmd_flags |= BIT_6; spin_unlock_irqrestore(>cmd_lock, flags); qlt_send_term_exchange(vha, cmd, >atio, 0, 1); @@ -3342,7 +3341,7 @@ static int qlt_prepare_srr_ctio(struct scsi_qla_host *vha, struct qla_tgt_srr_imm *imm; tgt->ctio_srr_id++; - cmd->cmd_flags |= BIT_15; + cmd->trc_flags |= TRC_SRR_CTIO; ql_dbg(ql_dbg_tgt_mgt, vha, 0xf019, "qla_target(%d): CTIO with SRR status received\n", vha->vp_idx); @@ -3525,7 +3524,7 @@ static struct qla_tgt_cmd *qlt_ctio_to_cmd(struct scsi_qla_host *vha, dump_stack(); } - cmd->cmd_flags |= BIT_17; + cmd->trc_flags |= TRC_FLUSH; ha->tgt.tgt_ops->free_cmd(cmd); } @@ -3691,7 +3690,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, */ if ((cmd->state != QLA_TGT_STATE_NEED_DATA) && (!cmd->aborted)) { - cmd->cmd_flags |= BIT_13; + cmd->trc_flags |= TRC_CTIO_ERR; if (qlt_term_ctio_exchange(vha, ctio, cmd, status)) return; } @@ -3699,7 +3698,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, skip_term: if (cmd->state == QLA_TGT_STATE_PROCESSED) { - cmd->cmd_flags |= BIT_12; + cmd->trc_flags |= TRC_CTIO_DONE; } else if (cmd->state == QLA_TGT_STATE_NEED_DATA) { cmd->state = QLA_TGT_STATE_DATA_IN; @@ -3709,11 +3708,11 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, ha->tgt.tgt_ops->handle_data(cmd); return; } else if (cmd->aborted) { - cmd->cmd_flags |= BIT_18; + cmd->trc_flags |= TRC_CTIO_ABORTED; ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01e, "Aborted command %p (tag %lld) finished\n", cmd, se_cmd->tag); } else { - cmd->cmd_flags |= BIT_19; + cmd->trc_flags |= TRC_CTIO_STRANGE; ql_dbg(ql_dbg_tgt_mgt, vha, 0xf05c, "qla_target(%d): A command in state (%d) should " "not return a CTIO complete\n", vha->vp_idx, cmd->state); @@ -3778,7 +3777,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd) int ret, fcp_task_attr, data_dir, bidi = 0; cmd->cmd_in_wq = 0; - cmd->cmd_flags |= BIT_1; + cmd->trc_flags |= TRC_DO_WORK; if (tgt->tgt_stop) goto out_term; @@ -3830,7 +3829,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd) * cmd has not sent to target yet, so pass NULL as the second * argument to qlt_send_term_exchange() and free the memory here. */ - cmd->cmd_flags |= BIT_2; + cmd->trc_flags |= TRC_DO_WORK_ERR; spin_lock_irqsave(>hardware_lock, flags); qlt_send_term_exchange(vha, NULL, >atio, 1, 0); @@ -3881,7 +3880,7 @@ static struct qla_tgt_cmd *qlt_get_tag(scsi_qla_host_t *vha, cmd->loop_id = sess->loop_id; cmd->conf_compl_supported = sess->conf_compl_supported; - cmd->cmd_flags = 0; + cmd->trc_flags = 0; cmd->jiffies_at_alloc = get_jiffies_64(); cmd->reset_count = vha->hw->chip_reset; @@ -4017,7 +4016,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, } cmd->cmd_in_wq = 1; - cmd->cmd_flags |= BIT_0; + cmd->trc_flags |= TRC_NEW_CMD; cmd->se_cmd.cpuid = ha->msix_count ? ha->tgt.rspq_vector_cpuid : WORK_CPU_UNBOUND; @@ -4709,7 +4708,7 @@ static void qlt_handle_srr(struct scsi_qla_host *vha, 0, 0, 0, NOTIFY_ACK_SRR_FLAGS_ACCEPT, 0, 0); spin_unlock_irqrestore(>hardware_lock, flags); if (xmit_type & QLA_TGT_XMIT_DATA) { - cmd->cmd_flags |= BIT_8; + cmd->trc_flags |= TRC_SRR_XRDY; qlt_rdy_to_xfer(cmd); } } else { @@ -4728,7 +4727,7 @@
[PATCH 04/11] qla2xxx: Cleanup SRR code.
Signed-off-by: Himanshu MadhaniSigned-off-by: Giridhar Malavali --- drivers/scsi/qla2xxx/qla_target.c | 641 -- drivers/scsi/qla2xxx/qla_target.h | 21 -- 2 files changed, 662 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index c9e6a8b..8a10f93 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -106,8 +106,6 @@ static int qlt_issue_task_mgmt(struct qla_tgt_sess *sess, uint32_t lun, int fn, void *iocb, int flags); static void qlt_send_term_exchange(struct scsi_qla_host *ha, struct qla_tgt_cmd *cmd, struct atio_from_isp *atio, int ha_locked, int ul_abort); -static void qlt_reject_free_srr_imm(struct scsi_qla_host *ha, - struct qla_tgt_srr_imm *imm, int ha_lock); static void qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd); static void qlt_alloc_qfull_cmd(struct scsi_qla_host *vha, @@ -2183,95 +2181,6 @@ static inline int qlt_need_explicit_conf(struct qla_hw_data *ha, cmd->conf_compl_supported; } -#ifdef CONFIG_QLA_TGT_DEBUG_SRR -/* - * Original taken from the XFS code - */ -static unsigned long qlt_srr_random(void) -{ - static int Inited; - static unsigned long RandomValue; - static DEFINE_SPINLOCK(lock); - /* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */ - register long rv; - register long lo; - register long hi; - unsigned long flags; - - spin_lock_irqsave(, flags); - if (!Inited) { - RandomValue = jiffies; - Inited = 1; - } - rv = RandomValue; - hi = rv / 127773; - lo = rv % 127773; - rv = 16807 * lo - 2836 * hi; - if (rv <= 0) - rv += 2147483647; - RandomValue = rv; - spin_unlock_irqrestore(, flags); - return rv; -} - -static void qlt_check_srr_debug(struct qla_tgt_cmd *cmd, int *xmit_type) -{ -#if 0 /* This is not a real status packets lost, so it won't lead to SRR */ - if ((*xmit_type & QLA_TGT_XMIT_STATUS) && (qlt_srr_random() % 200) - == 50) { - *xmit_type &= ~QLA_TGT_XMIT_STATUS; - ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf015, - "Dropping cmd %p (tag %d) status", cmd, se_cmd->tag); - } -#endif - /* -* It's currently not possible to simulate SRRs for FCP_WRITE without -* a physical link layer failure, so don't even try here.. -*/ - if (cmd->dma_data_direction != DMA_FROM_DEVICE) - return; - - if (qlt_has_data(cmd) && (cmd->sg_cnt > 1) && - ((qlt_srr_random() % 100) == 20)) { - int i, leave = 0; - unsigned int tot_len = 0; - - while (leave == 0) - leave = qlt_srr_random() % cmd->sg_cnt; - - for (i = 0; i < leave; i++) - tot_len += cmd->sg[i].length; - - ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf016, - "Cutting cmd %p (tag %d) buffer" - " tail to len %d, sg_cnt %d (cmd->bufflen %d," - " cmd->sg_cnt %d)", cmd, se_cmd->tag, tot_len, leave, - cmd->bufflen, cmd->sg_cnt); - - cmd->bufflen = tot_len; - cmd->sg_cnt = leave; - } - - if (qlt_has_data(cmd) && ((qlt_srr_random() % 100) == 70)) { - unsigned int offset = qlt_srr_random() % cmd->bufflen; - - ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf017, - "Cutting cmd %p (tag %d) buffer head " - "to offset %d (cmd->bufflen %d)", cmd, se_cmd->tag, offset, - cmd->bufflen); - if (offset == 0) - *xmit_type &= ~QLA_TGT_XMIT_DATA; - else if (qlt_set_data_offset(cmd, offset)) { - ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf018, - "qlt_set_data_offset() failed (tag %d)", se_cmd->tag); - } - } -} -#else -static inline void qlt_check_srr_debug(struct qla_tgt_cmd *cmd, int *xmit_type) -{} -#endif - static void qlt_24xx_init_ctio_to_isp(struct ctio7_to_24xx *ctio, struct qla_tgt_prm *prm) { @@ -2686,7 +2595,6 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, spin_unlock_irqrestore(>hardware_lock, flags); memset(, 0, sizeof(prm)); - qlt_check_srr_debug(cmd, _type); ql_dbg(ql_dbg_tgt, cmd->vha, 0xe018, "is_send_status=%d, cmd->bufflen=%d, cmd->sg_cnt=%d, cmd->dma_data_direction=%d se_cmd[%p]\n", @@ -3332,90 +3240,6 @@ void qlt_free_cmd(struct qla_tgt_cmd *cmd) } EXPORT_SYMBOL(qlt_free_cmd); -/* ha->hardware_lock supposed to be held on entry */ -static int qlt_prepare_srr_ctio(struct scsi_qla_host *vha, - struct
Re: [4.10, panic, regression] iscsi: null pointer deref at iscsi_tcp_segment_done+0x20d/0x2e0
On 12/23/2016 12:42 PM, Linus Torvalds wrote: > On Fri, Dec 23, 2016 at 2:00 AM, Christoph Hellwigwrote: >> >> From: Christoph Hellwig >> Date: Fri, 23 Dec 2016 10:57:06 +0100 >> Subject: virtio_blk: avoid DMA to stack for the sense buffer >> >> Most users of BLOCK_PC requests allocate the sense buffer on the stack, >> so to avoid DMA to the stack copy them to a field in the heap allocated >> virtblk_req structure. Without that any attempt at SCSI passthrough I/O, >> including the SG_IO ioctl from userspace will crash the kernel. Note that >> this includes running tools like hdparm even when the host does not have >> SCSI passthrough enabled. > > Ugh. This patch is nasty. > > I think we should just fix blk_execute_rq() instead. > > But from a quick look, we also have at least sg_scsi_ioctl() and > sg_io() doing the same thing. > > And the SG_IO thing in bsg_ioctl(). And spi_execute() in scsi_transport_spi.c > > And resp_requests() in scsi_debug.c. It's not that it's technically hard to fix up, it's more that it's a pain in the ass to have to do it. For instance, for blk_execute_rq(), we either should enforce that the caller allocates it dynamically and then free it, or we need nasty hack where the caller needs to know he has to free it. Pretty obvious what I would prefer there. And yes, there would be a good chunk of other places where this would nede to be fixed up... > So I guess ugly it may need to be, and the rule is that the sense > buffer really can be on the stack and you can't DMA to/from it. > Comments from others? I'm just wondering why this is being hit now, we have a 4.9 release with this issue and nobody reported it (that I saw)... Which is pretty sad. If no one beats me to it, I'll try and get a patch done on Sunday. We're in the midst of the holidays here. -- Jens Axboe -- 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 v3 03/10] qla2xxx: Set tcm_qla2xxx version to automatically track qla2xxx version.
Reviewed-by: Christoph HellwigSigned-off-by: Himanshu Madhani Signed-off-by: Giridhar Malavali --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 ++-- drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 6643f6f..d925910 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -1800,7 +1800,7 @@ static ssize_t tcm_qla2xxx_wwn_version_show(struct config_item *item, { return sprintf(page, "TCM QLOGIC QLA2XXX NPIV capable fabric module %s on %s/%s on " - UTS_RELEASE"\n", TCM_QLA2XXX_VERSION, utsname()->sysname, + UTS_RELEASE"\n", QLA2XXX_VERSION, utsname()->sysname, utsname()->machine); } @@ -1906,7 +1906,7 @@ static int tcm_qla2xxx_register_configfs(void) int ret; pr_debug("TCM QLOGIC QLA2XXX fabric module %s on %s/%s on " - UTS_RELEASE"\n", TCM_QLA2XXX_VERSION, utsname()->sysname, + UTS_RELEASE"\n", QLA2XXX_VERSION, utsname()->sysname, utsname()->machine); ret = target_register_template(_qla2xxx_ops); diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 37e026a..cf8430b 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h @@ -1,7 +1,6 @@ #include #include -#define TCM_QLA2XXX_VERSION"v0.1" /* length of ASCII WWPNs including pad */ #define TCM_QLA2XXX_NAMELEN32 /* -- 1.8.3.1 -- 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 v3 01/10] qla2xxx: Fix wrong IOCB type assumption.
From: Quinn Tranqlt_reset is called with Immedidate Notify IOCB only. Current code wrongly cast it as ATIO IOCB. Reviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index bff9689..b9c559c 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -668,11 +668,9 @@ static int qlt_reset(struct scsi_qla_host *vha, void *iocb, int mcmd) { struct qla_hw_data *ha = vha->hw; struct qla_tgt_sess *sess = NULL; - uint32_t unpacked_lun, lun = 0; uint16_t loop_id; int res = 0; struct imm_ntfy_from_isp *n = (struct imm_ntfy_from_isp *)iocb; - struct atio_from_isp *a = (struct atio_from_isp *)iocb; unsigned long flags; loop_id = le16_to_cpu(n->u.isp24.nport_handle); @@ -725,11 +723,7 @@ static int qlt_reset(struct scsi_qla_host *vha, void *iocb, int mcmd) "loop_id %d)\n", vha->host_no, sess, sess->port_name, mcmd, loop_id); - lun = a->u.isp24.fcp_cmnd.lun; - unpacked_lun = scsilun_to_int((struct scsi_lun *)); - - return qlt_issue_task_mgmt(sess, unpacked_lun, mcmd, - iocb, QLA24XX_MGMT_SEND_NACK); + return qlt_issue_task_mgmt(sess, 0, mcmd, iocb, QLA24XX_MGMT_SEND_NACK); } /* ha->tgt.sess_lock supposed to be held on entry */ -- 1.8.3.1 -- 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 v3 08/10] qla2xxx: Reduce exess wait during chip reset
From: Quinn TranSoft reset and Risc reset should take 100uS to complete. This change pad the timeout up to 400uS, which should be plenty. Reviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 632d5f3..7b6317c 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1191,7 +1191,7 @@ static int qla2x00_fabric_dev_login(scsi_qla_host_t *, fc_port_t *, /* Wait for soft-reset to complete. */ RD_REG_DWORD(>ctrl_status); - for (cnt = 0; cnt < 600; cnt++) { + for (cnt = 0; cnt < 60; cnt++) { barrier(); if ((RD_REG_DWORD(>ctrl_status) & CSRX_ISP_SOFT_RESET) == 0) @@ -1234,7 +1234,7 @@ static int qla2x00_fabric_dev_login(scsi_qla_host_t *, fc_port_t *, RD_REG_DWORD(>hccr); RD_REG_WORD(>mailbox0); - for (cnt = 600; RD_REG_WORD(>mailbox0) != 0 && + for (cnt = 60; RD_REG_WORD(>mailbox0) != 0 && rval == QLA_SUCCESS; cnt--) { barrier(); if (cnt) -- 1.8.3.1 -- 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 v3 02/10] qla2xxx: Include ATIO queue in firmware dump when in target mode
Include ATIO queue for ISP27XX when firmware dump is collected for target mode. Reviewed-by: Christoph HellwigSigned-off-by: Himanshu Madhani Signed-off-by: Giridhar Malavali --- drivers/scsi/qla2xxx/qla_tmpl.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index 36935c9..8a58ef3 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -433,6 +433,18 @@ static inline void (*qla27xx_read_vector(uint width))(void __iomem*, void *, ulo count++; } } + } else if (QLA_TGT_MODE_ENABLED() && + ent->t263.queue_type == T263_QUEUE_TYPE_ATIO) { + struct qla_hw_data *ha = vha->hw; + struct atio *atr = ha->tgt.atio_ring; + + if (atr || !buf) { + length = ha->tgt.atio_q_length; + qla27xx_insert16(0, buf, len); + qla27xx_insert16(length, buf, len); + qla27xx_insertbuf(atr, length * sizeof(*atr), buf, len); + count++; + } } else { ql_dbg(ql_dbg_misc, vha, 0xd026, "%s: unknown queue %x\n", __func__, ent->t263.queue_type); @@ -676,6 +688,18 @@ static inline void (*qla27xx_read_vector(uint width))(void __iomem*, void *, ulo count++; } } + } else if (QLA_TGT_MODE_ENABLED() && + ent->t274.queue_type == T274_QUEUE_TYPE_ATIO_SHAD) { + struct qla_hw_data *ha = vha->hw; + struct atio *atr = ha->tgt.atio_ring_ptr; + + if (atr || !buf) { + qla27xx_insert16(0, buf, len); + qla27xx_insert16(1, buf, len); + qla27xx_insert32(ha->tgt.atio_q_in ? + readl(ha->tgt.atio_q_in) : 0, buf, len); + count++; + } } else { ql_dbg(ql_dbg_misc, vha, 0xd02f, "%s: unknown queue %x\n", __func__, ent->t274.queue_type); -- 1.8.3.1 -- 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 v3 04/10] qla2xxx: Reset reserved field in firmware options to 0.
During NVRAM initialization in target mode, reset reserved fields in firmware options to Zero (BIT 15) Reviewed-by: Christoph HellwigSigned-off-by: Himanshu Madhani Signed-off-by: Giridhar Malavali --- drivers/scsi/qla2xxx/qla_target.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index b9c559c..369d62f2 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -6539,6 +6539,13 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) /* Disable Full Login after LIP */ nv->host_p &= cpu_to_le32(~BIT_10); + + /* +* clear BIT 15 explicitly as we have seen at least +* a couple of instances where this was set and this +* was causing the firmware to not be initialized. +*/ + nv->firmware_options_1 &= cpu_to_le32(~BIT_15); /* Enable target PRLI control */ nv->firmware_options_2 |= cpu_to_le32(BIT_14); } else { @@ -6623,11 +6630,17 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) /* Disable ini mode, if requested */ if (!qla_ini_mode_enabled(vha)) nv->firmware_options_1 |= cpu_to_le32(BIT_5); - /* Disable Full Login after LIP */ nv->firmware_options_1 &= cpu_to_le32(~BIT_13); /* Enable initial LIP */ nv->firmware_options_1 &= cpu_to_le32(~BIT_9); + /* +* clear BIT 15 explicitly as we have seen at +* least a couple of instances where this was set +* and this was causing the firmware to not be +* initialized. +*/ + nv->firmware_options_1 &= cpu_to_le32(~BIT_15); if (ql2xtgt_tape_enable) /* Enable FC tape support */ nv->firmware_options_2 |= cpu_to_le32(BIT_12); -- 1.8.3.1 -- 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 v3 06/10] qla2xxx: Fix crash due to null pointer access.
From: Quinn TranDuring code inspection, while investigating following stack trace seen on one of the test setup, we found out there was possiblity of memory leak becuase driver was not unwinding the stack properly. This issue has not been reproduced in a test environment or on a customer setup. Here's stack trace that was seen. [1469877.797315] Call Trace: [1469877.799940] [] qla2x00_mem_alloc+0xb09/0x10c0 [qla2xxx] [1469877.806980] [] qla2x00_probe_one+0x86a/0x1b50 [qla2xxx] [1469877.814013] [] ? __pm_runtime_resume+0x51/0xa0 [1469877.820265] [] ? _raw_spin_lock_irqsave+0x25/0x90 [1469877.826776] [] ? _raw_spin_unlock_irqrestore+0x6d/0x80 [1469877.833720] [] ? preempt_count_sub+0xb1/0x100 [1469877.839885] [] ? _raw_spin_unlock_irqrestore+0x4c/0x80 [1469877.846830] [] local_pci_probe+0x4c/0xb0 [1469877.852562] [] ? preempt_count_sub+0xb1/0x100 [1469877.858727] [] pci_call_probe+0x89/0xb0 Cc: Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani Reviewed-by: Christoph Hellwig --- drivers/scsi/qla2xxx/qla_os.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 8521cfe..074dcca 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3662,7 +3662,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport, sizeof(struct ct6_dsd), 0, SLAB_HWCACHE_ALIGN, NULL); if (!ctx_cachep) - goto fail_free_gid_list; + goto fail_free_srb_mempool; } ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, ctx_cachep); @@ -3815,7 +3815,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport, ha->loop_id_map = kzalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE) * sizeof(long), GFP_KERNEL); if (!ha->loop_id_map) - goto fail_async_pd; + goto fail_loop_id_map; else { qla2x00_set_reserved_loop_ids(ha); ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, @@ -3824,6 +3824,8 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport, return 0; +fail_loop_id_map: + dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); fail_async_pd: dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); fail_ex_init_cb: @@ -3851,6 +3853,10 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport, dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); ha->ms_iocb = NULL; ha->ms_iocb_dma = 0; + + if (ha->sns_cmd) + dma_free_coherent(>pdev->dev, sizeof(struct sns_cmd_pkt), + ha->sns_cmd, ha->sns_cmd_dma); fail_dma_pool: if (IS_QLA82XX(ha) || ql2xenabledif) { dma_pool_destroy(ha->fcp_cmnd_dma_pool); @@ -3868,10 +3874,12 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport, kfree(ha->nvram); ha->nvram = NULL; fail_free_ctx_mempool: - mempool_destroy(ha->ctx_mempool); + if (ha->ctx_mempool) + mempool_destroy(ha->ctx_mempool); ha->ctx_mempool = NULL; fail_free_srb_mempool: - mempool_destroy(ha->srb_mempool); + if (ha->srb_mempool) + mempool_destroy(ha->srb_mempool); ha->srb_mempool = NULL; fail_free_gid_list: dma_free_coherent(>pdev->dev, qla2x00_gid_list_size(ha), -- 1.8.3.1 -- 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 v3 07/10] qla2xxx: Terminate exchange if corruputed.
From: Quinn TranCorrupted ATIO is defined as length of fcp_header & fcp_cmd payload is less than 0x38. It's the minimum size for a frame to carry 8..16 bytes SCSI CDB. The exchange will be dropped or terminated if corrupted. Reviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h| 3 ++- drivers/scsi/qla2xxx/qla_target.c | 23 --- drivers/scsi/qla2xxx/qla_target.h | 22 +- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index f7df01b..1f7c6d2 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -1556,7 +1556,8 @@ struct link_statistics { struct atio { uint8_t entry_type; /* Entry type. */ uint8_t entry_count;/* Entry count. */ - uint8_t data[58]; + __le16 attr_n_length; + uint8_t data[56]; uint32_tsignature; #define ATIO_PROCESSED 0xDEADDEAD /* Signature */ }; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 369d62f2..2c04f42 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -6451,12 +6451,29 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) if (!vha->flags.online) return; - while (ha->tgt.atio_ring_ptr->signature != ATIO_PROCESSED) { + while ((ha->tgt.atio_ring_ptr->signature != ATIO_PROCESSED) || + fcpcmd_is_corrupted(ha->tgt.atio_ring_ptr)) { pkt = (struct atio_from_isp *)ha->tgt.atio_ring_ptr; cnt = pkt->u.raw.entry_count; - qlt_24xx_atio_pkt_all_vps(vha, (struct atio_from_isp *)pkt, - ha_locked); + if (unlikely(fcpcmd_is_corrupted(ha->tgt.atio_ring_ptr))) { + /* +* This packet is corrupted. The header + payload +* can not be trusted. There is no point in passing +* it further up. +*/ + ql_log(ql_log_warn, vha, 0x, + "corrupted fcp frame SID[%3phN] OXID[%04x] EXCG[%x] %64phN\n", + pkt->u.isp24.fcp_hdr.s_id, + be16_to_cpu(pkt->u.isp24.fcp_hdr.ox_id), + le32_to_cpu(pkt->u.isp24.exchange_addr), pkt); + + adjust_corrupted_atio(pkt); + qlt_send_term_exchange(vha, NULL, pkt, ha_locked, 0); + } else { + qlt_24xx_atio_pkt_all_vps(vha, + (struct atio_from_isp *)pkt, ha_locked); + } for (i = 0; i < cnt; i++) { ha->tgt.atio_ring_index++; diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index f26c5f6..0824a81 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -427,13 +427,33 @@ struct atio_from_isp { struct { uint8_t entry_type;/* Entry type. */ uint8_t entry_count; /* Entry count. */ - uint8_t data[58]; + __le16 attr_n_length; +#define FCP_CMD_LENGTH_MASK 0x0fff +#define FCP_CMD_LENGTH_MIN 0x38 + uint8_t data[56]; uint32_t signature; #define ATIO_PROCESSED 0xDEADDEAD /* Signature */ } raw; } u; } __packed; +static inline int fcpcmd_is_corrupted(struct atio *atio) +{ + if (atio->entry_type == ATIO_TYPE7 && + (le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) < + FCP_CMD_LENGTH_MIN)) + return 1; + else + return 0; +} + +/* adjust corrupted atio so we won't trip over the same entry again. */ +static inline void adjust_corrupted_atio(struct atio_from_isp *atio) +{ + atio->u.raw.attr_n_length = cpu_to_le16(FCP_CMD_LENGTH_MIN); + atio->u.isp24.fcp_cmnd.add_cdb_len = 0; +} + #define CTIO_TYPE7 0x12 /* Continue target I/O entry (for 24xx) */ /* -- 1.8.3.1 -- 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 v3 05/10] qla2xxx: Collect additional information to debug fw dump.
From: Quinn TranReviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_mbx.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 2819ceb..b4386fc 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -323,20 +323,33 @@ static int is_rom_cmd(uint16_t cmd) } } else { - uint16_t mb0; - uint32_t ictrl; + uint16_t mb[8]; + uint32_t ictrl, host_status, hccr; uint16_tw; if (IS_FWI2_CAPABLE(ha)) { - mb0 = RD_REG_WORD(>isp24.mailbox0); + mb[0] = RD_REG_WORD(>isp24.mailbox0); + mb[1] = RD_REG_WORD(>isp24.mailbox1); + mb[2] = RD_REG_WORD(>isp24.mailbox2); + mb[3] = RD_REG_WORD(>isp24.mailbox3); + mb[7] = RD_REG_WORD(>isp24.mailbox7); ictrl = RD_REG_DWORD(>isp24.ictrl); + host_status = RD_REG_DWORD(>isp24.host_status); + hccr = RD_REG_DWORD(>isp24.hccr); + + ql_log(ql_log_warn, vha, 0x1119, + "MBX Command timeout for cmd %x, iocontrol=%x jiffies=%lx " + "mb[0-3]=[0x%x 0x%x 0x%x 0x%x] mb7 0x%x host_status 0x%x hccr 0x%x\n", + command, ictrl, jiffies, mb[0], mb[1], mb[2], mb[3], + mb[7], host_status, hccr); + } else { - mb0 = RD_MAILBOX_REG(ha, >isp, 0); + mb[0] = RD_MAILBOX_REG(ha, >isp, 0); ictrl = RD_REG_WORD(>isp.ictrl); + ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1119, + "MBX Command timeout for cmd %x, iocontrol=%x jiffies=%lx " + "mb[0]=0x%x\n", command, ictrl, jiffies, mb[0]); } - ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1119, - "MBX Command timeout for cmd %x, iocontrol=%x jiffies=%lx " - "mb[0]=0x%x\n", command, ictrl, jiffies, mb0); ql_dump_regs(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1019); /* Capture FW dump only, if PCI device active */ -- 1.8.3.1 -- 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 v3 09/10] qla2xxx: Fix invalid handle erroneous message.
From: Quinn TranTermination of Immediate Notify IOCB was using wrong IOCB handle. IOCB completion code was unable to find appropriate code path due to wrong handle. Following message is seen in the logs. "Error entry - invalid handle/queue ()." Reviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c| 4 drivers/scsi/qla2xxx/qla_target.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index af840bf..eefcf2f 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2495,6 +2495,10 @@ struct scsi_dif_tuple { if (pkt->entry_status & RF_BUSY) res = DID_BUS_BUSY << 16; + if (pkt->entry_type == NOTIFY_ACK_TYPE && + pkt->handle == QLA_TGT_SKIP_HANDLE) + return; + sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); if (sp) { sp->done(ha, sp, res); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 2c04f42..5e4248f 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -3061,7 +3061,7 @@ static int __qlt_send_term_imm_notif(struct scsi_qla_host *vha, pkt->entry_type = NOTIFY_ACK_TYPE; pkt->entry_count = 1; - pkt->handle = QLA_TGT_SKIP_HANDLE | CTIO_COMPLETION_HANDLE_MARK; + pkt->handle = QLA_TGT_SKIP_HANDLE; nack = (struct nack_to_isp *)pkt; nack->ox_id = ntfy->ox_id; -- 1.8.3.1 -- 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 v3 10/10] qla2xxx: Disable Out-of-order processing by default in Firmware
From: Quinn TranOut of order(OOO) processing requires initiator, switch and target to support OOO. In today¹s environment, none of the switches support OOO. OOO requires extra buffer space which affect performance. By turning ON this feature in QLogic's FW, it delays error recovery because droped frame is treated as out of order frame. We¹re turning OFF this option of speed up error recovery. Reviewed-by: Christoph Hellwig Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 5e4248f..9c6cb75 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -6578,9 +6578,6 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) return; } - /* out-of-order frames reassembly */ - nv->firmware_options_3 |= BIT_6|BIT_9; - if (ha->tgt.enable_class_2) { if (vha->flags.init_done) fc_host_supported_classes(vha->host) = @@ -6682,9 +6679,6 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) return; } - /* out-of-order frames reassembly */ - nv->firmware_options_3 |= BIT_6|BIT_9; - if (ha->tgt.enable_class_2) { if (vha->flags.init_done) fc_host_supported_classes(vha->host) = -- 1.8.3.1 -- 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 v3 00/10] qla2xxx: Bug fixes for driver.
Hi Bart, Here's updated series of bug fixes for target code in the driver. Please consider this for target-pending. Changes from v2 --> v3 o Added Reviewed-by tag for Christoph to complete series. o Fixed sparse warning for patch to collect ATIO-Q in firmware dump. o Fixed comment style and field for corrupted ATIO patch. o Fixed minor usage of cpu_to_le32() instead of __constant_cpu_to_le32() o Added description for patch which addresses NULL pointer access. Changes from v1 --> v2 o Updated patches to remove braces. o Added description for the patch reqeusted. Thanks, Himanshu Himanshu Madhani (3): qla2xxx: Include ATIO queue in firmware dump when in target mode qla2xxx: Set tcm_qla2xxx version to automatically track qla2xxx version. qla2xxx: Reset reserved field in firmware options to 0. Quinn Tran (7): qla2xxx: Fix wrong IOCB type assumption. qla2xxx: Collect additional information to debug fw dump. qla2xxx: Fix crash due to null pointer access. qla2xxx: Terminate exchange if corruputed. qla2xxx: Reduce exess wait during chip reset qla2xxx: Fix invalid handle erroneous message. qla2xxx: Disable Out-of-order processing by default in Firmware drivers/scsi/qla2xxx/qla_def.h | 3 ++- drivers/scsi/qla2xxx/qla_init.c| 4 +-- drivers/scsi/qla2xxx/qla_isr.c | 4 +++ drivers/scsi/qla2xxx/qla_mbx.c | 27 ++- drivers/scsi/qla2xxx/qla_os.c | 16 --- drivers/scsi/qla2xxx/qla_target.c | 54 +- drivers/scsi/qla2xxx/qla_target.h | 22 +++- drivers/scsi/qla2xxx/qla_tmpl.c| 24 + drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +-- drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 - 10 files changed, 123 insertions(+), 36 deletions(-) -- 1.8.3.1 -- 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
RE: [PATCH] scsi: bfa: Increase requested firmware version to 3.2.5.1
> From: Benjamin Poirier [mailto:benjamin.poir...@gmail.com] On Behalf Of > Benjamin Poirier > Sent: Friday, December 23, 2016 2:01 PM > > bna & bfa firmware version 3.2.5.1 was submitted to linux-firmware on Tue > Feb 17 19:10:20 2015 -0500 in 0ab54ff1dc ("linux-firmware: Add QLogic BR > Series Adapter Firmware"). > > bna was updated to use the newer firmware on Thu, 19 Feb 2015 16:02:32 > -0500 in 3f307c3d70 ("bna: Update the Driver and Firmware Version") > > bfa was not updated. I presume this was an oversight but it broke support > for bfa+bna cards such as the following > 04:00.0 Fibre Channel [0c04]: Brocade Communications Systems, Inc. > 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) > 04:00.1 Fibre Channel [0c04]: Brocade Communications Systems, Inc. > 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) > 04:00.2 Ethernet controller [0200]: Brocade Communications > Systems, > Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) > 04:00.3 Ethernet controller [0200]: Brocade Communications > Systems, > Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) > > Currently, if the bfa module is loaded first, bna fails to probe the > respective > devices with [ 215.026787] bna: QLogic BR-series 10G Ethernet driver - > version: 3.2.25.1 [ 215.043707] bna :04:00.2: bar0 mapped to > c90001fc, len 262144 [ 215.060656] bna :04:00.2: initialization > failed err=1 [ 215.073893] bna :04:00.3: bar0 mapped to > c9000204, len 262144 [ 215.090644] bna :04:00.3: initialization > failed err=1 > > Whereas if bna is loaded first, bfa fails with [ 249.592109] QLogic BR-series > BFA FC/FCOE SCSI driver - version: 3.2.25.0 [ 249.610738] bfa :04:00.0: > Running firmware version is incompatible with the driver version [ > 249.833513] bfa :04:00.0: bfa init failed [ 249.833919] scsi host6: > QLogic > BR-series FC/FCOE Adapter, hwpath: :04:00.0 driver: 3.2.25.0 [ > 249.841446] bfa :04:00.1: Running firmware version is incompatible with > the driver version [ 250.045449] bfa :04:00.1: bfa init failed [ > 250.045962] > scsi host7: QLogic BR-series FC/FCOE Adapter, hwpath: :04:00.1 driver: > 3.2.25.0 > > Increase bfa's requested firmware version. > I only tested that all of the devices probe without error. > > Cc: Rasesh Mody> Reported-by: Tim Ehlers > Signed-off-by: Benjamin Poirier Acked-by: Rasesh Mody Thanks! We also need to bump up the BFA driver version to 3.2.25.1. > --- > drivers/scsi/bfa/bfad.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index > 9d253cb..e70410b 100644 > --- a/drivers/scsi/bfa/bfad.c > +++ b/drivers/scsi/bfa/bfad.c > @@ -64,9 +64,9 @@ int max_rport_logins = > BFA_FCS_MAX_RPORT_LOGINS; > u32 bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size; > u32 *bfi_image_cb, *bfi_image_ct, *bfi_image_ct2; > > -#define BFAD_FW_FILE_CB "cbfw-3.2.3.0.bin" > -#define BFAD_FW_FILE_CT "ctfw-3.2.3.0.bin" > -#define BFAD_FW_FILE_CT2 "ct2fw-3.2.3.0.bin" > +#define BFAD_FW_FILE_CB "cbfw-3.2.5.1.bin" > +#define BFAD_FW_FILE_CT "ctfw-3.2.5.1.bin" > +#define BFAD_FW_FILE_CT2 "ct2fw-3.2.5.1.bin" > > static u32 *bfad_load_fwimg(struct pci_dev *pdev); static void > bfad_free_fwimg(void); > -- > 2.10.2 -- 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
Re: [PATCH v2 02/10] qla2xxx: Include ATIO queue in firmware dump when in target mode
On 12/23/16, 12:32 AM, "Bart Van Assche"wrote: >Sparse reports this because the atio_q_in pointer is declared as uint32_t >__iomem*. >Does this perhaps mean that a readl() call is missing? Ack. Will fix in revised series. N�r��yb�X��ǧv�^�){.n�+{���"�{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj"��!�i
Re: [PATCH v2 04/10] qla2xxx: Reset reserved field in firmware options to 0.
On 12/23/16, 12:37 AM, "Bart Van Assche"wrote: >Please use cpu_to_le32() in new code instead of __constant_cpu_to_le32(). >gcc generates the same code for both conversion functions but the former >function makes source code easier to read. Ack. Will update the patch. >
Re: [PATCH v2 06/10] qla2xxx: Fix crash due to null pointer access.
On 12/23/16, 12:47 AM, "Bart Van Assche"wrote: >This patch needs a more detailed description. There are many changes in this >patch. What changes are the changes that prevent the NULL pointer dereference? >What changes (if any) were made as the result of code inspection? We saw this stack trace on one test setup which never was reproduced. This patch is result of code inspection only and we have not seen this being Reproduced or reported by customer.
Re: [PATCH v2 07/10] qla2xxx: Terminate exchange if corrputed.
On 12/23/16, 1:01 AM, "Bart Van Assche"wrote: >On Wed, 2016-12-21 at 13:57 -0800, Himanshu Madhani wrote: >> diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h >> index f7df01b..b14455e 100644 >> --- a/drivers/scsi/qla2xxx/qla_def.h >> +++ b/drivers/scsi/qla2xxx/qla_def.h >> @@ -1556,7 +1556,8 @@ struct link_statistics { >> struct atio { >> uint8_t entry_type; /* Entry type. */ >> uint8_t entry_count;/* Entry count. */ >> -uint8_t data[58]; >> +uint16_tattr_n_length; >> +uint8_t data[56]; >> uint32_tsignature; >> #define ATIO_PROCESSED 0xDEADDEAD /* Signature */ >> }; > >Are struct atio and/or struct atio_from_isp the description of a firmware >data structure? If so, do all firmware versions initialize the attr_n_length >field or is there a minimum firmware version required for this field to be >valid? Please mention any changed dependencies on the firmware version in the >patch description. Please also fix the typo in the patch title when reposting >this patch ("corrputed"). They represent same data structure from firmware. We will send follow up patch to Clean up redundant structure. > >> +/* This packet is corrupted. The header + payload >> + * can not be trusted. There is no point in passing >> + * it further up. >> + */ > >This is not the proper Linux kernel comment style (see also >Documentation/process/coding-style.rst). Ack. Will update patch with correct format. > >> diff --git a/drivers/scsi/qla2xxx/qla_target.h >> b/drivers/scsi/qla2xxx/qla_target.h >> index f26c5f6..f31d343 100644 >> --- a/drivers/scsi/qla2xxx/qla_target.h >> +++ b/drivers/scsi/qla2xxx/qla_target.h >> @@ -427,13 +427,33 @@ struct atio_from_isp { >> struct { >> uint8_t entry_type;/* Entry type. */ >> uint8_t entry_count; /* Entry count. */ >> -uint8_t data[58]; >> +uint16_t attr_n_length; >> +#define FCP_CMD_LENGTH_MASK 0x0fff >> +#define FCP_CMD_LENGTH_MIN 0x38 >> +uint8_t data[56]; >> uint32_t signature; >> #define ATIO_PROCESSED 0xDEADDEAD /* Signature */ >> } raw; >> } u; >> } __packed; >> >> +static inline int fcpcmd_is_corrupted(struct atio *atio) >> +{ >> +if (atio->entry_type == ATIO_TYPE7 && >> +(le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) < >> +FCP_CMD_LENGTH_MIN)) >> +return 1; >> +else >> +return 0; >> +} > >The above code shows that attr_n_length is a little endian field so please >declare it as little endian where appropriate (__le16 instead of uint16_t). Ack. Will update the patch > >Bart.
[PATCH] scsi: bfa: Increase requested firmware version to 3.2.5.1
bna & bfa firmware version 3.2.5.1 was submitted to linux-firmware on Tue Feb 17 19:10:20 2015 -0500 in 0ab54ff1dc ("linux-firmware: Add QLogic BR Series Adapter Firmware"). bna was updated to use the newer firmware on Thu, 19 Feb 2015 16:02:32 -0500 in 3f307c3d70 ("bna: Update the Driver and Firmware Version") bfa was not updated. I presume this was an oversight but it broke support for bfa+bna cards such as the following 04:00.0 Fibre Channel [0c04]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) 04:00.1 Fibre Channel [0c04]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) 04:00.2 Ethernet controller [0200]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) 04:00.3 Ethernet controller [0200]: Brocade Communications Systems, Inc. 1010/1020/1007/1741 10Gbps CNA [1657:0014] (rev 01) Currently, if the bfa module is loaded first, bna fails to probe the respective devices with [ 215.026787] bna: QLogic BR-series 10G Ethernet driver - version: 3.2.25.1 [ 215.043707] bna :04:00.2: bar0 mapped to c90001fc, len 262144 [ 215.060656] bna :04:00.2: initialization failed err=1 [ 215.073893] bna :04:00.3: bar0 mapped to c9000204, len 262144 [ 215.090644] bna :04:00.3: initialization failed err=1 Whereas if bna is loaded first, bfa fails with [ 249.592109] QLogic BR-series BFA FC/FCOE SCSI driver - version: 3.2.25.0 [ 249.610738] bfa :04:00.0: Running firmware version is incompatible with the driver version [ 249.833513] bfa :04:00.0: bfa init failed [ 249.833919] scsi host6: QLogic BR-series FC/FCOE Adapter, hwpath: :04:00.0 driver: 3.2.25.0 [ 249.841446] bfa :04:00.1: Running firmware version is incompatible with the driver version [ 250.045449] bfa :04:00.1: bfa init failed [ 250.045962] scsi host7: QLogic BR-series FC/FCOE Adapter, hwpath: :04:00.1 driver: 3.2.25.0 Increase bfa's requested firmware version. I only tested that all of the devices probe without error. Cc: Rasesh ModyReported-by: Tim Ehlers Signed-off-by: Benjamin Poirier --- drivers/scsi/bfa/bfad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 9d253cb..e70410b 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -64,9 +64,9 @@ int max_rport_logins = BFA_FCS_MAX_RPORT_LOGINS; u32bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size; u32*bfi_image_cb, *bfi_image_ct, *bfi_image_ct2; -#define BFAD_FW_FILE_CB"cbfw-3.2.3.0.bin" -#define BFAD_FW_FILE_CT"ctfw-3.2.3.0.bin" -#define BFAD_FW_FILE_CT2 "ct2fw-3.2.3.0.bin" +#define BFAD_FW_FILE_CB"cbfw-3.2.5.1.bin" +#define BFAD_FW_FILE_CT"ctfw-3.2.5.1.bin" +#define BFAD_FW_FILE_CT2 "ct2fw-3.2.5.1.bin" static u32 *bfad_load_fwimg(struct pci_dev *pdev); static void bfad_free_fwimg(void); -- 2.10.2 -- 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 RFC net-next 1/5] qed: Add support for hardware offloaded FCoE.
From: Arun EasiThis adds the backbone required for the various HW initalizations which are necessary for the FCoE driver (qedf) for QLogic FastLinQ 4 line of adapters - FW notification, resource initializations, etc. Signed-off-by: Arun Easi Signed-off-by: Yuval Mintz --- drivers/net/ethernet/qlogic/Kconfig | 3 + drivers/net/ethernet/qlogic/qed/Makefile | 1 + drivers/net/ethernet/qlogic/qed/qed.h | 11 + drivers/net/ethernet/qlogic/qed/qed_cxt.c | 98 ++- drivers/net/ethernet/qlogic/qed/qed_cxt.h | 3 + drivers/net/ethernet/qlogic/qed/qed_dcbx.c| 11 + drivers/net/ethernet/qlogic/qed/qed_dcbx.h| 1 + drivers/net/ethernet/qlogic/qed/qed_dev.c | 205 - drivers/net/ethernet/qlogic/qed/qed_dev_api.h | 42 + drivers/net/ethernet/qlogic/qed/qed_fcoe.c| 990 ++ drivers/net/ethernet/qlogic/qed/qed_fcoe.h| 52 ++ drivers/net/ethernet/qlogic/qed/qed_hsi.h | 781 - drivers/net/ethernet/qlogic/qed/qed_hw.c | 3 + drivers/net/ethernet/qlogic/qed/qed_ll2.c | 25 + drivers/net/ethernet/qlogic/qed/qed_ll2.h | 2 +- drivers/net/ethernet/qlogic/qed/qed_main.c| 7 + drivers/net/ethernet/qlogic/qed/qed_mcp.c | 3 + drivers/net/ethernet/qlogic/qed/qed_mcp.h | 1 + drivers/net/ethernet/qlogic/qed/qed_reg_addr.h| 8 + drivers/net/ethernet/qlogic/qed/qed_sp.h | 4 + drivers/net/ethernet/qlogic/qed/qed_sp_commands.c | 3 + include/linux/qed/common_hsi.h| 10 +- include/linux/qed/fcoe_common.h | 715 include/linux/qed/qed_fcoe_if.h | 145 include/linux/qed/qed_if.h| 39 + 25 files changed, 3152 insertions(+), 11 deletions(-) create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.c create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.h create mode 100644 include/linux/qed/fcoe_common.h create mode 100644 include/linux/qed/qed_fcoe_if.h diff --git a/drivers/net/ethernet/qlogic/Kconfig b/drivers/net/ethernet/qlogic/Kconfig index 3cfd105..737b303 100644 --- a/drivers/net/ethernet/qlogic/Kconfig +++ b/drivers/net/ethernet/qlogic/Kconfig @@ -113,4 +113,7 @@ config QED_RDMA config QED_ISCSI bool +config QED_FCOE + bool + endif # NET_VENDOR_QLOGIC diff --git a/drivers/net/ethernet/qlogic/qed/Makefile b/drivers/net/ethernet/qlogic/qed/Makefile index 729e437..e234083 100644 --- a/drivers/net/ethernet/qlogic/qed/Makefile +++ b/drivers/net/ethernet/qlogic/qed/Makefile @@ -7,3 +7,4 @@ qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o qed-$(CONFIG_QED_LL2) += qed_ll2.o qed-$(CONFIG_QED_RDMA) += qed_roce.o qed-$(CONFIG_QED_ISCSI) += qed_iscsi.o qed_ooo.o +qed-$(CONFIG_QED_FCOE) += qed_fcoe.o diff --git a/drivers/net/ethernet/qlogic/qed/qed.h b/drivers/net/ethernet/qlogic/qed/qed.h index 44c184e..cbb4ebc 100644 --- a/drivers/net/ethernet/qlogic/qed/qed.h +++ b/drivers/net/ethernet/qlogic/qed/qed.h @@ -36,6 +36,7 @@ #define QED_WFQ_UNIT 100 #define ISCSI_BDQ_ID(_port_id) (_port_id) +#define FCOE_BDQ_ID(_port_id) ((_port_id) + 2) #define QED_WID_SIZE(1024) #define QED_PF_DEMS_SIZE(4) @@ -143,6 +144,7 @@ struct qed_tunn_update_params { */ enum qed_pci_personality { QED_PCI_ETH, + QED_PCI_FCOE, QED_PCI_ISCSI, QED_PCI_ETH_ROCE, QED_PCI_DEFAULT /* default in shmem */ @@ -180,6 +182,7 @@ enum QED_FEATURE { QED_VF, QED_RDMA_CNQ, QED_VF_L2_QUE, + QED_FCOE_CQ, QED_MAX_FEATURES, }; @@ -197,6 +200,7 @@ enum QED_PORT_MODE { enum qed_dev_cap { QED_DEV_CAP_ETH, + QED_DEV_CAP_FCOE, QED_DEV_CAP_ISCSI, QED_DEV_CAP_ROCE, }; @@ -231,6 +235,10 @@ struct qed_hw_info { u32 part_num[4]; unsigned char hw_mac_addr[ETH_ALEN]; + u64 node_wwn; + u64 port_wwn; + + u16 num_fcoe_conns; struct qed_igu_info *p_igu_info; @@ -386,6 +394,7 @@ struct qed_hwfn { struct qed_ooo_info *p_ooo_info; struct qed_rdma_info*p_rdma_info; struct qed_iscsi_info *p_iscsi_info; + struct qed_fcoe_info*p_fcoe_info; struct qed_pf_paramspf_params; bool b_rdma_enabled_in_prs; @@ -594,11 +603,13 @@ struct qed_dev { u8 protocol; #define IS_QED_ETH_IF(cdev) ((cdev)->protocol == QED_PROTOCOL_ETH) +#define IS_QED_FCOE_IF(cdev)((cdev)->protocol == QED_PROTOCOL_FCOE) /* Callbacks to protocol driver */ union { struct qed_common_cb_ops*common; struct
[PATCH RFC 5/5] qedf: Add FIP request handling
From: "Dupuis, Chad"This patch adds handling for FIP requests and responses that are handled by the driver itself and not by libfcoe. Signed-off-by: Nilesh Javali Signed-off-by: Manish Rangankar Signed-off-by: Saurav Kashyap Signed-off-by: Chad Dupuis --- drivers/scsi/qedf/qedf_fip.c | 267 +++ 1 file changed, 267 insertions(+) create mode 100644 drivers/scsi/qedf/qedf_fip.c diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c new file mode 100644 index 000..4f185c6 --- /dev/null +++ b/drivers/scsi/qedf/qedf_fip.c @@ -0,0 +1,267 @@ +/* + * QLogic FCoE Offload Driver + * Copyright (c) 2016 Cavium Inc. + * + * This software is available under the terms of the GNU General Public License + * (GPL) Version 2, available from the file COPYING in the main directory of + * this source tree. + */ +#include +#include +#include "qedf.h" + +extern const struct qed_fcoe_ops *qed_ops; +/* + * FIP VLAN functions that will eventually move to libfcoe. + */ + +void qedf_fcoe_send_vlan_req(struct qedf_ctx *qedf) +{ + struct sk_buff *skb; + char *eth_fr; + int fr_len; + struct fip_vlan *vlan; +#define MY_FIP_ALL_FCF_MACS((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 }) + static u8 my_fcoe_all_fcfs[ETH_ALEN] = MY_FIP_ALL_FCF_MACS; + + skb = dev_alloc_skb(sizeof(struct fip_vlan)); + if (!skb) + return; + + fr_len = sizeof(*vlan); + eth_fr = (char *)skb->data; + vlan = (struct fip_vlan *)eth_fr; + + memset(vlan, 0, sizeof(*vlan)); + ether_addr_copy(vlan->eth.h_source, qedf->mac); + ether_addr_copy(vlan->eth.h_dest, my_fcoe_all_fcfs); + vlan->eth.h_proto = htons(ETH_P_FIP); + + vlan->fip.fip_ver = FIP_VER_ENCAPS(FIP_VER); + vlan->fip.fip_op = htons(FIP_OP_VLAN); + vlan->fip.fip_subcode = FIP_SC_VL_REQ; + vlan->fip.fip_dl_len = htons(sizeof(vlan->desc) / FIP_BPW); + + vlan->desc.mac.fd_desc.fip_dtype = FIP_DT_MAC; + vlan->desc.mac.fd_desc.fip_dlen = sizeof(vlan->desc.mac) / FIP_BPW; + ether_addr_copy(vlan->desc.mac.fd_mac, qedf->mac); + + vlan->desc.wwnn.fd_desc.fip_dtype = FIP_DT_NAME; + vlan->desc.wwnn.fd_desc.fip_dlen = sizeof(vlan->desc.wwnn) / FIP_BPW; + put_unaligned_be64(qedf->lport->wwnn, >desc.wwnn.fd_wwn); + + skb_put(skb, sizeof(*vlan)); + skb->protocol = htons(ETH_P_FIP); + skb_reset_mac_header(skb); + skb_reset_network_header(skb); + + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Sending FIP VLAN " + "request."); + + if (atomic_read(>link_state) != QEDF_LINK_UP) { + QEDF_WARN(&(qedf->dbg_ctx), "Cannot send vlan request " + "because link is not up.\n"); + + kfree_skb(skb); + return; + } + qed_ops->ll2->start_xmit(qedf->cdev, skb); +} + +static void qedf_fcoe_process_vlan_resp(struct qedf_ctx *qedf, + struct sk_buff *skb) +{ + struct fip_header *fiph; + struct fip_desc *desc; + u16 vid = 0; + ssize_t rlen; + size_t dlen; + + fiph = (struct fip_header *)(((void *)skb->data) + 2 * ETH_ALEN + 2); + + rlen = ntohs(fiph->fip_dl_len) * 4; + desc = (struct fip_desc *)(fiph + 1); + while (rlen > 0) { + dlen = desc->fip_dlen * FIP_BPW; + switch (desc->fip_dtype) { + case FIP_DT_VLAN: + vid = ntohs(((struct fip_vlan_desc *)desc)->fd_vlan); + break; + } + desc = (struct fip_desc *)((char *)desc + dlen); + rlen -= dlen; + } + + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "VLAN response, " + "vid=0x%x.\n", vid); + + if (vid > 0 && qedf->vlan_id != vid) { + qedf_set_vlan_id(qedf, vid); + + /* Inform waiter that it's ok to call fcoe_ctlr_link up() */ + complete(>fipvlan_compl); + } +} + +void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) +{ + struct qedf_ctx *qedf = container_of(fip, struct qedf_ctx, ctlr); + struct ethhdr *eth_hdr; + struct vlan_ethhdr *vlan_hdr; + struct fip_header *fiph; + u16 op, vlan_tci = 0; + u8 sub; + + if (!test_bit(QEDF_LL2_STARTED, >flags)) { + QEDF_WARN(&(qedf->dbg_ctx), "LL2 not started\n"); + kfree_skb(skb); + return; + } + + fiph = (struct fip_header *) ((void *)skb->data + 2 * ETH_ALEN + 2); + eth_hdr = (struct ethhdr *)skb_mac_header(skb); + op = ntohs(fiph->fip_op); + sub = fiph->fip_subcode; + + if (!qedf->vlan_hw_insert) { + vlan_hdr = (struct vlan_ethhdr *)skb_push(skb, sizeof(*vlan_hdr) +
SAS disk from RAID card (no RAID mode) problems
Hello, First message here. After looking for a solution without any luck I have found this list. I hope someone can help me with this. I have an ASUS P6T Deluxe with a MARVELL 88SE63xx SAS RAID controller. There are to identical 400GB SAS SSD drives attached to it. One of them has a Windows 10 installation, the other one Linux. Grub is installed on the second disk. Windows works as expected, but I have problems with the Linux installation: the desktop environment freezes for some second once in a while. This occurs with Mint Cinnamon, OpenSuSe KDE, Ubuntu and Manjaro KDE. All of them are current installations. I'm now working in up to date Manjaro KDE (kernel 4.9.0). When the temporary freezes occur the mouse pointer moves, some windows are updated correctly, other do not and DE stops working. When this happens always I have a system log like this: __ 23/12/16 8:29kernelsas: Enter sas_scsi_recover_host busy: 6 failed: 6 23/12/16 8:29kernelsas: trying to find task 0x8bda8d2bd900 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bda8d2bd900 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bda8d2bd900 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bda8d2bd900 is done 23/12/16 8:29kernelsas: trying to find task 0x8bda8d2bce00 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bda8d2bce00 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bda8d2bce00 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bda8d2bce00 is done 23/12/16 8:29kernelsas: trying to find task 0x8bda8d2bd700 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bda8d2bd700 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bda8d2bd700 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bda8d2bd700 is done 23/12/16 8:29kernelsas: trying to find task 0x8bda8d2bde00 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bda8d2bde00 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bda8d2bde00 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bda8d2bde00 is done 23/12/16 8:29kernelsas: trying to find task 0x8bda8d2bdc00 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bda8d2bdc00 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bda8d2bdc00 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bda8d2bdc00 is done 23/12/16 8:29kernelsas: trying to find task 0x8bdcb0298800 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bdcb0298800 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bdcb0298800 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bdcb0298800 is done 23/12/16 8:29kernelsas: --- Exit sas_scsi_recover_host: busy: 0 failed: 6 tries: 1 23/12/16 8:29kerneldrivers/scsi/mvsas/mv_sas.c 1694:reuse same slot, retry command. 23/12/16 8:29kerneldrivers/scsi/mvsas/mv_sas.c 1694:reuse same slot, retry command. 23/12/16 8:29kerneldrivers/scsi/mvsas/mv_sas.c 1694:reuse same slot, retry command. 23/12/16 8:29kernelsas: Enter sas_scsi_recover_host busy: 2 failed: 2 23/12/16 8:29kernelsas: trying to find task 0x8bdb9453ae00 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bdb9453ae00 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bdb9453ae00 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bdb9453ae00 is done 23/12/16 8:29kernelsas: trying to find task 0x8bdb9453b000 23/12/16 8:29kernelsas: sas_scsi_find_task: aborting task 0x8bdb9453b000 23/12/16 8:29kernelsas: task done but aborted 23/12/16 8:29kernelsas: sas_scsi_find_task: task 0x8bdb9453b000 is done 23/12/16 8:29kernelsas: sas_eh_handle_sas_errors: task 0x8bdb9453b000 is done 23/12/16 8:29kernelsas: --- Exit sas_scsi_recover_host: busy: 0 failed: 2 tries: 1 __ Sometimes shorter sometimes larger. It looks like a controller/drive/cable problem? Any thoughts? Thanks in advance. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to
Re: [4.10, panic, regression] iscsi: null pointer deref at iscsi_tcp_segment_done+0x20d/0x2e0
On Fri, Dec 23, 2016 at 2:00 AM, Christoph Hellwigwrote: > > From: Christoph Hellwig > Date: Fri, 23 Dec 2016 10:57:06 +0100 > Subject: virtio_blk: avoid DMA to stack for the sense buffer > > Most users of BLOCK_PC requests allocate the sense buffer on the stack, > so to avoid DMA to the stack copy them to a field in the heap allocated > virtblk_req structure. Without that any attempt at SCSI passthrough I/O, > including the SG_IO ioctl from userspace will crash the kernel. Note that > this includes running tools like hdparm even when the host does not have > SCSI passthrough enabled. Ugh. This patch is nasty. I think we should just fix blk_execute_rq() instead. But from a quick look, we also have at least sg_scsi_ioctl() and sg_io() doing the same thing. And the SG_IO thing in bsg_ioctl(). And spi_execute() in scsi_transport_spi.c And resp_requests() in scsi_debug.c. So I guess ugly it may need to be, and the rule is that the sense buffer really can be on the stack and you can't DMA to/from it. Comments from others? Linus -- 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 RFC 0/5] Add QLogic FastLinQ FCoE (qedf) driver
From: "Dupuis, Chad"This series introduces the hardware offload FCoE initiator driver for the 41000 Series Converged Network Adapters (579xx chip) by QLogic. The overall driver design includes a common module ('qed') and protocol specific dependent modules ('qedf' for FCoE). This driver uses the kernel components of libfc and libfcoe as is and does not Make use of the open-fcoe user space components. Therefore, no changes will need to be Made to any open-fcoe components. The 'qed' common module, under drivers/net/ethernet/qlogic/qed/, is enhanced with functionality required for FCoE support. Arun Easi (1): qed: Add support for hardware offloaded FCoE. Dupuis, Chad (4): qedf: Add QLogic FastLinQ offload FCoE driver framework. qedf: Add offloaded I/O request functions. qedf: Add offload ELS request handling. qedf: Add FIP request handling.qdevelop_dec13_qedf MAINTAINERS |6 + drivers/net/ethernet/qlogic/Kconfig |3 + drivers/net/ethernet/qlogic/qed/Makefile |1 + drivers/net/ethernet/qlogic/qed/qed.h | 11 + drivers/net/ethernet/qlogic/qed/qed_cxt.c | 98 +- drivers/net/ethernet/qlogic/qed/qed_cxt.h |3 + drivers/net/ethernet/qlogic/qed/qed_dcbx.c| 11 + drivers/net/ethernet/qlogic/qed/qed_dcbx.h|1 + drivers/net/ethernet/qlogic/qed/qed_dev.c | 205 +- drivers/net/ethernet/qlogic/qed/qed_dev_api.h | 42 + drivers/net/ethernet/qlogic/qed/qed_fcoe.c| 990 ++ drivers/net/ethernet/qlogic/qed/qed_fcoe.h| 52 + drivers/net/ethernet/qlogic/qed/qed_hsi.h | 781 - drivers/net/ethernet/qlogic/qed/qed_hw.c |3 + drivers/net/ethernet/qlogic/qed/qed_ll2.c | 25 + drivers/net/ethernet/qlogic/qed/qed_ll2.h |2 +- drivers/net/ethernet/qlogic/qed/qed_main.c|7 + drivers/net/ethernet/qlogic/qed/qed_mcp.c |3 + drivers/net/ethernet/qlogic/qed/qed_mcp.h |1 + drivers/net/ethernet/qlogic/qed/qed_reg_addr.h|8 + drivers/net/ethernet/qlogic/qed/qed_sp.h |4 + drivers/net/ethernet/qlogic/qed/qed_sp_commands.c |3 + drivers/scsi/Kconfig |1 + drivers/scsi/qedf/Kconfig | 11 + drivers/scsi/qedf/Makefile|5 + drivers/scsi/qedf/qedf.h | 555 drivers/scsi/qedf/qedf_attr.c | 165 + drivers/scsi/qedf/qedf_dbg.c | 192 ++ drivers/scsi/qedf/qedf_dbg.h | 153 + drivers/scsi/qedf/qedf_debugfs.c | 472 +++ drivers/scsi/qedf/qedf_els.c | 984 ++ drivers/scsi/qedf/qedf_fip.c | 267 ++ drivers/scsi/qedf/qedf_hsi.h | 427 +++ drivers/scsi/qedf/qedf_io.c | 2303 ++ drivers/scsi/qedf/qedf_main.c | 3519 + drivers/scsi/qedf/qedf_version.h | 15 + include/linux/qed/common_hsi.h| 10 +- include/linux/qed/fcoe_common.h | 715 + include/linux/qed/qed_fcoe_if.h | 145 + include/linux/qed/qed_if.h| 39 + 40 files changed, 12227 insertions(+), 11 deletions(-) create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.c create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.h create mode 100644 drivers/scsi/qedf/Kconfig create mode 100644 drivers/scsi/qedf/Makefile create mode 100644 drivers/scsi/qedf/qedf.h create mode 100644 drivers/scsi/qedf/qedf_attr.c create mode 100644 drivers/scsi/qedf/qedf_dbg.c create mode 100644 drivers/scsi/qedf/qedf_dbg.h create mode 100644 drivers/scsi/qedf/qedf_debugfs.c create mode 100644 drivers/scsi/qedf/qedf_els.c create mode 100644 drivers/scsi/qedf/qedf_fip.c create mode 100644 drivers/scsi/qedf/qedf_hsi.h create mode 100644 drivers/scsi/qedf/qedf_io.c create mode 100644 drivers/scsi/qedf/qedf_main.c create mode 100644 drivers/scsi/qedf/qedf_version.h create mode 100644 include/linux/qed/fcoe_common.h create mode 100644 include/linux/qed/qed_fcoe_if.h -- 1.8.5.6 -- 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] message: fusion: Use kmemdup instead of kmalloc and memcpy
When some other buffer is immediately copied into allocated region. Replace calls to kmalloc followed by a memcpy with a direct call to kmemdup. Signed-off-by: Shyam Saini--- drivers/message/fusion/mptbase.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 1e73064..7b46462 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -5995,13 +5995,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) if (mpt_config(ioc, ) != 0) goto out; - mem = kmalloc(iocpage2sz, GFP_KERNEL); + mem = kmemdup((u8 *)pIoc2, iocpage2sz, GFP_KERNEL); if (!mem) { rc = -ENOMEM; goto out; } - memcpy(mem, (u8 *)pIoc2, iocpage2sz); ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem; mpt_read_ioc_pg_3(ioc); -- 2.7.4 -- 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 RFC 3/5] qedf: Add offloaded I/O request functions.
From: "Dupuis, Chad"This patch adds various I/O requests types that are handled in firmware: - Normal I/O requests - ABTS requests - Cleanup requests - Task management requests It also contains: - I/O request initialization - Firmware completion handling Signed-off-by: Nilesh Javali Signed-off-by: Manish Rangankar Signed-off-by: Saurav Kashyap Signed-off-by: Chad Dupuis --- drivers/scsi/qedf/qedf_hsi.h | 427 drivers/scsi/qedf/qedf_io.c | 2303 ++ 2 files changed, 2730 insertions(+) create mode 100644 drivers/scsi/qedf/qedf_hsi.h create mode 100644 drivers/scsi/qedf/qedf_io.c diff --git a/drivers/scsi/qedf/qedf_hsi.h b/drivers/scsi/qedf/qedf_hsi.h new file mode 100644 index 000..953aa5e --- /dev/null +++ b/drivers/scsi/qedf/qedf_hsi.h @@ -0,0 +1,427 @@ +/* + * QLogic FCoE Offload Driver + * Copyright (c) 2016 Cavium Inc. + * + * This software is available under the terms of the GNU General Public License + * (GPL) Version 2, available from the file COPYING in the main directory of + * this source tree. + */ +#ifndef __QEDF_HSI__ +#define __QEDF_HSI__ +/* + * Add include to common target + */ +#include + +/* + * Add include to common storage target + */ +#include + +/* + * Add include to common fcoe target for both eCore and protocol driver + */ +#include + + +/* + * FCoE CQ element ABTS information + */ +struct fcoe_abts_info { + u8 r_ctl /* R_CTL in the ABTS response frame */; + u8 reserved0; + __le16 rx_id; + __le32 reserved2[2]; + __le32 fc_payload[3] /* ABTS FC payload response frame */; +}; + + +/* + * FCoE class type + */ +enum fcoe_class_type { + FCOE_TASK_CLASS_TYPE_3, + FCOE_TASK_CLASS_TYPE_2, + MAX_FCOE_CLASS_TYPE +}; + + +/* + * FCoE CMDQ element control information + */ +struct fcoe_cmdqe_control { + __le16 conn_id; + u8 num_additional_cmdqes; + u8 cmdType; + /* true for ABTS request cmdqe. used in Target mode */ +#define FCOE_CMDQE_CONTROL_ABTSREQCMD_MASK 0x1 +#define FCOE_CMDQE_CONTROL_ABTSREQCMD_SHIFT 0 +#define FCOE_CMDQE_CONTROL_RESERVED1_MASK 0x7F +#define FCOE_CMDQE_CONTROL_RESERVED1_SHIFT 1 + u8 reserved2[4]; +}; + +/* + * FCoE control + payload CMDQ element + */ +struct fcoe_cmdqe { + struct fcoe_cmdqe_control hdr; + u8 fc_header[24]; + __le32 fcp_cmd_payload[8]; +}; + + + +/* + * FCP RSP flags + */ +struct fcoe_fcp_rsp_flags { + u8 flags; +#define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID_MASK 0x1 +#define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID_SHIFT 0 +#define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID_MASK 0x1 +#define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID_SHIFT 1 +#define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER_MASK 0x1 +#define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER_SHIFT2 +#define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER_MASK0x1 +#define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER_SHIFT 3 +#define FCOE_FCP_RSP_FLAGS_FCP_CONF_REQ_MASK 0x1 +#define FCOE_FCP_RSP_FLAGS_FCP_CONF_REQ_SHIFT 4 +#define FCOE_FCP_RSP_FLAGS_FCP_BIDI_FLAGS_MASK 0x7 +#define FCOE_FCP_RSP_FLAGS_FCP_BIDI_FLAGS_SHIFT5 +}; + +/* + * FCoE CQ element response information + */ +struct fcoe_cqe_rsp_info { + struct fcoe_fcp_rsp_flags rsp_flags; + u8 scsi_status_code; + __le16 retry_delay_timer; + __le32 fcp_resid; + __le32 fcp_sns_len; + __le32 fcp_rsp_len; + __le16 rx_id; + u8 fw_error_flags; +#define FCOE_CQE_RSP_INFO_FW_UNDERRUN_MASK 0x1 /* FW detected underrun */ +#define FCOE_CQE_RSP_INFO_FW_UNDERRUN_SHIFT 0 +#define FCOE_CQE_RSP_INFO_RESREVED_MASK 0x7F +#define FCOE_CQE_RSP_INFO_RESREVED_SHIFT1 + u8 reserved; + __le32 fw_residual /* Residual bytes calculated by FW */; +}; + +/* + * FCoE CQ element Target completion information + */ +struct fcoe_cqe_target_info { + __le16 rx_id; + __le16 reserved0; + __le32 reserved1[5]; +}; + +/* + * FCoE error/warning reporting entry + */ +struct fcoe_err_report_entry { + __le32 err_warn_bitmap_lo /* Error bitmap lower 32 bits */; + __le32 err_warn_bitmap_hi /* Error bitmap higher 32 bits */; + /* Buffer offset the beginning of the Sequence last transmitted */ + __le32 tx_buf_off; + /* Buffer offset from the beginning of the Sequence last received */ + __le32 rx_buf_off; + __le16 rx_id /* RX_ID of the associated task */; + __le16 reserved1; + __le32 reserved2; +}; + +/* + * FCoE CQ element middle path information + */ +struct fcoe_cqe_midpath_info { + __le32 data_placement_size; + __le16 rx_id; + __le16 reserved0; + __le32 reserved1[4]; +}; + +/* + * FCoE CQ element unsolicited information + */ +struct fcoe_unsolic_info { + /* BD information: Physical address and opaque data */ + struct scsi_bd
[PATCH RFC 4/5] qedf: Add offload ELS request handling.
From: "Dupuis, Chad"This patch adds support for ELS requests that are handled by the firmware for offloaded sessions. Signed-off-by: Nilesh Javali Signed-off-by: Manish Rangankar Signed-off-by: Saurav Kashyap Signed-off-by: Chad Dupuis --- drivers/scsi/qedf/qedf_els.c | 984 +++ 1 file changed, 984 insertions(+) create mode 100644 drivers/scsi/qedf/qedf_els.c diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c new file mode 100644 index 000..98a80b3 --- /dev/null +++ b/drivers/scsi/qedf/qedf_els.c @@ -0,0 +1,984 @@ +/* + * QLogic FCoE Offload Driver + * Copyright (c) 2016 Cavium Inc. + * + * This software is available under the terms of the GNU General Public License + * (GPL) Version 2, available from the file COPYING in the main directory of + * this source tree. + */ +#include "qedf.h" + +/* It's assumed that the lock is held when calling this function. */ +static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, + void *data, uint32_t data_len, + void (*cb_func)(struct qedf_els_cb_arg *cb_arg), + struct qedf_els_cb_arg *cb_arg, uint32_t timer_msec) +{ + struct qedf_ctx *qedf = fcport->qedf; + struct fc_lport *lport = qedf->lport; + struct qedf_ioreq *els_req; + struct qedf_mp_req *mp_req; + struct fc_frame_header *fc_hdr; + struct fcoe_task_context *task; + int rc = 0; + uint32_t did, sid; + uint16_t xid; + uint32_t start_time = jiffies / HZ; + uint32_t current_time; + + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending ELS\n"); + + rc = fc_remote_port_chkready(fcport->rport); + if (rc) { + QEDF_ERR(&(qedf->dbg_ctx), "els 0x%x: rport not ready\n", op); + rc = -EAGAIN; + goto els_err; + } + if (lport->state != LPORT_ST_READY || !(lport->link_up)) { + QEDF_ERR(&(qedf->dbg_ctx), "els 0x%x: link is not ready\n", + op); + rc = -EAGAIN; + goto els_err; + } + + if (!(test_bit(QEDF_RPORT_SESSION_READY, >flags))) { + QEDF_ERR(&(qedf->dbg_ctx), "els 0x%x: fcport not ready\n", op); + rc = -EINVAL; + goto els_err; + } + +retry_els: + els_req = qedf_alloc_cmd(fcport, QEDF_ELS); + if (!els_req) { + current_time = jiffies / HZ; + if ((current_time - start_time) > 10) { + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, + "els: Failed els 0x%x\n", op); + rc = -ENOMEM; + goto els_err; + } + mdelay(20 * USEC_PER_MSEC); + goto retry_els; + } + + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "initiate_els els_req = " + "0x%p cb_arg = %p xid = %x\n", els_req, cb_arg, + els_req->xid); + els_req->sc_cmd = NULL; + els_req->cmd_type = QEDF_ELS; + els_req->fcport = fcport; + els_req->cb_func = cb_func; + cb_arg->io_req = els_req; + cb_arg->op = op; + els_req->cb_arg = cb_arg; + els_req->data_xfer_len = data_len; + + /* Record which cpu this request is associated with */ + els_req->cpu = smp_processor_id(); + qedf_inc_percpu_requests(els_req->cpu); + + mp_req = (struct qedf_mp_req *)&(els_req->mp_req); + rc = qedf_init_mp_req(els_req); + if (rc) { + QEDF_ERR(&(qedf->dbg_ctx), "ELS MP request init failed\n"); + kref_put(_req->refcount, qedf_release_cmd); + goto els_err; + } else { + rc = 0; + } + + /* Fill ELS Payload */ + if ((op >= ELS_LS_RJT) && (op <= ELS_AUTH_ELS)) { + memcpy(mp_req->req_buf, data, data_len); + } else { + QEDF_ERR(&(qedf->dbg_ctx), "Invalid ELS op 0x%x\n", op); + els_req->cb_func = NULL; + els_req->cb_arg = NULL; + kref_put(_req->refcount, qedf_release_cmd); + rc = -EINVAL; + } + + if (rc) + goto els_err; + + /* Fill FC header */ + fc_hdr = &(mp_req->req_fc_hdr); + + did = fcport->rdata->ids.port_id; + sid = fcport->sid; + + __fc_fill_fc_hdr(fc_hdr, FC_RCTL_ELS_REQ, sid, did, + FC_TYPE_ELS, FC_FC_FIRST_SEQ | FC_FC_END_SEQ | + FC_FC_SEQ_INIT, 0); + + /* Obtain exchange id */ + xid = els_req->xid; + + /* Initialize task context for this IO request */ + task = qedf_get_task_mem(>tasks, xid); + qedf_init_mp_task(els_req, task); + + /* Put timer on original I/O request */ + if (timer_msec) +
Re: [PATCH v2 03/11] lpfc: Deprecate lpfc_soft_wwn parameter
I competes, without reasonable solutions to resolve which should be what at what time, with things like fabric-assigned wwn's as well as platform-oem name assignments via platform mechanisms. Too many admin planes competing. -- james On 12/22/2016 2:00 PM, Sebastian Herbszt wrote: James Smart wrote: Deprecate lpfc_soft_wwn parameter. No longer allow override of hw-assigned wwns Signed-off-by: Dick KennedySigned-off-by: James Smart Any reason to remove this functionality? I was actually using it. Sebastian -- 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
Re: [PATCH V6 00/11] megaraid_sas: Updates for scsi-next
On 23.12.2016 16:24, Tomas Henzl wrote: > On 23.12.2016 02:19, Sasikumar Chandrasekaran wrote: >> Sasikumar Chandrasekaran (11): >> megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid >> Controllers >> megaraid_sas: 128 MSIX Support >> megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid >> Controllers >> megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and >> IO Coalescing >> megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID >> 1/10 Writes >> megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid >> Controllers >> megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers >> Capabilities >> megaraid_sas: Enable or Disable Fast path based on the PCI Threshold >> Bandwidth >> megaraid_sas: ldio_outstanding variable is not decremented in >> completion path >> megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid >> Controllers >> megaraid_sas: driver version upgrade >> >> drivers/scsi/megaraid/megaraid_sas.h| 139 -- >> drivers/scsi/megaraid/megaraid_sas_base.c | 240 +++-- >> drivers/scsi/megaraid/megaraid_sas_fp.c | 341 +++-- >> drivers/scsi/megaraid/megaraid_sas_fusion.c | 750 >> +++- >> drivers/scsi/megaraid/megaraid_sas_fusion.h | 364 -- >> 5 files changed, 1557 insertions(+), 277 deletions(-) >> > I finished review of this set and ack-ed it. > There still is a large amount (~1600) of checkpatch errors, > ERROR: DOS line endings > ERROR: trailing whitespace > ... > I complained about this several times and was hoping that Sasi would fix all > that in V6 > but for some reason it hasn't been fixed. > I don't want to stop the series only because of formatting issues, > so well ok > -tm I looked into this once again and I think now, that the issue with the 'line endings' is an issue on my side. I'm sorry for that and please ignore my previous comment. -tm > > -- > 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 -- 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
Re: [PATCH V6 00/11] megaraid_sas: Updates for scsi-next
On 23.12.2016 02:19, Sasikumar Chandrasekaran wrote: > Sasikumar Chandrasekaran (11): > megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid > Controllers > megaraid_sas: 128 MSIX Support > megaraid_sas: EEDP Escape Mode Support for SAS3.5 Generic Megaraid > Controllers > megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and > IO Coalescing > megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID > 1/10 Writes > megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid > Controllers > megaraid_sas: Add the Support for SAS3.5 Generic Megaraid Controllers > Capabilities > megaraid_sas: Enable or Disable Fast path based on the PCI Threshold > Bandwidth > megaraid_sas: ldio_outstanding variable is not decremented in > completion path > megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid > Controllers > megaraid_sas: driver version upgrade > > drivers/scsi/megaraid/megaraid_sas.h| 139 -- > drivers/scsi/megaraid/megaraid_sas_base.c | 240 +++-- > drivers/scsi/megaraid/megaraid_sas_fp.c | 341 +++-- > drivers/scsi/megaraid/megaraid_sas_fusion.c | 750 > +++- > drivers/scsi/megaraid/megaraid_sas_fusion.h | 364 -- > 5 files changed, 1557 insertions(+), 277 deletions(-) > I finished review of this set and ack-ed it. There still is a large amount (~1600) of checkpatch errors, ERROR: DOS line endings ERROR: trailing whitespace ... I complained about this several times and was hoping that Sasi would fix all that in V6 but for some reason it hasn't been fixed. I don't want to stop the series only because of formatting issues, so well ok -tm -- 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
Re: [PATCH V6 08/11] megaraid_sas: Enable or Disable Fast path based on the PCI Threshold Bandwidth
On 23.12.2016 02:19, Sasikumar Chandrasekaran wrote: > Large SEQ IO workload should sent as non fast path commands > > This patch is depending on patch 7 > > 80 chars per line limit is taken care around VD_EXT_DEBUG macro. > > Signed-off-by: Sasikumar ChandrasekaranReviewed-by: Tomas Henzl -- 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
Re: [PATCH V6 10/11] megaraid_sas: Implement the PD Map support for SAS3.5 Generic Megaraid Controllers
On 23.12.2016 02:19, Sasikumar Chandrasekaran wrote: > Update Linux driver to use new pdTargetId field for JBOD target ID > > This patch is depending on patch 9 and same as V5 > > Signed-off-by: Sasikumar ChandrasekaranReviewed-by: Tomas Henzl -- 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
Re: [PATCH V6 06/11] megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers
On 23.12.2016 02:19, Sasikumar Chandrasekaran wrote: > SAS3.5 Generic Megaraid Controllers FW will support new dynamic RaidMap to > have different > sizes for different number of supported VDs. > > This patch is depending on patch 5 > > 80 chars per line limit is taken care around VD_EXT_DEBUG macro. > NULL pointer check for desc_table has been removed. > Few code indentation issues fixed. > > Signed-off-by: Sasikumar ChandrasekaranReviewed-by: Tomas Henzl -- 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
Re: [PATCH V6 02/11] megaraid_sas: 128 MSIX Support
On 23.12.2016 02:19, Sasikumar Chandrasekaran wrote: > SAS3.5 Generic Megaraid based Controllers will have the support for 128 MSI-X > vectors, > resulting in the need to support 128 reply queues > > This patch is depending on patch 1 and same as V5 > > Signed-off-by: Sasikumar ChandrasekaranReviewed-by: Tomas Henzl -- 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
Re: JMS56x not working reliably with uas driver
On Fri, 23 Dec 2016, George Cherian wrote: > >> 2) On disconnect I am seeing the following issue > >> > >>scsi host4: uas_post_reset: alloc streams error -19 after reset > >>sd 4:0:0:0: [sdb] Synchronizing SCSI cache > >> > >> This is more fatal because after these messages the USB port becomes > >> unusable. Even an lsusb invocation hangs for ever. > > This problem looks pretty simple. uas doesn't check properly to see if > > the device was disconnected following a reset. > > > > Try changing the line in uas_post_reset() that says: > > > > if (devinfo->shutdown) > > > > to: > > > > if (devinfo->shutdown || > > devinfo->udev->state == USB_STATE_NOTATTACHED) > Yes this works for me but with a little bit change as follows, But am > not sure whether we should goto reset_scsi in case of shutdown. > Please advice. > > diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c > index 5ef014b..24db3fd 100644 > --- a/drivers/usb/storage/uas.c > +++ b/drivers/usb/storage/uas.c > @@ -1072,8 +1072,8 @@ static int uas_post_reset(struct usb_interface *intf) > unsigned long flags; > int err; > > - if (devinfo->shutdown) > - return 0; > + if (devinfo->shutdown || devinfo->udev->state == > USB_STATE_NOTATTACHED) > + goto reset_scsi; > > err = uas_configure_endpoints(devinfo); > if (err) { > @@ -1083,6 +1083,7 @@ static int uas_post_reset(struct usb_interface *intf) > return 1; > } > > +reset_scsi: > spin_lock_irqsave(shost->host_lock, flags); > scsi_report_bus_reset(shost, 0); > spin_unlock_irqrestore(shost->host_lock, flags); As far as I can tell, adding the "goto reset_scsi" line does not help at all. There's no reason to report that the bus has been reset after the device is gone. Alan Stern -- 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] drivers: scsi: esas2r: Use setup_timer() and mod_timer()
Use setup_timer instead of structure field assignments to initialize a timer. mod_timer is a more efficient way to update the expire field of an active timer (if the timer is inactive it will be activated) Signed-off-by: Shyam Saini--- drivers/scsi/esas2r/esas2r_main.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c index 5092c82..6ee4315 100644 --- a/drivers/scsi/esas2r/esas2r_main.c +++ b/drivers/scsi/esas2r/esas2r_main.c @@ -1635,14 +1635,8 @@ static void esas2r_timer_callback(unsigned long context); void esas2r_kickoff_timer(struct esas2r_adapter *a) { - init_timer(>timer); - - a->timer.function = esas2r_timer_callback; - a->timer.data = (unsigned long)a; - a->timer.expires = jiffies + - msecs_to_jiffies(100); - - add_timer(>timer); + setup_timer(>timer, esas2r_timer_callback, (unsigned long)a); + mod_timer(>timer, jiffies + msecs_to_jiffies(100)); } static void esas2r_timer_callback(unsigned long context) -- 2.7.4 -- 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
Hello
Hello, Complement of the Season, I'M Anessa female 25 years old single, I am contacting you because I will be relocating to your country. I will send you my photos and also tell you much about my self. Thanks. Sincerely yours Anessa. -- 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
Re: [4.10, panic, regression] iscsi: null pointer deref at iscsi_tcp_segment_done+0x20d/0x2e0
On Thu, Dec 22, 2016 at 04:03:56PM -0800, Chris Leech wrote: > Of course, looks like I've screwed up my bisect run on this so I'm still > taking a look. It triggers for me with 'hdparm -B /dev/vda' but may > also depend on kernel configuration. > > I started with the fedora rawhide config with a lot of debug on and > trimed it down with a localmodconfig run in the VM to speed up rebuilds. I think the configuration dependency is CONFIG_HAVE_ARCH_VMAP_STACK, I've just reproduce the issue with it, and the backtrace points to __virtblk_add_req when setting up the sense buffer. And it turns out that blk_execute_rq tries to do I/O to the on-stack sense buffer. At least SCSI always has a kmalloced sense buffer, so I guess we'll need something similar for virtio_blk for now. For 4.11 I plan to rework how BLOCK_PC commands work entirely, so hopefull we can make the sense buffer handling a lot less wasteful. --- >From 0a77bc424ed907c1e99b4756bb498370b498183a Mon Sep 17 00:00:00 2001 From: Christoph HellwigDate: Fri, 23 Dec 2016 10:57:06 +0100 Subject: virtio_blk: avoid DMA to stack for the sense buffer Most users of BLOCK_PC requests allocate the sense buffer on the stack, so to avoid DMA to the stack copy them to a field in the heap allocated virtblk_req structure. Without that any attempt at SCSI passthrough I/O, including the SG_IO ioctl from userspace will crash the kernel. Note that this includes running tools like hdparm even when the host does not have SCSI passthrough enabled. Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 5545a67..3c3b8f6 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -56,6 +56,7 @@ struct virtblk_req { struct virtio_blk_outhdr out_hdr; struct virtio_scsi_inhdr in_hdr; u8 status; + u8 sense[SCSI_SENSE_BUFFERSIZE]; struct scatterlist sg[]; }; @@ -102,7 +103,8 @@ static int __virtblk_add_req(struct virtqueue *vq, } if (type == cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_SCSI_CMD)) { - sg_init_one(, vbr->req->sense, SCSI_SENSE_BUFFERSIZE); + memcpy(vbr->sense, vbr->req->sense, SCSI_SENSE_BUFFERSIZE); + sg_init_one(, vbr->sense, SCSI_SENSE_BUFFERSIZE); sgs[num_out + num_in++] = sg_init_one(, >in_hdr, sizeof(vbr->in_hdr)); sgs[num_out + num_in++] = -- 2.1.4 -- 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
Re: [PATCH v2 07/10] qla2xxx: Terminate exchange if corrputed.
On Wed, 2016-12-21 at 13:57 -0800, Himanshu Madhani wrote: > diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h > index f7df01b..b14455e 100644 > --- a/drivers/scsi/qla2xxx/qla_def.h > +++ b/drivers/scsi/qla2xxx/qla_def.h > @@ -1556,7 +1556,8 @@ struct link_statistics { > struct atio { > uint8_t entry_type; /* Entry type. */ > uint8_t entry_count;/* Entry count. */ > - uint8_t data[58]; > + uint16_tattr_n_length; > + uint8_t data[56]; > uint32_tsignature; > #define ATIO_PROCESSED 0xDEADDEAD/* Signature */ > }; Are struct atio and/or struct atio_from_isp the description of a firmware data structure? If so, do all firmware versions initialize the attr_n_length field or is there a minimum firmware version required for this field to be valid? Please mention any changed dependencies on the firmware version in the patch description. Please also fix the typo in the patch title when reposting this patch ("corrputed"). > + /* This packet is corrupted. The header + payload > + * can not be trusted. There is no point in passing > + * it further up. > + */ This is not the proper Linux kernel comment style (see also Documentation/process/coding-style.rst). > diff --git a/drivers/scsi/qla2xxx/qla_target.h > b/drivers/scsi/qla2xxx/qla_target.h > index f26c5f6..f31d343 100644 > --- a/drivers/scsi/qla2xxx/qla_target.h > +++ b/drivers/scsi/qla2xxx/qla_target.h > @@ -427,13 +427,33 @@ struct atio_from_isp { > struct { > uint8_t entry_type;/* Entry type. */ > uint8_t entry_count; /* Entry count. */ > - uint8_t data[58]; > + uint16_t attr_n_length; > +#define FCP_CMD_LENGTH_MASK 0x0fff > +#define FCP_CMD_LENGTH_MIN 0x38 > + uint8_t data[56]; > uint32_t signature; > #define ATIO_PROCESSED 0xDEADDEAD/* Signature */ > } raw; > } u; > } __packed; > > +static inline int fcpcmd_is_corrupted(struct atio *atio) > +{ > + if (atio->entry_type == ATIO_TYPE7 && > + (le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) < > + FCP_CMD_LENGTH_MIN)) > + return 1; > + else > + return 0; > +} The above code shows that attr_n_length is a little endian field so please declare it as little endian where appropriate (__le16 instead of uint16_t). Bart.
Re: [PATCH v2 06/10] qla2xxx: Fix crash due to null pointer access.
On Wed, 2016-12-21 at 13:57 -0800, Himanshu Madhani wrote: > From: Quinn Tran> > This patch fixes crash due to NULL pointer access. > > Following stack trace will be seen. > > [1469877.797315] Call Trace: > [1469877.799940] [] qla2x00_mem_alloc+0xb09/0x10c0 > [qla2xxx] > [1469877.806980] [] qla2x00_probe_one+0x86a/0x1b50 > [qla2xxx] > [1469877.814013] [] ? __pm_runtime_resume+0x51/0xa0 > [1469877.820265] [] ? _raw_spin_lock_irqsave+0x25/0x90 > [1469877.826776] [] ? _raw_spin_unlock_irqrestore+0x6d/0x80 > [1469877.833720] [] ? preempt_count_sub+0xb1/0x100 > [1469877.839885] [] ? _raw_spin_unlock_irqrestore+0x4c/0x80 > [1469877.846830] [] local_pci_probe+0x4c/0xb0 > [1469877.852562] [] ? preempt_count_sub+0xb1/0x100 > [1469877.858727] [] pci_call_probe+0x89/0xb0 This patch needs a more detailed description. There are many changes in this patch. What changes are the changes that prevent the NULL pointer dereference? What changes (if any) were made as the result of code inspection? Bart.
Re: [PATCH v2 04/10] qla2xxx: Reset reserved field in firmware options to 0.
On Wed, 2016-12-21 at 13:57 -0800, Himanshu Madhani wrote: > During NVRAM initialization in target mode, reset reserved > fields in firmware options to Zero (BIT 15) > > Signed-off-by: Himanshu Madhani> Signed-off-by: Giridhar Malavali > --- > drivers/scsi/qla2xxx/qla_target.c | 17 - > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/qla2xxx/qla_target.c > b/drivers/scsi/qla2xxx/qla_target.c > index b9c559c..5037b51 100644 > --- a/drivers/scsi/qla2xxx/qla_target.c > +++ b/drivers/scsi/qla2xxx/qla_target.c > @@ -6539,6 +6539,14 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) > > /* Disable Full Login after LIP */ > nv->host_p &= cpu_to_le32(~BIT_10); > + > + /* > + * clear BIT 15 explicitly as we have seen at least > + * a couple of instances where this was set and this > + * was causing the firmware to not be initialized. > + */ > + nv->firmware_options_1 &= > + __constant_cpu_to_le32(~BIT_15); > /* Enable target PRLI control */ > nv->firmware_options_2 |= cpu_to_le32(BIT_14); > } else { > @@ -6623,11 +6631,18 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) > /* Disable ini mode, if requested */ > if (!qla_ini_mode_enabled(vha)) > nv->firmware_options_1 |= cpu_to_le32(BIT_5); > - > /* Disable Full Login after LIP */ > nv->firmware_options_1 &= cpu_to_le32(~BIT_13); > /* Enable initial LIP */ > nv->firmware_options_1 &= cpu_to_le32(~BIT_9); > + /* > + * clear BIT 15 explicitly as we have seen at > + * least a couple of instances where this was set > + * and this was causing the firmware to not be > + * initialized. > + */ > + nv->firmware_options_1 &= > + __constant_cpu_to_le32(~BIT_15); > if (ql2xtgt_tape_enable) > /* Enable FC tape support */ > nv->firmware_options_2 |= cpu_to_le32(BIT_12); Hello Himanshu, Please use cpu_to_le32() in new code instead of __constant_cpu_to_le32(). gcc generates the same code for both conversion functions but the former function makes source code easier to read. Bart.
Re: [4.10, panic, regression] iscsi: null pointer deref at iscsi_tcp_segment_done+0x20d/0x2e0
On Fri, Dec 23, 2016 at 02:32:41AM -0500, Johannes Weiner wrote: > On Thu, Dec 22, 2016 at 12:22:27PM -0800, Hugh Dickins wrote: > > On Wed, 21 Dec 2016, Linus Torvalds wrote: > > > On Wed, Dec 21, 2016 at 9:13 PM, Dave Chinnerwrote: > > > > I unmounted the fs, mkfs'd it again, ran the > > > > workload again and about a minute in this fired: > > > > > > > > [628867.607417] [ cut here ] > > > > [628867.608603] WARNING: CPU: 2 PID: 16925 at mm/workingset.c:461 > > > > shadow_lru_isolate+0x171/0x220 > > > > > > Well, part of the changes during the merge window were the shadow > > > entry tracking changes that came in through Andrew's tree. Adding > > > Johannes Weiner to the participants. > > > > > > > Now, this workload does not touch the page cache at all - it's > > > > entirely an XFS metadata workload, so it should not really be > > > > affecting the working set code. > > > > > > Well, I suspect that anything that creates memory pressure will end up > > > triggering the working set code, so .. > > > > > > That said, obviously memory corruption could be involved and result in > > > random issues too, but I wouldn't really expect that in this code. > > > > > > It would probably be really useful to get more data points - is the > > > problem reliably in this area, or is it going to be random and all > > > over the place. > > > > Data point: kswapd got WARNING on mm/workingset.c:457 in shadow_lru_isolate, > > soon followed by NULL pointer deref in list_lru_isolate, one time when > > I tried out Sunday's git tree. Not seen since, I haven't had time to > > investigate, just set it aside as something to worry about if it happens > > again. But it looks like shadow_lru_isolate() has issues beyond Dave's > > case (I've no XFS and no iscsi), suspect unrelated to his other problems. > > This seems consistent with what Dave observed: we encounter regular > pages in radix tree nodes on the shadow LRU that should only contain > nodes full of exceptional shadow entries. It could be an issue in the > new slot replacement code and the node tracking callback. Both encounters seem to indicate use-after-free. Dave's node didn't warn about an unexpected node->count / node->exceptional state, but had entries that were inconsistent with that. Hugh got the counter warning but crashed on a list_head that's not NULLed in a live node. workingset_update_node() should be called on page cache radix tree leaf nodes that go empty. I must be missing an update_node callback where a leaf node gets freed somewhere. -- 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
Re: [PATCH v2 02/10] qla2xxx: Include ATIO queue in firmware dump when in target mode
On Wed, 2016-12-21 at 13:57 -0800, Himanshu Madhani wrote: > @@ -676,6 +688,18 @@ static inline void (*qla27xx_read_vector(uint > width))(void __iomem*, void *, ulo > count++; > } > } > + } else if (QLA_TGT_MODE_ENABLED() && > + ent->t274.queue_type == T274_QUEUE_TYPE_ATIO_SHAD) { > + struct qla_hw_data *ha = vha->hw; > + struct atio *atr = ha->tgt.atio_ring_ptr; > + > + if (atr || !buf) { > + qla27xx_insert16(0, buf, len); > + qla27xx_insert16(1, buf, len); > + qla27xx_insert32(ha->tgt.atio_q_in ? > + *ha->tgt.atio_q_in : 0, buf, len); > + count++; > + } > } else { > ql_dbg(ql_dbg_misc, vha, 0xd02f, > "%s: unknown queue %x\n", __func__, ent->t274.queue_type); Hello Himanshu, This patch introduces a new sparse warning for *ha->tgt.atio_q_in: drivers/scsi/qla2xxx/qla_tmpl.c:700:37: warning: dereference of noderef expression Sparse reports this because the atio_q_in pointer is declared as uint32_t __iomem*. Does this perhaps mean that a readl() call is missing? Bart.N�r��yb�X��ǧv�^�){.n�+{���"�{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj"��!�i