mac80211: rtl8xxxu: sync with linux-next 20240229
[openwrt/staging/mans0n.git] / package / kernel / mac80211 / patches / rtl / 001-08-v6.9-wifi-rtl8xxxu-don-t-parse-CFO-if-both-interfaces-are.patch
1 From f86dd8eaf8da84ee5b803d90b8c311d7e2725d0b Mon Sep 17 00:00:00 2001
2 From: Martin Kaistra <martin.kaistra@linutronix.de>
3 Date: Fri, 22 Dec 2023 11:14:29 +0100
4 Subject: [PATCH 08/21] wifi: rtl8xxxu: don't parse CFO, if both interfaces are
5 connected in STA mode
6
7 If both interfaces are in STATION mode and both are connected to an AP,
8 there might be conflicting CFO values for the two connections. Ignore
9 the CFO information in this case.
10
11 Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
12 Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
13 Signed-off-by: Kalle Valo <kvalo@kernel.org>
14 Link: https://msgid.link/20231222101442.626837-9-martin.kaistra@linutronix.de
15 ---
16 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 ++++++++++
17 1 file changed, 10 insertions(+)
18
19 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
20 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
21 @@ -5716,6 +5716,14 @@ static inline bool rtl8xxxu_is_packet_ma
22 ether_addr_equal(priv->vifs[port_num]->bss_conf.bssid, hdr->addr2);
23 }
24
25 +static inline bool rtl8xxxu_is_sta_sta(struct rtl8xxxu_priv *priv)
26 +{
27 + return (priv->vifs[0] && priv->vifs[0]->cfg.assoc &&
28 + priv->vifs[0]->type == NL80211_IFTYPE_STATION) &&
29 + (priv->vifs[1] && priv->vifs[1]->cfg.assoc &&
30 + priv->vifs[1]->type == NL80211_IFTYPE_STATION);
31 +}
32 +
33 void rtl8723au_rx_parse_phystats(struct rtl8xxxu_priv *priv,
34 struct ieee80211_rx_status *rx_status,
35 struct rtl8723au_phy_stats *phy_stats,
36 @@ -5734,6 +5742,7 @@ void rtl8723au_rx_parse_phystats(struct
37 bool parse_cfo = priv->fops->set_crystal_cap &&
38 !crc_icv_err &&
39 !ieee80211_is_ctl(hdr->frame_control) &&
40 + !rtl8xxxu_is_sta_sta(priv) &&
41 (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) ||
42 rtl8xxxu_is_packet_match_bssid(priv, hdr, 1));
43
44 @@ -5772,6 +5781,7 @@ static void jaguar2_rx_parse_phystats_ty
45 bool parse_cfo = priv->fops->set_crystal_cap &&
46 !crc_icv_err &&
47 !ieee80211_is_ctl(hdr->frame_control) &&
48 + !rtl8xxxu_is_sta_sta(priv) &&
49 (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) ||
50 rtl8xxxu_is_packet_match_bssid(priv, hdr, 1));
51 u8 pwdb_max = 0;