wifi: mt76: add mt76_connac_mcu_build_rnr_scan_param routine

Introduce mt76_connac_mcu_build_rnr_scan_param routine for handling
RNR scan. This is a preliminary patch to enable RNR scan in mt7921 and
mt7925 driver.

Signed-off-by: Ming Yen Hsieh <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Ming Yen Hsieh
2025-05-21 14:31:27 +02:00
committed by Felix Fietkau
parent b70a4a6195
commit 2247afffc7
3 changed files with 53 additions and 0 deletions
+12
View File
@@ -167,6 +167,16 @@ enum mt76_dfs_state {
MT_DFS_STATE_ACTIVE,
};
#define MT76_RNR_SCAN_MAX_BSSIDS 16
struct mt76_scan_rnr_param {
u8 bssid[MT76_RNR_SCAN_MAX_BSSIDS][ETH_ALEN];
u8 channel[MT76_RNR_SCAN_MAX_BSSIDS];
u8 random_mac[ETH_ALEN];
u8 seq_num;
u8 bssid_num;
u32 sreq_flag;
};
struct mt76_queue_buf {
dma_addr_t addr;
u16 len:15,
@@ -946,6 +956,8 @@ struct mt76_dev {
char alpha2[3];
enum nl80211_dfs_regions region;
struct mt76_scan_rnr_param rnr;
u32 debugfs_reg;
u8 csa_complete;
+38
View File
@@ -1666,6 +1666,44 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy,
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_uni_add_bss);
void mt76_connac_mcu_build_rnr_scan_param(struct mt76_dev *mdev,
struct cfg80211_scan_request *sreq)
{
struct ieee80211_channel **scan_list = sreq->channels;
int i, bssid_index = 0;
/* clear 6G active Scan BSSID table */
memset(&mdev->rnr, 0, sizeof(mdev->rnr));
for (i = 0; i < sreq->n_6ghz_params; i++) {
u8 ch_idx = sreq->scan_6ghz_params[i].channel_idx;
int k = 0;
/* Remove the duplicated BSSID */
for (k = 0; k < bssid_index; k++) {
if (!memcmp(&mdev->rnr.bssid[k],
sreq->scan_6ghz_params[i].bssid,
ETH_ALEN))
break;
}
if (k == bssid_index &&
bssid_index < MT76_RNR_SCAN_MAX_BSSIDS) {
memcpy(&mdev->rnr.bssid[bssid_index++],
sreq->scan_6ghz_params[i].bssid, ETH_ALEN);
mdev->rnr.channel[k] = scan_list[ch_idx]->hw_value;
}
}
mdev->rnr.bssid_num = bssid_index;
if (sreq->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
memcpy(mdev->rnr.random_mac, sreq->mac_addr, ETH_ALEN);
mdev->rnr.sreq_flag = sreq->flags;
}
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_build_rnr_scan_param);
#define MT76_CONNAC_SCAN_CHANNEL_TIME 60
int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_scan_request *scan_req)
+3
View File
@@ -869,6 +869,7 @@ enum {
#define NETWORK_WDS BIT(21)
#define SCAN_FUNC_RANDOM_MAC BIT(0)
#define SCAN_FUNC_RNR_SCAN BIT(3)
#define SCAN_FUNC_SPLIT_SCAN BIT(5)
#define CONNECTION_INFRA_STA (STA_TYPE_STA | NETWORK_INFRA)
@@ -1972,6 +1973,8 @@ int mt76_connac_mcu_start_patch(struct mt76_dev *dev);
int mt76_connac_mcu_patch_sem_ctrl(struct mt76_dev *dev, bool get);
int mt76_connac_mcu_start_firmware(struct mt76_dev *dev, u32 addr, u32 option);
void mt76_connac_mcu_build_rnr_scan_param(struct mt76_dev *mdev,
struct cfg80211_scan_request *sreq);
int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_scan_request *scan_req);
int mt76_connac_mcu_cancel_hw_scan(struct mt76_phy *phy,