]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iwlwifi: mvm: send the low latency command
authorShaul Triebitz <shaul.triebitz@intel.com>
Sun, 10 Dec 2017 15:11:38 +0000 (17:11 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 20 Dec 2017 16:28:25 +0000 (18:28 +0200)
Recently a new command was added to the firmware
for setting a MAC's low-latency mode.  Use it.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
drivers/net/wireless/intel/iwlwifi/mvm/utils.c

index ec42c84e5df2f16edac71584d7a1d812f6491e4f..17c7ef1662a9d6319f34cb1d2e03ca10b5a9407c 100644 (file)
  * enum iwl_mac_conf_subcmd_ids - mac configuration command IDs
  */
 enum iwl_mac_conf_subcmd_ids {
+       /**
+        * @LOW_LATENCY_CMD: &struct iwl_mac_low_latency_cmd
+        */
+       LOW_LATENCY_CMD = 0x3,
        /**
         * @CHANNEL_SWITCH_NOA_NOTIF: &struct iwl_channel_switch_noa_notif
         */
@@ -82,4 +86,19 @@ struct iwl_channel_switch_noa_notif {
        __le32 id_and_color;
 } __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */
 
+/**
+ * struct iwl_mac_low_latency_cmd - set/clear mac to 'low-latency mode'
+ *
+ * @mac_id: MAC ID to whom to apply the low-latency configurations
+ * @low_latency_rx: 1/0 to set/clear Rx low latency direction
+ * @low_latency_tx: 1/0 to set/clear Tx low latency direction
+ * @reserved: reserved for alignment purposes
+ */
+struct iwl_mac_low_latency_cmd {
+       __le32 mac_id;
+       u8 low_latency_rx;
+       u8 low_latency_tx;
+       __le16 reserved;
+} __packed; /* MAC_LOW_LATENCY_API_S_VER_1 */
+
 #endif /* __iwl_fw_api_mac_cfg_h__ */
index b2e9a79d41865b1ef46461dda64b44d3b80e78b0..2fead5eb63fe59d5c8c22937b23891beaa3c1200 100644 (file)
@@ -1032,12 +1032,34 @@ int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 {
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
        int res;
+       bool low_latency;
 
        lockdep_assert_held(&mvm->mutex);
 
-       if (iwl_mvm_vif_low_latency(mvmvif) == prev)
+       low_latency = iwl_mvm_vif_low_latency(mvmvif);
+
+       if (low_latency == prev)
                return 0;
 
+       if (fw_has_capa(&mvm->fw->ucode_capa,
+                       IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA)) {
+               struct iwl_mac_low_latency_cmd cmd = {
+                       .mac_id = cpu_to_le32(mvmvif->id)
+               };
+
+               if (low_latency) {
+                       /* currently we don't care about the direction */
+                       cmd.low_latency_rx = 1;
+                       cmd.low_latency_tx = 1;
+               }
+               res = iwl_mvm_send_cmd_pdu(mvm,
+                                          iwl_cmd_id(LOW_LATENCY_CMD,
+                                                     MAC_CONF_GROUP, 0),
+                                          0, sizeof(cmd), &cmd);
+               if (res)
+                       IWL_ERR(mvm, "Failed to send low latency command\n");
+       }
+
        res = iwl_mvm_update_quotas(mvm, false, NULL);
        if (res)
                return res;