Skip to content

Commit 07db056

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull more SCSI updates from James Bottomley: "This is a set of minor fixes in various drivers (qla2xxx, ufs, scsi_debug, lpfc) one doc fix and a fairly large update to the fnic driver to remove the open coded iteration functions in favour of the scsi provided ones" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: fnic: Use scsi_host_busy_iter() to traverse commands scsi: fnic: Kill 'exclude_id' argument to fnic_cleanup_io() scsi: scsi_debug: Fix cmd_per_lun, set to max_queue scsi: ufs: core: Narrow down fast path in system suspend path scsi: ufs: core: Cancel rpm_dev_flush_recheck_work during system suspend scsi: ufs: core: Do not put UFS power into LPM if link is broken scsi: qla2xxx: Prevent PRLI in target mode scsi: qla2xxx: Add marginal path handling support scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id not found scsi: ufs: core: Fix a typo in ufs-sysfs.c scsi: lpfc: Fix bad memory access during VPD DUMP mailbox command scsi: lpfc: Fix DMA virtual address ptr assignment in bsg scsi: lpfc: Fix illegal memory access on Abort IOCBs scsi: blk-mq: Fix build warning when making htmldocs
2 parents 0f979d8 + 35ffbb6 commit 07db056

File tree

11 files changed

+438
-489
lines changed

11 files changed

+438
-489
lines changed

drivers/scsi/fnic/fnic_scsi.c

Lines changed: 377 additions & 451 deletions
Large diffs are not rendered by default.

drivers/scsi/lpfc/lpfc_bsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
934934
INIT_LIST_HEAD(&head);
935935
list_add_tail(&head, &piocbq->list);
936936

937-
ct_req = (struct lpfc_sli_ct_request *)bdeBuf1;
937+
ct_req = (struct lpfc_sli_ct_request *)bdeBuf1->virt;
938938
evt_req_id = ct_req->FsType;
939939
cmd = ct_req->CommandResponse.bits.CmdRsp;
940940

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
254254
if (mb->un.varDmp.word_cnt == 0)
255255
break;
256256

257-
i = mb->un.varDmp.word_cnt * sizeof(uint32_t);
258-
if (offset + i > DMP_VPD_SIZE)
259-
i = DMP_VPD_SIZE - offset;
257+
if (mb->un.varDmp.word_cnt > DMP_VPD_SIZE - offset)
258+
mb->un.varDmp.word_cnt = DMP_VPD_SIZE - offset;
260259
lpfc_sli_pcimem_bcopy(((uint8_t *)mb) + DMP_RSP_OFFSET,
261-
lpfc_vpd_data + offset, i);
262-
offset += i;
263-
} while (offset < DMP_VPD_SIZE);
260+
lpfc_vpd_data + offset,
261+
mb->un.varDmp.word_cnt);
262+
offset += mb->un.varDmp.word_cnt;
263+
} while (mb->un.varDmp.word_cnt && offset < DMP_VPD_SIZE);
264264

265265
lpfc_parse_vpd(phba, lpfc_vpd_data, offset);
266266

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11804,13 +11804,20 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
1180411804
lpfc_ctx_cmd ctx_cmd)
1180511805
{
1180611806
struct lpfc_io_buf *lpfc_cmd;
11807+
IOCB_t *icmd = NULL;
1180711808
int rc = 1;
1180811809

1180911810
if (!iocbq || iocbq->vport != vport)
1181011811
return rc;
1181111812

11812-
if (!(iocbq->iocb_flag & LPFC_IO_FCP) ||
11813-
!(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ))
11813+
if (!(iocbq->iocb_flag & LPFC_IO_FCP) ||
11814+
!(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) ||
11815+
iocbq->iocb_flag & LPFC_DRIVER_ABORTED)
11816+
return rc;
11817+
11818+
icmd = &iocbq->iocb;
11819+
if (icmd->ulpCommand == CMD_ABORT_XRI_CN ||
11820+
icmd->ulpCommand == CMD_CLOSE_XRI_CN)
1181411821
return rc;
1181511822

1181611823
lpfc_cmd = container_of(iocbq, struct lpfc_io_buf, cur_iocbq);
@@ -19770,7 +19777,7 @@ lpfc_sli_get_config_region23(struct lpfc_hba *phba, char *rgn23_data)
1977019777
LPFC_MBOXQ_t *pmb = NULL;
1977119778
MAILBOX_t *mb;
1977219779
uint32_t offset = 0;
19773-
int i, rc;
19780+
int rc;
1977419781

1977519782
if (!rgn23_data)
1977619783
return 0;
@@ -19801,13 +19808,14 @@ lpfc_sli_get_config_region23(struct lpfc_hba *phba, char *rgn23_data)
1980119808
if (mb->un.varDmp.word_cnt == 0)
1980219809
break;
1980319810

19804-
i = mb->un.varDmp.word_cnt * sizeof(uint32_t);
19805-
if (offset + i > DMP_RGN23_SIZE)
19806-
i = DMP_RGN23_SIZE - offset;
19811+
if (mb->un.varDmp.word_cnt > DMP_RGN23_SIZE - offset)
19812+
mb->un.varDmp.word_cnt = DMP_RGN23_SIZE - offset;
19813+
1980719814
lpfc_sli_pcimem_bcopy(((uint8_t *)mb) + DMP_RSP_OFFSET,
19808-
rgn23_data + offset, i);
19809-
offset += i;
19810-
} while (offset < DMP_RGN23_SIZE);
19815+
rgn23_data + offset,
19816+
mb->un.varDmp.word_cnt);
19817+
offset += mb->un.varDmp.word_cnt;
19818+
} while (mb->un.varDmp.word_cnt && offset < DMP_RGN23_SIZE);
1981119819

1981219820
mempool_free(pmb, phba->mbox_mem_pool);
1981319821
return offset;

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,9 @@ static int qla24xx_post_prli_work(struct scsi_qla_host *vha, fc_port_t *fcport)
11951195
{
11961196
struct qla_work_evt *e;
11971197

1198+
if (vha->host->active_mode == MODE_TARGET)
1199+
return QLA_FUNCTION_FAILED;
1200+
11981201
e = qla2x00_alloc_work(vha, QLA_EVT_PRLI);
11991202
if (!e)
12001203
return QLA_FUNCTION_FAILED;

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7707,6 +7707,7 @@ struct scsi_host_template qla2xxx_driver_template = {
77077707

77087708
.eh_timed_out = fc_eh_timed_out,
77097709
.eh_abort_handler = qla2xxx_eh_abort,
7710+
.eh_should_retry_cmd = fc_eh_should_retry_cmd,
77107711
.eh_device_reset_handler = qla2xxx_eh_device_reset,
77117712
.eh_target_reset_handler = qla2xxx_eh_target_reset,
77127713
.eh_bus_reset_handler = qla2xxx_eh_bus_reset,

drivers/scsi/scsi_debug.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static const char *sdebug_version_date = "20200710";
218218
*/
219219
#define SDEBUG_CANQUEUE_WORDS 3 /* a WORD is bits in a long */
220220
#define SDEBUG_CANQUEUE (SDEBUG_CANQUEUE_WORDS * BITS_PER_LONG)
221-
#define DEF_CMD_PER_LUN 255
221+
#define DEF_CMD_PER_LUN SDEBUG_CANQUEUE
222222

223223
/* UA - Unit Attention; SA - Service Action; SSU - Start Stop Unit */
224224
#define F_D_IN 1 /* Data-in command (e.g. READ) */
@@ -5695,8 +5695,8 @@ MODULE_PARM_DESC(lbpu, "enable LBP, support UNMAP command (def=0)");
56955695
MODULE_PARM_DESC(lbpws, "enable LBP, support WRITE SAME(16) with UNMAP bit (def=0)");
56965696
MODULE_PARM_DESC(lbpws10, "enable LBP, support WRITE SAME(10) with UNMAP bit (def=0)");
56975697
MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)");
5698-
MODULE_PARM_DESC(max_luns, "number of LUNs per target to simulate(def=1)");
56995698
MODULE_PARM_DESC(lun_format, "LUN format: 0->peripheral (def); 1 --> flat address method");
5699+
MODULE_PARM_DESC(max_luns, "number of LUNs per target to simulate(def=1)");
57005700
MODULE_PARM_DESC(max_queue, "max number of queued commands (1 to max(def))");
57015701
MODULE_PARM_DESC(medium_error_count, "count of sectors to return follow on MEDIUM error");
57025702
MODULE_PARM_DESC(medium_error_start, "starting sector number to return MEDIUM error");
@@ -5710,7 +5710,7 @@ MODULE_PARM_DESC(opt_xferlen_exp, "optimal transfer length granularity exponent
57105710
MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 8->recovered_err... (def=0)");
57115711
MODULE_PARM_DESC(per_host_store, "If set, next positive add_host will get new store (def=0)");
57125712
MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
5713-
MODULE_PARM_DESC(poll_queues, "support for iouring iopoll queues (1 to max(submit_queues - 1)");
5713+
MODULE_PARM_DESC(poll_queues, "support for iouring iopoll queues (1 to max(submit_queues - 1))");
57145714
MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])");
57155715
MODULE_PARM_DESC(random, "If set, uniformly randomize command duration between 0 and delay_in_ns");
57165716
MODULE_PARM_DESC(removable, "claim to have removable media (def=0)");
@@ -7165,12 +7165,15 @@ static int sdebug_change_qdepth(struct scsi_device *sdev, int qdepth)
71657165
}
71667166
num_in_q = atomic_read(&devip->num_in_q);
71677167

7168+
if (qdepth > SDEBUG_CANQUEUE) {
7169+
qdepth = SDEBUG_CANQUEUE;
7170+
pr_warn("%s: requested qdepth [%d] exceeds canqueue [%d], trim\n", __func__,
7171+
qdepth, SDEBUG_CANQUEUE);
7172+
}
71687173
if (qdepth < 1)
71697174
qdepth = 1;
7170-
/* allow to exceed max host qc_arr elements for testing */
7171-
if (qdepth > SDEBUG_CANQUEUE + 10)
7172-
qdepth = SDEBUG_CANQUEUE + 10;
7173-
scsi_change_queue_depth(sdev, qdepth);
7175+
if (qdepth != sdev->queue_depth)
7176+
scsi_change_queue_depth(sdev, qdepth);
71747177

71757178
if (SDEBUG_OPT_Q_NOISE & sdebug_opts) {
71767179
sdev_printk(KERN_INFO, sdev, "%s: qdepth=%d, num_in_q=%d\n",
@@ -7558,6 +7561,7 @@ static int sdebug_driver_probe(struct device *dev)
75587561
sdbg_host = to_sdebug_host(dev);
75597562

75607563
sdebug_driver_template.can_queue = sdebug_max_queue;
7564+
sdebug_driver_template.cmd_per_lun = sdebug_max_queue;
75617565
if (!sdebug_clustering)
75627566
sdebug_driver_template.dma_boundary = PAGE_SIZE - 1;
75637567

@@ -7593,7 +7597,11 @@ static int sdebug_driver_probe(struct device *dev)
75937597
* If condition not met, trim poll_queues to 1 (just for simplicity).
75947598
*/
75957599
if (poll_queues >= submit_queues) {
7596-
pr_warn("%s: trim poll_queues to 1\n", my_name);
7600+
if (submit_queues < 3)
7601+
pr_warn("%s: trim poll_queues to 1\n", my_name);
7602+
else
7603+
pr_warn("%s: trim poll_queues to 1. Perhaps try poll_queues=%d\n",
7604+
my_name, submit_queues - 1);
75977605
poll_queues = 1;
75987606
}
75997607
if (poll_queues)

drivers/scsi/ufs/ufs-sysfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "ufs.h"
1010
#include "ufs-sysfs.h"
1111

12-
static const char *ufschd_uic_link_state_to_string(
12+
static const char *ufshcd_uic_link_state_to_string(
1313
enum uic_link_state state)
1414
{
1515
switch (state) {
@@ -21,7 +21,7 @@ static const char *ufschd_uic_link_state_to_string(
2121
}
2222
}
2323

24-
static const char *ufschd_ufs_dev_pwr_mode_to_string(
24+
static const char *ufshcd_ufs_dev_pwr_mode_to_string(
2525
enum ufs_dev_pwr_mode state)
2626
{
2727
switch (state) {
@@ -81,7 +81,7 @@ static ssize_t rpm_target_dev_state_show(struct device *dev,
8181
{
8282
struct ufs_hba *hba = dev_get_drvdata(dev);
8383

84-
return sysfs_emit(buf, "%s\n", ufschd_ufs_dev_pwr_mode_to_string(
84+
return sysfs_emit(buf, "%s\n", ufshcd_ufs_dev_pwr_mode_to_string(
8585
ufs_pm_lvl_states[hba->rpm_lvl].dev_state));
8686
}
8787

@@ -90,7 +90,7 @@ static ssize_t rpm_target_link_state_show(struct device *dev,
9090
{
9191
struct ufs_hba *hba = dev_get_drvdata(dev);
9292

93-
return sysfs_emit(buf, "%s\n", ufschd_uic_link_state_to_string(
93+
return sysfs_emit(buf, "%s\n", ufshcd_uic_link_state_to_string(
9494
ufs_pm_lvl_states[hba->rpm_lvl].link_state));
9595
}
9696

@@ -113,7 +113,7 @@ static ssize_t spm_target_dev_state_show(struct device *dev,
113113
{
114114
struct ufs_hba *hba = dev_get_drvdata(dev);
115115

116-
return sysfs_emit(buf, "%s\n", ufschd_ufs_dev_pwr_mode_to_string(
116+
return sysfs_emit(buf, "%s\n", ufshcd_ufs_dev_pwr_mode_to_string(
117117
ufs_pm_lvl_states[hba->spm_lvl].dev_state));
118118
}
119119

@@ -122,7 +122,7 @@ static ssize_t spm_target_link_state_show(struct device *dev,
122122
{
123123
struct ufs_hba *hba = dev_get_drvdata(dev);
124124

125-
return sysfs_emit(buf, "%s\n", ufschd_uic_link_state_to_string(
125+
return sysfs_emit(buf, "%s\n", ufshcd_uic_link_state_to_string(
126126
ufs_pm_lvl_states[hba->spm_lvl].link_state));
127127
}
128128

drivers/scsi/ufs/ufshcd.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8593,7 +8593,7 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba *hba)
85938593
} else if (!ufshcd_is_ufs_dev_active(hba)) {
85948594
ufshcd_toggle_vreg(hba->dev, hba->vreg_info.vcc, false);
85958595
vcc_off = true;
8596-
if (!ufshcd_is_link_active(hba)) {
8596+
if (ufshcd_is_link_hibern8(hba) || ufshcd_is_link_off(hba)) {
85978597
ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq);
85988598
ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq2);
85998599
}
@@ -8615,7 +8615,7 @@ static int ufshcd_vreg_set_hpm(struct ufs_hba *hba)
86158615
!hba->dev_info.is_lu_power_on_wp) {
86168616
ret = ufshcd_setup_vreg(hba, true);
86178617
} else if (!ufshcd_is_ufs_dev_active(hba)) {
8618-
if (!ret && !ufshcd_is_link_active(hba)) {
8618+
if (!ufshcd_is_link_active(hba)) {
86198619
ret = ufshcd_config_vreg_hpm(hba, hba->vreg_info.vccq);
86208620
if (ret)
86218621
goto vcc_disable;
@@ -8975,10 +8975,13 @@ int ufshcd_system_suspend(struct ufs_hba *hba)
89758975
if (!hba->is_powered)
89768976
return 0;
89778977

8978+
cancel_delayed_work_sync(&hba->rpm_dev_flush_recheck_work);
8979+
89788980
if ((ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
89798981
hba->curr_dev_pwr_mode) &&
89808982
(ufs_get_pm_lvl_to_link_pwr_state(hba->spm_lvl) ==
89818983
hba->uic_link_state) &&
8984+
pm_runtime_suspended(hba->dev) &&
89828985
!hba->dev_info.b_rpm_dev_flush_capable)
89838986
goto out;
89848987

drivers/target/target_core_user.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ static int tcmu_run_tmr_queue(struct tcmu_dev *udev)
14131413
return 1;
14141414
}
14151415

1416-
static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
1416+
static bool tcmu_handle_completions(struct tcmu_dev *udev)
14171417
{
14181418
struct tcmu_mailbox *mb;
14191419
struct tcmu_cmd *cmd;
@@ -1456,7 +1456,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
14561456
pr_err("cmd_id %u not found, ring is broken\n",
14571457
entry->hdr.cmd_id);
14581458
set_bit(TCMU_DEV_BIT_BROKEN, &udev->flags);
1459-
break;
1459+
return false;
14601460
}
14611461

14621462
tcmu_handle_completion(cmd, entry);

include/linux/blk-mq.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@ struct blk_mq_ops {
313313
*/
314314
void (*put_budget)(struct request_queue *, int);
315315

316-
/*
317-
* @set_rq_budget_toekn: store rq's budget token
316+
/**
317+
* @set_rq_budget_token: store rq's budget token
318318
*/
319319
void (*set_rq_budget_token)(struct request *, int);
320-
/*
321-
* @get_rq_budget_toekn: retrieve rq's budget token
320+
/**
321+
* @get_rq_budget_token: retrieve rq's budget token
322322
*/
323323
int (*get_rq_budget_token)(struct request *);
324324

0 commit comments

Comments
 (0)