]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw89: Add header conversion for MLO connections
authorPo-Hao Huang <phhuang@realtek.com>
Tue, 22 Oct 2024 08:31:02 +0000 (16:31 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 29 Oct 2024 03:23:35 +0000 (11:23 +0800)
For MLO connections, this setting replaces 802.11 header addresses
to according link addresses based on each packet's destination.
The fields most likely to be replaced would be both A1 and A2.
For legacy connections, it's the same with or without the conversion.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241022083106.149252-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h

index ca639794f40fcc9394076e376c352c890e2c7fd9..2ec7a2b8e44939675fe6b6f681509a49f71a32f3 100644 (file)
@@ -939,8 +939,10 @@ rtw89_core_tx_update_desc_info(struct rtw89_dev *rtwdev,
        struct sk_buff *skb = tx_req->skb;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        struct ieee80211_hdr *hdr = (void *)skb->data;
+       struct rtw89_addr_cam_entry *addr_cam;
        enum rtw89_core_tx_type tx_type;
        enum btc_pkt_type pkt_type;
+       bool upd_wlan_hdr = false;
        bool is_bmc;
        u16 seq;
 
@@ -948,6 +950,11 @@ rtw89_core_tx_update_desc_info(struct rtw89_dev *rtwdev,
        if (tx_req->tx_type != RTW89_CORE_TX_TYPE_FWCMD) {
                tx_type = rtw89_core_get_tx_type(rtwdev, skb);
                tx_req->tx_type = tx_type;
+
+               addr_cam = rtw89_get_addr_cam_of(tx_req->rtwvif_link,
+                                                tx_req->rtwsta_link);
+               if (addr_cam->valid)
+                       upd_wlan_hdr = true;
        }
        is_bmc = (is_broadcast_ether_addr(hdr->addr1) ||
                  is_multicast_ether_addr(hdr->addr1));
@@ -957,6 +964,7 @@ rtw89_core_tx_update_desc_info(struct rtw89_dev *rtwdev,
        desc_info->is_bmc = is_bmc;
        desc_info->wd_page = true;
        desc_info->hiq = info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM;
+       desc_info->upd_wlan_hdr = upd_wlan_hdr;
 
        switch (tx_req->tx_type) {
        case RTW89_CORE_TX_TYPE_MGMT:
@@ -1355,6 +1363,13 @@ static __le32 rtw89_build_txwd_body5_v2(struct rtw89_tx_desc_info *desc_info)
        return cpu_to_le32(dword);
 }
 
+static __le32 rtw89_build_txwd_body6_v2(struct rtw89_tx_desc_info *desc_info)
+{
+       u32 dword = FIELD_PREP(BE_TXD_BODY6_UPD_WLAN_HDR, desc_info->upd_wlan_hdr);
+
+       return cpu_to_le32(dword);
+}
+
 static __le32 rtw89_build_txwd_body7_v2(struct rtw89_tx_desc_info *desc_info)
 {
        u32 dword = FIELD_PREP(BE_TXD_BODY7_USERATE_SEL, desc_info->use_rate) |
@@ -1418,6 +1433,7 @@ void rtw89_core_fill_txdesc_v2(struct rtw89_dev *rtwdev,
                txwd_body->dword4 = rtw89_build_txwd_body4_v2(desc_info);
                txwd_body->dword5 = rtw89_build_txwd_body5_v2(desc_info);
        }
+       txwd_body->dword6 = rtw89_build_txwd_body6_v2(desc_info);
        txwd_body->dword7 = rtw89_build_txwd_body7_v2(desc_info);
 
        if (!desc_info->en_wd_info)
index fed743e650d1e77d04d48340ef84fbc22dcf31ba..373ad468918b97bb31218a9c5587b949813a3541 100644 (file)
@@ -1162,6 +1162,7 @@ struct rtw89_tx_desc_info {
        bool er_cap;
        bool stbc;
        bool ldpc;
+       bool upd_wlan_hdr;
 };
 
 struct rtw89_core_tx_request {