mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
wifi: rtw89: 8852c: support hw_scan
This enables hw_scan function for 52c. The mechanism is similar to 52a except that it adds modifications required for 6G channels and extends the command length to make driver compatible to both newer and existing firmware. 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/20220908051257.25353-9-pkshih@realtek.com
This commit is contained in:
parent
5abbb68aca
commit
3a1e7cb16d
4 changed files with 27 additions and 7 deletions
|
@ -3787,6 +3787,20 @@ enum nl80211_band rtw89_hw_to_nl80211_band(enum rtw89_band hw_band)
|
|||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
enum rtw89_band rtw89_nl80211_to_hw_band(enum nl80211_band nl_band)
|
||||
{
|
||||
switch (nl_band) {
|
||||
default:
|
||||
case NL80211_BAND_2GHZ:
|
||||
return RTW89_BAND_2G;
|
||||
case NL80211_BAND_5GHZ:
|
||||
return RTW89_BAND_5G;
|
||||
case NL80211_BAND_6GHZ:
|
||||
return RTW89_BAND_6G;
|
||||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
enum rtw89_bandwidth nl_to_rtw89_bandwidth(enum nl80211_chan_width width)
|
||||
{
|
||||
|
|
|
@ -227,6 +227,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
|
|||
__CFG_FW_FEAT(RTL8852A, ge, 0, 13, 36, 0, CRASH_TRIGGER),
|
||||
__CFG_FW_FEAT(RTL8852C, le, 0, 27, 33, 0, NO_DEEP_PS),
|
||||
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 34, 0, TX_WAKE),
|
||||
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 36, 0, SCAN_OFFLOAD),
|
||||
};
|
||||
|
||||
static void rtw89_fw_recognize_features(struct rtw89_dev *rtwdev)
|
||||
|
@ -1941,7 +1942,7 @@ int rtw89_fw_h2c_scan_list_offload(struct rtw89_dev *rtwdev, int len,
|
|||
return -EBUSY;
|
||||
}
|
||||
|
||||
#define H2C_LEN_SCAN_OFFLOAD 20
|
||||
#define H2C_LEN_SCAN_OFFLOAD 28
|
||||
int rtw89_fw_h2c_scan_offload(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_scan_option *option,
|
||||
struct rtw89_vif *rtwvif)
|
||||
|
@ -1972,6 +1973,8 @@ int rtw89_fw_h2c_scan_offload(struct rtw89_dev *rtwdev,
|
|||
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);
|
||||
}
|
||||
|
||||
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
|
@ -2406,7 +2409,7 @@ static void rtw89_hw_scan_add_chan(struct rtw89_dev *rtwdev, int chan_type,
|
|||
|
||||
if (ssid_num) {
|
||||
ch_info->num_pkt = ssid_num;
|
||||
band = ch_info->ch_band;
|
||||
band = rtw89_hw_to_nl80211_band(ch_info->ch_band);
|
||||
|
||||
list_for_each_entry(info, &scan_info->pkt_list[band], list) {
|
||||
ch_info->probe_id = info->id;
|
||||
|
@ -2463,7 +2466,7 @@ static int rtw89_hw_scan_add_chan_list(struct rtw89_dev *rtwdev,
|
|||
|
||||
ch_info->period = req->duration_mandatory ?
|
||||
req->duration : RTW89_CHANNEL_TIME;
|
||||
ch_info->ch_band = channel->band;
|
||||
ch_info->ch_band = rtw89_nl80211_to_hw_band(channel->band);
|
||||
ch_info->central_ch = channel->hw_value;
|
||||
ch_info->pri_ch = channel->hw_value;
|
||||
ch_info->rand_seq_num = random_seq;
|
||||
|
|
|
@ -197,7 +197,7 @@ struct rtw89_h2creg_sch_tx_en {
|
|||
#define RTW89_SCANOFLD_MAX_IE_LEN 512
|
||||
#define RTW89_SCANOFLD_PKT_NONE 0xFF
|
||||
#define RTW89_SCANOFLD_DEBUG_MASK 0x1F
|
||||
#define RTW89_MAC_CHINFO_SIZE 20
|
||||
#define RTW89_MAC_CHINFO_SIZE 24
|
||||
|
||||
struct rtw89_mac_chinfo {
|
||||
u8 period;
|
||||
|
@ -2467,6 +2467,8 @@ static inline void RTW89_SET_FWCMD_SCANOFLD_TSF_SLOW(void *cmd, u32 val)
|
|||
le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(19, 16))
|
||||
#define RTW89_GET_MAC_C2H_SCANOFLD_STATUS(c2h) \
|
||||
le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(23, 20))
|
||||
#define RTW89_GET_MAC_C2H_ACTUAL_PERIOD(c2h) \
|
||||
le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(31, 24))
|
||||
#define RTW89_GET_MAC_C2H_SCANOFLD_TX_FAIL(c2h) \
|
||||
le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(3, 0))
|
||||
#define RTW89_GET_MAC_C2H_SCANOFLD_AIR_DENSITY(c2h) \
|
||||
|
|
|
@ -3735,7 +3735,7 @@ rtw89_mac_c2h_scanofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
|
|||
{
|
||||
struct ieee80211_vif *vif = rtwdev->scan_info.scanning_vif;
|
||||
struct rtw89_chan new;
|
||||
u8 reason, status, tx_fail, band;
|
||||
u8 reason, status, tx_fail, band, actual_period;
|
||||
u16 chan;
|
||||
|
||||
tx_fail = RTW89_GET_MAC_C2H_SCANOFLD_TX_FAIL(c2h->data);
|
||||
|
@ -3743,13 +3743,14 @@ rtw89_mac_c2h_scanofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *c2h,
|
|||
chan = RTW89_GET_MAC_C2H_SCANOFLD_PRI_CH(c2h->data);
|
||||
reason = RTW89_GET_MAC_C2H_SCANOFLD_RSP(c2h->data);
|
||||
band = RTW89_GET_MAC_C2H_SCANOFLD_BAND(c2h->data);
|
||||
actual_period = RTW89_GET_MAC_C2H_ACTUAL_PERIOD(c2h->data);
|
||||
|
||||
if (!(rtwdev->chip->support_bands & BIT(NL80211_BAND_6GHZ)))
|
||||
band = chan > 14 ? RTW89_BAND_5G : RTW89_BAND_2G;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_HW_SCAN,
|
||||
"band: %d, chan: %d, reason: %d, status: %d, tx_fail: %d\n",
|
||||
band, chan, reason, status, tx_fail);
|
||||
"band: %d, chan: %d, reason: %d, status: %d, tx_fail: %d, actual: %d\n",
|
||||
band, chan, reason, status, tx_fail, actual_period);
|
||||
|
||||
switch (reason) {
|
||||
case RTW89_SCAN_LEAVE_CH_NOTIFY:
|
||||
|
|
Loading…
Reference in a new issue