Commit 886ff146 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher

i40e: stop using cmpxchg flow in i40e_set_priv_flags()

Now that the only places which modify flags are either (a) during
initialization prior to creating a netdevice, or (b) while holding the
rtnl lock, we no longer need the cmpxchg64 call in i40e_set_priv_flags.
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent f0ee70a0
...@@ -4436,21 +4436,12 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags) ...@@ -4436,21 +4436,12 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
} }
} }
/* Compare and exchange the new flags into place. If we failed, that /* Now that we've checked to ensure that the new flags are valid, load
* is if cmpxchg returns anything but the old value, this means that * them into place. Since we only modify flags either (a) during
* something else has modified the flags variable since we copied it * initialization or (b) while holding the RTNL lock, we don't need
* originally. We'll just punt with an error and log something in the * anything fancy here.
* message buffer.
*
* This is the point of no return for this function. We need to have
* checked any discrepancies or misconfigurations and returned
* EOPNOTSUPP before updating pf->flags here.
*/ */
if (cmpxchg64(&pf->flags, orig_flags, new_flags) != orig_flags) { pf->flags = new_flags;
dev_warn(&pf->pdev->dev,
"Unable to update pf->flags as it was modified by another thread...\n");
return -EAGAIN;
}
/* Process any additional changes needed as a result of flag changes. /* Process any additional changes needed as a result of flag changes.
* The changed_flags value reflects the list of bits that were * The changed_flags value reflects the list of bits that were
......
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