[Refactor and sync wifi from Openwrt]
[Description]
Refactor and sync wifi from Openwrt
1.mt76/mac80211/hostapd
[Release-log]
N/A
diff --git a/recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-add-support-for-runtime-set-inband-discovery.patch b/recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-add-support-for-runtime-set-inband-discovery.patch
index f6fc98f..6046344 100644
--- a/recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-add-support-for-runtime-set-inband-discovery.patch
+++ b/recipes-kernel/linux-mac80211/files/patches/subsys/906-mac80211-add-support-for-runtime-set-inband-discovery.patch
@@ -23,7 +23,7 @@
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
-@@ -7236,6 +7236,7 @@ enum nl80211_fils_discovery_attributes {
+@@ -7242,6 +7242,7 @@ enum nl80211_fils_discovery_attributes {
NL80211_FILS_DISCOVERY_ATTR_INT_MIN,
NL80211_FILS_DISCOVERY_ATTR_INT_MAX,
NL80211_FILS_DISCOVERY_ATTR_TMPL,
@@ -42,37 +42,45 @@
old = sdata_dereference(sdata->u.ap.fils_discovery, sdata);
new = kzalloc(sizeof(*new) + params->tmpl_len, GFP_KERNEL);
-@@ -1316,6 +1317,8 @@ static int ieee80211_change_beacon(struc
+@@ -1316,6 +1317,9 @@ static int ieee80211_change_beacon(struc
{
struct ieee80211_sub_if_data *sdata;
struct beacon_data *old;
+ struct cfg80211_ap_settings *ap_params;
++ struct ieee80211_supported_band *sband;
+ u32 changed;
int err;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-@@ -1334,7 +1337,26 @@ static int ieee80211_change_beacon(struc
+@@ -1334,7 +1338,33 @@ static int ieee80211_change_beacon(struc
err = ieee80211_assign_beacon(sdata, params, NULL, NULL);
if (err < 0)
return err;
- ieee80211_bss_info_change_notify(sdata, err);
+
+ changed = err;
-+ ap_params = container_of(params, struct cfg80211_ap_settings, beacon);
+
-+ if(ap_params->unsol_bcast_probe_resp.interval) {
-+ err = ieee80211_set_unsol_bcast_probe_resp(sdata,
-+ &ap_params->unsol_bcast_probe_resp);
-+ if (err < 0)
-+ return err;
-+ changed |= BSS_CHANGED_UNSOL_BCAST_PROBE_RESP;
-+ } else {
-+ err = ieee80211_set_fils_discovery(sdata,
-+ &ap_params->fils_discovery);
-+ if (err < 0)
-+ return err;
-+ changed |= BSS_CHANGED_FILS_DISCOVERY;
++ sband = ieee80211_get_sband(sdata);
++ if (!sband)
++ return -EINVAL;
++
++ if (sband->band == NL80211_BAND_6GHZ) {
++ ap_params = container_of(params, struct cfg80211_ap_settings, beacon);
++
++ if(ap_params->unsol_bcast_probe_resp.interval) {
++ err = ieee80211_set_unsol_bcast_probe_resp(sdata,
++ &ap_params->unsol_bcast_probe_resp);
++ if (err < 0)
++ return err;
++ changed |= BSS_CHANGED_UNSOL_BCAST_PROBE_RESP;
++ } else {
++ err = ieee80211_set_fils_discovery(sdata,
++ &ap_params->fils_discovery);
+
++ if (err < 0)
++ return err;
++ changed |= BSS_CHANGED_FILS_DISCOVERY;
++ }
+ }
+
+ ieee80211_bss_info_change_notify(sdata, changed);
diff --git a/recipes-kernel/linux-mt76/files/patches/0012-mt76-mt7915-add-spatial-extension-index-support.patch b/recipes-kernel/linux-mt76/files/patches/0012-mt76-mt7915-add-spatial-extension-index-support.patch
index 45bdef4..7060348 100644
--- a/recipes-kernel/linux-mt76/files/patches/0012-mt76-mt7915-add-spatial-extension-index-support.patch
+++ b/recipes-kernel/linux-mt76/files/patches/0012-mt76-mt7915-add-spatial-extension-index-support.patch
@@ -1,18 +1,18 @@
-From ab47a5638c81b4e79bce84ea0c67cf5e89820e3b Mon Sep 17 00:00:00 2001
+From 7e339b883383bc9a54fddddbe3d56dbadffb5e49 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 13 Jul 2022 10:43:16 +0800
Subject: [PATCH] mt76: mt7915: add spatial extension index support
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
- .../net/wireless/mediatek/mt76/mt76_connac.h | 11 ++++++++
- .../wireless/mediatek/mt76/mt76_connac_mac.c | 11 +++++---
+ .../net/wireless/mediatek/mt76/mt76_connac.h | 11 ++++++++++
+ .../wireless/mediatek/mt76/mt76_connac_mac.c | 11 +++++++---
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 +-
.../net/wireless/mediatek/mt76/mt7915/main.c | 3 ---
- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 26 +++++++++++++++++--
+ .../net/wireless/mediatek/mt76/mt7915/mcu.c | 20 ++++++++++++++++++-
.../net/wireless/mediatek/mt76/mt7915/mcu.h | 1 +
- .../wireless/mediatek/mt76/mt7915/testmode.c | 9 +++----
- 7 files changed, 48 insertions(+), 15 deletions(-)
+ .../wireless/mediatek/mt76/mt7915/testmode.c | 9 +++------
+ 7 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
index 9070162c..5a9c1c97 100644
@@ -93,7 +93,7 @@
phy->mt76->antenna_mask = tx_ant;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 6587be2f..03a3c252 100644
+index 6587be2f..c196d453 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1306,6 +1306,9 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
@@ -106,22 +106,18 @@
default:
break;
}
-@@ -1348,6 +1351,22 @@ int mt7915_mcu_add_smps(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1348,6 +1351,18 @@ int mt7915_mcu_add_smps(struct mt7915_dev *dev, struct ieee80211_vif *vif,
RATE_PARAM_MMPS_UPDATE);
}
+static int
+mt7915_mcu_set_spe_idx(struct mt7915_dev *dev, struct ieee80211_vif *vif,
-+ struct ieee80211_sta *sta, bool fixed_rate)
++ struct ieee80211_sta *sta)
+{
+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
+ struct mt76_phy *mphy = mvif->phy->mt76;
+ u8 spe_idx = mt76_connac_spe_idx(mphy->antenna_mask);
+
-+ if (!spe_idx && !fixed_rate &&
-+ mphy->antenna_mask == mphy->hw->wiphy->available_antennas_tx)
-+ spe_idx = 24 + mvif->mt76.band_idx;
-+
+ return mt7915_mcu_set_fixed_rate_ctrl(dev, vif, sta, &spe_idx,
+ RATE_PARAM_SPE_UPDATE);
+}
@@ -129,25 +125,16 @@
static int
mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
struct ieee80211_vif *vif,
-@@ -1393,7 +1412,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
- mask->control[band].he_gi == GENMASK(7, 0) &&
- mask->control[band].he_ltf == GENMASK(7, 0) &&
- nrates != 1)
-- return 0;
-+ return mt7915_mcu_set_spe_idx(dev, vif, sta, false);
-
- /* fixed single rate */
- if (nrates == 1) {
-@@ -1433,7 +1452,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
+@@ -1433,7 +1448,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
return ret;
}
- return 0;
-+ return mt7915_mcu_set_spe_idx(dev, vif, sta, true);
++ return mt7915_mcu_set_spe_idx(dev, vif, sta);
}
static void
-@@ -2649,6 +2668,9 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+@@ -2649,6 +2664,9 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
}
#endif