diff options
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_mad.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_mad.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c index d61c03044545..8f152167208a 100644 --- a/drivers/infiniband/hw/ipath/ipath_mad.c +++ b/drivers/infiniband/hw/ipath/ipath_mad.c | |||
@@ -245,7 +245,7 @@ static int recv_subn_get_portinfo(struct ib_smp *smp, | |||
245 | 245 | ||
246 | /* Only return the mkey if the protection field allows it. */ | 246 | /* Only return the mkey if the protection field allows it. */ |
247 | if (smp->method == IB_MGMT_METHOD_SET || dev->mkey == smp->mkey || | 247 | if (smp->method == IB_MGMT_METHOD_SET || dev->mkey == smp->mkey || |
248 | (dev->mkeyprot_resv_lmc >> 6) == 0) | 248 | dev->mkeyprot == 0) |
249 | pip->mkey = dev->mkey; | 249 | pip->mkey = dev->mkey; |
250 | pip->gid_prefix = dev->gid_prefix; | 250 | pip->gid_prefix = dev->gid_prefix; |
251 | lid = dev->dd->ipath_lid; | 251 | lid = dev->dd->ipath_lid; |
@@ -264,7 +264,7 @@ static int recv_subn_get_portinfo(struct ib_smp *smp, | |||
264 | pip->portphysstate_linkdown = | 264 | pip->portphysstate_linkdown = |
265 | (ipath_cvt_physportstate[ibcstat & 0xf] << 4) | | 265 | (ipath_cvt_physportstate[ibcstat & 0xf] << 4) | |
266 | (get_linkdowndefaultstate(dev->dd) ? 1 : 2); | 266 | (get_linkdowndefaultstate(dev->dd) ? 1 : 2); |
267 | pip->mkeyprot_resv_lmc = dev->mkeyprot_resv_lmc; | 267 | pip->mkeyprot_resv_lmc = (dev->mkeyprot << 6) | dev->dd->ipath_lmc; |
268 | pip->linkspeedactive_enabled = 0x11; /* 2.5Gbps, 2.5Gbps */ | 268 | pip->linkspeedactive_enabled = 0x11; /* 2.5Gbps, 2.5Gbps */ |
269 | switch (dev->dd->ipath_ibmtu) { | 269 | switch (dev->dd->ipath_ibmtu) { |
270 | case 4096: | 270 | case 4096: |
@@ -401,6 +401,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
401 | struct ib_port_info *pip = (struct ib_port_info *)smp->data; | 401 | struct ib_port_info *pip = (struct ib_port_info *)smp->data; |
402 | struct ib_event event; | 402 | struct ib_event event; |
403 | struct ipath_ibdev *dev; | 403 | struct ipath_ibdev *dev; |
404 | struct ipath_devdata *dd; | ||
404 | u32 flags; | 405 | u32 flags; |
405 | char clientrereg = 0; | 406 | char clientrereg = 0; |
406 | u16 lid, smlid; | 407 | u16 lid, smlid; |
@@ -415,6 +416,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
415 | goto err; | 416 | goto err; |
416 | 417 | ||
417 | dev = to_idev(ibdev); | 418 | dev = to_idev(ibdev); |
419 | dd = dev->dd; | ||
418 | event.device = ibdev; | 420 | event.device = ibdev; |
419 | event.element.port_num = port; | 421 | event.element.port_num = port; |
420 | 422 | ||
@@ -423,11 +425,12 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
423 | dev->mkey_lease_period = be16_to_cpu(pip->mkey_lease_period); | 425 | dev->mkey_lease_period = be16_to_cpu(pip->mkey_lease_period); |
424 | 426 | ||
425 | lid = be16_to_cpu(pip->lid); | 427 | lid = be16_to_cpu(pip->lid); |
426 | if (lid != dev->dd->ipath_lid) { | 428 | if (dd->ipath_lid != lid || |
429 | dd->ipath_lmc != (pip->mkeyprot_resv_lmc & 7)) { | ||
427 | /* Must be a valid unicast LID address. */ | 430 | /* Must be a valid unicast LID address. */ |
428 | if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE) | 431 | if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE) |
429 | goto err; | 432 | goto err; |
430 | ipath_set_lid(dev->dd, lid, pip->mkeyprot_resv_lmc & 7); | 433 | ipath_set_lid(dd, lid, pip->mkeyprot_resv_lmc & 7); |
431 | event.event = IB_EVENT_LID_CHANGE; | 434 | event.event = IB_EVENT_LID_CHANGE; |
432 | ib_dispatch_event(&event); | 435 | ib_dispatch_event(&event); |
433 | } | 436 | } |
@@ -461,18 +464,18 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
461 | case 0: /* NOP */ | 464 | case 0: /* NOP */ |
462 | break; | 465 | break; |
463 | case 1: /* SLEEP */ | 466 | case 1: /* SLEEP */ |
464 | if (set_linkdowndefaultstate(dev->dd, 1)) | 467 | if (set_linkdowndefaultstate(dd, 1)) |
465 | goto err; | 468 | goto err; |
466 | break; | 469 | break; |
467 | case 2: /* POLL */ | 470 | case 2: /* POLL */ |
468 | if (set_linkdowndefaultstate(dev->dd, 0)) | 471 | if (set_linkdowndefaultstate(dd, 0)) |
469 | goto err; | 472 | goto err; |
470 | break; | 473 | break; |
471 | default: | 474 | default: |
472 | goto err; | 475 | goto err; |
473 | } | 476 | } |
474 | 477 | ||
475 | dev->mkeyprot_resv_lmc = pip->mkeyprot_resv_lmc; | 478 | dev->mkeyprot = pip->mkeyprot_resv_lmc >> 6; |
476 | dev->vl_high_limit = pip->vl_high_limit; | 479 | dev->vl_high_limit = pip->vl_high_limit; |
477 | 480 | ||
478 | switch ((pip->neighbormtu_mastersmsl >> 4) & 0xF) { | 481 | switch ((pip->neighbormtu_mastersmsl >> 4) & 0xF) { |
@@ -495,7 +498,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
495 | /* XXX We have already partially updated our state! */ | 498 | /* XXX We have already partially updated our state! */ |
496 | goto err; | 499 | goto err; |
497 | } | 500 | } |
498 | ipath_set_mtu(dev->dd, mtu); | 501 | ipath_set_mtu(dd, mtu); |
499 | 502 | ||
500 | dev->sm_sl = pip->neighbormtu_mastersmsl & 0xF; | 503 | dev->sm_sl = pip->neighbormtu_mastersmsl & 0xF; |
501 | 504 | ||
@@ -511,16 +514,16 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
511 | * later. | 514 | * later. |
512 | */ | 515 | */ |
513 | if (pip->pkey_violations == 0) | 516 | if (pip->pkey_violations == 0) |
514 | dev->z_pkey_violations = ipath_get_cr_errpkey(dev->dd); | 517 | dev->z_pkey_violations = ipath_get_cr_errpkey(dd); |
515 | 518 | ||
516 | if (pip->qkey_violations == 0) | 519 | if (pip->qkey_violations == 0) |
517 | dev->qkey_violations = 0; | 520 | dev->qkey_violations = 0; |
518 | 521 | ||
519 | ore = pip->localphyerrors_overrunerrors; | 522 | ore = pip->localphyerrors_overrunerrors; |
520 | if (set_phyerrthreshold(dev->dd, (ore >> 4) & 0xF)) | 523 | if (set_phyerrthreshold(dd, (ore >> 4) & 0xF)) |
521 | goto err; | 524 | goto err; |
522 | 525 | ||
523 | if (set_overrunthreshold(dev->dd, (ore & 0xF))) | 526 | if (set_overrunthreshold(dd, (ore & 0xF))) |
524 | goto err; | 527 | goto err; |
525 | 528 | ||
526 | dev->subnet_timeout = pip->clientrereg_resv_subnetto & 0x1F; | 529 | dev->subnet_timeout = pip->clientrereg_resv_subnetto & 0x1F; |
@@ -538,7 +541,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
538 | * is down or is being set to down. | 541 | * is down or is being set to down. |
539 | */ | 542 | */ |
540 | state = pip->linkspeed_portstate & 0xF; | 543 | state = pip->linkspeed_portstate & 0xF; |
541 | flags = dev->dd->ipath_flags; | 544 | flags = dd->ipath_flags; |
542 | lstate = (pip->portphysstate_linkdown >> 4) & 0xF; | 545 | lstate = (pip->portphysstate_linkdown >> 4) & 0xF; |
543 | if (lstate && !(state == IB_PORT_DOWN || state == IB_PORT_NOP)) | 546 | if (lstate && !(state == IB_PORT_DOWN || state == IB_PORT_NOP)) |
544 | goto err; | 547 | goto err; |
@@ -554,7 +557,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
554 | /* FALLTHROUGH */ | 557 | /* FALLTHROUGH */ |
555 | case IB_PORT_DOWN: | 558 | case IB_PORT_DOWN: |
556 | if (lstate == 0) | 559 | if (lstate == 0) |
557 | if (get_linkdowndefaultstate(dev->dd)) | 560 | if (get_linkdowndefaultstate(dd)) |
558 | lstate = IPATH_IB_LINKDOWN_SLEEP; | 561 | lstate = IPATH_IB_LINKDOWN_SLEEP; |
559 | else | 562 | else |
560 | lstate = IPATH_IB_LINKDOWN; | 563 | lstate = IPATH_IB_LINKDOWN; |
@@ -566,7 +569,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
566 | lstate = IPATH_IB_LINKDOWN_DISABLE; | 569 | lstate = IPATH_IB_LINKDOWN_DISABLE; |
567 | else | 570 | else |
568 | goto err; | 571 | goto err; |
569 | ipath_set_linkstate(dev->dd, lstate); | 572 | ipath_set_linkstate(dd, lstate); |
570 | if (flags & IPATH_LINKACTIVE) { | 573 | if (flags & IPATH_LINKACTIVE) { |
571 | event.event = IB_EVENT_PORT_ERR; | 574 | event.event = IB_EVENT_PORT_ERR; |
572 | ib_dispatch_event(&event); | 575 | ib_dispatch_event(&event); |
@@ -575,7 +578,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
575 | case IB_PORT_ARMED: | 578 | case IB_PORT_ARMED: |
576 | if (!(flags & (IPATH_LINKINIT | IPATH_LINKACTIVE))) | 579 | if (!(flags & (IPATH_LINKINIT | IPATH_LINKACTIVE))) |
577 | break; | 580 | break; |
578 | ipath_set_linkstate(dev->dd, IPATH_IB_LINKARM); | 581 | ipath_set_linkstate(dd, IPATH_IB_LINKARM); |
579 | if (flags & IPATH_LINKACTIVE) { | 582 | if (flags & IPATH_LINKACTIVE) { |
580 | event.event = IB_EVENT_PORT_ERR; | 583 | event.event = IB_EVENT_PORT_ERR; |
581 | ib_dispatch_event(&event); | 584 | ib_dispatch_event(&event); |
@@ -584,7 +587,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
584 | case IB_PORT_ACTIVE: | 587 | case IB_PORT_ACTIVE: |
585 | if (!(flags & IPATH_LINKARMED)) | 588 | if (!(flags & IPATH_LINKARMED)) |
586 | break; | 589 | break; |
587 | ipath_set_linkstate(dev->dd, IPATH_IB_LINKACTIVE); | 590 | ipath_set_linkstate(dd, IPATH_IB_LINKACTIVE); |
588 | event.event = IB_EVENT_PORT_ACTIVE; | 591 | event.event = IB_EVENT_PORT_ACTIVE; |
589 | ib_dispatch_event(&event); | 592 | ib_dispatch_event(&event); |
590 | break; | 593 | break; |
@@ -1350,7 +1353,7 @@ static int process_subn(struct ib_device *ibdev, int mad_flags, | |||
1350 | if (dev->mkey_lease_timeout && jiffies >= dev->mkey_lease_timeout) { | 1353 | if (dev->mkey_lease_timeout && jiffies >= dev->mkey_lease_timeout) { |
1351 | /* Clear timeout and mkey protection field. */ | 1354 | /* Clear timeout and mkey protection field. */ |
1352 | dev->mkey_lease_timeout = 0; | 1355 | dev->mkey_lease_timeout = 0; |
1353 | dev->mkeyprot_resv_lmc &= 0x3F; | 1356 | dev->mkeyprot = 0; |
1354 | } | 1357 | } |
1355 | 1358 | ||
1356 | /* | 1359 | /* |
@@ -1361,7 +1364,7 @@ static int process_subn(struct ib_device *ibdev, int mad_flags, | |||
1361 | dev->mkey != smp->mkey && | 1364 | dev->mkey != smp->mkey && |
1362 | (smp->method == IB_MGMT_METHOD_SET || | 1365 | (smp->method == IB_MGMT_METHOD_SET || |
1363 | (smp->method == IB_MGMT_METHOD_GET && | 1366 | (smp->method == IB_MGMT_METHOD_GET && |
1364 | (dev->mkeyprot_resv_lmc >> 7) != 0))) { | 1367 | dev->mkeyprot >= 2))) { |
1365 | if (dev->mkey_violations != 0xFFFF) | 1368 | if (dev->mkey_violations != 0xFFFF) |
1366 | ++dev->mkey_violations; | 1369 | ++dev->mkey_violations; |
1367 | if (dev->mkey_lease_timeout || | 1370 | if (dev->mkey_lease_timeout || |