Skip to content

Commit

Permalink
Merge pull request #109 from openwrtdiy/openwrt-23.05
Browse files Browse the repository at this point in the history
Synchronize official source code updates
  • Loading branch information
openwrtdiy authored May 8, 2024
2 parents 7703f67 + 06be957 commit 181b0d3
Show file tree
Hide file tree
Showing 15 changed files with 495 additions and 36 deletions.
56 changes: 52 additions & 4 deletions package/kernel/mt76/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=mt76
PKG_RELEASE=2
PKG_RELEASE=1

PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=

PKG_SOURCE_URL:=https://github.com/openwrt/mt76
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2023-09-11
PKG_SOURCE_VERSION:=f1e1e67d97d1e9a8bb01b59ab20c45ebc985a958
PKG_MIRROR_HASH:=41fde79de5bec3aaafdb64658475a1fa99bc483b8122e6aad9b2aa8aa8edfce6
PKG_SOURCE_DATE:=2023-12-08
PKG_SOURCE_VERSION:=f559adf1849c8af91f5a5eb670f4ed2c24988898
PKG_MIRROR_HASH:=74dde4478442d5f0edbae918636b40767b0e49181b732d4184feeccd8a8cc328

PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_USE_NINJA:=0
Expand Down Expand Up @@ -315,6 +315,38 @@ define KernelPackage/mt7921e
AUTOLOAD:=$(call AutoProbe,mt7921e)
endef

define KernelPackage/mt7996e
$(KernelPackage/mt76-default)
TITLE:=MediaTek MT7996E wireless driver
DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core
FILES:= $(PKG_BUILD_DIR)/mt7996/mt7996e.ko
AUTOLOAD:=$(call AutoProbe,mt7996e)
endef

define KernelPackage/mt7925-common
$(KernelPackage/mt76-default)
TITLE:=MediaTek MT7925 wireless driver common code
HIDDEN:=1
DEPENDS+=+kmod-mt792x-common +@DRIVER_11AX_SUPPORT +kmod-hwmon-core
FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925-common.ko
endef

define KernelPackage/mt7925u
$(KernelPackage/mt76-default)
TITLE:=MediaTek MT7925U wireless driver
DEPENDS+=+kmod-mt792x-usb +kmod-mt7925-common
FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925u.ko
AUTOLOAD:=$(call AutoProbe,mt7921u)
endef

define KernelPackage/mt7925e
$(KernelPackage/mt76-default)
TITLE:=MediaTek MT7925e wireless driver
DEPENDS+=@PCI_SUPPORT +kmod-mt7925-common
FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925e.ko
AUTOLOAD:=$(call AutoProbe,mt7921e)
endef

define Package/mt76-test
SECTION:=devel
CATEGORY:=Development
Expand Down Expand Up @@ -423,6 +455,18 @@ endif
ifdef CONFIG_PACKAGE_kmod-mt7921e
PKG_MAKE_FLAGS += CONFIG_MT7921E=m
endif
ifdef CONFIG_PACKAGE_kmod-mt7996e
PKG_MAKE_FLAGS += CONFIG_MT7996E=m
endif
ifdef CONFIG_PACKAGE_kmod-mt7925-common
PKG_MAKE_FLAGS += CONFIG_MT7925_COMMON=m
endif
ifdef CONFIG_PACKAGE_kmod-mt7925u
PKG_MAKE_FLAGS += CONFIG_MT7925U=m
endif
ifdef CONFIG_PACKAGE_kmod-mt7925e
PKG_MAKE_FLAGS += CONFIG_MT7925E=m
endif

define Build/Compile
+$(KERNEL_MAKE) $(PKG_JOBS) \
Expand Down Expand Up @@ -603,8 +647,12 @@ $(eval $(call KernelPackage,mt7922-firmware))
$(eval $(call KernelPackage,mt792x-common))
$(eval $(call KernelPackage,mt792x-usb))
$(eval $(call KernelPackage,mt7921-common))
$(eval $(call KernelPackage,mt7925-common))
$(eval $(call KernelPackage,mt7921u))
$(eval $(call KernelPackage,mt7921s))
$(eval $(call KernelPackage,mt7921e))
$(eval $(call KernelPackage,mt7925u))
$(eval $(call KernelPackage,mt7925e))
$(eval $(call KernelPackage,mt7996e))
$(eval $(call KernelPackage,mt76))
$(eval $(call BuildPackage,mt76-test))

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From f63f87cd5b45c3779293e6062c6b26bdf57e851d Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Sat, 9 Dec 2023 22:44:57 +0100
Subject: [PATCH] wifi: mt76: mt7996: fix shift overflow warning on 32 bit
systems

Fix additional shift overflow warning on 32 bit systems for mt7996 mac.c
source.

Fixes: 95c14207d2a9 ("wifi: mt76: mt7996: set DMA mask to 36 bits for boards with more than 4GB of RAM")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
mt7996/mac.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -942,9 +942,13 @@ int mt7996_tx_prepare_skb(struct mt76_de

txp = (struct mt76_connac_txp_common *)(txwi + MT_TXD_SIZE);
for (i = 0; i < nbuf; i++) {
- u16 len = FIELD_PREP(MT_TXP_BUF_LEN, tx_info->buf[i + 1].len) |
- FIELD_PREP(MT_TXP_DMA_ADDR_H,
- tx_info->buf[i + 1].addr >> 32);
+ u16 len;
+
+ len = FIELD_PREP(MT_TXP_BUF_LEN, tx_info->buf[i + 1].len);
+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
+ len |= FIELD_PREP(MT_TXP_DMA_ADDR_H,
+ tx_info->buf[i + 1].addr >> 32);
+#endif

txp->fw.buf[i] = cpu_to_le32(tx_info->buf[i + 1].addr);
txp->fw.len[i] = cpu_to_le16(len);
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From bebd9cffc2aeb2cecb40aadbb8c6eab3bdf7971b Mon Sep 17 00:00:00 2001
From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Date: Mon, 30 Oct 2023 15:17:34 +0800
Subject: [PATCH] wifi: mt76: mt7921: fix 6GHz disabled by the missing default
CLC config

No matter CLC is enabled or disabled, the driver should initialize
the default value 0xff for channel configuration of CLC. Otherwise,
the zero value would disable channels.

Reported-and-tested-by: Ben Greear <greearb@candelatech.com>
Closes: https://lore.kernel.org/all/2fb78387-d226-3193-8ca7-90040561b9ad@candelatech.com/
Fixes: 09382d8f8641 ("wifi: mt76: mt7921: update the channel usage when the regd domain changed")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/5a976ddf1f636b5cb809373501d3cfdc6d8de3e4.1698648737.git.deren.wu@mediatek.com
---
mt7921/mcu.c | 1 +
1 file changed, 1 insertion(+)

--- a/mt7921/mcu.c
+++ b/mt7921/mcu.c
@@ -375,6 +375,7 @@ static int mt7921_load_clc(struct mt792x
int ret, i, len, offset = 0;
u8 *clc_base = NULL, hw_encap = 0;

+ dev->phy.clc_chan_conf = 0xff;
if (mt7921_disable_clc ||
mt76_is_usb(&dev->mt76))
return 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 786a339bac36d8e53eb8b540e79221d20011ab2a Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Sat, 3 Feb 2024 14:21:58 +0100
Subject: [PATCH] wifi: mt76: mt7996: fix fortify warning

Copy cck and ofdm separately in order to avoid __read_overflow2_field
warning.

Fixes: f75e4779d215 ("wifi: mt76: mt7996: add txpower setting support")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
mt7996/mcu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -4477,7 +4477,8 @@ int mt7996_mcu_set_txpower_sku(struct mt

skb_put_data(skb, &req, sizeof(req));
/* cck and ofdm */
- skb_put_data(skb, &la.cck, sizeof(la.cck) + sizeof(la.ofdm));
+ skb_put_data(skb, &la.cck, sizeof(la.cck));
+ skb_put_data(skb, &la.ofdm, sizeof(la.ofdm));
/* ht20 */
skb_put_data(skb, &la.mcs[0], 8);
/* ht40 */
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From bc37a7ebc267e400fc4e9886b7197b4b866763d1 Mon Sep 17 00:00:00 2001
From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Thu, 21 Dec 2023 10:41:18 +0100
Subject: [PATCH] wifi: mt76: mt7996: fix fw loading timeout

Fix the following firmware loading error due to a wrong dma register
configuration if wed is disabled.

[ 8.245881] mt7996e_hif 0001:01:00.0: assign IRQ: got 128
[ 8.251308] mt7996e_hif 0001:01:00.0: enabling device (0000 -> 0002)
[ 8.257674] mt7996e_hif 0001:01:00.0: enabling bus mastering
[ 8.263488] mt7996e 0000:01:00.0: assign IRQ: got 126
[ 8.268537] mt7996e 0000:01:00.0: enabling device (0000 -> 0002)
[ 8.274551] mt7996e 0000:01:00.0: enabling bus mastering
[ 28.648773] mt7996e 0000:01:00.0: Message 00000010 (seq 1) timeout
[ 28.654959] mt7996e 0000:01:00.0: Failed to get patch semaphore
[ 29.661033] mt7996e: probe of 0000:01:00.0 failed with error -11

Suggested-by: Sujuan Chen" <sujuan.chen@mediatek.com>
Fixes: 4920a3a1285f ("wifi: mt76: mt7996: set DMA mask to 36 bits for boards with more than 4GB of RAM")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
mt7996/dma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/mt7996/dma.c
+++ b/mt7996/dma.c
@@ -237,7 +237,8 @@ void mt7996_dma_start(struct mt7996_dev
MT_WFDMA0_GLO_CFG_TX_DMA_EN |
MT_WFDMA0_GLO_CFG_RX_DMA_EN |
MT_WFDMA0_GLO_CFG_OMIT_TX_INFO |
- MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2);
+ MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2 |
+ MT_WFDMA0_GLO_CFG_EXT_EN);

if (dev->hif2)
mt76_set(dev, MT_WFDMA0_GLO_CFG + hif1_ofs,
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
From 025d5734caba6fa1fd96b57c19c61e42e601815b Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 26 Jan 2024 17:09:12 +0800
Subject: [PATCH] wifi: mt76: mt7996: check txs format before getting skb by
pid

The PPDU TXS does not include the error bit so it cannot use to report
status to mac80211. This patch fixes issue that STA wrongly detects if AP
is still alive.

Fixes: 2569ea5326e2 ("wifi: mt76: mt7996: enable PPDU-TxS to host")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
mt7996/mac.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)

--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -1188,25 +1188,28 @@ mt7996_mac_add_txs_skb(struct mt7996_dev
struct ieee80211_tx_info *info;
struct sk_buff_head list;
struct rate_info rate = {};
- struct sk_buff *skb;
+ struct sk_buff *skb = NULL;
bool cck = false;
u32 txrate, txs, mode, stbc;

txs = le32_to_cpu(txs_data[0]);

mt76_tx_status_lock(mdev, &list);
- skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);

- if (skb) {
- info = IEEE80211_SKB_CB(skb);
- if (!(txs & MT_TXS0_ACK_ERROR_MASK))
- info->flags |= IEEE80211_TX_STAT_ACK;
-
- info->status.ampdu_len = 1;
- info->status.ampdu_ack_len =
- !!(info->flags & IEEE80211_TX_STAT_ACK);
+ /* only report MPDU TXS */
+ if (le32_get_bits(txs_data[0], MT_TXS0_TXS_FORMAT) == 0) {
+ skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
+ if (skb) {
+ info = IEEE80211_SKB_CB(skb);
+ if (!(txs & MT_TXS0_ACK_ERROR_MASK))
+ info->flags |= IEEE80211_TX_STAT_ACK;
+
+ info->status.ampdu_len = 1;
+ info->status.ampdu_ack_len =
+ !!(info->flags & IEEE80211_TX_STAT_ACK);

- info->status.rates[0].idx = -1;
+ info->status.rates[0].idx = -1;
+ }
}

if (mtk_wed_device_active(&dev->mt76.mmio.wed) && wcid->sta) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From d75eac9f5531e484fbbabf2652922976e15a7a7a Mon Sep 17 00:00:00 2001
From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Date: Tue, 16 Jan 2024 10:48:54 +0800
Subject: [PATCH] wifi: mt76: mt7921: fix incorrect type conversion for CLC
command

clc->len is defined as 32 bits in length, so it must also be
operated on with 32 bits, not 16 bits.

Fixes: fa6ad88e023d ("wifi: mt76: mt7921: fix country count limitation for CLC")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312112104.Zkc3QUHr-lkp@intel.com/
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
mt7921/mcu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mt7921/mcu.c
+++ b/mt7921/mcu.c
@@ -1272,7 +1272,7 @@ int __mt7921_mcu_set_clc(struct mt792x_d
.mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2),
};
int ret, valid_cnt = 0;
- u16 buf_len = 0;
+ u32 buf_len = 0;
u8 *pos;

if (!clc)
@@ -1283,7 +1283,7 @@ int __mt7921_mcu_set_clc(struct mt792x_d
if (mt76_find_power_limits_node(&dev->mt76))
req.cap |= CLC_CAP_DTS_EN;

- buf_len = le16_to_cpu(clc->len) - sizeof(*clc);
+ buf_len = le32_to_cpu(clc->len) - sizeof(*clc);
pos = clc->data;
while (buf_len > 16) {
struct mt7921_clc_rule *rule = (struct mt7921_clc_rule *)pos;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 841bf82e99581f648325bee570de98892cad894f Mon Sep 17 00:00:00 2001
From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Date: Wed, 7 Feb 2024 11:31:23 +0800
Subject: [PATCH] wifi: mt76: fix the issue of missing txpwr settings from
ch153 to ch177

Because the number of channels to be configured is calculated using the %,
and it results in 0 when there's an exact division, this leads to some
channels not having their tx power configured.

Fixes: 7801da338856 ("wifi: mt76: mt7921: enable set txpower for UNII-4")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
mt76_connac_mcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -2101,7 +2101,7 @@ mt76_connac_mcu_rate_txpower_band(struct
int j, msg_len, num_ch;
struct sk_buff *skb;

- num_ch = i == batch_size - 1 ? n_chan % batch_len : batch_len;
+ num_ch = i == batch_size - 1 ? n_chan - i * batch_len : batch_len;
msg_len = sizeof(tx_power_tlv) + num_ch * sizeof(sku_tlbv);
skb = mt76_mcu_msg_alloc(dev, NULL, msg_len);
if (!skb) {
Loading

0 comments on commit 181b0d3

Please sign in to comment.