* [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2
@ 2018-10-15 9:33 Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 1/6] mt76x0: pci: add get_survey support Lorenzo Bianconi
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-10-15 9:33 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Unify debugfs implementation between mt76x0 and mt76x2 drivers.
Add get_survey support to mt76x0e driver
Add mac work support to mt76x2u driver
Lorenzo Bianconi (6):
mt76x0: pci: add get_survey support
mt76: move mt76x02_mac_work routine in mt76x02-lib module
mt76: move mt76x02_debugfs in mt76x02-lib module
mt76x0: use shared debugfs implementation
mt76x0: use mt76x02_mac_work as stats handler
mt76x2u: introduce mac workqueue support
drivers/net/wireless/mediatek/mt76/Makefile | 2 +-
.../wireless/mediatek/mt76/mt76x0/Makefile | 4 +-
.../wireless/mediatek/mt76/mt76x0/debugfs.c | 87 -------------------
.../net/wireless/mediatek/mt76/mt76x0/init.c | 5 +-
.../net/wireless/mediatek/mt76/mt76x0/mac.c | 66 --------------
.../net/wireless/mediatek/mt76/mt76x0/main.c | 5 ++
.../wireless/mediatek/mt76/mt76x0/mt76x0.h | 5 --
.../net/wireless/mediatek/mt76/mt76x0/pci.c | 2 +
drivers/net/wireless/mediatek/mt76/mt76x02.h | 12 +--
.../{mt76x2/debugfs.c => mt76x02_debugfs.c} | 22 ++---
.../net/wireless/mediatek/mt76/mt76x02_mac.c | 56 ++++++++++++
.../net/wireless/mediatek/mt76/mt76x02_mac.h | 2 +
.../wireless/mediatek/mt76/mt76x2/Makefile | 2 +-
.../net/wireless/mediatek/mt76/mt76x2/init.c | 2 +
.../net/wireless/mediatek/mt76/mt76x2/mac.h | 2 -
.../wireless/mediatek/mt76/mt76x2/mt76x2.h | 5 --
.../wireless/mediatek/mt76/mt76x2/pci_init.c | 5 +-
.../wireless/mediatek/mt76/mt76x2/pci_mac.c | 35 --------
.../wireless/mediatek/mt76/mt76x2/usb_init.c | 3 +-
.../wireless/mediatek/mt76/mt76x2/usb_main.c | 2 +
20 files changed, 93 insertions(+), 231 deletions(-)
delete mode 100644 drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
rename drivers/net/wireless/mediatek/mt76/{mt76x2/debugfs.c => mt76x02_debugfs.c} (86%)
--
2.19.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/6] mt76x0: pci: add get_survey support
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
@ 2018-10-15 9:33 ` Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 2/6] mt76: move mt76x02_mac_work routine in mt76x02-lib module Lorenzo Bianconi
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-10-15 9:33 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Move mt76x02_update_channel routine in mt76x02-lib module in
order to be reused by mt76x0 driver adding get_survey support
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
.../net/wireless/mediatek/mt76/mt76x0/mac.c | 2 ++
.../net/wireless/mediatek/mt76/mt76x0/main.c | 5 +++++
.../net/wireless/mediatek/mt76/mt76x0/pci.c | 2 ++
.../net/wireless/mediatek/mt76/mt76x02_mac.c | 18 ++++++++++++++++++
.../net/wireless/mediatek/mt76/mt76x02_mac.h | 1 +
.../wireless/mediatek/mt76/mt76x2/mt76x2.h | 2 --
.../wireless/mediatek/mt76/mt76x2/pci_init.c | 2 +-
.../wireless/mediatek/mt76/mt76x2/pci_mac.c | 19 +------------------
8 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c b/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c
index 7a422c590211..9cabe8ebf5da 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c
@@ -137,6 +137,8 @@ void mt76x0_mac_work(struct work_struct *work)
u32 sum, n;
int i, j, k;
+ mt76x02_update_channel(&dev->mt76);
+
/* Note: using MCU_RANDOM_READ is actually slower then reading all the
* registers by hand. MCU takes ca. 20ms to complete read of 24
* registers while reading them one by one will takes roughly
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index 9273d2d2764a..e9fbbabbe7e0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -25,6 +25,11 @@ mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
mt76_set_channel(&dev->mt76);
ret = mt76x0_phy_set_channel(dev, chandef);
+
+ /* channel cycle counters read-and-clear */
+ mt76_rr(dev, MT_CH_IDLE);
+ mt76_rr(dev, MT_CH_BUSY);
+
mt76_txq_schedule_all(&dev->mt76);
return ret;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
index 522c86059bcb..3277e6b07a46 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
@@ -85,6 +85,7 @@ static const struct ieee80211_ops mt76x0e_ops = {
.ampdu_action = mt76x02_ampdu_action,
.sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
.wake_tx_queue = mt76_wake_tx_queue,
+ .get_survey = mt76_get_survey,
};
static int mt76x0e_register_device(struct mt76x02_dev *dev)
@@ -135,6 +136,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
static const struct mt76_driver_ops drv_ops = {
.txwi_size = sizeof(struct mt76x02_txwi),
+ .update_survey = mt76x02_update_channel,
.tx_prepare_skb = mt76x02_tx_prepare_skb,
.tx_complete_skb = mt76x02_tx_complete_skb,
.rx_skb = mt76x02_queue_rx_skb,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index 10578e4cb269..e6d6ddaa5a07 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -735,3 +735,21 @@ void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
dev_kfree_skb_any(e->skb);
}
EXPORT_SYMBOL_GPL(mt76x02_tx_complete_skb);
+
+void mt76x02_update_channel(struct mt76_dev *mdev)
+{
+ struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
+ struct mt76_channel_state *state;
+ u32 active, busy;
+
+ state = mt76_channel_state(&dev->mt76, dev->mt76.chandef.chan);
+
+ busy = mt76_rr(dev, MT_CH_BUSY);
+ active = busy + mt76_rr(dev, MT_CH_IDLE);
+
+ spin_lock_bh(&dev->mt76.cc_lock);
+ state->cc_busy += busy;
+ state->cc_active += active;
+ spin_unlock_bh(&dev->mt76.cc_lock);
+}
+EXPORT_SYMBOL_GPL(mt76x02_update_channel);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
index d99c18743969..6bce18bcbf36 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
@@ -226,4 +226,5 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq);
void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
struct mt76_queue_entry *e, bool flush);
+void mt76x02_update_channel(struct mt76_dev *mdev);
#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
index be0ae24d310a..72c365040be1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
@@ -85,8 +85,6 @@ void mt76x2_pre_tbtt_tasklet(unsigned long arg);
void mt76x2_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps);
-void mt76x2_update_channel(struct mt76_dev *mdev);
-
void mt76x2_reset_wlan(struct mt76x02_dev *dev, bool enable);
void mt76x2_init_txpower(struct mt76x02_dev *dev,
struct ieee80211_supported_band *sband);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index 3824290b219d..279edc612119 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -354,7 +354,7 @@ struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev)
{
static const struct mt76_driver_ops drv_ops = {
.txwi_size = sizeof(struct mt76x02_txwi),
- .update_survey = mt76x2_update_channel,
+ .update_survey = mt76x02_update_channel,
.tx_prepare_skb = mt76x02_tx_prepare_skb,
.tx_complete_skb = mt76x02_tx_complete_skb,
.rx_skb = mt76x02_queue_rx_skb,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c
index 4b331ed14bb2..15620d4d425e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c
@@ -137,30 +137,13 @@ void mt76x2_mac_set_beacon_enable(struct mt76x02_dev *dev,
mt76x02_irq_disable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT);
}
-void mt76x2_update_channel(struct mt76_dev *mdev)
-{
- struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
- struct mt76_channel_state *state;
- u32 active, busy;
-
- state = mt76_channel_state(&dev->mt76, dev->mt76.chandef.chan);
-
- busy = mt76_rr(dev, MT_CH_BUSY);
- active = busy + mt76_rr(dev, MT_CH_IDLE);
-
- spin_lock_bh(&dev->mt76.cc_lock);
- state->cc_busy += busy;
- state->cc_active += active;
- spin_unlock_bh(&dev->mt76.cc_lock);
-}
-
void mt76x2_mac_work(struct work_struct *work)
{
struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev,
mac_work.work);
int i, idx;
- mt76x2_update_channel(&dev->mt76);
+ mt76x02_update_channel(&dev->mt76);
for (i = 0, idx = 0; i < 16; i++) {
u32 val = mt76_rr(dev, MT_TX_AGG_CNT(i));
--
2.19.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] mt76: move mt76x02_mac_work routine in mt76x02-lib module
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 1/6] mt76x0: pci: add get_survey support Lorenzo Bianconi
@ 2018-10-15 9:33 ` Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 3/6] mt76: move mt76x02_debugfs " Lorenzo Bianconi
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-10-15 9:33 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Move mt76x02_mac_work routine in mt76x02_mac.c in order to be reused by
mt76x0 driver to read device statistics
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
.../wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 --
drivers/net/wireless/mediatek/mt76/mt76x02.h | 2 ++
.../net/wireless/mediatek/mt76/mt76x02_mac.c | 19 +++++++++++++++++++
.../net/wireless/mediatek/mt76/mt76x02_mac.h | 1 +
.../net/wireless/mediatek/mt76/mt76x2/mac.h | 2 --
.../wireless/mediatek/mt76/mt76x2/mt76x2.h | 2 --
.../wireless/mediatek/mt76/mt76x2/pci_init.c | 2 +-
.../wireless/mediatek/mt76/mt76x2/pci_mac.c | 18 ------------------
8 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index f27335ccb582..17fc7206c55d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -28,8 +28,6 @@
#include "../mt76x02.h"
#include "eeprom.h"
-#define MT_CALIBRATE_INTERVAL (4 * HZ)
-
#define MT_USB_AGGR_SIZE_LIMIT 21 /* * 1024B */
#define MT_USB_AGGR_TIMEOUT 0x80 /* * 33ns */
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 47c42c607964..189c697973bd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -26,6 +26,8 @@
#include "mt76x02_dfs.h"
#include "mt76x02_dma.h"
+#define MT_CALIBRATE_INTERVAL HZ
+
struct mt76x02_mac_stats {
u64 rx_stat[6];
u64 tx_stat[6];
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index e6d6ddaa5a07..c7666f4c432f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -753,3 +753,22 @@ void mt76x02_update_channel(struct mt76_dev *mdev)
spin_unlock_bh(&dev->mt76.cc_lock);
}
EXPORT_SYMBOL_GPL(mt76x02_update_channel);
+
+void mt76x02_mac_work(struct work_struct *work)
+{
+ struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev,
+ mac_work.work);
+ int i, idx;
+
+ mt76x02_update_channel(&dev->mt76);
+ for (i = 0, idx = 0; i < 16; i++) {
+ u32 val = mt76_rr(dev, MT_TX_AGG_CNT(i));
+
+ dev->aggr_stats[idx++] += val & 0xffff;
+ dev->aggr_stats[idx++] += val >> 16;
+ }
+
+ ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
+ MT_CALIBRATE_INTERVAL);
+}
+EXPORT_SYMBOL_GPL(mt76x02_mac_work);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
index 6bce18bcbf36..c1936e2277d1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
@@ -227,4 +227,5 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq);
void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
struct mt76_queue_entry *e, bool flush);
void mt76x02_update_channel(struct mt76_dev *mdev);
+void mt76x02_mac_work(struct work_struct *work);
#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/mac.h b/drivers/net/wireless/mediatek/mt76/mt76x2/mac.h
index a31bd49ae6cb..2dc2b9d5dc8f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/mac.h
@@ -32,6 +32,4 @@ int mt76x2_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
struct sk_buff *skb);
void mt76x2_mac_set_beacon_enable(struct mt76x02_dev *dev, u8 vif_idx, bool val);
-void mt76x2_mac_work(struct work_struct *work);
-
#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
index 72c365040be1..eca142ac656d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
@@ -31,8 +31,6 @@
#define MT7662_ROM_PATCH "mt7662_rom_patch.bin"
#define MT7662_EEPROM_SIZE 512
-#define MT_CALIBRATE_INTERVAL HZ
-
#include "../mt76x02.h"
#include "mac.h"
#include "dfs.h"
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index 279edc612119..0dea7d7b17a3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -467,7 +467,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev)
int i, ret;
INIT_DELAYED_WORK(&dev->cal_work, mt76x2_phy_calibrate);
- INIT_DELAYED_WORK(&dev->mac_work, mt76x2_mac_work);
+ INIT_DELAYED_WORK(&dev->mac_work, mt76x02_mac_work);
mt76x2_init_device(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c
index 15620d4d425e..97128ea6bd7a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c
@@ -137,24 +137,6 @@ void mt76x2_mac_set_beacon_enable(struct mt76x02_dev *dev,
mt76x02_irq_disable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT);
}
-void mt76x2_mac_work(struct work_struct *work)
-{
- struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev,
- mac_work.work);
- int i, idx;
-
- mt76x02_update_channel(&dev->mt76);
- for (i = 0, idx = 0; i < 16; i++) {
- u32 val = mt76_rr(dev, MT_TX_AGG_CNT(i));
-
- dev->aggr_stats[idx++] += val & 0xffff;
- dev->aggr_stats[idx++] += val >> 16;
- }
-
- ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
- MT_CALIBRATE_INTERVAL);
-}
-
void mt76x2_mac_set_tx_protection(struct mt76x02_dev *dev, u32 val)
{
u32 data = 0;
--
2.19.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] mt76: move mt76x02_debugfs in mt76x02-lib module
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 1/6] mt76x0: pci: add get_survey support Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 2/6] mt76: move mt76x02_mac_work routine in mt76x02-lib module Lorenzo Bianconi
@ 2018-10-15 9:33 ` Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 4/6] mt76x0: use shared debugfs implementation Lorenzo Bianconi
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-10-15 9:33 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Move mt76x02_debugfs in mt76x02-lib module in order to
be reused by mt76x0 driver and remove duplicated code
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
drivers/net/wireless/mediatek/mt76/Makefile | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x02.h | 2 ++
.../{mt76x2/debugfs.c => mt76x02_debugfs.c} | 22 +++++++++----------
.../wireless/mediatek/mt76/mt76x2/Makefile | 2 +-
.../wireless/mediatek/mt76/mt76x2/mt76x2.h | 1 -
.../wireless/mediatek/mt76/mt76x2/pci_init.c | 2 +-
.../wireless/mediatek/mt76/mt76x2/usb_init.c | 2 +-
7 files changed, 17 insertions(+), 16 deletions(-)
rename drivers/net/wireless/mediatek/mt76/{mt76x2/debugfs.c => mt76x02_debugfs.c} (86%)
diff --git a/drivers/net/wireless/mediatek/mt76/Makefile b/drivers/net/wireless/mediatek/mt76/Makefile
index 9b8d7488c545..a737a518802f 100644
--- a/drivers/net/wireless/mediatek/mt76/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/Makefile
@@ -14,7 +14,7 @@ CFLAGS_mt76x02_trace.o := -I$(src)
mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \
mt76x02_eeprom.o mt76x02_phy.o mt76x02_mmio.o \
- mt76x02_txrx.o mt76x02_trace.o
+ mt76x02_txrx.o mt76x02_trace.o mt76x02_debugfs.o
mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 189c697973bd..58721307d917 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -162,6 +162,8 @@ void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev);
void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set);
void mt76x02_mac_start(struct mt76x02_dev *dev);
+void mt76x02_init_debugfs(struct mt76x02_dev *dev);
+
static inline bool is_mt76x2(struct mt76x02_dev *dev)
{
return mt76_chip(&dev->mt76) == 0x7612 ||
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
similarity index 86%
rename from drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c
rename to drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
index e8f8ccc0a5ed..a9d52ba1e270 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
@@ -15,10 +15,10 @@
*/
#include <linux/debugfs.h>
-#include "mt76x2.h"
+#include "mt76x02.h"
static int
-mt76x2_ampdu_stat_read(struct seq_file *file, void *data)
+mt76x02_ampdu_stat_read(struct seq_file *file, void *data)
{
struct mt76x02_dev *dev = file->private;
int i, j;
@@ -42,9 +42,9 @@ mt76x2_ampdu_stat_read(struct seq_file *file, void *data)
}
static int
-mt76x2_ampdu_stat_open(struct inode *inode, struct file *f)
+mt76x02_ampdu_stat_open(struct inode *inode, struct file *f)
{
- return single_open(f, mt76x2_ampdu_stat_read, inode->i_private);
+ return single_open(f, mt76x02_ampdu_stat_read, inode->i_private);
}
static int read_txpower(struct seq_file *file, void *data)
@@ -59,14 +59,14 @@ static int read_txpower(struct seq_file *file, void *data)
}
static const struct file_operations fops_ampdu_stat = {
- .open = mt76x2_ampdu_stat_open,
+ .open = mt76x02_ampdu_stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int
-mt76x2_dfs_stat_read(struct seq_file *file, void *data)
+mt76x02_dfs_stat_read(struct seq_file *file, void *data)
{
struct mt76x02_dev *dev = file->private;
struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd;
@@ -92,13 +92,13 @@ mt76x2_dfs_stat_read(struct seq_file *file, void *data)
}
static int
-mt76x2_dfs_stat_open(struct inode *inode, struct file *f)
+mt76x02_dfs_stat_open(struct inode *inode, struct file *f)
{
- return single_open(f, mt76x2_dfs_stat_read, inode->i_private);
+ return single_open(f, mt76x02_dfs_stat_read, inode->i_private);
}
static const struct file_operations fops_dfs_stat = {
- .open = mt76x2_dfs_stat_open,
+ .open = mt76x02_dfs_stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
@@ -116,7 +116,7 @@ static int read_agc(struct seq_file *file, void *data)
return 0;
}
-void mt76x2_init_debugfs(struct mt76x02_dev *dev)
+void mt76x02_init_debugfs(struct mt76x02_dev *dev)
{
struct dentry *dir;
@@ -134,4 +134,4 @@ void mt76x2_init_debugfs(struct mt76x02_dev *dev)
debugfs_create_devm_seqfile(dev->mt76.dev, "agc", dir, read_agc);
}
-EXPORT_SYMBOL_GPL(mt76x2_init_debugfs);
+EXPORT_SYMBOL_GPL(mt76x02_init_debugfs);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/Makefile b/drivers/net/wireless/mediatek/mt76/mt76x2/Makefile
index b71bb1049170..696f071f47f8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_MT76x2E) += mt76x2e.o
obj-$(CONFIG_MT76x2U) += mt76x2u.o
mt76x2-common-y := \
- eeprom.o mac.o init.o phy.o debugfs.o mcu.o
+ eeprom.o mac.o init.o phy.o mcu.o
mt76x2e-y := \
pci.o pci_main.o pci_init.o pci_tx.o \
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
index eca142ac656d..7408db788409 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
@@ -52,7 +52,6 @@ extern const struct ieee80211_ops mt76x2_ops;
struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev);
int mt76x2_register_device(struct mt76x02_dev *dev);
-void mt76x2_init_debugfs(struct mt76x02_dev *dev);
void mt76x2_init_device(struct mt76x02_dev *dev);
void mt76x2_phy_power_on(struct mt76x02_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index 0dea7d7b17a3..5b167aaaf7f7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -515,7 +515,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev)
if (ret)
goto fail;
- mt76x2_init_debugfs(dev);
+ mt76x02_init_debugfs(dev);
mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband);
mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
index 13cce2937573..dfc80ecfde92 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
@@ -282,7 +282,7 @@ int mt76x2u_register_device(struct mt76x02_dev *dev)
set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
- mt76x2_init_debugfs(dev);
+ mt76x02_init_debugfs(dev);
mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband);
mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband);
--
2.19.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] mt76x0: use shared debugfs implementation
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
` (2 preceding siblings ...)
2018-10-15 9:33 ` [PATCH 3/6] mt76: move mt76x02_debugfs " Lorenzo Bianconi
@ 2018-10-15 9:33 ` Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 5/6] mt76x0: use mt76x02_mac_work as stats handler Lorenzo Bianconi
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-10-15 9:33 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Use mt76x02 debugfs implementation and remove duplicated code
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
.../wireless/mediatek/mt76/mt76x0/Makefile | 4 +-
.../wireless/mediatek/mt76/mt76x0/debugfs.c | 87 -------------------
.../net/wireless/mediatek/mt76/mt76x0/init.c | 2 +-
.../wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 -
4 files changed, 3 insertions(+), 92 deletions(-)
delete mode 100644 drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/Makefile b/drivers/net/wireless/mediatek/mt76/mt76x0/Makefile
index 20672978dceb..e49cbf6be945 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/Makefile
@@ -3,8 +3,8 @@ obj-$(CONFIG_MT76x0E) += mt76x0e.o
obj-$(CONFIG_MT76x0_COMMON) += mt76x0-common.o
mt76x0-common-y := \
- init.o main.o trace.o eeprom.o phy.o \
- mac.o debugfs.o
+ init.o main.o trace.o eeprom.o phy.o mac.o
+
mt76x0u-y := usb.o usb_mcu.o
mt76x0e-y := pci.o pci_mcu.o
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
deleted file mode 100644
index 3224e5b1a1e5..000000000000
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
- * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
- * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <linux/debugfs.h>
-
-#include "mt76x0.h"
-#include "eeprom.h"
-
-static int
-mt76x0_ampdu_stat_read(struct seq_file *file, void *data)
-{
- struct mt76x02_dev *dev = file->private;
- int i, j;
-
-#define stat_printf(grp, off, name) \
- seq_printf(file, #name ":\t%llu\n", dev->stats.grp[off])
-
- stat_printf(rx_stat, 0, rx_crc_err);
- stat_printf(rx_stat, 1, rx_phy_err);
- stat_printf(rx_stat, 2, rx_false_cca);
- stat_printf(rx_stat, 3, rx_plcp_err);
- stat_printf(rx_stat, 4, rx_fifo_overflow);
- stat_printf(rx_stat, 5, rx_duplicate);
-
- stat_printf(tx_stat, 0, tx_fail_cnt);
- stat_printf(tx_stat, 1, tx_bcn_cnt);
- stat_printf(tx_stat, 2, tx_success);
- stat_printf(tx_stat, 3, tx_retransmit);
- stat_printf(tx_stat, 4, tx_zero_len);
- stat_printf(tx_stat, 5, tx_underflow);
-
- stat_printf(aggr_stat, 0, non_aggr_tx);
- stat_printf(aggr_stat, 1, aggr_tx);
-
- stat_printf(zero_len_del, 0, tx_zero_len_del);
- stat_printf(zero_len_del, 1, rx_zero_len_del);
-#undef stat_printf
-
- seq_puts(file, "Aggregations stats:\n");
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 8; j++)
- seq_printf(file, "%08llx ",
- dev->stats.aggr_n[i * 8 + j]);
- seq_putc(file, '\n');
- }
-
- seq_printf(file, "recent average AMPDU len: %d\n",
- atomic_read(&dev->avg_ampdu_len));
-
- return 0;
-}
-
-static int
-mt76x0_ampdu_stat_open(struct inode *inode, struct file *f)
-{
- return single_open(f, mt76x0_ampdu_stat_read, inode->i_private);
-}
-
-static const struct file_operations fops_ampdu_stat = {
- .open = mt76x0_ampdu_stat_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-void mt76x0_init_debugfs(struct mt76x02_dev *dev)
-{
- struct dentry *dir;
-
- dir = mt76_register_debugfs(&dev->mt76);
- if (!dir)
- return;
-
- debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat);
-}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
index d7d4dfbbd04d..f90ef4d803d5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
@@ -389,7 +389,7 @@ int mt76x0_register_device(struct mt76x02_dev *dev)
if (mdev->cap.has_5ghz)
mt76x0_vht_cap_mask(&dev->mt76.sband_5g.sband);
- mt76x0_init_debugfs(dev);
+ mt76x02_init_debugfs(dev);
return 0;
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index 17fc7206c55d..b9743b575099 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -37,8 +37,6 @@ static inline bool is_mt7610e(struct mt76x02_dev *dev)
return false;
}
-void mt76x0_init_debugfs(struct mt76x02_dev *dev);
-
/* Init */
struct mt76x02_dev *
mt76x0_alloc_device(struct device *pdev,
--
2.19.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/6] mt76x0: use mt76x02_mac_work as stats handler
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
` (3 preceding siblings ...)
2018-10-15 9:33 ` [PATCH 4/6] mt76x0: use shared debugfs implementation Lorenzo Bianconi
@ 2018-10-15 9:33 ` Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 6/6] mt76x2u: introduce mac workqueue support Lorenzo Bianconi
2018-10-16 9:14 ` [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Felix Fietkau
6 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-10-15 9:33 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Use mt76x02_mac_work utility routine as stats workqueue handler
and remove duplicated code. Moreover run mac stuck check in
mt76x02_mac_work for client interfaces.
Remove no longer used avg_ampdu_len and mt76x02_mac_stats data
structure in mt76x02_dev
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
.../net/wireless/mediatek/mt76/mt76x0/init.c | 3 +-
.../net/wireless/mediatek/mt76/mt76x0/mac.c | 68 -------------------
.../wireless/mediatek/mt76/mt76x0/mt76x0.h | 1 -
drivers/net/wireless/mediatek/mt76/mt76x02.h | 10 ---
.../net/wireless/mediatek/mt76/mt76x02_mac.c | 19 ++++++
5 files changed, 20 insertions(+), 81 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
index f90ef4d803d5..f5c7db9ca02a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
@@ -339,7 +339,6 @@ mt76x0_alloc_device(struct device *pdev,
dev = container_of(mdev, struct mt76x02_dev, mt76);
mutex_init(&dev->phy_mutex);
- atomic_set(&dev->avg_ampdu_len, 1);
return dev;
}
@@ -378,7 +377,7 @@ int mt76x0_register_device(struct mt76x02_dev *dev)
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
- INIT_DELAYED_WORK(&dev->mac_work, mt76x0_mac_work);
+ INIT_DELAYED_WORK(&dev->mac_work, mt76x02_mac_work);
ret = mt76_register_device(mdev, true, mt76x02_rates,
ARRAY_SIZE(mt76x02_rates));
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c b/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c
index 9cabe8ebf5da..98d4a97f0a72 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mac.c
@@ -105,74 +105,6 @@ void mt76x0_mac_config_tsf(struct mt76x02_dev *dev, bool enable, int interval)
MT_BEACON_TIME_CFG_TBTT_EN;
}
-static void mt76x0_check_mac_err(struct mt76x02_dev *dev)
-{
- u32 val = mt76_rr(dev, 0x10f4);
-
- if (!(val & BIT(29)) || !(val & (BIT(7) | BIT(5))))
- return;
-
- dev_err(dev->mt76.dev, "Error: MAC specific condition occurred\n");
-
- mt76_set(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR);
- udelay(10);
- mt76_clear(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR);
-}
-void mt76x0_mac_work(struct work_struct *work)
-{
- struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev,
- mac_work.work);
- struct {
- u32 addr_base;
- u32 span;
- u64 *stat_base;
- } spans[] = {
- { MT_RX_STAT_0, 3, dev->stats.rx_stat },
- { MT_TX_STA_0, 3, dev->stats.tx_stat },
- { MT_TX_AGG_STAT, 1, dev->stats.aggr_stat },
- { MT_MPDU_DENSITY_CNT, 1, dev->stats.zero_len_del },
- { MT_TX_AGG_CNT_BASE0, 8, &dev->stats.aggr_n[0] },
- { MT_TX_AGG_CNT_BASE1, 8, &dev->stats.aggr_n[16] },
- };
- u32 sum, n;
- int i, j, k;
-
- mt76x02_update_channel(&dev->mt76);
-
- /* Note: using MCU_RANDOM_READ is actually slower then reading all the
- * registers by hand. MCU takes ca. 20ms to complete read of 24
- * registers while reading them one by one will takes roughly
- * 24*200us =~ 5ms.
- */
-
- k = 0;
- n = 0;
- sum = 0;
- for (i = 0; i < ARRAY_SIZE(spans); i++)
- for (j = 0; j < spans[i].span; j++) {
- u32 val = mt76_rr(dev, spans[i].addr_base + j * 4);
-
- spans[i].stat_base[j * 2] += val & 0xffff;
- spans[i].stat_base[j * 2 + 1] += val >> 16;
-
- /* Calculate average AMPDU length */
- if (spans[i].addr_base != MT_TX_AGG_CNT_BASE0 &&
- spans[i].addr_base != MT_TX_AGG_CNT_BASE1)
- continue;
-
- n += (val >> 16) + (val & 0xffff);
- sum += (val & 0xffff) * (1 + k * 2) +
- (val >> 16) * (2 + k * 2);
- k++;
- }
-
- atomic_set(&dev->avg_ampdu_len, n ? DIV_ROUND_CLOSEST(sum, n) : 1);
-
- mt76x0_check_mac_err(dev);
-
- ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work, 10 * HZ);
-}
-
void mt76x0_mac_set_ampdu_factor(struct mt76x02_dev *dev)
{
struct ieee80211_sta *sta;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index b9743b575099..85de821483cd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -69,7 +69,6 @@ void mt76x0_phy_set_txpower(struct mt76x02_dev *dev);
void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on);
/* MAC */
-void mt76x0_mac_work(struct work_struct *work);
void mt76x0_mac_set_protection(struct mt76x02_dev *dev, bool legacy_prot,
int ht_mode);
void mt76x0_mac_set_short_preamble(struct mt76x02_dev *dev, bool short_preamb);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 58721307d917..bdbe4bbf7a59 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -28,14 +28,6 @@
#define MT_CALIBRATE_INTERVAL HZ
-struct mt76x02_mac_stats {
- u64 rx_stat[6];
- u64 tx_stat[6];
- u64 aggr_stat[2];
- u64 aggr_n[32];
- u64 zero_len_del[2];
-};
-
#define MT_MAX_CHAINS 2
struct mt76x02_rx_freq_cal {
s8 high_gain[MT_MAX_CHAINS];
@@ -85,8 +77,6 @@ struct mt76x02_dev {
struct delayed_work cal_work;
struct delayed_work mac_work;
- struct mt76x02_mac_stats stats;
- atomic_t avg_ampdu_len;
u32 aggr_stats[32];
struct sk_buff *beacons[8];
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index c7666f4c432f..3896da690b83 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -754,6 +754,21 @@ void mt76x02_update_channel(struct mt76_dev *mdev)
}
EXPORT_SYMBOL_GPL(mt76x02_update_channel);
+static void mt76x02_check_mac_err(struct mt76x02_dev *dev)
+{
+ u32 val = mt76_rr(dev, 0x10f4);
+
+ if (!(val & BIT(29)) || !(val & (BIT(7) | BIT(5))))
+ return;
+
+ dev_err(dev->mt76.dev, "mac specific condition occurred\n");
+
+ mt76_set(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR);
+ udelay(10);
+ mt76_clear(dev, MT_MAC_SYS_CTRL,
+ MT_MAC_SYS_CTRL_ENABLE_TX | MT_MAC_SYS_CTRL_ENABLE_RX);
+}
+
void mt76x02_mac_work(struct work_struct *work)
{
struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev,
@@ -768,6 +783,10 @@ void mt76x02_mac_work(struct work_struct *work)
dev->aggr_stats[idx++] += val >> 16;
}
+ /* XXX: check beacon stuck for ap mode */
+ if (!dev->beacon_mask)
+ mt76x02_check_mac_err(dev);
+
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
MT_CALIBRATE_INTERVAL);
}
--
2.19.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] mt76x2u: introduce mac workqueue support
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
` (4 preceding siblings ...)
2018-10-15 9:33 ` [PATCH 5/6] mt76x0: use mt76x02_mac_work as stats handler Lorenzo Bianconi
@ 2018-10-15 9:33 ` Lorenzo Bianconi
2018-10-16 9:14 ` [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Felix Fietkau
6 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-10-15 9:33 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Add mac workqueue support to mt76x2u driver in order
to compute device statistics and add mac stuck routine
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
drivers/net/wireless/mediatek/mt76/mt76x2/init.c | 2 ++
drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c | 1 -
drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c | 1 +
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 2 ++
4 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/init.c
index 3c73fdeaf30f..04790f84d7d4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/init.c
@@ -162,6 +162,8 @@ void mt76x2_init_device(struct mt76x02_dev *dev)
{
struct ieee80211_hw *hw = mt76_hw(dev);
+ INIT_DELAYED_WORK(&dev->mac_work, mt76x02_mac_work);
+
hw->queues = 4;
hw->max_rates = 1;
hw->max_report_rates = 7;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index 5b167aaaf7f7..b15c97e1dfb3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -467,7 +467,6 @@ int mt76x2_register_device(struct mt76x02_dev *dev)
int i, ret;
INIT_DELAYED_WORK(&dev->cal_work, mt76x2_phy_calibrate);
- INIT_DELAYED_WORK(&dev->mac_work, mt76x02_mac_work);
mt76x2_init_device(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
index dfc80ecfde92..b2388f506505 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
@@ -297,6 +297,7 @@ void mt76x2u_stop_hw(struct mt76x02_dev *dev)
{
mt76u_stop_stat_wk(&dev->mt76);
cancel_delayed_work_sync(&dev->cal_work);
+ cancel_delayed_work_sync(&dev->mac_work);
mt76x2u_mac_stop(dev);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 1971a1b00038..25c43175e6e5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -27,6 +27,8 @@ static int mt76x2u_start(struct ieee80211_hw *hw)
if (ret)
goto out;
+ ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
+ MT_CALIBRATE_INTERVAL);
set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
out:
--
2.19.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
` (5 preceding siblings ...)
2018-10-15 9:33 ` [PATCH 6/6] mt76x2u: introduce mac workqueue support Lorenzo Bianconi
@ 2018-10-16 9:14 ` Felix Fietkau
6 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2018-10-16 9:14 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: sgruszka, linux-wireless
On 2018-10-15 11:33, Lorenzo Bianconi wrote:
> Unify debugfs implementation between mt76x0 and mt76x2 drivers.
> Add get_survey support to mt76x0e driver
> Add mac work support to mt76x2u driver
Applied, thanks.
- Felix
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-10-16 9:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 9:33 [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 1/6] mt76x0: pci: add get_survey support Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 2/6] mt76: move mt76x02_mac_work routine in mt76x02-lib module Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 3/6] mt76: move mt76x02_debugfs " Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 4/6] mt76x0: use shared debugfs implementation Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 5/6] mt76x0: use mt76x02_mac_work as stats handler Lorenzo Bianconi
2018-10-15 9:33 ` [PATCH 6/6] mt76x2u: introduce mac workqueue support Lorenzo Bianconi
2018-10-16 9:14 ` [PATCH 0/6] unify debugfs code between mt76x0 and mt76x2 Felix Fietkau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).