diff mbox series

[1/2] rtw89: update scan_mac_addr during scanning period

Message ID 20211111023706.14154-2-pkshih@realtek.com (mailing list archive)
State Accepted
Commit e45a9e6265d2591efb745c9ffa46f4e9cceb5c65
Delegated to: Kalle Valo
Headers show
Series rtw89: correct scan behavior and results | expand

Commit Message

Ping-Ke Shih Nov. 11, 2021, 2:37 a.m. UTC
Update scan_mac_addr to address CAM as A1, so hardware can ACK probe
response properly.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/cam.c      | 22 ++++++++++---------
 drivers/net/wireless/realtek/rtw89/cam.h      |  3 ++-
 drivers/net/wireless/realtek/rtw89/core.c     |  4 ++--
 drivers/net/wireless/realtek/rtw89/fw.c       |  5 +++--
 drivers/net/wireless/realtek/rtw89/fw.h       |  3 ++-
 drivers/net/wireless/realtek/rtw89/mac.c      |  4 ++--
 drivers/net/wireless/realtek/rtw89/mac80211.c |  6 ++++-
 7 files changed, 28 insertions(+), 19 deletions(-)

Comments

Kalle Valo Nov. 26, 2021, 4:12 p.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> Update scan_mac_addr to address CAM as A1, so hardware can ACK probe
> response properly.
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

Failed to apply to wireless-drivers-next, please respin.

error: sha1 information is lacking or useless (drivers/net/wireless/realtek/rtw89/txrx.h).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: rtw89: fix incorrect channel info during scan
Patch failed at 0001 rtw89: fix incorrect channel info during scan

2 patches set to Changes Requested.

12613957 [1/2] rtw89: update scan_mac_addr during scanning period
12613959 [2/2] rtw89: fix incorrect channel info during scan
Ping-Ke Shih Nov. 27, 2021, 12:58 a.m. UTC | #2
On Fri, 2021-11-26 at 16:12 +0000, Kalle Valo wrote:
> Ping-Ke Shih <pkshih@realtek.com> wrote:
> 
> > Update scan_mac_addr to address CAM as A1, so hardware can ACK probe
> > response properly.
> > 
> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> 
> Failed to apply to wireless-drivers-next, please respin.
> 
> error: sha1 information is lacking or useless (drivers/net/wireless/realtek/rtw89/txrx.h).
> error: could not build fake ancestor
> hint: Use 'git am --show-current-patch' to see the failed patch
> Applying: rtw89: fix incorrect channel info during scan
> Patch failed at 0001 rtw89: fix incorrect channel info during scan
> 
> 2 patches set to Changes Requested.
> 
> 12613957 [1/2] rtw89: update scan_mac_addr during scanning period
> 12613959 [2/2] rtw89: fix incorrect channel info during scan
> 

This patchset is based on the the 2 patches of another patchset
whose status is Awaiting Upstream:

12628209 [v3,2/3] rtw89: add const in the cast of le32_get_bits()
12628211 [v3,3/3] rtw89: use inline function instead macro to set H2C and CAM

If I do rebase on this patchset and get merged, the awaiting patchset
could be conflict. Should I wait the awaiting patchset get merged?

Please guide me the way to deal with this.
Sorry for the inconvenience.

--
Ping-Ke
Kalle Valo Nov. 29, 2021, 9:11 a.m. UTC | #3
Pkshih <pkshih@realtek.com> writes:

> On Fri, 2021-11-26 at 16:12 +0000, Kalle Valo wrote:
>> Ping-Ke Shih <pkshih@realtek.com> wrote:
>> 
>> > Update scan_mac_addr to address CAM as A1, so hardware can ACK probe
>> > response properly.
>> > 
>> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>> 
>> Failed to apply to wireless-drivers-next, please respin.
>> 
>> error: sha1 information is lacking or useless
>> (drivers/net/wireless/realtek/rtw89/txrx.h).
>> error: could not build fake ancestor
>> hint: Use 'git am --show-current-patch' to see the failed patch
>> Applying: rtw89: fix incorrect channel info during scan
>> Patch failed at 0001 rtw89: fix incorrect channel info during scan
>> 
>> 2 patches set to Changes Requested.
>> 
>> 12613957 [1/2] rtw89: update scan_mac_addr during scanning period
>> 12613959 [2/2] rtw89: fix incorrect channel info during scan
>> 
>
> This patchset is based on the the 2 patches of another patchset
> whose status is Awaiting Upstream:
>
> 12628209 [v3,2/3] rtw89: add const in the cast of le32_get_bits()
> 12628211 [v3,3/3] rtw89: use inline function instead macro to set H2C and CAM
>
> If I do rebase on this patchset and get merged, the awaiting patchset
> could be conflict. Should I wait the awaiting patchset get merged?
>
> Please guide me the way to deal with this.

I think the easiest is that I also mark these patches as Awaiting
Upstream and apply the patches after the dependencies have been applied.

> Sorry for the inconvenience.

No problem, this is business as usual. But this is exactly why I keep
the bar high in patches going to wireless-drivers and only take
important fixes, the conflicts between w-d and w-d-next just cause too
much of a hassle.
Kalle Valo Dec. 8, 2021, 6:27 p.m. UTC | #4
Ping-Ke Shih <pkshih@realtek.com> wrote:

> Update scan_mac_addr to address CAM as A1, so hardware can ACK probe
> response properly.
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

2 patches applied to wireless-drivers-next.git, thanks.

e45a9e6265d2 rtw89: update scan_mac_addr during scanning period
eb4e52b3f38d rtw89: fix incorrect channel info during scan
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/cam.c b/drivers/net/wireless/realtek/rtw89/cam.c
index ad7a8155dbed3..ce5056ad1e5c8 100644
--- a/drivers/net/wireless/realtek/rtw89/cam.c
+++ b/drivers/net/wireless/realtek/rtw89/cam.c
@@ -243,7 +243,7 @@  static int rtw89_cam_attach_sec_cam(struct rtw89_dev *rtwdev,
 	addr_cam->sec_ent[key_idx] = sec_cam->sec_cam_idx;
 	addr_cam->sec_entries[key_idx] = sec_cam;
 	set_bit(key_idx, addr_cam->sec_cam_map);
-	ret = rtw89_fw_h2c_cam(rtwdev, rtwvif);
+	ret = rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 	if (ret) {
 		rtw89_err(rtwdev, "failed to update addr cam sec entry: %d\n",
 			  ret);
@@ -394,7 +394,7 @@  int rtw89_cam_sec_key_del(struct rtw89_dev *rtwdev,
 	clear_bit(key_idx, addr_cam->sec_cam_map);
 	addr_cam->sec_entries[key_idx] = NULL;
 	if (inform_fw) {
-		ret = rtw89_fw_h2c_cam(rtwdev, rtwvif);
+		ret = rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 		if (ret)
 			rtw89_err(rtwdev, "failed to update cam del key: %d\n", ret);
 	}
@@ -593,7 +593,7 @@  int rtw89_cam_fill_bssid_cam_info(struct rtw89_dev *rtwdev,
 	return 0;
 }
 
-static u8 rtw89_cam_addr_hash(u8 start, u8 *addr)
+static u8 rtw89_cam_addr_hash(u8 start, const u8 *addr)
 {
 	u8 hash = 0;
 	u8 i;
@@ -606,12 +606,14 @@  static u8 rtw89_cam_addr_hash(u8 start, u8 *addr)
 
 void rtw89_cam_fill_addr_cam_info(struct rtw89_dev *rtwdev,
 				  struct rtw89_vif *rtwvif,
+				  const u8 *scan_mac_addr,
 				  u8 *cmd)
 {
 	struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
 	struct ieee80211_sta *sta;
 	struct rtw89_sta *rtwsta;
 	struct rtw89_addr_cam_entry *addr_cam = &rtwvif->addr_cam;
+	const u8 *sma = scan_mac_addr ? scan_mac_addr : rtwvif->mac_addr;
 	u8 sma_hash, tma_hash, addr_msk_start;
 	u8 sma_start = 0;
 	u8 tma_start = 0;
@@ -623,7 +625,7 @@  void rtw89_cam_fill_addr_cam_info(struct rtw89_dev *rtwdev,
 		else if (addr_cam->mask_sel == RTW89_TMA)
 			tma_start = addr_msk_start;
 	}
-	sma_hash = rtw89_cam_addr_hash(sma_start, rtwvif->mac_addr);
+	sma_hash = rtw89_cam_addr_hash(sma_start, sma);
 	tma_hash = rtw89_cam_addr_hash(tma_start, addr_cam->tma);
 
 	FWCMD_SET_ADDR_IDX(cmd, addr_cam->addr_cam_idx);
@@ -642,12 +644,12 @@  void rtw89_cam_fill_addr_cam_info(struct rtw89_dev *rtwdev,
 
 	FWCMD_SET_ADDR_BSSID_CAM_IDX(cmd, addr_cam->bssid_cam_idx);
 
-	FWCMD_SET_ADDR_SMA0(cmd, rtwvif->mac_addr[0]);
-	FWCMD_SET_ADDR_SMA1(cmd, rtwvif->mac_addr[1]);
-	FWCMD_SET_ADDR_SMA2(cmd, rtwvif->mac_addr[2]);
-	FWCMD_SET_ADDR_SMA3(cmd, rtwvif->mac_addr[3]);
-	FWCMD_SET_ADDR_SMA4(cmd, rtwvif->mac_addr[4]);
-	FWCMD_SET_ADDR_SMA5(cmd, rtwvif->mac_addr[5]);
+	FWCMD_SET_ADDR_SMA0(cmd, sma[0]);
+	FWCMD_SET_ADDR_SMA1(cmd, sma[1]);
+	FWCMD_SET_ADDR_SMA2(cmd, sma[2]);
+	FWCMD_SET_ADDR_SMA3(cmd, sma[3]);
+	FWCMD_SET_ADDR_SMA4(cmd, sma[4]);
+	FWCMD_SET_ADDR_SMA5(cmd, sma[5]);
 
 	FWCMD_SET_ADDR_TMA0(cmd, addr_cam->tma[0]);
 	FWCMD_SET_ADDR_TMA1(cmd, addr_cam->tma[1]);
diff --git a/drivers/net/wireless/realtek/rtw89/cam.h b/drivers/net/wireless/realtek/rtw89/cam.h
index 41d7d27120276..c0f9ef12f530a 100644
--- a/drivers/net/wireless/realtek/rtw89/cam.h
+++ b/drivers/net/wireless/realtek/rtw89/cam.h
@@ -347,7 +347,8 @@  static inline void FWCMD_SET_ADDR_BSSID_BSSID5(void *cmd, u32 value)
 int rtw89_cam_init(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
 void rtw89_cam_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
 void rtw89_cam_fill_addr_cam_info(struct rtw89_dev *rtwdev,
-				  struct rtw89_vif *vif, u8 *cmd);
+				  struct rtw89_vif *vif,
+				  const u8 *scan_mac_addr, u8 *cmd);
 int rtw89_cam_fill_bssid_cam_info(struct rtw89_dev *rtwdev,
 				  struct rtw89_vif *vif, u8 *cmd);
 int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index d02ec5a735cb1..6c91e99fd28f1 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -1872,7 +1872,7 @@  int rtw89_core_sta_disconnect(struct rtw89_dev *rtwdev,
 	}
 
 	/* update cam aid mac_id net_type */
-	rtw89_fw_h2c_cam(rtwdev, rtwvif);
+	rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 	if (ret) {
 		rtw89_warn(rtwdev, "failed to send h2c cam\n");
 		return ret;
@@ -1908,7 +1908,7 @@  int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev,
 	}
 
 	/* update cam aid mac_id net_type */
-	rtw89_fw_h2c_cam(rtwdev, rtwvif);
+	rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 	if (ret) {
 		rtw89_warn(rtwdev, "failed to send h2c cam\n");
 		return ret;
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 65ef3dc9d0614..c9aa86e5d4e4b 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -523,7 +523,8 @@  void rtw89_unload_firmware(struct rtw89_dev *rtwdev)
 }
 
 #define H2C_CAM_LEN 60
-int rtw89_fw_h2c_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
+int rtw89_fw_h2c_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
+		     const u8 *scan_mac_addr)
 {
 	struct sk_buff *skb;
 
@@ -533,7 +534,7 @@  int rtw89_fw_h2c_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
 		return -ENOMEM;
 	}
 	skb_put(skb, H2C_CAM_LEN);
-	rtw89_cam_fill_addr_cam_info(rtwdev, rtwvif, skb->data);
+	rtw89_cam_fill_addr_cam_info(rtwdev, rtwvif, scan_mac_addr, skb->data);
 	rtw89_cam_fill_bssid_cam_info(rtwdev, rtwvif, skb->data);
 
 	rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
index 3877c0eb7c580..7dee23574c5fc 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.h
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
@@ -1590,7 +1590,8 @@  int rtw89_fw_h2c_assoc_cmac_tbl(struct rtw89_dev *rtwdev,
 				struct ieee80211_sta *sta);
 int rtw89_fw_h2c_txtime_cmac_tbl(struct rtw89_dev *rtwdev,
 				 struct rtw89_sta *rtwsta);
-int rtw89_fw_h2c_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
+int rtw89_fw_h2c_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *vif,
+		     const u8 *scan_mac_addr);
 void rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h);
 void rtw89_fw_c2h_work(struct work_struct *work);
 int rtw89_fw_h2c_vif_maintain(struct rtw89_dev *rtwdev,
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index afcd07ab1de79..6a67ae46e22e5 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -2991,7 +2991,7 @@  int rtw89_mac_vif_init(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
 	if (ret)
 		return ret;
 
-	ret = rtw89_fw_h2c_cam(rtwdev, rtwvif);
+	ret = rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 	if (ret)
 		return ret;
 
@@ -3012,7 +3012,7 @@  int rtw89_mac_vif_deinit(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
 
 	rtw89_cam_deinit(rtwdev, rtwvif);
 
-	ret = rtw89_fw_h2c_cam(rtwdev, rtwvif);
+	ret = rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 	if (ret)
 		return ret;
 
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
index 16dc6fb7dbb0b..16381adf006ec 100644
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
@@ -336,7 +336,7 @@  static void rtw89_ops_bss_info_changed(struct ieee80211_hw *hw,
 	if (changed & BSS_CHANGED_BSSID) {
 		ether_addr_copy(rtwvif->bssid, conf->bssid);
 		rtw89_cam_bssid_changed(rtwdev, rtwvif);
-		rtw89_fw_h2c_cam(rtwdev, rtwvif);
+		rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 	}
 
 	if (changed & BSS_CHANGED_ERP_SLOT)
@@ -615,6 +615,7 @@  static void rtw89_ops_sw_scan_start(struct ieee80211_hw *hw,
 				    const u8 *mac_addr)
 {
 	struct rtw89_dev *rtwdev = hw->priv;
+	struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
 	struct rtw89_hal *hal = &rtwdev->hal;
 
 	mutex_lock(&rtwdev->mutex);
@@ -623,6 +624,7 @@  static void rtw89_ops_sw_scan_start(struct ieee80211_hw *hw,
 	rtw89_btc_ntfy_scan_start(rtwdev, RTW89_PHY_0, hal->current_band_type);
 	rtw89_chip_rfk_scan(rtwdev, true);
 	rtw89_hci_recalc_int_mit(rtwdev);
+	rtw89_fw_h2c_cam(rtwdev, rtwvif, mac_addr);
 	mutex_unlock(&rtwdev->mutex);
 }
 
@@ -630,8 +632,10 @@  static void rtw89_ops_sw_scan_complete(struct ieee80211_hw *hw,
 				       struct ieee80211_vif *vif)
 {
 	struct rtw89_dev *rtwdev = hw->priv;
+	struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
 
 	mutex_lock(&rtwdev->mutex);
+	rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL);
 	rtw89_chip_rfk_scan(rtwdev, false);
 	rtw89_btc_ntfy_scan_finish(rtwdev, RTW89_PHY_0);
 	rtwdev->scanning = false;