Skip to content
/ linux Public

Commit cff11b1

Browse files
orospgregkh
authored andcommitted
iavf: fix VLAN filter lost on add/delete race
[ Upstream commit fc9c69b ] When iavf_add_vlan() finds an existing filter in IAVF_VLAN_REMOVE state, it transitions the filter to IAVF_VLAN_ACTIVE assuming the pending delete can simply be cancelled. However, there is no guarantee that iavf_del_vlans() has not already processed the delete AQ request and removed the filter from the PF. In that case the filter remains in the driver's list as IAVF_VLAN_ACTIVE but is no longer programmed on the NIC. Since iavf_add_vlans() only picks up filters in IAVF_VLAN_ADD state, the filter is never re-added, and spoof checking drops all traffic for that VLAN. CPU0 CPU1 Workqueue ---- ---- --------- iavf_del_vlan(vlan 100) f->state = REMOVE schedule AQ_DEL_VLAN iavf_add_vlan(vlan 100) f->state = ACTIVE iavf_del_vlans() f is ACTIVE, skip iavf_add_vlans() f is ACTIVE, skip Filter is ACTIVE in driver but absent from NIC. Transition to IAVF_VLAN_ADD instead and schedule IAVF_FLAG_AQ_ADD_VLAN_FILTER so iavf_add_vlans() re-programs the filter. A duplicate add is idempotent on the PF. Fixes: 0c0da0e ("iavf: refactor VLAN filter states") Signed-off-by: Petr Oros <poros@redhat.com> Tested-by: Rafal Romanowski <rafal.romanowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 31521c1 commit cff11b1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,13 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *adapter,
757757
adapter->num_vlan_filters++;
758758
iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_ADD_VLAN_FILTER);
759759
} else if (f->state == IAVF_VLAN_REMOVE) {
760-
/* IAVF_VLAN_REMOVE means that VLAN wasn't yet removed.
761-
* We can safely only change the state here.
760+
/* Re-add the filter since we cannot tell whether the
761+
* pending delete has already been processed by the PF.
762+
* A duplicate add is harmless.
762763
*/
763-
f->state = IAVF_VLAN_ACTIVE;
764+
f->state = IAVF_VLAN_ADD;
765+
iavf_schedule_aq_request(adapter,
766+
IAVF_FLAG_AQ_ADD_VLAN_FILTER);
764767
}
765768

766769
clearout:

0 commit comments

Comments
 (0)