Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1872569rwb; Wed, 5 Oct 2022 06:09:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ojUiFSYp9dgZmN+8K4UpTxoJahXUma8slFb4wosZVBmK9ymIn8iKD6tiTq/C+zRnpNdsR X-Received: by 2002:a50:9991:0:b0:458:a612:bf5a with SMTP id m17-20020a509991000000b00458a612bf5amr20557172edb.22.1664975362305; Wed, 05 Oct 2022 06:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664975362; cv=none; d=google.com; s=arc-20160816; b=QASTrybN7i5z5U0J6Iabovf7eOutGkUnvMH8z4t58ENvoQr/VkVw+WorZC2SDaK1rK w9NFJZRKmx/q8ja04fSK8moxTe/93RVNWedNzr0KuF/7G7OAE2q/hWTitnervPKNhWPM 19ARqvgN0jKCJpsxQATNsLFwMinJYA3D6Lxr/v98NDn72voafNDh1Vl0D3cxCijS6+fT mCvIqV+13nXh+H2Q1gLdGOXREeQ6yhkocEgAsSP1dSAuF8J4x4JlVzSNhkQMRl+4WxPJ yEW+V7zRjZTTu8R15/jSMetOvcQJjI2JT+cv/IVYwSasbUcTOUxBsfnwji91ykAKLNVd dDOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ViUzERznmY9U49Nq8HELK7/3YsqE5xhCFUTaS/36kxY=; b=mQGyYVsJRjeeV8FC3sG6HDdoQQshcF8YK1sqBnpwbO1Lb6dNUnXq3df3reH9VratM9 DBU0BhrqknEAUrtVXzJnHqgxXhhYKs0tg9zMSG5e/L6gVmHaGOfgWkevXbKstlZPu0ip vqYkeEyyfbW5eiapvZtZ/8KEOsrrrs4+P2dX7DFQDWrYnNDaVbDgJ6zN0Cx9ubI01jar 4+3L9sYJNgZhb/R9L3vHud9qww3NNN9HC7nkbX4EbuubTs6Kbup08IUF0F+Ityj++lLq mNHPUuv/dwWjfmjpz2i1cQW8fVAtdI0f7ABxnsMqJ0qQ2baJM1LFEFBCa7qeNcl1wFal GPUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=Gqq9DZqM; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js18-20020a17090797d200b007837bed6470si13941708ejc.576.2022.10.05.06.09.06; Wed, 05 Oct 2022 06:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=Gqq9DZqM; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229747AbiJENIb (ORCPT + 61 others); Wed, 5 Oct 2022 09:08:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiJENIa (ORCPT ); Wed, 5 Oct 2022 09:08:30 -0400 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8DC078595 for ; Wed, 5 Oct 2022 06:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ViUzERznmY9U49Nq8HELK7/3YsqE5xhCFUTaS/36kxY=; b=Gqq9DZqMiwmqlIkZnxeKUBPl0m iK6pd5IhPc1yZIyiBt8RHMEd89CS2EBT1BtkNT2GSPt+pke2eaHZTgndEQ78U6evtyOuG/N/UbsAS QeHfaSbPgJ516Ix7YfC25EWuQ3hUkiloMaGlRgVvilI4Iv++/pAFC/uuk6GT1JSJHpYY=; Received: from p200300daa7301d005d133ca52e775ee5.dip0.t-ipconnect.de ([2003:da:a730:1d00:5d13:3ca5:2e77:5ee5] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1og48Q-00ANpv-9e; Wed, 05 Oct 2022 15:08:26 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: kvalo@kernel.org, Chad Monroe Subject: [PATCH 6.1 1/2] wifi: mt76: fix receiving LLC packets on mt7615/mt7915 Date: Wed, 5 Oct 2022 15:08:23 +0200 Message-Id: <20221005130824.23371-1-nbd@nbd.name> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When 802.3 decap offload is enabled, the hardware indicates header translation failure, whenever either the LLC-SNAP header was not found, or a VLAN header with an unregcognized tag is present. In that case, the hardware inserts a 2-byte length fields after the MAC addresses. For VLAN packets, this tag needs to be removed. However, for 802.3 LLC packets, the length bytes should be preserved, since there is no separate ethertype field in the data. This fixes an issue where the length field was omitted for LLC frames, causing them to be malformed after hardware decap. Fixes: 1eeff0b4c1a6 ("mt76: mt7915: fix decap offload corner case with 4-addr VLAN frames") Reported-by: Chad Monroe Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 8 ++++---- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index d6aae60c440d..cbc6859e38ac 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -610,14 +610,14 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) * When header translation failure is indicated, * the hardware will insert an extra 2-byte field * containing the data length after the protocol - * type field. + * type field. This happens either when the LLC-SNAP + * pattern did not match, or if a VLAN header was + * detected. */ pad_start = 12; if (get_unaligned_be16(skb->data + pad_start) == ETH_P_8021Q) pad_start += 4; - - if (get_unaligned_be16(skb->data + pad_start) != - skb->len - pad_start - 2) + else pad_start = 0; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 1070838e7e16..ec996a587142 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -446,14 +446,14 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb) * When header translation failure is indicated, * the hardware will insert an extra 2-byte field * containing the data length after the protocol - * type field. + * type field. This happens either when the LLC-SNAP + * pattern did not match, or if a VLAN header was + * detected. */ pad_start = 12; if (get_unaligned_be16(skb->data + pad_start) == ETH_P_8021Q) pad_start += 4; - - if (get_unaligned_be16(skb->data + pad_start) != - skb->len - pad_start - 2) + else pad_start = 0; } -- 2.36.1