Commit 3588423f authored by Arthur Jones's avatar Arthur Jones Committed by Roland Dreier

IB/ipath: Test interrupts at driver startup

All too often, interrupts do not get enabled for our card due to BIOS
misconfiguration and other issues.  This patch checks for that
condition on startup and warns the user.  This patch is based on work
(check LID availability) by Robert Walsh.
Signed-off-by: default avatarArthur Jones <arthur.jones@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 9ca48655
...@@ -104,6 +104,9 @@ static int __devinit ipath_init_one(struct pci_dev *, ...@@ -104,6 +104,9 @@ static int __devinit ipath_init_one(struct pci_dev *,
#define PCI_DEVICE_ID_INFINIPATH_HT 0xd #define PCI_DEVICE_ID_INFINIPATH_HT 0xd
#define PCI_DEVICE_ID_INFINIPATH_PE800 0x10 #define PCI_DEVICE_ID_INFINIPATH_PE800 0x10
/* Number of seconds before our card status check... */
#define STATUS_TIMEOUT 60
static const struct pci_device_id ipath_pci_tbl[] = { static const struct pci_device_id ipath_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) }, { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) },
{ PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) }, { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) },
...@@ -119,6 +122,18 @@ static struct pci_driver ipath_driver = { ...@@ -119,6 +122,18 @@ static struct pci_driver ipath_driver = {
.id_table = ipath_pci_tbl, .id_table = ipath_pci_tbl,
}; };
static void ipath_check_status(struct work_struct *work)
{
struct ipath_devdata *dd = container_of(work, struct ipath_devdata,
status_work.work);
/*
* If we don't have any interrupts, let the user know and
* don't bother checking again.
*/
if (dd->ipath_int_counter == 0)
dev_err(&dd->pcidev->dev, "No interrupts detected.\n");
}
static inline void read_bars(struct ipath_devdata *dd, struct pci_dev *dev, static inline void read_bars(struct ipath_devdata *dd, struct pci_dev *dev,
u32 *bar0, u32 *bar1) u32 *bar0, u32 *bar1)
...@@ -187,6 +202,8 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev) ...@@ -187,6 +202,8 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev)
dd->pcidev = pdev; dd->pcidev = pdev;
pci_set_drvdata(pdev, dd); pci_set_drvdata(pdev, dd);
INIT_DELAYED_WORK(&dd->status_work, ipath_check_status);
list_add(&dd->ipath_list, &ipath_dev_list); list_add(&dd->ipath_list, &ipath_dev_list);
bail_unlock: bail_unlock:
...@@ -511,6 +528,9 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, ...@@ -511,6 +528,9 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
ipath_diag_add(dd); ipath_diag_add(dd);
ipath_register_ib_device(dd); ipath_register_ib_device(dd);
/* Check that card status in STATUS_TIMEOUT seconds. */
schedule_delayed_work(&dd->status_work, HZ * STATUS_TIMEOUT);
goto bail; goto bail;
bail_irqsetup: bail_irqsetup:
...@@ -638,6 +658,9 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev) ...@@ -638,6 +658,9 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev)
*/ */
ipath_shutdown_device(dd); ipath_shutdown_device(dd);
cancel_delayed_work(&dd->status_work);
flush_scheduled_work();
if (dd->verbs_dev) if (dd->verbs_dev)
ipath_unregister_ib_device(dd->verbs_dev); ipath_unregister_ib_device(dd->verbs_dev);
......
...@@ -1009,6 +1009,9 @@ irqreturn_t ipath_intr(int irq, void *data) ...@@ -1009,6 +1009,9 @@ irqreturn_t ipath_intr(int irq, void *data)
ipath_stats.sps_ints++; ipath_stats.sps_ints++;
if (dd->ipath_int_counter != (u32) -1)
dd->ipath_int_counter++;
if (!(dd->ipath_flags & IPATH_PRESENT)) { if (!(dd->ipath_flags & IPATH_PRESENT)) {
/* /*
* This return value is not great, but we do not want the * This return value is not great, but we do not want the
......
...@@ -297,6 +297,8 @@ struct ipath_devdata { ...@@ -297,6 +297,8 @@ struct ipath_devdata {
u32 ipath_lastport_piobuf; u32 ipath_lastport_piobuf;
/* is a stats timer active */ /* is a stats timer active */
u32 ipath_stats_timer_active; u32 ipath_stats_timer_active;
/* number of interrupts for this device -- saturates... */
u32 ipath_int_counter;
/* dwords sent read from counter */ /* dwords sent read from counter */
u32 ipath_lastsword; u32 ipath_lastsword;
/* dwords received read from counter */ /* dwords received read from counter */
...@@ -571,6 +573,9 @@ struct ipath_devdata { ...@@ -571,6 +573,9 @@ struct ipath_devdata {
u32 ipath_overrun_thresh_errs; u32 ipath_overrun_thresh_errs;
u32 ipath_lli_errs; u32 ipath_lli_errs;
/* status check work */
struct delayed_work status_work;
/* /*
* Not all devices managed by a driver instance are the same * Not all devices managed by a driver instance are the same
* type, so these fields must be per-device. * type, so these fields must be per-device.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment