iwl-mvm: Report tx/rx antennas.
PATCH 1/1 iwl-mvm: Report tx/rx antennas.
From: Ben Greear <[email protected]>
This makes it easier for user-space to know how many antennas the radio has. Seems to work with the AX200 radio, at least.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +14 -0
@@ -440,10 +440,19 @@ const static struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = { }, }; +static int iwl_mvm_op_get_antenna (struct ieee80211_hw *hw,u32 *tx_ant,u32 *rx_ant) +{ +struct iwl_mvm *mvm =IWL_MAC80211_GET_MVM (hw); + *tx_ant =iwl_mvm_get_valid_tx_ant (mvm); + *rx_ant =iwl_mvm_get_valid_rx_ant (mvm); +return 0 ; +} +int iwl_mvm_mac_setup_register (struct iwl_mvm *mvm) {struct ieee80211_hw *hw = mvm->hw;int num_mac, ret, i; +u32 tx_ant, rx_ant;static const u32 mvm_ciphers[] = {WLAN_CIPHER_SUITE_WEP40 ,WLAN_CIPHER_SUITE_WEP104 ,
@@ -813,6 +822,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)wiphy_ext_feature_set (hw->wiphy,NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER ); +iwl_mvm_op_get_antenna (hw, &tx_ant, &rx_ant); + hw->wiphy->available_antennas_tx = tx_ant; + hw->wiphy->available_antennas_rx = rx_ant; + ret =ieee80211_register_hw (mvm->hw);if (ret) {iwl_mvm_leds_exit (mvm);
@@ -5167,6 +5180,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { .tx = iwl_mvm_mac_tx, .wake_tx_queue = iwl_mvm_mac_wake_tx_queue, .ampdu_action = iwl_mvm_mac_ampdu_action, + .get_antenna = iwl_mvm_op_get_antenna, .start = iwl_mvm_mac_start, .reconfig_complete = iwl_mvm_mac_reconfig_complete, .stop = iwl_mvm_mac_stop,
Signature · 1 line
2.20.1
Quoted 35 lines · On Thu, 2019-09-05 at 14:28 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
This makes it easier for user-space to know how many antennas the radio has. Seems to work with the AX200 radio, at least.
Signed-off-by Ben Greear <[email protected]>--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +9
-0@@ -440,10 +440,19 @@ const static struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = { }, }; +static int iwl_mvm_op_get_antenna (struct ieee80211_hw *hw,u32 *tx_ant,u32 *rx_ant) +{ +struct iwl_mvm *mvm =IWL_MAC80211_GET_MVM (hw); + *tx_ant =iwl_mvm_get_valid_tx_ant (mvm); + *rx_ant =iwl_mvm_get_valid_rx_ant (mvm); +return 0 ; +} +int iwl_mvm_mac_setup_register (struct iwl_mvm *mvm) {struct ieee80211_hw *hw = mvm->hw;int num_mac, ret, i; +u32 tx_ant, rx_ant;static const u32 mvm_ciphers[] = {WLAN_CIPHER_SUITE_WEP40 ,WLAN_CIPHER_SUITE_WEP104 ,
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) · line 828
Quoted 7 lines
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +4
-0@@ -813,6 +822,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)wiphy_ext_feature_set (hw->wiphy,NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER ); +iwl_mvm_op_get_antenna (hw, &tx_ant, &rx_ant); + hw->wiphy->available_antennas_tx = tx_ant; + hw->wiphy->available_antennas_rx = rx_ant; +
I changed this slightly so we call iwl_mvm_get_valid_tx/rx_ant() here instead of calling the op function. Then we don't need the local variables and it's a bit clearer IMHO.
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c const struct ieee80211_ops iwl_mvm_hw_ops = { · line 5186
Quoted 11 lines
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +1
-0ret =ieee80211_register_hw (mvm->hw);if (ret) {iwl_mvm_leds_exit (mvm);@@ -5167,6 +5180,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { .tx = iwl_mvm_mac_tx, .wake_tx_queue = iwl_mvm_mac_wake_tx_queue, .ampdu_action = iwl_mvm_mac_ampdu_action, + .get_antenna = iwl_mvm_op_get_antenna, .start = iwl_mvm_mac_start, .reconfig_complete = iwl_mvm_mac_reconfig_complete, .stop = iwl_mvm_mac_stop,
I've applied this (with the above-mentioned change) to our internal tree and it should reach the mainline following our usual upstreaming process. Thanks!
--
Cheers,
Luca.