@@ -417,6 +417,14 @@ struct ipoib_path {
int valid;
};
+enum ipoib_neigh_state {
+ IPOIB_NEIGH_CREATED,
+ IPOIB_NEIGH_REMOVED,
+};
+
+typedef int (*state_callback_fn)(struct ipoib_dev_priv *priv,
+ enum ipoib_neigh_state state, void *context);
+
struct ipoib_neigh {
struct ipoib_ah *ah;
#ifdef CONFIG_INFINIBAND_IPOIB_CM
@@ -432,6 +440,9 @@ struct ipoib_neigh {
struct rcu_head rcu;
atomic_t refcnt;
unsigned long alive;
+ /* add the ability to notify the objects that hold that neigh */
+ state_callback_fn state_callback;
+ void *context;
};
#define IPOIB_UD_MTU(ib_mtu) (ib_mtu - IPOIB_ENCAP_LEN)
@@ -1179,6 +1179,10 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
rcu_assign_pointer(*np,
rcu_dereference_protected(neigh->hnext,
lockdep_is_held(&priv->lock)));
+ /* inform state if requested */
+ if (neigh->state_callback != NULL)
+ neigh->state_callback(priv, IPOIB_NEIGH_REMOVED, neigh->context);
+
/* remove from path/mc list */
list_del(&neigh->list);
call_rcu(&neigh->rcu, ipoib_neigh_reclaim);