svn commit: r352655 - head/sys/net

Eric Joyner erj at FreeBSD.org
Tue Sep 24 17:03:31 UTC 2019


Author: erj
Date: Tue Sep 24 17:03:31 2019
New Revision: 352655
URL: https://svnweb.freebsd.org/changeset/base/352655

Log:
  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 at intel.com>,
  erj <erj at FreeBSD.org> and Jacob Keller <jacob.e.keller at intel.com>.
  
  Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski at intel.com>
  
  Submitted by:	Piotr Pietruszewski <piotr.pietruszewski at intel.com>
  Reviewed by:	gallatin@, erj@
  MFC after:	3 days
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D21711

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Tue Sep 24 16:49:42 2019	(r352654)
+++ head/sys/net/iflib.c	Tue Sep 24 17:03:31 2019	(r352655)
@@ -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 */
@@ -5078,12 +5081,6 @@ iflib_device_deregister(if_ctx_t ctx)
 	CTX_LOCK(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);


More information about the svn-src-head mailing list