Commit a4dece9a authored by Johannes Berg's avatar Johannes Berg

iwlwifi: fix queue flush confusion

The flush_control parameter to iwlagn_txfifo_flush
is passed as an internal value (context flags) and
then sent to the device, that can't be right.

Fix the confusion by removing the parameter, always
use IWL_DROP_ALL that is redefined according to the
firmware API in the flush control.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2eb81a40
...@@ -176,8 +176,8 @@ int iwlagn_hw_valid_rtc_data_addr(u32 addr); ...@@ -176,8 +176,8 @@ int iwlagn_hw_valid_rtc_data_addr(u32 addr);
/* lib */ /* lib */
int iwlagn_send_tx_power(struct iwl_priv *priv); int iwlagn_send_tx_power(struct iwl_priv *priv);
void iwlagn_temperature(struct iwl_priv *priv); void iwlagn_temperature(struct iwl_priv *priv);
int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control); int iwlagn_txfifo_flush(struct iwl_priv *priv);
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control); void iwlagn_dev_txfifo_flush(struct iwl_priv *priv);
int iwlagn_send_beacon_cmd(struct iwl_priv *priv); int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
int iwl_send_statistics_request(struct iwl_priv *priv, int iwl_send_statistics_request(struct iwl_priv *priv,
u8 flags, bool clear); u8 flags, bool clear);
......
...@@ -986,8 +986,7 @@ struct iwl_rem_sta_cmd { ...@@ -986,8 +986,7 @@ struct iwl_rem_sta_cmd {
#define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) #define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
#define IWL_DROP_SINGLE 0 #define IWL_DROP_ALL BIT(1)
#define IWL_DROP_ALL (BIT(IWL_RXON_CTX_BSS) | BIT(IWL_RXON_CTX_PAN))
/* /*
* REPLY_TXFIFO_FLUSH = 0x1e(command and response) * REPLY_TXFIFO_FLUSH = 0x1e(command and response)
......
...@@ -2101,7 +2101,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file, ...@@ -2101,7 +2101,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file,
if (iwl_is_rfkill(priv)) if (iwl_is_rfkill(priv))
return -EFAULT; return -EFAULT;
iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); iwlagn_dev_txfifo_flush(priv);
return count; return count;
} }
......
...@@ -136,7 +136,7 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv, ...@@ -136,7 +136,7 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv,
* 1. acquire mutex before calling * 1. acquire mutex before calling
* 2. make sure rf is on and not in exit state * 2. make sure rf is on and not in exit state
*/ */
int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) int iwlagn_txfifo_flush(struct iwl_priv *priv)
{ {
struct iwl_txfifo_flush_cmd flush_cmd; struct iwl_txfifo_flush_cmd flush_cmd;
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
...@@ -146,18 +146,17 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) ...@@ -146,18 +146,17 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
.data = { &flush_cmd, }, .data = { &flush_cmd, },
}; };
might_sleep();
memset(&flush_cmd, 0, sizeof(flush_cmd)); memset(&flush_cmd, 0, sizeof(flush_cmd));
if (flush_control & BIT(IWL_RXON_CTX_BSS))
flush_cmd.queue_control = IWL_SCD_VO_MSK | IWL_SCD_VI_MSK | flush_cmd.queue_control = IWL_SCD_VO_MSK | IWL_SCD_VI_MSK |
IWL_SCD_BE_MSK | IWL_SCD_BK_MSK | IWL_SCD_BE_MSK | IWL_SCD_BK_MSK |
IWL_SCD_MGMT_MSK; IWL_SCD_MGMT_MSK;
if ((flush_control & BIT(IWL_RXON_CTX_PAN)) && if ((priv->valid_contexts != BIT(IWL_RXON_CTX_BSS)))
(priv->valid_contexts != BIT(IWL_RXON_CTX_BSS)))
flush_cmd.queue_control |= IWL_PAN_SCD_VO_MSK | flush_cmd.queue_control |= IWL_PAN_SCD_VO_MSK |
IWL_PAN_SCD_VI_MSK | IWL_PAN_SCD_BE_MSK | IWL_PAN_SCD_VI_MSK |
IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK | IWL_PAN_SCD_BE_MSK |
IWL_PAN_SCD_BK_MSK |
IWL_PAN_SCD_MGMT_MSK |
IWL_PAN_SCD_MULTICAST_MSK; IWL_PAN_SCD_MULTICAST_MSK;
if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE) if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)
...@@ -165,16 +164,16 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) ...@@ -165,16 +164,16 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
IWL_DEBUG_INFO(priv, "queue control: 0x%x\n", IWL_DEBUG_INFO(priv, "queue control: 0x%x\n",
flush_cmd.queue_control); flush_cmd.queue_control);
flush_cmd.flush_control = cpu_to_le16(flush_control); flush_cmd.flush_control = cpu_to_le16(IWL_DROP_ALL);
return iwl_dvm_send_cmd(priv, &cmd); return iwl_dvm_send_cmd(priv, &cmd);
} }
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control) void iwlagn_dev_txfifo_flush(struct iwl_priv *priv)
{ {
mutex_lock(&priv->mutex); mutex_lock(&priv->mutex);
ieee80211_stop_queues(priv->hw); ieee80211_stop_queues(priv->hw);
if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { if (iwlagn_txfifo_flush(priv)) {
IWL_ERR(priv, "flush request fail\n"); IWL_ERR(priv, "flush request fail\n");
goto done; goto done;
} }
......
...@@ -1017,7 +1017,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) ...@@ -1017,7 +1017,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop)
*/ */
if (drop) { if (drop) {
IWL_DEBUG_MAC80211(priv, "send flush command\n"); IWL_DEBUG_MAC80211(priv, "send flush command\n");
if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) { if (iwlagn_txfifo_flush(priv)) {
IWL_ERR(priv, "flush request fail\n"); IWL_ERR(priv, "flush request fail\n");
goto done; goto done;
} }
......
...@@ -511,7 +511,7 @@ static void iwl_bg_tx_flush(struct work_struct *work) ...@@ -511,7 +511,7 @@ static void iwl_bg_tx_flush(struct work_struct *work)
return; return;
IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n"); IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n");
iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); iwlagn_dev_txfifo_flush(priv);
} }
/* /*
......
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