Commit be98bdf8 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Greg Kroah-Hartman

i40e: fix: do not sleep in netdev_ops

[ Upstream commit 0e4425ed ]

The driver was being called by VLAN, bonding, teaming operations
that expected to be able to hold locks like rcu_read_lock().

This causes the driver to be held to the requirement to not sleep,
and was found by the kernel debug options for checking sleep
inside critical section, and the locking validator.

Change-ID: Ibc68c835f5ffa8ffe0638ffe910a66fc5649a7f7
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f36bb42d
...@@ -1547,9 +1547,11 @@ static int i40e_set_mac(struct net_device *netdev, void *p) ...@@ -1547,9 +1547,11 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
spin_unlock_bh(&vsi->mac_filter_list_lock); spin_unlock_bh(&vsi->mac_filter_list_lock);
} }
i40e_sync_vsi_filters(vsi, false);
ether_addr_copy(netdev->dev_addr, addr->sa_data); ether_addr_copy(netdev->dev_addr, addr->sa_data);
/* schedule our worker thread which will take care of
* applying the new filter changes
*/
i40e_service_event_schedule(vsi->back);
return 0; return 0;
} }
...@@ -2112,12 +2114,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi, bool grab_rtnl) ...@@ -2112,12 +2114,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi, bool grab_rtnl)
*/ */
if (pf->cur_promisc != cur_promisc) { if (pf->cur_promisc != cur_promisc) {
pf->cur_promisc = cur_promisc; pf->cur_promisc = cur_promisc;
if (grab_rtnl) set_bit(__I40E_PF_RESET_REQUESTED, &pf->state);
i40e_do_reset_safe(pf,
BIT(__I40E_PF_RESET_REQUESTED));
else
i40e_do_reset(pf,
BIT(__I40E_PF_RESET_REQUESTED));
} }
} else { } else {
ret = i40e_aq_set_vsi_unicast_promiscuous( ret = i40e_aq_set_vsi_unicast_promiscuous(
...@@ -2377,16 +2374,13 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -2377,16 +2374,13 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)
} }
} }
/* Make sure to release before sync_vsi_filter because that
* function will lock/unlock as necessary
*/
spin_unlock_bh(&vsi->mac_filter_list_lock); spin_unlock_bh(&vsi->mac_filter_list_lock);
if (test_bit(__I40E_DOWN, &vsi->back->state) || /* schedule our worker thread which will take care of
test_bit(__I40E_RESET_RECOVERY_PENDING, &vsi->back->state)) * applying the new filter changes
return 0; */
i40e_service_event_schedule(vsi->back);
return i40e_sync_vsi_filters(vsi, false); return 0;
} }
/** /**
...@@ -2459,16 +2453,13 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) ...@@ -2459,16 +2453,13 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)
} }
} }
/* Make sure to release before sync_vsi_filter because that
* function with lock/unlock as necessary
*/
spin_unlock_bh(&vsi->mac_filter_list_lock); spin_unlock_bh(&vsi->mac_filter_list_lock);
if (test_bit(__I40E_DOWN, &vsi->back->state) || /* schedule our worker thread which will take care of
test_bit(__I40E_RESET_RECOVERY_PENDING, &vsi->back->state)) * applying the new filter changes
return 0; */
i40e_service_event_schedule(vsi->back);
return i40e_sync_vsi_filters(vsi, false); return 0;
} }
/** /**
...@@ -2711,6 +2702,11 @@ static void i40e_config_xps_tx_ring(struct i40e_ring *ring) ...@@ -2711,6 +2702,11 @@ static void i40e_config_xps_tx_ring(struct i40e_ring *ring)
netif_set_xps_queue(ring->netdev, mask, ring->queue_index); netif_set_xps_queue(ring->netdev, mask, ring->queue_index);
free_cpumask_var(mask); free_cpumask_var(mask);
} }
/* schedule our worker thread which will take care of
* applying the new filter changes
*/
i40e_service_event_schedule(vsi->back);
} }
/** /**
......
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