iwlwifi: mvm: BT Coex - enable per-AC BT priority
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 6 Mar 2014 12:49:36 +0000 (14:49 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 11 Mar 2014 18:17:33 +0000 (20:17 +0200)
We can now define the priority against BT per AC. This is
possible with a newer firmware that allows to define the
priority with 2 bits.
Note that this change is compatible with older firmware
since older firmware will simply ignore the new bit (11),
and we still set the old bit (12) in the same cases as
before.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/coex.c
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/sta.c
drivers/net/wireless/iwlwifi/mvm/tx.c

index 43027c346ad3cce31a907583aec94cbcc28cf5b2..018d75c805addd9c48021bebbbe22f6701c01fd4 100644 (file)
@@ -1208,16 +1208,30 @@ bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
 }
 
 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
-                          struct ieee80211_tx_info *info)
+                          struct ieee80211_tx_info *info, u8 ac)
 {
        __le16 fc = hdr->frame_control;
 
+       if (info->band != IEEE80211_BAND_2GHZ)
+               return 0;
+
        /* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */
-       if (info->band == IEEE80211_BAND_2GHZ &&
-           (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO ||
+       if (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO ||
             is_multicast_ether_addr(hdr->addr1) ||
-            ieee80211_is_back_req(fc) || ieee80211_is_mgmt(fc)))
+            ieee80211_is_ctl(fc) || ieee80211_is_mgmt(fc) ||
+            ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc))
+               return 3;
+
+       switch (ac) {
+       case IEEE80211_AC_BE:
+               return 1;
+       case IEEE80211_AC_VO:
+               return 3;
+       case IEEE80211_AC_VI:
                return 2;
+       default:
+               break;
+       }
 
        return 0;
 }
index 221a482a36ea52d42b9218134dfd3c8d4f55c825..f77be762ebd9e614086bafab76b2296c367a9532 100644 (file)
@@ -346,6 +346,8 @@ iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
        return (void *)vif->drv_priv;
 }
 
+extern const u8 tid_to_mac80211_ac[];
+
 enum iwl_scan_status {
        IWL_MVM_SCAN_NONE,
        IWL_MVM_SCAN_OS,
@@ -913,7 +915,7 @@ u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
 bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
                                     struct ieee80211_sta *sta);
 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
-                          struct ieee80211_tx_info *info);
+                          struct ieee80211_tx_info *info, u8 ac);
 int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable);
 
 enum iwl_bt_kill_msk {
index 2677d1c0e1a1b69a46b533cb722d7f386974b8a2..67393535a5fb61c0da599c932fcacddff7ec31df 100644 (file)
@@ -851,7 +851,7 @@ static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
        return ret;
 }
 
-static const u8 tid_to_mac80211_ac[] = {
+const u8 tid_to_mac80211_ac[] = {
        IEEE80211_AC_BE,
        IEEE80211_AC_BK,
        IEEE80211_AC_BK,
index dd813d463218a07c378ef8e68e4cdd7d23f29c4f..0e3f45a8553ed654c21ccc3bfce637349820e7ea 100644 (file)
@@ -79,6 +79,7 @@ static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
        __le16 fc = hdr->frame_control;
        u32 tx_flags = le32_to_cpu(tx_cmd->tx_flags);
        u32 len = skb->len + FCS_LEN;
+       u8 ac;
 
        if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
                tx_flags |= TX_CMD_FLG_ACK;
@@ -90,9 +91,6 @@ static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
        else if (ieee80211_is_back_req(fc))
                tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR;
 
-       tx_flags |= iwl_mvm_bt_coex_tx_prio(mvm, hdr, info) <<
-                       TX_CMD_FLG_BT_PRIO_POS;
-
        if (ieee80211_has_morefrags(fc))
                tx_flags |= TX_CMD_FLG_MORE_FRAG;
 
@@ -108,6 +106,11 @@ static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
                        tx_flags &= ~TX_CMD_FLG_SEQ_CTL;
        }
 
+       /* tid_tspec will default to 0 = BE when QOS isn't enabled */
+       ac = tid_to_mac80211_ac[tx_cmd->tid_tspec];
+       tx_flags |= iwl_mvm_bt_coex_tx_prio(mvm, hdr, info, ac) <<
+                       TX_CMD_FLG_BT_PRIO_POS;
+
        if (ieee80211_is_mgmt(fc)) {
                if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc))
                        tx_cmd->pm_frame_timeout = cpu_to_le16(3);