diff options
author | Ralph Campbell <ralph.campbell@qlogic.com> | 2007-09-13 14:42:52 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-10-09 23:55:06 -0400 |
commit | 542869a17eee2edf389273f40f757aa4e662b3da (patch) | |
tree | 720a0099a4e91e325671d0bddd506a5a2b51471c /drivers/infiniband | |
parent | 15cba26f42c13ca30cbb4388f132ac0ddf4df538 (diff) |
IB/ipath: Remove duplicate copy of LMC
The LMC value was being saved by the SMA in two places. This patch
cleans it up so only one copy is kept.
Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_mad.c | 39 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_ud.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_verbs.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_verbs.h | 2 |
4 files changed, 29 insertions, 26 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 || |
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c index 34c4a0a5be31..16a2a938b520 100644 --- a/drivers/infiniband/hw/ipath/ipath_ud.c +++ b/drivers/infiniband/hw/ipath/ipath_ud.c | |||
@@ -236,10 +236,10 @@ static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_swqe *swqe) | |||
236 | wc.pkey_index = 0; | 236 | wc.pkey_index = 0; |
237 | wc.slid = dev->dd->ipath_lid | | 237 | wc.slid = dev->dd->ipath_lid | |
238 | (ah_attr->src_path_bits & | 238 | (ah_attr->src_path_bits & |
239 | ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1)); | 239 | ((1 << dev->dd->ipath_lmc) - 1)); |
240 | wc.sl = ah_attr->sl; | 240 | wc.sl = ah_attr->sl; |
241 | wc.dlid_path_bits = | 241 | wc.dlid_path_bits = |
242 | ah_attr->dlid & ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); | 242 | ah_attr->dlid & ((1 << dev->dd->ipath_lmc) - 1); |
243 | wc.port_num = 1; | 243 | wc.port_num = 1; |
244 | /* Signal completion event if the solicited bit is set. */ | 244 | /* Signal completion event if the solicited bit is set. */ |
245 | ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, | 245 | ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, |
@@ -289,7 +289,7 @@ int ipath_make_ud_req(struct ipath_qp *qp) | |||
289 | } else { | 289 | } else { |
290 | dev->n_unicast_xmit++; | 290 | dev->n_unicast_xmit++; |
291 | lid = ah_attr->dlid & | 291 | lid = ah_attr->dlid & |
292 | ~((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); | 292 | ~((1 << dev->dd->ipath_lmc) - 1); |
293 | if (unlikely(lid == dev->dd->ipath_lid)) { | 293 | if (unlikely(lid == dev->dd->ipath_lid)) { |
294 | ipath_ud_loopback(qp, wqe); | 294 | ipath_ud_loopback(qp, wqe); |
295 | goto done; | 295 | goto done; |
@@ -341,7 +341,7 @@ int ipath_make_ud_req(struct ipath_qp *qp) | |||
341 | lid = dev->dd->ipath_lid; | 341 | lid = dev->dd->ipath_lid; |
342 | if (lid) { | 342 | if (lid) { |
343 | lid |= ah_attr->src_path_bits & | 343 | lid |= ah_attr->src_path_bits & |
344 | ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); | 344 | ((1 << dev->dd->ipath_lmc) - 1); |
345 | qp->s_hdr.lrh[3] = cpu_to_be16(lid); | 345 | qp->s_hdr.lrh[3] = cpu_to_be16(lid); |
346 | } else | 346 | } else |
347 | qp->s_hdr.lrh[3] = IB_LID_PERMISSIVE; | 347 | qp->s_hdr.lrh[3] = IB_LID_PERMISSIVE; |
@@ -551,7 +551,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
551 | * Save the LMC lower bits if the destination LID is a unicast LID. | 551 | * Save the LMC lower bits if the destination LID is a unicast LID. |
552 | */ | 552 | */ |
553 | wc.dlid_path_bits = dlid >= IPATH_MULTICAST_LID_BASE ? 0 : | 553 | wc.dlid_path_bits = dlid >= IPATH_MULTICAST_LID_BASE ? 0 : |
554 | dlid & ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); | 554 | dlid & ((1 << dev->dd->ipath_lmc) - 1); |
555 | wc.port_num = 1; | 555 | wc.port_num = 1; |
556 | /* Signal completion event if the solicited bit is set. */ | 556 | /* Signal completion event if the solicited bit is set. */ |
557 | ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, | 557 | ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 495194bb84a5..13aba3d40543 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -513,7 +513,7 @@ void ipath_ib_rcv(struct ipath_ibdev *dev, void *rhdr, void *data, | |||
513 | /* Check for a valid destination LID (see ch. 7.11.1). */ | 513 | /* Check for a valid destination LID (see ch. 7.11.1). */ |
514 | lid = be16_to_cpu(hdr->lrh[1]); | 514 | lid = be16_to_cpu(hdr->lrh[1]); |
515 | if (lid < IPATH_MULTICAST_LID_BASE) { | 515 | if (lid < IPATH_MULTICAST_LID_BASE) { |
516 | lid &= ~((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); | 516 | lid &= ~((1 << dev->dd->ipath_lmc) - 1); |
517 | if (unlikely(lid != dev->dd->ipath_lid)) { | 517 | if (unlikely(lid != dev->dd->ipath_lid)) { |
518 | dev->rcv_errors++; | 518 | dev->rcv_errors++; |
519 | goto bail; | 519 | goto bail; |
@@ -1152,7 +1152,7 @@ static int ipath_query_port(struct ib_device *ibdev, | |||
1152 | 1152 | ||
1153 | memset(props, 0, sizeof(*props)); | 1153 | memset(props, 0, sizeof(*props)); |
1154 | props->lid = lid ? lid : __constant_be16_to_cpu(IB_LID_PERMISSIVE); | 1154 | props->lid = lid ? lid : __constant_be16_to_cpu(IB_LID_PERMISSIVE); |
1155 | props->lmc = dev->mkeyprot_resv_lmc & 7; | 1155 | props->lmc = dd->ipath_lmc; |
1156 | props->sm_lid = dev->sm_lid; | 1156 | props->sm_lid = dev->sm_lid; |
1157 | props->sm_sl = dev->sm_sl; | 1157 | props->sm_sl = dev->sm_sl; |
1158 | ibcstat = dd->ipath_lastibcstat; | 1158 | ibcstat = dd->ipath_lastibcstat; |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h index 9be9bf91f4f0..6ccb54f104a3 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.h +++ b/drivers/infiniband/hw/ipath/ipath_verbs.h | |||
@@ -501,7 +501,7 @@ struct ipath_ibdev { | |||
501 | int ib_unit; /* This is the device number */ | 501 | int ib_unit; /* This is the device number */ |
502 | u16 sm_lid; /* in host order */ | 502 | u16 sm_lid; /* in host order */ |
503 | u8 sm_sl; | 503 | u8 sm_sl; |
504 | u8 mkeyprot_resv_lmc; | 504 | u8 mkeyprot; |
505 | /* non-zero when timer is set */ | 505 | /* non-zero when timer is set */ |
506 | unsigned long mkey_lease_timeout; | 506 | unsigned long mkey_lease_timeout; |
507 | 507 | ||