iwlwifi: move QoS into context
authorJohannes Berg <johannes.berg@intel.com>
Mon, 23 Aug 2010 08:46:38 +0000 (10:46 +0200)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 27 Aug 2010 16:13:00 +0000 (09:13 -0700)
Since mac80211 doesn't currently enable/disable
QoS per interface, we can't yet do it properly,
but we can already prepare for it and move the
QoS data and command ID into the context struct.

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.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl3945-base.c

index d3714f076a0c776970889e50c87ca75f88ecef75..007dede73698e6eb0a7c6959d4f0282faf83f5d0 100644 (file)
@@ -4203,6 +4203,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        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;
+       priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
        BUILD_BUG_ON(NUM_IWL_RXON_CTX != 1);
 
        SET_IEEE80211_DEV(hw, &pdev->dev);
index a145d17cd943bcaed3f275622f9ec2a15173c7d2..d5499db34eb2b18cb187006946cc038ece7ebd63 100644 (file)
@@ -191,27 +191,27 @@ EXPORT_SYMBOL(iwl_alloc_all);
 /*
  * QoS  support
 */
-static void iwl_update_qos(struct iwl_priv *priv)
+static void iwl_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
 {
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       priv->qos_data.def_qos_parm.qos_flags = 0;
+       ctx->qos_data.def_qos_parm.qos_flags = 0;
 
-       if (priv->qos_data.qos_active)
-               priv->qos_data.def_qos_parm.qos_flags |=
+       if (ctx->qos_data.qos_active)
+               ctx->qos_data.def_qos_parm.qos_flags |=
                        QOS_PARAM_FLG_UPDATE_EDCA_MSK;
 
        if (priv->current_ht_config.is_ht)
-               priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
+               ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
 
        IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",
-                     priv->qos_data.qos_active,
-                     priv->qos_data.def_qos_parm.qos_flags);
+                     ctx->qos_data.qos_active,
+                     ctx->qos_data.def_qos_parm.qos_flags);
 
-       iwl_send_cmd_pdu_async(priv, REPLY_QOS_PARAM,
+       iwl_send_cmd_pdu_async(priv, ctx->qos_cmd,
                               sizeof(struct iwl_qosparam_cmd),
-                              &priv->qos_data.def_qos_parm, NULL);
+                              &ctx->qos_data.def_qos_parm, NULL);
 }
 
 #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */
@@ -1584,6 +1584,7 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
                           const struct ieee80211_tx_queue_params *params)
 {
        struct iwl_priv *priv = hw->priv;
+       struct iwl_rxon_context *ctx;
        unsigned long flags;
        int q;
 
@@ -1603,13 +1604,21 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       priv->qos_data.def_qos_parm.ac[q].cw_min = cpu_to_le16(params->cw_min);
-       priv->qos_data.def_qos_parm.ac[q].cw_max = cpu_to_le16(params->cw_max);
-       priv->qos_data.def_qos_parm.ac[q].aifsn = params->aifs;
-       priv->qos_data.def_qos_parm.ac[q].edca_txop =
-                       cpu_to_le16((params->txop * 32));
+       /*
+        * MULTI-FIXME
+        * This may need to be done per interface in nl80211/cfg80211/mac80211.
+        */
+       for_each_context(priv, ctx) {
+               ctx->qos_data.def_qos_parm.ac[q].cw_min =
+                       cpu_to_le16(params->cw_min);
+               ctx->qos_data.def_qos_parm.ac[q].cw_max =
+                       cpu_to_le16(params->cw_max);
+               ctx->qos_data.def_qos_parm.ac[q].aifsn = params->aifs;
+               ctx->qos_data.def_qos_parm.ac[q].edca_txop =
+                               cpu_to_le16((params->txop * 32));
 
-       priv->qos_data.def_qos_parm.ac[q].reserved1 = 0;
+               ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0;
+       }
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
@@ -1751,8 +1760,8 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
                unsigned long flags;
 
                spin_lock_irqsave(&priv->lock, flags);
-               priv->qos_data.qos_active = bss_conf->qos;
-               iwl_update_qos(priv);
+               ctx->qos_data.qos_active = bss_conf->qos;
+               iwl_update_qos(priv, ctx);
                spin_unlock_irqrestore(&priv->lock, flags);
        }
 
index d36418c3a6b531daab1b89acf386ec5714f64437..0ee8f516c4ab0e4b1711f32792ec89d84c52a65f 100644 (file)
@@ -643,19 +643,25 @@ static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf,
                                       size_t count, loff_t *ppos)
 {
        struct iwl_priv *priv = file->private_data;
+       struct iwl_rxon_context *ctx;
        int pos = 0, i;
-       char buf[256];
+       char buf[256 * NUM_IWL_RXON_CTX];
        const size_t bufsz = sizeof(buf);
 
-       for (i = 0; i < AC_NUM; i++) {
-               pos += scnprintf(buf + pos, bufsz - pos,
-                       "\tcw_min\tcw_max\taifsn\ttxop\n");
-               pos += scnprintf(buf + pos, bufsz - pos,
+       for_each_context(priv, ctx) {
+               pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n",
+                                ctx->ctxid);
+               for (i = 0; i < AC_NUM; i++) {
+                       pos += scnprintf(buf + pos, bufsz - pos,
+                               "\tcw_min\tcw_max\taifsn\ttxop\n");
+                       pos += scnprintf(buf + pos, bufsz - pos,
                                "AC[%d]\t%u\t%u\t%u\t%u\n", i,
-                               priv->qos_data.def_qos_parm.ac[i].cw_min,
-                               priv->qos_data.def_qos_parm.ac[i].cw_max,
-                               priv->qos_data.def_qos_parm.ac[i].aifsn,
-                               priv->qos_data.def_qos_parm.ac[i].edca_txop);
+                               ctx->qos_data.def_qos_parm.ac[i].cw_min,
+                               ctx->qos_data.def_qos_parm.ac[i].cw_max,
+                               ctx->qos_data.def_qos_parm.ac[i].aifsn,
+                               ctx->qos_data.def_qos_parm.ac[i].edca_txop);
+               }
+               pos += scnprintf(buf + pos, bufsz - pos, "\n");
        }
        return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
index 6a7e9ff4a88c840f5faac239f79e7aa45200dde1..01a654e6db26b597dc04e286521e182627763846 100644 (file)
@@ -1125,9 +1125,12 @@ struct iwl_rxon_context {
 
        struct iwl_rxon_time_cmd timing;
 
+       struct iwl_qos_info qos_data;
+
        u8 bcast_sta_id;
 
        u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd;
+       u8 qos_cmd;
 };
 
 struct iwl_priv {
@@ -1418,8 +1421,6 @@ struct iwl_priv {
 
        u32 inta_mask;
 
-       struct iwl_qos_info qos_data;
-
        struct workqueue_struct *workqueue;
 
        struct work_struct restart;
index 4321d970d58d28e9de4b8635edef5a0f5a87da60..09bca17255b47c694fca469fd770de0a8a32064f 100644 (file)
@@ -4016,6 +4016,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        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;
+       priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
 
        /*
         * Disabling hardware scan means that mac80211 will perform scans