Message ID | 20250321013829.3598-2-mingyen.hsieh@mediatek.com |
---|---|
State | New |
Headers | show |
Series | [v2,1/2] wifi: mt76: add mt76_connac_mcu_build_rnr_scan_param routine | expand |
On 21.03.25 02:38, Mingyen Hsieh wrote: > From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> > > 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@mediatek.com> > --- > v2: > - use '= {}' to replace the '= {0}' for short_ssid array. > - align with the open paranthesis for crc32_le. > - use ether_addr_copy() to replace the memcpy of bssid. > --- > .../net/wireless/mediatek/mt76/mt7925/mcu.c | 36 ++++++++++++++++--- > .../net/wireless/mediatek/mt76/mt7925/mcu.h | 17 +++++---- > 2 files changed, 41 insertions(+), 12 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > index 243adace8799..22686faca1af 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > @@ -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); I had to remove this variable due to a unused-but-set warning. I'm not sure if the contents of it should have been stored somewhere in the MCU message, or if this was something that ended up not being necessary. Please review and send a follow-up fix if needed. - Felix
On Thu, 2025-05-22 at 12:49 +0200, Felix Fietkau wrote: > > External email : Please do not click links or open attachments until > you have verified the sender or the content. > > > On 21.03.25 02:38, Mingyen Hsieh wrote: > > From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> > > > > 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@mediatek.com> > > --- > > v2: > > - use '= {}' to replace the '= {0}' for short_ssid array. > > - align with the open paranthesis for crc32_le. > > - use ether_addr_copy() to replace the memcpy of bssid. > > --- > > .../net/wireless/mediatek/mt76/mt7925/mcu.c | 36 > > ++++++++++++++++--- > > .../net/wireless/mediatek/mt76/mt7925/mcu.h | 17 +++++---- > > 2 files changed, 41 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > > b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > > index 243adace8799..22686faca1af 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > > +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c > > @@ -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); > > I had to remove this variable due to a unused-but-set warning. I'm > not > sure if the contents of it should have been stored somewhere in the > MCU > message, or if this was something that ended up not being necessary. > Please review and send a follow-up fix if needed. > > - Felix Hi Felix, This variable is currently not being used. I apologize for my oversight that caused this warning. Should i submit a v3 to remove it, or will you help remove it? Yen.
On 22.05.25 13:12, Mingyen Hsieh (謝明諺) wrote: > Hi Felix, > > This variable is currently not being used. I apologize for my oversight > that caused this warning. Should i submit a v3 to remove it, or will > you help remove it? No problem, I already removed the variable in my tree. - Felix
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 243adace8799..22686faca1af 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] = {}; 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); 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,10 +3092,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; - tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID, sizeof(*bssid)); - bssid = (struct scan_bssid_tlv *)tlv; + 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, sreq->bssid, ETH_ALEN); + 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; + + 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; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index 0419aa922e17..96809c2fdff9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -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;