Skip to content

Commit bcd438b

Browse files
committed
Merge git://bedivere.hansenpartnership.com/git/scsi-rc-fixes-2.6
* git://bedivere.hansenpartnership.com/git/scsi-rc-fixes-2.6: (25 commits) [SCSI] bnx2i: Fixed the endian on TTT for NOP out transmission [SCSI] libfc: fix referencing to fc_fcp_pkt from the frame pointer via fr_fsp() [SCSI] libfc: block SCSI eh thread for blocked rports [SCSI] libfc: fix fc_eh_host_reset [SCSI] fcoe: Fix deadlock between fip's recv_work and rtnl [SCSI] qla2xxx: Update version number to 8.03.07.07-k. [SCSI] qla2xxx: Set the task attributes after memsetting fcp cmnd. [SCSI] qla2xxx: Correct inadvertent loop state transitions during port-update handling. [SCSI] qla2xxx: Save and restore irq in the response queue interrupt handler. [SCSI] qla2xxx: Double check for command completion if abort mailbox command fails. [SCSI] qla2xxx: Acquire hardware lock while manipulating dsd list. [SCSI] qla2xxx: Fix qla24xx revision check while enabling interrupts. [SCSI] qla2xxx: T10 DIF - Fix incorrect error reporting. [SCSI] qla2xxx: T10 DIF - Handle uninitalized sectors. [SCSI] hpsa: fix physical device lun and target numbering problem [SCSI] hpsa: fix problem that OBDR devices are not detected [SCSI] isci: add version number [SCSI] isci: fix event-get pointer increment [SCSI] isci: dynamic interrupt coalescing [SCSI] isci: Leave requests alone if already terminating. ...
2 parents 53d872e + 610602f commit bcd438b

28 files changed

Lines changed: 631 additions & 200 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
What: /sys/class/scsi_host/hostX/isci_id
2+
Date: June 2011
3+
Contact: Dave Jiang <dave.jiang@intel.com>
4+
Description:
5+
This file contains the enumerated host ID for the Intel
6+
SCU controller. The Intel(R) C600 Series Chipset SATA/SAS
7+
Storage Control Unit embeds up to two 4-port controllers in
8+
a single PCI device. The controllers are enumerated in order
9+
which usually means the lowest number scsi_host corresponds
10+
with the first controller, but this association is not
11+
guaranteed. The 'isci_id' attribute unambiguously identifies
12+
the controller index: '0' for the first controller,
13+
'1' for the second.

‎MAINTAINERS‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,6 +3262,17 @@ F: Documentation/input/multi-touch-protocol.txt
32623262
F: drivers/input/input-mt.c
32633263
K: \b(ABS|SYN)_MT_
32643264

3265+
INTEL C600 SERIES SAS CONTROLLER DRIVER
3266+
M: Intel SCU Linux support <intel-linux-scu@intel.com>
3267+
M: Dan Williams <dan.j.williams@intel.com>
3268+
M: Dave Jiang <dave.jiang@intel.com>
3269+
M: Ed Nadolski <edmund.nadolski@intel.com>
3270+
L: linux-scsi@vger.kernel.org
3271+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git
3272+
S: Maintained
3273+
F: drivers/scsi/isci/
3274+
F: firmware/isci/
3275+
32653276
INTEL IDLE DRIVER
32663277
M: Len Brown <lenb@kernel.org>
32673278
L: linux-pm@lists.linux-foundation.org

‎drivers/scsi/bnx2i/bnx2i_hwi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
563563
nopout_wqe->itt = ((u16)task->itt |
564564
(ISCSI_TASK_TYPE_MPATH <<
565565
ISCSI_TMF_REQUEST_TYPE_SHIFT));
566-
nopout_wqe->ttt = nopout_hdr->ttt;
566+
nopout_wqe->ttt = be32_to_cpu(nopout_hdr->ttt);
567567
nopout_wqe->flags = 0;
568568
if (!unsol)
569569
nopout_wqe->flags = ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION;

‎drivers/scsi/fcoe/fcoe.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
432432
u8 flogi_maddr[ETH_ALEN];
433433
const struct net_device_ops *ops;
434434

435+
rtnl_lock();
436+
435437
/*
436438
* Don't listen for Ethernet packets anymore.
437439
* synchronize_net() ensures that the packet handlers are not running
@@ -461,6 +463,8 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
461463
" specific feature for LLD.\n");
462464
}
463465

466+
rtnl_unlock();
467+
464468
/* Release the self-reference taken during fcoe_interface_create() */
465469
fcoe_interface_put(fcoe);
466470
}
@@ -1951,11 +1955,8 @@ static void fcoe_destroy_work(struct work_struct *work)
19511955
fcoe_if_destroy(port->lport);
19521956

19531957
/* Do not tear down the fcoe interface for NPIV port */
1954-
if (!npiv) {
1955-
rtnl_lock();
1958+
if (!npiv)
19561959
fcoe_interface_cleanup(fcoe);
1957-
rtnl_unlock();
1958-
}
19591960

19601961
mutex_unlock(&fcoe_config_mutex);
19611962
}
@@ -2009,8 +2010,9 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode)
20092010
printk(KERN_ERR "fcoe: Failed to create interface (%s)\n",
20102011
netdev->name);
20112012
rc = -EIO;
2013+
rtnl_unlock();
20122014
fcoe_interface_cleanup(fcoe);
2013-
goto out_nodev;
2015+
goto out_nortnl;
20142016
}
20152017

20162018
/* Make this the "master" N_Port */
@@ -2027,6 +2029,7 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode)
20272029

20282030
out_nodev:
20292031
rtnl_unlock();
2032+
out_nortnl:
20302033
mutex_unlock(&fcoe_config_mutex);
20312034
return rc;
20322035
}

‎drivers/scsi/hpsa.c‎

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,16 @@ static void hpsa_scsi_replace_entry(struct ctlr_info *h, int hostno,
676676
BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA);
677677
removed[*nremoved] = h->dev[entry];
678678
(*nremoved)++;
679+
680+
/*
681+
* New physical devices won't have target/lun assigned yet
682+
* so we need to preserve the values in the slot we are replacing.
683+
*/
684+
if (new_entry->target == -1) {
685+
new_entry->target = h->dev[entry]->target;
686+
new_entry->lun = h->dev[entry]->lun;
687+
}
688+
679689
h->dev[entry] = new_entry;
680690
added[*nadded] = new_entry;
681691
(*nadded)++;
@@ -1548,10 +1558,17 @@ static inline void hpsa_set_bus_target_lun(struct hpsa_scsi_dev_t *device,
15481558
}
15491559

15501560
static int hpsa_update_device_info(struct ctlr_info *h,
1551-
unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device)
1561+
unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device,
1562+
unsigned char *is_OBDR_device)
15521563
{
1553-
#define OBDR_TAPE_INQ_SIZE 49
1564+
1565+
#define OBDR_SIG_OFFSET 43
1566+
#define OBDR_TAPE_SIG "$DR-10"
1567+
#define OBDR_SIG_LEN (sizeof(OBDR_TAPE_SIG) - 1)
1568+
#define OBDR_TAPE_INQ_SIZE (OBDR_SIG_OFFSET + OBDR_SIG_LEN)
1569+
15541570
unsigned char *inq_buff;
1571+
unsigned char *obdr_sig;
15551572

15561573
inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
15571574
if (!inq_buff)
@@ -1583,6 +1600,16 @@ static int hpsa_update_device_info(struct ctlr_info *h,
15831600
else
15841601
this_device->raid_level = RAID_UNKNOWN;
15851602

1603+
if (is_OBDR_device) {
1604+
/* See if this is a One-Button-Disaster-Recovery device
1605+
* by looking for "$DR-10" at offset 43 in inquiry data.
1606+
*/
1607+
obdr_sig = &inq_buff[OBDR_SIG_OFFSET];
1608+
*is_OBDR_device = (this_device->devtype == TYPE_ROM &&
1609+
strncmp(obdr_sig, OBDR_TAPE_SIG,
1610+
OBDR_SIG_LEN) == 0);
1611+
}
1612+
15861613
kfree(inq_buff);
15871614
return 0;
15881615

@@ -1716,7 +1743,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
17161743
return 0;
17171744
}
17181745

1719-
if (hpsa_update_device_info(h, scsi3addr, this_device))
1746+
if (hpsa_update_device_info(h, scsi3addr, this_device, NULL))
17201747
return 0;
17211748
(*nmsa2xxx_enclosures)++;
17221749
hpsa_set_bus_target_lun(this_device, bus, target, 0);
@@ -1808,7 +1835,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
18081835
*/
18091836
struct ReportLUNdata *physdev_list = NULL;
18101837
struct ReportLUNdata *logdev_list = NULL;
1811-
unsigned char *inq_buff = NULL;
18121838
u32 nphysicals = 0;
18131839
u32 nlogicals = 0;
18141840
u32 ndev_allocated = 0;
@@ -1824,11 +1850,9 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
18241850
GFP_KERNEL);
18251851
physdev_list = kzalloc(reportlunsize, GFP_KERNEL);
18261852
logdev_list = kzalloc(reportlunsize, GFP_KERNEL);
1827-
inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
18281853
tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL);
18291854

1830-
if (!currentsd || !physdev_list || !logdev_list ||
1831-
!inq_buff || !tmpdevice) {
1855+
if (!currentsd || !physdev_list || !logdev_list || !tmpdevice) {
18321856
dev_err(&h->pdev->dev, "out of memory\n");
18331857
goto out;
18341858
}
@@ -1863,7 +1887,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
18631887
/* adjust our table of devices */
18641888
nmsa2xxx_enclosures = 0;
18651889
for (i = 0; i < nphysicals + nlogicals + 1; i++) {
1866-
u8 *lunaddrbytes;
1890+
u8 *lunaddrbytes, is_OBDR = 0;
18671891

18681892
/* Figure out where the LUN ID info is coming from */
18691893
lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position,
@@ -1874,7 +1898,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
18741898
continue;
18751899

18761900
/* Get device type, vendor, model, device id */
1877-
if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice))
1901+
if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice,
1902+
&is_OBDR))
18781903
continue; /* skip it if we can't talk to it. */
18791904
figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun,
18801905
tmpdevice);
@@ -1898,23 +1923,16 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
18981923
hpsa_set_bus_target_lun(this_device, bus, target, lun);
18991924

19001925
switch (this_device->devtype) {
1901-
case TYPE_ROM: {
1926+
case TYPE_ROM:
19021927
/* We don't *really* support actual CD-ROM devices,
19031928
* just "One Button Disaster Recovery" tape drive
19041929
* which temporarily pretends to be a CD-ROM drive.
19051930
* So we check that the device is really an OBDR tape
19061931
* device by checking for "$DR-10" in bytes 43-48 of
19071932
* the inquiry data.
19081933
*/
1909-
char obdr_sig[7];
1910-
#define OBDR_TAPE_SIG "$DR-10"
1911-
strncpy(obdr_sig, &inq_buff[43], 6);
1912-
obdr_sig[6] = '\0';
1913-
if (strncmp(obdr_sig, OBDR_TAPE_SIG, 6) != 0)
1914-
/* Not OBDR device, ignore it. */
1915-
break;
1916-
}
1917-
ncurrent++;
1934+
if (is_OBDR)
1935+
ncurrent++;
19181936
break;
19191937
case TYPE_DISK:
19201938
if (i < nphysicals)
@@ -1947,7 +1965,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
19471965
for (i = 0; i < ndev_allocated; i++)
19481966
kfree(currentsd[i]);
19491967
kfree(currentsd);
1950-
kfree(inq_buff);
19511968
kfree(physdev_list);
19521969
kfree(logdev_list);
19531970
}

‎drivers/scsi/isci/host.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ static void sci_controller_process_completions(struct isci_host *ihost)
531531
break;
532532

533533
case SCU_COMPLETION_TYPE_EVENT:
534+
sci_controller_event_completion(ihost, ent);
535+
break;
536+
534537
case SCU_COMPLETION_TYPE_NOTIFY: {
535538
event_cycle ^= ((event_get+1) & SCU_MAX_EVENTS) <<
536539
(SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT);
@@ -1091,6 +1094,7 @@ static void isci_host_completion_routine(unsigned long data)
10911094
struct isci_request *request;
10921095
struct isci_request *next_request;
10931096
struct sas_task *task;
1097+
u16 active;
10941098

10951099
INIT_LIST_HEAD(&completed_request_list);
10961100
INIT_LIST_HEAD(&errored_request_list);
@@ -1181,6 +1185,13 @@ static void isci_host_completion_routine(unsigned long data)
11811185
}
11821186
}
11831187

1188+
/* the coalesence timeout doubles at each encoding step, so
1189+
* update it based on the ilog2 value of the outstanding requests
1190+
*/
1191+
active = isci_tci_active(ihost);
1192+
writel(SMU_ICC_GEN_VAL(NUMBER, active) |
1193+
SMU_ICC_GEN_VAL(TIMER, ISCI_COALESCE_BASE + ilog2(active)),
1194+
&ihost->smu_registers->interrupt_coalesce_control);
11841195
}
11851196

11861197
/**
@@ -1471,7 +1482,7 @@ static void sci_controller_ready_state_enter(struct sci_base_state_machine *sm)
14711482
struct isci_host *ihost = container_of(sm, typeof(*ihost), sm);
14721483

14731484
/* set the default interrupt coalescence number and timeout value. */
1474-
sci_controller_set_interrupt_coalescence(ihost, 0x10, 250);
1485+
sci_controller_set_interrupt_coalescence(ihost, 0, 0);
14751486
}
14761487

14771488
static void sci_controller_ready_state_exit(struct sci_base_state_machine *sm)

‎drivers/scsi/isci/host.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ static inline struct isci_host *dev_to_ihost(struct domain_device *dev)
369369
#define ISCI_TAG_SEQ(tag) (((tag) >> 12) & (SCI_MAX_SEQ-1))
370370
#define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1))
371371

372+
/* interrupt coalescing baseline: 9 == 3 to 5us interrupt delay per command */
373+
#define ISCI_COALESCE_BASE 9
374+
372375
/* expander attached sata devices require 3 rnc slots */
373376
static inline int sci_remote_device_node_count(struct isci_remote_device *idev)
374377
{

‎drivers/scsi/isci/init.c‎

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,19 @@
5959
#include <linux/firmware.h>
6060
#include <linux/efi.h>
6161
#include <asm/string.h>
62+
#include <scsi/scsi_host.h>
6263
#include "isci.h"
6364
#include "task.h"
6465
#include "probe_roms.h"
6566

67+
#define MAJ 1
68+
#define MIN 0
69+
#define BUILD 0
70+
#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \
71+
__stringify(BUILD)
72+
73+
MODULE_VERSION(DRV_VERSION);
74+
6675
static struct scsi_transport_template *isci_transport_template;
6776

6877
static DEFINE_PCI_DEVICE_TABLE(isci_id_table) = {
@@ -113,6 +122,22 @@ unsigned char max_concurr_spinup = 1;
113122
module_param(max_concurr_spinup, byte, 0);
114123
MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup");
115124

125+
static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf)
126+
{
127+
struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev);
128+
struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
129+
struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha);
130+
131+
return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id);
132+
}
133+
134+
static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);
135+
136+
struct device_attribute *isci_host_attrs[] = {
137+
&dev_attr_isci_id,
138+
NULL
139+
};
140+
116141
static struct scsi_host_template isci_sht = {
117142

118143
.module = THIS_MODULE,
@@ -138,6 +163,7 @@ static struct scsi_host_template isci_sht = {
138163
.slave_alloc = sas_slave_alloc,
139164
.target_destroy = sas_target_destroy,
140165
.ioctl = sas_ioctl,
166+
.shost_attrs = isci_host_attrs,
141167
};
142168

143169
static struct sas_domain_function_template isci_transport_ops = {
@@ -232,17 +258,6 @@ static int isci_register_sas_ha(struct isci_host *isci_host)
232258
return 0;
233259
}
234260

235-
static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf)
236-
{
237-
struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev);
238-
struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
239-
struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha);
240-
241-
return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id);
242-
}
243-
244-
static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);
245-
246261
static void isci_unregister(struct isci_host *isci_host)
247262
{
248263
struct Scsi_Host *shost;
@@ -251,7 +266,6 @@ static void isci_unregister(struct isci_host *isci_host)
251266
return;
252267

253268
shost = isci_host->shost;
254-
device_remove_file(&shost->shost_dev, &dev_attr_isci_id);
255269

256270
sas_unregister_ha(&isci_host->sas_ha);
257271

@@ -415,14 +429,8 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
415429
if (err)
416430
goto err_shost_remove;
417431

418-
err = device_create_file(&shost->shost_dev, &dev_attr_isci_id);
419-
if (err)
420-
goto err_unregister_ha;
421-
422432
return isci_host;
423433

424-
err_unregister_ha:
425-
sas_unregister_ha(&(isci_host->sas_ha));
426434
err_shost_remove:
427435
scsi_remove_host(shost);
428436
err_shost:
@@ -540,7 +548,8 @@ static __init int isci_init(void)
540548
{
541549
int err;
542550

543-
pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME);
551+
pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n",
552+
DRV_NAME, DRV_VERSION);
544553

545554
isci_transport_template = sas_domain_attach_transport(&isci_transport_ops);
546555
if (!isci_transport_template)

0 commit comments

Comments
 (0)