Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Nov 2022 17:27:06 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a585f67606fc - stable/13 - LinuxKPI: 802.11: enable WME support
Message-ID:  <202211281727.2ASHR6sb081283@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

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

commit a585f67606fced8a89cb0267d6e86a635658630d
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-11-07 12:39:46 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-11-28 16:34:24 +0000

    LinuxKPI: 802.11: enable WME support
    
    Most of the WME code has been there disabled for months.  One of the
    reasons was that it lead to crashes early on.  It is now understood
    that the crashes are independent event and we can enable WME.
    Update the code and deal with the calls from net80211 and adjust the
    updates to when mac80211 drivers expect them, coherently put it under
    LKPI_80211_WME and enable the define locally.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 4a67f1df8bdf70bc4a54ae212563dedfe4546e8d)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 68 +++++++++++++++++++++-------
 sys/compat/linuxkpi/common/src/linux_80211.h |  1 +
 2 files changed, 52 insertions(+), 17 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 4423109cc4b8..01263a642abd 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #include <linux/workqueue.h>
 #include "linux_80211.h"
 
+#define	LKPI_80211_WME
 /* #define	LKPI_80211_HW_CRYPTO */
 
 static MALLOC_DEFINE(M_LKPI80211, "lkpi80211", "LinuxKPI 80211 compat");
@@ -137,6 +138,9 @@ static struct lkpi_sta *lkpi_find_lsta_by_ni(struct lkpi_vif *,
     struct ieee80211_node *);
 static void lkpi_80211_txq_task(void *, int);
 static void lkpi_ieee80211_free_skb_mbuf(void *);
+#ifdef LKPI_80211_WME
+static int lkpi_wme_update(struct lkpi_hw *, struct ieee80211vap *, bool);
+#endif
 
 static void
 lkpi_lsta_dump(struct lkpi_sta *lsta, struct ieee80211_node *ni,
@@ -1502,6 +1506,10 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 	    "AUTH: %#x\n", __func__, lsta, lsta->state));
 	sta = LSTA_TO_STA(lsta);
 	sta->aid = IEEE80211_NODE_AID(ni);
+#ifdef LKPI_80211_WME
+	if (vap->iv_flags & IEEE80211_F_WME)
+		sta->wme = true;
+#endif
 	error = lkpi_80211_mo_sta_state(hw, vif, lsta, IEEE80211_STA_ASSOC);
 	if (error != 0)
 		goto out;
@@ -1510,6 +1518,9 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 
 	/* Update bss info (bss_info_changed) (assoc, aid, ..). */
 	bss_changed = 0;
+#ifdef LKPI_80211_WME
+	bss_changed |= lkpi_wme_update(lhw, vap, true);
+#endif
 	if (!vif->bss_conf.assoc || vif->bss_conf.aid != IEEE80211_NODE_AID(ni)) {
 		vif->bss_conf.assoc = true;
 		vif->bss_conf.aid = IEEE80211_NODE_AID(ni);
@@ -2097,13 +2108,11 @@ out:
 	return (lvif->iv_update_bss(vap, ni));
 }
 
+#ifdef LKPI_80211_WME
 static int
-lkpi_ic_wme_update(struct ieee80211com *ic)
+lkpi_wme_update(struct lkpi_hw *lhw, struct ieee80211vap *vap, bool planned)
 {
-	/* This needs queuing and go at the right moment. */
-#ifdef WITH_WME_UPDATE
-	struct ieee80211vap *vap;
-	struct lkpi_hw *lhw;
+	struct ieee80211com *ic;
 	struct ieee80211_hw *hw;
 	struct lkpi_vif *lvif;
 	struct ieee80211_vif *vif;
@@ -2113,39 +2122,42 @@ lkpi_ic_wme_update(struct ieee80211com *ic)
 	enum ieee80211_bss_changed changed;
 	int error;
 	uint16_t ac;
-#endif
 
 	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));
 
-#ifdef WITH_WME_UPDATE
-	vap = TAILQ_FIRST(&ic->ic_vaps);
 	if (vap == NULL)
 		return (0);
 
-	/* We should factor this out into per-vap (*wme_update). */
-	lhw = ic->ic_softc;
+	if ((vap->iv_flags & IEEE80211_F_WME) == 0)
+		return (0);
+
 	if (lhw->ops->conf_tx == NULL)
 		return (0);
 
-	/* XXX-BZ check amount of hw queues */
-	hw = LHW_TO_HW(lhw);
-	lvif = VAP_TO_LVIF(vap);
-	vif = LVIF_TO_VIF(lvif);
+	if (!planned && (vap->iv_state != IEEE80211_S_RUN)) {
+		lhw->update_wme = true;
+		return (0);
+	}
+	lhw->update_wme = false;
 
+	ic = lhw->ic;
 	ieee80211_wme_ic_getparams(ic, &chp);
 	IEEE80211_LOCK(ic);
 	for (ac = 0; ac < WME_NUM_AC; ac++)
 		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;
 
-		/* XXX-BZ should keep this in lvif? */
 		wmep = &wmeparr[ac];
 		bzero(&txqp, sizeof(txqp));
 		txqp.cw_min = wmep->wmep_logcwmin;
@@ -2159,10 +2171,30 @@ lkpi_ic_wme_update(struct ieee80211com *ic)
 	}
 	LKPI_80211_LHW_UNLOCK(lhw);
 	changed = BSS_CHANGED_QOS;
-	lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
+	if (!planned)
+		lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
+
+	return (changed);
+}
 #endif
 
-	return (0);
+static int
+lkpi_ic_wme_update(struct ieee80211com *ic)
+{
+#ifdef LKPI_80211_WME
+	struct ieee80211vap *vap;
+	struct lkpi_hw *lhw;
+
+	IMPROVE("Use the per-VAP callback in net80211.");
+	vap = TAILQ_FIRST(&ic->ic_vaps);
+	if (vap == NULL)
+		return (0);
+
+	lhw = ic->ic_softc;
+
+	lkpi_wme_update(lhw, vap, false);
+#endif
+	return (0);	/* unused */
 }
 
 static struct ieee80211vap *
@@ -3462,7 +3494,9 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
 	    IEEE80211_C_STA |
 	    IEEE80211_C_MONITOR |
 	    IEEE80211_C_WPA |		/* WPA/RSN */
+#ifdef LKPI_80211_WME
 	    IEEE80211_C_WME |
+#endif
 #if 0
 	    IEEE80211_C_PMGT |
 #endif
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h
index fc50521e57bf..d9f2ce68f4f1 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.h
+++ b/sys/compat/linuxkpi/common/src/linux_80211.h
@@ -187,6 +187,7 @@ struct lkpi_hw {	/* name it mac80211_sc? */
 	int				scan_ie_len;	/* Length of common per-band scan IEs. */
 
 	bool				update_mc;
+	bool				update_wme;
 
 	/* Must be last! */
 	struct ieee80211_hw		hw __aligned(CACHE_LINE_SIZE);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211281727.2ASHR6sb081283>