Skip to content

Commit 126195c

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Twelve patches mostly small but obvious fixes or cosmetic but small updates" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: qla2xxx: Fix Nport ID display value scsi: qla2xxx: Fix N2N link up fail scsi: qla2xxx: Fix N2N link reset scsi: qla2xxx: Optimize NPIV tear down process scsi: qla2xxx: Fix stale mem access on driver unload scsi: qla2xxx: Fix unbound sleep in fcport delete path. scsi: qla2xxx: Silence fwdump template message scsi: hisi_sas: Make three functions static scsi: megaraid: disable device when probe failed after enabled device scsi: storvsc: setup 1:1 mapping between hardware queue and CPU queue scsi: qedf: Remove always false 'tmp_prio < 0' statement scsi: ufs: skip shutdown if hba is not powered scsi: bnx2fc: Handle scope bits when array returns BUSY or TSF
2 parents 4f11918 + 0aabb6b commit 126195c

File tree

15 files changed

+193
-80
lines changed

15 files changed

+193
-80
lines changed

drivers/scsi/bnx2fc/bnx2fc_io.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
19231923
struct fcoe_fcp_rsp_payload *fcp_rsp;
19241924
struct bnx2fc_rport *tgt = io_req->tgt;
19251925
struct scsi_cmnd *sc_cmd;
1926+
u16 scope = 0, qualifier = 0;
19261927

19271928
/* scsi_cmd_cmpl is called with tgt lock held */
19281929

@@ -1990,12 +1991,30 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
19901991

19911992
if (io_req->cdb_status == SAM_STAT_TASK_SET_FULL ||
19921993
io_req->cdb_status == SAM_STAT_BUSY) {
1993-
/* Set the jiffies + retry_delay_timer * 100ms
1994-
for the rport/tgt */
1995-
tgt->retry_delay_timestamp = jiffies +
1996-
fcp_rsp->retry_delay_timer * HZ / 10;
1994+
/* Newer array firmware with BUSY or
1995+
* TASK_SET_FULL may return a status that needs
1996+
* the scope bits masked.
1997+
* Or a huge delay timestamp up to 27 minutes
1998+
* can result.
1999+
*/
2000+
if (fcp_rsp->retry_delay_timer) {
2001+
/* Upper 2 bits */
2002+
scope = fcp_rsp->retry_delay_timer
2003+
& 0xC000;
2004+
/* Lower 14 bits */
2005+
qualifier = fcp_rsp->retry_delay_timer
2006+
& 0x3FFF;
2007+
}
2008+
if (scope > 0 && qualifier > 0 &&
2009+
qualifier <= 0x3FEF) {
2010+
/* Set the jiffies +
2011+
* retry_delay_timer * 100ms
2012+
* for the rport/tgt
2013+
*/
2014+
tgt->retry_delay_timestamp = jiffies +
2015+
(qualifier * HZ / 10);
2016+
}
19972017
}
1998-
19992018
}
20002019
if (io_req->fcp_resid)
20012020
scsi_set_resid(sc_cmd, io_req->fcp_resid);

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3683,7 +3683,7 @@ void hisi_sas_debugfs_work_handler(struct work_struct *work)
36833683
}
36843684
EXPORT_SYMBOL_GPL(hisi_sas_debugfs_work_handler);
36853685

3686-
void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)
3686+
static void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)
36873687
{
36883688
struct device *dev = hisi_hba->dev;
36893689
int i;
@@ -3705,7 +3705,7 @@ void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)
37053705
devm_kfree(dev, hisi_hba->debugfs_port_reg[i]);
37063706
}
37073707

3708-
int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
3708+
static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
37093709
{
37103710
const struct hisi_sas_hw *hw = hisi_hba->hw;
37113711
struct device *dev = hisi_hba->dev;
@@ -3796,7 +3796,7 @@ int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
37963796
return -ENOMEM;
37973797
}
37983798

3799-
void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba)
3799+
static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba)
38003800
{
38013801
hisi_hba->debugfs_bist_dentry =
38023802
debugfs_create_dir("bist", hisi_hba->debugfs_dir);

drivers/scsi/megaraid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4183,11 +4183,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
41834183
*/
41844184
if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
41854185
pdev->subsystem_device == 0xC000)
4186-
return -ENODEV;
4186+
goto out_disable_device;
41874187
/* Now check the magic signature byte */
41884188
pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
41894189
if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
4190-
return -ENODEV;
4190+
goto out_disable_device;
41914191
/* Ok it is probably a megaraid */
41924192
}
41934193

drivers/scsi/qedf/qedf_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ static void qedf_dcbx_handler(void *dev, struct qed_dcbx_get *get, u32 mib_type)
596596
tmp_prio = get->operational.app_prio.fcoe;
597597
if (qedf_default_prio > -1)
598598
qedf->prio = qedf_default_prio;
599-
else if (tmp_prio < 0 || tmp_prio > 7) {
599+
else if (tmp_prio > 7) {
600600
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
601601
"FIP/FCoE prio %d out of range, setting to %d.\n",
602602
tmp_prio, QEDF_DEFAULT_PRIO);

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,6 +2920,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
29202920
struct qla_hw_data *ha = vha->hw;
29212921
uint16_t id = vha->vp_idx;
29222922

2923+
set_bit(VPORT_DELETE, &vha->dpc_flags);
2924+
29232925
while (test_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags) ||
29242926
test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
29252927
msleep(1000);

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,7 @@ typedef struct fc_port {
23962396
unsigned int query:1;
23972397
unsigned int id_changed:1;
23982398
unsigned int scan_needed:1;
2399+
unsigned int n2n_flag:1;
23992400

24002401
struct completion nvme_del_done;
24012402
uint32_t nvme_prli_service_param;
@@ -2446,7 +2447,6 @@ typedef struct fc_port {
24462447
uint8_t fc4_type;
24472448
uint8_t fc4f_nvme;
24482449
uint8_t scan_state;
2449-
uint8_t n2n_flag;
24502450

24512451
unsigned long last_queue_full;
24522452
unsigned long last_ramp_up;
@@ -3036,6 +3036,7 @@ enum scan_flags_t {
30363036
enum fc4type_t {
30373037
FS_FC4TYPE_FCP = BIT_0,
30383038
FS_FC4TYPE_NVME = BIT_1,
3039+
FS_FCP_IS_N2N = BIT_7,
30393040
};
30403041

30413042
struct fab_scan_rp {
@@ -4394,6 +4395,7 @@ typedef struct scsi_qla_host {
43944395
#define IOCB_WORK_ACTIVE 31
43954396
#define SET_ZIO_THRESHOLD_NEEDED 32
43964397
#define ISP_ABORT_TO_ROM 33
4398+
#define VPORT_DELETE 34
43974399

43984400
unsigned long pci_flags;
43994401
#define PFLG_DISCONNECTED 0 /* PCI device removed */

drivers/scsi/qla2xxx/qla_gs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3102,7 +3102,8 @@ int qla24xx_post_gpnid_work(struct scsi_qla_host *vha, port_id_t *id)
31023102
{
31033103
struct qla_work_evt *e;
31043104

3105-
if (test_bit(UNLOADING, &vha->dpc_flags))
3105+
if (test_bit(UNLOADING, &vha->dpc_flags) ||
3106+
(vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)))
31063107
return 0;
31073108

31083109
e = qla2x00_alloc_work(vha, QLA_EVT_GPNID);

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 78 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -746,19 +746,24 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
746746
break;
747747
default:
748748
if ((id.b24 != fcport->d_id.b24 &&
749-
fcport->d_id.b24) ||
749+
fcport->d_id.b24 &&
750+
fcport->loop_id != FC_NO_LOOP_ID) ||
750751
(fcport->loop_id != FC_NO_LOOP_ID &&
751752
fcport->loop_id != loop_id)) {
752753
ql_dbg(ql_dbg_disc, vha, 0x20e3,
753754
"%s %d %8phC post del sess\n",
754755
__func__, __LINE__, fcport->port_name);
756+
if (fcport->n2n_flag)
757+
fcport->d_id.b24 = 0;
755758
qlt_schedule_sess_for_deletion(fcport);
756759
return;
757760
}
758761
break;
759762
}
760763

761764
fcport->loop_id = loop_id;
765+
if (fcport->n2n_flag)
766+
fcport->d_id.b24 = id.b24;
762767

763768
wwn = wwn_to_u64(fcport->port_name);
764769
qlt_find_sess_invalidate_other(vha, wwn,
@@ -972,7 +977,7 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res)
972977
wwn = wwn_to_u64(e->port_name);
973978

974979
ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x20e8,
975-
"%s %8phC %02x:%02x:%02x state %d/%d lid %x \n",
980+
"%s %8phC %02x:%02x:%02x CLS %x/%x lid %x \n",
976981
__func__, (void *)&wwn, e->port_id[2], e->port_id[1],
977982
e->port_id[0], e->current_login_state, e->last_login_state,
978983
(loop_id & 0x7fff));
@@ -1499,7 +1504,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
14991504
(fcport->fw_login_state == DSC_LS_PRLI_PEND)))
15001505
return 0;
15011506

1502-
if (fcport->fw_login_state == DSC_LS_PLOGI_COMP) {
1507+
if (fcport->fw_login_state == DSC_LS_PLOGI_COMP &&
1508+
!N2N_TOPO(vha->hw)) {
15031509
if (time_before_eq(jiffies, fcport->plogi_nack_done_deadline)) {
15041510
set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
15051511
return 0;
@@ -1570,8 +1576,9 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
15701576
qla24xx_post_gpdb_work(vha, fcport, 0);
15711577
} else {
15721578
ql_dbg(ql_dbg_disc, vha, 0x2118,
1573-
"%s %d %8phC post NVMe PRLI\n",
1574-
__func__, __LINE__, fcport->port_name);
1579+
"%s %d %8phC post %s PRLI\n",
1580+
__func__, __LINE__, fcport->port_name,
1581+
fcport->fc4f_nvme ? "NVME" : "FC");
15751582
qla24xx_post_prli_work(vha, fcport);
15761583
}
15771584
break;
@@ -1853,17 +1860,38 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
18531860
break;
18541861
}
18551862

1856-
if (ea->fcport->n2n_flag) {
1863+
if (ea->fcport->fc4f_nvme) {
18571864
ql_dbg(ql_dbg_disc, vha, 0x2118,
18581865
"%s %d %8phC post fc4 prli\n",
18591866
__func__, __LINE__, ea->fcport->port_name);
18601867
ea->fcport->fc4f_nvme = 0;
1861-
ea->fcport->n2n_flag = 0;
18621868
qla24xx_post_prli_work(vha, ea->fcport);
1869+
return;
1870+
}
1871+
1872+
/* at this point both PRLI NVME & PRLI FCP failed */
1873+
if (N2N_TOPO(vha->hw)) {
1874+
if (ea->fcport->n2n_link_reset_cnt < 3) {
1875+
ea->fcport->n2n_link_reset_cnt++;
1876+
/*
1877+
* remote port is not sending Plogi. Reset
1878+
* link to kick start his state machine
1879+
*/
1880+
set_bit(N2N_LINK_RESET, &vha->dpc_flags);
1881+
} else {
1882+
ql_log(ql_log_warn, vha, 0x2119,
1883+
"%s %d %8phC Unable to reconnect\n",
1884+
__func__, __LINE__, ea->fcport->port_name);
1885+
}
1886+
} else {
1887+
/*
1888+
* switch connect. login failed. Take connection
1889+
* down and allow relogin to retrigger
1890+
*/
1891+
ea->fcport->flags &= ~FCF_ASYNC_SENT;
1892+
ea->fcport->keep_nport_handle = 0;
1893+
qlt_schedule_sess_for_deletion(ea->fcport);
18631894
}
1864-
ql_dbg(ql_dbg_disc, vha, 0x2119,
1865-
"%s %d %8phC unhandle event of %x\n",
1866-
__func__, __LINE__, ea->fcport->port_name, ea->data[0]);
18671895
break;
18681896
}
18691897
}
@@ -3190,7 +3218,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
31903218

31913219
for (j = 0; j < 2; j++, fwdt++) {
31923220
if (!fwdt->template) {
3193-
ql_log(ql_log_warn, vha, 0x00ba,
3221+
ql_dbg(ql_dbg_init, vha, 0x00ba,
31943222
"-> fwdt%u no template\n", j);
31953223
continue;
31963224
}
@@ -4986,28 +5014,47 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
49865014
unsigned long flags;
49875015

49885016
/* Inititae N2N login. */
4989-
if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) {
4990-
/* borrowing */
4991-
u32 *bp, i, sz;
4992-
4993-
memset(ha->init_cb, 0, ha->init_cb_size);
4994-
sz = min_t(int, sizeof(struct els_plogi_payload),
4995-
ha->init_cb_size);
4996-
rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma,
4997-
(void *)ha->init_cb, sz);
4998-
if (rval == QLA_SUCCESS) {
4999-
bp = (uint32_t *)ha->init_cb;
5000-
for (i = 0; i < sz/4 ; i++, bp++)
5001-
*bp = cpu_to_be32(*bp);
5017+
if (N2N_TOPO(ha)) {
5018+
if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) {
5019+
/* borrowing */
5020+
u32 *bp, i, sz;
5021+
5022+
memset(ha->init_cb, 0, ha->init_cb_size);
5023+
sz = min_t(int, sizeof(struct els_plogi_payload),
5024+
ha->init_cb_size);
5025+
rval = qla24xx_get_port_login_templ(vha,
5026+
ha->init_cb_dma, (void *)ha->init_cb, sz);
5027+
if (rval == QLA_SUCCESS) {
5028+
bp = (uint32_t *)ha->init_cb;
5029+
for (i = 0; i < sz/4 ; i++, bp++)
5030+
*bp = cpu_to_be32(*bp);
50025031

5003-
memcpy(&ha->plogi_els_payld.data, (void *)ha->init_cb,
5004-
sizeof(ha->plogi_els_payld.data));
5005-
set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
5006-
} else {
5007-
ql_dbg(ql_dbg_init, vha, 0x00d1,
5008-
"PLOGI ELS param read fail.\n");
5032+
memcpy(&ha->plogi_els_payld.data,
5033+
(void *)ha->init_cb,
5034+
sizeof(ha->plogi_els_payld.data));
5035+
set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
5036+
} else {
5037+
ql_dbg(ql_dbg_init, vha, 0x00d1,
5038+
"PLOGI ELS param read fail.\n");
5039+
goto skip_login;
5040+
}
5041+
}
5042+
5043+
list_for_each_entry(fcport, &vha->vp_fcports, list) {
5044+
if (fcport->n2n_flag) {
5045+
qla24xx_fcport_handle_login(vha, fcport);
5046+
return QLA_SUCCESS;
5047+
}
5048+
}
5049+
skip_login:
5050+
spin_lock_irqsave(&vha->work_lock, flags);
5051+
vha->scan.scan_retry++;
5052+
spin_unlock_irqrestore(&vha->work_lock, flags);
5053+
5054+
if (vha->scan.scan_retry < MAX_SCAN_RETRIES) {
5055+
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
5056+
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
50095057
}
5010-
return QLA_SUCCESS;
50115058
}
50125059

50135060
found_devs = 0;

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,9 +2656,10 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
26562656
els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
26572657
els_iocb->port_id[1] = sp->fcport->d_id.b.area;
26582658
els_iocb->port_id[2] = sp->fcport->d_id.b.domain;
2659-
els_iocb->s_id[0] = vha->d_id.b.al_pa;
2660-
els_iocb->s_id[1] = vha->d_id.b.area;
2661-
els_iocb->s_id[2] = vha->d_id.b.domain;
2659+
/* For SID the byte order is different than DID */
2660+
els_iocb->s_id[1] = vha->d_id.b.al_pa;
2661+
els_iocb->s_id[2] = vha->d_id.b.area;
2662+
els_iocb->s_id[0] = vha->d_id.b.domain;
26622663

26632664
if (elsio->u.els_logo.els_cmd == ELS_DCMD_PLOGI) {
26642665
els_iocb->control_flags = 0;

0 commit comments

Comments
 (0)