wifi: rtw89: refine TX nulldata judgement when scan with 2 OP channels

When scan with 2 OP channels, for the case like
not-connect(macid 0) + GO(macid 1) or not-connect(macid 0) + GC(macid 1),
the macid 0 doesn't offload NULL data packet to FW. Therefore, refine the
NULL data judgement to let interfaces that only connected and non-AP mode
need to TX nulldata.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251229030926.27004-10-pkshih@realtek.com
This commit is contained in:
Chih-Kang Chang 2025-12-29 11:09:23 +08:00 committed by Ping-Ke Shih
parent 8cb147e237
commit fe17b1852f
2 changed files with 35 additions and 20 deletions

View File

@ -5944,27 +5944,18 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
u8 scan_offload_ver = U8_MAX;
u8 cfg_len = sizeof(*h2c);
unsigned int cond;
u8 ap_idx = U8_MAX;
u8 ver = U8_MAX;
u8 policy_val;
void *ptr;
u8 txnull;
u8 txbcn;
int ret;
u32 len;
u8 i;
scan_op[0].macid = rtwvif_link->mac_id;
scan_op[0].port = rtwvif_link->port;
scan_op[0].chan = *op;
vif = rtwvif_to_vif(rtwvif_link->rtwvif);
if (vif->type == NL80211_IFTYPE_AP)
ap_idx = 0;
if (ext->set) {
scan_op[1] = *ext;
vif = rtwvif_to_vif(ext->rtwvif_link->rtwvif);
if (vif->type == NL80211_IFTYPE_AP)
ap_idx = 1;
if (option->num_opch > RTW89_MAX_OP_NUM_BE) {
rtw89_err(rtwdev, "num of scan OP chan %d over limit\n", option->num_opch);
return -ENOENT;
}
rtw89_scan_get_6g_disabled_chan(rtwdev, option);
@ -6069,11 +6060,29 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
}
for (i = 0; i < option->num_opch; i++) {
bool is_ap_idx = i == ap_idx;
struct rtw89_vif_link *rtwvif_link_op;
bool is_ap;
opmode = is_ap_idx ? RTW89_SCAN_OPMODE_TBTT : RTW89_SCAN_OPMODE_INTV;
policy_val = is_ap_idx ? 2 : RTW89_OFF_CHAN_TIME / 10;
txbcn = is_ap_idx ? 1 : 0;
switch (i) {
case 0:
scan_op[0].macid = rtwvif_link->mac_id;
scan_op[0].port = rtwvif_link->port;
scan_op[0].chan = *op;
rtwvif_link_op = rtwvif_link;
break;
case 1:
scan_op[1] = *ext;
rtwvif_link_op = ext->rtwvif_link;
break;
}
vif = rtwvif_to_vif(rtwvif_link_op->rtwvif);
is_ap = vif->type == NL80211_IFTYPE_AP;
txnull = !is_zero_ether_addr(rtwvif_link_op->bssid) &&
vif->type != NL80211_IFTYPE_AP;
opmode = is_ap ? RTW89_SCAN_OPMODE_TBTT : RTW89_SCAN_OPMODE_INTV;
policy_val = is_ap ? 2 : RTW89_OFF_CHAN_TIME / 10;
txbcn = is_ap ? 1 : 0;
opch = ptr;
opch->w0 = le32_encode_bits(scan_op[i].macid,
@ -6084,7 +6093,7 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
RTW89_H2C_SCANOFLD_BE_OPCH_W0_PORT) |
le32_encode_bits(opmode,
RTW89_H2C_SCANOFLD_BE_OPCH_W0_POLICY) |
le32_encode_bits(true,
le32_encode_bits(txnull,
RTW89_H2C_SCANOFLD_BE_OPCH_W0_TXNULL) |
le32_encode_bits(policy_val,
RTW89_H2C_SCANOFLD_BE_OPCH_W0_POLICY_VAL);
@ -7396,6 +7405,7 @@ static void rtw89_hw_scan_add_chan_ax(struct rtw89_dev *rtwdev, int chan_type,
struct cfg80211_scan_request *req = rtwvif->scan_req;
struct rtw89_chan *op = &rtwdev->scan_info.op_chan;
struct rtw89_pktofld_info *info;
struct ieee80211_vif *vif;
u8 band, probe_count = 0;
int ret;
@ -7448,7 +7458,9 @@ static void rtw89_hw_scan_add_chan_ax(struct rtw89_dev *rtwdev, int chan_type,
ch_info->pri_ch = op->primary_channel;
ch_info->ch_band = op->band_type;
ch_info->bw = op->band_width;
ch_info->tx_null = true;
vif = rtwvif_link_to_vif(rtwvif_link);
ch_info->tx_null = !is_zero_ether_addr(rtwvif_link->bssid) &&
vif->type != NL80211_IFTYPE_AP;
ch_info->num_pkt = 0;
break;
case RTW89_CHAN_DFS:
@ -7466,7 +7478,9 @@ static void rtw89_hw_scan_add_chan_ax(struct rtw89_dev *rtwdev, int chan_type,
ch_info->pri_ch = ext->chan.primary_channel;
ch_info->ch_band = ext->chan.band_type;
ch_info->bw = ext->chan.band_width;
ch_info->tx_null = true;
vif = rtwvif_link_to_vif(ext->rtwvif_link);
ch_info->tx_null = !is_zero_ether_addr(ext->rtwvif_link->bssid) &&
vif->type != NL80211_IFTYPE_AP;
ch_info->num_pkt = 0;
ch_info->macid_tx = true;
break;

View File

@ -2812,6 +2812,7 @@ struct rtw89_h2c_scanofld_be_macc_role {
__le32 w0;
} __packed;
#define RTW89_MAX_OP_NUM_BE 2
#define RTW89_H2C_SCANOFLD_BE_MACC_ROLE_W0_BAND GENMASK(1, 0)
#define RTW89_H2C_SCANOFLD_BE_MACC_ROLE_W0_PORT GENMASK(4, 2)
#define RTW89_H2C_SCANOFLD_BE_MACC_ROLE_W0_MACID GENMASK(23, 8)