[openib-general] Re: ipoib_mcast_send.patch
Roland Dreier
rdreier at cisco.com
Wed Feb 8 11:49:36 PST 2006
I think we might want to be even more paranoid and wait until the
broadcast join succeeds before allowing send-only joins. Otherwise
we could create a send-only MCG with the wrong Q_Key, SL, etc.
something like this maybe?
--- infiniband/ulp/ipoib/ipoib_multicast.c (revision 5337)
+++ infiniband/ulp/ipoib/ipoib_multicast.c (working copy)
@@ -222,6 +222,13 @@ static int ipoib_mcast_join_finish(struc
sizeof (union ib_gid))) {
priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey);
priv->tx_wr.wr.ud.remote_qkey = priv->qkey;
+
+ /*
+ * Make sure that all the attributes are visible
+ * before we set the attached bit, so that send-only
+ * joins don't get started with incorrect attributes.
+ */
+ smp_wmb();
}
if (!test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) {
@@ -533,8 +540,10 @@ void ipoib_mcast_join_task(void *dev_ptr
}
if (!priv->broadcast) {
- priv->broadcast = ipoib_mcast_alloc(dev, 1);
- if (!priv->broadcast) {
+ struct ipoib_mcast *broadcast;
+
+ broadcast = ipoib_mcast_alloc(dev, 1);
+ if (!broadcast) {
ipoib_warn(priv, "failed to allocate broadcast group\n");
mutex_lock(&mcast_mutex);
if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
@@ -544,10 +553,11 @@ void ipoib_mcast_join_task(void *dev_ptr
return;
}
- memcpy(priv->broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
+ spin_lock_irq(&priv->lock);
+ memcpy(broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
sizeof (union ib_gid));
+ priv->broadcast = broadcast;
- spin_lock_irq(&priv->lock);
__ipoib_mcast_add(dev, priv->broadcast);
spin_unlock_irq(&priv->lock);
}
More information about the general
mailing list