]> git.baikalelectronics.ru Git - kernel.git/commit
i40e: use changed_flags to check I40E_FLAG_DISABLE_FW_LLDP
authorAlan Brady <alan.brady@intel.com>
Fri, 29 Dec 2017 13:50:34 +0000 (08:50 -0500)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Mon, 12 Feb 2018 18:51:54 +0000 (10:51 -0800)
commit643cf407e13645a6418574f2b8534516fee116d8
tree263805381135c6fb87e6c4ea9082146db1fd294a
parentf6132c335587bf6e87a4117da9ee57d56ce39cbe
i40e: use changed_flags to check I40E_FLAG_DISABLE_FW_LLDP

Currently in i40e_set_priv_flags we use new_flags to check for the
I40E_FLAG_DISABLE_FW_LLDP flag.  This is an issue for a few a reasons.
DISABLE_FW_LLDP is persistent across reboots/driver reloads.  This means
we need some way to detect if FW LLDP is enabled on init.  We do this by
trying to init_dcb and if it fails with EPERM we know LLDP is disabled
in FW.

This could be a problem on older FW versions or NPAR enabled PFs because
there are situations where the FW could disable LLDP, but they do _not_
support using this flag to change it.  If we do end up in this
situation, the flag will be set, then when the user tries to change any
priv flags, the driver thinks the user is trying to disable FW LLDP on a
FW that doesn't support it and essentially forbids any priv flag
changes.

The fix is simple, instead of checking if this flag is set, we should be
checking if the user is trying to _change_ the flag on unsupported FW
versions.

This patch also adds a comment explaining that the cmpxchg is the point
of no return.  Once we put the new flags into pf->flags we can't back
out.

Signed-off-by: Alan Brady <alan.brady@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_ethtool.c