Commit 41affd52 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

rtlwifi: use work for lps

Leaving leisure power save mode can take some time, so it's better to
perform that action in process context with interrupts enabled. This
patch changes lps_leave tasklet to work.
Reported-by: default avatarPhilipp Dreimann <philipp@dreimann.net>
Tested-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Mike McCormack <mikem@ring3k.org>
Cc: Chaoming Li <chaoming_li@realsil.com.cn>
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 49d55cef
...@@ -610,7 +610,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) ...@@ -610,7 +610,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
if (((rtlpriv->link_info.num_rx_inperiod + if (((rtlpriv->link_info.num_rx_inperiod +
rtlpriv->link_info.num_tx_inperiod) > 8) || rtlpriv->link_info.num_tx_inperiod) > 8) ||
(rtlpriv->link_info.num_rx_inperiod > 2)) { (rtlpriv->link_info.num_rx_inperiod > 2)) {
tasklet_schedule(&rtlpriv->works.ips_leave_tasklet); schedule_work(&rtlpriv->works.lps_leave_work);
} }
} }
...@@ -736,7 +736,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) ...@@ -736,7 +736,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
if (((rtlpriv->link_info.num_rx_inperiod + if (((rtlpriv->link_info.num_rx_inperiod +
rtlpriv->link_info.num_tx_inperiod) > 8) || rtlpriv->link_info.num_tx_inperiod) > 8) ||
(rtlpriv->link_info.num_rx_inperiod > 2)) { (rtlpriv->link_info.num_rx_inperiod > 2)) {
tasklet_schedule(&rtlpriv->works.ips_leave_tasklet); schedule_work(&rtlpriv->works.lps_leave_work);
} }
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
...@@ -903,11 +903,6 @@ static void _rtl_pci_irq_tasklet(struct ieee80211_hw *hw) ...@@ -903,11 +903,6 @@ static void _rtl_pci_irq_tasklet(struct ieee80211_hw *hw)
_rtl_pci_tx_chk_waitq(hw); _rtl_pci_tx_chk_waitq(hw);
} }
static void _rtl_pci_ips_leave_tasklet(struct ieee80211_hw *hw)
{
rtl_lps_leave(hw);
}
static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
...@@ -945,6 +940,15 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) ...@@ -945,6 +940,15 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
return; return;
} }
static void rtl_lps_leave_work_callback(struct work_struct *work)
{
struct rtl_works *rtlworks =
container_of(work, struct rtl_works, lps_leave_work);
struct ieee80211_hw *hw = rtlworks->hw;
rtl_lps_leave(hw);
}
static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw)
{ {
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
...@@ -1006,9 +1010,7 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw, ...@@ -1006,9 +1010,7 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw,
tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet, tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet,
(void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet, (void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet,
(unsigned long)hw); (unsigned long)hw);
tasklet_init(&rtlpriv->works.ips_leave_tasklet, INIT_WORK(&rtlpriv->works.lps_leave_work, rtl_lps_leave_work_callback);
(void (*)(unsigned long))_rtl_pci_ips_leave_tasklet,
(unsigned long)hw);
} }
static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
...@@ -1478,7 +1480,7 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw) ...@@ -1478,7 +1480,7 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw)
synchronize_irq(rtlpci->pdev->irq); synchronize_irq(rtlpci->pdev->irq);
tasklet_kill(&rtlpriv->works.irq_tasklet); tasklet_kill(&rtlpriv->works.irq_tasklet);
tasklet_kill(&rtlpriv->works.ips_leave_tasklet); cancel_work_sync(&rtlpriv->works.lps_leave_work);
flush_workqueue(rtlpriv->works.rtl_wq); flush_workqueue(rtlpriv->works.rtl_wq);
destroy_workqueue(rtlpriv->works.rtl_wq); destroy_workqueue(rtlpriv->works.rtl_wq);
...@@ -1553,7 +1555,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw) ...@@ -1553,7 +1555,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
set_hal_stop(rtlhal); set_hal_stop(rtlhal);
rtlpriv->cfg->ops->disable_interrupt(hw); rtlpriv->cfg->ops->disable_interrupt(hw);
tasklet_kill(&rtlpriv->works.ips_leave_tasklet); cancel_work_sync(&rtlpriv->works.lps_leave_work);
spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
while (ppsc->rfchange_inprogress) { while (ppsc->rfchange_inprogress) {
......
...@@ -1576,7 +1576,8 @@ struct rtl_works { ...@@ -1576,7 +1576,8 @@ struct rtl_works {
/* For SW LPS */ /* For SW LPS */
struct delayed_work ps_work; struct delayed_work ps_work;
struct delayed_work ps_rfon_wq; struct delayed_work ps_rfon_wq;
struct tasklet_struct ips_leave_tasklet;
struct work_struct lps_leave_work;
}; };
struct rtl_debug { struct rtl_debug {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment