aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2015-09-03 17:05:58 -0400
committerDoug Ledford <dledford@redhat.com>2015-09-03 17:05:58 -0400
commitc3acdc06a95ff20d920220ecb931186b0bb22c42 (patch)
tree5e433081f0f017bf0f6e2a7c4b7d331ace528bf0
parent7fbc67df2cd6d0b72fd5d6d3acaa79ab6f5b0224 (diff)
IB/ipoib: Clean up send-only multicast joins
Even though we don't expect the group to be created by the SM we sill need to provide all the parameters to force the SM to validate they are correct. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 0d23e0568deb..5e2db3b7c8bb 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -448,8 +448,7 @@ out_locked:
448 return status; 448 return status;
449} 449}
450 450
451static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast, 451static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast)
452 int create)
453{ 452{
454 struct ipoib_dev_priv *priv = netdev_priv(dev); 453 struct ipoib_dev_priv *priv = netdev_priv(dev);
455 struct ib_sa_multicast *multicast; 454 struct ib_sa_multicast *multicast;
@@ -471,7 +470,14 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast,
471 IB_SA_MCMEMBER_REC_PKEY | 470 IB_SA_MCMEMBER_REC_PKEY |
472 IB_SA_MCMEMBER_REC_JOIN_STATE; 471 IB_SA_MCMEMBER_REC_JOIN_STATE;
473 472
474 if (create) { 473 if (mcast != priv->broadcast) {
474 /*
475 * RFC 4391:
476 * The MGID MUST use the same P_Key, Q_Key, SL, MTU,
477 * and HopLimit as those used in the broadcast-GID. The rest
478 * of attributes SHOULD follow the values used in the
479 * broadcast-GID as well.
480 */
475 comp_mask |= 481 comp_mask |=
476 IB_SA_MCMEMBER_REC_QKEY | 482 IB_SA_MCMEMBER_REC_QKEY |
477 IB_SA_MCMEMBER_REC_MTU_SELECTOR | 483 IB_SA_MCMEMBER_REC_MTU_SELECTOR |
@@ -492,6 +498,22 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast,
492 rec.sl = priv->broadcast->mcmember.sl; 498 rec.sl = priv->broadcast->mcmember.sl;
493 rec.flow_label = priv->broadcast->mcmember.flow_label; 499 rec.flow_label = priv->broadcast->mcmember.flow_label;
494 rec.hop_limit = priv->broadcast->mcmember.hop_limit; 500 rec.hop_limit = priv->broadcast->mcmember.hop_limit;
501
502 /*
503 * Historically Linux IPoIB has never properly supported SEND
504 * ONLY join. It emulated it by not providing all the required
505 * attributes, which is enough to prevent group creation and
506 * detect if there are full members or not. A major problem
507 * with supporting SEND ONLY is detecting when the group is
508 * auto-destroyed as IPoIB will cache the MLID..
509 */
510#if 1
511 if (test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags))
512 comp_mask &= ~IB_SA_MCMEMBER_REC_TRAFFIC_CLASS;
513#else
514 if (test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags))
515 rec.join_state = 4;
516#endif
495 } 517 }
496 518
497 multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, 519 multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port,
@@ -517,7 +539,6 @@ void ipoib_mcast_join_task(struct work_struct *work)
517 struct ib_port_attr port_attr; 539 struct ib_port_attr port_attr;
518 unsigned long delay_until = 0; 540 unsigned long delay_until = 0;
519 struct ipoib_mcast *mcast = NULL; 541 struct ipoib_mcast *mcast = NULL;
520 int create = 1;
521 542
522 if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) 543 if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags))
523 return; 544 return;
@@ -566,7 +587,6 @@ void ipoib_mcast_join_task(struct work_struct *work)
566 if (IS_ERR_OR_NULL(priv->broadcast->mc) && 587 if (IS_ERR_OR_NULL(priv->broadcast->mc) &&
567 !test_bit(IPOIB_MCAST_FLAG_BUSY, &priv->broadcast->flags)) { 588 !test_bit(IPOIB_MCAST_FLAG_BUSY, &priv->broadcast->flags)) {
568 mcast = priv->broadcast; 589 mcast = priv->broadcast;
569 create = 0;
570 if (mcast->backoff > 1 && 590 if (mcast->backoff > 1 &&
571 time_before(jiffies, mcast->delay_until)) { 591 time_before(jiffies, mcast->delay_until)) {
572 delay_until = mcast->delay_until; 592 delay_until = mcast->delay_until;
@@ -590,12 +610,8 @@ void ipoib_mcast_join_task(struct work_struct *work)
590 /* Found the next unjoined group */ 610 /* Found the next unjoined group */
591 init_completion(&mcast->done); 611 init_completion(&mcast->done);
592 set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); 612 set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags);
593 if (test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags))
594 create = 0;
595 else
596 create = 1;
597 spin_unlock_irq(&priv->lock); 613 spin_unlock_irq(&priv->lock);
598 ipoib_mcast_join(dev, mcast, create); 614 ipoib_mcast_join(dev, mcast);
599 spin_lock_irq(&priv->lock); 615 spin_lock_irq(&priv->lock);
600 } else if (!delay_until || 616 } else if (!delay_until ||
601 time_before(mcast->delay_until, delay_until)) 617 time_before(mcast->delay_until, delay_until))
@@ -618,7 +634,7 @@ out:
618 } 634 }
619 spin_unlock_irq(&priv->lock); 635 spin_unlock_irq(&priv->lock);
620 if (mcast) 636 if (mcast)
621 ipoib_mcast_join(dev, mcast, create); 637 ipoib_mcast_join(dev, mcast);
622} 638}
623 639
624int ipoib_mcast_start_thread(struct net_device *dev) 640int ipoib_mcast_start_thread(struct net_device *dev)