iwlwifi: enforce FreeBSD specific (expected) behaviour

iwlwifi can return early from probe (in FreeBSD attach) while a separate
thread is still grinding loading the firmware and setting things up.
For us this means that kldload succeeded but we may not have a physical
wireless interface (com) yet but the rc framework might already try to
configure a vap on one.

Wait until we get a firmware completion event from the other thread
(on success or error) and block returning.  That way we can ensure that
the "hw" (or com in net80211 terms) is there when we return from attach
matching the expected FreeBSD driver behaviour.

Reported by:	J.R. Oldroyd (jr opal.com)
Reported by:	probably inderectly showing as other problem
Tested by:	J.R. Oldroyd (jr opal.com)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
This commit is contained in:
Bjoern A. Zeeb 2022-09-25 21:23:12 +00:00
parent be280f60dd
commit f808c43ad9

View File

@ -1752,6 +1752,16 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans)
goto err_fw;
}
#if defined(__FreeBSD__)
/*
* Wait until initilization is done before returning in order to
* replicate FreeBSD's synchronous behaviour -- we cannot create
* a vap before the com is fully created but if LinuxKPI "probe"
* returned before it was all done that is what could happen.
*/
wait_for_completion(&drv->request_firmware_complete);
#endif
return drv;
err_fw: