Commit 39913cc8 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo
Browse files

wifi: rtw89: allocate BSSID CAM per TDLS peer



In STA mode, if peer is TDLS. Allocate a BSSID CAM entry with peer's
address to match address properly, and then hardware can ACK peer's
packets and receive packets to driver.

Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-4-pkshih@realtek.com
parent 445b6bc3
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -605,10 +605,11 @@ int rtw89_cam_init(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
}

int rtw89_cam_fill_bssid_cam_info(struct rtw89_dev *rtwdev,
				  struct rtw89_vif *rtwvif, u8 *cmd)
				  struct rtw89_vif *rtwvif,
				  struct rtw89_sta *rtwsta, u8 *cmd)
{
	struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
	struct rtw89_bssid_cam_entry *bssid_cam = &rtwvif->bssid_cam;
	struct rtw89_bssid_cam_entry *bssid_cam = rtw89_get_bssid_cam_of(rtwvif, rtwsta);
	u8 bss_color = vif->bss_conf.he_bss_color.color;
	u8 bss_mask;

+2 −1
Original line number Diff line number Diff line
@@ -374,7 +374,8 @@ void rtw89_cam_fill_dctl_sec_cam_info_v1(struct rtw89_dev *rtwdev,
					 struct rtw89_sta *rtwsta,
					 u8 *cmd);
int rtw89_cam_fill_bssid_cam_info(struct rtw89_dev *rtwdev,
				  struct rtw89_vif *vif, u8 *cmd);
				  struct rtw89_vif *rtwvif,
				  struct rtw89_sta *rtwsta, u8 *cmd);
int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
			  struct ieee80211_vif *vif,
			  struct ieee80211_sta *sta,
+12 −1
Original line number Diff line number Diff line
@@ -2325,6 +2325,8 @@ int rtw89_core_sta_disconnect(struct rtw89_dev *rtwdev,
	rtw89_core_free_sta_pending_ba(rtwdev, sta);
	if (vif->type == NL80211_IFTYPE_AP || sta->tdls)
		rtw89_cam_deinit_addr_cam(rtwdev, &rtwsta->addr_cam);
	if (sta->tdls)
		rtw89_cam_deinit_bssid_cam(rtwdev, &rtwsta->bssid_cam);

	if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
		rtw89_vif_type_mapping(vif, false);
@@ -2365,6 +2367,7 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev,
{
	struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
	struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv;
	struct rtw89_bssid_cam_entry *bssid_cam = rtw89_get_bssid_cam_of(rtwvif, rtwsta);
	int ret;

	if (vif->type == NL80211_IFTYPE_AP || sta->tdls) {
@@ -2380,7 +2383,15 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev,
			return ret;
		}

		ret = rtw89_cam_init_addr_cam(rtwdev, &rtwsta->addr_cam, &rtwvif->bssid_cam);
		if (sta->tdls) {
			ret = rtw89_cam_init_bssid_cam(rtwdev, rtwvif, bssid_cam, sta->addr);
			if (ret) {
				rtw89_warn(rtwdev, "failed to send h2c init bssid cam for TDLS\n");
				return ret;
			}
		}

		ret = rtw89_cam_init_addr_cam(rtwdev, &rtwsta->addr_cam, bssid_cam);
		if (ret) {
			rtw89_warn(rtwdev, "failed to send h2c init addr cam\n");
			return ret;
+14 −0
Original line number Diff line number Diff line
@@ -1976,6 +1976,7 @@ struct rtw89_sta {
	u16 rx_hw_rate;
	__le32 htc_template;
	struct rtw89_addr_cam_entry addr_cam; /* AP mode or TDLS peer only */
	struct rtw89_bssid_cam_entry bssid_cam; /* TDLS peer only */

	bool use_cfg_mask;
	struct cfg80211_bitrate_mask mask;
@@ -3567,6 +3568,19 @@ struct rtw89_addr_cam_entry *rtw89_get_addr_cam_of(struct rtw89_vif *rtwvif,
	return &rtwvif->addr_cam;
}

static inline
struct rtw89_bssid_cam_entry *rtw89_get_bssid_cam_of(struct rtw89_vif *rtwvif,
						     struct rtw89_sta *rtwsta)
{
	if (rtwsta) {
		struct ieee80211_sta *sta = rtwsta_to_sta(rtwsta);

		if (sta->tdls)
			return &rtwsta->bssid_cam;
	}
	return &rtwvif->bssid_cam;
}

static inline
void rtw89_chip_set_channel_prepare(struct rtw89_dev *rtwdev,
				    struct rtw89_channel_help_params *p)
+2 −1
Original line number Diff line number Diff line
@@ -2438,7 +2438,8 @@ static void rtw89_sta_ids_get_iter(void *data, struct ieee80211_sta *sta)
	struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv;
	struct seq_file *m = (struct seq_file *)data;

	seq_printf(m, "STA [%d] %pM\n", rtwsta->mac_id, sta->addr);
	seq_printf(m, "STA [%d] %pM %s\n", rtwsta->mac_id, sta->addr,
		   sta->tdls ? "(TDLS)" : "");
	rtw89_dump_addr_cam(m, &rtwsta->addr_cam);
}

Loading