iwlwifi: mvm: Update TX power in TPC reports
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Tue, 1 Jul 2014 09:54:25 +0000 (12:54 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 16 Sep 2014 09:57:50 +0000 (12:57 +0300)
Introduce new tx command flag (TX_CMD_FLG_WRITE_TX_POWER) which requests the
fw to update the tx power value at some constant offset.
Set this flag when transmitting either TPC report or Link measurement report
action frames.
In addition, introduce new tlv which indicates whether the fw supports power
insertion (IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT) and publish the
corresponding nl80211 feature.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-fw.h
drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/tx.c

index 62c46eb8b99c5fff7a6fecf9b7d7eac4e9c9b639..6ab40bce039456b8dc8df964bb4a41f6e51e7f07 100644 (file)
@@ -145,9 +145,13 @@ enum iwl_ucode_tlv_api {
 /**
  * enum iwl_ucode_tlv_capa - ucode capabilities
  * @IWL_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3
+ * @IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT: supports insertion of current
+ *     tx power value into TPC Report action frame and Link Measurement Report
+ *     action frame
  */
 enum iwl_ucode_tlv_capa {
        IWL_UCODE_TLV_CAPA_D0I3_SUPPORT         = BIT(0),
+       IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT = BIT(8),
 };
 
 /* The default calibrate table size if not specified by firmware file */
index d6073f67b212e12c2c7565cadf44c50268763cd8..5bca1f8bfebf3d87177cacdbcc919f221aaee020 100644 (file)
@@ -66,6 +66,7 @@
 /**
  * enum iwl_tx_flags - bitmasks for tx_flags in TX command
  * @TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame
+ * @TX_CMD_FLG_WRITE_TX_POWER: update current tx power value in the mgmt frame
  * @TX_CMD_FLG_ACK: expect ACK from receiving station
  * @TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command.
  *     Otherwise, use rate_n_flags from the TX command
@@ -97,6 +98,7 @@
  */
 enum iwl_tx_flags {
        TX_CMD_FLG_PROT_REQUIRE         = BIT(0),
+       TX_CMD_FLG_WRITE_TX_POWER       = BIT(1),
        TX_CMD_FLG_ACK                  = BIT(3),
        TX_CMD_FLG_STA_RATE             = BIT(4),
        TX_CMD_FLG_BAR                  = BIT(6),
index 5f5a89399879038bac9e529c1063f2603ee5e3b6..ba029f621391710c892596c758b3bc46c38af724 100644 (file)
@@ -412,6 +412,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
                               NL80211_FEATURE_DYNAMIC_SMPS |
                               NL80211_FEATURE_STATIC_SMPS;
 
+       if (mvm->fw->ucode_capa.capa[0] &
+           IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT)
+               hw->wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION;
+
        mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
 
        /* currently FW API supports only one optional cipher scheme */
index c67296efa04db97b3936b60234f8a3b7650ea439..d84f3ca75f63edd91726dbbd8cb9ea5b08e57750 100644 (file)
@@ -133,6 +133,11 @@ static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
            !is_multicast_ether_addr(ieee80211_get_DA(hdr)))
                tx_flags |= TX_CMD_FLG_PROT_REQUIRE;
 
+       if ((mvm->fw->ucode_capa.capa[0] &
+            IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT) &&
+           ieee80211_action_contains_tpc(skb))
+               tx_flags |= TX_CMD_FLG_WRITE_TX_POWER;
+
        tx_cmd->tx_flags = cpu_to_le32(tx_flags);
        /* Total # bytes to be transmitted */
        tx_cmd->len = cpu_to_le16((u16)skb->len);