From 53b5b9b049be36ac1856a7b0964901cac54daefe Mon Sep 17 00:00:00 2001 From: Eric Joyner Date: Tue, 24 Sep 2019 17:03:31 +0000 Subject: [PATCH] iflib: Remove redundant VLAN events deregistration From Piotr: r351152 introduced iflib_deregister() function calling EVENTHANDLER_DEREGISTER() to unregister VLAN events. This patch removes duplicate of EVENTHANDLER_DEREGISTER() calls placed in iflib_device_deregister() as this function is now calling iflib_deregister(). This is to avoid deregistering same event twice. This patch also adds check in iflib_vlan_register() to prevent registering VLAN while being in detach. Patch co-authored by Krzysztof Galazka , erj and Jacob Keller . Signed-off-by: Piotr Pietruszewski Submitted by: Piotr Pietruszewski Reviewed by: gallatin@, erj@ MFC after: 3 days Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21711 --- sys/net/iflib.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 6c57b6aaeaef..148a8b3e6d90 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -4280,6 +4280,9 @@ iflib_vlan_register(void *arg, if_t ifp, uint16_t vtag) if ((vtag == 0) || (vtag > 4095)) return; + if (iflib_in_detach(ctx)) + return; + CTX_LOCK(ctx); IFDI_VLAN_REGISTER(ctx, vtag); /* Re-init to load the changes */ @@ -5079,12 +5082,6 @@ iflib_device_deregister(if_ctx_t ctx) iflib_stop(ctx); CTX_UNLOCK(ctx); - /* Unregister VLAN events */ - if (ctx->ifc_vlan_attach_event != NULL) - EVENTHANDLER_DEREGISTER(vlan_config, ctx->ifc_vlan_attach_event); - if (ctx->ifc_vlan_detach_event != NULL) - EVENTHANDLER_DEREGISTER(vlan_unconfig, ctx->ifc_vlan_detach_event); - iflib_netmap_detach(ifp); ether_ifdetach(ifp); iflib_rem_pfil(ctx);