From: Ryder Lee <ryder.lee@mediatek.com> To: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Cc: Shayne Chen <shayne.chen@mediatek.com>, YF Luo <yf.luo@mediatek.com>, Yiwei Chung <yiwei.chung@mediatek.com>, Chih-Min Chen <chih-min.chen@mediatek.com>, Evelyn Tsai <evelyn.tsai@mediatek.com>, Sean Wang <sean.wang@mediatek.com>, <linux-wireless@vger.kernel.org>, <linux-mediatek@lists.infradead.org>, Ryder Lee <ryder.lee@mediatek.com> Subject: [PATCH 10/16] mt76: mt7915: add HE bss_conf support for interfaces Date: Fri, 10 Apr 2020 16:54:47 +0800 [thread overview] Message-ID: <4c91a0ccab5d3738e2a1313b449d8bcfdc204925.1586507878.git.ryder.lee@mediatek.com> (raw) In-Reply-To: <cover.1586507878.git.ryder.lee@mediatek.com> Add basic HE BSS's info for interfaces. As for the advanced features will be added gradually in the future patches. (i.e. BSS color, TWT, spatial reuse and OFDMA) Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Tested-by: Shayne Chen <shayne.chen@mediatek.com> Tested-by: Chih-Min Chen <chih-min.chen@mediatek.com> Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com> Acked-by: Yiwei Chung <yiwei.chung@mediatek.com> Acked-by: YF Luo <yf.luo@mediatek.com> --- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 89 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7915/mcu.h | 11 +++ 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 3cc7b9234e9d..549e1460b184 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -746,6 +746,47 @@ mt7915_mcu_bss_omac_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) omac->hw_bss_idx = idx; } +struct mt7915_he_obss_narrow_bw_ru_data { + bool tolerated; +}; + +static void mt7915_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, + struct cfg80211_bss *bss, + void *_data) +{ + struct mt7915_he_obss_narrow_bw_ru_data *data = _data; + const struct element *elem; + + elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, bss->ies->data, + bss->ies->len); + + if (!elem || elem->datalen < 10 || + !(elem->data[10] & + WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT)) + data->tolerated = false; +} + +static bool mt7915_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) +{ + struct mt7915_he_obss_narrow_bw_ru_data iter_data = { + .tolerated = true, + }; + + if (!(vif->bss_conf.chandef.chan->flags & IEEE80211_CHAN_RADAR)) + return false; + + cfg80211_bss_iter(hw->wiphy, &vif->bss_conf.chandef, + mt7915_check_he_obss_narrow_bw_ru_iter, + &iter_data); + + /* + * If there is at least one AP on radar channel that cannot + * tolerate 26-tone RU UL OFDMA transmissions using HE TB PPDU. + */ + return !iter_data.tolerated; +} + static void mt7915_mcu_bss_rfch_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct mt7915_phy *phy) @@ -768,7 +809,20 @@ mt7915_mcu_bss_rfch_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, ch->center_ch1 = ieee80211_frequency_to_channel(freq2); } - ch->he_all_disable = true; + if (vif->bss_conf.he_support && vif->type == NL80211_IFTYPE_STATION) { + struct mt7915_dev *dev = phy->dev; + struct mt76_phy *mphy = &dev->mt76.phy; + bool ext_phy = phy != &dev->phy; + + if (ext_phy && dev->mt76.phy2) + mphy = dev->mt76.phy2; + + ch->he_ru26_block = + mt7915_check_he_obss_narrow_bw_ru(mphy->hw, vif); + ch->he_all_disable = false; + } else { + ch->he_all_disable = true; + } } static void @@ -797,6 +851,36 @@ mt7915_mcu_bss_ra_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, ra->fast_interval = cpu_to_le32(100); } +static void +mt7915_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, + struct mt7915_phy *phy) +{ +#define DEFAULT_HE_PE_DURATION 4 +#define DEFAULT_HE_DURATION_RTS_THRES 1023 + struct cfg80211_chan_def *chandef = &phy->mt76->chandef; + enum nl80211_band band = chandef->chan->band; + struct ieee80211_sta_he_cap *cap; + struct bss_info_he *he; + struct tlv *tlv; + + cap = &phy->dev->iftype[band][vif->type].he_cap; + + tlv = mt7915_mcu_add_tlv(skb, BSS_INFO_HE_BASIC, sizeof(*he)); + + he = (struct bss_info_he *)tlv; + he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext * 4; + if (!he->he_pe_duration) + he->he_pe_duration = DEFAULT_HE_PE_DURATION; + + he->he_rts_thres = cpu_to_le16(vif->bss_conf.frame_time_rts_th * 32); + if (!he->he_rts_thres) + he->he_rts_thres = cpu_to_le16(DEFAULT_HE_DURATION_RTS_THRES); + + he->max_nss_mcs[CMD_HE_MCS_BW80] = cap->he_mcs_nss_supp.tx_mcs_80; + he->max_nss_mcs[CMD_HE_MCS_BW160] = cap->he_mcs_nss_supp.tx_mcs_160; + he->max_nss_mcs[CMD_HE_MCS_BW8080] = cap->he_mcs_nss_supp.tx_mcs_80p80; +} + static void mt7915_mcu_bss_hw_amsdu_tlv(struct sk_buff *skb) { @@ -889,6 +973,9 @@ int mt7915_mcu_add_bss_info(struct mt7915_phy *phy, mt7915_mcu_bss_bmc_tlv(skb, phy); mt7915_mcu_bss_ra_tlv(skb, vif, phy); + if (vif->bss_conf.he_support) + mt7915_mcu_bss_he_tlv(skb, vif, phy); + if (phy->dev->hw_tx_amsdu) mt7915_mcu_bss_hw_amsdu_tlv(skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h index 0563e9321175..b2f37b87117c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h @@ -396,6 +396,17 @@ struct bss_info_ra { __le32 fast_interval; } __packed; + +struct bss_info_he { + __le16 tag; + __le16 len; + u8 he_pe_duration; + u8 vht_op_info_present; + __le16 he_rts_thres; + __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM]; + u8 rsv[6]; +} __packed; + struct bss_info_hw_amsdu { __le16 tag; __le16 len; -- 2.18.0
WARNING: multiple messages have this Message-ID (diff)
From: Ryder Lee <ryder.lee@mediatek.com> To: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Cc: YF Luo <yf.luo@mediatek.com>, Evelyn Tsai <evelyn.tsai@mediatek.com>, linux-wireless@vger.kernel.org, Sean Wang <sean.wang@mediatek.com>, Chih-Min Chen <chih-min.chen@mediatek.com>, Ryder Lee <ryder.lee@mediatek.com>, Yiwei Chung <yiwei.chung@mediatek.com>, linux-mediatek@lists.infradead.org, Shayne Chen <shayne.chen@mediatek.com> Subject: [PATCH 10/16] mt76: mt7915: add HE bss_conf support for interfaces Date: Fri, 10 Apr 2020 16:54:47 +0800 [thread overview] Message-ID: <4c91a0ccab5d3738e2a1313b449d8bcfdc204925.1586507878.git.ryder.lee@mediatek.com> (raw) In-Reply-To: <cover.1586507878.git.ryder.lee@mediatek.com> Add basic HE BSS's info for interfaces. As for the advanced features will be added gradually in the future patches. (i.e. BSS color, TWT, spatial reuse and OFDMA) Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Tested-by: Shayne Chen <shayne.chen@mediatek.com> Tested-by: Chih-Min Chen <chih-min.chen@mediatek.com> Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com> Acked-by: Yiwei Chung <yiwei.chung@mediatek.com> Acked-by: YF Luo <yf.luo@mediatek.com> --- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 89 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7915/mcu.h | 11 +++ 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 3cc7b9234e9d..549e1460b184 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -746,6 +746,47 @@ mt7915_mcu_bss_omac_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) omac->hw_bss_idx = idx; } +struct mt7915_he_obss_narrow_bw_ru_data { + bool tolerated; +}; + +static void mt7915_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, + struct cfg80211_bss *bss, + void *_data) +{ + struct mt7915_he_obss_narrow_bw_ru_data *data = _data; + const struct element *elem; + + elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, bss->ies->data, + bss->ies->len); + + if (!elem || elem->datalen < 10 || + !(elem->data[10] & + WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT)) + data->tolerated = false; +} + +static bool mt7915_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) +{ + struct mt7915_he_obss_narrow_bw_ru_data iter_data = { + .tolerated = true, + }; + + if (!(vif->bss_conf.chandef.chan->flags & IEEE80211_CHAN_RADAR)) + return false; + + cfg80211_bss_iter(hw->wiphy, &vif->bss_conf.chandef, + mt7915_check_he_obss_narrow_bw_ru_iter, + &iter_data); + + /* + * If there is at least one AP on radar channel that cannot + * tolerate 26-tone RU UL OFDMA transmissions using HE TB PPDU. + */ + return !iter_data.tolerated; +} + static void mt7915_mcu_bss_rfch_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct mt7915_phy *phy) @@ -768,7 +809,20 @@ mt7915_mcu_bss_rfch_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, ch->center_ch1 = ieee80211_frequency_to_channel(freq2); } - ch->he_all_disable = true; + if (vif->bss_conf.he_support && vif->type == NL80211_IFTYPE_STATION) { + struct mt7915_dev *dev = phy->dev; + struct mt76_phy *mphy = &dev->mt76.phy; + bool ext_phy = phy != &dev->phy; + + if (ext_phy && dev->mt76.phy2) + mphy = dev->mt76.phy2; + + ch->he_ru26_block = + mt7915_check_he_obss_narrow_bw_ru(mphy->hw, vif); + ch->he_all_disable = false; + } else { + ch->he_all_disable = true; + } } static void @@ -797,6 +851,36 @@ mt7915_mcu_bss_ra_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, ra->fast_interval = cpu_to_le32(100); } +static void +mt7915_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, + struct mt7915_phy *phy) +{ +#define DEFAULT_HE_PE_DURATION 4 +#define DEFAULT_HE_DURATION_RTS_THRES 1023 + struct cfg80211_chan_def *chandef = &phy->mt76->chandef; + enum nl80211_band band = chandef->chan->band; + struct ieee80211_sta_he_cap *cap; + struct bss_info_he *he; + struct tlv *tlv; + + cap = &phy->dev->iftype[band][vif->type].he_cap; + + tlv = mt7915_mcu_add_tlv(skb, BSS_INFO_HE_BASIC, sizeof(*he)); + + he = (struct bss_info_he *)tlv; + he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext * 4; + if (!he->he_pe_duration) + he->he_pe_duration = DEFAULT_HE_PE_DURATION; + + he->he_rts_thres = cpu_to_le16(vif->bss_conf.frame_time_rts_th * 32); + if (!he->he_rts_thres) + he->he_rts_thres = cpu_to_le16(DEFAULT_HE_DURATION_RTS_THRES); + + he->max_nss_mcs[CMD_HE_MCS_BW80] = cap->he_mcs_nss_supp.tx_mcs_80; + he->max_nss_mcs[CMD_HE_MCS_BW160] = cap->he_mcs_nss_supp.tx_mcs_160; + he->max_nss_mcs[CMD_HE_MCS_BW8080] = cap->he_mcs_nss_supp.tx_mcs_80p80; +} + static void mt7915_mcu_bss_hw_amsdu_tlv(struct sk_buff *skb) { @@ -889,6 +973,9 @@ int mt7915_mcu_add_bss_info(struct mt7915_phy *phy, mt7915_mcu_bss_bmc_tlv(skb, phy); mt7915_mcu_bss_ra_tlv(skb, vif, phy); + if (vif->bss_conf.he_support) + mt7915_mcu_bss_he_tlv(skb, vif, phy); + if (phy->dev->hw_tx_amsdu) mt7915_mcu_bss_hw_amsdu_tlv(skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h index 0563e9321175..b2f37b87117c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h @@ -396,6 +396,17 @@ struct bss_info_ra { __le32 fast_interval; } __packed; + +struct bss_info_he { + __le16 tag; + __le16 len; + u8 he_pe_duration; + u8 vht_op_info_present; + __le16 he_rts_thres; + __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM]; + u8 rsv[6]; +} __packed; + struct bss_info_hw_amsdu { __le16 tag; __le16 len; -- 2.18.0 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2020-04-10 8:55 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-10 8:54 [PATCH 00/16] Add MediaTek IEEE 802.11ax devices - MT7915E Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 01/16] mt76: avoid rx reorder buffer overflow Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 02/16] mt76: add support for HE RX rate reporting Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 03/16] mt76: add Rx stats support for radiotap Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 04/16] mt76: adjust wcid size to support new 802.11ax generation Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 05/16] mt76: add HE phy modes and hardware queue Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 06/16] mt76: add mac80211 driver for MT7915 PCIe-based chipsets Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-14 6:37 ` Kalle Valo 2020-04-14 6:37 ` Kalle Valo 2020-04-14 9:05 ` Ryder Lee 2020-04-14 9:05 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 07/16] mt76: mt7915: implement HE per-rate tx power support Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 08/16] mt76: mt7915: add offloading Tx AMSDU support Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-14 6:44 ` Kalle Valo 2020-04-14 6:44 ` Kalle Valo 2020-04-14 9:59 ` Ryder Lee 2020-04-14 9:59 ` Ryder Lee 2020-04-14 10:05 ` Kalle Valo 2020-04-14 10:05 ` Kalle Valo 2020-04-10 8:54 ` [PATCH 09/16] mt76: mt7915: register HE capabilities for each interface Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` Ryder Lee [this message] 2020-04-10 8:54 ` [PATCH 10/16] mt76: mt7915: add HE bss_conf support for interfaces Ryder Lee 2020-04-10 8:54 ` [PATCH 11/16] mt76: mt7915: add HE capabilities support for peers Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 12/16] mt76: mt7915: add Rx radiotap header support Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 13/16] mt76: mt7915: add .sta_add_debugfs support Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 14/16] mt76: mt7915: add .sta_statistics support Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 15/16] mt76: mt7915: set peer Tx fixed rate through debugfs Ryder Lee 2020-04-10 8:54 ` Ryder Lee 2020-04-10 8:54 ` [PATCH 16/16] mt76: mt7915: enable firmware module debug support Ryder Lee 2020-04-10 8:54 ` Ryder Lee
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4c91a0ccab5d3738e2a1313b449d8bcfdc204925.1586507878.git.ryder.lee@mediatek.com \ --to=ryder.lee@mediatek.com \ --cc=chih-min.chen@mediatek.com \ --cc=evelyn.tsai@mediatek.com \ --cc=linux-mediatek@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ --cc=lorenzo.bianconi@redhat.com \ --cc=nbd@nbd.name \ --cc=sean.wang@mediatek.com \ --cc=shayne.chen@mediatek.com \ --cc=yf.luo@mediatek.com \ --cc=yiwei.chung@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.