From nobody Wed Dec 18 23:48:57 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 4YD9PP61Lrz5h7nX; Wed, 18 Dec 2024 23:48:57 +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 4YD9PP5QLfz44dW; Wed, 18 Dec 2024 23:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734565737; 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=qmfauz8nY4DZK3/OEjFNwsPqhEj6ViO4cx48KUF5UjE=; b=qnorBnm/RRJHXikmRpxBzLV+ykGOnHZPTUHikHej3efruUuk8QYT5cVb1o8nTr8mekW7E8 A1Pz7AAQstmeHJUyOy/W2/i8SQ4k4i7KyvRzNdCfZx/Pz8UP0gQu3EYcoo+nR3BUPk7ZG1 UcA/YSCnr/lPUnqvhrAvtR4nRPVesQBL0WtElpZyd2885Cdndff1mikWzJ3ur5OrpJ0mpu 0ZmD1xfAd+tZq2/y1NIstlE6CSh/K/jlgDZZnjwRiveV15C7jZPhUMJvT4pgP0RhhjcAuf tlbPgbyQxsfMxJsB1hisuZhJSjJIjaM3jeYrZY1si25MfR1zSAoT12qkFO+1Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734565737; 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=qmfauz8nY4DZK3/OEjFNwsPqhEj6ViO4cx48KUF5UjE=; b=oICUdPWrtXLRZGhvfN3/oGZVTMCL7jYCuDEdwr4HY26i2nuJqbGesRAQEGWp8CkO+FtMag FXhUJUfiI3zMnag/FGV5IsmwVNy+eycegSYYB78jDnz6d8Fd3HiaCsYlzdkPhaLihG3B/d CnvFfajL4fclrp1T3XWrONuZlzAS8B/9crLprr++Uy0BUxU2CZxwZ0GN36MsUDaS/KplUH xb+eZlMrtm7KrFbGSGS2p/6klczyxCc0ySoDCSRgEyKUwD65eQVBXX0jed+pSv2Fu997Yh zF/e99LvRpbiSDfIO9T/uZilk0ML4Y/3kcDPOiXnyKLlQY6cLyJepLuf2uZf+Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734565737; a=rsa-sha256; cv=none; b=Kk6OYNB8TCKajitlqm+MfcXwEKj+6ZmQfMpH/gDc8vNMi7qmCTtW0PEFJKFdzMQp8paeEk 5TB6ggyJjBC1DYI2ve17A+tMNfmi9k3XUrL7trbFsfxB6KLEWBeOX18BtGKXWAu9HembsZ azFw5uIfAcjYgiKGsD7WLMheN+kHrVZERNPnvlVUTGMngytA+e1+EiqjACPL+rt9MLtoho rDVzKHoeny6SoZb4q6VbLLOd0py5tUahs2AmqKhqTfnrFQrS3JC8KjmDxlus3jTEch2kdN goBNyhGSjEN2Q0bTlamz4atGoLmCbSJwWqNUrG2Lns/r088zabtBOHkMxaHAjw== 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 4YD9PP4vKwzTLZ; Wed, 18 Dec 2024 23:48:57 +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 4BINmvOR037998; Wed, 18 Dec 2024 23:48:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BINmvvd037995; Wed, 18 Dec 2024 23:48:57 GMT (envelope-from git) Date: Wed, 18 Dec 2024 23:48:57 GMT Message-Id: <202412182348.4BINmvvd037995@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: b71805e991fb - main - rtwn: add APIs for setting transmit power 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: b71805e991fb955005640bdec81618e37d3af47c Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=b71805e991fb955005640bdec81618e37d3af47c commit b71805e991fb955005640bdec81618e37d3af47c Author: Adrian Chadd AuthorDate: 2024-12-07 16:32:04 +0000 Commit: Adrian Chadd CommitDate: 2024-12-18 23:45:24 +0000 rtwn: add APIs for setting transmit power The RTL8188/RTL8192/RTL8821/RTL8812 NICs all seem happy to have their transmit power changed at runtime - and it does seem to do what's expected - the transmit power level does change. So, add the API call here, even though it's all currently no-ops. A follow-up commit will land changes for the chipsets to both limit transmit power to the configured / regulatory limit AND allow reconfiguration at runtime. Differential Revision: https://reviews.freebsd.org/D47979 Reviewed by: bz, imp --- sys/dev/rtwn/if_rtwn.c | 9 +++++++++ sys/dev/rtwn/if_rtwn_nop.h | 6 ++++++ sys/dev/rtwn/if_rtwnvar.h | 4 ++++ sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c | 1 + sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c | 1 + sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c | 1 + sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c | 1 + sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c | 1 + sys/dev/rtwn/rtl8812a/usb/r12au_attach.c | 1 + sys/dev/rtwn/rtl8821a/usb/r21au_attach.c | 1 + 10 files changed, 26 insertions(+) diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c index d4b45aa9eea7..fdf44467680b 100644 --- a/sys/dev/rtwn/if_rtwn.c +++ b/sys/dev/rtwn/if_rtwn.c @@ -232,6 +232,7 @@ rtwn_attach(struct rtwn_softc *sc) | IEEE80211_C_WME /* 802.11e */ | IEEE80211_C_SWAMSDUTX /* Do software A-MSDU TX */ | IEEE80211_C_FF /* Atheros fast-frames */ + | IEEE80211_C_TXPMGT /* TX power control */ ; if (sc->sc_hwcrypto != RTWN_CRYPTO_SW) { @@ -696,6 +697,14 @@ rtwn_ioctl_reset(struct ieee80211vap *vap, u_long cmd) case IEEE80211_IOC_LDPC: error = 0; break; + case IEEE80211_IOC_TXPOWER: + { + struct rtwn_softc *sc = vap->iv_ic->ic_softc; + RTWN_LOCK(sc); + error = rtwn_set_tx_power(sc, vap); + RTWN_UNLOCK(sc); + } + break; default: error = ENETRESET; break; diff --git a/sys/dev/rtwn/if_rtwn_nop.h b/sys/dev/rtwn/if_rtwn_nop.h index 4d7c63c87cd8..5e205617a12d 100644 --- a/sys/dev/rtwn/if_rtwn_nop.h +++ b/sys/dev/rtwn/if_rtwn_nop.h @@ -54,6 +54,12 @@ rtwn_nop_softc_vap(struct rtwn_softc *sc, struct ieee80211vap *vap) { } +static __inline int +rtwn_nop_int_softc_vap(struct rtwn_softc *sc, struct ieee80211vap *vap) +{ + return (0); +} + static __inline void rtwn_nop_softc_uint8_int(struct rtwn_softc *sc, uint8_t *buf, int len) { diff --git a/sys/dev/rtwn/if_rtwnvar.h b/sys/dev/rtwn/if_rtwnvar.h index 163ab6068ee6..3f14c05eb79d 100644 --- a/sys/dev/rtwn/if_rtwnvar.h +++ b/sys/dev/rtwn/if_rtwnvar.h @@ -366,6 +366,8 @@ struct rtwn_softc { void (*sc_init_antsel)(struct rtwn_softc *); void (*sc_post_init)(struct rtwn_softc *); int (*sc_init_bcnq1_boundary)(struct rtwn_softc *); + int (*sc_set_tx_power)(struct rtwn_softc *, + struct ieee80211vap *); const uint8_t *chan_list_5ghz[3]; int chan_num_5ghz[3]; @@ -590,6 +592,8 @@ void rtwn_suspend(struct rtwn_softc *); (((_sc)->sc_post_init)((_sc))) #define rtwn_init_bcnq1_boundary(_sc) \ (((_sc)->sc_init_bcnq1_boundary)((_sc))) +#define rtwn_set_tx_power(_sc, _vap) \ + (((_sc)->sc_set_tx_power)((_sc), (_vap))) /* * Methods to access subfields in registers. diff --git a/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c b/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c index 060572f54800..e4c0027c39a5 100644 --- a/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c +++ b/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c @@ -191,6 +191,7 @@ r88ee_attach(struct rtwn_pci_softc *pc) sc->sc_init_antsel = rtwn_nop_softc; sc->sc_post_init = r88ee_post_init; sc->sc_init_bcnq1_boundary = rtwn_nop_int_softc; + sc->sc_set_tx_power = rtwn_nop_int_softc_vap; sc->mac_prog = &rtl8188e_mac[0]; sc->mac_size = nitems(rtl8188e_mac); diff --git a/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c b/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c index fcd26cd9a212..400c0a148f35 100644 --- a/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c +++ b/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c @@ -184,6 +184,7 @@ r88eu_attach(struct rtwn_usb_softc *uc) sc->sc_init_antsel = rtwn_nop_softc; sc->sc_post_init = r88eu_post_init; sc->sc_init_bcnq1_boundary = rtwn_nop_int_softc; + sc->sc_set_tx_power = rtwn_nop_int_softc_vap; sc->mac_prog = &rtl8188e_mac[0]; sc->mac_size = nitems(rtl8188e_mac); diff --git a/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c b/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c index 4c12403bf4fb..e992f1c50f26 100644 --- a/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c +++ b/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c @@ -221,6 +221,7 @@ r92ce_attach(struct rtwn_pci_softc *pc) sc->sc_init_antsel = rtwn_nop_softc; sc->sc_post_init = r92ce_post_init; sc->sc_init_bcnq1_boundary = rtwn_nop_int_softc; + sc->sc_set_tx_power = rtwn_nop_int_softc_vap; sc->mac_prog = &rtl8192ce_mac[0]; sc->mac_size = nitems(rtl8192ce_mac); diff --git a/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c b/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c index 8585333290bf..6482c933eec2 100644 --- a/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c +++ b/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c @@ -213,6 +213,7 @@ r92cu_attach(struct rtwn_usb_softc *uc) sc->sc_init_antsel = r92c_init_antsel; sc->sc_post_init = r92cu_post_init; sc->sc_init_bcnq1_boundary = rtwn_nop_int_softc; + sc->sc_set_tx_power = rtwn_nop_int_softc_vap; sc->mac_prog = &rtl8192cu_mac[0]; sc->mac_size = nitems(rtl8192cu_mac); diff --git a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c index e0eadd72056b..c134ba22a430 100644 --- a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c +++ b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c @@ -164,6 +164,7 @@ r92eu_attach(struct rtwn_usb_softc *uc) sc->sc_init_antsel = rtwn_nop_softc; sc->sc_post_init = r92eu_post_init; sc->sc_init_bcnq1_boundary = rtwn_nop_int_softc; + sc->sc_set_tx_power = rtwn_nop_int_softc_vap; sc->mac_prog = &rtl8192eu_mac[0]; sc->mac_size = nitems(rtl8192eu_mac); diff --git a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c index 70655092d1be..4b86461b2f25 100644 --- a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c +++ b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c @@ -251,6 +251,7 @@ r12au_attach(struct rtwn_usb_softc *uc) sc->sc_init_antsel = r12a_init_antsel; sc->sc_post_init = r12au_post_init; sc->sc_init_bcnq1_boundary = rtwn_nop_int_softc; + sc->sc_set_tx_power = rtwn_nop_int_softc_vap; sc->chan_list_5ghz[0] = r12a_chan_5ghz_0; sc->chan_list_5ghz[1] = r12a_chan_5ghz_1; diff --git a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c index 59fa183fd804..75d8f3669c12 100644 --- a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c +++ b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c @@ -237,6 +237,7 @@ r21au_attach(struct rtwn_usb_softc *uc) sc->sc_init_antsel = r12a_init_antsel; sc->sc_post_init = r12au_post_init; sc->sc_init_bcnq1_boundary = r21a_init_bcnq1_boundary; + sc->sc_set_tx_power = rtwn_nop_int_softc_vap; sc->chan_list_5ghz[0] = r12a_chan_5ghz_0; sc->chan_list_5ghz[1] = r12a_chan_5ghz_1;