From nobody Thu Dec 05 07:30:12 2024 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 4Y3mJ5234vz5g3hL; Thu, 05 Dec 2024 07:30:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y3mJ51XNtz4KcJ; Thu, 5 Dec 2024 07:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383813; 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=D534nZHNZW+ORtgK5opxNd1lSOynMXEmQ06OkfhSPWI=; b=pHde6St2povCrxhi0tlwZcE+tidKsv0/s/CtbE5gppHLqwr37vFrAJooiPZpliYey0WJJP zARqhf6s7adOBWDS3yRxglm7uPEFS8V3ifwMIrCOvmtkrT3Qqo7tq0XppMrsYn00fFXgTc aZNDdpiYNrFHpH/4RQS91D5cshXdmL7Z33kr3ZKzxOWUg4p0RZCv6JyfestxIQveK+okdz JahMjDS6pZl6aekA5zCzFqhy+uDrs0VkF31SNFm/RGrWYdN5YfT4WL77pX1S7LvCNSiZ4s vxsvLjz6+rkHjlPZuRCqAQPFK63erKH3pZBLNRXvj61GR6z0Ev9ERuxsr2r9DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383813; 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=D534nZHNZW+ORtgK5opxNd1lSOynMXEmQ06OkfhSPWI=; b=WBHi5MdfdJXB8kauYlKERh5ebXxV1QyGmGztZRyzv4MF5SDY3xcniyc409faK2PWNAcoEV axX835+EHHVb+FtuOAdo5By+XJ55rfrd9e8Mp0Hv5l1kCJ4EP3Fpk3jp9XxuQoSBPsKA5P zOpknPaaTAUyPxD7kICVv71wGRgGU61ncX4lVfWDcS19u5mfpearZkAo7ppOZJD117ur9p biCRgiWhsm2qwoEiWJxFuUNQEX6WvcRpAr7exCAeav7rWQJXpkjfrGW7/euvNZcmTuXb8d YVBLotMovliPX79OPlTwUNckDsd+3qj2HPBKZgqiHj6BDYSwONnw6+fYLR32aQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733383813; a=rsa-sha256; cv=none; b=E+9PULXXlKkaFsTlAkvsT41k3OIIRBvkrwtgBf+VHMw+3G0nKWgj/+dxFoKjzzL4DXqUdM HdG1IgySfDDrZOS5NbZdk62XH9AtOctiL2Q5gvKHhbEvp50GhV9pLpkTnVFL5HjUHVLFun yXCqyK3w92VQkwWoFc8MdClzncQdh32OLFTziCkeNo7aDO8kMQEs+pgBuHFzSpXgTh3B1l OvC7wM7jQVozqqL013RPXoM1XsyN+pAHa5R4J21ZgtbQKiUm1RpL28owAAeDFwQpY2bjsE /FONTdMQqzfXjMlqwx7rkt647k3hNGsjkjz9bdfXPUPv05hxb1/veNSHy6UdRQ== 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 4Y3mJ50ncbzk5n; Thu, 5 Dec 2024 07:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B57UCEE020633; Thu, 5 Dec 2024 07:30:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B57UCpM020624; Thu, 5 Dec 2024 07:30:12 GMT (envelope-from git) Date: Thu, 5 Dec 2024 07:30:12 GMT Message-Id: <202412050730.4B57UCpM020624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 77e64f45c478 - main - rtwn: use ieee80211_ht_get_node_ampdu_density(), fix programming MAX_AGG 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77e64f45c47827987b84a2e5bf3e9f6a2a52bda8 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=77e64f45c47827987b84a2e5bf3e9f6a2a52bda8 commit 77e64f45c47827987b84a2e5bf3e9f6a2a52bda8 Author: Adrian Chadd AuthorDate: 2024-11-26 16:59:11 +0000 Commit: Adrian Chadd CommitDate: 2024-12-05 07:26:35 +0000 rtwn: use ieee80211_ht_get_node_ampdu_density(), fix programming MAX_AGG * use ieee80211_ht_get_node_ampdu_density() now instead of the vap->iv_ampdu_density, so the correct density is used in AP/IBSS/mesh modes. * MAX_AGG controls how many frames are to be sent in an A-MPDU. It maps to ((MAX_AGG * 2) + 1) == npackets. 0x1f (31) means 64 packets. So, instead of hard-coding 0x1f, use the negotiated block-ack window size. Differential Revision: https://reviews.freebsd.org/D47766 --- sys/dev/rtwn/rtl8192c/r92c_tx.c | 26 ++++++++++++++++++++++++-- sys/dev/rtwn/rtl8812a/r12a_tx.c | 26 ++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c index b8c26d861a14..a3e92e1b7ebb 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_tx.c +++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c @@ -221,6 +221,28 @@ r92c_tx_setup_macid(void *buf, int id) txd->txdw4 &= ~htole32(R92C_TXDW4_RTS_SHORT); } +static int +r92c_calculate_tx_agg_window(struct rtwn_softc *sc, + const struct ieee80211_node *ni, int tid) +{ + const struct ieee80211_tx_ampdu *tap; + int wnd; + + tap = &ni->ni_tx_ampdu[tid]; + + /* + * BAW is (MAX_AGG * 2) + 1, hence the /2 here. + * Ensure we don't send 0 or more than 64. + */ + wnd = tap->txa_wnd / 2; + if (wnd == 0) + wnd = 1; + else if (wnd > 0x1f) + wnd = 0x1f; + + return (wnd); +} + void r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, void *buf, uint8_t ridx, int maxretry) @@ -276,9 +298,9 @@ r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, (m->m_flags & M_AMPDU_MPDU) != 0); if (m->m_flags & M_AMPDU_MPDU) { txd->txdw2 |= htole32(SM(R92C_TXDW2_AMPDU_DEN, - vap->iv_ampdu_density)); + ieee80211_ht_get_node_ampdu_density(ni))); txd->txdw6 |= htole32(SM(R92C_TXDW6_MAX_AGG, - 0x1f)); /* XXX */ + r92c_calculate_tx_agg_window(sc, ni, tid))); } if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { txd->txdw2 |= htole32(R92C_TXDW2_CCX_RPT); diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c index 8cee2a16fbd5..6102a0567e74 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_tx.c +++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c @@ -229,6 +229,28 @@ r12a_tx_set_ldpc(struct rtwn_softc *sc, struct r12a_tx_desc *txd, txd->txdw5 |= htole32(R12A_TXDW5_DATA_LDPC); } +static int +r12a_calculate_tx_agg_window(struct rtwn_softc *sc, + const struct ieee80211_node *ni, int tid) +{ + const struct ieee80211_tx_ampdu *tap; + int wnd; + + tap = &ni->ni_tx_ampdu[tid]; + + /* + * BAW is (MAX_AGG * 2) + 1, hence the /2 here. + * Ensure we don't send 0 or more than 64. + */ + wnd = tap->txa_wnd / 2; + if (wnd == 0) + wnd = 1; + else if (wnd > 0x1f) + wnd = 0x1f; + + return (wnd); +} + void r12a_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, void *buf, uint8_t ridx, int maxretry) @@ -280,9 +302,9 @@ r12a_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, if (m->m_flags & M_AMPDU_MPDU) { txd->txdw2 |= htole32(R12A_TXDW2_AGGEN); txd->txdw2 |= htole32(SM(R12A_TXDW2_AMPDU_DEN, - vap->iv_ampdu_density)); + ieee80211_ht_get_node_ampdu_density(ni))); txd->txdw3 |= htole32(SM(R12A_TXDW3_MAX_AGG, - 0x1f)); /* XXX */ + r12a_calculate_tx_agg_window(sc, ni, tid))); } else txd->txdw2 |= htole32(R12A_TXDW2_AGGBK);