diff options
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_cmn.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index ebd8b1cdd58c..04cacbf5d714 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -1918,13 +1918,23 @@ load_error0: | |||
1918 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | 1918 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) |
1919 | { | 1919 | { |
1920 | int i; | 1920 | int i; |
1921 | 1921 | bool global = false; | |
1922 | if (bp->state == BNX2X_STATE_CLOSED) { | 1922 | |
1923 | /* Interface has been removed - nothing to recover */ | 1923 | if ((bp->state == BNX2X_STATE_CLOSED) || |
1924 | (bp->state == BNX2X_STATE_ERROR)) { | ||
1925 | /* We can get here if the driver has been unloaded | ||
1926 | * during parity error recovery and is either waiting for a | ||
1927 | * leader to complete or for other functions to unload and | ||
1928 | * then ifdown has been issued. In this case we want to | ||
1929 | * unload and let other functions to complete a recovery | ||
1930 | * process. | ||
1931 | */ | ||
1924 | bp->recovery_state = BNX2X_RECOVERY_DONE; | 1932 | bp->recovery_state = BNX2X_RECOVERY_DONE; |
1925 | bp->is_leader = 0; | 1933 | bp->is_leader = 0; |
1926 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESERVED_08); | 1934 | bnx2x_release_leader_lock(bp); |
1927 | smp_wmb(); | 1935 | smp_mb(); |
1936 | |||
1937 | DP(NETIF_MSG_HW, "Releasing a leadership...\n"); | ||
1928 | 1938 | ||
1929 | return -EINVAL; | 1939 | return -EINVAL; |
1930 | } | 1940 | } |
@@ -1953,11 +1963,27 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
1953 | if (unload_mode != UNLOAD_RECOVERY) | 1963 | if (unload_mode != UNLOAD_RECOVERY) |
1954 | bnx2x_chip_cleanup(bp, unload_mode); | 1964 | bnx2x_chip_cleanup(bp, unload_mode); |
1955 | else { | 1965 | else { |
1956 | /* Disable HW interrupts, NAPI and Tx */ | 1966 | /* Send the UNLOAD_REQUEST to the MCP */ |
1967 | bnx2x_send_unload_req(bp, unload_mode); | ||
1968 | |||
1969 | /* | ||
1970 | * Prevent transactions to host from the functions on the | ||
1971 | * engine that doesn't reset global blocks in case of global | ||
1972 | * attention once gloabl blocks are reset and gates are opened | ||
1973 | * (the engine which leader will perform the recovery | ||
1974 | * last). | ||
1975 | */ | ||
1976 | if (!CHIP_IS_E1x(bp)) | ||
1977 | bnx2x_pf_disable(bp); | ||
1978 | |||
1979 | /* Disable HW interrupts, NAPI */ | ||
1957 | bnx2x_netif_stop(bp, 1); | 1980 | bnx2x_netif_stop(bp, 1); |
1958 | 1981 | ||
1959 | /* Release IRQs */ | 1982 | /* Release IRQs */ |
1960 | bnx2x_free_irq(bp); | 1983 | bnx2x_free_irq(bp); |
1984 | |||
1985 | /* Report UNLOAD_DONE to MCP */ | ||
1986 | bnx2x_send_unload_done(bp); | ||
1961 | } | 1987 | } |
1962 | 1988 | ||
1963 | /* | 1989 | /* |
@@ -1977,17 +2003,24 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
1977 | 2003 | ||
1978 | bp->state = BNX2X_STATE_CLOSED; | 2004 | bp->state = BNX2X_STATE_CLOSED; |
1979 | 2005 | ||
2006 | /* Check if there are pending parity attentions. If there are - set | ||
2007 | * RECOVERY_IN_PROGRESS. | ||
2008 | */ | ||
2009 | if (bnx2x_chk_parity_attn(bp, &global, false)) { | ||
2010 | bnx2x_set_reset_in_progress(bp); | ||
2011 | |||
2012 | /* Set RESET_IS_GLOBAL if needed */ | ||
2013 | if (global) | ||
2014 | bnx2x_set_reset_global(bp); | ||
2015 | } | ||
2016 | |||
2017 | |||
1980 | /* The last driver must disable a "close the gate" if there is no | 2018 | /* The last driver must disable a "close the gate" if there is no |
1981 | * parity attention or "process kill" pending. | 2019 | * parity attention or "process kill" pending. |
1982 | */ | 2020 | */ |
1983 | if ((!bnx2x_dec_load_cnt(bp)) && (!bnx2x_chk_parity_attn(bp)) && | 2021 | if (!bnx2x_dec_load_cnt(bp) && bnx2x_reset_is_done(bp, BP_PATH(bp))) |
1984 | bnx2x_reset_is_done(bp)) | ||
1985 | bnx2x_disable_close_the_gate(bp); | 2022 | bnx2x_disable_close_the_gate(bp); |
1986 | 2023 | ||
1987 | /* Reset MCP mail box sequence if there is on going recovery */ | ||
1988 | if (unload_mode == UNLOAD_RECOVERY) | ||
1989 | bp->fw_seq = 0; | ||
1990 | |||
1991 | return 0; | 2024 | return 0; |
1992 | } | 2025 | } |
1993 | 2026 | ||