Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 229263
b: refs/heads/master
c: 3c9e5f4
h: refs/heads/master
i:
  229261: df07749
  229259: 45cdd73
  229255: 58f8b76
  229247: 2f5525b
v: v3
  • Loading branch information
Mike Marciniszyn authored and Roland Dreier committed Jan 11, 2011
1 parent de57ff1 commit 0ae106e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a377acd15188cf11e47a67af5feea098cd8b25d2
refs/heads/master: 3c9e5f4d657170c2fbc3d382d2daae3820713a6c
45 changes: 25 additions & 20 deletions trunk/drivers/infiniband/hw/qib/qib_mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
lid = be16_to_cpu(pip->lid);
/* Must be a valid unicast LID address. */
if (lid == 0 || lid >= QIB_MULTICAST_LID_BASE)
goto err;
if (ppd->lid != lid || ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) {
smp->status |= IB_SMP_INVALID_FIELD;
else if (ppd->lid != lid || ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) {
if (ppd->lid != lid)
qib_set_uevent_bits(ppd, _QIB_EVENT_LID_CHANGE_BIT);
if (ppd->lmc != (pip->mkeyprot_resv_lmc & 7))
Expand All @@ -683,8 +683,8 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
msl = pip->neighbormtu_mastersmsl & 0xF;
/* Must be a valid unicast LID address. */
if (smlid == 0 || smlid >= QIB_MULTICAST_LID_BASE)
goto err;
if (smlid != ibp->sm_lid || msl != ibp->sm_sl) {
smp->status |= IB_SMP_INVALID_FIELD;
else if (smlid != ibp->sm_lid || msl != ibp->sm_sl) {
spin_lock_irqsave(&ibp->lock, flags);
if (ibp->sm_ah) {
if (smlid != ibp->sm_lid)
Expand All @@ -707,8 +707,9 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
if (lwe == 0xFF)
lwe = ppd->link_width_supported;
else if (lwe >= 16 || (lwe & ~ppd->link_width_supported))
goto err;
set_link_width_enabled(ppd, lwe);
smp->status |= IB_SMP_INVALID_FIELD;
else if (lwe != ppd->link_width_enabled)
set_link_width_enabled(ppd, lwe);
}

lse = pip->linkspeedactive_enabled & 0xF;
Expand All @@ -721,8 +722,9 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
if (lse == 15)
lse = ppd->link_speed_supported;
else if (lse >= 8 || (lse & ~ppd->link_speed_supported))
goto err;
set_link_speed_enabled(ppd, lse);
smp->status |= IB_SMP_INVALID_FIELD;
else if (lse != ppd->link_speed_enabled)
set_link_speed_enabled(ppd, lse);
}

/* Set link down default state. */
Expand All @@ -738,7 +740,7 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
IB_LINKINITCMD_POLL);
break;
default:
goto err;
smp->status |= IB_SMP_INVALID_FIELD;
}

ibp->mkeyprot = pip->mkeyprot_resv_lmc >> 6;
Expand All @@ -748,15 +750,17 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,

mtu = ib_mtu_enum_to_int((pip->neighbormtu_mastersmsl >> 4) & 0xF);
if (mtu == -1)
goto err;
qib_set_mtu(ppd, mtu);
smp->status |= IB_SMP_INVALID_FIELD;
else
qib_set_mtu(ppd, mtu);

/* Set operational VLs */
vls = (pip->operationalvl_pei_peo_fpi_fpo >> 4) & 0xF;
if (vls) {
if (vls > ppd->vls_supported)
goto err;
(void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_OP_VLS, vls);
smp->status |= IB_SMP_INVALID_FIELD;
else
(void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_OP_VLS, vls);
}

if (pip->mkey_violations == 0)
Expand All @@ -770,10 +774,10 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,

ore = pip->localphyerrors_overrunerrors;
if (set_phyerrthreshold(ppd, (ore >> 4) & 0xF))
goto err;
smp->status |= IB_SMP_INVALID_FIELD;

if (set_overrunthreshold(ppd, (ore & 0xF)))
goto err;
smp->status |= IB_SMP_INVALID_FIELD;

ibp->subnet_timeout = pip->clientrereg_resv_subnetto & 0x1F;

Expand All @@ -792,7 +796,7 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
state = pip->linkspeed_portstate & 0xF;
lstate = (pip->portphysstate_linkdown >> 4) & 0xF;
if (lstate && !(state == IB_PORT_DOWN || state == IB_PORT_NOP))
goto err;
smp->status |= IB_SMP_INVALID_FIELD;

/*
* Only state changes of DOWN, ARM, and ACTIVE are valid
Expand All @@ -812,8 +816,10 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
lstate = QIB_IB_LINKDOWN;
else if (lstate == 3)
lstate = QIB_IB_LINKDOWN_DISABLE;
else
goto err;
else {
smp->status |= IB_SMP_INVALID_FIELD;
break;
}
spin_lock_irqsave(&ppd->lflags_lock, flags);
ppd->lflags &= ~QIBL_LINKV;
spin_unlock_irqrestore(&ppd->lflags_lock, flags);
Expand All @@ -835,8 +841,7 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
qib_set_linkstate(ppd, QIB_IB_LINKACTIVE);
break;
default:
/* XXX We have already partially updated our state! */
goto err;
smp->status |= IB_SMP_INVALID_FIELD;
}

ret = subn_get_portinfo(smp, ibdev, port);
Expand Down

0 comments on commit 0ae106e

Please sign in to comment.