From patchwork Wed Dec 12 01:22:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Porsch X-Patchwork-Id: 1864431 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 765753FCA5 for ; Wed, 12 Dec 2012 01:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754230Ab2LLBro (ORCPT ); Tue, 11 Dec 2012 20:47:44 -0500 Received: from mail-pb0-f42.google.com ([209.85.160.42]:54082 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754094Ab2LLBrn (ORCPT ); Tue, 11 Dec 2012 20:47:43 -0500 X-Greylist: delayed 1488 seconds by postgrey-1.27 at vger.kernel.org; Tue, 11 Dec 2012 20:47:43 EST Received: by mail-pb0-f42.google.com with SMTP id rp2so89363pbb.29 for ; Tue, 11 Dec 2012 17:47:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=4VSFTXb18x/+1cylKueSK4wNqvzSEAd0zdU4NuslHNM=; b=NEYE7s4q3h4VTRD4a60tkKo6orQgT6jmlgSobYnSSW67VdOjZYfSXcPESweRj54luO jx87WVMtbQpqGh4DkZ8M/DIGh9TvrUVW2z65LBBb5QEca22wQOm2mytmr9qvjuBmHywD fRGCIxmCU/2L7rDoctTAFvpkvCAt1lJqiQCP7YnJrYjHkgmyEujq/6kDBCoh0TRLD0eO D4mAA/Z66bIp2IkZ7IdrAkr7/xKwoi4cgV+XyBsR2KcVeIPKKuczx6W2Ch0mnPKW+FBL 0tO1vzBbt/12ICm+DcDktUCll+TK5HT7lyVCyN8M9ZeQUccuy0aN+9ekoG2Mggpn3wpV Jfjw== Received: by 10.68.252.232 with SMTP id zv8mr299662pbc.38.1355275375575; Tue, 11 Dec 2012 17:22:55 -0800 (PST) Received: from X220-marco.lan (70-35-43-50.static.wiline.com. [70.35.43.50]) by mx.google.com with ESMTPS id rk17sm14649822pbb.3.2012.12.11.17.22.53 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Dec 2012 17:22:54 -0800 (PST) From: Marco Porsch To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, devel@lists.open80211s.org, Marco Porsch Subject: [RFC] mac80211: update mesh established plink counter after userspace peering Date: Tue, 11 Dec 2012 17:22:47 -0800 Message-Id: <1355275367-21371-1-git-send-email-marco@cozybit.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQn2FBG9Xktsn312t5ULSyZFmU9dC9Xm2pYn+LyWAQ9YSFetlXLda7f00zE4bqHMNWvewZRP Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The established peer link count is indicated in mesh beacons and used for other internal tasks. Previously it was not updated when authenticated peering is performed in userspace. Signed-off-by: Marco Porsch --- net/mac80211/cfg.c | 22 +++++++++++++++++++--- net/mac80211/mesh.h | 14 ++++++++++++++ net/mac80211/mesh_plink.c | 14 -------------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 4965aa6..2b8e3f8 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1200,18 +1200,33 @@ static int sta_apply_parameters(struct ieee80211_local *local, if (ieee80211_vif_is_mesh(&sdata->vif)) { #ifdef CONFIG_MAC80211_MESH - if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) + if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) { + u32 changed = 0; + switch (params->plink_state) { - case NL80211_PLINK_LISTEN: case NL80211_PLINK_ESTAB: + if (sta->plink_state != NL80211_PLINK_ESTAB) + changed = mesh_plink_inc_estab_count( + sdata); + sta->plink_state = params->plink_state; + break; + case NL80211_PLINK_LISTEN: case NL80211_PLINK_BLOCKED: + case NL80211_PLINK_OPN_SNT: + case NL80211_PLINK_OPN_RCVD: + case NL80211_PLINK_CNF_RCVD: + case NL80211_PLINK_HOLDING: + if (sta->plink_state == NL80211_PLINK_ESTAB) + changed = mesh_plink_dec_estab_count( + sdata); sta->plink_state = params->plink_state; break; default: /* nothing */ break; } - else + ieee80211_bss_info_change_notify(sdata, changed); + } else { switch (params->plink_action) { case PLINK_ACTION_OPEN: mesh_plink_open(sta); @@ -1220,6 +1235,7 @@ static int sta_apply_parameters(struct ieee80211_local *local, mesh_plink_block(sta); break; } + } #endif } diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 7c9215f..39897e0 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h @@ -307,6 +307,20 @@ extern int mesh_paths_generation; #ifdef CONFIG_MAC80211_MESH extern int mesh_allocated; +static inline +u32 mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata) +{ + atomic_inc(&sdata->u.mesh.estab_plinks); + return mesh_accept_plinks_update(sdata); +} + +static inline +u32 mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata) +{ + atomic_dec(&sdata->u.mesh.estab_plinks); + return mesh_accept_plinks_update(sdata); +} + static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata) { return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks - diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index ca52dfd..3254522 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -41,20 +41,6 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, enum ieee80211_self_protected_actioncode action, u8 *da, __le16 llid, __le16 plid, __le16 reason); -static inline -u32 mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata) -{ - atomic_inc(&sdata->u.mesh.estab_plinks); - return mesh_accept_plinks_update(sdata); -} - -static inline -u32 mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata) -{ - atomic_dec(&sdata->u.mesh.estab_plinks); - return mesh_accept_plinks_update(sdata); -} - /** * mesh_plink_fsm_restart - restart a mesh peer link finite state machine *