iwlwifi: Support changing antenna settings.
PATCH 1/1 iwlwifi: Support changing antenna settings.
From: Ben Greear <[email protected]>
Support 'iw phy foo set_antenna 0x1'
The old code had static he_capab, so instead change that to have a constant initial he_capab object and also a current-in-use object that we actually use.
Then we can easily re-initialize those settings when the antenna settings change.
Tested on ax210 against Hawkeye ath11k /AX AP.
Signed-off-by Ben Greear <[email protected]>
---
* NOTE: This is on top of the previous set of patches I posted (against 5.10).
.../wireless/intel/iwlwifi/iwl-eeprom-parse.c | 5 + .../wireless/intel/iwlwifi/iwl-nvm-parse.c | 148 ++++++++++++------ .../wireless/intel/iwlwifi/iwl-nvm-parse.h | 11 ++ .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 8 + drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 + .../net/wireless/intel/iwlwifi/mvm/utils.c | 17 ++ 6 files changed, 141 insertions(+), 50 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c +5 -0
@@ -784,8 +784,13 @@ void iwl_init_ht_hw_capab(struct iwl_trans *trans, ht_info->mcs.rx_mask[0 ] =0xFF ;if (rx_chains >=2 ) ht_info->mcs.rx_mask[1 ] =0xFF ; +else + ht_info->mcs.rx_mask[1 ] =0 ; +if (rx_chains >=3 ) ht_info->mcs.rx_mask[2 ] =0xFF ; +else + ht_info->mcs.rx_mask[2 ] =0 ;if (cfg->ht_params->ht_greenfield_support) ht_info->cap |=IEEE80211_HT_CAP_GRN_FLD ;
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +98 -50
190 lines not on this page · raw message
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h +11 -0
@@ -135,4 +135,15 @@ void iwl_nvm_fixups(u32 hw_id, unsigned int section, u8 *data,*/ struct iwl_nvm_data *iwl_get_nvm (struct iwl_trans *trans,const struct iwl_fw *fw); + +/** +* iwl_reinit_capab - Re-initialize the current HT, VHT and/or HE capabilities +* +* This should be called when changing values that affect the capabilities, such +* as number of spatial streams. +*/ +void iwl_reinit_capab (struct iwl_trans *trans, +struct iwl_nvm_data *data, +u8 tx_chains,u8 rx_chains); +#endif /* __iwl_nvm_parse_h__ */
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +8 -0
@@ -370,6 +370,13 @@ iwl_mvm_op_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)return 0 ; } +static int +iwl_mvm_op_set_antenna (struct ieee80211_hw *hw,u32 tx_ant,u32 rx_ant) +{ +struct iwl_mvm *mvm =IWL_MAC80211_GET_MVM (hw); +return iwl_mvm_set_valid_ant (mvm, tx_ant, rx_ant); +} +int iwl_mvm_mac_setup_register (struct iwl_mvm *mvm) {struct ieee80211_hw *hw = mvm->hw;
@@ -5247,6 +5254,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { .wake_tx_queue = iwl_mvm_mac_wake_tx_queue, .ampdu_action = iwl_mvm_mac_ampdu_action, .get_antenna = iwl_mvm_op_get_antenna, + .set_antenna = iwl_mvm_op_set_antenna, .start = iwl_mvm_mac_start, .reconfig_complete = iwl_mvm_mac_reconfig_complete, .stop = iwl_mvm_mac_stop,
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -0
@@ -1574,6 +1574,8 @@ static inline u8 iwl_mvm_get_valid_rx_ant(struct iwl_mvm *mvm) mvm->fw->valid_rx_ant; } +int iwl_mvm_set_valid_ant (struct iwl_mvm *mvm,u32 tx_ant,u32 rx_ant); +static inline void iwl_mvm_toggle_tx_ant (struct iwl_mvm *mvm,u8 *ant) { *ant =iwl_mvm_next_antenna (mvm,iwl_mvm_get_valid_tx_ant (mvm), *ant);
drivers/net/wireless/intel/iwlwifi/mvm/utils.c +17 -0
@@ -208,6 +208,23 @@ static const u8 fw_rate_idx_to_plcp[IWL_RATE_COUNT] = { IWL_DECLARE_RATE_INFO(54), }; +int iwl_mvm_set_valid_ant (struct iwl_mvm *mvm,u32 tx_ant,u32 rx_ant) +{ +if (mvm->nvm_data) { + mvm->nvm_data->valid_rx_ant = (rx_ant &ANT_ABC ); + mvm->nvm_data->valid_tx_ant = (tx_ant &ANT_ABC ); + +iwl_reinit_capab (mvm->trans, mvm->nvm_data, mvm->nvm_data->valid_tx_ant, + mvm->nvm_data->valid_rx_ant); + +return 0 ; + } +else { +pr_err ("ERROR: iwl-mvm-set-valid-ant: mvm->nvm_data is NULL\n" ); +return -EINVAL ; + } +} +int iwl_mvm_legacy_rate_to_mac80211_idx (u32 rate_n_flags,enum nl80211_band band) {
Signature · 1 line
2.20.1