Let the stack be exercised without hardware. mac80211 does both services in software, so the two extended feature flags are all a simulated device needs. It answers the traffic descriptions as well, because mac80211 declines every descriptor carrying one when no driver does. Nothing here schedules a stream, so the answer comes from debugfs: scs_status holds the status code to give such a descriptor, and zero accepts it. Signed-off-by: Felix Fietkau --- drivers/net/wireless/virtual/mac80211_hwsim_i.h | 3 ++- drivers/net/wireless/virtual/mac80211_hwsim_main.c | 25 +++++++++++++++- 2 files changed, 28 insertions(+) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_i.h b/drivers/net/wireless/virtual/mac80211_hwsim_i.h index 0f0f2ac6d80e..f9316a24a639 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim_i.h +++ b/drivers/net/wireless/virtual/mac80211_hwsim_i.h @@ -137,6 +137,9 @@ struct mac80211_hwsim_data { /* RSSI in rx status of the receiver */ int rx_rssi; + /* IEEE status code to answer a traffic description with, 0 accepts */ + u16 scs_status; + /* only used when pmsr capability is supplied */ struct cfg80211_pmsr_capabilities pmsr_capa; struct cfg80211_pmsr_request *pmsr_request; diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c index 02b6d81cccd1..ee9a78853211 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c @@ -4289,6 +4289,27 @@ static int mac80211_hwsim_set_radar_background(struct ieee80211_hw *hw, return 0; } +/* + * Nothing here serves a traffic description, so there is nothing to run out of + * and no reason of its own to refuse one. The answer comes from debugfs, so a + * test can drive what mac80211 does with either one. + */ +static int mac80211_hwsim_sta_set_scs(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct cfg80211_scs_desc * const *desc, + struct cfg80211_scs_result *res, u8 n_desc) +{ + struct mac80211_hwsim_data *data = hw->priv; + u8 i; + + for (i = 0; i < n_desc; i++) + if (desc[i]->qos_char) + res[i].status = data->scs_status; + + return 0; +} + #ifdef CONFIG_MAC80211_DEBUGFS #define HWSIM_DEBUGFS_OPS \ .link_add_debugfs = mac80211_hwsim_link_add_debugfs, @@ -4313,6 +4334,7 @@ static int mac80211_hwsim_set_radar_background(struct ieee80211_hw *hw, .link_sta_rc_update = mac80211_hwsim_sta_rc_update, \ .conf_tx = mac80211_hwsim_conf_tx, \ .get_survey = mac80211_hwsim_get_survey, \ + .sta_set_scs = mac80211_hwsim_sta_set_scs, \ CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) \ .ampdu_action = mac80211_hwsim_ampdu_action, \ .flush = mac80211_hwsim_flush, \ @@ -5967,6 +5989,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, NL80211_EXT_FEATURE_EXT_KEY_ID); wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION); + wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_SCS); + wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_MSCS); hw->wiphy->interface_modes = param->iftypes; @@ -6156,6 +6180,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, &hwsim_fops_group); debugfs_create_file("rx_rssi", 0666, data->debugfs, data, &hwsim_fops_rx_rssi); + debugfs_create_u16("scs_status", 0600, data->debugfs, &data->scs_status); if (!data->use_chanctx) debugfs_create_file("dfs_simulate_radar", 0222, data->debugfs, -- git-series 0.9.1