2013-11-22 08:06:55

by Karl Beldan

[permalink] [raw]
Subject: [PATCH] mac80211_hwsim: claim CSA support for AP

From: Karl Beldan <[email protected]>

Signed-off-by: Karl Beldan <[email protected]>
Cc: Simon Wunderlich <[email protected]>
---
drivers/net/wireless/mac80211_hwsim.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index a11dc7c..e9c6d2d 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1058,6 +1058,9 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,

mac80211_hwsim_tx_frame(hw, skb,
rcu_dereference(vif->chanctx_conf)->def.chan);
+
+ if (vif->csa_active && ieee80211_csa_is_complete(vif))
+ ieee80211_csa_finish(vif);
}

static enum hrtimer_restart
@@ -1692,6 +1695,16 @@ static void mac80211_hwsim_unassign_vif_chanctx(struct ieee80211_hw *hw,
hwsim_check_chanctx_magic(ctx);
}

+static void mac80211_hwsim_channel_switch_beacon(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct cfg80211_chan_def *chandef)
+{
+ wiphy_debug(hw->wiphy, "%s (freq=%d(%d - %d)/%s)\n", __func__,
+ chandef->chan->center_freq, chandef->center_freq1,
+ chandef->center_freq2, hwsim_chanwidths[chandef->width]);
+
+}
+
static struct ieee80211_ops mac80211_hwsim_ops =
{
.tx = mac80211_hwsim_tx,
@@ -1716,6 +1729,7 @@ static struct ieee80211_ops mac80211_hwsim_ops =
.flush = mac80211_hwsim_flush,
.get_tsf = mac80211_hwsim_get_tsf,
.set_tsf = mac80211_hwsim_set_tsf,
+ .channel_switch_beacon = mac80211_hwsim_channel_switch_beacon,
};


@@ -2359,7 +2373,9 @@ static int __init init_mac80211_hwsim(void)

hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
- WIPHY_FLAG_AP_UAPSD;
+ WIPHY_FLAG_AP_UAPSD |
+ WIPHY_FLAG_HAS_CHANNEL_SWITCH;
+
hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR;

/* ask mac80211 to reserve space for magic */
--
1.8.2