nxpwifi_cmd_sta_cfg_data() writes the parsed calibration payload directly at S_DS_GEN without prepending the 6-byte host_cmd_ds_802_11_cfg_data header (action, type, data_len) expected by the firmware for HOST_CMD_CFG_DATA (0x008f), matching upstream mwifiex commit 9868c4ce9481 ("wifi: mwifiex: Fix RF calibration data download from file"). Add struct host_cmd_ds_802_11_cfg_data to struct host_cmd_ds_command, populate the header before the calibration payload, and include its size in cmd->size. Fixes: 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x") Assisted-by: GitHub-Copilot:Gemini-4-Argon Signed-off-by: Viktor Korsnes --- Tested on i.MX8MM with IW611 (SDIO, FW 18.99.8.p136.0) using a 458-byte calibration configuration file: verified via kprobes on nxpwifi_ret_sta_cfg_data() that HOST_CMD_CFG_DATA (0x8f) succeeds (result=0, action=1, type=0x2, data_len=458, size=472) and the firmware parses and endian-converts all 113 32-bit calibration words from the file. drivers/net/wireless/nxp/nxpwifi/fw.h | 10 ++++++++++ drivers/net/wireless/nxp/nxpwifi/sta_cmd.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/nxp/nxpwifi/fw.h b/drivers/net/wireless/nxp/nxpwifi/fw.h index 124728a72442..d4fe29faedea 100644 --- a/drivers/net/wireless/nxp/nxpwifi/fw.h +++ b/drivers/net/wireless/nxp/nxpwifi/fw.h @@ -2375,6 +2375,15 @@ struct host_cmd_twt_cfg { u8 val[]; } __packed; +#define NXPWIFI_CFG_TYPE_CAL 0x2 + +struct host_cmd_ds_802_11_cfg_data { + __le16 action; + __le16 type; + __le16 data_len; + u8 data[]; +} __packed; + struct host_cmd_ds_command { __le16 command; __le16 size; @@ -2382,6 +2391,7 @@ struct host_cmd_ds_command { __le16 result; union { struct host_cmd_ds_get_hw_spec hw_spec; + struct host_cmd_ds_802_11_cfg_data cfg_data; struct host_cmd_ds_mac_control mac_ctrl; struct host_cmd_ds_802_11_mac_address mac_addr; struct host_cmd_ds_mac_multicast_adr mc_addr; diff --git a/drivers/net/wireless/nxp/nxpwifi/sta_cmd.c b/drivers/net/wireless/nxp/nxpwifi/sta_cmd.c index f3cd5a51c438..a62ea7b9dc07 100644 --- a/drivers/net/wireless/nxp/nxpwifi/sta_cmd.c +++ b/drivers/net/wireless/nxp/nxpwifi/sta_cmd.c @@ -1421,24 +1421,28 @@ nxpwifi_cmd_sta_cfg_data(struct nxpwifi_private *priv, u16 cmd_action, u32 cmd_type) { struct nxpwifi_adapter *adapter = priv->adapter; + struct host_cmd_ds_802_11_cfg_data *pcfg_data = &cmd->params.cfg_data; u32 len; - u8 *data = (u8 *)cmd + S_DS_GEN; if (!adapter->cal_data || !adapter->cal_data->data || !adapter->cal_data->size) return -EINVAL; len = nxpwifi_parse_cal_cfg((u8 *)adapter->cal_data->data, - adapter->cal_data->size, data, - NXPWIFI_SIZE_OF_CMD_BUFFER - S_DS_GEN); + adapter->cal_data->size, pcfg_data->data, + NXPWIFI_SIZE_OF_CMD_BUFFER - S_DS_GEN - + sizeof(*pcfg_data)); if (!len) return -EINVAL; + pcfg_data->action = cpu_to_le16(cmd_action); + pcfg_data->type = cpu_to_le16(NXPWIFI_CFG_TYPE_CAL); + pcfg_data->data_len = cpu_to_le16(len); nxpwifi_dbg(adapter, INFO, "download cfg_data from config file\n"); cmd->command = cpu_to_le16(HOST_CMD_CFG_DATA); - cmd->size = cpu_to_le16(S_DS_GEN + len); + cmd->size = cpu_to_le16(S_DS_GEN + sizeof(*pcfg_data) + len); return 0; } -- 2.53.0