From patchwork Wed Nov 6 10:34:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yeow Yeoh X-Patchwork-Id: 3146241 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 84BC79F3C4 for ; Wed, 6 Nov 2013 10:38:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 394CC2049B for ; Wed, 6 Nov 2013 10:38:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 168A0202AE for ; Wed, 6 Nov 2013 10:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756180Ab3KFKiH (ORCPT ); Wed, 6 Nov 2013 05:38:07 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:48802 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755921Ab3KFKiG (ORCPT ); Wed, 6 Nov 2013 05:38:06 -0500 Received: by mail-pa0-f50.google.com with SMTP id fb1so10351611pad.37 for ; Wed, 06 Nov 2013 02:38:03 -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=lF/FpgqFYB1s81+xxBLZuZ1ZTDZIesTTV/twt/pgxWE=; b=c8N6UEMzqpYV523Dx8frUMiHszcgpJ6FYw1Abf7oboBJhtucKGWafqjFrV86UEy9Tg CMlJcY1CEmxP3UdORjdVZd4qBEkp6SkqgSn1w4BHAfZfWaEeUz8DFfDO1QcFTgU3s48t cIGf3Wsu6ycr/1caOn0j7TVop5NDshbXCiUIp0O4pFGCBEPJXXNvWJyrqeCm1b+9LyYs NHU6xvbrYicFhzTmIo5zMLSAMRVCz1usCMxZ50sYuupoVvZhMB0MrHRy3IetjU8rVwk7 /Z7DNHJLEQhe3FNU6sN4E0fJtj8twIG9uX+z+g6kuCUGbsJBAaf3ABsfIrl1QUHu14Dl oY0w== X-Received: by 10.68.254.164 with SMTP id aj4mr2431480pbd.161.1383734283719; Wed, 06 Nov 2013 02:38:03 -0800 (PST) Received: from localhost.localdomain ([203.106.67.32]) by mx.google.com with ESMTPSA id hi5sm40459201pbb.43.2013.11.06.02.36.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 02:38:03 -0800 (PST) From: Chun-Yeow Yeoh To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, linville@tuxdriver.com, devel@lists.open80211s.org, distro11s@cozybit.com, Chun-Yeow Yeoh Subject: [PATCH] mac80211: fix the mesh channel switch support Date: Wed, 6 Nov 2013 18:34:06 +0800 Message-Id: <1383734046-3584-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=-6.8 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 Mesh STA receiving the mesh CSA action frame is not able to trigger the mesh channel switch due to the incorrect handling and comparison of mesh channel switch parameters element (MCSP)'s TTL. Make sure the MCSP's TTL is updated accordingly before calling the ieee80211_mesh_process_chnswitch. Signed-off-by: Chun-Yeow Yeoh --- net/mac80211/mesh.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 896fe3b..973c8dd 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -945,10 +945,8 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, params.block_tx = csa_ie.mode & WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT; if (beacon) ifmsh->chsw_ttl = csa_ie.ttl - 1; - else - ifmsh->chsw_ttl = 0; - if (ifmsh->chsw_ttl > 0) + if (ifmsh->chsw_ttl >= 0) if (ieee80211_mesh_csa_beacon(sdata, ¶ms, false) < 0) return false; @@ -1163,7 +1161,6 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata, offset_ttl = (len < 42) ? 7 : 10; *(pos + offset_ttl) -= 1; *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR; - sdata->u.mesh.chsw_ttl = *(pos + offset_ttl); memcpy(mgmt_fwd, mgmt, len); eth_broadcast_addr(mgmt_fwd->da); @@ -1182,7 +1179,7 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, u16 pre_value; bool fwd_csa = true; size_t baselen; - u8 *pos, ttl; + u8 *pos; if (mgmt->u.action.u.measurement.action_code != WLAN_ACTION_SPCT_CHL_SWITCH) @@ -1193,8 +1190,8 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, u.action.u.chan_switch.variable); ieee802_11_parse_elems(pos, len - baselen, false, &elems); - ttl = elems.mesh_chansw_params_ie->mesh_ttl; - if (!--ttl) + ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl; + if (!--ifmsh->chsw_ttl) fwd_csa = false; pre_value = le16_to_cpu(elems.mesh_chansw_params_ie->mesh_pre_value);