Commit 8284815c authored by Ming Yen Hsieh's avatar Ming Yen Hsieh Committed by Felix Fietkau
Browse files

wifi: mt76: mt7925: add RNR scan support for 6GHz



Enhance the mt7925 to include RNR scan support. It adds
the necessary RNR information to the scan command.

Signed-off-by: default avatarMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250321013829.3598-2-mingyen.hsieh@mediatek.com


Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 913a6182
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
@@ -2830,7 +2830,6 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
	struct mt76_dev *mdev = phy->dev;
	struct mt76_connac_mcu_scan_channel *chan;
	struct sk_buff *skb;

	struct scan_hdr_tlv *hdr;
	struct scan_req_tlv *req;
	struct scan_ssid_tlv *ssid;
@@ -2842,8 +2841,8 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
	int max_len;

	max_len = sizeof(*hdr) + sizeof(*req) + sizeof(*ssid) +
				sizeof(*bssid) + sizeof(*chan_info) +
				sizeof(*misc) + sizeof(*ie);
		  sizeof(*bssid) * MT7925_RNR_SCAN_MAX_BSSIDS +
		  sizeof(*chan_info) + sizeof(*misc) + sizeof(*ie);

	skb = mt76_mcu_msg_alloc(mdev, NULL, max_len);
	if (!skb)
@@ -2866,6 +2865,8 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
	for (i = 0; i < sreq->n_ssids; i++) {
		if (!sreq->ssids[i].ssid_len)
			continue;
		if (i > MT7925_RNR_SCAN_MAX_BSSIDS)
			break;

		ssid->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len);
		memcpy(ssid->ssids[i].ssid, sreq->ssids[i].ssid,
@@ -2875,10 +2876,31 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
	ssid->ssid_type = n_ssids ? BIT(2) : BIT(0);
	ssid->ssids_num = n_ssids;

	if (sreq->n_6ghz_params) {
		u8 j;

		mt76_connac_mcu_build_rnr_scan_param(mdev, sreq);

		for (j = 0; j < mdev->rnr.bssid_num; j++) {
			if (j > MT7925_RNR_SCAN_MAX_BSSIDS)
				break;

			tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID,
						      sizeof(*bssid));
			bssid = (struct scan_bssid_tlv *)tlv;

			ether_addr_copy(bssid->bssid, mdev->rnr.bssid[j]);
			bssid->match_ch = mdev->rnr.channel[j];
			bssid->match_ssid_ind = MT7925_RNR_SCAN_MAX_BSSIDS;
			bssid->match_short_ssid_ind = MT7925_RNR_SCAN_MAX_BSSIDS;
		}
		req->scan_func |= SCAN_FUNC_RNR_SCAN;
	} else {
		tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID, sizeof(*bssid));
		bssid = (struct scan_bssid_tlv *)tlv;

	memcpy(bssid->bssid, sreq->bssid, ETH_ALEN);
		ether_addr_copy(bssid->bssid, sreq->bssid);
	}

	tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_CHANNEL, sizeof(*chan_info));
	chan_info = (struct scan_chan_info_tlv *)tlv;
+10 −7
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ enum {
	UNI_SNIFFER_CONFIG,
};

#define MT7925_RNR_SCAN_MAX_BSSIDS	10
struct scan_hdr_tlv {
	/* fixed field */
	u8 seq_num;
@@ -223,7 +224,7 @@ struct scan_req_tlv {
	__le16 timeout_value;
	__le16 probe_delay_time;
	__le32 func_mask_ext;
};
} __packed;

struct scan_ssid_tlv {
	__le16 tag;
@@ -235,9 +236,10 @@ struct scan_ssid_tlv {
		       * BIT(2) + ssid_type_ext BIT(0) specified SSID only
		       */
	u8 ssids_num;
	u8 pad[2];
	struct mt76_connac_mcu_scan_ssid ssids[4];
};
	u8 is_short_ssid;
	u8 pad;
	struct mt76_connac_mcu_scan_ssid ssids[MT7925_RNR_SCAN_MAX_BSSIDS];
} __packed;

struct scan_bssid_tlv {
	__le16 tag;
@@ -247,8 +249,9 @@ struct scan_bssid_tlv {
	u8 match_ch;
	u8 match_ssid_ind;
	u8 rcpi;
	u8 pad[3];
};
	u8 match_short_ssid_ind;
	u8 pad[2];
} __packed;

struct scan_chan_info_tlv {
	__le16 tag;
@@ -264,7 +267,7 @@ struct scan_chan_info_tlv {
	u8 channels_num; /* valid when channel_type is 4 */
	u8 pad[2];
	struct mt76_connac_mcu_scan_channel channels[64];
};
} __packed;

struct scan_ie_tlv {
	__le16 tag;