i40evf: prevent VF close returning before state transitions to DOWN
authorSudheer Mogilappagari <sudheer.mogilappagari@intel.com>
Fri, 23 Jun 2017 08:24:44 +0000 (04:24 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 25 Aug 2017 21:45:55 +0000 (14:45 -0700)
commitfe2647ab0c9970cfc2895f1671343c23fed27f44
tree9dfc33d5e06cf2059c45c340960110cf9f3ba996
parent1e3a5fd5c0492d2cd37d86dce82ac7899136123f
i40evf: prevent VF close returning before state transitions to DOWN

Currently i40evf_close() can return before state transitions to
__I40EVF_DOWN because of the latency involved in processing and
receiving response from PF driver and scheduling of VF watchdog_task.
Due to this inconsistency an immediate call to i40evf_open() fails
because state is still DOWN_PENDING.

When a VF interface is in up state and we try to add it as slave,
The bonding driver calls dev_close() and dev_open() in short duration
resulting in dev_open returning error. The ifenslave command needs
to be run again for dev_open to succeed.

This fix ensures that watchdog timer is scheduled immediately after
admin queue operations are scheduled in i40evf_down(). In addition a
wait condition is added at the end of i40evf_close so that function
wont return when state is still DOWN_PENDING. The timeout value is
chosen after some profiling and includes some buffer.

Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40evf/i40evf.h
drivers/net/ethernet/intel/i40evf/i40evf_main.c
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c