The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=baef1301a2bc60be3908f44dff1f83dbbd8f812a

commit baef1301a2bc60be3908f44dff1f83dbbd8f812a
Author:     Sumit Saxena <[email protected]>
AuthorDate: 2022-11-04 22:28:51 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2022-11-04 22:28:51 +0000

    if_bnxt: Fix the issue when kernel invokes _init() again without _stop()
    
    Fixed the issue when kernel invokes _init() when it is already in
    _init() state by invoking _stop() in such case.
    
    Reviewed by: imp
    Differential Revsion: https://reviews.freebsd.org/D36445
---
 sys/dev/bnxt/bnxt.h    | 1 +
 sys/dev/bnxt/if_bnxt.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h
index f8f3f4ccc2f5..0d5824722b41 100644
--- a/sys/dev/bnxt/bnxt.h
+++ b/sys/dev/bnxt/bnxt.h
@@ -738,6 +738,7 @@ struct bnxt_softc {
        struct bnxt_ver_info    *ver_info;
        struct bnxt_nvram_info  *nvm_info;
        bool wol;
+       bool is_dev_init;
        struct bnxt_hw_lro      hw_lro;
        uint8_t wol_filter_id;
        uint16_t                rx_coal_usecs;
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index bc6dd1c2b1c5..8b26b4d64436 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -1749,7 +1749,11 @@ bnxt_init(if_ctx_t ctx)
                rc = bnxt_hwrm_func_reset(softc);
                if (rc)
                        return;
+       } else if (softc->is_dev_init) {
+               bnxt_stop(ctx);
        }
+
+       softc->is_dev_init = true;
        bnxt_clear_ids(softc);
 
        // TBD -- Check if it is needed for Thor as well
@@ -1909,8 +1913,8 @@ bnxt_stop(if_ctx_t ctx)
 {
        struct bnxt_softc *softc = iflib_get_softc(ctx);
 
+       softc->is_dev_init = false;
        bnxt_do_disable_intr(&softc->def_cp_ring);
-       bnxt_hwrm_func_reset(softc);
        bnxt_func_reset(softc);
        bnxt_clear_ids(softc);
        return;

Reply via email to