wifi: iwlwifi: mld: add BIOS revision compatibility check for PPAG command

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
This commit is contained in:
Pagadala Yesu Anjaneyulu 2026-03-20 10:09:14 +02:00 committed by Miri Korenblit
parent 6e6d8f344d
commit 4aece67f1c

View 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)