From: Ryder Lee <ryder.lee@mediatek.com> To: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Cc: Shayne Chen <shayne.chen@mediatek.com>, <linux-wireless@vger.kernel.org>, <linux-mediatek@lists.infradead.org>, Ryder Lee <ryder.lee@mediatek.com> Subject: [PATCH 2/3] mt76: mt7615: add rx checksum offload support Date: Thu, 18 Feb 2021 09:34:39 +0800 [thread overview] Message-ID: <5986dbd65f23d49aaf7656e0a4b4750985188f36.1613603857.git.ryder.lee@mediatek.com> (raw) In-Reply-To: <b7883f5ee09d13f7cbdf5ab1d5fef61ebc79dcc4.1613603857.git.ryder.lee@mediatek.com> Set skb->ip_summed to CHECKSUM_UNNECESSARY if the hardware has validated the IP and TCP/UDP checksum Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Ryder Lee <ryder.lee@mediatek.com> To: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Cc: linux-mediatek@lists.infradead.org, Ryder Lee <ryder.lee@mediatek.com>, linux-wireless@vger.kernel.org, Shayne Chen <shayne.chen@mediatek.com> Subject: [PATCH 2/3] mt76: mt7615: add rx checksum offload support Date: Thu, 18 Feb 2021 09:34:39 +0800 [thread overview] Message-ID: <5986dbd65f23d49aaf7656e0a4b4750985188f36.1613603857.git.ryder.lee@mediatek.com> (raw) In-Reply-To: <b7883f5ee09d13f7cbdf5ab1d5fef61ebc79dcc4.1613603857.git.ryder.lee@mediatek.com> Set skb->ip_summed to CHECKSUM_UNNECESSARY if the hardware has validated the IP and TCP/UDP checksum Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> --- 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 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-02-18 1:35 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-18 1:34 [PATCH 1/3] mt76: mt7615: enable hw rx-amsdu de-aggregation Ryder Lee 2021-02-18 1:34 ` Ryder Lee 2021-02-18 1:34 ` Ryder Lee [this message] 2021-02-18 1:34 ` [PATCH 2/3] mt76: mt7615: add rx checksum offload support Ryder Lee 2021-02-18 1:34 ` [PATCH 3/3] mt76: mt7615: add support for rx decapsulation offload Ryder Lee 2021-02-18 1:34 ` Ryder Lee 2021-02-18 12:13 ` [PATCH 1/3] mt76: mt7615: enable hw rx-amsdu de-aggregation Lorenzo Bianconi 2021-02-18 12:13 ` Lorenzo Bianconi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5986dbd65f23d49aaf7656e0a4b4750985188f36.1613603857.git.ryder.lee@mediatek.com \ --to=ryder.lee@mediatek.com \ --cc=linux-mediatek@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ --cc=lorenzo.bianconi@redhat.com \ --cc=nbd@nbd.name \ --cc=shayne.chen@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.