Mingyen Hsieh <mingyen.hsieh@xxxxxxxxxxxx> wrote: > From: Ming Yen Hsieh <mingyen.hsieh@xxxxxxxxxxxx> > > Enhance the mt7925 to include RNR scan support. It adds > the necessary RNR information to the scan command. > > Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@xxxxxxxxxxxx> > --- > .../net/wireless/mediatek/mt76/mt7925/mcu.c | 35 +++++++++++++++++-- > .../net/wireless/mediatek/mt76/mt7925/mcu.h | 17 +++++---- > 2 files changed, 43 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > index 243adace8799..7e24c4aa1e61 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > @@ -3042,6 +3042,7 @@ 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; > + u32 short_ssid[MT7925_RNR_SCAN_MAX_BSSIDS] = {0}; Using '= {}' as initializer would be more general for array and struct. > > struct scan_hdr_tlv *hdr; > struct scan_req_tlv *req; > @@ -3054,8 +3055,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) > @@ -3078,7 +3079,11 @@ 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; > > + short_ssid[i] = ~crc32_le(~0, sreq->ssids[i].ssid, > + sreq->ssids[i].ssid_len); Have you run checkpatch? Third argument doesn't align with open parenthesis. > ssid->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len); > memcpy(ssid->ssids[i].ssid, sreq->ssids[i].ssid, > sreq->ssids[i].ssid_len); > @@ -3087,6 +3092,32 @@ 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; > + > + memcpy(bssid->bssid, mdev->rnr.bssid[j], ETH_ALEN); If addresses of dst and src BSSID are aligned u16, then ether_addr_copy(). > + 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); > + } > + > tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID, sizeof(*bssid)); > bssid = (struct scan_bssid_tlv *)tlv; > >