001-07-v6.9-wifi-rtl8xxxu-extend-check-for-matching-bssid-to-bot.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 80fd8687db41b1e04f78c37137d090f2165cca6e Mon Sep 17 00:00:00 2001
  2. From: Martin Kaistra <[email protected]>
  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. The driver will support two interfaces soon, which both can be in
  7. station mode, so extend the check, whether cfo information should be
  8. parsed, to cover both interfaces.
  9. For better code readability put the lines with priv->vifs[port_num] in a
  10. separate function.
  11. Signed-off-by: Martin Kaistra <[email protected]>
  12. Reviewed-by: Ping-Ke Shih <[email protected]>
  13. Signed-off-by: Kalle Valo <[email protected]>
  14. Link: https://msgid.link/[email protected]
  15. ---
  16. .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 ++++++++++++-------
  17. 1 file changed, 14 insertions(+), 8 deletions(-)
  18. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
  19. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
  20. @@ -5706,6 +5706,16 @@ static void rtl8xxxu_update_beacon_work_
  21. rtl8xxxu_send_beacon_frame(hw, vif);
  22. }
  23. +static inline bool rtl8xxxu_is_packet_match_bssid(struct rtl8xxxu_priv *priv,
  24. + struct ieee80211_hdr *hdr,
  25. + int port_num)
  26. +{
  27. + return priv->vifs[port_num] &&
  28. + priv->vifs[port_num]->type == NL80211_IFTYPE_STATION &&
  29. + priv->vifs[port_num]->cfg.assoc &&
  30. + ether_addr_equal(priv->vifs[port_num]->bss_conf.bssid, hdr->addr2);
  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. @@ -5722,12 +5732,10 @@ void rtl8723au_rx_parse_phystats(struct
  37. rx_status->signal = priv->fops->cck_rssi(priv, phy_stats);
  38. } else {
  39. bool parse_cfo = priv->fops->set_crystal_cap &&
  40. - priv->vif &&
  41. - priv->vif->type == NL80211_IFTYPE_STATION &&
  42. - priv->vif->cfg.assoc &&
  43. !crc_icv_err &&
  44. !ieee80211_is_ctl(hdr->frame_control) &&
  45. - ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2);
  46. + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) ||
  47. + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1));
  48. if (parse_cfo) {
  49. priv->cfo_tracking.cfo_tail[0] = phy_stats->path_cfotail[0];
  50. @@ -5762,12 +5770,10 @@ static void jaguar2_rx_parse_phystats_ty
  51. bool crc_icv_err)
  52. {
  53. bool parse_cfo = priv->fops->set_crystal_cap &&
  54. - priv->vif &&
  55. - priv->vif->type == NL80211_IFTYPE_STATION &&
  56. - priv->vif->cfg.assoc &&
  57. !crc_icv_err &&
  58. !ieee80211_is_ctl(hdr->frame_control) &&
  59. - ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2);
  60. + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) ||
  61. + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1));
  62. u8 pwdb_max = 0;
  63. int rx_path;