]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mld: add BIOS revision compatibility check for PPAG command
authorPagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Fri, 20 Mar 2026 08:09:14 +0000 (10:09 +0200)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 25 Mar 2026 09:31:57 +0000 (11:31 +0200)
Prevent potential issues when newer BIOS revisions
are used with firmware that doesn't support them for
PER_PLATFORM_ANT_GAIN_CMD.

Without this check, the driver may attempt to use
BIOS configurations that are incompatible with the
current firmware version, leading to dropping of
command in firmware without any failure notification
to driver.

Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.79bf2bf398d0.I8161dbe1a04af3738e00ab0fc13fe3dbfa9094ec@changeid
drivers/net/wireless/intel/iwlwifi/mld/regulatory.c

index f91f61ca9b2e6cb1d8ab164670231fb70e0fbd35..659243ada86c6a5bac9f09f47037eae6520ca34d 100644 (file)
@@ -214,6 +214,7 @@ static int iwl_mld_ppag_send_cmd(struct iwl_mld *mld)
        u32 cmd_id = WIDE_ID(PHY_OPS_GROUP, PER_PLATFORM_ANT_GAIN_CMD);
        int cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw, cmd_id, 1);
        int cmd_len = sizeof(cmd.v8);
+       u8 cmd_bios_rev;
        int ret;
 
        BUILD_BUG_ON(offsetof(typeof(cmd), v8.ppag_config_info.hdr) !=
@@ -249,6 +250,10 @@ static int iwl_mld_ppag_send_cmd(struct iwl_mld *mld)
                        }
                }
                cmd_len = sizeof(cmd.v7);
+               cmd_bios_rev =
+                       iwl_fw_lookup_cmd_bios_supported_revision(fwrt->fw,
+                                                                 fwrt->ppag_bios_source,
+                                                                 cmd_id, 4);
        } else if (cmd_ver == 8) {
                for (int chain = 0; chain < ARRAY_SIZE(cmd.v8.gain); chain++) {
                        for (int subband = 0;
@@ -262,12 +267,23 @@ static int iwl_mld_ppag_send_cmd(struct iwl_mld *mld)
                                                cmd.v8.gain[chain][subband]);
                        }
                }
+               cmd_bios_rev =
+                       iwl_fw_lookup_cmd_bios_supported_revision(fwrt->fw,
+                                                                 fwrt->ppag_bios_source,
+                                                                 cmd_id, 5);
        } else {
                WARN(1, "Bad version for PER_PLATFORM_ANT_GAIN_CMD %d\n",
                     cmd_ver);
                return -EINVAL;
        }
 
+       if (cmd_bios_rev < fwrt->ppag_bios_rev) {
+               IWL_ERR(mld,
+                       "BIOS revision compatibility check failed - Supported: %d, Current: %d\n",
+                       cmd_bios_rev, fwrt->ppag_bios_rev);
+               return 0;
+       }
+
        IWL_DEBUG_RADIO(mld, "Sending PER_PLATFORM_ANT_GAIN_CMD\n");
        ret = iwl_mld_send_cmd_pdu(mld, cmd_id, &cmd, cmd_len);
        if (ret < 0)