Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6908450pxb; Wed, 17 Feb 2021 17:37:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6IiUt5HDc6E3GYhUNCKlrTeK/u0HidH+d3GIhPELD03t0HdFC3eya3ncyhBaW4yDXRD+D X-Received: by 2002:a17:906:1796:: with SMTP id t22mr1666243eje.372.1613612249361; Wed, 17 Feb 2021 17:37:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613612249; cv=none; d=google.com; s=arc-20160816; b=h5YBKoEXaOMpxgcDV+6+NXy1QzrZLFtSMQ+W+UudUvj4C3S6+MW2Drs1iIFVZ12Xtt MUg+EBnB2DGRKehjE3YblE8LBmgHfPygE+duGZlcldcP0PiOHtlBAYsM2dKRndInYg1V 16Z0ytI+0iPOE/9BFcPb3HhPLY6/nugU99ZlWTa5prIq4xRWaqzn2oUf02Y6N0w+1H9x clelj50TTL03tTXM+VLWg/C0haD4IOTEWwrnSyU84Skxrw82N/hR54YGUMPEPn5/Tavn HpGczqKFHmcX/hTvrY59mufrdajagwIetaMDSQ7FH4WolWX8DNzzMB+FiBODAyenaa2v lzDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=9+JjvUOD67QWmcgVl7vVaSQcEyvxGkHUN+8wZBO22PU=; b=kNnZS9lesvm/08TMoZaYqT/uiY+SmvrtIsUnawevJr8aWXZeCP89E1o+eqSFaN2WEf DnKJqyylzeFaywqqFvvWdz0Sdbg1FtdlxPbHc8CXGcG+ug5Zk4R1uyKYUX3yWmAUxh4x osoee+S0stJa5PRNN59NBOP0PCUJ2ASPbLoVPwkgt3SMIewyf9CVyPEHMGphn8C1+CZd i+A0Ns9NNHYwr3OXSxoan50p+2XZQ4MvV7h0xZWrlVr8H/81r4WqQ07gfCcRl0rAJYD6 TmSkHau1JygWmpKHIsUwthaULh/qiiQ5QnjqLd0BVGLEpT5e2ZaH+v4dW0McTsszO36R qhdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si2557076edc.83.2021.02.17.17.37.05; Wed, 17 Feb 2021 17:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbhBRBfe (ORCPT + 99 others); Wed, 17 Feb 2021 20:35:34 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:39778 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229993AbhBRBfb (ORCPT ); Wed, 17 Feb 2021 20:35:31 -0500 X-UUID: b97938a56a674f168c6a9c2f38f0f44f-20210218 X-UUID: b97938a56a674f168c6a9c2f38f0f44f-20210218 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1417638374; Thu, 18 Feb 2021 09:34:44 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 18 Feb 2021 09:34:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 18 Feb 2021 09:34:43 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH 2/3] mt76: mt7615: add rx checksum offload support Date: Thu, 18 Feb 2021 09:34:39 +0800 Message-ID: <5986dbd65f23d49aaf7656e0a4b4750985188f36.1613603857.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Set skb->ip_summed to CHECKSUM_UNNECESSARY if the hardware has validated the IP and TCP/UDP checksum Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 1 + drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index a97cc723094c..fd38737a27bd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -329,6 +329,7 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) hw->max_rates = 3; hw->max_report_rates = 7; hw->max_rate_tries = 11; + hw->netdev_features = NETIF_F_RXCSUM; phy->slottime = 9; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 928edd158f64..340beff0e121 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -234,6 +234,7 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) u32 rxd0 = le32_to_cpu(rxd[0]); u32 rxd1 = le32_to_cpu(rxd[1]); u32 rxd2 = le32_to_cpu(rxd[2]); + u32 csum_mask = MT_RXD0_NORMAL_IP_SUM | MT_RXD0_NORMAL_UDP_TCP_SUM; __le32 rxd12 = rxd[12]; bool unicast, remove_pad, insert_ccmp_hdr = false; int phy_idx; @@ -271,6 +272,9 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) spin_unlock_bh(&dev->sta_poll_lock); } + if ((rxd0 & csum_mask) == csum_mask) + skb->ip_summed = CHECKSUM_UNNECESSARY; + if (rxd2 & MT_RXD2_NORMAL_FCS_ERR) status->flag |= RX_FLAG_FAILED_FCS_CRC; -- 2.18.0