From patchwork Sat Sep 20 06:40:44 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: 4940751 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 361EF9F2EC for ; Sat, 20 Sep 2014 06:41:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6006520200 for ; Sat, 20 Sep 2014 06:41:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C1B72017E for ; Sat, 20 Sep 2014 06:41:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754795AbaITGlH (ORCPT ); Sat, 20 Sep 2014 02:41:07 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:56544 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbaITGlF (ORCPT ); Sat, 20 Sep 2014 02:41:05 -0400 Received: by mail-pa0-f41.google.com with SMTP id ey11so1626918pad.28 for ; Fri, 19 Sep 2014 23:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6qBNbGT632TMnHwKEBdHSmZgD/H9JtMJXjIqGoADK4w=; b=RgcQTDxiJEfHdA9BCVFrle/yU9DDbmdukNCXLZJVCboV5cscBurh785WreckZ13n0x y88SH9UtAOsSEgfLkMiLxSgIzlQNvFNSE9JOh78AOdMunEUKcJkdURUVOqKd0ycovX9p 2aZDhFlJbhgKVmvK5Y2lIQW+aBpmmkrsFSbKSG9ypH97YXn/0J54p2ITJz/RaGE6Uuwi TMqXslskt1PN2td1AZ9zgvumpDav85DeiNab5oIUabC3zFct+Zr5obLGbFHUvuhRRH9Y Q9XLIG0DAaJNAWzrjoLiwuuAoZLnMZ9wlkH+bjzQsKmrd4+WkFrQEY3fAxnEaAiRIrep aG9A== X-Received: by 10.70.47.42 with SMTP id a10mr7611848pdn.14.1411195264862; Fri, 19 Sep 2014 23:41:04 -0700 (PDT) Received: from nga.lan ([175.139.58.149]) by mx.google.com with ESMTPSA id h4sm3586715pat.11.2014.09.19.23.41.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Sep 2014 23:41:04 -0700 (PDT) From: Chun-Yeow Yeoh To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, devel@lists.open80211s.org, Chun-Yeow Yeoh , Ashok Nagarajan Subject: [PATCH v3 2/2] iw: Allow basic rates to be configured when joining mesh Date: Sat, 20 Sep 2014 14:40:44 +0800 Message-Id: <1411195244-9130-2-git-send-email-yeohchunyeow@gmail.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1411195244-9130-1-git-send-email-yeohchunyeow@gmail.com> References: <1411195244-9130-1-git-send-email-yeohchunyeow@gmail.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.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 This patch adds option to configure basic rates during mesh join. Signed-off-by: Ashok Nagarajan Signed-off-by: Chun-Yeow Yeoh v2: minor change for upstream v3: fix typo error (Colleen) --- mesh.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/mesh.c b/mesh.c index 69c54cc..23cba2e 100644 --- a/mesh.c +++ b/mesh.c @@ -438,8 +438,9 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb, { struct nlattr *container; float rate; - int bintval, dtim_period, i; - char *end; + unsigned char rates[NL80211_MAX_SUPP_RATES]; + int bintval, dtim_period, i, n_rates = 0; + char *end, *value = NULL, *sptr = NULL; unsigned long freq = 0; static const struct { const char *name; @@ -510,6 +511,32 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb, } } + /* basic rates */ + if (argc > 1 && strcmp(argv[0], "basic-rates") == 0) { + argv++; + argc--; + + value = strtok_r(argv[0], ",", &sptr); + + while (value && n_rates < NL80211_MAX_SUPP_RATES) { + rate = strtod(value, &end); + rates[n_rates] = rate * 2; + + /* filter out suspicious values */ + if (*end != '\0' || !rates[n_rates] || + rate*2 != rates[n_rates]) + return 1; + + n_rates++; + value = strtok_r(NULL, ",", &sptr); + } + + NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, n_rates, rates); + argv++; + argc--; + } + + /* multicast rate */ if (argc > 1 && strcmp(argv[0], "mcast-rate") == 0) { argv++; argc--; @@ -575,13 +602,14 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb, nla_put_failure: return -ENOBUFS; } -COMMAND(mesh, join, " [freq in MHz] [HT20|HT40+|HT40-|NOHT]" - " [mcast-rate ]" +COMMAND(mesh, join, " [freq in MHz [HT20|HT40+|HT40-|NOHT]" + " [basic-rates ]], [mcast-rate ]" " [beacon-interval