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
This commit is contained in:
Sumit Saxena 2022-11-04 16:28:51 -06:00 committed by Warner Losh
parent 72e9dbb58c
commit baef1301a2
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -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;