Commit 2122dfbf authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

mt76: mt7615: add rx checksum offload support

Set skb->ip_summed to CHECKSUM_UNNECESSARY if the hardware has validated
the IP and TCP/UDP checksum
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent e78d73e0
...@@ -329,6 +329,7 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) ...@@ -329,6 +329,7 @@ mt7615_init_wiphy(struct ieee80211_hw *hw)
hw->max_rates = 3; hw->max_rates = 3;
hw->max_report_rates = 7; hw->max_report_rates = 7;
hw->max_rate_tries = 11; hw->max_rate_tries = 11;
hw->netdev_features = NETIF_F_RXCSUM;
phy->slottime = 9; phy->slottime = 9;
......
...@@ -234,6 +234,7 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) ...@@ -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 rxd0 = le32_to_cpu(rxd[0]);
u32 rxd1 = le32_to_cpu(rxd[1]); u32 rxd1 = le32_to_cpu(rxd[1]);
u32 rxd2 = le32_to_cpu(rxd[2]); 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]; __le32 rxd12 = rxd[12];
bool unicast, remove_pad, insert_ccmp_hdr = false; bool unicast, remove_pad, insert_ccmp_hdr = false;
int phy_idx; int phy_idx;
...@@ -271,6 +272,9 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) ...@@ -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); 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) if (rxd2 & MT_RXD2_NORMAL_FCS_ERR)
status->flag |= RX_FLAG_FAILED_FCS_CRC; status->flag |= RX_FLAG_FAILED_FCS_CRC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment