Commit 8f2d3d2a authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlwifi: contextify command sending

Some commands will have different command IDs
for different contexts, so we need to store
those IDs in the context structure and use
them instead of hardcoding the commands.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent dcef732c
...@@ -77,7 +77,7 @@ int iwlagn_send_rxon_assoc(struct iwl_priv *priv, ...@@ -77,7 +77,7 @@ int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
ctx->staging.ofdm_ht_triple_stream_basic_rates; ctx->staging.ofdm_ht_triple_stream_basic_rates;
rxon_assoc.acquisition_data = ctx->staging.acquisition_data; rxon_assoc.acquisition_data = ctx->staging.acquisition_data;
ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, ret = iwl_send_cmd_pdu_async(priv, ctx->rxon_assoc_cmd,
sizeof(rxon_assoc), &rxon_assoc, NULL); sizeof(rxon_assoc), &rxon_assoc, NULL);
if (ret) if (ret)
return ret; return ret;
......
...@@ -152,7 +152,7 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -152,7 +152,7 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
ret = iwl_send_cmd_pdu(priv, REPLY_RXON, ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd,
sizeof(struct iwl_rxon_cmd), sizeof(struct iwl_rxon_cmd),
active_rxon); active_rxon);
...@@ -187,7 +187,7 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -187,7 +187,7 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
* stations is needed after it (the RXON command) completes * stations is needed after it (the RXON command) completes
*/ */
if (!new_assoc) { if (!new_assoc) {
ret = iwl_send_cmd_pdu(priv, REPLY_RXON, ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd,
sizeof(struct iwl_rxon_cmd), &ctx->staging); sizeof(struct iwl_rxon_cmd), &ctx->staging);
if (ret) { if (ret) {
IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
...@@ -209,7 +209,7 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -209,7 +209,7 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
/* Apply the new configuration /* Apply the new configuration
* RXON assoc doesn't clear the station table in uCode, * RXON assoc doesn't clear the station table in uCode,
*/ */
ret = iwl_send_cmd_pdu(priv, REPLY_RXON, ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd,
sizeof(struct iwl_rxon_cmd), &ctx->staging); sizeof(struct iwl_rxon_cmd), &ctx->staging);
if (ret) { if (ret) {
IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
...@@ -3244,7 +3244,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3244,7 +3244,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
ret = iwl_send_rxon_timing(priv, vif); ret = iwl_send_rxon_timing(priv, vif);
if (ret) if (ret)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "RXON timing - "
"Attempting to continue.\n"); "Attempting to continue.\n");
ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
...@@ -3481,7 +3481,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3481,7 +3481,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
/* RXON Timing */ /* RXON Timing */
ret = iwl_send_rxon_timing(priv, vif); ret = iwl_send_rxon_timing(priv, vif);
if (ret) if (ret)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "RXON timing failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
/* AP has all antennas */ /* AP has all antennas */
...@@ -4200,6 +4200,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -4200,6 +4200,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
for (i = 0; i < NUM_IWL_RXON_CTX; i++) for (i = 0; i < NUM_IWL_RXON_CTX; i++)
priv->contexts[i].ctxid = i; priv->contexts[i].ctxid = i;
priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
BUILD_BUG_ON(NUM_IWL_RXON_CTX != 1);
SET_IEEE80211_DEV(hw, &pdev->dev); SET_IEEE80211_DEV(hw, &pdev->dev);
IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
......
...@@ -545,7 +545,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -545,7 +545,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
le32_to_cpu(ctx->timing.beacon_init_val), le32_to_cpu(ctx->timing.beacon_init_val),
le16_to_cpu(ctx->timing.atim_window)); le16_to_cpu(ctx->timing.atim_window));
return iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, return iwl_send_cmd_pdu(priv, ctx->rxon_timing_cmd,
sizeof(ctx->timing), &ctx->timing); sizeof(ctx->timing), &ctx->timing);
} }
EXPORT_SYMBOL(iwl_send_rxon_timing); EXPORT_SYMBOL(iwl_send_rxon_timing);
......
...@@ -1126,6 +1126,8 @@ struct iwl_rxon_context { ...@@ -1126,6 +1126,8 @@ struct iwl_rxon_context {
struct iwl_rxon_time_cmd timing; struct iwl_rxon_time_cmd timing;
u8 bcast_sta_id; u8 bcast_sta_id;
u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd;
}; };
struct iwl_priv { struct iwl_priv {
......
...@@ -4013,6 +4013,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -4013,6 +4013,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
for (i = 0; i < NUM_IWL_RXON_CTX; i++) for (i = 0; i < NUM_IWL_RXON_CTX; i++)
priv->contexts[i].ctxid = i; priv->contexts[i].ctxid = i;
priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
/* /*
* Disabling hardware scan means that mac80211 will perform scans * Disabling hardware scan means that mac80211 will perform scans
* "the hard way", rather than using device's scan. * "the hard way", rather than using device's scan.
......
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