be2net: Report a "link down" to the stack when a fatal error or fw reset happens.

When an error (related to HW or FW) is detected on a function, the driver
must pro-actively report a "link down" to the stack so that a possible
failover can be initiated. This is being done currently only for some
HW errors. This patch reports a "link down" even for fatal FW errors and
EEH errors.

Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Venkata Duvvuru
2015-05-13 13:00:13 +05:30
committed by David S. Miller
parent 29e9122b3a
commit 954f6825ee
3 changed files with 56 additions and 41 deletions

View File

@@ -522,6 +522,7 @@ struct be_adapter {
u16 work_counter;
struct delayed_work be_err_detection_work;
u8 err_flags;
u32 flags;
u32 cmd_privileges;
/* Ethtool knobs and info */
@@ -781,28 +782,38 @@ static inline bool is_ipv4_pkt(struct sk_buff *skb)
return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4;
}
#define BE_ERROR_EEH 1
#define BE_ERROR_UE BIT(1)
#define BE_ERROR_FW BIT(2)
#define BE_ERROR_HW (BE_ERROR_EEH | BE_ERROR_UE)
#define BE_ERROR_ANY (BE_ERROR_EEH | BE_ERROR_UE | BE_ERROR_FW)
#define BE_CLEAR_ALL 0xFF
static inline u8 be_check_error(struct be_adapter *adapter, u32 err_type)
{
return (adapter->err_flags & err_type);
}
static inline void be_set_error(struct be_adapter *adapter, int err_type)
{
struct net_device *netdev = adapter->netdev;
adapter->err_flags |= err_type;
netif_carrier_off(netdev);
dev_info(&adapter->pdev->dev, "%s: Link down\n", netdev->name);
}
static inline void be_clear_error(struct be_adapter *adapter, int err_type)
{
adapter->err_flags &= ~err_type;
}
static inline bool be_multi_rxq(const struct be_adapter *adapter)
{
return adapter->num_rx_qs > 1;
}
static inline bool be_error(struct be_adapter *adapter)
{
return adapter->eeh_error || adapter->hw_error || adapter->fw_timeout;
}
static inline bool be_hw_error(struct be_adapter *adapter)
{
return adapter->eeh_error || adapter->hw_error;
}
static inline void be_clear_all_error(struct be_adapter *adapter)
{
adapter->eeh_error = false;
adapter->hw_error = false;
adapter->fw_timeout = false;
}
void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
u16 num_popped);
void be_link_status_update(struct be_adapter *adapter, u8 link_status);