Commit 80f6428f authored by Anjali Singhai Jain's avatar Anjali Singhai Jain Committed by Jeff Kirsher

i40e: Do not allow AQ calls from ndo-ops

If the device is not in a working state avoid making admin
queue (AQ) calls that rely on a working AQ.

Change-Id: Ifbba6d257b3a5b51bfe92938c04088c0baa21433
Signed-off-by: default avatarAnjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 37f0be6d
...@@ -1215,6 +1215,10 @@ static int i40e_set_mac(struct net_device *netdev, void *p) ...@@ -1215,6 +1215,10 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
if (ether_addr_equal(netdev->dev_addr, addr->sa_data)) if (ether_addr_equal(netdev->dev_addr, addr->sa_data))
return 0; return 0;
if (test_bit(__I40E_DOWN, &vsi->back->state) ||
test_bit(__I40E_RESET_RECOVERY_PENDING, &vsi->back->state))
return -EADDRNOTAVAIL;
if (vsi->type == I40E_VSI_MAIN) { if (vsi->type == I40E_VSI_MAIN) {
i40e_status ret; i40e_status ret;
ret = i40e_aq_mac_address_write(&vsi->back->hw, ret = i40e_aq_mac_address_write(&vsi->back->hw,
...@@ -1779,7 +1783,6 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -1779,7 +1783,6 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)
{ {
struct i40e_mac_filter *f, *add_f; struct i40e_mac_filter *f, *add_f;
bool is_netdev, is_vf; bool is_netdev, is_vf;
int ret;
is_vf = (vsi->type == I40E_VSI_SRIOV); is_vf = (vsi->type == I40E_VSI_SRIOV);
is_netdev = !!(vsi->netdev); is_netdev = !!(vsi->netdev);
...@@ -1805,13 +1808,6 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -1805,13 +1808,6 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)
} }
} }
ret = i40e_sync_vsi_filters(vsi);
if (ret) {
dev_info(&vsi->back->pdev->dev,
"Could not sync filters for vid %d\n", vid);
return ret;
}
/* Now if we add a vlan tag, make sure to check if it is the first /* Now if we add a vlan tag, make sure to check if it is the first
* tag (i.e. a "tag" -1 does exist) and if so replace the -1 "tag" * tag (i.e. a "tag" -1 does exist) and if so replace the -1 "tag"
* with 0, so we now accept untagged and specified tagged traffic * with 0, so we now accept untagged and specified tagged traffic
...@@ -1848,10 +1844,13 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -1848,10 +1844,13 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)
} }
} }
} }
ret = i40e_sync_vsi_filters(vsi);
} }
return ret; if (test_bit(__I40E_DOWN, &vsi->back->state) ||
test_bit(__I40E_RESET_RECOVERY_PENDING, &vsi->back->state))
return 0;
return i40e_sync_vsi_filters(vsi);
} }
/** /**
...@@ -1867,7 +1866,6 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -1867,7 +1866,6 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)
struct i40e_mac_filter *f, *add_f; struct i40e_mac_filter *f, *add_f;
bool is_vf, is_netdev; bool is_vf, is_netdev;
int filter_count = 0; int filter_count = 0;
int ret;
is_vf = (vsi->type == I40E_VSI_SRIOV); is_vf = (vsi->type == I40E_VSI_SRIOV);
is_netdev = !!(netdev); is_netdev = !!(netdev);
...@@ -1878,12 +1876,6 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -1878,12 +1876,6 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)
list_for_each_entry(f, &vsi->mac_filter_list, list) list_for_each_entry(f, &vsi->mac_filter_list, list)
i40e_del_filter(vsi, f->macaddr, vid, is_vf, is_netdev); i40e_del_filter(vsi, f->macaddr, vid, is_vf, is_netdev);
ret = i40e_sync_vsi_filters(vsi);
if (ret) {
dev_info(&vsi->back->pdev->dev, "Could not sync filters\n");
return ret;
}
/* go through all the filters for this VSI and if there is only /* go through all the filters for this VSI and if there is only
* vid == 0 it means there are no other filters, so vid 0 must * vid == 0 it means there are no other filters, so vid 0 must
* be replaced with -1. This signifies that we should from now * be replaced with -1. This signifies that we should from now
...@@ -1926,6 +1918,10 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -1926,6 +1918,10 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)
} }
} }
if (test_bit(__I40E_DOWN, &vsi->back->state) ||
test_bit(__I40E_RESET_RECOVERY_PENDING, &vsi->back->state))
return 0;
return i40e_sync_vsi_filters(vsi); return i40e_sync_vsi_filters(vsi);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment