blob: 479e720912beda3fc5a3707ad8ad1e53c880260f [file] [log] [blame]
developer617abbd2024-04-23 14:50:01 +08001From c7aef97eb798ee5c8e779e5d0514cbe68b41f6a3 Mon Sep 17 00:00:00 2001
2From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Thu, 30 Nov 2023 16:31:17 +0800
4Subject: [PATCH 089/116] wifi: mt76: mt7996: enable MLO capability
5
6This is a preliminary patch to add MLO support for mt7996 chipsets.
7
8Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
9---
10 mt7996/eeprom.c | 6 ++++++
11 mt7996/init.c | 40 ++++++++++++++++++++++++++++++++++++++--
12 2 files changed, 44 insertions(+), 2 deletions(-)
13
14diff --git a/mt7996/eeprom.c b/mt7996/eeprom.c
15index 51455d877..0393e93bf 100644
16--- a/mt7996/eeprom.c
17+++ b/mt7996/eeprom.c
18@@ -387,6 +387,12 @@ static int mt7996_eeprom_parse_band_config(struct mt7996_phy *phy)
19 break;
20 }
21
22+ /* TODO: for MLO, we enable all band capabilities */
23+ phy->mt76->cap.has_2ghz = true;
24+ phy->mt76->cap.has_5ghz = true;
25+ if (is_mt7996(&phy->dev->mt76))
26+ phy->mt76->cap.has_6ghz = true;
27+
28 return ret;
29 }
30
31diff --git a/mt7996/init.c b/mt7996/init.c
32index 381e1292c..c6eb6a5c2 100644
33--- a/mt7996/init.c
34+++ b/mt7996/init.c
35@@ -34,16 +34,45 @@ static const struct ieee80211_iface_combination if_comb[] = {
36 .limits = if_limits,
37 .n_limits = ARRAY_SIZE(if_limits),
38 .max_interfaces = MT7996_MAX_INTERFACES,
39- .num_different_channels = 1,
40+ .num_different_channels = 3,
41 .beacon_int_infra_match = true,
42+ /*
43 .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
44 BIT(NL80211_CHAN_WIDTH_20) |
45 BIT(NL80211_CHAN_WIDTH_40) |
46 BIT(NL80211_CHAN_WIDTH_80) |
47 BIT(NL80211_CHAN_WIDTH_160),
48+ */
49 }
50 };
51
52+static const u8 mt7996_if_types_ext_capa[] = {
53+ [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
54+ [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
55+};
56+
57+static const struct wiphy_iftype_ext_capab mt7996_iftypes_ext_capa[] = {
58+ {
59+ .iftype = NL80211_IFTYPE_STATION,
60+ .extended_capabilities = mt7996_if_types_ext_capa,
61+ .extended_capabilities_mask = mt7996_if_types_ext_capa,
62+ .extended_capabilities_len = sizeof(mt7996_if_types_ext_capa),
63+ .mld_capa_and_ops = 2,
64+ },
65+ {
66+ .iftype = NL80211_IFTYPE_AP,
67+ .extended_capabilities = mt7996_if_types_ext_capa,
68+ .extended_capabilities_mask = mt7996_if_types_ext_capa,
69+ .extended_capabilities_len = sizeof(mt7996_if_types_ext_capa),
70+ .mld_capa_and_ops = 2,
71+ /* the max number of simultaneous links is defined as the
72+ * maximum number of affiliated APs minus 1.
73+ * mt7996 could have 3 links in an MLD AP, so currently
74+ * hardcode it to 2.
75+ */
76+ },
77+};
78+
79 static ssize_t mt7996_thermal_temp_show(struct device *dev,
80 struct device_attribute *attr,
81 char *buf)
82@@ -417,8 +446,9 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
83 ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
84 ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
85 ieee80211_hw_set(hw, WANT_MONITOR_VIF);
86- ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
87+ // ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
88 ieee80211_hw_set(hw, CHANCTX_STA_CSA);
89+ ieee80211_hw_set(hw, CONNECTION_MONITOR);
90
91 hw->max_tx_fragments = 4;
92
93@@ -462,6 +492,12 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
94
95 wiphy->max_scan_ssids = 4;
96 wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
97+
98+ /* enable MLO support */
99+ wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
100+ wiphy->iftype_ext_capab = mt7996_iftypes_ext_capa;
101+ wiphy->num_iftype_ext_capab = ARRAY_SIZE(mt7996_iftypes_ext_capa);
102+ wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE;
103 }
104
105 static void
106--
1072.39.2
108