Skip to contentSkip to conversation

rtw89: support MULTI_BSSID and correct BSSID mask of H2C

PATCH In review Ping-Ke Shih 2 participants 2 messages May 30, 2022 – Jun 8, 2022 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH v2 1/1 rtw89: support MULTI_BSSID and correct BSSID mask of H2C

The BSSID mask of H2C is used to match BSSID of receiving packets. Normally, we set six bits BSSID mask to exactly match BSSID of packets sent by target AP. After we support multiple BSSID, it could connect a nontransmitted BSSID, so we can only match first five bytes of BSSID. That means we could possibly receive other AP's packets if only the last byte of BSSID is different from target AP.

---
v2: add RTW89_ prefix to name of #define, and move to proper place.

---
 drivers/net/wireless/realtek/rtw89/cam.c  | 7 +++++++
 drivers/net/wireless/realtek/rtw89/cam.h  | 8 ++++++++
 drivers/net/wireless/realtek/rtw89/core.c | 1 +
 3 files changed, 16 insertions(+)
drivers/net/wireless/realtek/rtw89/cam.c +7 -0
index 8a26adeb23fb2..db3c55f0ccd0d 100644
@@ -602,11 +602,18 @@ int rtw89_cam_fill_bssid_cam_info(struct rtw89_dev *rtwdev,
 	struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
 	struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam;
 	u8 bss_color = vif->bss_conf.he_bss_color.color;
+	u8 bss_mask;
+
+	if (vif->bss_conf.nontransmitted)
+		bss_mask = RTW89_BSSID_MATCH_5_BYTES;
+	else
+		bss_mask = RTW89_BSSID_MATCH_ALL;
 
 	FWCMD_SET_ADDR_BSSID_IDX(cmd, bssid_cam->bssid_cam_idx);
 	FWCMD_SET_ADDR_BSSID_OFFSET(cmd, bssid_cam->offset);
 	FWCMD_SET_ADDR_BSSID_LEN(cmd, bssid_cam->len);
 	FWCMD_SET_ADDR_BSSID_VALID(cmd, bssid_cam->valid);
+	FWCMD_SET_ADDR_BSSID_MASK(cmd, bss_mask);
 	FWCMD_SET_ADDR_BSSID_BB_SEL(cmd, bssid_cam->phy_idx);
 	FWCMD_SET_ADDR_BSSID_BSS_COLOR(cmd, bss_color);
 
drivers/net/wireless/realtek/rtw89/cam.h +8 -0
index a3931d3e40d26..74a6c4748d64f 100644
@@ -9,6 +9,9 @@
 
 #define RTW89_SEC_CAM_LEN	20
 
+#define RTW89_BSSID_MATCH_ALL GENMASK(5, 0)
+#define RTW89_BSSID_MATCH_5_BYTES GENMASK(4, 0)
+
 static inline void FWCMD_SET_ADDR_IDX(void *cmd, u32 value)
 {
 	le32p_replace_bits((__le32 *)(cmd) + 1, value, GENMASK(7, 0));
@@ -309,6 +312,11 @@ static inline void FWCMD_SET_ADDR_BSSID_BB_SEL(void *cmd, u32 value)
 	le32p_replace_bits((__le32 *)(cmd) + 13, value, BIT(1));
 }
 
+static inline void FWCMD_SET_ADDR_BSSID_MASK(void *cmd, u32 value)
+{
+	le32p_replace_bits((__le32 *)(cmd) + 13, value, GENMASK(7, 2));
+}
+
 static inline void FWCMD_SET_ADDR_BSSID_BSS_COLOR(void *cmd, u32 value)
 {
 	le32p_replace_bits((__le32 *)(cmd) + 13, value, GENMASK(13, 8));
drivers/net/wireless/realtek/rtw89/core.c +1 -0
index 958fe2787c6a1..4df81f00c2211 100644
@@ -3011,6 +3011,7 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
 	ieee80211_hw_set(hw, SUPPORTS_PS);
 	ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
 	ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
+	ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
 
 	hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
 				     BIT(NL80211_IFTYPE_AP);
Signature · 1 line
2.25.1
#1 lore raw

Re: [v2] wifi: rtw89: support MULTI_BSSID and correct BSSID mask of H2C

Quoted 8 lines · Ping-Ke Shih

The BSSID mask of H2C is used to match BSSID of receiving packets. Normally, we set six bits BSSID mask to exactly match BSSID of packets sent by target AP. After we support multiple BSSID, it could connect a nontransmitted BSSID, so we can only match first five bytes of BSSID. That means we could possibly receive other AP's packets if only the last byte of BSSID is different from target AP.

Patch applied to wireless-next.git, thanks.

85393ca610de wifi: rtw89: support MULTI_BSSID and correct BSSID mask of H2C

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches