Skip to content

Commit 886ff14

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
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: 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>
1 parent f0ee70a commit 886ff14

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4436,21 +4436,12 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
44364436
}
44374437
}
44384438

4439-
/* Compare and exchange the new flags into place. If we failed, that
4440-
* is if cmpxchg returns anything but the old value, this means that
4441-
* something else has modified the flags variable since we copied it
4442-
* originally. We'll just punt with an error and log something in the
4443-
* message buffer.
4444-
*
4445-
* This is the point of no return for this function. We need to have
4446-
* checked any discrepancies or misconfigurations and returned
4447-
* EOPNOTSUPP before updating pf->flags here.
4439+
/* Now that we've checked to ensure that the new flags are valid, load
4440+
* them into place. Since we only modify flags either (a) during
4441+
* initialization or (b) while holding the RTNL lock, we don't need
4442+
* anything fancy here.
44484443
*/
4449-
if (cmpxchg64(&pf->flags, orig_flags, new_flags) != orig_flags) {
4450-
dev_warn(&pf->pdev->dev,
4451-
"Unable to update pf->flags as it was modified by another thread...\n");
4452-
return -EAGAIN;
4453-
}
4444+
pf->flags = new_flags;
44544445

44554446
/* Process any additional changes needed as a result of flag changes.
44564447
* The changed_flags value reflects the list of bits that were

0 commit comments

Comments
 (0)