fix: write radiotap HE fields without struct copy

This commit is contained in:
Shen Mintao
2026-06-25 19:38:40 +08:00
parent 0c9e2f1bca
commit 18d4be4228
+13 -5
View File
@@ -1310,7 +1310,7 @@ static void rwnx_rx_add_rtap_hdr(struct rwnx_hw* rwnx_hw,
// Check for HE frames // Check for HE frames
if (rxvect->format_mod == FORMATMOD_HE_SU) { if (rxvect->format_mod == FORMATMOD_HE_SU) {
struct ieee80211_radiotap_he he; struct ieee80211_radiotap_he he = {0};
#define HE_PREP(f, val) cpu_to_le16(FIELD_PREP(IEEE80211_RADIOTAP_HE_##f, val)) #define HE_PREP(f, val) cpu_to_le16(FIELD_PREP(IEEE80211_RADIOTAP_HE_##f, val))
#define D1_KNOWN(f) cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_##f##_KNOWN) #define D1_KNOWN(f) cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_##f##_KNOWN)
#define D2_KNOWN(f) cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_##f##_KNOWN) #define D2_KNOWN(f) cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_##f##_KNOWN)
@@ -1366,10 +1366,18 @@ static void rwnx_rx_add_rtap_hdr(struct rwnx_hw* rwnx_hw,
while ((pos - (u8 *)rtap) & 1) while ((pos - (u8 *)rtap) & 1)
pos++; pos++;
rtap->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_HE); rtap->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_HE);
//memcpy(pos, &he, sizeof(he)); put_unaligned_le16(le16_to_cpu(he.data1), pos);
//pos += sizeof(he); pos += 2;
*(struct ieee80211_radiotap_he *)pos = he; put_unaligned_le16(le16_to_cpu(he.data2), pos);
pos += sizeof(struct ieee80211_radiotap_he); pos += 2;
put_unaligned_le16(le16_to_cpu(he.data3), pos);
pos += 2;
put_unaligned_le16(le16_to_cpu(he.data4), pos);
pos += 2;
put_unaligned_le16(le16_to_cpu(he.data5), pos);
pos += 2;
put_unaligned_le16(le16_to_cpu(he.data6), pos);
pos += 2;
} }
// Rx Chains // Rx Chains