iwlwifi: introduce post_scan hook
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / net / wireless / iwlwifi / iwl-agn-hcmd.c
index 6fb52ab..634177d 100644 (file)
@@ -137,7 +137,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
                        continue;
                }
 
-               delta_g = (priv->cfg->chain_noise_scale *
+               delta_g = (priv->cfg->base_params->chain_noise_scale *
                        ((s32)average_noise[default_chain] -
                        (s32)average_noise[i])) / 1500;
 
@@ -222,7 +222,8 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
                return;
        }
 
-       if (priv->cfg->use_rts_for_aggregation &&
+       if (priv->cfg->ht_params &&
+           priv->cfg->ht_params->use_rts_for_aggregation &&
            info->flags & IEEE80211_TX_CTL_AMPDU) {
                *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
                return;
@@ -287,6 +288,15 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
        ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS];
        ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN];
 
+       /*
+        * If the PAN context is inactive, then we don't need
+        * to update the PAN parameters, the last thing we'll
+        * have done before it goes inactive is making the PAN
+        * parameters be WLAN-only.
+        */
+       if (!ctx_pan->is_active)
+               return 0;
+
        memset(&cmd, 0, sizeof(cmd));
 
        /* only 2 slots are currently allowed */
@@ -312,7 +322,7 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
                        bcnint = max_t(int, bcnint,
                                       ctx_bss->vif->bss_conf.beacon_int);
                if (!bcnint)
-                       bcnint = 100;
+                       bcnint = DEFAULT_BEACON_INTERVAL;
                slot0 = bcnint / 2;
                slot1 = bcnint - slot0;
 
@@ -330,7 +340,12 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
                slot0 = 0;
                slot1 = max_t(int, 1, ctx_pan->vif->bss_conf.dtim_period) *
                                        ctx_pan->vif->bss_conf.beacon_int;
-               slot1 = max_t(int, 100, slot1);
+               slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);
+
+               if (test_bit(STATUS_SCAN_HW, &priv->status)) {
+                       slot0 = slot1 * 3 - 20;
+                       slot1 = 20;
+               }
        }
 
        cmd.slots[0].width = cpu_to_le16(slot0);
@@ -345,7 +360,7 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
 
 struct iwl_hcmd_ops iwlagn_hcmd = {
        .rxon_assoc = iwlagn_send_rxon_assoc,
-       .commit_rxon = iwl_commit_rxon,
+       .commit_rxon = iwlagn_commit_rxon,
        .set_rxon_chain = iwl_set_rxon_chain,
        .set_tx_ant = iwlagn_send_tx_ant_config,
        .send_bt_config = iwl_send_bt_config,
@@ -354,7 +369,7 @@ struct iwl_hcmd_ops iwlagn_hcmd = {
 
 struct iwl_hcmd_ops iwlagn_bt_hcmd = {
        .rxon_assoc = iwlagn_send_rxon_assoc,
-       .commit_rxon = iwl_commit_rxon,
+       .commit_rxon = iwlagn_commit_rxon,
        .set_rxon_chain = iwl_set_rxon_chain,
        .set_tx_ant = iwlagn_send_tx_ant_config,
        .send_bt_config = iwlagn_send_advance_bt_config,
@@ -369,4 +384,5 @@ struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
        .tx_cmd_protection = iwlagn_tx_cmd_protection,
        .calc_rssi = iwlagn_calc_rssi,
        .request_scan = iwlagn_request_scan,
+       .post_scan = iwlagn_post_scan,
 };