sfc: Split STATE_READY in to STATE_NET_DOWN and STATE_NET_UP.
[ Upstream commit 813cf9d1e753e1e0a247d3d685212a06141b483e ] This patch splits the READY state in to NET_UP and NET_DOWN. This is to prepare for future work to delay resource allocation until interface up so that we can use resources more efficiently in SRIOV environments, and also to lay the ground work for an extra PROBED state where we don't create a network interface, for VDPA operation. Signed-off-by: Jonathan Cooper <jonathan.s.cooper@amd.com> Acked-by: Martin Habets <habetsm.xilinx@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Stable-dep-of: a80bb8e7233b ("sfc: Fix use-after-free due to selftest_work") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
b6dd232f63
commit
06a72bbf0d
@@ -627,12 +627,54 @@ enum efx_int_mode {
|
||||
#define EFX_INT_MODE_USE_MSI(x) (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)
|
||||
|
||||
enum nic_state {
|
||||
STATE_UNINIT = 0, /* device being probed/removed or is frozen */
|
||||
STATE_READY = 1, /* hardware ready and netdev registered */
|
||||
STATE_DISABLED = 2, /* device disabled due to hardware errors */
|
||||
STATE_RECOVERY = 3, /* device recovering from PCI error */
|
||||
STATE_UNINIT = 0, /* device being probed/removed */
|
||||
STATE_NET_DOWN, /* hardware probed and netdev registered */
|
||||
STATE_NET_UP, /* ready for traffic */
|
||||
STATE_DISABLED, /* device disabled due to hardware errors */
|
||||
|
||||
STATE_RECOVERY = 0x100,/* recovering from PCI error */
|
||||
STATE_FROZEN = 0x200, /* frozen by power management */
|
||||
};
|
||||
|
||||
static inline bool efx_net_active(enum nic_state state)
|
||||
{
|
||||
return state == STATE_NET_DOWN || state == STATE_NET_UP;
|
||||
}
|
||||
|
||||
static inline bool efx_frozen(enum nic_state state)
|
||||
{
|
||||
return state & STATE_FROZEN;
|
||||
}
|
||||
|
||||
static inline bool efx_recovering(enum nic_state state)
|
||||
{
|
||||
return state & STATE_RECOVERY;
|
||||
}
|
||||
|
||||
static inline enum nic_state efx_freeze(enum nic_state state)
|
||||
{
|
||||
WARN_ON(!efx_net_active(state));
|
||||
return state | STATE_FROZEN;
|
||||
}
|
||||
|
||||
static inline enum nic_state efx_thaw(enum nic_state state)
|
||||
{
|
||||
WARN_ON(!efx_frozen(state));
|
||||
return state & ~STATE_FROZEN;
|
||||
}
|
||||
|
||||
static inline enum nic_state efx_recover(enum nic_state state)
|
||||
{
|
||||
WARN_ON(!efx_net_active(state));
|
||||
return state | STATE_RECOVERY;
|
||||
}
|
||||
|
||||
static inline enum nic_state efx_recovered(enum nic_state state)
|
||||
{
|
||||
WARN_ON(!efx_recovering(state));
|
||||
return state & ~STATE_RECOVERY;
|
||||
}
|
||||
|
||||
/* Forward declaration */
|
||||
struct efx_nic;
|
||||
|
||||
|
Reference in New Issue
Block a user