git: da24b50552e7 - releng/14.0 - LinuxKPI: 802.11: inialize tx queue params

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 09 Oct 2023 23:16:24 UTC
The branch releng/14.0 has been updated by bz:

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

commit da24b50552e72d5d7ff6f995902777125f3d202d
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-09-21 12:36:38 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-10-09 23:14:54 +0000

    LinuxKPI: 802.11: inialize tx queue params
    
    When adding a VAP (vif) initialize its tx queue parameters calling
    mo_conf_tx().
    I could not spot net80211 providing some of the values needed before
    having a node so currrently we use hard-coded values with a comment
    with a reference on how to properly calculate the values in the future
    (e.g., in case of 11b or other cases).
    
    Sponsored by:   The FreeBSD Foundation
    Approved by:    re (gjb)
    
    (cherry picked from commit a6042e17c8999c4965bd4d762c4564b322f1ae7b)
    (cherry picked from commit 68e1e25baf2e5576011ed532d5a30e70997d488c)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 7ffe658a628d..e89979521296 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -2244,9 +2244,11 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
 	struct lkpi_vif *lvif;
 	struct ieee80211vap *vap;
 	struct ieee80211_vif *vif;
+	struct ieee80211_tx_queue_params txqp;
 	enum ieee80211_bss_changed changed;
 	size_t len;
 	int error, i;
+	uint16_t ac;
 
 	if (!TAILQ_EMPTY(&ic->ic_vaps))	/* 1 so far. Add <n> once this works. */
 		return (NULL);
@@ -2345,7 +2347,24 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
 	changed = 0;
 	lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
 
-	/* conf_tx setup; default WME? */
+	/* 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);
+	for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
+
+		bzero(&txqp, sizeof(txqp));
+		txqp.cw_min = 15;
+		txqp.cw_max = 1023;
+		txqp.txop = 0;
+		txqp.aifs = 2;
+		error = lkpi_80211_mo_conf_tx(hw, vif, /* link_id */0, ac, &txqp);
+		if (error != 0)
+			ic_printf(ic, "%s: conf_tx ac %u failed %d\n",
+			    __func__, ac, error);
+	}
+	LKPI_80211_LHW_UNLOCK(lhw);
+	changed = BSS_CHANGED_QOS;
+	lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, changed);
 
 	/* Force MC init. */
 	lkpi_update_mcast_filter(ic, true);