]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: mvm: prepare the introduction of V9 of REDUCED_TX_POWER
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 29 Jul 2024 17:20:02 +0000 (20:20 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 27 Aug 2024 08:14:26 +0000 (10:14 +0200)
* Rename iwl_dev_tx_power_cmd to iwl_dev_tx_power_cmd_v3_v8
* struct iwl_dev_tx_power_common needs to be packed. It was always the
  case, but now that its size is not a multiple of 4, it becomes
  meaningful.
* Move per_band data out of the common structure since it won't be
  present in the new versions of the command.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240729201718.8da29a66984f.I922bdef4740d990f98cb452e858c4157bbc491c5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/power.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c

index 6e6a92d173cc2b1f695bf8ff59ec44e1f8612691..4c9d28327efc47a91ca7d77a255adc885541d6e0 100644 (file)
@@ -285,18 +285,12 @@ enum iwl_dev_tx_power_cmd_mode {
  * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
  * @pwr_restriction: TX power restriction in 1/8 dBms.
- * @dev_24: device TX power restriction in 1/8 dBms
- * @dev_52_low: device TX power restriction upper band - low
- * @dev_52_high: device TX power restriction upper band - high
  */
 struct iwl_dev_tx_power_common {
        __le32 set_mode;
        __le32 mac_context_id;
        __le16 pwr_restriction;
-       __le16 dev_24;
-       __le16 dev_52_low;
-       __le16 dev_52_high;
-};
+} __packed;
 
 /**
  * struct iwl_dev_tx_power_cmd_v3 - TX power reduction command version 3
@@ -412,8 +406,20 @@ struct iwl_dev_tx_power_cmd_v8 {
        __le32 tpc_vlp_backoff_level;
 } __packed; /* TX_REDUCED_POWER_API_S_VER_8 */
 
+/*
+ * @dev_24: device TX power restriction in 1/8 dBms
+ * @dev_52_low: device TX power restriction upper band - low
+ * @dev_52_high: device TX power restriction upper band - high
+ */
+struct iwl_dev_tx_power_cmd_per_band {
+       __le16 dev_24;
+       __le16 dev_52_low;
+       __le16 dev_52_high;
+} __packed;
+
 /**
- * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion)
+ * struct iwl_dev_tx_power_cmd_v3_v8 - TX power reduction command (multiversion)
+ * @per_band: per band restrictions
  * @common: common part of the command
  * @v3: version 3 part of the command
  * @v4: version 4 part of the command
@@ -422,8 +428,9 @@ struct iwl_dev_tx_power_cmd_v8 {
  * @v7: version 7 part of the command
  * @v8: version 8 part of the command
  */
-struct iwl_dev_tx_power_cmd {
+struct iwl_dev_tx_power_cmd_v3_v8 {
        struct iwl_dev_tx_power_common common;
+       struct iwl_dev_tx_power_cmd_per_band per_band;
        union {
                struct iwl_dev_tx_power_cmd_v3 v3;
                struct iwl_dev_tx_power_cmd_v4 v4;
index 08c4898c8f1a33fd0045e1ca13ba1b70244720a5..4c0847446e22a0db13acd47fc85aa415f3695f30 100644 (file)
@@ -863,7 +863,7 @@ static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
 int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
 {
        u32 cmd_id = REDUCE_TX_POWER_CMD;
-       struct iwl_dev_tx_power_cmd cmd = {
+       struct iwl_dev_tx_power_cmd_v3_v8 cmd = {
                .common.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS),
        };
        __le16 *per_chain;
@@ -899,9 +899,12 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
                per_chain = cmd.v3.per_chain[0][0];
        }
 
-       /* all structs have the same common part, add it */
+       /* all structs have the same common part, add its length */
        len += sizeof(cmd.common);
 
+       /* all structs have the same per_band part, add its length */
+       len += sizeof(cmd.per_band);
+
        ret = iwl_sar_fill_profile(&mvm->fwrt, per_chain,
                                   IWL_NUM_CHAIN_TABLES,
                                   n_subbands, prof_a, prof_b);
index 835a05b9183331fa2f94bad31944f3043bf3a0c1..f0b290aa6bec43424d862c8ab82e28bc99bb3cc6 100644 (file)
@@ -1480,7 +1480,7 @@ int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 {
        u32 cmd_id = REDUCE_TX_POWER_CMD;
        int len;
-       struct iwl_dev_tx_power_cmd cmd = {
+       struct iwl_dev_tx_power_cmd_v3_v8 cmd = {
                .common.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_MAC),
                .common.mac_context_id =
                        cpu_to_le32(iwl_mvm_vif_from_mac80211(vif)->id),
@@ -1507,9 +1507,12 @@ int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        else
                len = sizeof(cmd.v3);
 
-       /* all structs have the same common part, add it */
+       /* all structs have the same common part, add its length */
        len += sizeof(cmd.common);
 
+       /* all structs have the same per_band part, add its length */
+       len += sizeof(cmd.per_band);
+
        return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, len, &cmd);
 }