Commit 57e861d9 authored by David Spinadel's avatar David Spinadel Committed by Luca Coelho

iwlwifi: mvm: Change FW channel info API

Change iwl_fw_channel_info structure so it can have channel number
greater than 255. This is needed for 6 GHz channel numbers.
Change all relevant structs and member accesses accordingly.
The new API is indicated by a TLV capability bit.
Signed-off-by: default avatarDavid Spinadel <david.spinadel@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 5213e8a8
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as * it under the terms of version 2 of the GNU General Public License as
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -95,17 +97,36 @@ ...@@ -95,17 +97,36 @@
#define PHY_VHT_CTRL_POS_4_ABOVE (0x7) #define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
/* /*
* struct iwl_fw_channel_info_v1 - channel information
*
* @band: PHY_BAND_* * @band: PHY_BAND_*
* @channel: channel number * @channel: channel number
* @width: PHY_[VHT|LEGACY]_CHANNEL_* * @width: PHY_[VHT|LEGACY]_CHANNEL_*
* @ctrl channel: PHY_[VHT|LEGACY]_CTRL_* * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
*/ */
struct iwl_fw_channel_info { struct iwl_fw_channel_info_v1 {
u8 band; u8 band;
u8 channel; u8 channel;
u8 width; u8 width;
u8 ctrl_pos; u8 ctrl_pos;
} __packed; } __packed; /* CHANNEL_CONFIG_API_S_VER_1 */
/*
* struct iwl_fw_channel_info - channel information
*
* @channel: channel number
* @band: PHY_BAND_*
* @width: PHY_[VHT|LEGACY]_CHANNEL_*
* @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
* @reserved: for future use and alignment
*/
struct iwl_fw_channel_info {
__le32 channel;
u8 band;
u8 width;
u8 ctrl_pos;
u8 reserved;
} __packed; /*CHANNEL_CONFIG_API_S_VER_2 */
#define PHY_RX_CHAIN_DRIVER_FORCE_POS (0) #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
#define PHY_RX_CHAIN_DRIVER_FORCE_MSK \ #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
...@@ -133,6 +154,22 @@ struct iwl_fw_channel_info { ...@@ -133,6 +154,22 @@ struct iwl_fw_channel_info {
#define NUM_PHY_CTX 3 #define NUM_PHY_CTX 3
/* TODO: complete missing documentation */ /* TODO: complete missing documentation */
/**
* struct iwl_phy_context_cmd_tail - tail of iwl_phy_ctx_cmd for alignment with
* various channel structures.
*
* @txchain_info: ???
* @rxchain_info: ???
* @acquisition_data: ???
* @dsp_cfg_flags: set to 0
*/
struct iwl_phy_context_cmd_tail {
__le32 txchain_info;
__le32 rxchain_info;
__le32 acquisition_data;
__le32 dsp_cfg_flags;
} __packed;
/** /**
* struct iwl_phy_context_cmd - config of the PHY context * struct iwl_phy_context_cmd - config of the PHY context
* ( PHY_CONTEXT_CMD = 0x8 ) * ( PHY_CONTEXT_CMD = 0x8 )
...@@ -142,10 +179,7 @@ struct iwl_fw_channel_info { ...@@ -142,10 +179,7 @@ struct iwl_fw_channel_info {
* other value means apply new params after X usecs * other value means apply new params after X usecs
* @tx_param_color: ??? * @tx_param_color: ???
* @ci: channel info * @ci: channel info
* @txchain_info: ??? * @tail: command tail
* @rxchain_info: ???
* @acquisition_data: ???
* @dsp_cfg_flags: set to 0
*/ */
struct iwl_phy_context_cmd { struct iwl_phy_context_cmd {
/* COMMON_INDEX_HDR_API_S_VER_1 */ /* COMMON_INDEX_HDR_API_S_VER_1 */
...@@ -155,10 +189,7 @@ struct iwl_phy_context_cmd { ...@@ -155,10 +189,7 @@ struct iwl_phy_context_cmd {
__le32 apply_time; __le32 apply_time;
__le32 tx_param_color; __le32 tx_param_color;
struct iwl_fw_channel_info ci; struct iwl_fw_channel_info ci;
__le32 txchain_info; struct iwl_phy_context_cmd_tail tail;
__le32 rxchain_info;
__le32 acquisition_data;
__le32 dsp_cfg_flags;
} __packed; /* PHY_CONTEXT_CMD_API_VER_1 */ } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
#endif /* __iwl_fw_api_phy_ctxt_h__ */ #endif /* __iwl_fw_api_phy_ctxt_h__ */
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as * it under the terms of version 2 of the GNU General Public License as
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -110,6 +112,17 @@ struct iwl_tdls_channel_switch_frame { ...@@ -110,6 +112,17 @@ struct iwl_tdls_channel_switch_frame {
u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE]; u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
} __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */ } __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */
/**
* struct iwl_tdls_channel_switch_cmd_tail - tail of iwl_tdls_channel_switch_cmd
*
* @timing: timing related data for command
* @frame: channel-switch request/response template, depending to switch_type
*/
struct iwl_tdls_channel_switch_cmd_tail {
struct iwl_tdls_channel_switch_timing timing;
struct iwl_tdls_channel_switch_frame frame;
} __packed;
/** /**
* struct iwl_tdls_channel_switch_cmd - TDLS channel switch command * struct iwl_tdls_channel_switch_cmd - TDLS channel switch command
* *
...@@ -119,15 +132,13 @@ struct iwl_tdls_channel_switch_frame { ...@@ -119,15 +132,13 @@ struct iwl_tdls_channel_switch_frame {
* @switch_type: see &enum iwl_tdls_channel_switch_type * @switch_type: see &enum iwl_tdls_channel_switch_type
* @peer_sta_id: station id of TDLS peer * @peer_sta_id: station id of TDLS peer
* @ci: channel we switch to * @ci: channel we switch to
* @timing: timing related data for command * @tail: command tail
* @frame: channel-switch request/response template, depending to switch_type
*/ */
struct iwl_tdls_channel_switch_cmd { struct iwl_tdls_channel_switch_cmd {
u8 switch_type; u8 switch_type;
__le32 peer_sta_id; __le32 peer_sta_id;
struct iwl_fw_channel_info ci; struct iwl_fw_channel_info ci;
struct iwl_tdls_channel_switch_timing timing; struct iwl_tdls_channel_switch_cmd_tail tail;
struct iwl_tdls_channel_switch_frame frame;
} __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */ } __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */
/** /**
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as * it under the terms of version 2 of the GNU General Public License as
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -317,6 +319,25 @@ struct iwl_time_event_notif { ...@@ -317,6 +319,25 @@ struct iwl_time_event_notif {
__le32 status; __le32 status;
} __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */ } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
/*
* struct iwl_hs20_roc_req_tail - tail of iwl_hs20_roc_req
*
* @node_addr: Our MAC Address
* @reserved: reserved for alignment
* @apply_time: GP2 value to start (should always be the current GP2 value)
* @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
* time by which start of the event is allowed to be postponed.
* @duration: event duration in TU To calculate event duration:
* timeEventDuration = min(duration, remainingQuota)
*/
struct iwl_hs20_roc_req_tail {
u8 node_addr[ETH_ALEN];
__le16 reserved;
__le32 apply_time;
__le32 apply_time_max_delay;
__le32 duration;
} __packed;
/* /*
* Aux ROC command * Aux ROC command
* *
...@@ -336,13 +357,6 @@ struct iwl_time_event_notif { ...@@ -336,13 +357,6 @@ struct iwl_time_event_notif {
* @sta_id_and_color: station id and color, resumed during "Remain On Channel" * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
* activity. * activity.
* @channel_info: channel info * @channel_info: channel info
* @node_addr: Our MAC Address
* @reserved: reserved for alignment
* @apply_time: GP2 value to start (should always be the current GP2 value)
* @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
* time by which start of the event is allowed to be postponed.
* @duration: event duration in TU To calculate event duration:
* timeEventDuration = min(duration, remainingQuota)
*/ */
struct iwl_hs20_roc_req { struct iwl_hs20_roc_req {
/* COMMON_INDEX_HDR_API_S_VER_1 hdr */ /* COMMON_INDEX_HDR_API_S_VER_1 hdr */
...@@ -351,11 +365,7 @@ struct iwl_hs20_roc_req { ...@@ -351,11 +365,7 @@ struct iwl_hs20_roc_req {
__le32 event_unique_id; __le32 event_unique_id;
__le32 sta_id_and_color; __le32 sta_id_and_color;
struct iwl_fw_channel_info channel_info; struct iwl_fw_channel_info channel_info;
u8 node_addr[ETH_ALEN]; struct iwl_hs20_roc_req_tail tail;
__le16 reserved;
__le32 apply_time;
__le32 apply_time_max_delay;
__le32 duration;
} __packed; /* HOT_SPOT_CMD_API_S_VER_1 */ } __packed; /* HOT_SPOT_CMD_API_S_VER_1 */
/* /*
......
...@@ -333,6 +333,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t; ...@@ -333,6 +333,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
* @IWL_UCODE_TLV_CAPA_TLC_OFFLOAD: firmware implements rate scaling algorithm * @IWL_UCODE_TLV_CAPA_TLC_OFFLOAD: firmware implements rate scaling algorithm
* @IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA: firmware implements quota related * @IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA: firmware implements quota related
* @IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2: firmware implements Coex Schema 2 * @IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2: firmware implements Coex Schema 2
* @IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS: firmware supports ultra high band
* (6 GHz).
* @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement
* @IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS: supports short PM timeouts * @IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS: supports short PM timeouts
* @IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT * @IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT: supports bt-coex Multi-priority LUT
...@@ -395,6 +397,7 @@ enum iwl_ucode_tlv_capa { ...@@ -395,6 +397,7 @@ enum iwl_ucode_tlv_capa {
IWL_UCODE_TLV_CAPA_TLC_OFFLOAD = (__force iwl_ucode_tlv_capa_t)43, IWL_UCODE_TLV_CAPA_TLC_OFFLOAD = (__force iwl_ucode_tlv_capa_t)43,
IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA = (__force iwl_ucode_tlv_capa_t)44, IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA = (__force iwl_ucode_tlv_capa_t)44,
IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2 = (__force iwl_ucode_tlv_capa_t)45, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2 = (__force iwl_ucode_tlv_capa_t)45,
IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS = (__force iwl_ucode_tlv_capa_t)48,
IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE = (__force iwl_ucode_tlv_capa_t)64, IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE = (__force iwl_ucode_tlv_capa_t)64,
IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = (__force iwl_ucode_tlv_capa_t)65, IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = (__force iwl_ucode_tlv_capa_t)65,
IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = (__force iwl_ucode_tlv_capa_t)67, IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = (__force iwl_ucode_tlv_capa_t)67,
......
...@@ -3520,14 +3520,20 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, ...@@ -3520,14 +3520,20 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm,
.id_and_color = .id_and_color =
cpu_to_le32(FW_CMD_ID_AND_COLOR(MAC_INDEX_AUX, 0)), cpu_to_le32(FW_CMD_ID_AND_COLOR(MAC_INDEX_AUX, 0)),
.sta_id_and_color = cpu_to_le32(mvm->aux_sta.sta_id), .sta_id_and_color = cpu_to_le32(mvm->aux_sta.sta_id),
/* Set the channel info data */ };
.channel_info.band = (channel->band == NL80211_BAND_2GHZ) ? struct iwl_hs20_roc_req_tail *tail = iwl_mvm_chan_info_cmd_tail(mvm,
PHY_BAND_24 : PHY_BAND_5, &aux_roc_req.channel_info);
.channel_info.channel = channel->hw_value, u16 len = sizeof(aux_roc_req) - iwl_mvm_chan_info_padding(mvm);
.channel_info.width = PHY_VHT_CHANNEL_MODE20,
/* Set the time and duration */ /* Set the channel info data */
.apply_time = cpu_to_le32(iwl_read_prph(mvm->trans, time_reg)), iwl_mvm_set_chan_info(mvm, &aux_roc_req.channel_info, channel->hw_value,
}; (channel->band == NL80211_BAND_2GHZ) ?
PHY_BAND_24 : PHY_BAND_5,
PHY_VHT_CHANNEL_MODE20,
0);
/* Set the time and duration */
tail->apply_time = cpu_to_le32(iwl_read_prph(mvm->trans, time_reg));
delay = AUX_ROC_MIN_DELAY; delay = AUX_ROC_MIN_DELAY;
req_dur = MSEC_TO_TU(duration); req_dur = MSEC_TO_TU(duration);
...@@ -3552,15 +3558,15 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, ...@@ -3552,15 +3558,15 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm,
} }
} }
aux_roc_req.duration = cpu_to_le32(req_dur); tail->duration = cpu_to_le32(req_dur);
aux_roc_req.apply_time_max_delay = cpu_to_le32(delay); tail->apply_time_max_delay = cpu_to_le32(delay);
IWL_DEBUG_TE(mvm, IWL_DEBUG_TE(mvm,
"ROC: Requesting to remain on channel %u for %ums (requested = %ums, max_delay = %ums, dtim_interval = %ums)\n", "ROC: Requesting to remain on channel %u for %ums (requested = %ums, max_delay = %ums, dtim_interval = %ums)\n",
channel->hw_value, req_dur, duration, delay, channel->hw_value, req_dur, duration, delay,
dtim_interval); dtim_interval);
/* Set the node address */ /* Set the node address */
memcpy(aux_roc_req.node_addr, vif->addr, ETH_ALEN); memcpy(tail->node_addr, vif->addr, ETH_ALEN);
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
...@@ -3591,7 +3597,7 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, ...@@ -3591,7 +3597,7 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm,
ARRAY_SIZE(time_event_response), ARRAY_SIZE(time_event_response),
iwl_mvm_rx_aux_roc, te_data); iwl_mvm_rx_aux_roc, te_data);
res = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0, sizeof(aux_roc_req), res = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0, len,
&aux_roc_req); &aux_roc_req);
if (res) { if (res) {
......
...@@ -2059,4 +2059,59 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw, ...@@ -2059,4 +2059,59 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
struct dentry *dir); struct dentry *dir);
#endif #endif
/* Channel info utils */
static inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm)
{
return fw_has_capa(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS);
}
static inline void *iwl_mvm_chan_info_cmd_tail(struct iwl_mvm *mvm,
struct iwl_fw_channel_info *ci)
{
return (u8 *)ci + (iwl_mvm_has_ultra_hb_channel(mvm) ?
sizeof(struct iwl_fw_channel_info) :
sizeof(struct iwl_fw_channel_info_v1));
}
static inline size_t iwl_mvm_chan_info_padding(struct iwl_mvm *mvm)
{
return iwl_mvm_has_ultra_hb_channel(mvm) ? 0 :
sizeof(struct iwl_fw_channel_info) -
sizeof(struct iwl_fw_channel_info_v1);
}
static inline void iwl_mvm_set_chan_info(struct iwl_mvm *mvm,
struct iwl_fw_channel_info *ci,
u32 chan, u8 band, u8 width,
u8 ctrl_pos)
{
if (iwl_mvm_has_ultra_hb_channel(mvm)) {
ci->channel = cpu_to_le32(chan);
ci->band = band;
ci->width = width;
ci->ctrl_pos = ctrl_pos;
} else {
struct iwl_fw_channel_info_v1 *ci_v1 =
(struct iwl_fw_channel_info_v1 *)ci;
ci_v1->channel = chan;
ci_v1->band = band;
ci_v1->width = width;
ci_v1->ctrl_pos = ctrl_pos;
}
}
static inline void
iwl_mvm_set_chan_info_chandef(struct iwl_mvm *mvm,
struct iwl_fw_channel_info *ci,
struct cfg80211_chan_def *chandef)
{
iwl_mvm_set_chan_info(mvm, ci, chandef->chan->hw_value,
(chandef->chan->band == NL80211_BAND_2GHZ ?
PHY_BAND_24 : PHY_BAND_5),
iwl_mvm_get_channel_width(chandef),
iwl_mvm_get_ctrl_pos(chandef));
}
#endif /* __IWL_MVM_H__ */ #endif /* __IWL_MVM_H__ */
...@@ -143,14 +143,11 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm, ...@@ -143,14 +143,11 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
u8 chains_static, u8 chains_dynamic) u8 chains_static, u8 chains_dynamic)
{ {
u8 active_cnt, idle_cnt; u8 active_cnt, idle_cnt;
struct iwl_phy_context_cmd_tail *tail =
iwl_mvm_chan_info_cmd_tail(mvm, &cmd->ci);
/* Set the channel info data */ /* Set the channel info data */
cmd->ci.band = (chandef->chan->band == NL80211_BAND_2GHZ ? iwl_mvm_set_chan_info_chandef(mvm, &cmd->ci, chandef);
PHY_BAND_24 : PHY_BAND_5);
cmd->ci.channel = chandef->chan->hw_value;
cmd->ci.width = iwl_mvm_get_channel_width(chandef);
cmd->ci.ctrl_pos = iwl_mvm_get_ctrl_pos(chandef);
/* Set rx the chains */ /* Set rx the chains */
idle_cnt = chains_static; idle_cnt = chains_static;
...@@ -168,17 +165,17 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm, ...@@ -168,17 +165,17 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
active_cnt = 2; active_cnt = 2;
} }
cmd->rxchain_info = cpu_to_le32(iwl_mvm_get_valid_rx_ant(mvm) << tail->rxchain_info = cpu_to_le32(iwl_mvm_get_valid_rx_ant(mvm) <<
PHY_RX_CHAIN_VALID_POS); PHY_RX_CHAIN_VALID_POS);
cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); tail->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS);
cmd->rxchain_info |= cpu_to_le32(active_cnt << tail->rxchain_info |= cpu_to_le32(active_cnt <<
PHY_RX_CHAIN_MIMO_CNT_POS); PHY_RX_CHAIN_MIMO_CNT_POS);
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
if (unlikely(mvm->dbgfs_rx_phyinfo)) if (unlikely(mvm->dbgfs_rx_phyinfo))
cmd->rxchain_info = cpu_to_le32(mvm->dbgfs_rx_phyinfo); tail->rxchain_info = cpu_to_le32(mvm->dbgfs_rx_phyinfo);
#endif #endif
cmd->txchain_info = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); tail->txchain_info = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm));
} }
/* /*
...@@ -195,6 +192,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm, ...@@ -195,6 +192,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm,
{ {
struct iwl_phy_context_cmd cmd; struct iwl_phy_context_cmd cmd;
int ret; int ret;
u16 len = sizeof(cmd) - iwl_mvm_chan_info_padding(mvm);
/* Set the command header fields */ /* Set the command header fields */
iwl_mvm_phy_ctxt_cmd_hdr(ctxt, &cmd, action, apply_time); iwl_mvm_phy_ctxt_cmd_hdr(ctxt, &cmd, action, apply_time);
...@@ -203,9 +201,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm, ...@@ -203,9 +201,7 @@ static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm,
iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef, iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef,
chains_static, chains_dynamic); chains_static, chains_dynamic);
ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, 0, ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, 0, len, &cmd);
sizeof(struct iwl_phy_context_cmd),
&cmd);
if (ret) if (ret)
IWL_ERR(mvm, "PHY ctxt cmd error. ret=%d\n", ret); IWL_ERR(mvm, "PHY ctxt cmd error. ret=%d\n", ret);
return ret; return ret;
......
...@@ -399,6 +399,9 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, ...@@ -399,6 +399,9 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
struct iwl_tdls_channel_switch_cmd cmd = {0}; struct iwl_tdls_channel_switch_cmd cmd = {0};
struct iwl_tdls_channel_switch_cmd_tail *tail =
iwl_mvm_chan_info_cmd_tail(mvm, &cmd.ci);
u16 len = sizeof(cmd) - iwl_mvm_chan_info_padding(mvm);
int ret; int ret;
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
...@@ -414,9 +417,9 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, ...@@ -414,9 +417,9 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
} }
cmd.switch_type = type; cmd.switch_type = type;
cmd.timing.frame_timestamp = cpu_to_le32(timestamp); tail->timing.frame_timestamp = cpu_to_le32(timestamp);
cmd.timing.switch_time = cpu_to_le32(switch_time); tail->timing.switch_time = cpu_to_le32(switch_time);
cmd.timing.switch_timeout = cpu_to_le32(switch_timeout); tail->timing.switch_timeout = cpu_to_le32(switch_timeout);
rcu_read_lock(); rcu_read_lock();
sta = ieee80211_find_sta(vif, peer); sta = ieee80211_find_sta(vif, peer);
...@@ -448,21 +451,16 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, ...@@ -448,21 +451,16 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
} }
} }
if (chandef) { if (chandef)
cmd.ci.band = (chandef->chan->band == NL80211_BAND_2GHZ ? iwl_mvm_set_chan_info_chandef(mvm, &cmd.ci, chandef);
PHY_BAND_24 : PHY_BAND_5);
cmd.ci.channel = chandef->chan->hw_value;
cmd.ci.width = iwl_mvm_get_channel_width(chandef);
cmd.ci.ctrl_pos = iwl_mvm_get_ctrl_pos(chandef);
}
/* keep quota calculation simple for now - 50% of DTIM for TDLS */ /* keep quota calculation simple for now - 50% of DTIM for TDLS */
cmd.timing.max_offchan_duration = tail->timing.max_offchan_duration =
cpu_to_le32(TU_TO_US(vif->bss_conf.dtim_period * cpu_to_le32(TU_TO_US(vif->bss_conf.dtim_period *
vif->bss_conf.beacon_int) / 2); vif->bss_conf.beacon_int) / 2);
/* Switch time is the first element in the switch-timing IE. */ /* Switch time is the first element in the switch-timing IE. */
cmd.frame.switch_time_offset = cpu_to_le32(ch_sw_tm_ie + 2); tail->frame.switch_time_offset = cpu_to_le32(ch_sw_tm_ie + 2);
info = IEEE80211_SKB_CB(skb); info = IEEE80211_SKB_CB(skb);
hdr = (void *)skb->data; hdr = (void *)skb->data;
...@@ -472,20 +470,19 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, ...@@ -472,20 +470,19 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
iwl_mvm_set_tx_cmd_ccmp(info, &cmd.frame.tx_cmd); iwl_mvm_set_tx_cmd_ccmp(info, &tail->frame.tx_cmd);
} }
iwl_mvm_set_tx_cmd(mvm, skb, &cmd.frame.tx_cmd, info, iwl_mvm_set_tx_cmd(mvm, skb, &tail->frame.tx_cmd, info,
mvmsta->sta_id); mvmsta->sta_id);
iwl_mvm_set_tx_cmd_rate(mvm, &cmd.frame.tx_cmd, info, sta, iwl_mvm_set_tx_cmd_rate(mvm, &tail->frame.tx_cmd, info, sta,
hdr->frame_control); hdr->frame_control);
rcu_read_unlock(); rcu_read_unlock();
memcpy(cmd.frame.data, skb->data, skb->len); memcpy(tail->frame.data, skb->data, skb->len);
ret = iwl_mvm_send_cmd_pdu(mvm, TDLS_CHANNEL_SWITCH_CMD, 0, ret = iwl_mvm_send_cmd_pdu(mvm, TDLS_CHANNEL_SWITCH_CMD, 0, len, &cmd);
sizeof(cmd), &cmd);
if (ret) { if (ret) {
IWL_ERR(mvm, "Failed to send TDLS_CHANNEL_SWITCH cmd: %d\n", IWL_ERR(mvm, "Failed to send TDLS_CHANNEL_SWITCH cmd: %d\n",
ret); ret);
......
...@@ -687,6 +687,8 @@ static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm, ...@@ -687,6 +687,8 @@ static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm,
struct iwl_mvm_time_event_data *te_data) struct iwl_mvm_time_event_data *te_data)
{ {
struct iwl_hs20_roc_req aux_cmd = {}; struct iwl_hs20_roc_req aux_cmd = {};
u16 len = sizeof(aux_cmd) - iwl_mvm_chan_info_padding(mvm);
u32 uid; u32 uid;
int ret; int ret;
...@@ -700,7 +702,7 @@ static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm, ...@@ -700,7 +702,7 @@ static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm,
IWL_DEBUG_TE(mvm, "Removing BSS AUX ROC TE 0x%x\n", IWL_DEBUG_TE(mvm, "Removing BSS AUX ROC TE 0x%x\n",
le32_to_cpu(aux_cmd.event_unique_id)); le32_to_cpu(aux_cmd.event_unique_id));
ret = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0, ret = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0,
sizeof(aux_cmd), &aux_cmd); len, &aux_cmd);
if (WARN_ON(ret)) if (WARN_ON(ret))
return; return;
......
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