]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
iflib: Stop interface before (un)registering VLAN
authorerj <erj@FreeBSD.org>
Mon, 27 Apr 2020 22:02:44 +0000 (22:02 +0000)
committererj <erj@FreeBSD.org>
Mon, 27 Apr 2020 22:02:44 +0000 (22:02 +0000)
commit83723aa6b0f87d16f36181c34b9f23095204b493
treeca53cb84e479ce96d354ec032c672143b320160f
parent7cae950029b39a77bfaf0fbb827372ac1e390791
iflib: Stop interface before (un)registering VLAN

This patch is intended to solve a specific problem that iavf(4)
encounters, but what it does can be extended to solve other issues.

To summarize the iavf(4) issue, if the PF driver configures VLAN
anti-spoof, then the VF driver needs to make sure no untagged traffic is
sent if a VLAN is configured, and vice-versa. This can be an issue when
a VLAN is being registered or unregistered, e.g. when a packet may be on
the ring with a VLAN in it, but the VLANs are being unregistered. This
can cause that tagged packet to go out and cause an MDD event.

To fix this, include a new interface-dependent function that drivers can
implement named IFDI_NEEDS_RESTART(). Right now, this function is called
in iflib_vlan_unregister/register() to determine whether the interface
needs to be stopped and started when a VLAN is registered or
unregistered. The default return value of IFDI_NEEDS_RESTART() is true,
so this fixes the MDD problem that iavf(4) encounters, since the
interface rings are flushed during a stop/init.

A future change to iavf(4) will implement that function just in case the
default value changes, and to make it explicit that this interface reset
is required when a VLAN is added or removed.

Reviewed by: gallatin@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D22086
sys/net/ifdi_if.m
sys/net/iflib.c
sys/net/iflib.h