Commit 3fa50738 authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlagn: prepare for multi-TB commands

In a subsequent patch, I want to make commands use
multiple TBs in a TFD. This is a simple change to
prepare the data structures for this, with as of
now still just a single TB supported.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 6b86bd62
...@@ -195,9 +195,9 @@ static int iwl2030_hw_channel_switch(struct iwl_priv *priv, ...@@ -195,9 +195,9 @@ static int iwl2030_hw_channel_switch(struct iwl_priv *priv,
struct ieee80211_vif *vif = ctx->vif; struct ieee80211_vif *vif = ctx->vif;
struct iwl_host_cmd hcmd = { struct iwl_host_cmd hcmd = {
.id = REPLY_CHANNEL_SWITCH, .id = REPLY_CHANNEL_SWITCH,
.len = sizeof(cmd), .len = { sizeof(cmd), },
.flags = CMD_SYNC, .flags = CMD_SYNC,
.data = &cmd, .data = { &cmd, },
}; };
cmd.band = priv->band == IEEE80211_BAND_2GHZ; cmd.band = priv->band == IEEE80211_BAND_2GHZ;
......
...@@ -282,9 +282,9 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, ...@@ -282,9 +282,9 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
struct ieee80211_vif *vif = ctx->vif; struct ieee80211_vif *vif = ctx->vif;
struct iwl_host_cmd hcmd = { struct iwl_host_cmd hcmd = {
.id = REPLY_CHANNEL_SWITCH, .id = REPLY_CHANNEL_SWITCH,
.len = sizeof(cmd), .len = { sizeof(cmd), },
.flags = CMD_SYNC, .flags = CMD_SYNC,
.data = &cmd, .data = { &cmd, },
}; };
cmd.band = priv->band == IEEE80211_BAND_2GHZ; cmd.band = priv->band == IEEE80211_BAND_2GHZ;
......
...@@ -221,9 +221,9 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, ...@@ -221,9 +221,9 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
struct ieee80211_vif *vif = ctx->vif; struct ieee80211_vif *vif = ctx->vif;
struct iwl_host_cmd hcmd = { struct iwl_host_cmd hcmd = {
.id = REPLY_CHANNEL_SWITCH, .id = REPLY_CHANNEL_SWITCH,
.len = sizeof(cmd), .len = { sizeof(cmd), },
.flags = CMD_SYNC, .flags = CMD_SYNC,
.data = &cmd, .data = { &cmd, },
}; };
cmd.band = priv->band == IEEE80211_BAND_2GHZ; cmd.band = priv->band == IEEE80211_BAND_2GHZ;
......
...@@ -93,8 +93,8 @@ int iwl_send_calib_results(struct iwl_priv *priv) ...@@ -93,8 +93,8 @@ int iwl_send_calib_results(struct iwl_priv *priv)
for (i = 0; i < IWL_CALIB_MAX; i++) { for (i = 0; i < IWL_CALIB_MAX; i++) {
if ((BIT(i) & priv->hw_params.calib_init_cfg) && if ((BIT(i) & priv->hw_params.calib_init_cfg) &&
priv->calib_results[i].buf) { priv->calib_results[i].buf) {
hcmd.len = priv->calib_results[i].buf_len; hcmd.len[0] = priv->calib_results[i].buf_len;
hcmd.data = priv->calib_results[i].buf; hcmd.data[0] = priv->calib_results[i].buf;
ret = iwl_send_cmd_sync(priv, &hcmd); ret = iwl_send_cmd_sync(priv, &hcmd);
if (ret) { if (ret) {
IWL_ERR(priv, "Error %d iteration %d\n", IWL_ERR(priv, "Error %d iteration %d\n",
...@@ -456,9 +456,9 @@ static int iwl_sensitivity_write(struct iwl_priv *priv) ...@@ -456,9 +456,9 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
struct iwl_sensitivity_data *data = NULL; struct iwl_sensitivity_data *data = NULL;
struct iwl_host_cmd cmd_out = { struct iwl_host_cmd cmd_out = {
.id = SENSITIVITY_CMD, .id = SENSITIVITY_CMD,
.len = sizeof(struct iwl_sensitivity_cmd), .len = { sizeof(struct iwl_sensitivity_cmd), },
.flags = CMD_ASYNC, .flags = CMD_ASYNC,
.data = &cmd, .data = { &cmd, },
}; };
data = &(priv->sensitivity_data); data = &(priv->sensitivity_data);
...@@ -491,9 +491,9 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv) ...@@ -491,9 +491,9 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)
struct iwl_sensitivity_data *data = NULL; struct iwl_sensitivity_data *data = NULL;
struct iwl_host_cmd cmd_out = { struct iwl_host_cmd cmd_out = {
.id = SENSITIVITY_CMD, .id = SENSITIVITY_CMD,
.len = sizeof(struct iwl_enhance_sensitivity_cmd), .len = { sizeof(struct iwl_enhance_sensitivity_cmd), },
.flags = CMD_ASYNC, .flags = CMD_ASYNC,
.data = &cmd, .data = { &cmd, },
}; };
data = &(priv->sensitivity_data); data = &(priv->sensitivity_data);
......
...@@ -1140,7 +1140,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -1140,7 +1140,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
{ {
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = REPLY_SCAN_CMD, .id = REPLY_SCAN_CMD,
.len = sizeof(struct iwl_scan_cmd), .len = { sizeof(struct iwl_scan_cmd), },
.flags = CMD_SIZE_HUGE, .flags = CMD_SIZE_HUGE,
}; };
struct iwl_scan_cmd *scan; struct iwl_scan_cmd *scan;
...@@ -1425,10 +1425,10 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -1425,10 +1425,10 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
return -EIO; return -EIO;
} }
cmd.len += le16_to_cpu(scan->tx_cmd.len) + cmd.len[0] += le16_to_cpu(scan->tx_cmd.len) +
scan->channel_count * sizeof(struct iwl_scan_channel); scan->channel_count * sizeof(struct iwl_scan_channel);
cmd.data = scan; cmd.data[0] = scan;
scan->len = cpu_to_le16(cmd.len); scan->len = cpu_to_le16(cmd.len[0]);
/* set scan bit here for PAN params */ /* set scan bit here for PAN params */
set_bit(STATUS_SCAN_HW, &priv->status); set_bit(STATUS_SCAN_HW, &priv->status);
...@@ -1520,9 +1520,9 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control) ...@@ -1520,9 +1520,9 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
struct iwl_txfifo_flush_cmd flush_cmd; struct iwl_txfifo_flush_cmd flush_cmd;
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = REPLY_TXFIFO_FLUSH, .id = REPLY_TXFIFO_FLUSH,
.len = sizeof(struct iwl_txfifo_flush_cmd), .len = { sizeof(struct iwl_txfifo_flush_cmd), },
.flags = CMD_SYNC, .flags = CMD_SYNC,
.data = &flush_cmd, .data = { &flush_cmd, },
}; };
might_sleep(); might_sleep();
......
...@@ -144,7 +144,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, ...@@ -144,7 +144,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
size_t cmd_size = sizeof(struct iwl_wep_cmd); size_t cmd_size = sizeof(struct iwl_wep_cmd);
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = ctx->wep_key_cmd, .id = ctx->wep_key_cmd,
.data = wep_cmd, .data = { wep_cmd, },
.flags = CMD_SYNC, .flags = CMD_SYNC,
}; };
...@@ -172,7 +172,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, ...@@ -172,7 +172,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
cmd_size += sizeof(struct iwl_wep_key) * WEP_KEYS_MAX; cmd_size += sizeof(struct iwl_wep_key) * WEP_KEYS_MAX;
cmd.len = cmd_size; cmd.len[0] = cmd_size;
if (not_empty || send_if_empty) if (not_empty || send_if_empty)
return iwl_send_cmd(priv, &cmd); return iwl_send_cmd(priv, &cmd);
......
...@@ -217,8 +217,8 @@ static int iwlagn_send_calib_cfg(struct iwl_priv *priv) ...@@ -217,8 +217,8 @@ static int iwlagn_send_calib_cfg(struct iwl_priv *priv)
struct iwl_calib_cfg_cmd calib_cfg_cmd; struct iwl_calib_cfg_cmd calib_cfg_cmd;
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = CALIBRATION_CFG_CMD, .id = CALIBRATION_CFG_CMD,
.len = sizeof(struct iwl_calib_cfg_cmd), .len = { sizeof(struct iwl_calib_cfg_cmd), },
.data = &calib_cfg_cmd, .data = { &calib_cfg_cmd, },
}; };
memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd)); memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd));
......
...@@ -189,8 +189,8 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv) ...@@ -189,8 +189,8 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
rate_flags); rate_flags);
/* Submit command */ /* Submit command */
cmd.len = sizeof(*tx_beacon_cmd) + frame_size; cmd.len[0] = sizeof(*tx_beacon_cmd) + frame_size;
cmd.data = tx_beacon_cmd; cmd.data[0] = tx_beacon_cmd;
err = iwl_send_cmd_sync(priv, &cmd); err = iwl_send_cmd_sync(priv, &cmd);
...@@ -2114,8 +2114,8 @@ static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg) ...@@ -2114,8 +2114,8 @@ static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg)
struct iwl_calib_cfg_cmd calib_cfg_cmd; struct iwl_calib_cfg_cmd calib_cfg_cmd;
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = CALIBRATION_CFG_CMD, .id = CALIBRATION_CFG_CMD,
.len = sizeof(struct iwl_calib_cfg_cmd), .len = { sizeof(struct iwl_calib_cfg_cmd), },
.data = &calib_cfg_cmd, .data = { &calib_cfg_cmd, },
}; };
memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd)); memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd));
......
...@@ -277,15 +277,16 @@ struct iwl_device_cmd { ...@@ -277,15 +277,16 @@ struct iwl_device_cmd {
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
#define IWL_MAX_CMD_TFDS 1
struct iwl_host_cmd { struct iwl_host_cmd {
const void *data; const void *data[IWL_MAX_CMD_TFDS];
unsigned long reply_page; unsigned long reply_page;
void (*callback)(struct iwl_priv *priv, void (*callback)(struct iwl_priv *priv,
struct iwl_device_cmd *cmd, struct iwl_device_cmd *cmd,
struct iwl_rx_packet *pkt); struct iwl_rx_packet *pkt);
u32 flags; u32 flags;
u16 len; u16 len[IWL_MAX_CMD_TFDS];
u8 id; u8 id;
}; };
......
...@@ -264,8 +264,8 @@ int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) ...@@ -264,8 +264,8 @@ int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data)
{ {
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = id, .id = id,
.len = len, .len = { len, },
.data = data, .data = { data, },
}; };
return iwl_send_cmd_sync(priv, &cmd); return iwl_send_cmd_sync(priv, &cmd);
...@@ -279,8 +279,8 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, ...@@ -279,8 +279,8 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv,
{ {
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = id, .id = id,
.len = len, .len = { len, },
.data = data, .data = { data, },
}; };
cmd.flags |= CMD_ASYNC; cmd.flags |= CMD_ASYNC;
......
...@@ -107,8 +107,8 @@ static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) ...@@ -107,8 +107,8 @@ static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd)
{ {
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = REPLY_LEDS_CMD, .id = REPLY_LEDS_CMD,
.len = sizeof(struct iwl_led_cmd), .len = { sizeof(struct iwl_led_cmd), },
.data = led_cmd, .data = { led_cmd, },
.flags = CMD_ASYNC, .flags = CMD_ASYNC,
.callback = NULL, .callback = NULL,
}; };
......
...@@ -141,7 +141,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, ...@@ -141,7 +141,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = REPLY_ADD_STA, .id = REPLY_ADD_STA,
.flags = flags, .flags = flags,
.data = data, .data = { data, },
}; };
u8 sta_id __maybe_unused = sta->sta.sta_id; u8 sta_id __maybe_unused = sta->sta.sta_id;
...@@ -155,7 +155,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, ...@@ -155,7 +155,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
might_sleep(); might_sleep();
} }
cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data); cmd.len[0] = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
ret = iwl_send_cmd(priv, &cmd); ret = iwl_send_cmd(priv, &cmd);
if (ret || (flags & CMD_ASYNC)) if (ret || (flags & CMD_ASYNC))
...@@ -401,9 +401,9 @@ static int iwl_send_remove_station(struct iwl_priv *priv, ...@@ -401,9 +401,9 @@ static int iwl_send_remove_station(struct iwl_priv *priv,
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = REPLY_REMOVE_STA, .id = REPLY_REMOVE_STA,
.len = sizeof(struct iwl_rem_sta_cmd), .len = { sizeof(struct iwl_rem_sta_cmd), },
.flags = CMD_SYNC, .flags = CMD_SYNC,
.data = &rm_sta_cmd, .data = { &rm_sta_cmd, },
}; };
memset(&rm_sta_cmd, 0, sizeof(rm_sta_cmd)); memset(&rm_sta_cmd, 0, sizeof(rm_sta_cmd));
...@@ -760,9 +760,9 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -760,9 +760,9 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = REPLY_TX_LINK_QUALITY_CMD, .id = REPLY_TX_LINK_QUALITY_CMD,
.len = sizeof(struct iwl_link_quality_cmd), .len = { sizeof(struct iwl_link_quality_cmd), },
.flags = flags, .flags = flags,
.data = lq, .data = { lq, },
}; };
if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) if (WARN_ON(lq->sta_id == IWL_INVALID_STATION))
......
...@@ -198,10 +198,10 @@ static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -198,10 +198,10 @@ static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb)
} }
cmd.id = nla_get_u8(tb[IWL_TM_ATTR_UCODE_CMD_ID]); cmd.id = nla_get_u8(tb[IWL_TM_ATTR_UCODE_CMD_ID]);
cmd.data = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); cmd.data[0] = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);
cmd.len = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); cmd.len[0] = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);
IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x," IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x,"
" len %d\n", cmd.id, cmd.flags, cmd.len); " len %d\n", cmd.id, cmd.flags, cmd.len[0]);
/* ok, let's submit the command to ucode */ /* ok, let's submit the command to ucode */
return iwl_send_cmd(priv, &cmd); return iwl_send_cmd(priv, &cmd);
} }
......
...@@ -446,7 +446,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -446,7 +446,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
u16 fix_size; u16 fix_size;
bool is_ct_kill = false; bool is_ct_kill = false;
fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); fix_size = (u16)(cmd->len[0] + sizeof(out_cmd->hdr));
/* /*
* If any of the command structures end up being larger than * If any of the command structures end up being larger than
...@@ -506,7 +506,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -506,7 +506,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
out_meta->callback = cmd->callback; out_meta->callback = cmd->callback;
out_cmd->hdr.cmd = cmd->id; out_cmd->hdr.cmd = cmd->id;
memcpy(&out_cmd->cmd.payload, cmd->data, cmd->len); memcpy(&out_cmd->cmd.payload, cmd->data[0], cmd->len[0]);
/* At this point, the out_cmd now has all of the incoming cmd /* At this point, the out_cmd now has all of the incoming cmd
* information */ * information */
...@@ -555,7 +555,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -555,7 +555,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
phys_addr, fix_size, 1, phys_addr, fix_size, 1,
U32_PAD(cmd->len)); U32_PAD(cmd->len[0]));
/* Increment and update queue's write index */ /* Increment and update queue's write index */
q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
......
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