mac80211: rtl8xxxu: sync with linux-next 20240229
[openwrt/staging/mans0n.git] / package / kernel / mac80211 / patches / rtl / 001-07-v6.9-wifi-rtl8xxxu-extend-check-for-matching-bssid-to-bot.patch
1 From 80fd8687db41b1e04f78c37137d090f2165cca6e Mon Sep 17 00:00:00 2001
2 From: Martin Kaistra <martin.kaistra@linutronix.de>
3 Date: Fri, 22 Dec 2023 11:14:28 +0100
4 Subject: [PATCH 07/21] wifi: rtl8xxxu: extend check for matching bssid to both
5 interfaces
6
7 The driver will support two interfaces soon, which both can be in
8 station mode, so extend the check, whether cfo information should be
9 parsed, to cover both interfaces.
10
11 For better code readability put the lines with priv->vifs[port_num] in a
12 separate function.
13
14 Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
15 Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
16 Signed-off-by: Kalle Valo <kvalo@kernel.org>
17 Link: https://msgid.link/20231222101442.626837-8-martin.kaistra@linutronix.de
18 ---
19 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 ++++++++++++-------
20 1 file changed, 14 insertions(+), 8 deletions(-)
21
22 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
23 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
24 @@ -5706,6 +5706,16 @@ static void rtl8xxxu_update_beacon_work_
25 rtl8xxxu_send_beacon_frame(hw, vif);
26 }
27
28 +static inline bool rtl8xxxu_is_packet_match_bssid(struct rtl8xxxu_priv *priv,
29 + struct ieee80211_hdr *hdr,
30 + int port_num)
31 +{
32 + return priv->vifs[port_num] &&
33 + priv->vifs[port_num]->type == NL80211_IFTYPE_STATION &&
34 + priv->vifs[port_num]->cfg.assoc &&
35 + ether_addr_equal(priv->vifs[port_num]->bss_conf.bssid, hdr->addr2);
36 +}
37 +
38 void rtl8723au_rx_parse_phystats(struct rtl8xxxu_priv *priv,
39 struct ieee80211_rx_status *rx_status,
40 struct rtl8723au_phy_stats *phy_stats,
41 @@ -5722,12 +5732,10 @@ void rtl8723au_rx_parse_phystats(struct
42 rx_status->signal = priv->fops->cck_rssi(priv, phy_stats);
43 } else {
44 bool parse_cfo = priv->fops->set_crystal_cap &&
45 - priv->vif &&
46 - priv->vif->type == NL80211_IFTYPE_STATION &&
47 - priv->vif->cfg.assoc &&
48 !crc_icv_err &&
49 !ieee80211_is_ctl(hdr->frame_control) &&
50 - ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2);
51 + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) ||
52 + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1));
53
54 if (parse_cfo) {
55 priv->cfo_tracking.cfo_tail[0] = phy_stats->path_cfotail[0];
56 @@ -5762,12 +5770,10 @@ static void jaguar2_rx_parse_phystats_ty
57 bool crc_icv_err)
58 {
59 bool parse_cfo = priv->fops->set_crystal_cap &&
60 - priv->vif &&
61 - priv->vif->type == NL80211_IFTYPE_STATION &&
62 - priv->vif->cfg.assoc &&
63 !crc_icv_err &&
64 !ieee80211_is_ctl(hdr->frame_control) &&
65 - ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2);
66 + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) ||
67 + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1));
68 u8 pwdb_max = 0;
69 int rx_path;
70