diff mbox series

[1/2] mt76: run mac work every 100ms

Message ID f28b63441e1a1c1518e28dc70ff7fc854ae60361.1545667662.git.lorenzo.bianconi@redhat.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series introduce mt76 tx hang watchdog | expand

Commit Message

Lorenzo Bianconi Dec. 24, 2018, 4:24 p.m. UTC
Introduce MT_WATCHDOG_TIME macro in order to run mac work every 100ms.
This is a preliminary patch to implement a proper tx hang watchdog

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/pci.c      | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x0/usb.c      | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x02.h         | 1 +
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c     | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 2 +-
 6 files changed, 6 insertions(+), 5 deletions(-)

Comments

Stanislaw Gruszka Dec. 27, 2018, 10:54 a.m. UTC | #1
On Mon, Dec 24, 2018 at 05:24:41PM +0100, Lorenzo Bianconi wrote:
> Introduce MT_WATCHDOG_TIME macro in order to run mac work every 100ms.
> This is a preliminary patch to implement a proper tx hang watchdog
<snip>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> index b54a32397486..ec936002a286 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> @@ -33,7 +33,7 @@ mt76x2_start(struct ieee80211_hw *hw)
>  		goto out;
>  
>  	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
> -				     MT_CALIBRATE_INTERVAL);
> +				     MT_WATCHDOG_TIME);

There are other procedures that are performed on mac_work , which most
likely don't have to be done so frequently. I think watchdog should
be placed it it's own work.

Regards
Stanislaw
Lorenzo Bianconi Dec. 27, 2018, 4:44 p.m. UTC | #2
>
> On Mon, Dec 24, 2018 at 05:24:41PM +0100, Lorenzo Bianconi wrote:
> > Introduce MT_WATCHDOG_TIME macro in order to run mac work every 100ms.
> > This is a preliminary patch to implement a proper tx hang watchdog
> <snip>
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> > index b54a32397486..ec936002a286 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> > @@ -33,7 +33,7 @@ mt76x2_start(struct ieee80211_hw *hw)
> >               goto out;
> >
> >       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
> > -                                  MT_CALIBRATE_INTERVAL);
> > +                                  MT_WATCHDOG_TIME);
>
> There are other procedures that are performed on mac_work , which most
> likely don't have to be done so frequently. I think watchdog should
> be placed it it's own work.

I guess it will be useful to have a dedicated work for it if we add
new watchdogs (like mt7603 driver).
I will fix it in v2.

Regards,
Lorenzo

>
> Regards
> Stanislaw
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
index 720b05e325a5..d2005632101f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
@@ -30,7 +30,7 @@  static int mt76x0e_start(struct ieee80211_hw *hw)
 	mt76x02_mac_start(dev);
 	mt76x0_phy_calibrate(dev, true);
 	ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work,
-				     MT_CALIBRATE_INTERVAL);
+				     MT_WATCHDOG_TIME);
 	ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
 				     MT_CALIBRATE_INTERVAL);
 	set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index 0e6b43bb4678..b7ace310ca72 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -118,7 +118,7 @@  static int mt76x0u_start(struct ieee80211_hw *hw)
 
 	mt76x0_phy_calibrate(dev, true);
 	ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work,
-				     MT_CALIBRATE_INTERVAL);
+				     MT_WATCHDOG_TIME);
 	ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
 				     MT_CALIBRATE_INTERVAL);
 	set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 5f5831d18af5..17e13e373f53 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -26,6 +26,7 @@ 
 #include "mt76x02_dfs.h"
 #include "mt76x02_dma.h"
 
+#define MT_WATCHDOG_TIME	(HZ / 10)
 #define MT_CALIBRATE_INTERVAL	HZ
 
 #define MT_MAX_CHAINS		2
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index aed108e8761f..a4ff5a7a219f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -888,7 +888,7 @@  void mt76x02_mac_work(struct work_struct *work)
 	mt76_tx_status_check(&dev->mt76, NULL, false);
 
 	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
-				     MT_CALIBRATE_INTERVAL);
+				     MT_WATCHDOG_TIME);
 }
 
 void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
index b54a32397486..ec936002a286 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
@@ -33,7 +33,7 @@  mt76x2_start(struct ieee80211_hw *hw)
 		goto out;
 
 	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
-				     MT_CALIBRATE_INTERVAL);
+				     MT_WATCHDOG_TIME);
 
 	set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 2b48cc51a30d..77f95688a41b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -28,7 +28,7 @@  static int mt76x2u_start(struct ieee80211_hw *hw)
 		goto out;
 
 	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
-				     MT_CALIBRATE_INTERVAL);
+				     MT_WATCHDOG_TIME);
 	set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
 
 out: