From patchwork Fri Sep 19 02:24:36 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: 4935221 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 4245BBEEA5 for ; Fri, 19 Sep 2014 02:25:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6052C20173 for ; Fri, 19 Sep 2014 02:25:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 702E320166 for ; Fri, 19 Sep 2014 02:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754609AbaISCY5 (ORCPT ); Thu, 18 Sep 2014 22:24:57 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:37499 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754584AbaISCY5 (ORCPT ); Thu, 18 Sep 2014 22:24:57 -0400 Received: by mail-pd0-f169.google.com with SMTP id fp1so2642171pdb.28 for ; Thu, 18 Sep 2014 19:24:56 -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=qFwxzCgS+MunbtbedG0raNNv1yLivoPGHcghOLMyuJw=; b=F2WJ/ElP98FvKeXiM0XZ1GZbRNTt1z8jJQ2qUNp3K2Hy2bN/wtZcryjWYM04+4SJCL 5Fe8iEyRUbFCkPXwD1fA9j0UjW1Nm+K+ybxy4dVqyQMyVhw5kBiIfGf8XHZHqCBS4u62 jBq2A+dWC1/K3mwy5aA/4YgN0XOU/l8eHLOgNVNE0+HrmuhyuVi9N0yxR8eI5kkwaHHY bRRctsTYh+brN3XJZSui0FMm2lXIqN2VHII4MViWwhN89dGrRYzsPDoy8p0ZuTkkBw9j VeZxERMJbluEjwYz41Qq70q0bcFd14oBNxnd+g//EYjPi5PLtnUA/QyLNOuPVyhERKh1 LbCg== X-Received: by 10.68.57.172 with SMTP id j12mr10199995pbq.147.1411093496458; Thu, 18 Sep 2014 19:24:56 -0700 (PDT) Received: from localhost.localdomain ([58.26.233.145]) by mx.google.com with ESMTPSA id ca2sm318865pbc.26.2014.09.18.19.24.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 19:24:53 -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 v2 2/2] iw: Allow basic rates to be configured when joining mesh Date: Fri, 19 Sep 2014 10:24:36 +0800 Message-Id: <1411093476-15685-2-git-send-email-yeohchunyeow@gmail.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1411093476-15685-1-git-send-email-yeohchunyeow@gmail.com> References: <1411093476-15685-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 --- mesh.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/mesh.c b/mesh.c index 69c54cc..b21a302 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