Skip to content

Commit 626c077

Browse files
ssanchez11dledford
authored andcommitted
IB/hfi1: Prevent link down request double queuing
When link interrupts occur, multiple link down requests could be queued up when only one is needed. This could get the hfi1 out of sync with its link partner during LNI. Only allow one link down request to be queued at any one time. Reviewed-by: Dean Luick <[email protected]> Signed-off-by: Sebastian Sanchez <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 71d4700 commit 626c077

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/infiniband/hw/hfi1/chip.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7045,6 +7045,7 @@ void handle_link_down(struct work_struct *work)
70457045
/* Go offline first, then deal with reading/writing through 8051 */
70467046
was_up = !!(ppd->host_link_state & HLS_UP);
70477047
set_link_state(ppd, HLS_DN_OFFLINE);
7048+
xchg(&ppd->is_link_down_queued, 0);
70487049

70497050
if (was_up) {
70507051
lcl_reason = 0;
@@ -7805,10 +7806,11 @@ static void handle_8051_interrupt(struct hfi1_devdata *dd, u32 unused, u64 reg)
78057806
*/
78067807
if ((ppd->host_link_state &
78077808
(HLS_GOING_OFFLINE | HLS_LINK_COOLDOWN)) ||
7808-
ppd->link_enabled == 0) {
7809+
ppd->link_enabled == 0 || ppd->is_link_down_queued) {
78097810
dd_dev_info(dd, "%s: not queuing link down\n",
78107811
__func__);
78117812
} else {
7813+
xchg(&ppd->is_link_down_queued, 1);
78127814
queue_work(ppd->link_wq, &ppd->link_down_work);
78137815
}
78147816
}

drivers/infiniband/hw/hfi1/hfi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ struct hfi1_pportdata {
644644
/* placeholders for IB MAD packet settings */
645645
u8 overrun_threshold;
646646
u8 phy_error_threshold;
647+
unsigned int is_link_down_queued;
647648

648649
/* Used to override LED behavior for things like maintenance beaconing*/
649650
/*

0 commit comments

Comments
 (0)