From nobody Tue Dec 31 19:13:35 2024 X-Original-To: dev-commits-src-all@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 4YN2gg5L6Yz5jtYY; Tue, 31 Dec 2024 19:13:35 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YN2gg27Nvz4pST; Tue, 31 Dec 2024 19:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735672415; 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=e0ue8KI/umlRCtK0asyBebXcIjG7GIGXfjyvGsJUc8U=; b=GpOvIwtAH7yO1+uSIFUxe4jS8ykrnvp4S2yTfkNJine56NJZmkZdul4A9kGUy7xGOKV3Fe QOIIgzXRfstYx7tsYQpJ5GQTQmO0SznpMn+rbOUZekN6EjknrBG3IAVwUhckf9LzWLmYGQ kb+8P/gjT2kGIgsNZIoEHzrCoSc/8odOG2S/DqWkUidrjSAv+5FcXSLF4+4C+uVApA452i U63h0SQ18PUNM6uprcvX+Y7LTkOd7wL30G54D0tqM03a0CgSNu1+IxAoJ2laV1IO0S839D r0Hym06DIbfYsmSQyOHOARCUhwrith9QM3dbYNAuEaLxJa/PfRG0E0q5x7dB8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735672415; 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=e0ue8KI/umlRCtK0asyBebXcIjG7GIGXfjyvGsJUc8U=; b=BGAqT8+UkewpWbLDX9xkD7P7jrtuEdkYGtBf4JrvWXQChvNk5AfW/lq7lluqBp1BiRNwTs 6p2iLnrJnX3/ZuddY9P/39zrxCVij+k925BRwG/qJUg1OWfvdtuJwOYiETI24YgphDtzuj XU0MtaailSQbprCkA4IcU4B+CZYh9naoftcXIzeIw+46hpQC8RVzFVxX9Vb6BM0PA27P4n jzS4KCsCGJgId3+kQ8JEQ+ILzIYsst6r1CiYAsSC5/OhnODP1vJzCXR2xLuBri/YyV0XNf WSFxdfNrIwRKHr6k2v1ld0qcRAi3YE/UoJPV6iyO4GhZWpgBUaI4dtBHiWohbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735672415; a=rsa-sha256; cv=none; b=tg+slFfwR2CYxx++bdU3In24dmDDIDm/3lN3X9CAX2NiXvsk0CKm63WDkJcbRQU/nZfSal zpic60muRglSvKAdnYuC2KbAeAdVitwCm0j5+u9VQyTrD1ofk9oAImeHH/gnKl1zXsuoZ1 at+9RKL9SZhsREjeGv/iwBUzL806ndE9L4pQu8TSdG098QMhhG4yUMtzoMoi8AFO/yIurD wRn7IoYtWIlET679GG0jC7XfCjD4/fKhbDYxeVgFvf7F4Tqt+yFhSXqokA605GLG5wPzBb 3H2Z5Bd4uGBA7KTs+qKSP9xLcTPkn6GmzfFKORPUXLJeOtmIxOHPcG+qQ+gL+A== 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 4YN2gg1lGMzsQS; Tue, 31 Dec 2024 19:13:35 +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 4BVJDZ0I060190; Tue, 31 Dec 2024 19:13:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BVJDZsZ060187; Tue, 31 Dec 2024 19:13:35 GMT (envelope-from git) Date: Tue, 31 Dec 2024 19:13:35 GMT Message-Id: <202412311913.4BVJDZsZ060187@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: 06b7335701fa - main - rtwn: add rtwn_ctl_vhtrate(), some cleanups List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 06b7335701fac54d752445e7d2b2c15c301f90dc Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=06b7335701fac54d752445e7d2b2c15c301f90dc commit 06b7335701fac54d752445e7d2b2c15c301f90dc Author: Adrian Chadd AuthorDate: 2024-12-15 22:58:13 +0000 Commit: Adrian Chadd CommitDate: 2024-12-31 19:13:26 +0000 rtwn: add rtwn_ctl_vhtrate(), some cleanups * remove the hard-coded ridx values in rate2ridx(), use the RIDX defines for CCK/OFDM rates * Add a placeholder rtwn_ctl_vhtrate() which returns the dot11rate control rate to use for the given VHT rate index. Since net80211 currently doesn't have any VHT PHY tables, there's no mapping for us to leverage so just return OFDM 12M for now. * Use the new macro to convert rate index to MCS rate * Add a printf() in rate2ridx if it's passed a HT/VHT rate. Differential Revision: https://reviews.freebsd.org/D48098 Reviewed by: bz --- sys/dev/rtwn/if_rtwn_ridx.h | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/sys/dev/rtwn/if_rtwn_ridx.h b/sys/dev/rtwn/if_rtwn_ridx.h index 6193f9ee2cad..0a1ea35303f1 100644 --- a/sys/dev/rtwn/if_rtwn_ridx.h +++ b/sys/dev/rtwn/if_rtwn_ridx.h @@ -82,20 +82,22 @@ rate2ridx(uint8_t rate) } switch (rate) { /* 11g */ - case 12: return 4; - case 18: return 5; - case 24: return 6; - case 36: return 7; - case 48: return 8; - case 72: return 9; - case 96: return 10; - case 108: return 11; + case 12: return (RTWN_RIDX_OFDM6); + case 18: return (RTWN_RIDX_OFDM9); + case 24: return (RTWN_RIDX_OFDM12); + case 36: return (RTWN_RIDX_OFDM18); + case 48: return (RTWN_RIDX_OFDM24); + case 72: return (RTWN_RIDX_OFDM36); + case 96: return (RTWN_RIDX_OFDM48); + case 108: return (RTWN_RIDX_OFDM54); /* 11b */ - case 2: return 0; - case 4: return 1; - case 11: return 2; - case 22: return 3; - default: return RTWN_RIDX_UNKNOWN; + case 2: return (RTWN_RIDX_CCK1); + case 4: return (RTWN_RIDX_CCK2); + case 11: return (RTWN_RIDX_CCK55); + case 22: return (RTWN_RIDX_CCK11); + default: + printf("%s: called; unknown rate (%d)\n", __func__, rate); + return (RTWN_RIDX_UNKNOWN); } } @@ -108,10 +110,23 @@ rtwn_ctl_mcsrate(const struct ieee80211_rate_table *rt, uint8_t ridx) /* Check if we are using MCS rate. */ KASSERT(RTWN_RATE_IS_HT(ridx), ("bad mcs rate index %d", ridx)); - rate = (ridx - RTWN_RIDX_HT_MCS(0)) | IEEE80211_RATE_MCS; + rate = RTWN_RIDX_TO_MCS(ridx) | IEEE80211_RATE_MCS; cix = rt->info[rt->rateCodeToIndex[rate]].ctlRateIndex; KASSERT(cix != (uint8_t)-1, ("rate %d (%d) has no info", rate, ridx)); - return rt->info[cix].dot11Rate; + return (rt->info[cix].dot11Rate); +} + +/* VHT version of rtwn_ctl_mcsrate */ +/* XXX TODO: also should move this to net80211 */ +static __inline__ uint8_t +rtwn_ctl_vhtrate(const struct ieee80211_rate_table *rt, uint8_t ridx) +{ + + /* Check if we are using VHT MCS rate. */ + KASSERT(RTWN_RATE_IS_VHT(ridx), ("bad mcs rate index %d", ridx)); + + /* TODO: there's no VHT tables, so for now just stick to OFDM12 */ + return (24); } #endif /* IF_RTWN_RIDX_H */