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 <krzysztof.galazka@intel.com>,
erj <erj@FreeBSD.org> and Jacob Keller <jacob.e.keller@intel.com>.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>

Submitted by:	Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by:	gallatin@, erj@
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D21711
This commit is contained in:
erj 2019-09-24 17:03:31 +00:00
parent 43d5cab889
commit ff0d702014

View File

@ -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);