From patchwork Mon Jan 6 18:01:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 3440041 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 CC450C02DC for ; Mon, 6 Jan 2014 18:02:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 925DD2016C for ; Mon, 6 Jan 2014 18:02:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB8602016A for ; Mon, 6 Jan 2014 18:02:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754093AbaAFSCr (ORCPT ); Mon, 6 Jan 2014 13:02:47 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:64895 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751840AbaAFSCr (ORCPT ); Mon, 6 Jan 2014 13:02:47 -0500 Received: by mail-wi0-f172.google.com with SMTP id en1so3140091wid.17 for ; Mon, 06 Jan 2014 10:02:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=wzNud5UuB43oL+vpQvZ3NscYOixiwWKclA/XUVB120E=; b=QF7qhbdynSL6gZXx6N16cIGN1ss2lkB7L0KiFuNgA/s6rdo3/hHETuGRGsrOz/Zmy8 DUVXUt+6mQUedpFTpcVPcw0O0N9FXuXZhJ/bUrkOpM2aMzxNtAfx0mymJudMlSRZBWPv Q8o0U3j+fE1LQuJSwixre/poZ68RyHYIjpJXdUfwae9svORt+jWfOZBMQFNILmdSA5Vt KJpgQF24uAqlNTr/bFRV7MTvHc6Oz0wJn+KQgvShz+PCvu2fZWlPG6mKamRZtlrM0+XV kix6006UYCwTMKn06ZfCwm4eajw5y4EJ1u4YUEjavhwZWhQGGJuj6BMaeMsjsBd6X+6A QU/A== X-Received: by 10.181.11.201 with SMTP id ek9mr13252340wid.54.1389031365662; Mon, 06 Jan 2014 10:02:45 -0800 (PST) Received: from magnum.frso.rivierawaves.com (vpn.rivierawaves.com. [91.151.119.162]) by mx.google.com with ESMTPSA id hv3sm19087111wib.5.2014.01.06.10.02.43 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Jan 2014 10:02:45 -0800 (PST) Date: Mon, 6 Jan 2014 19:01:50 +0100 From: Karl Beldan To: Kalle Valo Cc: Johannes Berg , linux-wireless , Karl Beldan , Simon Wunderlich Subject: Re: [PATCH v4] mac80211_hwsim: claim CSA support for AP Message-ID: <20140106180150.GB5358@magnum.frso.rivierawaves.com> References: <1385224698-12294-1-git-send-email-karl.beldan@gmail.com> <874n67eabn.fsf@kamboji.qca.qualcomm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <874n67eabn.fsf@kamboji.qca.qualcomm.com> X-Location: France-Nice User-Agent: Mutt/1.5.21 (2010-09-15) 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.1 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 On Tue, Dec 17, 2013 at 06:01:00PM +0200, Kalle Valo wrote: > Karl Beldan writes: > > > From: Karl Beldan > > > > This assigns the channel_switch_beacon op. > > For hwsim, it comes down to calling ieee80211_csa_finish once > > ieee80211_csa_is_complete is true. > > Since channel_switch_beacon is not called if CSA count starts @ 0 or 1, > > the check for ieee80211_csa_is_complete can be done after getting the > > beacon (and this way it might trigger helpful warnings). > > > > This adds a per vif bool csa_finished that is set after a call to > > ieee80211_csa_finish() and used to skip beaconing while csa_active is > > set in case a beacon is scheduled prior to csa_finalize_work completion. > > This bool and the number of beacons transmitted during the CSA up to the > > call to ieee80211_csa_finish() are reset in channel_switch_beacon op. > > > > Signed-off-by: Karl Beldan > > Cc: Simon Wunderlich > > What are we going to do with this patch? It would be convenient to get > hwsim support CSA as it would help working with DFS issues. > > Was the issue blocking this patch the race when transmitting beacons? > IMHO we can live with that and fix it properly later. It's not the only > bug in DFS code right now ;) > Hi, Sorry for the delay. I am under the impression ppl who have expressed themselves would prefer something like: {{{ }}} I understand having this is convenient for DFS so feel free to adjust/submit this patch as you see fit. > > @@ -1058,6 +1067,17 @@ 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) { > > + 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); > > + vp->csa_finished = 1; > > + } > > + } > > csa_finished is a bool so 'true' should be used here. > Thanks, Karl --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 9c0cc8d..b76de14 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -169,6 +169,8 @@ struct hwsim_vif_priv { bool assoc; bool bcn_en; u16 aid; + int csa_bcn_cnt; + bool csa_finished; }; #define HWSIM_VIF_MAGIC 0x69537748 @@ -1032,6 +1034,7 @@ static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, struct ieee80211_vif *vif) { + struct hwsim_vif_priv *vp = (void *)vif->drv_priv; struct mac80211_hwsim_data *data = arg; struct ieee80211_hw *hw = data->hw; struct ieee80211_tx_info *info; @@ -1066,6 +1069,19 @@ 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) { + vp->csa_bcn_cnt++; + if (vp->csa_finished) { + wiphy_debug(hw->wiphy,"%s extra CSA-beacon\n", __func__); + } else 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); + vp->csa_finished = true; + } + } } static enum hrtimer_restart @@ -1700,6 +1716,20 @@ 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; + + hwsim_check_magic(vif); + vp->csa_finished = false; + 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, @@ -1724,6 +1754,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, }; @@ -2366,7 +2397,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 */