Commit 88742c9e authored by Johannes Berg's avatar Johannes Berg Committed by Emmanuel Grumbach

iwlwifi: mvm: move existing UMAC commands to group 1

Existing UMAC commands already use the long header, but are sent
with group 0 and the long header inserted manually. Move them to
the group 1 to take advantage of the header building in the low-
level transport.

Existing firmware ignores the group_id field (it's reserved) and
the first firmware that really supports long command headers can
parse all commands in both group 0 (with short header) and group
1 (with long header.)
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent ab02165c
...@@ -148,6 +148,11 @@ static inline u32 iwl_cmd_id(u8 opcode, u8 groupid, u8 version) ...@@ -148,6 +148,11 @@ static inline u32 iwl_cmd_id(u8 opcode, u8 groupid, u8 version)
return opcode + (groupid << 8) + (version << 16); return opcode + (groupid << 8) + (version << 16);
} }
/* due to the conversion, this group is special; new groups
* should be defined in the appropriate fw-api header files
*/
#define IWL_ALWAYS_LONG_GROUP 1
/** /**
* struct iwl_cmd_header * struct iwl_cmd_header
* *
......
...@@ -550,18 +550,6 @@ struct iwl_periodic_scan_complete { ...@@ -550,18 +550,6 @@ struct iwl_periodic_scan_complete {
/* UMAC Scan API */ /* UMAC Scan API */
/**
* struct iwl_mvm_umac_cmd_hdr - Command header for UMAC commands
* @size: size of the command (not including header)
* @reserved0: for future use and alignment
* @ver: API version number
*/
struct iwl_mvm_umac_cmd_hdr {
__le16 size;
u8 reserved0;
u8 ver;
} __packed;
/* The maximum of either of these cannot exceed 8, because we use an /* The maximum of either of these cannot exceed 8, because we use an
* 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h). * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
*/ */
...@@ -621,7 +609,6 @@ enum iwl_channel_flags { ...@@ -621,7 +609,6 @@ enum iwl_channel_flags {
/** /**
* struct iwl_scan_config * struct iwl_scan_config
* @hdr: umac command header
* @flags: enum scan_config_flags * @flags: enum scan_config_flags
* @tx_chains: valid_tx antenna - ANT_* definitions * @tx_chains: valid_tx antenna - ANT_* definitions
* @rx_chains: valid_rx antenna - ANT_* definitions * @rx_chains: valid_rx antenna - ANT_* definitions
...@@ -639,7 +626,6 @@ enum iwl_channel_flags { ...@@ -639,7 +626,6 @@ enum iwl_channel_flags {
* @channel_array: default supported channels * @channel_array: default supported channels
*/ */
struct iwl_scan_config { struct iwl_scan_config {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 flags; __le32 flags;
__le32 tx_chains; __le32 tx_chains;
__le32 rx_chains; __le32 rx_chains;
...@@ -734,7 +720,6 @@ struct iwl_scan_req_umac_tail { ...@@ -734,7 +720,6 @@ struct iwl_scan_req_umac_tail {
/** /**
* struct iwl_scan_req_umac * struct iwl_scan_req_umac
* @hdr: umac command header
* @flags: &enum iwl_umac_scan_flags * @flags: &enum iwl_umac_scan_flags
* @uid: scan id, &enum iwl_umac_scan_uid_offsets * @uid: scan id, &enum iwl_umac_scan_uid_offsets
* @ooc_priority: out of channel priority - &enum iwl_scan_priority * @ooc_priority: out of channel priority - &enum iwl_scan_priority
...@@ -753,7 +738,6 @@ struct iwl_scan_req_umac_tail { ...@@ -753,7 +738,6 @@ struct iwl_scan_req_umac_tail {
* &struct iwl_scan_req_umac_tail * &struct iwl_scan_req_umac_tail
*/ */
struct iwl_scan_req_umac { struct iwl_scan_req_umac {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 flags; __le32 flags;
__le32 uid; __le32 uid;
__le32 ooc_priority; __le32 ooc_priority;
...@@ -775,12 +759,10 @@ struct iwl_scan_req_umac { ...@@ -775,12 +759,10 @@ struct iwl_scan_req_umac {
/** /**
* struct iwl_umac_scan_abort * struct iwl_umac_scan_abort
* @hdr: umac command header
* @uid: scan id, &enum iwl_umac_scan_uid_offsets * @uid: scan id, &enum iwl_umac_scan_uid_offsets
* @flags: reserved * @flags: reserved
*/ */
struct iwl_umac_scan_abort { struct iwl_umac_scan_abort {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 uid; __le32 uid;
__le32 flags; __le32 flags;
} __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */ } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
......
...@@ -88,7 +88,6 @@ enum iwl_mvm_tof_sub_grp_ids { ...@@ -88,7 +88,6 @@ enum iwl_mvm_tof_sub_grp_ids {
* @is_buf_required: 1 channel estimation buffer required, 0 - otherwise * @is_buf_required: 1 channel estimation buffer required, 0 - otherwise
*/ */
struct iwl_tof_config_cmd { struct iwl_tof_config_cmd {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 sub_grp_cmd_id; __le32 sub_grp_cmd_id;
u8 tof_disabled; u8 tof_disabled;
u8 one_sided_disabled; u8 one_sided_disabled;
...@@ -136,7 +135,6 @@ struct iwl_tof_config_cmd { ...@@ -136,7 +135,6 @@ struct iwl_tof_config_cmd {
* @bssid: Current AP BSSID * @bssid: Current AP BSSID
*/ */
struct iwl_tof_responder_config_cmd { struct iwl_tof_responder_config_cmd {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 sub_grp_cmd_id; __le32 sub_grp_cmd_id;
__le16 burst_period; __le16 burst_period;
u8 min_delta_ftm; u8 min_delta_ftm;
...@@ -171,7 +169,6 @@ struct iwl_tof_responder_config_cmd { ...@@ -171,7 +169,6 @@ struct iwl_tof_responder_config_cmd {
* value to be sent to the AP * value to be sent to the AP
*/ */
struct iwl_tof_range_req_ext_cmd { struct iwl_tof_range_req_ext_cmd {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 sub_grp_cmd_id; __le32 sub_grp_cmd_id;
__le16 tsf_timer_offset_msec; __le16 tsf_timer_offset_msec;
__le16 reserved; __le16 reserved;
...@@ -273,7 +270,6 @@ enum iwl_tof_response_mode { ...@@ -273,7 +270,6 @@ enum iwl_tof_response_mode {
* Bits set to 1 shall be randomized by the UMAC * Bits set to 1 shall be randomized by the UMAC
*/ */
struct iwl_tof_range_req_cmd { struct iwl_tof_range_req_cmd {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 sub_grp_cmd_id; __le32 sub_grp_cmd_id;
u8 request_id; u8 request_id;
u8 initiator; u8 initiator;
...@@ -382,7 +378,6 @@ struct iwl_tof_neighbor_report { ...@@ -382,7 +378,6 @@ struct iwl_tof_neighbor_report {
* @request_id: corresponds to a range request * @request_id: corresponds to a range request
*/ */
struct iwl_tof_range_abort_cmd { struct iwl_tof_range_abort_cmd {
struct iwl_mvm_umac_cmd_hdr hdr;
__le32 sub_grp_cmd_id; __le32 sub_grp_cmd_id;
u8 request_id; u8 request_id;
u8 reserved[3]; u8 reserved[3];
......
...@@ -884,9 +884,9 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) ...@@ -884,9 +884,9 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
int num_channels = int num_channels =
mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels + mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels +
mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels;
int ret, i, j = 0, cmd_size, data_size; int ret, i, j = 0, cmd_size;
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = SCAN_CFG_CMD, .id = iwl_cmd_id(SCAN_CFG_CMD, IWL_ALWAYS_LONG_GROUP, 0),
}; };
if (WARN_ON(num_channels > mvm->fw->ucode_capa.n_scan_channels)) if (WARN_ON(num_channels > mvm->fw->ucode_capa.n_scan_channels))
...@@ -898,8 +898,6 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) ...@@ -898,8 +898,6 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
if (!scan_config) if (!scan_config)
return -ENOMEM; return -ENOMEM;
data_size = cmd_size - sizeof(struct iwl_mvm_umac_cmd_hdr);
scan_config->hdr.size = cpu_to_le16(data_size);
scan_config->flags = cpu_to_le32(SCAN_CONFIG_FLAG_ACTIVATE | scan_config->flags = cpu_to_le32(SCAN_CONFIG_FLAG_ACTIVATE |
SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS | SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS |
SCAN_CONFIG_FLAG_SET_TX_CHAINS | SCAN_CONFIG_FLAG_SET_TX_CHAINS |
...@@ -1045,8 +1043,6 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -1045,8 +1043,6 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
return uid; return uid;
memset(cmd, 0, ksize(cmd)); memset(cmd, 0, ksize(cmd));
cmd->hdr.size = cpu_to_le16(iwl_mvm_scan_size(mvm) -
sizeof(struct iwl_mvm_umac_cmd_hdr));
iwl_mvm_scan_umac_dwell(mvm, cmd, params); iwl_mvm_scan_umac_dwell(mvm, cmd, params);
...@@ -1183,7 +1179,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -1183,7 +1179,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
iwl_mvm_build_scan_probe(mvm, vif, ies, &params); iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
hcmd.id = SCAN_REQ_UMAC; hcmd.id = iwl_cmd_id(SCAN_REQ_UMAC, IWL_ALWAYS_LONG_GROUP, 0);
ret = iwl_mvm_scan_umac(mvm, vif, &params, ret = iwl_mvm_scan_umac(mvm, vif, &params,
IWL_MVM_SCAN_REGULAR); IWL_MVM_SCAN_REGULAR);
} else { } else {
...@@ -1291,7 +1287,7 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, ...@@ -1291,7 +1287,7 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
iwl_mvm_build_scan_probe(mvm, vif, ies, &params); iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
hcmd.id = SCAN_REQ_UMAC; hcmd.id = iwl_cmd_id(SCAN_REQ_UMAC, IWL_ALWAYS_LONG_GROUP, 0);
ret = iwl_mvm_scan_umac(mvm, vif, &params, IWL_MVM_SCAN_SCHED); ret = iwl_mvm_scan_umac(mvm, vif, &params, IWL_MVM_SCAN_SCHED);
} else { } else {
hcmd.id = SCAN_OFFLOAD_REQUEST_CMD; hcmd.id = SCAN_OFFLOAD_REQUEST_CMD;
...@@ -1369,10 +1365,7 @@ void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, ...@@ -1369,10 +1365,7 @@ void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type) static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type)
{ {
struct iwl_umac_scan_abort cmd = { struct iwl_umac_scan_abort cmd = {};
.hdr.size = cpu_to_le16(sizeof(struct iwl_umac_scan_abort) -
sizeof(struct iwl_mvm_umac_cmd_hdr)),
};
int uid, ret; int uid, ret;
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
...@@ -1389,7 +1382,10 @@ static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type) ...@@ -1389,7 +1382,10 @@ static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type)
IWL_DEBUG_SCAN(mvm, "Sending scan abort, uid %u\n", uid); IWL_DEBUG_SCAN(mvm, "Sending scan abort, uid %u\n", uid);
ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_UMAC, 0, sizeof(cmd), &cmd); ret = iwl_mvm_send_cmd_pdu(mvm,
iwl_cmd_id(SCAN_ABORT_UMAC,
IWL_ALWAYS_LONG_GROUP, 0),
0, sizeof(cmd), &cmd);
if (!ret) if (!ret)
mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT;
......
...@@ -74,33 +74,21 @@ void iwl_mvm_tof_init(struct iwl_mvm *mvm) ...@@ -74,33 +74,21 @@ void iwl_mvm_tof_init(struct iwl_mvm *mvm)
memset(tof_data, 0, sizeof(*tof_data)); memset(tof_data, 0, sizeof(*tof_data));
tof_data->tof_cfg.hdr.size =
cpu_to_le16(sizeof(struct iwl_tof_config_cmd) -
sizeof(struct iwl_mvm_umac_cmd_hdr));
tof_data->tof_cfg.sub_grp_cmd_id = cpu_to_le32(TOF_CONFIG_CMD); tof_data->tof_cfg.sub_grp_cmd_id = cpu_to_le32(TOF_CONFIG_CMD);
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
if (IWL_MVM_TOF_IS_RESPONDER) { if (IWL_MVM_TOF_IS_RESPONDER) {
tof_data->responder_cfg.hdr.size =
cpu_to_le16(sizeof(struct iwl_tof_responder_config_cmd) -
sizeof(struct iwl_mvm_umac_cmd_hdr));
tof_data->responder_cfg.sub_grp_cmd_id = tof_data->responder_cfg.sub_grp_cmd_id =
cpu_to_le32(TOF_RESPONDER_CONFIG_CMD); cpu_to_le32(TOF_RESPONDER_CONFIG_CMD);
tof_data->responder_cfg.sta_id = IWL_MVM_STATION_COUNT; tof_data->responder_cfg.sta_id = IWL_MVM_STATION_COUNT;
} }
#endif #endif
tof_data->range_req.hdr.size =
cpu_to_le16(sizeof(struct iwl_tof_range_req_cmd) -
sizeof(struct iwl_mvm_umac_cmd_hdr));
tof_data->range_req.sub_grp_cmd_id = cpu_to_le32(TOF_RANGE_REQ_CMD); tof_data->range_req.sub_grp_cmd_id = cpu_to_le32(TOF_RANGE_REQ_CMD);
tof_data->range_req.req_timeout = 1; tof_data->range_req.req_timeout = 1;
tof_data->range_req.initiator = 1; tof_data->range_req.initiator = 1;
tof_data->range_req.report_policy = 3; tof_data->range_req.report_policy = 3;
tof_data->range_req_ext.hdr.size =
cpu_to_le16(sizeof(struct iwl_tof_range_req_ext_cmd) -
sizeof(struct iwl_mvm_umac_cmd_hdr));
tof_data->range_req_ext.sub_grp_cmd_id = tof_data->range_req_ext.sub_grp_cmd_id =
cpu_to_le32(TOF_RANGE_REQ_EXT_CMD); cpu_to_le32(TOF_RANGE_REQ_EXT_CMD);
...@@ -147,15 +135,15 @@ int iwl_mvm_tof_config_cmd(struct iwl_mvm *mvm) ...@@ -147,15 +135,15 @@ int iwl_mvm_tof_config_cmd(struct iwl_mvm *mvm)
} }
mvm->tof_data.active_range_request = IWL_MVM_TOF_RANGE_REQ_MAX_ID; mvm->tof_data.active_range_request = IWL_MVM_TOF_RANGE_REQ_MAX_ID;
return iwl_mvm_send_cmd_pdu(mvm, TOF_CMD, 0, sizeof(*cmd), cmd); return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(TOF_CMD,
IWL_ALWAYS_LONG_GROUP, 0),
0, sizeof(*cmd), cmd);
} }
int iwl_mvm_tof_range_abort_cmd(struct iwl_mvm *mvm, u8 id) int iwl_mvm_tof_range_abort_cmd(struct iwl_mvm *mvm, u8 id)
{ {
struct iwl_tof_range_abort_cmd cmd = { struct iwl_tof_range_abort_cmd cmd = {
.sub_grp_cmd_id = cpu_to_le32(TOF_RANGE_ABORT_CMD), .sub_grp_cmd_id = cpu_to_le32(TOF_RANGE_ABORT_CMD),
.hdr.size = cpu_to_le16(sizeof(struct iwl_tof_range_abort_cmd) -
sizeof(struct iwl_mvm_umac_cmd_hdr)),
.request_id = id, .request_id = id,
}; };
...@@ -173,7 +161,9 @@ int iwl_mvm_tof_range_abort_cmd(struct iwl_mvm *mvm, u8 id) ...@@ -173,7 +161,9 @@ int iwl_mvm_tof_range_abort_cmd(struct iwl_mvm *mvm, u8 id)
/* after abort is sent there's no active request anymore */ /* after abort is sent there's no active request anymore */
mvm->tof_data.active_range_request = IWL_MVM_TOF_RANGE_REQ_MAX_ID; mvm->tof_data.active_range_request = IWL_MVM_TOF_RANGE_REQ_MAX_ID;
return iwl_mvm_send_cmd_pdu(mvm, TOF_CMD, 0, sizeof(cmd), &cmd); return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(TOF_CMD,
IWL_ALWAYS_LONG_GROUP, 0),
0, sizeof(cmd), &cmd);
} }
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
...@@ -194,7 +184,9 @@ int iwl_mvm_tof_responder_cmd(struct iwl_mvm *mvm, ...@@ -194,7 +184,9 @@ int iwl_mvm_tof_responder_cmd(struct iwl_mvm *mvm,
} }
cmd->sta_id = mvmvif->bcast_sta.sta_id; cmd->sta_id = mvmvif->bcast_sta.sta_id;
return iwl_mvm_send_cmd_pdu(mvm, TOF_CMD, 0, sizeof(*cmd), cmd); return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(TOF_CMD,
IWL_ALWAYS_LONG_GROUP, 0),
0, sizeof(*cmd), cmd);
} }
#endif #endif
...@@ -245,8 +237,9 @@ int iwl_mvm_tof_range_request_ext_cmd(struct iwl_mvm *mvm, ...@@ -245,8 +237,9 @@ int iwl_mvm_tof_range_request_ext_cmd(struct iwl_mvm *mvm,
return -EIO; return -EIO;
} }
return iwl_mvm_send_cmd_pdu(mvm, TOF_CMD, 0, return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(TOF_CMD,
sizeof(mvm->tof_data.range_req_ext), IWL_ALWAYS_LONG_GROUP, 0),
0, sizeof(mvm->tof_data.range_req_ext),
&mvm->tof_data.range_req_ext); &mvm->tof_data.range_req_ext);
} }
......
...@@ -1328,7 +1328,8 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, ...@@ -1328,7 +1328,8 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD]; const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD];
u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD]; u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD];
if (WARN(!trans_pcie->wide_cmd_header && group_id != 0, if (WARN(!trans_pcie->wide_cmd_header &&
group_id > IWL_ALWAYS_LONG_GROUP,
"unsupported wide command %#x\n", cmd->id)) "unsupported wide command %#x\n", cmd->id))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment