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
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.
11 For better code readability put the lines with priv->vifs[port_num] in a
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
19 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 ++++++++++++-------
20 1 file changed, 14 insertions(+), 8 deletions(-)
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);
28 +static inline bool rtl8xxxu_is_packet_match_bssid(struct rtl8xxxu_priv *priv,
29 + struct ieee80211_hdr *hdr,
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);
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);
44 bool parse_cfo = priv->fops->set_crystal_cap &&
46 - priv->vif->type == NL80211_IFTYPE_STATION &&
47 - priv->vif->cfg.assoc &&
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));
55 priv->cfo_tracking.cfo_tail[0] = phy_stats->path_cfotail[0];
56 @@ -5762,12 +5770,10 @@ static void jaguar2_rx_parse_phystats_ty
59 bool parse_cfo = priv->fops->set_crystal_cap &&
61 - priv->vif->type == NL80211_IFTYPE_STATION &&
62 - priv->vif->cfg.assoc &&
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));