Skip to content

Commit f4697d9

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: "A set of very minor fixes and a couple of reverts to fix a major problem (the attempt to change the busy count causes a hang when attempting to change the drive cache type)" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: aacraid: fix a signedness bug Revert "scsi: core: avoid host-wide host_busy counter for scsi_mq" Revert "scsi: core: fix scsi_host_queue_ready" scsi: libata: Add missing newline at end of file scsi: target: iscsi: cxgbit: use pr_debug() instead of pr_info() scsi: hpsa: limit transfer length to 1MB, not 512kB scsi: lpfc: Correct MDS diag and nvmet configuration scsi: lpfc: Default fdmi_on to on scsi: csiostor: fix incorrect port capabilities scsi: csiostor: add a check for NULL pointer after kmalloc() scsi: documentation: add scsi_mod.use_blk_mq to scsi-parameters scsi: core: Update SCSI_MQ_DEFAULT help text to match default
2 parents d0c1db1 + b9eb3b1 commit f4697d9

File tree

13 files changed

+85
-77
lines changed

13 files changed

+85
-77
lines changed

Documentation/scsi/scsi-parameters.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ parameters may be changed at runtime by the command
9797
allowing boot to proceed. none ignores them, expecting
9898
user space to do the scan.
9999

100+
scsi_mod.use_blk_mq=
101+
[SCSI] use blk-mq I/O path by default
102+
See SCSI_MQ_DEFAULT in drivers/scsi/Kconfig.
103+
Format: <y/n>
104+
100105
sim710= [SCSI,HW]
101106
See header of drivers/scsi/sim710.c.
102107

drivers/ata/libata-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7394,4 +7394,4 @@ EXPORT_SYMBOL_GPL(ata_cable_unknown);
73947394
EXPORT_SYMBOL_GPL(ata_cable_ignore);
73957395
EXPORT_SYMBOL_GPL(ata_cable_sata);
73967396
EXPORT_SYMBOL_GPL(ata_host_get);
7397-
EXPORT_SYMBOL_GPL(ata_host_put);
7397+
EXPORT_SYMBOL_GPL(ata_host_put);

drivers/scsi/Kconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ config SCSI_MQ_DEFAULT
5252
default y
5353
depends on SCSI
5454
---help---
55-
This option enables the new blk-mq based I/O path for SCSI
56-
devices by default. With the option the scsi_mod.use_blk_mq
57-
module/boot option defaults to Y, without it to N, but it can
58-
still be overridden either way.
55+
This option enables the blk-mq based I/O path for SCSI devices by
56+
default. With this option the scsi_mod.use_blk_mq module/boot
57+
option defaults to Y, without it to N, but it can still be
58+
overridden either way.
5959

60-
If unsure say N.
60+
If unsure say Y.
6161

6262
config SCSI_PROC_FS
6363
bool "legacy /proc/scsi/ support"

drivers/scsi/aacraid/aacraid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ struct fib {
13461346
struct aac_hba_map_info {
13471347
__le32 rmw_nexus; /* nexus for native HBA devices */
13481348
u8 devtype; /* device type */
1349-
u8 reset_state; /* 0 - no reset, 1..x - */
1349+
s8 reset_state; /* 0 - no reset, 1..x - */
13501350
/* after xth TM LUN reset */
13511351
u16 qd_limit;
13521352
u32 scan_counter;

drivers/scsi/csiostor/csio_hw.c

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,46 @@ fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16)
16011601
return caps32;
16021602
}
16031603

1604+
/**
1605+
* fwcaps32_to_caps16 - convert 32-bit Port Capabilities to 16-bits
1606+
* @caps32: a 32-bit Port Capabilities value
1607+
*
1608+
* Returns the equivalent 16-bit Port Capabilities value. Note that
1609+
* not all 32-bit Port Capabilities can be represented in the 16-bit
1610+
* Port Capabilities and some fields/values may not make it.
1611+
*/
1612+
fw_port_cap16_t fwcaps32_to_caps16(fw_port_cap32_t caps32)
1613+
{
1614+
fw_port_cap16_t caps16 = 0;
1615+
1616+
#define CAP32_TO_CAP16(__cap) \
1617+
do { \
1618+
if (caps32 & FW_PORT_CAP32_##__cap) \
1619+
caps16 |= FW_PORT_CAP_##__cap; \
1620+
} while (0)
1621+
1622+
CAP32_TO_CAP16(SPEED_100M);
1623+
CAP32_TO_CAP16(SPEED_1G);
1624+
CAP32_TO_CAP16(SPEED_10G);
1625+
CAP32_TO_CAP16(SPEED_25G);
1626+
CAP32_TO_CAP16(SPEED_40G);
1627+
CAP32_TO_CAP16(SPEED_100G);
1628+
CAP32_TO_CAP16(FC_RX);
1629+
CAP32_TO_CAP16(FC_TX);
1630+
CAP32_TO_CAP16(802_3_PAUSE);
1631+
CAP32_TO_CAP16(802_3_ASM_DIR);
1632+
CAP32_TO_CAP16(ANEG);
1633+
CAP32_TO_CAP16(FORCE_PAUSE);
1634+
CAP32_TO_CAP16(MDIAUTO);
1635+
CAP32_TO_CAP16(MDISTRAIGHT);
1636+
CAP32_TO_CAP16(FEC_RS);
1637+
CAP32_TO_CAP16(FEC_BASER_RS);
1638+
1639+
#undef CAP32_TO_CAP16
1640+
1641+
return caps16;
1642+
}
1643+
16041644
/**
16051645
* lstatus_to_fwcap - translate old lstatus to 32-bit Port Capabilities
16061646
* @lstatus: old FW_PORT_ACTION_GET_PORT_INFO lstatus value
@@ -1759,7 +1799,7 @@ csio_enable_ports(struct csio_hw *hw)
17591799
val = 1;
17601800

17611801
csio_mb_params(hw, mbp, CSIO_MB_DEFAULT_TMO,
1762-
hw->pfn, 0, 1, &param, &val, false,
1802+
hw->pfn, 0, 1, &param, &val, true,
17631803
NULL);
17641804

17651805
if (csio_mb_issue(hw, mbp)) {
@@ -1769,16 +1809,9 @@ csio_enable_ports(struct csio_hw *hw)
17691809
return -EINVAL;
17701810
}
17711811

1772-
csio_mb_process_read_params_rsp(hw, mbp, &retval, 1,
1773-
&val);
1774-
if (retval != FW_SUCCESS) {
1775-
csio_err(hw, "FW_PARAMS_CMD(r) port:%d failed: 0x%x\n",
1776-
portid, retval);
1777-
mempool_free(mbp, hw->mb_mempool);
1778-
return -EINVAL;
1779-
}
1780-
1781-
fw_caps = val;
1812+
csio_mb_process_read_params_rsp(hw, mbp, &retval,
1813+
0, NULL);
1814+
fw_caps = retval ? FW_CAPS16 : FW_CAPS32;
17821815
}
17831816

17841817
/* Read PORT information */
@@ -2364,8 +2397,8 @@ static int csio_hw_prep_fw(struct csio_hw *hw, struct fw_info *fw_info,
23642397
}
23652398

23662399
/*
2367-
* Returns -EINVAL if attempts to flash the firmware failed
2368-
* else returns 0,
2400+
* Returns -EINVAL if attempts to flash the firmware failed,
2401+
* -ENOMEM if memory allocation failed else returns 0,
23692402
* if flashing was not attempted because the card had the
23702403
* latest firmware ECANCELED is returned
23712404
*/
@@ -2393,6 +2426,13 @@ csio_hw_flash_fw(struct csio_hw *hw, int *reset)
23932426
return -EINVAL;
23942427
}
23952428

2429+
/* allocate memory to read the header of the firmware on the
2430+
* card
2431+
*/
2432+
card_fw = kmalloc(sizeof(*card_fw), GFP_KERNEL);
2433+
if (!card_fw)
2434+
return -ENOMEM;
2435+
23962436
if (csio_is_t5(pci_dev->device & CSIO_HW_CHIP_MASK))
23972437
fw_bin_file = FW_FNAME_T5;
23982438
else
@@ -2406,11 +2446,6 @@ csio_hw_flash_fw(struct csio_hw *hw, int *reset)
24062446
fw_size = fw->size;
24072447
}
24082448

2409-
/* allocate memory to read the header of the firmware on the
2410-
* card
2411-
*/
2412-
card_fw = kmalloc(sizeof(*card_fw), GFP_KERNEL);
2413-
24142449
/* upgrade FW logic */
24152450
ret = csio_hw_prep_fw(hw, fw_info, fw_data, fw_size, card_fw,
24162451
hw->fw_state, reset);

drivers/scsi/csiostor/csio_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ int csio_handle_intr_status(struct csio_hw *, unsigned int,
639639

640640
fw_port_cap32_t fwcap_to_fwspeed(fw_port_cap32_t acaps);
641641
fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16);
642+
fw_port_cap16_t fwcaps32_to_caps16(fw_port_cap32_t caps32);
642643
fw_port_cap32_t lstatus_to_fwcap(u32 lstatus);
643644

644645
int csio_hw_start(struct csio_hw *);

drivers/scsi/csiostor/csio_mb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ csio_mb_port(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo,
368368
FW_CMD_LEN16_V(sizeof(*cmdp) / 16));
369369

370370
if (fw_caps == FW_CAPS16)
371-
cmdp->u.l1cfg.rcap = cpu_to_be32(fc);
371+
cmdp->u.l1cfg.rcap = cpu_to_be32(fwcaps32_to_caps16(fc));
372372
else
373373
cmdp->u.l1cfg32.rcap32 = cpu_to_be32(fc);
374374
}
@@ -395,8 +395,8 @@ csio_mb_process_read_port_rsp(struct csio_hw *hw, struct csio_mb *mbp,
395395
*pcaps = fwcaps16_to_caps32(ntohs(rsp->u.info.pcap));
396396
*acaps = fwcaps16_to_caps32(ntohs(rsp->u.info.acap));
397397
} else {
398-
*pcaps = ntohs(rsp->u.info32.pcaps32);
399-
*acaps = ntohs(rsp->u.info32.acaps32);
398+
*pcaps = be32_to_cpu(rsp->u.info32.pcaps32);
399+
*acaps = be32_to_cpu(rsp->u.info32.acaps32);
400400
}
401401
}
402402
}

drivers/scsi/hosts.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -563,35 +563,13 @@ struct Scsi_Host *scsi_host_get(struct Scsi_Host *shost)
563563
}
564564
EXPORT_SYMBOL(scsi_host_get);
565565

566-
struct scsi_host_mq_in_flight {
567-
int cnt;
568-
};
569-
570-
static void scsi_host_check_in_flight(struct request *rq, void *data,
571-
bool reserved)
572-
{
573-
struct scsi_host_mq_in_flight *in_flight = data;
574-
575-
if (blk_mq_request_started(rq))
576-
in_flight->cnt++;
577-
}
578-
579566
/**
580567
* scsi_host_busy - Return the host busy counter
581568
* @shost: Pointer to Scsi_Host to inc.
582569
**/
583570
int scsi_host_busy(struct Scsi_Host *shost)
584571
{
585-
struct scsi_host_mq_in_flight in_flight = {
586-
.cnt = 0,
587-
};
588-
589-
if (!shost->use_blk_mq)
590-
return atomic_read(&shost->host_busy);
591-
592-
blk_mq_tagset_busy_iter(&shost->tag_set, scsi_host_check_in_flight,
593-
&in_flight);
594-
return in_flight.cnt;
572+
return atomic_read(&shost->host_busy);
595573
}
596574
EXPORT_SYMBOL(scsi_host_busy);
597575

drivers/scsi/hpsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ static struct scsi_host_template hpsa_driver_template = {
976976
#endif
977977
.sdev_attrs = hpsa_sdev_attrs,
978978
.shost_attrs = hpsa_shost_attrs,
979-
.max_sectors = 1024,
979+
.max_sectors = 2048,
980980
.no_write_same = 1,
981981
};
982982

drivers/scsi/lpfc/lpfc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ struct lpfc_hba {
672672
#define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */
673673
#define LS_IGNORE_ERATT 0x4 /* intr handler should ignore ERATT */
674674
#define LS_MDS_LINK_DOWN 0x8 /* MDS Diagnostics Link Down */
675-
#define LS_MDS_LOOPBACK 0x16 /* MDS Diagnostics Link Up (Loopback) */
675+
#define LS_MDS_LOOPBACK 0x10 /* MDS Diagnostics Link Up (Loopback) */
676676

677677
uint32_t hba_flag; /* hba generic flags */
678678
#define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5122,16 +5122,16 @@ LPFC_ATTR_R(enable_SmartSAN, 0, 0, 1, "Enable SmartSAN functionality");
51225122

51235123
/*
51245124
# lpfc_fdmi_on: Controls FDMI support.
5125-
# 0 No FDMI support (default)
5126-
# 1 Traditional FDMI support
5125+
# 0 No FDMI support
5126+
# 1 Traditional FDMI support (default)
51275127
# Traditional FDMI support means the driver will assume FDMI-2 support;
51285128
# however, if that fails, it will fallback to FDMI-1.
51295129
# If lpfc_enable_SmartSAN is set to 1, the driver ignores lpfc_fdmi_on.
51305130
# If lpfc_enable_SmartSAN is set 0, the driver uses the current value of
51315131
# lpfc_fdmi_on.
5132-
# Value range [0,1]. Default value is 0.
5132+
# Value range [0,1]. Default value is 1.
51335133
*/
5134-
LPFC_ATTR_R(fdmi_on, 0, 0, 1, "Enable FDMI support");
5134+
LPFC_ATTR_R(fdmi_on, 1, 0, 1, "Enable FDMI support");
51355135

51365136
/*
51375137
# Specifies the maximum number of ELS cmds we can have outstanding (for

drivers/scsi/scsi_lib.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,7 @@ static void scsi_dec_host_busy(struct Scsi_Host *shost)
345345
unsigned long flags;
346346

347347
rcu_read_lock();
348-
if (!shost->use_blk_mq)
349-
atomic_dec(&shost->host_busy);
348+
atomic_dec(&shost->host_busy);
350349
if (unlikely(scsi_host_in_recovery(shost))) {
351350
spin_lock_irqsave(shost->host_lock, flags);
352351
if (shost->host_failed || shost->host_eh_scheduled)
@@ -445,12 +444,7 @@ static inline bool scsi_target_is_busy(struct scsi_target *starget)
445444

446445
static inline bool scsi_host_is_busy(struct Scsi_Host *shost)
447446
{
448-
/*
449-
* blk-mq can handle host queue busy efficiently via host-wide driver
450-
* tag allocation
451-
*/
452-
453-
if (!shost->use_blk_mq && shost->can_queue > 0 &&
447+
if (shost->can_queue > 0 &&
454448
atomic_read(&shost->host_busy) >= shost->can_queue)
455449
return true;
456450
if (atomic_read(&shost->host_blocked) > 0)
@@ -1606,10 +1600,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
16061600
if (scsi_host_in_recovery(shost))
16071601
return 0;
16081602

1609-
if (!shost->use_blk_mq)
1610-
busy = atomic_inc_return(&shost->host_busy) - 1;
1611-
else
1612-
busy = 0;
1603+
busy = atomic_inc_return(&shost->host_busy) - 1;
16131604
if (atomic_read(&shost->host_blocked) > 0) {
16141605
if (busy)
16151606
goto starved;
@@ -1625,7 +1616,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
16251616
"unblocking host at zero depth\n"));
16261617
}
16271618

1628-
if (!shost->use_blk_mq && shost->can_queue > 0 && busy >= shost->can_queue)
1619+
if (shost->can_queue > 0 && busy >= shost->can_queue)
16291620
goto starved;
16301621
if (shost->host_self_blocked)
16311622
goto starved;
@@ -1711,9 +1702,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
17111702
* with the locks as normal issue path does.
17121703
*/
17131704
atomic_inc(&sdev->device_busy);
1714-
1715-
if (!shost->use_blk_mq)
1716-
atomic_inc(&shost->host_busy);
1705+
atomic_inc(&shost->host_busy);
17171706
if (starget->can_queue > 0)
17181707
atomic_inc(&starget->target_busy);
17191708

drivers/target/iscsi/cxgbit/cxgbit_ddp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ cxgbit_ddp_reserve(struct cxgbit_sock *csk, struct cxgbi_task_tag_info *ttinfo,
207207
ret = dma_map_sg(&ppm->pdev->dev, sgl, sgcnt, DMA_FROM_DEVICE);
208208
sgl->offset = sg_offset;
209209
if (!ret) {
210-
pr_info("%s: 0x%x, xfer %u, sgl %u dma mapping err.\n",
211-
__func__, 0, xferlen, sgcnt);
210+
pr_debug("%s: 0x%x, xfer %u, sgl %u dma mapping err.\n",
211+
__func__, 0, xferlen, sgcnt);
212212
goto rel_ppods;
213213
}
214214

@@ -250,8 +250,8 @@ cxgbit_get_r2t_ttt(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
250250

251251
ret = cxgbit_ddp_reserve(csk, ttinfo, cmd->se_cmd.data_length);
252252
if (ret < 0) {
253-
pr_info("csk 0x%p, cmd 0x%p, xfer len %u, sgcnt %u no ddp.\n",
254-
csk, cmd, cmd->se_cmd.data_length, ttinfo->nents);
253+
pr_debug("csk 0x%p, cmd 0x%p, xfer len %u, sgcnt %u no ddp.\n",
254+
csk, cmd, cmd->se_cmd.data_length, ttinfo->nents);
255255

256256
ttinfo->sgl = NULL;
257257
ttinfo->nents = 0;

0 commit comments

Comments
 (0)