From patchwork Fri Nov 22 08:56:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 3221861 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 82DD8C045B for ; Fri, 22 Nov 2013 08:58:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA5D920780 for ; Fri, 22 Nov 2013 08:58:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A8B42074A for ; Fri, 22 Nov 2013 08:58:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754214Ab3KVI6E (ORCPT ); Fri, 22 Nov 2013 03:58:04 -0500 Received: from mail-wg0-f46.google.com ([74.125.82.46]:61616 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751526Ab3KVI6C (ORCPT ); Fri, 22 Nov 2013 03:58:02 -0500 Received: by mail-wg0-f46.google.com with SMTP id m15so820811wgh.13 for ; Fri, 22 Nov 2013 00:58:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=LRQRg0L1TMpC5a2xbS260t89bvauddbUluQK/KfBmbg=; b=ea+oUTeL/IrRcxp1wQrgxfmz7gdYU/gnozV7UF7mIl1uUwKjyMRK6oEUiSWmRVCxjV 5CHOzLXLVlU2EoaQY2ZpFhnmbXf7c5TMg0XJFRCoMeYERU+h3FjCGszWV9fzaEExo3Qc oLGQJkQc+Sim09yICYtnjplRfszDOHTC3FkFywX9IcPReKNCJXJDBkY97apsWBzMhbIs cD/JvYtY6BlBrvN+dHrhR/XrDJy9X66R967mKoGqvnphGY1ZpobeqKJ9UeMCRLh8ynbb fWFl86yvGvmiIA1N9zm28TXFsKOFicGdaE1ykjcHgJ7AJ6chLh1zcnN8r5N37MfpxEZA QEjw== X-Received: by 10.180.182.198 with SMTP id eg6mr1622602wic.21.1385110680611; Fri, 22 Nov 2013 00:58:00 -0800 (PST) Received: from magnum.frso.rivierawaves.com (vpn.rivierawaves.com. [91.151.119.162]) by mx.google.com with ESMTPSA id w20sm13627823wia.5.2013.11.22.00.57.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2013 00:58:00 -0800 (PST) From: Karl Beldan To: Johannes Berg Cc: linux-wireless , Karl Beldan , Simon Wunderlich Subject: [PATCH v2] mac80211_hwsim: claim CSA support for AP Date: Fri, 22 Nov 2013 09:56:47 +0100 Message-Id: <1385110607-17962-1-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.8.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Karl Beldan Signed-off-by: Karl Beldan Cc: Simon Wunderlich --- drivers/net/wireless/mac80211_hwsim.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index a11dc7c..3fa63bd 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -168,6 +168,7 @@ struct hwsim_vif_priv { u8 bssid[ETH_ALEN]; bool assoc; bool bcn_en; + int csa_bcn_cnt; u16 aid; }; @@ -1058,6 +1059,18 @@ 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) { + struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + + vp->csa_bcn_cnt++; + if (ieee80211_csa_is_complete(vif)) { + wiphy_debug(hw->wiphy, + "%s CSA complete after %d beacons\n", + __func__, vp->csa_bcn_cnt); + ieee80211_csa_finish(vif); + } + } } static enum hrtimer_restart @@ -1692,6 +1705,18 @@ 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) +{ + struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + + vp->csa_bcn_cnt = 0; + 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 +1741,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 +2385,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 */