From patchwork Tue Nov 24 17:42:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 7692561 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 867799F2EC for ; Tue, 24 Nov 2015 17:42:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8878C207BB for ; Tue, 24 Nov 2015 17:42:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B5FF20794 for ; Tue, 24 Nov 2015 17:42:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753959AbbKXRm0 (ORCPT ); Tue, 24 Nov 2015 12:42:26 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:35154 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752615AbbKXRmZ (ORCPT ); Tue, 24 Nov 2015 12:42:25 -0500 Received: by wmuu63 with SMTP id u63so106798421wmu.0 for ; Tue, 24 Nov 2015 09:42:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=03XuJ5SwL7+Scj5IWzRi3l3yHLlZqBMT/yX2Dmdfo3c=; b=rg1gYcEOegInuhOQHSj94HxyhEnC8Ln7BO0zU73CcM5nY0lUFjQxrzwPGoaWNmIsRQ olsbc+sfK5psSl1IwpDvmx+uFmlvfOL8vCkDfp9plO6Ml3SFaZvMLOBT4BSzAyqgJui+ qhCiMdKrlwDdfb3WijsOxvMjsgX5U/X+3aBXHKp1eTifvBzav+eMz2aO72Un2CvOAXrE 3trME0Amlmv/49U8wLLYpZF35wuGF5MjTDq9iRuFYW4pjWPnwVi8JJT+LNyvaMHyGQfT GqtreSjkz8HD5RJJw8sWs4coPwZ0+jj7STgjPBRUU/zGlilp7tr0D8fPOab7Z3x60wsf ss5g== 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; bh=03XuJ5SwL7+Scj5IWzRi3l3yHLlZqBMT/yX2Dmdfo3c=; b=HJkBpb+lm5pNMRY8YeYkvFOEwW7pcy4jxQe1UXaaVDoK0YrzIub7JB462gKemzzhp7 fQ6n5LZ2Km6PXi2sgkf2kS+RUrVcSZ/CUV8yU6OzOQlZsYZF89cXHsHx/3+YccH9l3cC XtV0NUNOLh1C8AnnVQlSY71idEgaisJ87WbTK7tZ/18munZScAXqvpsNOB6c6wJogF3f FPTKXPN8mHQF1NXvIPARhDg03c4ug/s/qiZ5zJkENzycPFJPnUkgrGUxGUBxIhzvonK3 BTH5p8oghqyRg3sAhH9kgNwf97eeL9q0RD7gHUjgzjqxBG2nX+6p/cJcF8xzBim91W64 I3SA== X-Gm-Message-State: ALoCoQlIxFmd432CREW8qScL3BpAKaUkJkKLWojcboRjEqRwux3a9/RnBDroHEWu0BsBLQ230PjK X-Received: by 10.28.173.131 with SMTP id w125mr25296318wme.41.1448386944334; Tue, 24 Nov 2015 09:42:24 -0800 (PST) Received: from sven-desktop.home.narfation.org (x4d0d5f44.dyn.telefonica.de. [77.13.95.68]) by smtp.gmail.com with ESMTPSA id t5sm19072735wmt.1.2015.11.24.09.42.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Nov 2015 09:42:23 -0800 (PST) From: Sven Eckelmann To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Sven Eckelmann Subject: iw: add VHT80 support for 802.11s Date: Tue, 24 Nov 2015 18:42:07 +0100 Message-Id: <1448386927-25170-1-git-send-email-sven@open-mesh.com> X-Mailer: git-send-email 2.6.2 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_SIGNED, 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 iw mesh supports non-HT and HT channel widths like HT20 or NOHT. But the Linux 802.11s implementation also supports VHT80 which can be specified during the mesh join. iw dev mesh0 mesh join "meshnet" freq 5180 80MHz Signed-off-by: Sven Eckelmann --- ibss.c | 33 --------------------------------- iw.h | 9 +++++++++ mesh.c | 16 ++++++++-------- util.c | 26 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 41 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ibss.c b/ibss.c index 23bda70..ac06fc5 100644 --- a/ibss.c +++ b/ibss.c @@ -16,39 +16,6 @@ SECTION(ibss); -struct chanmode { - const char *name; - unsigned int width; - int freq1_diff; - int chantype; /* for older kernel */ -}; - -static int get_cf1(const struct chanmode *chanmode, unsigned long freq) -{ - int cf1 = freq, j; - int vht80[] = { 5180, 5260, 5500, 5580, 5660, 5745 }; - - switch (chanmode->width) { - case NL80211_CHAN_WIDTH_80: - /* setup center_freq1 */ - for (j = 0; j < ARRAY_SIZE(vht80); j++) { - if (freq >= vht80[j] && freq < vht80[j] + 80) - break; - } - - if (j == ARRAY_SIZE(vht80)) - break; - - cf1 = vht80[j] + 30; - break; - default: - cf1 = freq + chanmode->freq1_diff; - break; - } - - return cf1; -} - static int join_ibss(struct nl80211_state *state, struct nl_msg *msg, int argc, char **argv, diff --git a/iw.h b/iw.h index cef9da8..8e1a37a 100644 --- a/iw.h +++ b/iw.h @@ -59,6 +59,13 @@ struct cmd { const struct cmd *parent; }; +struct chanmode { + const char *name; + unsigned int width; + int freq1_diff; + int chantype; /* for older kernel */ +}; + #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0])) #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y)) @@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown, void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen); void iw_hexdump(const char *prefix, const __u8 *data, size_t len); +int get_cf1(const struct chanmode *chanmode, unsigned long freq); + #define SCHED_SCAN_OPTIONS "interval [delay ] " \ "[freqs +] [matches [ssid ]+]] [active [ssid ]+|passive] [randomise[=/]]" int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv); diff --git a/mesh.c b/mesh.c index 0090530..930d58f 100644 --- a/mesh.c +++ b/mesh.c @@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state, int bintval, dtim_period, i, n_rates = 0; char *end, *value = NULL, *sptr = NULL; unsigned long freq = 0; - static const struct { - const char *name; - unsigned int width; - int freq1_diff; - int chantype; /* for older kernel */ - } *chanmode_selected = NULL, chanmode[] = { + const struct chanmode *chanmode_selected = NULL; + static const struct chanmode chanmode[] = { { .name = "HT20", .width = NL80211_CHAN_WIDTH_20, .freq1_diff = 0, @@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state, .width = NL80211_CHAN_WIDTH_20_NOHT, .freq1_diff = 0, .chantype = NL80211_CHAN_NO_HT }, + { .name = "80MHz", + .width = NL80211_CHAN_WIDTH_80, + .freq1_diff = 0, + .chantype = -1 }, }; if (argc < 1) @@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state, NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH, chanmode_selected->width); NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, - freq + chanmode_selected->freq1_diff); + get_cf1(chanmode_selected, freq)); if (chanmode_selected->chantype != -1) NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, @@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state, nla_put_failure: return -ENOBUFS; } -COMMAND(mesh, join, " [[freq ]" +COMMAND(mesh, join, " [[freq ]" " [basic-rates ]], [mcast-rate ]" " [beacon-interval