iwlwifi: contextify command sending
authorJohannes Berg <johannes.berg@intel.com>
Mon, 23 Aug 2010 08:46:37 +0000 (10:46 +0200)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 27 Aug 2010 16:11:49 +0000 (09:11 -0700)
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: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl3945-base.c

index 3e5069943ddee7ca936d23e95f3d39ffc781abf0..2d4cdb027aa678f63aca51ef33eade4c5f82d513 100644 (file)
@@ -77,7 +77,7 @@ int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
                 ctx->staging.ofdm_ht_triple_stream_basic_rates;
        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);
        if (ret)
                return ret;
index 23db6c3e9aee4ab32df23b207386133dea9dff75..d3714f076a0c776970889e50c87ca75f88ecef75 100644 (file)
@@ -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");
                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),
                                       active_rxon);
 
@@ -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
         */
        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);
                if (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)
                /* Apply the new configuration
                 * 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);
                if (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)
 
        ret = iwl_send_rxon_timing(priv, vif);
        if (ret)
-               IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
+               IWL_WARN(priv, "RXON timing - "
                            "Attempting to continue.\n");
 
        ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
@@ -3481,7 +3481,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
                /* RXON Timing */
                ret = iwl_send_rxon_timing(priv, vif);
                if (ret)
-                       IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
+                       IWL_WARN(priv, "RXON timing failed - "
                                        "Attempting to continue.\n");
 
                /* AP has all antennas */
@@ -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++)
                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);
 
        IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
index f7bfe59c0ca8e43804d75f26a3c412d907945dea..a145d17cd943bcaed3f275622f9ec2a15173c7d2 100644 (file)
@@ -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),
                        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);
 }
 EXPORT_SYMBOL(iwl_send_rxon_timing);
index da54bd53c99d8d32296125dde087a9adc4c1aaa4..6a7e9ff4a88c840f5faac239f79e7aa45200dde1 100644 (file)
@@ -1126,6 +1126,8 @@ struct iwl_rxon_context {
        struct iwl_rxon_time_cmd timing;
 
        u8 bcast_sta_id;
+
+       u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd;
 };
 
 struct iwl_priv {
index 630b8d64172057ff61f332fccc8cd8987da3f6ca..4321d970d58d28e9de4b8635edef5a0f5a87da60 100644 (file)
@@ -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++)
                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
         * "the hard way", rather than using device's scan.