Skip to content

Commit 3126448

Browse files
Mitko Haralanovrolandd
authored andcommitted
IB/qib: Ensure that LOS and DFE are being turned off
Due to timing, it is possible for the LOS and DFE to remain on. This is due to the link progressing to LinkUP prior to the driver getting the first Status Changed interrupt. By expanding the conditions under which LOS is turned off and DFE timeout is being set, timing is no longer an issue. Signed-off-by: Mitko Haralanov <[email protected]> Signed-off-by: Mike Marciniszyn <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 2c53b43 commit 3126448

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

drivers/infiniband/hw/qib/qib_iba7322.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ static u8 ib_rate_to_delay[IB_RATE_120_GBPS + 1] = {
469469
#define IB_7322_LT_STATE_RECOVERIDLE 0x0f
470470
#define IB_7322_LT_STATE_CFGENH 0x10
471471
#define IB_7322_LT_STATE_CFGTEST 0x11
472+
#define IB_7322_LT_STATE_CFGWAITRMTTEST 0x12
473+
#define IB_7322_LT_STATE_CFGWAITENH 0x13
472474

473475
/* link state machine states from IBC */
474476
#define IB_7322_L_STATE_DOWN 0x0
@@ -498,8 +500,10 @@ static const u8 qib_7322_physportstate[0x20] = {
498500
IB_PHYSPORTSTATE_LINK_ERR_RECOVER,
499501
[IB_7322_LT_STATE_CFGENH] = IB_PHYSPORTSTATE_CFG_ENH,
500502
[IB_7322_LT_STATE_CFGTEST] = IB_PHYSPORTSTATE_CFG_TRAIN,
501-
[0x12] = IB_PHYSPORTSTATE_CFG_TRAIN,
502-
[0x13] = IB_PHYSPORTSTATE_CFG_WAIT_ENH,
503+
[IB_7322_LT_STATE_CFGWAITRMTTEST] =
504+
IB_PHYSPORTSTATE_CFG_TRAIN,
505+
[IB_7322_LT_STATE_CFGWAITENH] =
506+
IB_PHYSPORTSTATE_CFG_WAIT_ENH,
503507
[0x14] = IB_PHYSPORTSTATE_CFG_TRAIN,
504508
[0x15] = IB_PHYSPORTSTATE_CFG_TRAIN,
505509
[0x16] = IB_PHYSPORTSTATE_CFG_TRAIN,
@@ -1692,7 +1696,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst)
16921696
break;
16931697
}
16941698

1695-
if (ibclt == IB_7322_LT_STATE_CFGTEST &&
1699+
if (((ibclt >= IB_7322_LT_STATE_CFGTEST &&
1700+
ibclt <= IB_7322_LT_STATE_CFGWAITENH) ||
1701+
ibclt == IB_7322_LT_STATE_LINKUP) &&
16961702
(ibcst & SYM_MASK(IBCStatusA_0, LinkSpeedQDR))) {
16971703
force_h1(ppd);
16981704
ppd->cpspec->qdr_reforce = 1;
@@ -7301,12 +7307,17 @@ static void ibsd_wr_allchans(struct qib_pportdata *ppd, int addr, unsigned data,
73017307
static void serdes_7322_los_enable(struct qib_pportdata *ppd, int enable)
73027308
{
73037309
u64 data = qib_read_kreg_port(ppd, krp_serdesctrl);
7304-
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS %s\n",
7305-
ppd->dd->unit, ppd->port, (enable ? "on" : "off"));
7306-
if (enable)
7310+
u8 state = SYM_FIELD(data, IBSerdesCtrl_0, RXLOSEN);
7311+
7312+
if (enable && !state) {
7313+
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS on\n",
7314+
ppd->dd->unit, ppd->port);
73077315
data |= SYM_MASK(IBSerdesCtrl_0, RXLOSEN);
7308-
else
7316+
} else if (!enable && state) {
7317+
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS off\n",
7318+
ppd->dd->unit, ppd->port);
73097319
data &= ~SYM_MASK(IBSerdesCtrl_0, RXLOSEN);
7320+
}
73107321
qib_write_kreg_port(ppd, krp_serdesctrl, data);
73117322
}
73127323

drivers/infiniband/hw/qib/qib_intr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,12 @@ void qib_handle_e_ibstatuschanged(struct qib_pportdata *ppd, u64 ibcs)
9696
* states, or if it transitions from any of the up (INIT or better)
9797
* states into any of the down states (except link recovery), then
9898
* call the chip-specific code to take appropriate actions.
99+
*
100+
* ppd->lflags could be 0 if this is the first time the interrupt
101+
* handlers has been called but the link is already up.
99102
*/
100-
if (lstate >= IB_PORT_INIT && (ppd->lflags & QIBL_LINKDOWN) &&
103+
if (lstate >= IB_PORT_INIT &&
104+
(!ppd->lflags || (ppd->lflags & QIBL_LINKDOWN)) &&
101105
ltstate == IB_PHYSPORTSTATE_LINKUP) {
102106
/* transitioned to UP */
103107
if (dd->f_ib_updown(ppd, 1, ibcs))

0 commit comments

Comments
 (0)