From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>
Subject: [PATCH rtw-next 04/14] wifi: rtw89: coex: Rearrange _ntfy_role_info info
Date: Fri, 24 Jul 2026 21:56:30 +0800 [thread overview]
Message-ID: <20260724135640.3195044-5-pkshih@realtek.com> (raw)
In-Reply-To: <20260724135640.3195044-1-pkshih@realtek.com>
From: Ching-Te Ku <ku920601@realtek.com>
rtw89_btc_wl_link_info is duplicated declaring in the function, remove one
of them. We need MAC Address only when Wi-Fi role is station, included the
copy operation into if statement.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/coex.c | 79 +++++++++++++++--------
1 file changed, 53 insertions(+), 26 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index d873b9482e49..9da3b23b2d14 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -8675,13 +8675,14 @@ void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev,
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
rtwvif_link->chanctx_idx);
struct ieee80211_vif *vif = rtwvif_link_to_vif(rtwvif_link);
+ struct ieee80211_p2p_noa_attr *noa_attr;
+ struct ieee80211_p2p_noa_desc *noa_desc;
struct ieee80211_bss_conf *bss_conf;
struct ieee80211_link_sta *link_sta;
struct rtw89_btc *btc = &rtwdev->btc;
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
struct rtw89_btc_wl_link_info r = {0};
- struct rtw89_btc_wl_link_info *wlinfo = NULL;
- u8 mode = 0;
+ u8 i, mode = 0;
rcu_read_lock();
@@ -8729,34 +8730,60 @@ void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev,
rtw89_debug(rtwdev, RTW89_DBG_BTC,
"[BTC], wifi_role=%d\n", rtwvif_link->wifi_role);
- wlinfo = &wl->rlink_info[rtwvif_link->port][rtwvif_link->phy_idx];
-
- wlinfo->mode = mode;
- wlinfo->role = rtwvif_link->wifi_role;
- wlinfo->phy = rtwvif_link->phy_idx;
- wlinfo->pid = rtwvif_link->port;
- wlinfo->active = true;
- wlinfo->connected = MLME_LINKED;
- wlinfo->bcn_period = bss_conf->beacon_int;
- wlinfo->dtim_period = bss_conf->dtim_period;
- wlinfo->band = chan->band_type;
- wlinfo->ch = chan->channel;
- wlinfo->bw = chan->band_width;
- wlinfo->chdef.band = chan->band_type;
- wlinfo->chdef.center_ch = chan->channel;
- wlinfo->chdef.bw = chan->band_width;
- wlinfo->chdef.chan = chan->primary_channel;
- ether_addr_copy(r.mac_addr, rtwvif_link->mac_addr);
+ if (vif->type == NL80211_IFTYPE_P2P_GO ||
+ vif->type == NL80211_IFTYPE_P2P_CLIENT) {
+ noa_attr = &bss_conf->p2p_noa_attr;
- rcu_read_unlock();
+ for (i = 0; i < RTW89_P2P_MAX_NOA_NUM; i++) {
+ noa_desc = &noa_attr->desc[i];
+ if (noa_desc->count != 0) {
+ r.noa = 1;
+ r.noa_duration = le32_to_cpu(noa_desc->duration);
+ break;
+ }
+ }
+ }
+
+ r.mode = mode;
+ r.role = rtwvif_link->wifi_role;
+ r.phy = rtwvif_link->phy_idx;
+ r.pid = rtwvif_link->port;
+ r.active = true;
+ if (vif->active_links) {
+ if (rtwvif_link->link_id < 16)
+ r.active = !!(vif->active_links & BIT(rtwvif_link->link_id));
+ }
+ r.bcn_period = bss_conf->beacon_int;
+ r.dtim_period = bss_conf->dtim_period;
+ r.band = chan->band_type;
+ r.ch = chan->channel;
+ r.bw = chan->band_width;
+ r.chdef.band = chan->band_type;
+ r.chdef.center_ch = chan->channel;
+ r.chdef.bw = chan->band_width;
+ r.chdef.chan = chan->primary_channel;
+
+ if (rtwsta_link && vif->type == NL80211_IFTYPE_STATION) {
+ r.mac_id = rtwsta_link->mac_id;
+ ether_addr_copy(r.mac_addr, rtwvif_link->mac_addr);
+ }
+
+ switch (state) {
+ case BTC_ROLE_MSTS_STA_CONN_END:
+ case BTC_ROLE_MSTS_AP_START:
+ r.connected = MLME_LINKED;
+ break;
+ default:
+ r.connected = MLME_NO_LINK;
+ break;
+ }
- if (rtwsta_link && vif->type == NL80211_IFTYPE_STATION)
- wlinfo->mac_id = rtwsta_link->mac_id;
+ rcu_read_unlock();
btc->dm.cnt_notify[BTC_NCNT_ROLE_INFO]++;
- if (wlinfo->role == RTW89_WIFI_ROLE_STATION &&
- wlinfo->connected == MLME_NO_LINK)
+ if (r.role == RTW89_WIFI_ROLE_STATION &&
+ r.connected == MLME_NO_LINK)
btc->dm.leak_ap = 0;
if (state == BTC_ROLE_MSTS_STA_CONN_START) {
@@ -8774,7 +8801,7 @@ void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev,
state == BTC_ROLE_MSTS_STA_CONN_END)
wl->status.map._4way = false;
- _update_wl_info(rtwdev, wlinfo);
+ _update_wl_info(rtwdev, &r);
_run_coex(rtwdev, BTC_RSN_NTFY_ROLE_INFO);
}
--
2.25.1
next prev parent reply other threads:[~2026-07-24 13:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 13:56 [PATCH rtw-next 00/14] wifi: rtw89: coex: add more command / event formats for coming RTL8922D Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 01/14] wifi: rtw89: coex: Add chip initial info version 11 for RTL8922A/D Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 02/14] wifi: rtw89: coex: Add Wi-Fi MLO info version 2 H2C command Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 03/14] wifi: rtw89: coex: Add firmware 0.35.111.X support for RTL8922A/D Ping-Ke Shih
2026-07-24 13:56 ` Ping-Ke Shih [this message]
2026-07-24 13:56 ` [PATCH rtw-next 05/14] wifi: rtw89: coex: Separate _ntfy_role_info into two function Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 06/14] wifi: rtw89: coex: Decrease Wi-Fi special packet protect time Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 07/14] wifi: rtw89: coex: complete GPIO debug configuration handler Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 08/14] wifi: rtw89: coex: Refine RF calibration notify flow Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 09/14] wifi: rtw89: coex: Fix log dump format with proper newline Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 10/14] wifi: rtw89: coex: Add BTC report version 8 support for BT sub-reports Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 11/14] wifi: rtw89: coex: Add dual Bluetooth debug info dump Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 12/14] wifi: rtw89: coex: Fix TDMA v8 handling to unblock BTC report parsing Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 13/14] wifi: rtw89: coex: Fix H2C command redundant send & version fall through Ping-Ke Shih
2026-07-24 13:56 ` [PATCH rtw-next 14/14] wifi: rtw89: coex: Handle Bluetooth LE-Audio related coexistence feature Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724135640.3195044-5-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=ku920601@realtek.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox