linux/drivers/net/ethernet/intel/i40e
Jacob Keller 841c950d67 i40e/i40evf: use cmpxchg64 when updating private flags in ethtool
When a user gives an invalid command to change a private flag which is
not supported, either because it is read-only, or the device is not
capable of the feature, we simply ignore the request.

A naive solution would simply be to report error codes when one of the
flags was not supported. However, this causes problems because it makes
the operation not atomic. If a user requests multiple private flags
together at once we could end up changing one before failing at the
second flag.

We can do a bit better if we instead update a temporary copy of the
flags variable in the loop, and then copy it into place after. If we
aren't careful this has the pitfall of potentially silently overwriting
any changes caused by other threads.

Avoid this by using cmpxchg64 which will compare and swap the flags
variable only if it currently matched the old value. We'll report
-EAGAIN in the (hopefully rare!) case where the cmpxchg64 fails.

This ensures that we can properly report when flags are not supported in
an atomic fashion without the risk of overwriting other threads changes.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2017-08-25 14:46:34 -07:00
..
i40e_adminq_cmd.h i40e/i40evf: update WOL and I40E_AQC_ADDR_VALID_MASK flags 2017-06-20 18:17:10 -07:00
i40e_adminq.c
i40e_adminq.h
i40e_alloc.h
i40e_client.c i40e: use dev_dbg instead of dev_info when warning about missing routine 2017-06-20 18:17:10 -07:00
i40e_client.h
i40e_common.c i40e: comment that udp_port must be in host byte order 2017-06-20 18:17:10 -07:00
i40e_dcb_nl.c
i40e_dcb.c i40e: Support firmware CEE DCB UP to TC map re-definition 2017-06-20 18:17:10 -07:00
i40e_dcb.h
i40e_debugfs.c
i40e_devids.h
i40e_diag.c
i40e_diag.h
i40e_ethtool.c i40e/i40evf: use cmpxchg64 when updating private flags in ethtool 2017-08-25 14:46:34 -07:00
i40e_fcoe.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
i40e_fcoe.h
i40e_hmc.c
i40e_hmc.h
i40e_lan_hmc.c
i40e_lan_hmc.h
i40e_main.c i40e: Detect ATR HW Evict NVM issue and disable the feature 2017-08-25 14:46:26 -07:00
i40e_nvm.c i40e: Handle admin Q timeout when releasing NVM 2017-07-26 03:25:19 -07:00
i40e_osdep.h
i40e_prototype.h
i40e_ptp.c i40e: separate hw_features from runtime changing flags 2017-08-25 14:46:15 -07:00
i40e_register.h
i40e_status.h
i40e_trace.h
i40e_txrx.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-08-09 16:28:45 -07:00
i40e_txrx.h i40e: separate hw_features from runtime changing flags 2017-08-25 14:46:15 -07:00
i40e_type.h
i40e_virtchnl_pf.c i40e: separate hw_features from runtime changing flags 2017-08-25 14:46:15 -07:00
i40e_virtchnl_pf.h virtchnl: convert to new macros 2017-06-01 14:15:21 -07:00
i40e.h i40e: remove workaround for Open Firmware MAC address 2017-08-25 14:46:20 -07:00
Makefile