mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-22 03:00:30 -05:00
wifi: rtw89: refine scan function after chanctx
Since we can get the current channel definition each interface maps to, remove store_op function that is no longer required to make things simple. Signed-off-by: Po-Hao Huang <phhuang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230415034900.15679-3-pkshih@realtek.com
This commit is contained in:
@@ -360,6 +360,15 @@ void rtw89_set_channel(struct rtw89_dev *rtwdev)
|
||||
rtw89_set_entity_state(rtwdev, true);
|
||||
}
|
||||
|
||||
void rtw89_get_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
struct rtw89_chan *chan)
|
||||
{
|
||||
const struct cfg80211_chan_def *chandef;
|
||||
|
||||
chandef = rtw89_chandef_get(rtwdev, rtwvif->sub_entity_idx);
|
||||
rtw89_get_channel_params(chandef, chan);
|
||||
}
|
||||
|
||||
static enum rtw89_core_tx_type
|
||||
rtw89_core_get_tx_type(struct rtw89_dev *rtwdev,
|
||||
struct sk_buff *skb)
|
||||
|
||||
@@ -3936,10 +3936,7 @@ struct rtw89_early_h2c {
|
||||
struct rtw89_hw_scan_info {
|
||||
struct ieee80211_vif *scanning_vif;
|
||||
struct list_head pkt_list[NUM_NL80211_BANDS];
|
||||
u8 op_pri_ch;
|
||||
u8 op_chan;
|
||||
u8 op_bw;
|
||||
u8 op_band;
|
||||
struct rtw89_chan op_chan;
|
||||
u32 last_chan_idx;
|
||||
};
|
||||
|
||||
@@ -4981,6 +4978,8 @@ void rtw89_free_ieee80211_hw(struct rtw89_dev *rtwdev);
|
||||
void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev);
|
||||
void rtw89_get_default_chandef(struct cfg80211_chan_def *chandef);
|
||||
void rtw89_set_channel(struct rtw89_dev *rtwdev);
|
||||
void rtw89_get_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
||||
struct rtw89_chan *chan);
|
||||
u8 rtw89_core_acquire_bit_map(unsigned long *addr, unsigned long size);
|
||||
void rtw89_core_release_bit_map(unsigned long *addr, u8 bit);
|
||||
void rtw89_core_release_all_bits_map(unsigned long *addr, unsigned int nbits);
|
||||
|
||||
@@ -2551,7 +2551,7 @@ int rtw89_fw_h2c_scan_offload(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_scan_option *option,
|
||||
struct rtw89_vif *rtwvif)
|
||||
{
|
||||
struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;
|
||||
struct rtw89_chan *op = &rtwdev->scan_info.op_chan;
|
||||
struct sk_buff *skb;
|
||||
u8 *cmd;
|
||||
int ret;
|
||||
@@ -2573,13 +2573,11 @@ int rtw89_fw_h2c_scan_offload(struct rtw89_dev *rtwdev,
|
||||
RTW89_SET_FWCMD_SCANOFLD_START_MODE(cmd, RTW89_SCAN_IMMEDIATE);
|
||||
RTW89_SET_FWCMD_SCANOFLD_SCAN_TYPE(cmd, RTW89_SCAN_ONCE);
|
||||
if (option->target_ch_mode) {
|
||||
RTW89_SET_FWCMD_SCANOFLD_TARGET_CH_BW(cmd, scan_info->op_bw);
|
||||
RTW89_SET_FWCMD_SCANOFLD_TARGET_CH_BW(cmd, op->band_width);
|
||||
RTW89_SET_FWCMD_SCANOFLD_TARGET_PRI_CH(cmd,
|
||||
scan_info->op_pri_ch);
|
||||
RTW89_SET_FWCMD_SCANOFLD_TARGET_CENTRAL_CH(cmd,
|
||||
scan_info->op_chan);
|
||||
RTW89_SET_FWCMD_SCANOFLD_TARGET_CH_BAND(cmd,
|
||||
scan_info->op_band);
|
||||
op->primary_channel);
|
||||
RTW89_SET_FWCMD_SCANOFLD_TARGET_CENTRAL_CH(cmd, op->channel);
|
||||
RTW89_SET_FWCMD_SCANOFLD_TARGET_CH_BAND(cmd, op->band_type);
|
||||
}
|
||||
|
||||
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
@@ -3158,6 +3156,7 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
||||
struct ieee80211_vif *vif = rtwdev->scan_info.scanning_vif;
|
||||
struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
|
||||
struct cfg80211_scan_request *req = rtwvif->scan_req;
|
||||
struct rtw89_chan *op = &rtwdev->scan_info.op_chan;
|
||||
struct rtw89_pktofld_info *info;
|
||||
u8 band, probe_count = 0;
|
||||
int ret;
|
||||
@@ -3201,10 +3200,10 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
||||
|
||||
switch (chan_type) {
|
||||
case RTW89_CHAN_OPERATE:
|
||||
ch_info->central_ch = scan_info->op_chan;
|
||||
ch_info->pri_ch = scan_info->op_pri_ch;
|
||||
ch_info->ch_band = scan_info->op_band;
|
||||
ch_info->bw = scan_info->op_bw;
|
||||
ch_info->central_ch = op->channel;
|
||||
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;
|
||||
ch_info->num_pkt = 0;
|
||||
break;
|
||||
@@ -3321,6 +3320,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
u32 rx_fltr = rtwdev->hal.rx_fltr;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
|
||||
rtw89_get_channel(rtwdev, rtwvif, &rtwdev->scan_info.op_chan);
|
||||
rtwdev->scan_info.scanning_vif = vif;
|
||||
rtwdev->scan_info.last_chan_idx = 0;
|
||||
rtwvif->scan_ies = &scan_req->ies;
|
||||
@@ -3346,6 +3346,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
bool aborted)
|
||||
{
|
||||
struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;
|
||||
struct cfg80211_scan_info info = {
|
||||
.aborted = aborted,
|
||||
};
|
||||
@@ -3367,11 +3368,9 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
rtwvif = (struct rtw89_vif *)vif->drv_priv;
|
||||
rtwvif->scan_req = NULL;
|
||||
rtwvif->scan_ies = NULL;
|
||||
rtwdev->scan_info.last_chan_idx = 0;
|
||||
rtwdev->scan_info.scanning_vif = NULL;
|
||||
scan_info->last_chan_idx = 0;
|
||||
scan_info->scanning_vif = NULL;
|
||||
|
||||
if (rtwvif->net_type != RTW89_NET_TYPE_NO_LINK)
|
||||
rtw89_store_op_chan(rtwdev, false);
|
||||
rtw89_set_channel(rtwdev);
|
||||
}
|
||||
|
||||
@@ -3407,24 +3406,6 @@ int rtw89_hw_scan_offload(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtw89_store_op_chan(struct rtw89_dev *rtwdev, bool backup)
|
||||
{
|
||||
struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;
|
||||
const struct rtw89_chan *cur = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
struct rtw89_chan new;
|
||||
|
||||
if (backup) {
|
||||
scan_info->op_pri_ch = cur->primary_channel;
|
||||
scan_info->op_chan = cur->channel;
|
||||
scan_info->op_bw = cur->band_width;
|
||||
scan_info->op_band = cur->band_type;
|
||||
} else {
|
||||
rtw89_chan_create(&new, scan_info->op_chan, scan_info->op_pri_ch,
|
||||
scan_info->op_band, scan_info->op_bw);
|
||||
rtw89_assign_entity_chan(rtwdev, RTW89_SUB_ENTITY_0, &new);
|
||||
}
|
||||
}
|
||||
|
||||
#define H2C_FW_CPU_EXCEPTION_LEN 4
|
||||
#define H2C_FW_CPU_EXCEPTION_TYPE_DEF 0x5566
|
||||
int rtw89_fw_h2c_trigger_cpu_exception(struct rtw89_dev *rtwdev)
|
||||
|
||||
@@ -3713,7 +3713,6 @@ int rtw89_fw_msg_reg(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_mac_c2h_info *c2h_info);
|
||||
int rtw89_fw_h2c_fw_log(struct rtw89_dev *rtwdev, bool enable);
|
||||
void rtw89_fw_st_dbg_dump(struct rtw89_dev *rtwdev);
|
||||
void rtw89_store_op_chan(struct rtw89_dev *rtwdev, bool backup);
|
||||
void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
struct ieee80211_scan_request *req);
|
||||
void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
|
||||
@@ -4194,9 +4194,9 @@ rtw89_mac_c2h_macid_pause(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len
|
||||
|
||||
static bool rtw89_is_op_chan(struct rtw89_dev *rtwdev, u8 band, u8 channel)
|
||||
{
|
||||
struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;
|
||||
const struct rtw89_chan *op = &rtwdev->scan_info.op_chan;
|
||||
|
||||
return band == scan_info->op_band && channel == scan_info->op_pri_ch;
|
||||
return band == op->band_type && channel == op->primary_channel;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4246,11 +4246,15 @@ rtw89_mac_c2h_scanofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
|
||||
}
|
||||
break;
|
||||
case RTW89_SCAN_ENTER_CH_NOTIFY:
|
||||
rtw89_chan_create(&new, chan, chan, band, RTW89_CHANNEL_WIDTH_20);
|
||||
rtw89_assign_entity_chan(rtwdev, RTW89_SUB_ENTITY_0, &new);
|
||||
if (rtw89_is_op_chan(rtwdev, band, chan)) {
|
||||
rtw89_store_op_chan(rtwdev, false);
|
||||
rtw89_assign_entity_chan(rtwdev, rtwvif->sub_entity_idx,
|
||||
&rtwdev->scan_info.op_chan);
|
||||
ieee80211_wake_queues(rtwdev->hw);
|
||||
} else {
|
||||
rtw89_chan_create(&new, chan, chan, band,
|
||||
RTW89_CHANNEL_WIDTH_20);
|
||||
rtw89_assign_entity_chan(rtwdev, rtwvif->sub_entity_idx,
|
||||
&new);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -418,7 +418,6 @@ static void rtw89_ops_bss_info_changed(struct ieee80211_hw *hw,
|
||||
rtw89_chip_cfg_txpwr_ul_tb_offset(rtwdev, vif);
|
||||
rtw89_mac_port_update(rtwdev, rtwvif);
|
||||
rtw89_mac_set_he_obss_narrow_bw_ru(rtwdev, vif);
|
||||
rtw89_store_op_chan(rtwdev, true);
|
||||
} else {
|
||||
/* Abort ongoing scan if cancel_scan isn't issued
|
||||
* when disconnected by peer
|
||||
|
||||
Reference in New Issue
Block a user