mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: add tx checksum offload for mt7915 and mt7921
Supports IPv4 and IPv6 TCP + UDP Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -337,6 +337,9 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
|
||||
wmm = sta->wme;
|
||||
}
|
||||
|
||||
val = FIELD_PREP(MT_TXD0_ETH_TYPE_OFFSET, 10);
|
||||
txwi[0] |= cpu_to_le32(val);
|
||||
|
||||
val = FIELD_PREP(MT_TXD1_HDR_FORMAT, MT_HDR_FORMAT_802_3) |
|
||||
FIELD_PREP(MT_TXD1_TID, tid);
|
||||
|
||||
@@ -356,6 +359,8 @@ mt76_connac2_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
|
||||
|
||||
val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
|
||||
FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL)
|
||||
val |= MT_TXD7_IP_SUM | MT_TXD7_UDP_TCP_SUM;
|
||||
|
||||
txwi[7] |= cpu_to_le32(val);
|
||||
}
|
||||
|
||||
+3
-1
@@ -329,7 +329,9 @@ mt7915_init_wiphy(struct ieee80211_hw *hw)
|
||||
hw->queues = 4;
|
||||
hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
|
||||
hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
|
||||
hw->netdev_features = NETIF_F_RXCSUM | NETIF_F_SG;
|
||||
hw->netdev_features = NETIF_F_RXCSUM | NETIF_F_SG |
|
||||
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
|
||||
NETIF_F_GSO_SOFTWARE;
|
||||
|
||||
hw->radiotap_timestamp.units_pos =
|
||||
IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
|
||||
|
||||
+5
-1
@@ -248,9 +248,13 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
|
||||
mtxq->wcid = idx;
|
||||
}
|
||||
|
||||
vif->netdev_features &= ~NETIF_F_GSO_SOFTWARE;
|
||||
if (vif->type != NL80211_IFTYPE_AP &&
|
||||
(!mvif->mt76.omac_idx || mvif->mt76.omac_idx > 3))
|
||||
(!mvif->mt76.omac_idx || mvif->mt76.omac_idx > 3)) {
|
||||
vif->offload_flags = 0;
|
||||
vif->netdev_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
|
||||
}
|
||||
|
||||
vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR;
|
||||
|
||||
mt7915_init_bitrate_mask(vif);
|
||||
|
||||
+3
-1
@@ -55,7 +55,9 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
|
||||
hw->queues = 4;
|
||||
hw->max_rx_aggregation_subframes = 256;
|
||||
hw->max_tx_aggregation_subframes = 256;
|
||||
hw->netdev_features = NETIF_F_RXCSUM;
|
||||
hw->netdev_features = NETIF_F_RXCSUM |
|
||||
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
|
||||
NETIF_F_GSO_SOFTWARE;
|
||||
if (mt76_is_mmio(&dev->mt76))
|
||||
hw->netdev_features |= NETIF_F_SG;
|
||||
|
||||
|
||||
@@ -352,6 +352,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
|
||||
}
|
||||
|
||||
vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
|
||||
vif->netdev_features &= ~NETIF_F_GSO_SOFTWARE;
|
||||
out:
|
||||
mt7921_mutex_release(dev);
|
||||
|
||||
|
||||
@@ -312,16 +312,18 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
|
||||
struct mt76_queue *q;
|
||||
int qid = skb_get_queue_mapping(skb);
|
||||
|
||||
if (mt76_testmode_enabled(phy)) {
|
||||
ieee80211_free_txskb(phy->hw, skb);
|
||||
return;
|
||||
}
|
||||
if (mt76_testmode_enabled(phy))
|
||||
goto free;
|
||||
|
||||
if (WARN_ON(qid >= MT_TXQ_PSD)) {
|
||||
qid = MT_TXQ_BE;
|
||||
skb_set_queue_mapping(skb, qid);
|
||||
}
|
||||
|
||||
if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) &&
|
||||
skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
|
||||
goto free;
|
||||
|
||||
if ((dev->drv->drv_flags & MT_DRV_HW_MGMT_TXQ) &&
|
||||
!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) &&
|
||||
!ieee80211_is_data(hdr->frame_control) &&
|
||||
@@ -340,6 +342,10 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
|
||||
__mt76_tx_queue_skb(phy, qid, skb, wcid, sta, NULL);
|
||||
dev->queue_ops->kick(dev, q);
|
||||
spin_unlock_bh(&q->lock);
|
||||
return;
|
||||
|
||||
free:
|
||||
ieee80211_free_txskb(phy->hw, skb);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_tx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user