mt76: update to the latest version

This commit is contained in:
coolsnowwolf 2022-12-20 23:11:06 +08:00
parent a45ed09431
commit 07423281c6
4 changed files with 1928 additions and 4 deletions

View File

@ -1,16 +1,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mt76
PKG_RELEASE=6
PKG_RELEASE=7
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2022-12-01
PKG_SOURCE_VERSION:=cdd7229e769b65d12284ea9ebcd1cff01d3bf228
PKG_MIRROR_HASH:=b509fd2757775bffbc6daf41408d54c6c5aeb557774710712b5288315da94a9e
PKG_SOURCE_DATE:=2022-12-10
PKG_SOURCE_VERSION:=7fae1de12ae7832a6095fd2df198f41fabd5223d
PKG_MIRROR_HASH:=c01388f8029b007efdfb4327ef54aa373a91bbbff423caaa2ab4ab22befb9635
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_USE_NINJA:=0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,316 @@
From dab03e40b8c614d18dfeec054767275de25ff8ab Mon Sep 17 00:00:00 2001
From: coolsnowwolf <coolsnowwolf@gmail.com>
Date: Tue, 20 Dec 2022 23:01:27 +0800
Subject: [PATCH 2/2] Revert "wifi: mt76: mt7921: introduce chanctx support"
This reverts commit 2575de3aea332837a0784629b11146efa1c55e58.
---
mt7921/init.c | 33 +++-----------
mt7921/mac.c | 8 ++++
mt7921/main.c | 111 ++----------------------------------------------
mt7921/mt7921.h | 1 -
mt7921/pci.c | 7 ---
mt7921/sdio.c | 7 ---
mt7921/usb.c | 7 ---
7 files changed, 17 insertions(+), 157 deletions(-)
diff --git a/mt7921/init.c b/mt7921/init.c
index 9bf5d9f0..c16aeab0 100644
--- a/mt7921/init.c
+++ b/mt7921/init.c
@@ -26,27 +26,6 @@ static const struct ieee80211_iface_combination if_comb[] = {
.max_interfaces = MT7921_MAX_INTERFACES,
.num_different_channels = 1,
.beacon_int_infra_match = true,
- },
-};
-
-static const struct ieee80211_iface_limit if_limits_chanctx[] = {
- {
- .max = 2,
- .types = BIT(NL80211_IFTYPE_STATION),
- },
- {
- .max = 1,
- .types = BIT(NL80211_IFTYPE_AP),
- }
-};
-
-static const struct ieee80211_iface_combination if_comb_chanctx[] = {
- {
- .limits = if_limits_chanctx,
- .n_limits = ARRAY_SIZE(if_limits_chanctx),
- .max_interfaces = 2,
- .num_different_channels = 2,
- .beacon_int_infra_match = false,
}
};
@@ -88,19 +67,17 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
hw->sta_data_size = sizeof(struct mt7921_sta);
hw->vif_data_size = sizeof(struct mt7921_vif);
- if (dev->fw_features & MT7921_FW_CAP_CNM) {
+ if (dev->fw_features & MT7921_FW_CAP_CNM)
wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
- wiphy->iface_combinations = if_comb_chanctx;
- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_chanctx);
- } else {
+ else
wiphy->flags &= ~WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
- wiphy->iface_combinations = if_comb;
- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
- }
+
+ wiphy->iface_combinations = if_comb;
wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
WIPHY_FLAG_4ADDR_STATION);
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_AP);
+ wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
wiphy->max_remain_on_channel_duration = 5000;
wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
wiphy->max_scan_ssids = 4;
diff --git a/mt7921/mac.c b/mt7921/mac.c
index 47f79f16..639614b0 100644
--- a/mt7921/mac.c
+++ b/mt7921/mac.c
@@ -168,6 +168,14 @@ static void
mt7921_get_status_freq_info(struct mt7921_dev *dev, struct mt76_phy *mphy,
struct mt76_rx_status *status, u8 chfreq)
{
+ if (!test_bit(MT76_HW_SCANNING, &mphy->state) &&
+ !test_bit(MT76_HW_SCHED_SCANNING, &mphy->state) &&
+ !test_bit(MT76_STATE_ROC, &mphy->state)) {
+ status->freq = mphy->chandef.chan->center_freq;
+ status->band = mphy->chandef.chan->band;
+ return;
+ }
+
if (chfreq > 180) {
status->band = NL80211_BAND_6GHZ;
chfreq = (chfreq - 181) * 4 + 1;
diff --git a/mt7921/main.c b/mt7921/main.c
index a1611590..1b7219e3 100644
--- a/mt7921/main.c
+++ b/mt7921/main.c
@@ -856,7 +856,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid,
- true, mvif->ctx);
+ true, NULL);
mt7921_mac_wtbl_update(dev, msta->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -889,7 +889,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (!sta->tdls)
mt76_connac_mcu_uni_add_bss(&dev->mphy, vif,
&mvif->sta.wcid, false,
- mvif->ctx);
+ NULL);
}
spin_lock_bh(&dev->sta_poll_lock);
@@ -1649,7 +1649,7 @@ mt7921_start_ap(struct ieee80211_hw *hw,
mt7921_mutex_acquire(dev);
err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid,
- true, mvif->ctx);
+ true, NULL);
if (err)
goto out;
@@ -1681,108 +1681,12 @@ mt7921_stop_ap(struct ieee80211_hw *hw,
goto out;
mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false,
- mvif->ctx);
+ NULL);
out:
mt7921_mutex_release(dev);
}
-static int
-mt7921_add_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_chanctx_conf *ctx)
-{
- return 0;
-}
-
-static void
-mt7921_remove_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_chanctx_conf *ctx)
-{
-}
-
-static void mt7921_ctx_iter(void *priv, u8 *mac,
- struct ieee80211_vif *vif)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct ieee80211_chanctx_conf *ctx = priv;
-
- if (ctx != mvif->ctx)
- return;
-
- mt76_connac_mcu_uni_set_chctx(mvif->phy->mt76, &mvif->mt76, ctx);
-}
-
-static void
-mt7921_change_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_chanctx_conf *ctx,
- u32 changed)
-{
- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-
- mt7921_mutex_acquire(phy->dev);
- ieee80211_iterate_active_interfaces(phy->mt76->hw,
- IEEE80211_IFACE_ITER_ACTIVE,
- mt7921_ctx_iter, ctx);
- mt7921_mutex_release(phy->dev);
-}
-
-static int
-mt7921_assign_vif_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *link_conf,
- struct ieee80211_chanctx_conf *ctx)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-
- mutex_lock(&dev->mt76.mutex);
- mvif->ctx = ctx;
- mutex_unlock(&dev->mt76.mutex);
-
- return 0;
-}
-
-static void
-mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *link_conf,
- struct ieee80211_chanctx_conf *ctx)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-
- mutex_lock(&dev->mt76.mutex);
- mvif->ctx = NULL;
- mutex_unlock(&dev->mt76.mutex);
-}
-
-static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_prep_tx_info *info)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct mt7921_dev *dev = mt7921_hw_dev(hw);
- u16 duration = info->duration ? info->duration :
- jiffies_to_msecs(HZ);
-
- mt7921_mutex_acquire(dev);
- mt7921_set_roc(mvif->phy, mvif, mvif->ctx->def.chan, duration,
- MT7921_ROC_REQ_JOIN);
- mt7921_mutex_release(dev);
-}
-
-static void mt7921_mgd_complete_tx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_prep_tx_info *info)
-{
- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-
- mt7921_mutex_acquire(dev);
- mt7921_abort_roc(mvif->phy, mvif);
- mt7921_mutex_release(dev);
-}
-
const struct ieee80211_ops mt7921_ops = {
.tx = mt7921_tx,
.start = mt7921_start,
@@ -1835,13 +1739,6 @@ const struct ieee80211_ops mt7921_ops = {
.set_sar_specs = mt7921_set_sar_specs,
.remain_on_channel = mt7921_remain_on_channel,
.cancel_remain_on_channel = mt7921_cancel_remain_on_channel,
- .add_chanctx = mt7921_add_chanctx,
- .remove_chanctx = mt7921_remove_chanctx,
- .change_chanctx = mt7921_change_chanctx,
- .assign_vif_chanctx = mt7921_assign_vif_chanctx,
- .unassign_vif_chanctx = mt7921_unassign_vif_chanctx,
- .mgd_prepare_tx = mt7921_mgd_prepare_tx,
- .mgd_complete_tx = mt7921_mgd_complete_tx,
};
EXPORT_SYMBOL_GPL(mt7921_ops);
diff --git a/mt7921/mt7921.h b/mt7921/mt7921.h
index efff4d43..0954ac6c 100644
--- a/mt7921/mt7921.h
+++ b/mt7921/mt7921.h
@@ -171,7 +171,6 @@ struct mt7921_vif {
struct ewma_rssi rssi;
struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
- struct ieee80211_chanctx_conf *ctx;
};
struct mib_stats {
diff --git a/mt7921/pci.c b/mt7921/pci.c
index d84dbdd1..fbb06f04 100644
--- a/mt7921/pci.c
+++ b/mt7921/pci.c
@@ -297,13 +297,6 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
if (!(features & MT7921_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
- ops->add_chanctx = NULL;
- ops->remove_chanctx = NULL;
- ops->change_chanctx = NULL;
- ops->assign_vif_chanctx = NULL;
- ops->unassign_vif_chanctx = NULL;
- ops->mgd_prepare_tx = NULL;
- ops->mgd_complete_tx = NULL;
}
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), ops, &drv_ops);
diff --git a/mt7921/sdio.c b/mt7921/sdio.c
index 3f8973fb..f6b35087 100644
--- a/mt7921/sdio.c
+++ b/mt7921/sdio.c
@@ -140,13 +140,6 @@ static int mt7921s_probe(struct sdio_func *func,
if (!(features & MT7921_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
- ops->add_chanctx = NULL;
- ops->remove_chanctx = NULL;
- ops->change_chanctx = NULL;
- ops->assign_vif_chanctx = NULL;
- ops->unassign_vif_chanctx = NULL;
- ops->mgd_prepare_tx = NULL;
- ops->mgd_complete_tx = NULL;
}
mdev = mt76_alloc_device(&func->dev, sizeof(*dev), ops, &drv_ops);
diff --git a/mt7921/usb.c b/mt7921/usb.c
index 5321d20d..8a49d3de 100644
--- a/mt7921/usb.c
+++ b/mt7921/usb.c
@@ -218,13 +218,6 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
if (!(features & MT7921_FW_CAP_CNM)) {
ops->remain_on_channel = NULL;
ops->cancel_remain_on_channel = NULL;
- ops->add_chanctx = NULL;
- ops->remove_chanctx = NULL;
- ops->change_chanctx = NULL;
- ops->assign_vif_chanctx = NULL;
- ops->unassign_vif_chanctx = NULL;
- ops->mgd_prepare_tx = NULL;
- ops->mgd_complete_tx = NULL;
}
ops->stop = mt7921u_stop;
--
2.17.1