History

IB/qib: Fix issue with link states and QSFP cables

Fix an issue where the link would come up after replugging a cable even if it has been DISABLED manually.

Mitko Haralanov committed 15 years ago

Commit 16d99811 parent dde05cb2 files · +21 −10Browse files

Unified · Split

2 files
  1. drivers/infiniband/hw/qib/qib_iba7322.c +20 −10
  2. drivers/infiniband/hw/qib/qib_qsfp.h +1 −0
drivers/infiniband/hw/qib/qib_iba7322.c+20−10
@@ -2310,12 +2310,15 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd) · 2309 unmodified lines
23102310 val = ppd->cpspec->ibcctrl_a | (QLOGIC_IB_IBCC_LINKINITCMD_DISABLE <<
23112311 QLOGIC_IB_IBCC_LINKINITCMD_SHIFT);
23122312
2313+ ppd->cpspec->ibcctrl_a = val;
23132314 /*
23142315 * Reset the PCS interface to the serdes (and also ibc, which is still
23152316 * in reset from above). Writes new value of ibcctrl_a as last step.
23162317 */
23172318 qib_7322_mini_pcs_reset(ppd);
23182319 qib_write_kreg(dd, kr_scratch, 0ULL);
2320+ /* clear the linkinit cmds */
2321+ ppd->cpspec->ibcctrl_a &= ~SYM_MASK(IBCCtrlA_0, LinkInitCmd);
23192322
23202323 if (!ppd->cpspec->ibcctrl_b) {
23212324 unsigned lse = ppd->link_speed_enabled;
@@ -2381,11 +2384,6 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd) · 59 unmodified lines
23812384 ppd->cpspec->ibcctrl_a |= SYM_MASK(IBCCtrlA_0, IBLinkEn);
23822385 set_vls(ppd);
23832386
2384− /* Hold the link state machine for mezz boards */
2385− qib_set_ib_7322_lstate(ppd, 0,
2386− QLOGIC_IB_IBCC_LINKINITCMD_DISABLE);
2387−
2388−
23892387 /* be paranoid against later code motion, etc. */
23902388 spin_lock_irqsave(&dd->cspec->rcvmod_lock, flags);
23912389 ppd->p_rcvctrl |= SYM_MASK(RcvCtrl_0, RcvIBPortEnable);
@@ -5594,6 +5592,7 @@ static void qsfp_7322_event(struct work_struct *work) · 3202 unmodified lines
55945592 struct qib_qsfp_data *qd;
55955593 struct qib_pportdata *ppd;
55965594 u64 pwrup;
5595+ unsigned long flags;
55975596 int ret;
55985597 u32 le2;
55995598
@@ -5605,11 +5604,15 @@ static void qsfp_7322_event(struct work_struct *work) · 5 unmodified lines
56055604 /* Delay for 20 msecs to allow ModPrs resistor to setup */
56065605 mdelay(QSFP_MODPRS_LAG_MSEC);
56075606
5608− if (!qib_qsfp_mod_present(ppd))
5607+ if (!qib_qsfp_mod_present(ppd)) {
5608+ ppd->cpspec->qsfp_data.modpresent = 0;
56095609 /* Set the physical link to disabled */
56105610 qib_set_ib_7322_lstate(ppd, 0,
56115611 QLOGIC_IB_IBCC_LINKINITCMD_DISABLE);
5612− else {
5612+ spin_lock_irqsave(&ppd->lflags_lock, flags);
5613+ ppd->lflags &= ~QIBL_LINKV;
5614+ spin_unlock_irqrestore(&ppd->lflags_lock, flags);
5615+ } else {
56135616 /*
56145617 * Some QSFP's not only do not respond until the full power-up
56155618 * time, but may behave badly if we try. So hold off responding
@@ -5649,11 +5652,18 @@ static void qsfp_7322_event(struct work_struct *work) · 33 unmodified lines
56495652 */
56505653 init_txdds_table(ppd, 0);
56515654 /* The physical link is being re-enabled only when the
5652− previous state was DISABLED. This should only happen when
5653− the cable has been physically pulled. */
5654− if (ppd->lflags & QIBL_IB_LINK_DISABLED)
5655+ * previous state was DISABLED and the VALID bit is not
5656+ * set. This should only happen when the cable has been
5657+ * physically pulled. */
5658+ if (!ppd->cpspec->qsfp_data.modpresent &&
5659+ (ppd->lflags & (QIBL_LINKV | QIBL_IB_LINK_DISABLED))) {
5660+ ppd->cpspec->qsfp_data.modpresent = 1;
56555661 qib_set_ib_7322_lstate(ppd, 0,
56565662 QLOGIC_IB_IBCC_LINKINITCMD_SLEEP);
5663+ spin_lock_irqsave(&ppd->lflags_lock, flags);
5664+ ppd->lflags |= QIBL_LINKV;
5665+ spin_unlock_irqrestore(&ppd->lflags_lock, flags);
5666+ }
56575667 }
56585668 }
56595669
drivers/infiniband/hw/qib/qib_qsfp.h+1−0
@@ -178,6 +178,7 @@ struct qib_qsfp_data { · 177 unmodified lines
178178 struct work_struct work;
179179 struct qib_qsfp_cache cache;
180180 u64 t_insert;
181+ u8 modpresent;
181182 };
182183
183184 extern int qib_refresh_qsfp_cache(struct qib_pportdata *ppd,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t