aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xen/netfront/netfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/xen/netfront/netfront.c')
-rw-r--r--sys/dev/xen/netfront/netfront.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c
index 6ac6ecc3bdb7..3bc3679eb0db 100644
--- a/sys/dev/xen/netfront/netfront.c
+++ b/sys/dev/xen/netfront/netfront.c
@@ -335,8 +335,16 @@ static void mbuf_release(struct mbuf *m)
KASSERT(ref != NULL, ("Cannot find refcount"));
KASSERT(ref->count > 0, ("Invalid reference count"));
- if (--ref->count == 0)
+ if (--ref->count == 0) {
+ /*
+ * Explicitly free the tag while we hold the tx queue lock.
+ * This ensures that the tag is deleted promptly in case
+ * something else is holding extra references to the mbuf chain,
+ * such as netmap.
+ */
+ m_tag_delete(m, &ref->tag);
m_freem(m);
+ }
}
static void tag_free(struct m_tag *t)
@@ -1021,27 +1029,6 @@ out:
return (error);
}
-#ifdef INET
-static u_int
-netfront_addr_cb(void *arg, struct ifaddr *a, u_int count)
-{
- arp_ifinit((if_t)arg, a);
- return (1);
-}
-/**
- * If this interface has an ipv4 address, send an arp for it. This
- * helps to get the network going again after migrating hosts.
- */
-static void
-netfront_send_fake_arp(device_t dev, struct netfront_info *info)
-{
- if_t ifp;
-
- ifp = info->xn_ifp;
- if_foreach_addr_type(ifp, AF_INET, netfront_addr_cb, ifp);
-}
-#endif
-
/**
* Callback received when the backend's state changes.
*/
@@ -1082,7 +1069,12 @@ netfront_backend_changed(device_t dev, XenbusState newstate)
break;
case XenbusStateConnected:
#ifdef INET
- netfront_send_fake_arp(dev, sc);
+ /*
+ * If this interface has an ipv4 address, send an arp for it.
+ * This helps to get the network going again after migrating
+ * hosts.
+ */
+ EVENTHANDLER_INVOKE(iflladdr_event, sc->xn_ifp);
#endif
break;
}