igb: Fix removal of unicast MAC filters of VFs
[ Upstream commit 584af82154f56e6b2740160fcc84a2966d969e15 ]
Move checking condition of VF MAC filter before clearing
or adding MAC filter to VF to prevent potential blackout caused
by removal of necessary and working VF's MAC filter.
Fixes: 1b8b062a99
("igb: add VF trust infrastructure")
Signed-off-by: Karen Sornek <karen.sornek@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
12c1938870
commit
ddac50d04f
@@ -7654,19 +7654,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
|
|||||||
struct vf_mac_filter *entry = NULL;
|
struct vf_mac_filter *entry = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
switch (info) {
|
|
||||||
case E1000_VF_MAC_FILTER_CLR:
|
|
||||||
/* remove all unicast MAC filters related to the current VF */
|
|
||||||
list_for_each(pos, &adapter->vf_macs.l) {
|
|
||||||
entry = list_entry(pos, struct vf_mac_filter, l);
|
|
||||||
if (entry->vf == vf) {
|
|
||||||
entry->vf = -1;
|
|
||||||
entry->free = true;
|
|
||||||
igb_del_mac_filter(adapter, entry->vf_mac, vf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E1000_VF_MAC_FILTER_ADD:
|
|
||||||
if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
|
if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
|
||||||
!vf_data->trusted) {
|
!vf_data->trusted) {
|
||||||
dev_warn(&pdev->dev,
|
dev_warn(&pdev->dev,
|
||||||
@@ -7681,6 +7668,19 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (info) {
|
||||||
|
case E1000_VF_MAC_FILTER_CLR:
|
||||||
|
/* remove all unicast MAC filters related to the current VF */
|
||||||
|
list_for_each(pos, &adapter->vf_macs.l) {
|
||||||
|
entry = list_entry(pos, struct vf_mac_filter, l);
|
||||||
|
if (entry->vf == vf) {
|
||||||
|
entry->vf = -1;
|
||||||
|
entry->free = true;
|
||||||
|
igb_del_mac_filter(adapter, entry->vf_mac, vf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case E1000_VF_MAC_FILTER_ADD:
|
||||||
/* try to find empty slot in the list */
|
/* try to find empty slot in the list */
|
||||||
list_for_each(pos, &adapter->vf_macs.l) {
|
list_for_each(pos, &adapter->vf_macs.l) {
|
||||||
entry = list_entry(pos, struct vf_mac_filter, l);
|
entry = list_entry(pos, struct vf_mac_filter, l);
|
||||||
|
Reference in New Issue
Block a user