LinuxKPI: 802.11: defer workq allocation until we have a name

Turned out all the workq's taskqueues were named "wlanNA" if you had
more then one card in a machine as by the time we called wiphy_name()
the device name was not set yet and we returned the fallback.

Move the alloc_ordered_workqueue() from linuxkpi_ieee80211_alloc_hw()
to linuxkpi_ieee80211_ifattach() at which time the device name has
to be set to give us a unique name.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
This commit is contained in:
Bjoern A. Zeeb 2022-02-16 03:20:29 +00:00
parent d3ef7fb459
commit 652e22d395

@ -2748,11 +2748,7 @@ linuxkpi_ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops)
lhw = wiphy_priv(wiphy);
lhw->ops = ops;
lhw->workq = alloc_ordered_workqueue(wiphy_name(wiphy), 0);
if (lhw->workq == NULL) {
wiphy_free(wiphy);
return (NULL);
}
mtx_init(&lhw->mtx, "lhw", NULL, MTX_DEF | MTX_RECURSE);
TAILQ_INIT(&lhw->lvif_head);
@ -2841,6 +2837,11 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
lhw = HW_TO_LHW(hw);
ic = lhw->ic;
/* We do it this late as wiphy->dev should be set for the name. */
lhw->workq = alloc_ordered_workqueue(wiphy_name(hw->wiphy), 0);
if (lhw->workq == NULL)
return (-EAGAIN);
/* XXX-BZ figure this out how they count his... */
if (!is_zero_ether_addr(hw->wiphy->perm_addr)) {
IEEE80211_ADDR_COPY(ic->ic_macaddr,