From patchwork Wed Jan 22 06:53:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yeow Yeoh X-Patchwork-Id: 3521901 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 DFC36C02DC for ; Wed, 22 Jan 2014 06:53:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 271132012E for ; Wed, 22 Jan 2014 06:53:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 608C72010E for ; Wed, 22 Jan 2014 06:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751129AbaAVGxX (ORCPT ); Wed, 22 Jan 2014 01:53:23 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:41629 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbaAVGxX (ORCPT ); Wed, 22 Jan 2014 01:53:23 -0500 Received: by mail-pd0-f178.google.com with SMTP id y13so9293215pdi.9 for ; Tue, 21 Jan 2014 22:53:22 -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=l9dsc2Yw/Tkq9MKZ2+dvGpny4XSGQW/hcve9pUEiZ28=; b=mc7KyP/yN2gCnO4yipckGxcRSEHvKr/5bXYTb27dnsobYu9u1Zx1jQWzFt1QYw5hM5 CQiAfgEhuixhTu1Puv1NKxwef2j42zw/g5TLYotU/yyKUVp0Nl2RqmSkgH3O0vkhLS+2 nB0+4HNcEWbv52QLnnwSPZsV37QLK7upj1MbPEGVMauC9nYTnpmWPHKbDrNhe6jQa7io 89vQazBa2V4Y83+ftKeape6INnnVQNMZfU1djlc1Sb+kygOMkiBaOX9P7gZhxEwFPtd6 enhf19l6i+5L5N/evoqHA9lvv8PxjWJBeCpiHQN5pOIq/52RItMtSEuCtfsWrwK5DbaQ 14Tg== X-Received: by 10.66.189.193 with SMTP id gk1mr29621886pac.105.1390373602574; Tue, 21 Jan 2014 22:53:22 -0800 (PST) Received: from localhost.localdomain ([58.26.233.145]) by mx.google.com with ESMTPSA id gw11sm19217609pbd.17.2014.01.21.22.53.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Jan 2014 22:53:21 -0800 (PST) From: Chun-Yeow Yeoh To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, linville@tuxdriver.com, devel@lists.open80211s.org, Chun-Yeow Yeoh Subject: [PATCH] mac80211: fix the increment of mesh precedence value Date: Wed, 22 Jan 2014 14:53:04 +0800 Message-Id: <1390373584-24716-1-git-send-email-yeohchunyeow@gmail.com> X-Mailer: git-send-email 1.7.9.5 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.4 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 The mesh precedence value in ieee80211_channel_switch should be incremented or set to 1 only if this is the initiator of mesh channel switch. For non-initiator, the precedence value has updated using the Mesh Channel Switch Parameters element. Fix this. Signed-off-by: Chun-Yeow Yeoh --- net/mac80211/cfg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 032081c..e948b38 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3207,13 +3207,13 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, params->chandef.chan->band) return -EINVAL; - if (!ifmsh->pre_value) - ifmsh->pre_value = 1; - else - ifmsh->pre_value++; - - if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_NONE) + if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_NONE) { ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_INIT; + if (!ifmsh->pre_value) + ifmsh->pre_value = 1; + else + ifmsh->pre_value++; + } /* see comments in the NL80211_IFTYPE_AP block */ if (params->count > 1) {