From patchwork Fri Oct 12 12:05:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 1586561 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id AC6083FC1A for ; Fri, 12 Oct 2012 12:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759509Ab2JLMGa (ORCPT ); Fri, 12 Oct 2012 08:06:30 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:19315 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759066Ab2JLMG3 (ORCPT ); Fri, 12 Oct 2012 08:06:29 -0400 X-IronPort-AV: E=McAfee;i="5400,1158,6862"; a="247199913" Received: from ironmsg02-l.qualcomm.com ([172.30.48.16]) by wolverine02.qualcomm.com with ESMTP; 12 Oct 2012 05:05:53 -0700 X-IronPort-AV: E=Sophos;i="4.80,576,1344236400"; d="scan'208";a="125044696" Received: from nasanexhc08.na.qualcomm.com ([172.30.39.7]) by ironmsg02-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 12 Oct 2012 05:05:54 -0700 Received: from nako (172.30.39.5) by qcmail1.qualcomm.com (172.30.39.7) with Microsoft SMTP Server (TLS) id 14.2.318.1; Fri, 12 Oct 2012 05:05:52 -0700 From: Sujith Manoharan MIME-Version: 1.0 Message-ID: <20600.1945.579392.240669@gargle.gargle.HOWL> Date: Fri, 12 Oct 2012 17:35:45 +0530 To: X-Mailer: VM 8.2.0b under 24.2.1 (x86_64-unknown-linux-gnu) CC: Subject: [PATCH] mac80211: Notify new IBSS network creation X-Originating-IP: [172.30.39.5] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Initialization of beacon transmission in IBSS mode depends on whether a new BSS is being created or joined. When joining an existing IBSS network, beaconing has to start only after a TSF-sync has happened - this is explained in 11.1.4. Introduce a new parameter in the BSS information structure to indicate creator/joiner mode. Signed-off-by: Sujith Manoharan --- include/net/mac80211.h | 2 ++ net/mac80211/ibss.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 82558c8..512dc4b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -223,6 +223,7 @@ enum ieee80211_rssi_event { * @assoc: association status * @ibss_joined: indicates whether this station is part of an IBSS * or not + * @ibss_creator: indicates if a new IBSS network is being created * @aid: association ID number, valid only when @assoc is true * @use_cts_prot: use CTS protection * @use_short_preamble: use 802.11b short preamble; @@ -278,6 +279,7 @@ struct ieee80211_bss_conf { const u8 *bssid; /* association related data */ bool assoc, ibss_joined; + bool ibss_creator; u16 aid; /* erp related data */ bool use_cts_prot; diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 5f3620f..5c6c773 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -39,7 +39,8 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, const u8 *bssid, const int beacon_int, struct ieee80211_channel *chan, const u32 basic_rates, - const u16 capability, u64 tsf) + const u16 capability, u64 tsf, + bool creator) { struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; struct ieee80211_local *local = sdata->local; @@ -72,6 +73,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, /* if merging, indicate to driver that we leave the old IBSS */ if (sdata->vif.bss_conf.ibss_joined) { sdata->vif.bss_conf.ibss_joined = false; + sdata->vif.bss_conf.ibss_creator = false; netif_carrier_off(sdata->dev); ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IBSS); } @@ -197,6 +199,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, bss_change |= BSS_CHANGED_HT; bss_change |= BSS_CHANGED_IBSS; sdata->vif.bss_conf.ibss_joined = true; + sdata->vif.bss_conf.ibss_creator = creator; ieee80211_bss_info_change_notify(sdata, bss_change); ieee80211_sta_def_wmm_params(sdata, sband->n_bitrates, supp_rates); @@ -249,7 +252,8 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, cbss->channel, basic_rates, cbss->capability, - cbss->tsf); + cbss->tsf, + false); } static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta, @@ -715,7 +719,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, ifibss->channel, ifibss->basic_rates, - capability, 0); + capability, 0, true); } /* @@ -1197,6 +1201,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) lockdep_is_held(&sdata->u.ibss.mtx)); RCU_INIT_POINTER(sdata->u.ibss.presp, NULL); sdata->vif.bss_conf.ibss_joined = false; + sdata->vif.bss_conf.ibss_creator = false; ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_IBSS); synchronize_rcu();