From patchwork Thu Jul 2 13:28:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 6709721 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EBE9C9F54C for ; Thu, 2 Jul 2015 13:29:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0464206F2 for ; Thu, 2 Jul 2015 13:29:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E88FA206EC for ; Thu, 2 Jul 2015 13:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752920AbbGBN3E (ORCPT ); Thu, 2 Jul 2015 09:29:04 -0400 Received: from mail-ie0-f171.google.com ([209.85.223.171]:36522 "EHLO mail-ie0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751960AbbGBN3A (ORCPT ); Thu, 2 Jul 2015 09:29:00 -0400 Received: by iecvh10 with SMTP id vh10so56464537iec.3 for ; Thu, 02 Jul 2015 06:28:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H8RmpcZ9SYO1xBpiT9eUqK3PdZPJW3CFJ4PE1O7aIKI=; b=AhiUVSd3GYKGRkf6Hvpyecm6OJ/iwWNkUpf90pHO7eKcI3N/JU/P+wm0U686ehdk0A b+2dGkeYCrlI6LDGlkoWffAwdEIyDBdEUXSIjcVL57n2WwQLzPM07V8ubvmUCARGInmn aMTuCP/l9kn1AMcyKUwwh04c31i93UkxsFz/IvnCq5s7iAVVKFSCCFBHYatjVO43Csuv R8Yx1zJTAmnWxBSSejMRItl0AN1U5zZoOUTC6zf6HBqSLz4FI1+mNULN/wLtZyFiT4iq DToJh7jPUeKxTbm6T06KJuBhl9NVhHcwUm7G0N8me64tgKBfisM250e+bSgLAC8lDlL3 yDQw== X-Gm-Message-State: ALoCoQm5+fMqEt3HTekPsIzoKnQwxCR7NDtzoZCFTkj+hOnBWFlKlrUKGdIXhLks/wVs820VhLq8 X-Received: by 10.50.136.197 with SMTP id qc5mr14024740igb.6.1435843735930; Thu, 02 Jul 2015 06:28:55 -0700 (PDT) Received: from hash ([2001:470:1d:6db:230:48ff:fe9d:9c89]) by mx.google.com with ESMTPSA id s28sm3846731ioi.31.2015.07.02.06.28.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:28:53 -0700 (PDT) Received: from bob by hash with local (Exim 4.84) (envelope-from ) id 1ZAeXd-0000ko-0S; Thu, 02 Jul 2015 09:28:37 -0400 From: Bob Copeland To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, devel@lists.open80211s.org, Bob Copeland Subject: [PATCH 2/3] mac80211: mesh: separate plid and aid concepts Date: Thu, 2 Jul 2015 09:28:09 -0400 Message-Id: <1435843690-2856-3-git-send-email-me@bobcopeland.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435843690-2856-1-git-send-email-me@bobcopeland.com> References: <1435843690-2856-1-git-send-email-me@bobcopeland.com> 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 According to 802.11-2012 13.3.1, a mesh STA should assign an AID upon receipt of a mesh peering open frame rather than using the link id of the peer. Using the peer link id has two potential issues: it may not be unique among the peers, and by its nature it is random, so the TIM may not compress well. In preparation for allocating it properly, use sta->sta.aid, but keep the existing behavior of using the plid. Additionally, fix a bug where the AID is written into the wrong place in peering confirm frame skbs. Signed-off-by: Bob Copeland --- net/mac80211/mesh_plink.c | 20 ++++++++++++-------- net/mac80211/sta_info.c | 5 +---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 7b071e36e55e..9dca16bd3eb9 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -200,6 +200,7 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) } static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, + struct sta_info *sta, enum ieee80211_self_protected_actioncode action, u8 *da, u16 llid, u16 plid, u16 reason) { @@ -249,7 +250,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, if (action == WLAN_SP_MESH_PEERING_CONFIRM) { /* AID */ pos = skb_put(skb, 2); - put_unaligned_le16(plid, pos + 2); + put_unaligned_le16(sta->sta.aid, pos); } if (ieee80211_add_srates_ie(sdata, skb, true, band) || ieee80211_add_ext_srates_ie(sdata, skb, true, band) || @@ -362,7 +363,7 @@ u32 mesh_plink_deactivate(struct sta_info *sta) spin_lock_bh(&sta->mesh->plink_lock); changed = __mesh_plink_deactivate(sta); sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, + mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE, sta->sta.addr, sta->mesh->llid, sta->mesh->plid, sta->mesh->reason); spin_unlock_bh(&sta->mesh->plink_lock); @@ -619,7 +620,7 @@ static void mesh_plink_timer(unsigned long data) } spin_unlock_bh(&sta->mesh->plink_lock); if (action) - mesh_plink_frame_tx(sdata, action, sta->sta.addr, + mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, sta->mesh->llid, sta->mesh->plid, reason); } @@ -689,7 +690,7 @@ u32 mesh_plink_open(struct sta_info *sta) /* set the non-peer mode to active during peering */ changed = ieee80211_mps_local_status_update(sdata); - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN, + mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN, sta->sta.addr, sta->mesh->llid, 0, 0); return changed; } @@ -871,13 +872,13 @@ static u32 mesh_plink_fsm(struct ieee80211_sub_if_data *sdata, } spin_unlock_bh(&sta->mesh->plink_lock); if (action) { - mesh_plink_frame_tx(sdata, action, sta->sta.addr, + mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, sta->mesh->llid, sta->mesh->plid, sta->mesh->reason); /* also send confirm in open case */ if (action == WLAN_SP_MESH_PEERING_OPEN) { - mesh_plink_frame_tx(sdata, + mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CONFIRM, sta->sta.addr, sta->mesh->llid, sta->mesh->plid, 0); @@ -1067,8 +1068,9 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata, goto unlock_rcu; } sta->mesh->plid = plid; + sta->sta.aid = plid; } else if (!sta && event == OPN_RJCT) { - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, + mesh_plink_frame_tx(sdata, NULL, WLAN_SP_MESH_PEERING_CLOSE, mgmt->sa, 0, plid, WLAN_REASON_MESH_CONFIG); goto unlock_rcu; @@ -1078,8 +1080,10 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata, } /* 802.11-2012 13.3.7.2 - update plid on CNF if not set */ - if (!sta->mesh->plid && event == CNF_ACPT) + if (!sta->mesh->plid && event == CNF_ACPT) { sta->mesh->plid = plid; + sta->sta.aid = sta->mesh->plid; + } changed |= mesh_plink_fsm(sdata, sta, event); diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 9da7d2bc271a..70cd9fa57424 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -635,7 +635,7 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending) bool indicate_tim = false; u8 ignore_for_tim = sta->sta.uapsd_queues; int ac; - u16 id; + u16 id = sta->sta.aid; if (sta->sdata->vif.type == NL80211_IFTYPE_AP || sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { @@ -643,12 +643,9 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending) return; ps = &sta->sdata->bss->ps; - id = sta->sta.aid; #ifdef CONFIG_MAC80211_MESH } else if (ieee80211_vif_is_mesh(&sta->sdata->vif)) { ps = &sta->sdata->u.mesh.ps; - /* TIM map only for 1 <= PLID <= IEEE80211_MAX_AID */ - id = sta->mesh->plid % (IEEE80211_MAX_AID + 1); #endif } else { return;