2023-04-18 09:54:40

by Felix Fietkau

[permalink] [raw]
Subject: [PATCH 1/3] wifi: mt76: mt7615: increase eeprom size for mt7663

mt7663 efuse has 0x600 bytes instead of 0x400. Increase the size in order
to fix issues with incomplete calibration data

Signed-off-by: Felix Fietkau <[email protected]>
---
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c | 7 ++++++-
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h | 2 +-
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c
index 6dbaaf95ee38..68e88224b8b1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c
@@ -47,6 +47,9 @@ static int mt7615_efuse_init(struct mt7615_dev *dev, u32 base)
void *buf;
u32 val;

+ if (is_mt7663(&dev->mt76))
+ len = MT7663_EEPROM_SIZE;
+
val = mt76_rr(dev, base + MT_EFUSE_BASE_CTRL);
if (val & MT_EFUSE_BASE_CTRL_EMPTY)
return 0;
@@ -72,6 +75,8 @@ static int mt7615_eeprom_load(struct mt7615_dev *dev, u32 addr)
{
int ret;

+ BUILD_BUG_ON(MT7615_EEPROM_FULL_SIZE < MT7663_EEPROM_SIZE);
+
ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_FULL_SIZE);
if (ret < 0)
return ret;
@@ -336,7 +341,7 @@ int mt7615_eeprom_init(struct mt7615_dev *dev, u32 addr)
ret = mt7615_check_eeprom(&dev->mt76);
if (ret && dev->mt76.otp.data) {
memcpy(dev->mt76.eeprom.data, dev->mt76.otp.data,
- MT7615_EEPROM_SIZE);
+ dev->mt76.otp.size);
} else {
dev->flash_eeprom = true;
mt7615_cal_free_data(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h
index a024dee10362..a67fbb90f5b3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h
@@ -46,7 +46,7 @@ enum mt7615_eeprom_field {

MT7615_EE_MAX = 0x3bf,
MT7622_EE_MAX = 0x3db,
- MT7663_EE_MAX = 0x400,
+ MT7663_EE_MAX = 0x600,
};

#define MT_EE_RATE_POWER_MASK GENMASK(5, 0)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
index 932cdad7e7d4..0381c53bc96a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
@@ -51,6 +51,7 @@
#define MT7663_FIRMWARE_N9 "mediatek/mt7663_n9_rebb.bin"

#define MT7615_EEPROM_SIZE 1024
+#define MT7663_EEPROM_SIZE 1536
#define MT7615_TOKEN_SIZE 4096

#define MT_FRAC_SCALE 12
--
2.39.0


2023-04-18 09:55:20

by Felix Fietkau

[permalink] [raw]
Subject: [PATCH 2/3] wifi: mt76: dma: use napi_build_skb

Improves performance by using bulk allocation

Signed-off-by: Felix Fietkau <[email protected]>
---
drivers/net/wireless/mediatek/mt76/dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index 6c0174313d09..465190ebaf1c 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -853,7 +853,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
!(dev->drv->rx_check(dev, data, len)))
goto free_frag;

- skb = build_skb(data, q->buf_size);
+ skb = napi_build_skb(data, q->buf_size);
if (!skb)
goto free_frag;

--
2.39.0