Skip to content

Commit 49e1083

Browse files
alexestrgregkh
authored andcommitted
IB/{hfi1, qib}: Add handling of kernel restart
commit 8d3e711 upstream. A warm restart will fail to unload the driver, leaving link state potentially flapping up to the point the BIOS resets the adapter. Correct the issue by hooking the shutdown pci method, which will bring port down. Cc: <[email protected]> # 4.9.x Reviewed-by: Mike Marciniszyn <[email protected]> Signed-off-by: Alex Estrin <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e884ed8 commit 49e1083

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

drivers/infiniband/hw/hfi1/hfi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,7 @@ struct cc_state *get_cc_state_protected(struct hfi1_pportdata *ppd)
18511851
#define HFI1_HAS_SDMA_TIMEOUT 0x8
18521852
#define HFI1_HAS_SEND_DMA 0x10 /* Supports Send DMA */
18531853
#define HFI1_FORCED_FREEZE 0x80 /* driver forced freeze mode */
1854+
#define HFI1_SHUTDOWN 0x100 /* device is shutting down */
18541855

18551856
/* IB dword length mask in PBC (lower 11 bits); same for all chips */
18561857
#define HFI1_PBC_LENGTH_MASK ((1 << 11) - 1)

drivers/infiniband/hw/hfi1/init.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,10 @@ static void shutdown_device(struct hfi1_devdata *dd)
10291029
unsigned pidx;
10301030
int i;
10311031

1032+
if (dd->flags & HFI1_SHUTDOWN)
1033+
return;
1034+
dd->flags |= HFI1_SHUTDOWN;
1035+
10321036
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
10331037
ppd = dd->pport + pidx;
10341038

@@ -1353,6 +1357,7 @@ void hfi1_disable_after_error(struct hfi1_devdata *dd)
13531357

13541358
static void remove_one(struct pci_dev *);
13551359
static int init_one(struct pci_dev *, const struct pci_device_id *);
1360+
static void shutdown_one(struct pci_dev *);
13561361

13571362
#define DRIVER_LOAD_MSG "Intel " DRIVER_NAME " loaded: "
13581363
#define PFX DRIVER_NAME ": "
@@ -1369,6 +1374,7 @@ static struct pci_driver hfi1_pci_driver = {
13691374
.name = DRIVER_NAME,
13701375
.probe = init_one,
13711376
.remove = remove_one,
1377+
.shutdown = shutdown_one,
13721378
.id_table = hfi1_pci_tbl,
13731379
.err_handler = &hfi1_pci_err_handler,
13741380
};
@@ -1780,6 +1786,13 @@ static void remove_one(struct pci_dev *pdev)
17801786
postinit_cleanup(dd);
17811787
}
17821788

1789+
static void shutdown_one(struct pci_dev *pdev)
1790+
{
1791+
struct hfi1_devdata *dd = pci_get_drvdata(pdev);
1792+
1793+
shutdown_device(dd);
1794+
}
1795+
17831796
/**
17841797
* hfi1_create_rcvhdrq - create a receive header queue
17851798
* @dd: the hfi1_ib device

drivers/infiniband/hw/qib/qib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,7 @@ static inline struct qib_ibport *to_iport(struct ib_device *ibdev, u8 port)
12501250
#define QIB_BADINTR 0x8000 /* severe interrupt problems */
12511251
#define QIB_DCA_ENABLED 0x10000 /* Direct Cache Access enabled */
12521252
#define QIB_HAS_QSFP 0x20000 /* device (card instance) has QSFP */
1253+
#define QIB_SHUTDOWN 0x40000 /* device is shutting down */
12531254

12541255
/*
12551256
* values for ppd->lflags (_ib_port_ related flags)

drivers/infiniband/hw/qib/qib_init.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,10 @@ static void qib_shutdown_device(struct qib_devdata *dd)
850850
struct qib_pportdata *ppd;
851851
unsigned pidx;
852852

853+
if (dd->flags & QIB_SHUTDOWN)
854+
return;
855+
dd->flags |= QIB_SHUTDOWN;
856+
853857
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
854858
ppd = dd->pport + pidx;
855859

@@ -1189,6 +1193,7 @@ void qib_disable_after_error(struct qib_devdata *dd)
11891193

11901194
static void qib_remove_one(struct pci_dev *);
11911195
static int qib_init_one(struct pci_dev *, const struct pci_device_id *);
1196+
static void qib_shutdown_one(struct pci_dev *);
11921197

11931198
#define DRIVER_LOAD_MSG "Intel " QIB_DRV_NAME " loaded: "
11941199
#define PFX QIB_DRV_NAME ": "
@@ -1206,6 +1211,7 @@ static struct pci_driver qib_driver = {
12061211
.name = QIB_DRV_NAME,
12071212
.probe = qib_init_one,
12081213
.remove = qib_remove_one,
1214+
.shutdown = qib_shutdown_one,
12091215
.id_table = qib_pci_tbl,
12101216
.err_handler = &qib_pci_err_handler,
12111217
};
@@ -1556,6 +1562,13 @@ static void qib_remove_one(struct pci_dev *pdev)
15561562
qib_postinit_cleanup(dd);
15571563
}
15581564

1565+
static void qib_shutdown_one(struct pci_dev *pdev)
1566+
{
1567+
struct qib_devdata *dd = pci_get_drvdata(pdev);
1568+
1569+
qib_shutdown_device(dd);
1570+
}
1571+
15591572
/**
15601573
* qib_create_rcvhdrq - create a receive header queue
15611574
* @dd: the qlogic_ib device

0 commit comments

Comments
 (0)