Page MenuHomeFreeBSD

D49734.id153396.diff
No OneTemporary

D49734.id153396.diff

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -343,6 +343,7 @@
bool eht_support;
bool csa_active;
bool mu_mimo_owner;
+ bool color_change_active;
uint32_t sync_device_ts;
uint64_t sync_tsf;
uint16_t beacon_int;
@@ -363,7 +364,6 @@
int twt_requester, uora_exists, uora_ocw_range;
int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected;
int twt_responder, unsol_bcast_probe_resp_interval;
- int color_change_active;
};
struct ieee80211_channel_switch {
@@ -845,15 +845,13 @@
struct ieee80211_vif {
/* TODO FIXME */
enum nl80211_iftype type;
- int csa_active, mu_mimo_owner;
int cab_queue;
- int color_change_active, offload_flags;
+ int offload_flags;
enum ieee80211_vif_driver_flags driver_flags;
bool p2p;
bool probe_req_reg;
uint8_t addr[ETH_ALEN];
struct ieee80211_vif_cfg cfg;
- struct ieee80211_chanctx_conf *chanctx_conf;
struct ieee80211_txq *txq;
struct ieee80211_bss_conf bss_conf;
struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h
--- a/sys/compat/linuxkpi/common/src/linux_80211.h
+++ b/sys/compat/linuxkpi/common/src/linux_80211.h
@@ -216,7 +216,7 @@
TAILQ_HEAD(, lkpi_vif) lvif_head;
struct sx lvif_sx;
- struct sx sx; /* XXX-BZ Can this be wiphy->mtx in the future? */
+ struct list_head lchanctx_list;
struct mtx txq_mtx;
uint32_t txq_generation[IEEE80211_NUM_ACS];
@@ -284,7 +284,10 @@
#define HW_TO_LHW(_hw) container_of(_hw, struct lkpi_hw, hw)
struct lkpi_chanctx {
+ struct list_head entry;
+
bool added_to_drv; /* Managed by MO */
+
struct ieee80211_chanctx_conf chanctx_conf __aligned(CACHE_LINE_SIZE);
};
#define LCHANCTX_TO_CHANCTX_CONF(_lchanctx) \
@@ -318,19 +321,6 @@
#define LKPI_80211_LWIPHY_WORK_UNLOCK_ASSERT(_lwiphy) \
mtx_assert(&(_lwiphy)->wwk_mtx, MA_NOTOWNED)
-#define LKPI_80211_LHW_LOCK_INIT(_lhw) \
- sx_init_flags(&(_lhw)->sx, "lhw", SX_RECURSE);
-#define LKPI_80211_LHW_LOCK_DESTROY(_lhw) \
- sx_destroy(&(_lhw)->sx);
-#define LKPI_80211_LHW_LOCK(_lhw) \
- sx_xlock(&(_lhw)->sx)
-#define LKPI_80211_LHW_UNLOCK(_lhw) \
- sx_xunlock(&(_lhw)->sx)
-#define LKPI_80211_LHW_LOCK_ASSERT(_lhw) \
- sx_assert(&(_lhw)->sx, SA_LOCKED)
-#define LKPI_80211_LHW_UNLOCK_ASSERT(_lhw) \
- sx_assert(&(_lhw)->sx, SA_UNLOCKED)
-
#define LKPI_80211_LHW_SCAN_LOCK_INIT(_lhw) \
mtx_init(&(_lhw)->scan_mtx, "lhw-scan", NULL, MTX_DEF | MTX_RECURSE);
#define LKPI_80211_LHW_SCAN_LOCK_DESTROY(_lhw) \
@@ -425,7 +415,7 @@
int lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *, struct ieee80211_vif *,
struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
void lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *, struct ieee80211_vif *,
- struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf **);
+ struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
int lkpi_80211_mo_add_chanctx(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
void lkpi_80211_mo_change_chanctx(struct ieee80211_hw *,
struct ieee80211_chanctx_conf *, uint32_t);
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -570,12 +570,11 @@
lkpi_lsta_remove(struct lkpi_sta *lsta, struct lkpi_vif *lvif)
{
+ lockdep_assert_wiphy(lsta->hw->wiphy);
- wiphy_lock(lsta->hw->wiphy);
KASSERT(!list_empty(&lsta->lsta_list),
("%s: lsta %p ni %p\n", __func__, lsta, lsta->ni));
list_del_init(&lsta->lsta_list);
- wiphy_unlock(lsta->hw->wiphy);
}
static struct lkpi_sta *
@@ -1579,10 +1578,10 @@
hw = LHW_TO_HW(lhw);
IEEE80211_UNLOCK(lhw->ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
/* Need to cancel the scan. */
lkpi_80211_mo_cancel_hw_scan(hw, vif);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
/* Need to make sure we see ieee80211_scan_completed. */
LKPI_80211_LHW_SCAN_LOCK(lhw);
@@ -1699,11 +1698,14 @@
static void
lkpi_80211_flush_tx(struct lkpi_hw *lhw, struct lkpi_sta *lsta)
{
+ struct ieee80211_hw *hw;
struct mbufq mq;
struct mbuf *m;
int len;
- LKPI_80211_LHW_UNLOCK_ASSERT(lhw);
+ /* There is no lockdep_assert_not_held_wiphy(). */
+ hw = LHW_TO_HW(lhw);
+ lockdep_assert_not_held(&hw->wiphy->mtx);
/* Do not accept any new packets until scan_to_auth or lsta_free(). */
LKPI_80211_LSTA_TXQ_LOCK(lsta);
@@ -1731,6 +1733,35 @@
}
}
+
+static void
+lkpi_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+ struct ieee80211_chanctx_conf *chanctx_conf;
+ struct lkpi_chanctx *lchanctx;
+
+ chanctx_conf = rcu_dereference_protected(vif->bss_conf.chanctx_conf,
+ lockdep_is_held(&hw->wiphy->mtx));
+
+ if (chanctx_conf == NULL)
+ return;
+
+ /* Remove vif context. */
+ lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, chanctx_conf);
+
+ lkpi_hw_conf_idle(hw, true);
+
+ /* Remove chan ctx. */
+ lkpi_80211_mo_remove_chanctx(hw, chanctx_conf);
+
+ /* Cleanup. */
+ rcu_assign_pointer(vif->bss_conf.chanctx_conf, NULL);
+ lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
+ list_del(&lchanctx->entry);
+ free(lchanctx, M_LKPI80211);
+}
+
+
/* -------------------------------------------------------------------------- */
static int
@@ -1812,11 +1843,12 @@
LKPI_80211_LVIF_UNLOCK(lvif);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
/* Add chanctx (or if exists, change it). */
- if (vif->chanctx_conf != NULL) {
- chanctx_conf = vif->chanctx_conf;
+ chanctx_conf = rcu_dereference_protected(vif->bss_conf.chanctx_conf,
+ lockdep_is_held(&hw->wiphy->mtx));
+ if (chanctx_conf != NULL) {
lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
IMPROVE("diff changes for changed, working on live copy, rcu");
} else {
@@ -1891,7 +1923,7 @@
bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__);
error = 0;
- if (vif->chanctx_conf != NULL) {
+ if (vif->bss_conf.chanctx_conf == chanctx_conf) {
changed = IEEE80211_CHANCTX_CHANGE_MIN_WIDTH;
changed |= IEEE80211_CHANCTX_CHANGE_RADAR;
changed |= IEEE80211_CHANCTX_CHANGE_RX_CHAINS;
@@ -1912,7 +1944,8 @@
goto out;
}
- vif->bss_conf.chanctx_conf = chanctx_conf;
+ list_add_rcu(&lchanctx->entry, &lhw->lchanctx_list);
+ rcu_assign_pointer(vif->bss_conf.chanctx_conf, chanctx_conf);
/* Assign vif chanctx. */
if (error == 0)
@@ -1924,7 +1957,9 @@
ic_printf(vap->iv_ic, "%s:%d: mo_assign_vif_chanctx "
"failed: %d\n", __func__, __LINE__, error);
lkpi_80211_mo_remove_chanctx(hw, chanctx_conf);
+ rcu_assign_pointer(vif->bss_conf.chanctx_conf, NULL);
lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
+ list_del(&lchanctx->entry);
free(lchanctx, M_LKPI80211);
goto out;
}
@@ -1952,10 +1987,8 @@
lsta->txq_ready = true;
LKPI_80211_LSTA_TXQ_UNLOCK(lsta);
- wiphy_lock(hw->wiphy);
/* Insert the [l]sta into the list of known stations. */
list_add_tail(&lsta->lsta_list, &lvif->lsta_list);
- wiphy_unlock(hw->wiphy);
/* Add (or adjust) sta and change state (from NOTEXIST) to NONE. */
KASSERT(lsta != NULL, ("%s: ni %p lsta is NULL\n", __func__, ni));
@@ -2001,7 +2034,7 @@
* (ideally we'd do that on a callback for something else ...)
*/
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
LKPI_80211_LVIF_LOCK(lvif);
@@ -2046,7 +2079,7 @@
goto out_relocked;
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
out_relocked:
/*
@@ -2098,7 +2131,7 @@
lkpi_lsta_dump(lsta, ni, __func__, __LINE__);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
/* flush, drop. */
lkpi_80211_mo_flush(hw, vif, nitems(sta->txq), true);
@@ -2157,26 +2190,10 @@
/* conf_tx */
- /* Take the chan ctx down. */
- if (vif->chanctx_conf != NULL) {
- struct lkpi_chanctx *lchanctx;
- struct ieee80211_chanctx_conf *chanctx_conf;
-
- chanctx_conf = vif->chanctx_conf;
- /* Remove vif context. */
- lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf);
- /* NB: vif->chanctx_conf is NULL now. */
-
- lkpi_hw_conf_idle(hw, true);
-
- /* Remove chan ctx. */
- lkpi_80211_mo_remove_chanctx(hw, chanctx_conf);
- lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
- free(lchanctx, M_LKPI80211);
- }
+ lkpi_remove_chanctx(hw, vif);
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
return (error);
}
@@ -2209,7 +2226,7 @@
vif = LVIF_TO_VIF(lvif);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
LKPI_80211_LVIF_LOCK(lvif);
/* XXX-BZ KASSERT later? */
@@ -2275,7 +2292,7 @@
*/
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
return (error);
}
@@ -2298,7 +2315,7 @@
vif = LVIF_TO_VIF(lvif);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
LKPI_80211_LVIF_LOCK(lvif);
/* XXX-BZ KASSERT later? */
@@ -2342,7 +2359,7 @@
error = 0;
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
return (error);
@@ -2368,7 +2385,7 @@
vif = LVIF_TO_VIF(lvif);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
LKPI_80211_LVIF_LOCK(lvif);
#ifdef LINUXKPI_DEBUG_80211
@@ -2404,7 +2421,7 @@
lsta->in_mgd = true;
}
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
/* Call iv_newstate first so we get potential DEAUTH packet out. */
@@ -2420,7 +2437,7 @@
/* Ensure the packets get out. */
lkpi_80211_flush_tx(lhw, lsta);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
lkpi_lsta_dump(lsta, ni, __func__, __LINE__);
@@ -2501,27 +2518,11 @@
/* conf_tx */
- /* Take the chan ctx down. */
- if (vif->chanctx_conf != NULL) {
- struct lkpi_chanctx *lchanctx;
- struct ieee80211_chanctx_conf *chanctx_conf;
-
- chanctx_conf = vif->chanctx_conf;
- /* Remove vif context. */
- lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf);
- /* NB: vif->chanctx_conf is NULL now. */
-
- lkpi_hw_conf_idle(hw, true);
-
- /* Remove chan ctx. */
- lkpi_80211_mo_remove_chanctx(hw, chanctx_conf);
- lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
- free(lchanctx, M_LKPI80211);
- }
+ lkpi_remove_chanctx(hw, vif);
error = EALREADY;
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
outni:
return (error);
@@ -2580,7 +2581,7 @@
vif = LVIF_TO_VIF(lvif);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
LKPI_80211_LVIF_LOCK(lvif);
/* XXX-BZ KASSERT later? */
@@ -2718,7 +2719,7 @@
lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, bss_changed);
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
return (error);
}
@@ -2777,7 +2778,7 @@
lkpi_lsta_dump(lsta, ni, __func__, __LINE__);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
/* flush, drop. */
lkpi_80211_mo_flush(hw, vif, nitems(sta->txq), true);
@@ -2792,7 +2793,7 @@
lsta->in_mgd = true;
}
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
/* Call iv_newstate first so we get potential DISASSOC packet out. */
@@ -2808,7 +2809,7 @@
/* Ensure the packets get out. */
lkpi_80211_flush_tx(lhw, lsta);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
lkpi_lsta_dump(lsta, ni, __func__, __LINE__);
@@ -2852,9 +2853,7 @@
#ifdef LKPI_80211_HW_CRYPTO
if (lkpi_hwcrypto) {
- wiphy_lock(hw->wiphy);
error = lkpi_sta_del_keys(hw, vif, lsta);
- wiphy_unlock(hw->wiphy);
if (error != 0) {
ic_printf(vap->iv_ic, "%s:%d: lkpi_sta_del_keys "
"failed: %d\n", __func__, __LINE__, error);
@@ -2888,7 +2887,7 @@
error = EALREADY;
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
outni:
return (error);
@@ -2914,7 +2913,7 @@
vif = LVIF_TO_VIF(lvif);
IEEE80211_UNLOCK(vap->iv_ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
LKPI_80211_LVIF_LOCK(lvif);
#ifdef LINUXKPI_DEBUG_80211
@@ -2950,7 +2949,7 @@
lsta->in_mgd = true;
}
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
/* Call iv_newstate first so we get potential DISASSOC packet out. */
@@ -2966,7 +2965,7 @@
/* Ensure the packets get out. */
lkpi_80211_flush_tx(lhw, lsta);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
lkpi_lsta_dump(lsta, ni, __func__, __LINE__);
@@ -3008,9 +3007,7 @@
#ifdef LKPI_80211_HW_CRYPTO
if (lkpi_hwcrypto) {
- wiphy_lock(hw->wiphy);
error = lkpi_sta_del_keys(hw, vif, lsta);
- wiphy_unlock(hw->wiphy);
if (error != 0) {
ic_printf(vap->iv_ic, "%s:%d: lkpi_sta_del_keys "
"failed: %d\n", __func__, __LINE__, error);
@@ -3117,27 +3114,11 @@
/* conf_tx */
- /* Take the chan ctx down. */
- if (vif->chanctx_conf != NULL) {
- struct lkpi_chanctx *lchanctx;
- struct ieee80211_chanctx_conf *chanctx_conf;
-
- chanctx_conf = vif->chanctx_conf;
- /* Remove vif context. */
- lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf);
- /* NB: vif->chanctx_conf is NULL now. */
-
- lkpi_hw_conf_idle(hw, true);
-
- /* Remove chan ctx. */
- lkpi_80211_mo_remove_chanctx(hw, chanctx_conf);
- lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
- free(lchanctx, M_LKPI80211);
- }
+ lkpi_remove_chanctx(hw, vif);
error = EALREADY;
out:
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(vap->iv_ic);
outni:
return (error);
@@ -3341,6 +3322,9 @@
int error;
uint16_t ac;
+ hw = LHW_TO_HW(lhw);
+ lockdep_assert_wiphy(hw->wiphy);
+
IMPROVE();
KASSERT(WME_NUM_AC == IEEE80211_NUM_ACS, ("%s: WME_NUM_AC %d != "
"IEEE80211_NUM_ACS %d\n", __func__, WME_NUM_AC, IEEE80211_NUM_ACS));
@@ -3367,12 +3351,10 @@
wmeparr[ac] = chp.cap_wmeParams[ac];
IEEE80211_UNLOCK(ic);
- hw = LHW_TO_HW(lhw);
lvif = VAP_TO_LVIF(vap);
vif = LVIF_TO_VIF(lvif);
/* Configure tx queues (conf_tx) & send BSS_CHANGED_QOS. */
- LKPI_80211_LHW_LOCK(lhw);
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
struct wmeParams *wmep;
@@ -3387,7 +3369,6 @@
ic_printf(ic, "%s: conf_tx ac %u failed %d\n",
__func__, ac, error);
}
- LKPI_80211_LHW_UNLOCK(lhw);
changed = BSS_CHANGED_QOS;
if (!planned)
lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
@@ -3402,6 +3383,7 @@
#ifdef LKPI_80211_WME
struct ieee80211vap *vap;
struct lkpi_hw *lhw;
+ struct ieee80211_hw *hw;
IMPROVE("Use the per-VAP callback in net80211.");
vap = TAILQ_FIRST(&ic->ic_vaps);
@@ -3409,8 +3391,11 @@
return (0);
lhw = ic->ic_softc;
+ hw = LHW_TO_HW(lhw);
+ wiphy_lock(hw->wiphy);
lkpi_wme_update(lhw, vap, false);
+ wiphy_unlock(hw->wiphy);
#endif
return (0); /* unused */
}
@@ -3492,7 +3477,7 @@
/* XXX-BZ hardcoded for now! */
#if 1
- vif->chanctx_conf = NULL;
+ RCU_INIT_POINTER(vif->bss_conf.chanctx_conf, NULL);
vif->bss_conf.vif = vif;
/* vap->iv_myaddr is not set until net80211::vap_setup or vap_attach. */
IEEE80211_ADDR_COPY(vif->bss_conf.addr, mac);
@@ -3575,7 +3560,7 @@
/* Configure tx queues (conf_tx), default WME & send BSS_CHANGED_QOS. */
IMPROVE("Hardcoded values; to fix see 802.11-2016, 9.4.2.29 EDCA Parameter Set element");
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
bzero(&txqp, sizeof(txqp));
@@ -3588,7 +3573,7 @@
ic_printf(ic, "%s: conf_tx ac %u failed %d\n",
__func__, ac, error);
}
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
changed = BSS_CHANGED_QOS;
lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
@@ -3750,8 +3735,8 @@
lkpi_ic_parent(struct ieee80211com *ic)
{
struct lkpi_hw *lhw;
-#ifdef HW_START_STOP
struct ieee80211_hw *hw;
+#ifdef HW_START_STOP
int error;
#endif
bool start_all;
@@ -3759,13 +3744,11 @@
IMPROVE();
lhw = ic->ic_softc;
-#ifdef HW_START_STOP
hw = LHW_TO_HW(lhw);
-#endif
start_all = false;
/* IEEE80211_UNLOCK(ic); */
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
if (ic->ic_nrunning > 0) {
#ifdef HW_START_STOP
error = lkpi_80211_mo_start(hw);
@@ -3777,7 +3760,7 @@
lkpi_80211_mo_stop(hw, false); /* XXX SUSPEND */
#endif
}
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
/* IEEE80211_LOCK(ic); */
if (start_all)
@@ -4742,9 +4725,9 @@
ltxq->txq.tid, ac, skb->priority, skb->qmap);
#endif
LKPI_80211_LTXQ_UNLOCK(ltxq);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
lkpi_80211_mo_wake_tx_queue(hw, &ltxq->txq);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
return;
ops_tx:
@@ -4757,9 +4740,9 @@
#endif
memset(&control, 0, sizeof(control));
control.sta = sta;
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
lkpi_80211_mo_tx(hw, &control, skb);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
}
static void
@@ -4920,9 +4903,9 @@
params.amsdu = false;
IEEE80211_UNLOCK(ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
error = lkpi_80211_mo_ampdu_action(hw, vif, &params);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(ic);
if (error != 0) {
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n",
@@ -4998,9 +4981,9 @@
}
IEEE80211_UNLOCK(ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
error = lkpi_80211_mo_ampdu_action(hw, vif, &params);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(ic);
if (error != 0) {
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n",
@@ -5057,9 +5040,9 @@
params.amsdu = false;
IEEE80211_UNLOCK(ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
error = lkpi_80211_mo_ampdu_action(hw, vif, &params);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
IEEE80211_LOCK(ic);
if (error != 0) {
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n",
@@ -5155,9 +5138,9 @@
else
params.amsdu = false;
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
error = lkpi_80211_mo_ampdu_action(hw, vif, &params);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
if (error != 0) {
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p rap %p\n",
__func__, error, ni, rap);
@@ -5229,9 +5212,9 @@
ic_locked = IEEE80211_IS_LOCKED(ic);
if (ic_locked)
IEEE80211_UNLOCK(ic);
- LKPI_80211_LHW_LOCK(lhw);
+ wiphy_lock(hw->wiphy);
error = lkpi_80211_mo_ampdu_action(hw, vif, &params);
- LKPI_80211_LHW_UNLOCK(lhw);
+ wiphy_unlock(hw->wiphy);
if (ic_locked)
IEEE80211_LOCK(ic);
if (error != 0)
@@ -5469,7 +5452,6 @@
lhw = wiphy_priv(wiphy);
lhw->ops = ops;
- LKPI_80211_LHW_LOCK_INIT(lhw);
LKPI_80211_LHW_SCAN_LOCK_INIT(lhw);
LKPI_80211_LHW_TXQ_LOCK_INIT(lhw);
sx_init_flags(&lhw->lvif_sx, "lhw-lvif", SX_RECURSE | SX_DUPOK);
@@ -5479,6 +5461,9 @@
TAILQ_INIT(&lhw->scheduled_txqs[ac]);
}
+ /* Chanctx_conf */
+ INIT_LIST_HEAD(&lhw->lchanctx_list);
+
/* Deferred RX path. */
LKPI_80211_LHW_RXQ_LOCK_INIT(lhw);
TASK_INIT(&lhw->rxq_task, 0, lkpi_80211_lhw_rxq_task, lhw);
@@ -5542,10 +5527,25 @@
__func__, lhw, mbufq_len(&lhw->rxq)));
LKPI_80211_LHW_RXQ_LOCK_DESTROY(lhw);
+ /* Chanctx_conf. */
+ if (!list_empty_careful(&lhw->lchanctx_list)) {
+ struct lkpi_chanctx *lchanctx, *next;
+ struct ieee80211_chanctx_conf *chanctx_conf;
+
+ list_for_each_entry_safe(lchanctx, next, &lhw->lchanctx_list, entry) {
+ if (lchanctx->added_to_drv) {
+ /* In reality we should panic? */
+ chanctx_conf = &lchanctx->chanctx_conf;
+ lkpi_80211_mo_remove_chanctx(hw, chanctx_conf);
+ }
+ list_del(&lchanctx->entry);
+ free(lchanctx, M_LKPI80211);
+ }
+ }
+
/* Cleanup more of lhw here or in wiphy_free()? */
LKPI_80211_LHW_TXQ_LOCK_DESTROY(lhw);
LKPI_80211_LHW_SCAN_LOCK_DESTROY(lhw);
- LKPI_80211_LHW_LOCK_DESTROY(lhw);
sx_destroy(&lhw->lvif_sx);
IMPROVE();
}
@@ -5977,8 +5977,6 @@
void *arg)
{
struct lkpi_hw *lhw;
- struct lkpi_vif *lvif;
- struct ieee80211_vif *vif;
struct lkpi_chanctx *lchanctx;
KASSERT(hw != NULL && iterfunc != NULL,
@@ -5986,22 +5984,13 @@
lhw = HW_TO_LHW(hw);
- IMPROVE("lchanctx should be its own list somewhere");
-
- LKPI_80211_LHW_LVIF_LOCK(lhw);
- TAILQ_FOREACH(lvif, &lhw->lvif_head, lvif_entry) {
-
- vif = LVIF_TO_VIF(lvif);
- if (vif->chanctx_conf == NULL)
- continue;
-
- lchanctx = CHANCTX_CONF_TO_LCHANCTX(vif->chanctx_conf);
+ rcu_read_lock();
+ list_for_each_entry_rcu(lchanctx, &lhw->lchanctx_list, entry) {
if (!lchanctx->added_to_drv)
continue;
-
iterfunc(hw, &lchanctx->chanctx_conf, arg);
}
- LKPI_80211_LHW_LVIF_UNLOCK(lhw);
+ rcu_read_unlock();
}
void
diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
--- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
@@ -458,7 +458,7 @@
hw, vif, conf, chanctx_conf);
error = lhw->ops->assign_vif_chanctx(hw, vif, conf, chanctx_conf);
if (error == 0)
- vif->chanctx_conf = chanctx_conf;
+ vif->bss_conf.chanctx_conf = chanctx_conf;
out:
return (error);
@@ -466,21 +466,23 @@
void
lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *conf, struct ieee80211_chanctx_conf **chanctx_conf)
+ struct ieee80211_bss_conf *conf, struct ieee80211_chanctx_conf *chanctx_conf)
{
struct lkpi_hw *lhw;
+ might_sleep();
+ lockdep_assert_wiphy(hw->wiphy);
+
lhw = HW_TO_LHW(hw);
if (lhw->ops->unassign_vif_chanctx == NULL)
return;
- if (*chanctx_conf == NULL)
+ if (chanctx_conf == NULL)
return;
LKPI_80211_TRACE_MO("hw %p vif %p bss_conf %p chanctx_conf %p",
- hw, vif, conf, *chanctx_conf);
- lhw->ops->unassign_vif_chanctx(hw, vif, conf, *chanctx_conf);
- *chanctx_conf = NULL;
+ hw, vif, conf, chanctx_conf);
+ lhw->ops->unassign_vif_chanctx(hw, vif, conf, chanctx_conf);
}

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 9, 7:21 AM (2 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28552493
Default Alt Text
D49734.id153396.diff (22 KB)

Event Timeline