From nobody Thu Dec 05 07:30:15 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 4Y3mJ74xSTz5g3hM; Thu, 05 Dec 2024 07:30:15 +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 4Y3mJ73PFsz4KYx; Thu, 5 Dec 2024 07:30:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383815; 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=jr6gzLFn76OaOuJUX5iR/G7uKmSQoGjh4pya4FAlGT8=; b=X0AppszNNbcktu7W8CT3HAOJ5Dc/8Gw0DcKawszy5M8Ksj4BBSU8oearKE2kLHSqnRjgzg SsBZd/36tXnUYWL9jXTQnsSG6lYAe1lKOLodYbJcfoDihNz9D3RyHAw2uR5HMgU5c8sCc4 QNG+/OveGq42pgAfLFZGTAeV08ACqGQfnJV6Eepm3XzJflJmJb/yst+LKd3OVtg8w1KHlu 0PgGjayE/ABGKhTgUlY0o/5iiWU6v4vkJeYaSvMV7gFkdxlwLB1Zrzkq8o2QDsC2NpF1h7 O7ATcYuXTNdjZGjvGUlrFtIZb7trpKQNdFgQBnorhdcsCqcIRxSn+Yq+0Wd5Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733383815; 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=jr6gzLFn76OaOuJUX5iR/G7uKmSQoGjh4pya4FAlGT8=; b=FSu/0BEpJRgcHak+B0O6r5exVBx/31dEpXMT4H8xxExHIQmjs1v6ctnE5Lwp4q00cQV7Fw EHkW6WezpSmWQ0KvgjX1d6WySKj3VuckWQTbny05N6qoGENwe6OGasA1I+5uITJIb3fTLw zk/mBNk8T+JVXlRyhX44M1TENau07mJvQJOzhsNkvZ1Eq/b+wzjGl+m/Czo7fhj5kA84Nw ZkZK/z05mN8MGsoRSYqHzZxyrRzuiqp+u7ebtp9u3k3C9i6yNnl/3ndCVB3a90mdnW4MJ7 3SYGbDfJAiIWNLc9k/XUa9N7NuFFO/wyw19HDGMqMttm7eRiKEJ1pFWCPOmZNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733383815; a=rsa-sha256; cv=none; b=GD1wvWMFy99o4oeyP1GJ8SADR5iXWrz4r+DJhCkzgORXLHggGe+IYXrMJROO6l2LnQPbbl r0N4xhmlRsyWl7SiWagLjooGyhazvMX9lH3vGBuaDcNxtY1BMGFSzXH7oqhDJA7aGcvEir q70QuQds9Eb3GaZRkqxHcUBlER/mh2OBI4nI4HKC6eUvgGXJ+/XDgmGGzd60Y1MnTImtWL j6aRZ1kzT4Oicn5KkR+gH8UtwM9bReoaT00kQIJ0JKm48kMVhssBYR/vetP3Hx6hTOAIh/ Q5tYky132sGvz7bCVxP26c0TkkRtuGK2MsQzxbqlPGZCDZwwH0fUWsFc1oPOEw== 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 4Y3mJ71Rc3zk7Z; Thu, 5 Dec 2024 07:30:15 +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 4B57UFQx022118; Thu, 5 Dec 2024 07:30:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B57UFus022113; Thu, 5 Dec 2024 07:30:15 GMT (envelope-from git) Date: Thu, 5 Dec 2024 07:30:15 GMT Message-Id: <202412050730.4B57UFus022113@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: d76247e801de - main - rtwn: enable FCS in the recive config to work around truncated frames 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: d76247e801dec95600a068fa1bb09f4f57e00031 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=d76247e801dec95600a068fa1bb09f4f57e00031 commit d76247e801dec95600a068fa1bb09f4f57e00031 Author: Adrian Chadd AuthorDate: 2024-11-27 00:59:15 +0000 Commit: Adrian Chadd CommitDate: 2024-12-05 07:27:03 +0000 rtwn: enable FCS in the recive config to work around truncated frames I noticed that on RTL8812AU/RTL8821AU receiving VHT frames that I'd occasionally see frames missing the last 4 bytes. I can easily reproduce it with a ping sweep and fast (10ms) between frames. There's also a report of an earlier NIC (RTL8188EU) doing the same thing with HT frames but not with OFDM (11g) frames. After a bunch of poking, it turns out a driver where things DID work properly for the other report kept FCS enabled, and trimmed it from the frame before pushing it up to the network layer. I did the same and it also worked fine. The other solution was to disable PHYSTATUS notifications, but then we'd get no per packet RX notifications (RX rate, RSSI, etc.) Locally tested: * RTL8192EU, STA mode (HT) * RTL8812AU, STA mode (HT, VHT) * RTL8821AU, STA mode (HT, VHT) Differential Revision: https://reviews.freebsd.org/D47775 --- sys/dev/rtwn/if_rtwn_rx.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/dev/rtwn/if_rtwn_rx.c b/sys/dev/rtwn/if_rtwn_rx.c index 762472eca440..ebfb8e67ec6d 100644 --- a/sys/dev/rtwn/if_rtwn_rx.c +++ b/sys/dev/rtwn/if_rtwn_rx.c @@ -318,6 +318,10 @@ rtwn_rx_common(struct rtwn_softc *sc, struct mbuf *m, void *desc) /* Drop PHY descriptor. */ m_adj(m, infosz + shift); + /* If APPFCS, drop FCS */ + if (sc->rcr & R92C_RCR_APPFCS) + m_adj(m, -IEEE80211_CRC_LEN); + return (ni); } @@ -456,6 +460,15 @@ rtwn_rxfilter_init(struct rtwn_softc *sc) R92C_RCR_HTC_LOC_CTRL | R92C_RCR_APP_PHYSTS | R92C_RCR_APP_ICV | R92C_RCR_APP_MIC; + /* + * Add FCS, to work around occasional 4 byte truncation + * with some frames. This is more problematic on RTL8812/ + * RTL8821 because they're also doing L3/L4 checksum offload + * and hardware encryption, so both are tagged as "passed" + * before the frame is truncated. + */ + sc->rcr |= R92C_RCR_APPFCS; + /* Update dynamic Rx filter parts. */ rtwn_rxfilter_update(sc); } @@ -487,7 +500,7 @@ rtwn_set_promisc(struct rtwn_softc *sc) RTWN_ASSERT_LOCKED(sc); mask_all = R92C_RCR_ACF | R92C_RCR_ADF | R92C_RCR_AMF | R92C_RCR_AAP; - mask_min = R92C_RCR_APM; + mask_min = R92C_RCR_APM | R92C_RCR_APPFCS; if (sc->bcn_vaps == 0) mask_min |= R92C_RCR_CBSSID_BCN;