Skip to content

Commit bd99b2e

Browse files
Christoph Lameterdledford
authored andcommitted
IB/ipoib: Expire sendonly multicast joins
On neighbor expiration, check to see if the neighbor was actually a sendonly multicast join, and if so, leave the multicast group as we expire the neighbor. Signed-off-by: Christoph Lameter <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 81fb5e2 commit bd99b2e

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

drivers/infiniband/ulp/ipoib/ipoib.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ void ipoib_path_iter_read(struct ipoib_path_iter *iter,
548548

549549
int ipoib_mcast_attach(struct net_device *dev, u16 mlid,
550550
union ib_gid *mgid, int set_qkey);
551+
int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast);
552+
struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid);
551553

552554
int ipoib_init_qp(struct net_device *dev);
553555
int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca);

drivers/infiniband/ulp/ipoib/ipoib_main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,9 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
11491149
unsigned long dt;
11501150
unsigned long flags;
11511151
int i;
1152+
LIST_HEAD(remove_list);
1153+
struct ipoib_mcast *mcast, *tmcast;
1154+
struct net_device *dev = priv->dev;
11521155

11531156
if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags))
11541157
return;
@@ -1176,6 +1179,19 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
11761179
lockdep_is_held(&priv->lock))) != NULL) {
11771180
/* was the neigh idle for two GC periods */
11781181
if (time_after(neigh_obsolete, neigh->alive)) {
1182+
u8 *mgid = neigh->daddr + 4;
1183+
1184+
/* Is this multicast ? */
1185+
if (*mgid == 0xff) {
1186+
mcast = __ipoib_mcast_find(dev, mgid);
1187+
1188+
if (mcast && test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) {
1189+
list_del(&mcast->list);
1190+
rb_erase(&mcast->rb_node, &priv->multicast_tree);
1191+
list_add_tail(&mcast->list, &remove_list);
1192+
}
1193+
}
1194+
11791195
rcu_assign_pointer(*np,
11801196
rcu_dereference_protected(neigh->hnext,
11811197
lockdep_is_held(&priv->lock)));
@@ -1191,6 +1207,8 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
11911207

11921208
out_unlock:
11931209
spin_unlock_irqrestore(&priv->lock, flags);
1210+
list_for_each_entry_safe(mcast, tmcast, &remove_list, list)
1211+
ipoib_mcast_leave(dev, mcast);
11941212
}
11951213

11961214
static void ipoib_reap_neigh(struct work_struct *work)

drivers/infiniband/ulp/ipoib/ipoib_multicast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev,
153153
return mcast;
154154
}
155155

156-
static struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid)
156+
struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid)
157157
{
158158
struct ipoib_dev_priv *priv = netdev_priv(dev);
159159
struct rb_node *n = priv->multicast_tree.rb_node;
@@ -675,7 +675,7 @@ int ipoib_mcast_stop_thread(struct net_device *dev)
675675
return 0;
676676
}
677677

678-
static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
678+
int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
679679
{
680680
struct ipoib_dev_priv *priv = netdev_priv(dev);
681681
int ret = 0;

0 commit comments

Comments
 (0)