From nobody Mon Nov 07 12:45:45 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N5WDT6WXfz4gvK9; Mon, 7 Nov 2022 12:45:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N5WDT5m1gz4NQL; Mon, 7 Nov 2022 12:45:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667825145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IrgqbjyyDzvHvn9qJERVYwKofPskS75flSdBk1ILv1k=; b=ObwmZbURn7OhgTb0UNfH4rqX92bKV4eMrI5A9N7IcGxwy9KW68/hA9GrC8l3fKuI0qQNRb uLsqYhXYPA8CymFtYvcnYdBlu93Rb+fsuhezIqBJ0jptPtkbo+K7g1if/3XG1L2xeDUgym pMTRnqAD3B43FeLOU6YaWnqFJooazTuhqWc2Z+ZbBEfE2iwmBiQ/WRKDkZT/DSVN8iv+tV f9uBz/m11ewH9gO1SvHDh2nA99/CFeHjnbeq5weAHEX/ZACcd1fZ9BebOkw4ATKHVL7+5/ XBbVSbVcEpPjuooN1xU2ni2vAtoSJC8s4P78AQ47whdrmLNHFramKof9GcfWPA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N5WDT4k7Mz11Bh; Mon, 7 Nov 2022 12:45:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A7Cjj1G009785; Mon, 7 Nov 2022 12:45:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A7CjjRw009784; Mon, 7 Nov 2022 12:45:45 GMT (envelope-from git) Date: Mon, 7 Nov 2022 12:45:45 GMT Message-Id: <202211071245.2A7CjjRw009784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4a67f1df8bdf - main - LinuxKPI: 802.11: enable WME support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a67f1df8bdf70bc4a54ae212563dedfe4546e8d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667825145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IrgqbjyyDzvHvn9qJERVYwKofPskS75flSdBk1ILv1k=; b=QJIAm6Ko/ozJ/eR4Z+Md3KuupVExHRL9TqywXrhPbrktbfyMAMkfgqjG6NpZjijDoTdmMR sXSd2i85VZlToUs9fHQ5kq7KLBgPwwBEA2tNsBsijmhZ2k3lSPdzXSXpcZrsivpbi9xn4T MsDs7e3vgaSL4QF8JkYb9hIBq2OZn74/Pcz6JmToqtos10K9P/I92n4MZJ5fHoC3ncdHAX wE/ADSFpha7llt1DVyz77iyRjZEblaN73T/ssFk5SuqB44YtJj686zrOTd544gpELaoaGy 00cC/guxBhJbbBvPBPGUKNqQ/4Rt43IU/ncBOZhX4MkK8TCtck2U1XipzBoQhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667825145; a=rsa-sha256; cv=none; b=Q8wwGuS2zOviMxYcyGW1T82MFur4UrdZr2BpBx0X9P9OI6WgUuiaLHoaQLMR/fyIrWuus5 y+zgc0Ml+9MPtqXFkQRCJcN8f7E6UtwAzE6u0rYfp1LTKTjjPrXX2GxI0KbpBHbxv2EyR8 cXpbGbKOM4q3MMHsHokKVetLtmcv2ecZCoiFNDUMNBrK12kg/yeaXPC+6aGl8cQvvcN7nw 4c2QNV17h1EkRGcQGjjMq6wtzmg5CdZpTfLukl1+5PTzOwIIkEru4MTeN9lKgbOFjpJQiR h7P+VnCgWYbUeZGzdqaI9doTuqztIkAFrbVlYmpMGEn0SQYXSHSOBiyXz2z53w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4a67f1df8bdf70bc4a54ae212563dedfe4546e8d commit 4a67f1df8bdf70bc4a54ae212563dedfe4546e8d Author: Bjoern A. Zeeb AuthorDate: 2022-11-07 12:39:46 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-11-07 12:39:46 +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 MFC after: 3 days --- 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 c1606be3e1f9..998b39127993 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 #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);