Skip to content

Commit 0375ec5

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull misc SCSI driver updates from James Bottomley: "This patch set is a set of driver updates (megaraid_sas, fnic, lpfc, ufs, hpsa) we also have a couple of bug fixes (sd out of bounds and ibmvfc error handling) and the first round of esas2r checker fixes and finally the much anticipated big endian additions for megaraid_sas" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (47 commits) [SCSI] fnic: fnic Driver Tuneables Exposed through CLI [SCSI] fnic: Kernel panic while running sh/nosh with max lun cfg [SCSI] fnic: Hitting BUG_ON(io_req->abts_done) in fnic_rport_exch_reset [SCSI] fnic: Remove QUEUE_FULL handling code [SCSI] fnic: On system with >1.1TB RAM, VIC fails multipath after boot up [SCSI] fnic: FC stat param seconds_since_last_reset not getting updated [SCSI] sd: Fix potential out-of-bounds access [SCSI] lpfc 8.3.42: Update lpfc version to driver version 8.3.42 [SCSI] lpfc 8.3.42: Fixed issue of task management commands having a fixed timeout [SCSI] lpfc 8.3.42: Fixed inconsistent spin lock usage. [SCSI] lpfc 8.3.42: Fix driver's abort loop functionality to skip IOs already getting aborted [SCSI] lpfc 8.3.42: Fixed failure to allocate SCSI buffer on PPC64 platform for SLI4 devices [SCSI] lpfc 8.3.42: Fix WARN_ON when driver unloads [SCSI] lpfc 8.3.42: Avoided making pci bar ioremap call during dual-chute WQ/RQ pci bar selection [SCSI] lpfc 8.3.42: Fixed driver iocbq structure's iocb_flag field running out of space [SCSI] lpfc 8.3.42: Fix crash on driver load due to cpu affinity logic [SCSI] lpfc 8.3.42: Fixed logging format of setting driver sysfs attributes hard to interpret [SCSI] lpfc 8.3.42: Fixed back to back RSCNs discovery failure. [SCSI] lpfc 8.3.42: Fixed race condition between BSG I/O dispatch and timeout handling [SCSI] lpfc 8.3.42: Fixed function mode field defined too small for not recognizing dual-chute mode ...
2 parents bff157b + fc85799 commit 0375ec5

37 files changed

+1718
-678
lines changed

Documentation/scsi/ChangeLog.megaraid_sas

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Release Date : Sat. Aug 31, 2013 17:00:00 PST 2013 -
2+
(emaild-id:megaraidlinux@lsi.com)
3+
Adam Radford
4+
Kashyap Desai
5+
Sumit Saxena
6+
Current Version : 06.700.06.00-rc1
7+
Old Version : 06.600.18.00-rc1
8+
1. Add High Availability clustering support using shared Logical Disks.
9+
2. Version and Changelog update.
10+
-------------------------------------------------------------------------------
111
Release Date : Wed. May 15, 2013 17:00:00 PST 2013 -
212
(emaild-id:megaraidlinux@lsi.com)
313
Adam Radford

drivers/scsi/aic7xxx/aic7xxx_pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ ahc_find_pci_device(ahc_dev_softc_t pci)
692692
* ID as valid.
693693
*/
694694
if (ahc_get_pci_function(pci) > 0
695-
&& ahc_9005_subdevinfo_valid(vendor, device, subvendor, subdevice)
695+
&& ahc_9005_subdevinfo_valid(device, vendor, subdevice, subvendor)
696696
&& SUBID_9005_MFUNCENB(subdevice) == 0)
697697
return (NULL);
698698

drivers/scsi/esas2r/esas2r_flash.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,13 @@ bool esas2r_process_fs_ioctl(struct esas2r_adapter *a,
860860
return false;
861861
}
862862

863+
if (fsc->command >= cmdcnt) {
864+
fs->status = ATTO_STS_INV_FUNC;
865+
return false;
866+
}
867+
863868
func = cmd_to_fls_func[fsc->command];
864-
if (fsc->command >= cmdcnt || func == 0xFF) {
869+
if (func == 0xFF) {
865870
fs->status = ATTO_STS_INV_FUNC;
866871
return false;
867872
}
@@ -1355,7 +1360,7 @@ void esas2r_nvram_set_defaults(struct esas2r_adapter *a)
13551360
u32 time = jiffies_to_msecs(jiffies);
13561361

13571362
esas2r_lock_clear_flags(&a->flags, AF_NVR_VALID);
1358-
memcpy(n, &default_sas_nvram, sizeof(struct esas2r_sas_nvram));
1363+
*n = default_sas_nvram;
13591364
n->sas_addr[3] |= 0x0F;
13601365
n->sas_addr[4] = HIBYTE(LOWORD(time));
13611366
n->sas_addr[5] = LOBYTE(LOWORD(time));
@@ -1373,7 +1378,7 @@ void esas2r_nvram_get_defaults(struct esas2r_adapter *a,
13731378
* address out first.
13741379
*/
13751380
memcpy(&sas_addr[0], a->nvram->sas_addr, 8);
1376-
memcpy(nvram, &default_sas_nvram, sizeof(struct esas2r_sas_nvram));
1381+
*nvram = default_sas_nvram;
13771382
memcpy(&nvram->sas_addr[0], &sas_addr[0], 8);
13781383
}
13791384

drivers/scsi/esas2r/esas2r_init.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ void esas2r_kill_adapter(int i)
665665

666666
int esas2r_cleanup(struct Scsi_Host *host)
667667
{
668-
struct esas2r_adapter *a = (struct esas2r_adapter *)host->hostdata;
668+
struct esas2r_adapter *a;
669669
int index;
670670

671671
if (host == NULL) {
@@ -678,6 +678,7 @@ int esas2r_cleanup(struct Scsi_Host *host)
678678
}
679679

680680
esas2r_debug("esas2r_cleanup called for host %p", host);
681+
a = (struct esas2r_adapter *)host->hostdata;
681682
index = a->index;
682683
esas2r_kill_adapter(index);
683684
return index;
@@ -808,7 +809,7 @@ static void esas2r_init_pci_cfg_space(struct esas2r_adapter *a)
808809
int pcie_cap_reg;
809810

810811
pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP);
811-
if (0xffff && pcie_cap_reg) {
812+
if (0xffff & pcie_cap_reg) {
812813
u16 devcontrol;
813814

814815
pci_read_config_word(a->pcid, pcie_cap_reg + PCI_EXP_DEVCTL,
@@ -1550,8 +1551,7 @@ void esas2r_reset_chip(struct esas2r_adapter *a)
15501551
* to not overwrite a previous crash that was saved.
15511552
*/
15521553
if ((a->flags2 & AF2_COREDUMP_AVAIL)
1553-
&& !(a->flags2 & AF2_COREDUMP_SAVED)
1554-
&& a->fw_coredump_buff) {
1554+
&& !(a->flags2 & AF2_COREDUMP_SAVED)) {
15551555
esas2r_read_mem_block(a,
15561556
a->fw_coredump_buff,
15571557
MW_DATA_ADDR_SRAM + 0x80000,

drivers/scsi/esas2r/esas2r_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static int csmi_ioctl_callback(struct esas2r_adapter *a,
415415
lun = tm->lun;
416416
}
417417

418-
if (path > 0 || tid > ESAS2R_MAX_ID) {
418+
if (path > 0) {
419419
rq->func_rsp.ioctl_rsp.csmi.csmi_status = cpu_to_le32(
420420
CSMI_STS_INV_PARAM);
421421
return false;

drivers/scsi/esas2r/esas2r_vda.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,21 @@ static void esas2r_complete_vda_ioctl(struct esas2r_adapter *a,
302302
if (vi->cmd.cfg.cfg_func == VDA_CFG_GET_INIT) {
303303
struct atto_ioctl_vda_cfg_cmd *cfg = &vi->cmd.cfg;
304304
struct atto_vda_cfg_rsp *rsp = &rq->func_rsp.cfg_rsp;
305+
char buf[sizeof(cfg->data.init.fw_release) + 1];
305306

306307
cfg->data_length =
307308
cpu_to_le32(sizeof(struct atto_vda_cfg_init));
308309
cfg->data.init.vda_version =
309310
le32_to_cpu(rsp->vda_version);
310311
cfg->data.init.fw_build = rsp->fw_build;
311312

312-
sprintf((char *)&cfg->data.init.fw_release,
313-
"%1d.%02d",
313+
snprintf(buf, sizeof(buf), "%1d.%02d",
314314
(int)LOBYTE(le16_to_cpu(rsp->fw_release)),
315315
(int)HIBYTE(le16_to_cpu(rsp->fw_release)));
316316

317+
memcpy(&cfg->data.init.fw_release, buf,
318+
sizeof(cfg->data.init.fw_release));
319+
317320
if (LOWORD(LOBYTE(cfg->data.init.fw_build)) == 'A')
318321
cfg->data.init.fw_version =
319322
cfg->data.init.fw_build;

drivers/scsi/fnic/fnic.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#define DFX DRV_NAME "%d: "
4444

4545
#define DESC_CLEAN_LOW_WATERMARK 8
46+
#define FNIC_UCSM_DFLT_THROTTLE_CNT_BLD 16 /* UCSM default throttle count */
47+
#define FNIC_MIN_IO_REQ 256 /* Min IO throttle count */
4648
#define FNIC_MAX_IO_REQ 2048 /* scsi_cmnd tag map entries */
4749
#define FNIC_IO_LOCKS 64 /* IO locks: power of 2 */
4850
#define FNIC_DFLT_QUEUE_DEPTH 32
@@ -154,6 +156,9 @@ do { \
154156
FNIC_CHECK_LOGGING(FNIC_ISR_LOGGING, \
155157
shost_printk(kern_level, host, fmt, ##args);)
156158

159+
#define FNIC_MAIN_NOTE(kern_level, host, fmt, args...) \
160+
shost_printk(kern_level, host, fmt, ##args)
161+
157162
extern const char *fnic_state_str[];
158163

159164
enum fnic_intx_intr_index {
@@ -215,10 +220,12 @@ struct fnic {
215220

216221
struct vnic_stats *stats;
217222
unsigned long stats_time; /* time of stats update */
223+
unsigned long stats_reset_time; /* time of stats reset */
218224
struct vnic_nic_cfg *nic_cfg;
219225
char name[IFNAMSIZ];
220226
struct timer_list notify_timer; /* used for MSI interrupts */
221227

228+
unsigned int fnic_max_tag_id;
222229
unsigned int err_intr_offset;
223230
unsigned int link_intr_offset;
224231

@@ -359,4 +366,5 @@ fnic_chk_state_flags_locked(struct fnic *fnic, unsigned long st_flags)
359366
return ((fnic->state_flags & st_flags) == st_flags);
360367
}
361368
void __fnic_set_state_flags(struct fnic *, unsigned long, unsigned long);
369+
void fnic_dump_fchost_stats(struct Scsi_Host *, struct fc_host_statistics *);
362370
#endif /* _FNIC_H_ */

drivers/scsi/fnic/fnic_main.c

Lines changed: 132 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ module_param(fnic_trace_max_pages, uint, S_IRUGO|S_IWUSR);
7474
MODULE_PARM_DESC(fnic_trace_max_pages, "Total allocated memory pages "
7575
"for fnic trace buffer");
7676

77+
static unsigned int fnic_max_qdepth = FNIC_DFLT_QUEUE_DEPTH;
78+
module_param(fnic_max_qdepth, uint, S_IRUGO|S_IWUSR);
79+
MODULE_PARM_DESC(fnic_max_qdepth, "Queue depth to report for each LUN");
80+
7781
static struct libfc_function_template fnic_transport_template = {
7882
.frame_send = fnic_send,
7983
.lport_set_port_id = fnic_set_port_id,
@@ -91,7 +95,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
9195
if (!rport || fc_remote_port_chkready(rport))
9296
return -ENXIO;
9397

94-
scsi_activate_tcq(sdev, FNIC_DFLT_QUEUE_DEPTH);
98+
scsi_activate_tcq(sdev, fnic_max_qdepth);
9599
return 0;
96100
}
97101

@@ -126,6 +130,7 @@ fnic_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 timeout)
126130
static void fnic_get_host_speed(struct Scsi_Host *shost);
127131
static struct scsi_transport_template *fnic_fc_transport;
128132
static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *);
133+
static void fnic_reset_host_stats(struct Scsi_Host *);
129134

130135
static struct fc_function_template fnic_fc_functions = {
131136

@@ -153,6 +158,7 @@ static struct fc_function_template fnic_fc_functions = {
153158
.set_rport_dev_loss_tmo = fnic_set_rport_dev_loss_tmo,
154159
.issue_fc_host_lip = fnic_reset,
155160
.get_fc_host_stats = fnic_get_stats,
161+
.reset_fc_host_stats = fnic_reset_host_stats,
156162
.dd_fcrport_size = sizeof(struct fc_rport_libfc_priv),
157163
.terminate_rport_io = fnic_terminate_rport_io,
158164
.bsg_request = fc_lport_bsg_request,
@@ -206,13 +212,116 @@ static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *host)
206212
stats->error_frames = vs->tx.tx_errors + vs->rx.rx_errors;
207213
stats->dumped_frames = vs->tx.tx_drops + vs->rx.rx_drop;
208214
stats->invalid_crc_count = vs->rx.rx_crc_errors;
209-
stats->seconds_since_last_reset = (jiffies - lp->boot_time) / HZ;
215+
stats->seconds_since_last_reset =
216+
(jiffies - fnic->stats_reset_time) / HZ;
210217
stats->fcp_input_megabytes = div_u64(fnic->fcp_input_bytes, 1000000);
211218
stats->fcp_output_megabytes = div_u64(fnic->fcp_output_bytes, 1000000);
212219

213220
return stats;
214221
}
215222

223+
/*
224+
* fnic_dump_fchost_stats
225+
* note : dumps fc_statistics into system logs
226+
*/
227+
void fnic_dump_fchost_stats(struct Scsi_Host *host,
228+
struct fc_host_statistics *stats)
229+
{
230+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
231+
"fnic: seconds since last reset = %llu\n",
232+
stats->seconds_since_last_reset);
233+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
234+
"fnic: tx frames = %llu\n",
235+
stats->tx_frames);
236+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
237+
"fnic: tx words = %llu\n",
238+
stats->tx_words);
239+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
240+
"fnic: rx frames = %llu\n",
241+
stats->rx_frames);
242+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
243+
"fnic: rx words = %llu\n",
244+
stats->rx_words);
245+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
246+
"fnic: lip count = %llu\n",
247+
stats->lip_count);
248+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
249+
"fnic: nos count = %llu\n",
250+
stats->nos_count);
251+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
252+
"fnic: error frames = %llu\n",
253+
stats->error_frames);
254+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
255+
"fnic: dumped frames = %llu\n",
256+
stats->dumped_frames);
257+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
258+
"fnic: link failure count = %llu\n",
259+
stats->link_failure_count);
260+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
261+
"fnic: loss of sync count = %llu\n",
262+
stats->loss_of_sync_count);
263+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
264+
"fnic: loss of signal count = %llu\n",
265+
stats->loss_of_signal_count);
266+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
267+
"fnic: prim seq protocol err count = %llu\n",
268+
stats->prim_seq_protocol_err_count);
269+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
270+
"fnic: invalid tx word count= %llu\n",
271+
stats->invalid_tx_word_count);
272+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
273+
"fnic: invalid crc count = %llu\n",
274+
stats->invalid_crc_count);
275+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
276+
"fnic: fcp input requests = %llu\n",
277+
stats->fcp_input_requests);
278+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
279+
"fnic: fcp output requests = %llu\n",
280+
stats->fcp_output_requests);
281+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
282+
"fnic: fcp control requests = %llu\n",
283+
stats->fcp_control_requests);
284+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
285+
"fnic: fcp input megabytes = %llu\n",
286+
stats->fcp_input_megabytes);
287+
FNIC_MAIN_NOTE(KERN_NOTICE, host,
288+
"fnic: fcp output megabytes = %llu\n",
289+
stats->fcp_output_megabytes);
290+
return;
291+
}
292+
293+
/*
294+
* fnic_reset_host_stats : clears host stats
295+
* note : called when reset_statistics set under sysfs dir
296+
*/
297+
static void fnic_reset_host_stats(struct Scsi_Host *host)
298+
{
299+
int ret;
300+
struct fc_lport *lp = shost_priv(host);
301+
struct fnic *fnic = lport_priv(lp);
302+
struct fc_host_statistics *stats;
303+
unsigned long flags;
304+
305+
/* dump current stats, before clearing them */
306+
stats = fnic_get_stats(host);
307+
fnic_dump_fchost_stats(host, stats);
308+
309+
spin_lock_irqsave(&fnic->fnic_lock, flags);
310+
ret = vnic_dev_stats_clear(fnic->vdev);
311+
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
312+
313+
if (ret) {
314+
FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host,
315+
"fnic: Reset vnic stats failed"
316+
" 0x%x", ret);
317+
return;
318+
}
319+
fnic->stats_reset_time = jiffies;
320+
memset(stats, 0, sizeof(*stats));
321+
322+
return;
323+
}
324+
216325
void fnic_log_q_error(struct fnic *fnic)
217326
{
218327
unsigned int i;
@@ -447,13 +556,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
447556

448557
host->transportt = fnic_fc_transport;
449558

450-
err = scsi_init_shared_tag_map(host, FNIC_MAX_IO_REQ);
451-
if (err) {
452-
shost_printk(KERN_ERR, fnic->lport->host,
453-
"Unable to alloc shared tag map\n");
454-
goto err_out_free_hba;
455-
}
456-
457559
/* Setup PCI resources */
458560
pci_set_drvdata(pdev, fnic);
459561

@@ -476,10 +578,10 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
476578
pci_set_master(pdev);
477579

478580
/* Query PCI controller on system for DMA addressing
479-
* limitation for the device. Try 40-bit first, and
581+
* limitation for the device. Try 64-bit first, and
480582
* fail to 32-bit.
481583
*/
482-
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(40));
584+
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
483585
if (err) {
484586
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
485587
if (err) {
@@ -496,10 +598,10 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
496598
goto err_out_release_regions;
497599
}
498600
} else {
499-
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40));
601+
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
500602
if (err) {
501603
shost_printk(KERN_ERR, fnic->lport->host,
502-
"Unable to obtain 40-bit DMA "
604+
"Unable to obtain 64-bit DMA "
503605
"for consistent allocations, aborting.\n");
504606
goto err_out_release_regions;
505607
}
@@ -566,6 +668,22 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
566668
"aborting.\n");
567669
goto err_out_dev_close;
568670
}
671+
672+
/* Configure Maximum Outstanding IO reqs*/
673+
if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) {
674+
host->can_queue = min_t(u32, FNIC_MAX_IO_REQ,
675+
max_t(u32, FNIC_MIN_IO_REQ,
676+
fnic->config.io_throttle_count));
677+
}
678+
fnic->fnic_max_tag_id = host->can_queue;
679+
680+
err = scsi_init_shared_tag_map(host, fnic->fnic_max_tag_id);
681+
if (err) {
682+
shost_printk(KERN_ERR, fnic->lport->host,
683+
"Unable to alloc shared tag map\n");
684+
goto err_out_dev_close;
685+
}
686+
569687
host->max_lun = fnic->config.luns_per_tgt;
570688
host->max_id = FNIC_MAX_FCP_TARGET;
571689
host->max_cmd_len = FCOE_MAX_CMD_LEN;
@@ -719,6 +837,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
719837
}
720838

721839
fc_lport_init_stats(lp);
840+
fnic->stats_reset_time = jiffies;
722841

723842
fc_lport_config(lp);
724843

0 commit comments

Comments
 (0)