Commit 859cfb0a authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by John W. Linville

iwlagn: move iwl_stop / wake_queue to the upper layer

Add a wrapper in the upper layer to call the mac80211's function.
This allows not to have the transport layer call mac80211 directly.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 909e9b23
...@@ -209,7 +209,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv, ...@@ -209,7 +209,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
{ {
if (stop) { if (stop) {
IWL_DEBUG_TEMP(priv, "Stop all queues\n"); IWL_DEBUG_TEMP(priv, "Stop all queues\n");
if (priv->shrd->mac80211_registered) if (priv->mac80211_registered)
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
IWL_DEBUG_TEMP(priv, IWL_DEBUG_TEMP(priv,
"Schedule 5 seconds CT_KILL Timer\n"); "Schedule 5 seconds CT_KILL Timer\n");
...@@ -217,7 +217,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv, ...@@ -217,7 +217,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
jiffies + CT_KILL_EXIT_DURATION * HZ); jiffies + CT_KILL_EXIT_DURATION * HZ);
} else { } else {
IWL_DEBUG_TEMP(priv, "Wake all queues\n"); IWL_DEBUG_TEMP(priv, "Wake all queues\n");
if (priv->shrd->mac80211_registered) if (priv->mac80211_registered)
ieee80211_wake_queues(priv->hw); ieee80211_wake_queues(priv->hw);
} }
} }
......
...@@ -1519,7 +1519,7 @@ static void __iwl_down(struct iwl_priv *priv) ...@@ -1519,7 +1519,7 @@ static void __iwl_down(struct iwl_priv *priv)
if (!exit_pending) if (!exit_pending)
clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status); clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
if (priv->shrd->mac80211_registered) if (priv->mac80211_registered)
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
iwl_trans_stop_device(trans(priv)); iwl_trans_stop_device(trans(priv));
...@@ -1863,7 +1863,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv, ...@@ -1863,7 +1863,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv,
IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); IWL_ERR(priv, "Failed to register hw (error %d)\n", ret);
return ret; return ret;
} }
priv->shrd->mac80211_registered = 1; priv->mac80211_registered = 1;
return 0; return 0;
} }
...@@ -3311,7 +3311,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, ...@@ -3311,7 +3311,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
priv->shrd = &priv->_shrd; priv->shrd = &priv->_shrd;
priv->shrd->bus = bus; priv->shrd->bus = bus;
priv->shrd->priv = priv; priv->shrd->priv = priv;
priv->shrd->hw = hw;
bus_set_drv_data(priv->bus, priv->shrd); bus_set_drv_data(priv->bus, priv->shrd);
priv->shrd->trans = trans_ops->alloc(priv->shrd); priv->shrd->trans = trans_ops->alloc(priv->shrd);
...@@ -3487,9 +3486,9 @@ void __devexit iwl_remove(struct iwl_priv * priv) ...@@ -3487,9 +3486,9 @@ void __devexit iwl_remove(struct iwl_priv * priv)
iwl_testmode_cleanup(priv); iwl_testmode_cleanup(priv);
iwl_leds_exit(priv); iwl_leds_exit(priv);
if (priv->shrd->mac80211_registered) { if (priv->mac80211_registered) {
ieee80211_unregister_hw(priv->hw); ieee80211_unregister_hw(priv->hw);
priv->shrd->mac80211_registered = 0; priv->mac80211_registered = 0;
} }
iwl_tt_exit(priv); iwl_tt_exit(priv);
......
...@@ -1885,3 +1885,13 @@ void iwl_free_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -1885,3 +1885,13 @@ void iwl_free_skb(struct iwl_priv *priv, struct sk_buff *skb)
kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1])); kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
void iwl_stop_sw_queue(struct iwl_priv *priv, u8 ac)
{
ieee80211_stop_queue(priv->hw, ac);
}
void iwl_wake_sw_queue(struct iwl_priv *priv, u8 ac)
{
ieee80211_wake_queue(priv->hw, ac);
}
...@@ -958,6 +958,8 @@ struct iwl_priv { ...@@ -958,6 +958,8 @@ struct iwl_priv {
struct iwl_station_entry stations[IWLAGN_STATION_COUNT]; struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
unsigned long ucode_key_table; unsigned long ucode_key_table;
u8 mac80211_registered;
/* Indication if ieee80211_ops->open has been called */ /* Indication if ieee80211_ops->open has been called */
u8 is_open; u8 is_open;
......
...@@ -246,12 +246,6 @@ struct iwl_shared { ...@@ -246,12 +246,6 @@ struct iwl_shared {
spinlock_t sta_lock; spinlock_t sta_lock;
struct mutex mutex; struct mutex mutex;
/*these 2 shouldn't really be here, but they are needed for
* iwl_queue_stop, which is called from the upper layer too
*/
u8 mac80211_registered;
struct ieee80211_hw *hw;
struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT]; struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT];
wait_queue_head_t wait_command_queue; wait_queue_head_t wait_command_queue;
...@@ -397,6 +391,9 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand); ...@@ -397,6 +391,9 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand);
const char *get_cmd_string(u8 cmd); const char *get_cmd_string(u8 cmd);
bool iwl_check_for_ct_kill(struct iwl_priv *priv); bool iwl_check_for_ct_kill(struct iwl_priv *priv);
void iwl_stop_sw_queue(struct iwl_priv *priv, u8 ac);
void iwl_wake_sw_queue(struct iwl_priv *priv, u8 ac);
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
void iwl_reset_traffic_log(struct iwl_priv *priv); void iwl_reset_traffic_log(struct iwl_priv *priv);
#endif /* CONFIG_IWLWIFI_DEBUGFS */ #endif /* CONFIG_IWLWIFI_DEBUGFS */
......
...@@ -375,12 +375,9 @@ static inline void iwl_wake_queue(struct iwl_trans *trans, ...@@ -375,12 +375,9 @@ static inline void iwl_wake_queue(struct iwl_trans *trans,
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans); IWL_TRANS_GET_PCIE_TRANS(trans);
if (unlikely(!trans->shrd->mac80211_registered))
return;
if (test_and_clear_bit(hwq, trans_pcie->queue_stopped)) if (test_and_clear_bit(hwq, trans_pcie->queue_stopped))
if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0) if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0)
ieee80211_wake_queue(trans->shrd->hw, ac); iwl_wake_sw_queue(priv(trans), ac);
} }
static inline void iwl_stop_queue(struct iwl_trans *trans, static inline void iwl_stop_queue(struct iwl_trans *trans,
...@@ -392,12 +389,9 @@ static inline void iwl_stop_queue(struct iwl_trans *trans, ...@@ -392,12 +389,9 @@ static inline void iwl_stop_queue(struct iwl_trans *trans,
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans); IWL_TRANS_GET_PCIE_TRANS(trans);
if (unlikely(!trans->shrd->mac80211_registered))
return;
if (!test_and_set_bit(hwq, trans_pcie->queue_stopped)) if (!test_and_set_bit(hwq, trans_pcie->queue_stopped))
if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0) if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0)
ieee80211_stop_queue(trans->shrd->hw, ac); iwl_stop_sw_queue(priv(trans), ac);
} }
#ifdef ieee80211_stop_queue #ifdef ieee80211_stop_queue
......
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