From nobody Sat Dec 07 00:23:10 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 4Y4pkQ6qMBz5g8tB; Sat, 07 Dec 2024 00:23:10 +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 4Y4pkQ6CXDz4NqG; Sat, 7 Dec 2024 00:23:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733530990; 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=PXx7t4MhJ+eTmagkrXkj6bc26RffDfprrQ2N/gfaT+k=; b=Ukk/tGfgP2dVDtLM1kaVYMSqhKTSpAlj6Hmrbh5RwEblChmvyGGZ9k3GB4gNFRjbCrJA75 YyvNkQrs2C4eKKOXqH/JubkuC+QSY+SJ9v3gqQzcJt3lFXfDcqRyXNjoX+YxsgmeXFQ4ry kwGGN5Pt2wQpa0OIIfFo0d5uiqrvBiXVWNV83IcKxS2iIQjjCg5JdV0lOZq3VtITC8Ownt fJEQ4AcmBjOSPcmvbHuwjqNJGRq1ZRnIZScxtgA+uX18Poq00aKRefLqc5ssCYVh+gq76A sbngSNGnkZf6kZGvzTJu6qtVhvUIlstts6YVQFUGDhDr3Dm6TORRXxR833eo4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733530990; 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=PXx7t4MhJ+eTmagkrXkj6bc26RffDfprrQ2N/gfaT+k=; b=U7fd/eV0iyFjiYHxSdeGYWHfHbbpBjF6xVqBdcpCc1nU3lVE6MIkvhd+gGaytYO1Tg/obm CPKjwxRXWvSFl34q6JcQTwnx+qpdkpAS/DcxFvQNdU61iY10AlZNcDogf/qKqKAhz+eiYb bzOfyqmqYtANufbEd2tTulNYUlPz8hBAYb6ye9dfF9VUJziVVOTPn2PpliQmkh4A1OQ0AH t1fkYYbuyIb0CXkCN0cDTbnMP/cSxHvt3lHeuWoY3E9aK3biVOJKaogvxZg6eqM/y+LuW9 Ffi+JRh2NubpXIJosMhy8raY6spsURK5XJKgxMhsjfIfSC7ecJbQgMrGOXh/LQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733530990; a=rsa-sha256; cv=none; b=o4R62rOnLJR+1qZO8Ce804tqNFEIyhyylObtbxTPprp2lcyqHdMVOqgO6vSWpcjeN5Dy4p si4XvNEXqJ5hVC9ptKGQpSvmJzBl07YmpN3FZBud20Oog2dmkYzX6hHFO6GjVOBG4KUtR3 QfgNhOY+mKeYqGYbbbjL+Pu++bDdJE0V2KzDBFnXTdiRAc2cEgF3tJQw7VwnE9XBpLlsVR N6jGCkSCjoIEgLxGevKk4ddBEBpE7cnCKC9GMFQ4VgiGS6EqDx9VGoVslDMKd22mcMQ5BY GtNdfkx0VluHAGfJVNv9GoheoN089L+R2EvN+5MQTAvAXDtHdNl+NP6ecg7DLg== 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 4Y4pkQ4pjZz10Zg; Sat, 7 Dec 2024 00:23:10 +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 4B70NAPN094321; Sat, 7 Dec 2024 00:23:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B70NAbH094318; Sat, 7 Dec 2024 00:23:10 GMT (envelope-from git) Date: Sat, 7 Dec 2024 00:23:10 GMT Message-Id: <202412070023.4B70NAbH094318@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: b59017c5cad9 - main - rtwn: add placeholder for the per-MACID rate report 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: b59017c5cad90d0f09a59e68c00457b7faf93e7c Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=b59017c5cad90d0f09a59e68c00457b7faf93e7c commit b59017c5cad90d0f09a59e68c00457b7faf93e7c Author: Adrian Chadd AuthorDate: 2024-12-04 04:10:54 +0000 Commit: Adrian Chadd CommitDate: 2024-12-07 00:22:47 +0000 rtwn: add placeholder for the per-MACID rate report Some chipsets (such as the RTL8188E) have firmware which supports a second kind of TX report - instead of a per-packet TX report, it can generate a per-MACID summary of packet success/failure counters. This would be helpful for those chips to cut back on the USB traffic to get rate control feedback for the driver based rate control we're currently using. This is a no-op; it just gets the pieces in place for future work. Differential Revision: https://reviews.freebsd.org/D47894 --- sys/dev/rtwn/if_rtwnvar.h | 7 ++++++- sys/dev/rtwn/pci/rtwn_pci_rx.c | 30 ++++++++++++++++++++++++++++++ sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c | 1 + sys/dev/rtwn/rtl8188e/r88e_rx.c | 3 ++- 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 + sys/dev/rtwn/usb/rtwn_usb_rx.c | 21 +++++++++++++++++++++ 11 files changed, 66 insertions(+), 2 deletions(-) diff --git a/sys/dev/rtwn/if_rtwnvar.h b/sys/dev/rtwn/if_rtwnvar.h index d4458384dbd7..163ab6068ee6 100644 --- a/sys/dev/rtwn/if_rtwnvar.h +++ b/sys/dev/rtwn/if_rtwnvar.h @@ -133,7 +133,8 @@ struct rtwn_vap { */ enum { RTWN_RX_DATA, - RTWN_RX_TX_REPORT, + RTWN_RX_TX_REPORT, /* Per-packet */ + RTWN_RX_TX_REPORT2, /* Per-MACID summary */ RTWN_RX_OTHER }; @@ -348,6 +349,8 @@ struct rtwn_softc { int (*sc_classify_intr)(struct rtwn_softc *, void *, int); void (*sc_handle_tx_report)(struct rtwn_softc *, uint8_t *, int); + void (*sc_handle_tx_report2)(struct rtwn_softc *, uint8_t *, + int); void (*sc_handle_c2h_report)(struct rtwn_softc *, uint8_t *, int); int (*sc_check_frame)(struct rtwn_softc *, struct mbuf *); @@ -549,6 +552,8 @@ void rtwn_suspend(struct rtwn_softc *); (((_sc)->sc_classify_intr)((_sc), (_buf), (_len))) #define rtwn_handle_tx_report(_sc, _buf, _len) \ (((_sc)->sc_handle_tx_report)((_sc), (_buf), (_len))) +#define rtwn_handle_tx_report2(_sc, _buf, _len) \ + (((_sc)->sc_handle_tx_report2)((_sc), (_buf), (_len))) #define rtwn_handle_c2h_report(_sc, _buf, _len) \ (((_sc)->sc_handle_c2h_report)((_sc), (_buf), (_len))) #define rtwn_check_frame(_sc, _m) \ diff --git a/sys/dev/rtwn/pci/rtwn_pci_rx.c b/sys/dev/rtwn/pci/rtwn_pci_rx.c index 7f06725afb0e..4ef879f1c947 100644 --- a/sys/dev/rtwn/pci/rtwn_pci_rx.c +++ b/sys/dev/rtwn/pci/rtwn_pci_rx.c @@ -236,6 +236,33 @@ rtwn_pci_tx_report(struct rtwn_pci_softc *pc, int len) #endif } +static void +rtwn_pci_tx_report2(struct rtwn_pci_softc *pc, int len) +{ + struct rtwn_softc *sc = &pc->pc_sc; + + if (sc->sc_ratectl != RTWN_RATECTL_NET80211) { + /* shouldn't happen */ + device_printf(sc->sc_dev, + "%s called while ratectl = %d!\n", + __func__, sc->sc_ratectl); + return; + } + + RTWN_NT_LOCK(sc); + rtwn_handle_tx_report2(sc, pc->pc_rx_buf, len); + RTWN_NT_UNLOCK(sc); + +#ifdef IEEE80211_SUPPORT_SUPERG + /* + * NB: this will executed only when 'report' bit is set. + */ + if (sc->sc_tx_n_active > 0 && --sc->sc_tx_n_active <= 1) + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); +#endif +} + + static void rtwn_pci_c2h_report(struct rtwn_pci_softc *pc, int len) { @@ -341,6 +368,9 @@ rtwn_pci_rx_done(struct rtwn_softc *sc) case RTWN_RX_TX_REPORT: rtwn_pci_tx_report(pc, len); break; + case RTWN_RX_TX_REPORT2: + rtwn_pci_tx_report2(pc, len); + break; case RTWN_RX_OTHER: rtwn_pci_c2h_report(pc, len); break; diff --git a/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c b/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c index 190a0dcd0e2b..060572f54800 100644 --- a/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c +++ b/sys/dev/rtwn/rtl8188e/pci/r88ee_attach.c @@ -145,6 +145,7 @@ r88ee_attach(struct rtwn_pci_softc *pc) sc->sc_get_rssi_ofdm = r88e_get_rssi_ofdm; sc->sc_classify_intr = r88e_classify_intr; sc->sc_handle_tx_report = r88e_ratectl_tx_complete; + sc->sc_handle_tx_report2 = rtwn_nop_softc_uint8_int; sc->sc_handle_c2h_report = r88e_handle_c2h_report; sc->sc_check_frame = rtwn_nop_int_softc_mbuf; sc->sc_rf_read = r92c_rf_read; diff --git a/sys/dev/rtwn/rtl8188e/r88e_rx.c b/sys/dev/rtwn/rtl8188e/r88e_rx.c index 4f8517f1e490..826076c8071c 100644 --- a/sys/dev/rtwn/rtl8188e/r88e_rx.c +++ b/sys/dev/rtwn/rtl8188e/r88e_rx.c @@ -63,8 +63,9 @@ r88e_classify_intr(struct rtwn_softc *sc, void *buf, int len) case R88E_RXDW3_RPT_RX: return (RTWN_RX_DATA); case R88E_RXDW3_RPT_TX1: /* per-packet Tx report */ - case R88E_RXDW3_RPT_TX2: /* periodical Tx report */ return (RTWN_RX_TX_REPORT); + case R88E_RXDW3_RPT_TX2: /* periodical Tx report */ + return (RTWN_RX_TX_REPORT2); case R88E_RXDW3_RPT_HIS: return (RTWN_RX_OTHER); default: /* shut up the compiler */ diff --git a/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c b/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c index 77193321bb9e..fcd26cd9a212 100644 --- a/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c +++ b/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c @@ -138,6 +138,7 @@ r88eu_attach(struct rtwn_usb_softc *uc) sc->sc_get_rssi_ofdm = r88e_get_rssi_ofdm; sc->sc_classify_intr = r88e_classify_intr; sc->sc_handle_tx_report = r88e_ratectl_tx_complete; + sc->sc_handle_tx_report2 = rtwn_nop_softc_uint8_int; sc->sc_handle_c2h_report = r88e_handle_c2h_report; sc->sc_check_frame = rtwn_nop_int_softc_mbuf; sc->sc_rf_read = r92c_rf_read; diff --git a/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c b/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c index 423bf2af1845..4c12403bf4fb 100644 --- a/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c +++ b/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c @@ -175,6 +175,7 @@ r92ce_attach(struct rtwn_pci_softc *pc) sc->sc_get_rssi_ofdm = r92c_get_rssi_ofdm; sc->sc_classify_intr = r92c_classify_intr; sc->sc_handle_tx_report = rtwn_nop_softc_uint8_int; + sc->sc_handle_tx_report2 = rtwn_nop_softc_uint8_int; sc->sc_handle_c2h_report = rtwn_nop_softc_uint8_int; sc->sc_check_frame = rtwn_nop_int_softc_mbuf; sc->sc_rf_read = r92c_rf_read; diff --git a/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c b/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c index 585610225193..8585333290bf 100644 --- a/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c +++ b/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c @@ -167,6 +167,7 @@ r92cu_attach(struct rtwn_usb_softc *uc) sc->sc_get_rssi_ofdm = r92c_get_rssi_ofdm; sc->sc_classify_intr = r92c_classify_intr; sc->sc_handle_tx_report = rtwn_nop_softc_uint8_int; + sc->sc_handle_tx_report2 = rtwn_nop_softc_uint8_int; sc->sc_handle_c2h_report = rtwn_nop_softc_uint8_int; sc->sc_check_frame = rtwn_nop_int_softc_mbuf; sc->sc_rf_read = r92c_rf_read; diff --git a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c index a0a93925358c..e0eadd72056b 100644 --- a/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c +++ b/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c @@ -116,6 +116,7 @@ r92eu_attach(struct rtwn_usb_softc *uc) sc->sc_get_rssi_ofdm = r88e_get_rssi_ofdm; sc->sc_classify_intr = r12au_classify_intr; sc->sc_handle_tx_report = r12a_ratectl_tx_complete; + sc->sc_handle_tx_report2 = rtwn_nop_softc_uint8_int; sc->sc_handle_c2h_report = r92e_handle_c2h_report; sc->sc_check_frame = rtwn_nop_int_softc_mbuf; sc->sc_rf_read = r92e_rf_read; diff --git a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c index 0c04c2d24b7b..70655092d1be 100644 --- a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c +++ b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c @@ -205,6 +205,7 @@ r12au_attach(struct rtwn_usb_softc *uc) sc->sc_get_rssi_ofdm = r88e_get_rssi_ofdm; sc->sc_classify_intr = r12au_classify_intr; sc->sc_handle_tx_report = r12a_ratectl_tx_complete; + sc->sc_handle_tx_report2 = rtwn_nop_softc_uint8_int; sc->sc_handle_c2h_report = r12a_handle_c2h_report; sc->sc_check_frame = r12a_check_frame_checksum; sc->sc_rf_write = r12a_rf_write; diff --git a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c index 9b648c067c2f..59fa183fd804 100644 --- a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c +++ b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c @@ -190,6 +190,7 @@ r21au_attach(struct rtwn_usb_softc *uc) sc->sc_get_rssi_ofdm = r88e_get_rssi_ofdm; sc->sc_classify_intr = r12au_classify_intr; sc->sc_handle_tx_report = r12a_ratectl_tx_complete; + sc->sc_handle_tx_report2 = rtwn_nop_softc_uint8_int; sc->sc_handle_c2h_report = r12a_handle_c2h_report; sc->sc_check_frame = r12a_check_frame_checksum; sc->sc_rf_read = r12a_c_cut_rf_read; diff --git a/sys/dev/rtwn/usb/rtwn_usb_rx.c b/sys/dev/rtwn/usb/rtwn_usb_rx.c index 5db967ddcc18..657d6bdeb9e4 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_rx.c +++ b/sys/dev/rtwn/usb/rtwn_usb_rx.c @@ -326,6 +326,27 @@ rtwn_report_intr(struct rtwn_usb_softc *uc, struct usb_xfer *xfer, rtwn_handle_tx_report(sc, buf, len); RTWN_NT_UNLOCK(sc); +#ifdef IEEE80211_SUPPORT_SUPERG + /* + * NB: this will executed only when 'report' bit is set. + */ + if (sc->sc_tx_n_active > 0 && --sc->sc_tx_n_active <= 1) + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); +#endif + break; + case RTWN_RX_TX_REPORT2: + if (sc->sc_ratectl != RTWN_RATECTL_NET80211) { + /* shouldn't happen */ + device_printf(sc->sc_dev, + "%s called while ratectl = %d!\n", + __func__, sc->sc_ratectl); + break; + } + + RTWN_NT_LOCK(sc); + rtwn_handle_tx_report2(sc, buf, len); + RTWN_NT_UNLOCK(sc); + #ifdef IEEE80211_SUPPORT_SUPERG /* * NB: this will executed only when 'report' bit is set.