Date: Thu, 14 May 2020 20:07:02 +0000 (UTC) From: Eric Joyner <erj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r361055 - stable/11/sys/net Message-ID: <202005142007.04EK72Ow065844@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: erj Date: Thu May 14 20:07:02 2020 New Revision: 361055 URL: https://svnweb.freebsd.org/changeset/base/361055 Log: MFC r360398: iflib: Stop interface before (un)registering VLAN This is now misleadingly named for stable/11; this was meant to fix an issue in an out-of-tree iavf(4) driver that uses iflib. This commit actually introduces a new driver-dependent function that iflib-using drivers can implement in order to tell iflib whether an interface restart is needed for certain events. For this commit, this function is only used for VLAN register/unregister events. Sponsored by: Intel Corporation Modified: stable/11/sys/net/ifdi_if.m stable/11/sys/net/iflib.c stable/11/sys/net/iflib.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/ifdi_if.m ============================================================================== --- stable/11/sys/net/ifdi_if.m Thu May 14 19:57:52 2020 (r361054) +++ stable/11/sys/net/ifdi_if.m Thu May 14 20:07:02 2020 (r361055) @@ -111,6 +111,12 @@ CODE { { return (ENOTSUP); } + + static bool + null_needs_restart(if_ctx_t _ctx __unused, enum iflib_restart_event _event __unused) + { + return (true); + } }; # @@ -341,3 +347,8 @@ METHOD int sysctl_int_delay { METHOD void debug { if_ctx_t _ctx; } DEFAULT null_void_op; + +METHOD bool needs_restart { + if_ctx_t _ctx; + enum iflib_restart_event _event; +} DEFAULT null_needs_restart; Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Thu May 14 19:57:52 2020 (r361054) +++ stable/11/sys/net/iflib.c Thu May 14 20:07:02 2020 (r361055) @@ -4159,10 +4159,13 @@ iflib_vlan_register(void *arg, if_t ifp, uint16_t vtag return; CTX_LOCK(ctx); + /* Driver may need all untagged packets to be flushed */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_stop(ctx); IFDI_VLAN_REGISTER(ctx, vtag); - /* Re-init to load the changes */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - iflib_if_init_locked(ctx); + /* Re-init to load the changes, if required */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_init_locked(ctx); CTX_UNLOCK(ctx); } @@ -4178,10 +4181,13 @@ iflib_vlan_unregister(void *arg, if_t ifp, uint16_t vt return; CTX_LOCK(ctx); + /* Driver may need all tagged packets to be flushed */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_stop(ctx); IFDI_VLAN_UNREGISTER(ctx, vtag); - /* Re-init to load the changes */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - iflib_if_init_locked(ctx); + /* Re-init to load the changes, if required */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_init_locked(ctx); CTX_UNLOCK(ctx); } Modified: stable/11/sys/net/iflib.h ============================================================================== --- stable/11/sys/net/iflib.h Thu May 14 19:57:52 2020 (r361054) +++ stable/11/sys/net/iflib.h Thu May 14 20:07:02 2020 (r361055) @@ -328,6 +328,15 @@ typedef enum { /* + * These enum values are used in iflib_needs_restart to indicate to iflib + * functions whether or not the interface needs restarting when certain events + * happen. + */ +enum iflib_restart_event { + IFLIB_RESTART_VLAN_CONFIG, +}; + +/* * field accessors */ void *iflib_get_softc(if_ctx_t ctx);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005142007.04EK72Ow065844>