From patchwork Thu Sep 10 10:04:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 7153161 X-Patchwork-Delegate: johannes@sipsolutions.net 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 520A7BEEC1 for ; Thu, 10 Sep 2015 10:04:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48B0F206D7 for ; Thu, 10 Sep 2015 10:04:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AFA0F206EB for ; Thu, 10 Sep 2015 10:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbbIJKEv (ORCPT ); Thu, 10 Sep 2015 06:04:51 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:36321 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbbIJKEt (ORCPT ); Thu, 10 Sep 2015 06:04:49 -0400 Received: by lbcao8 with SMTP id ao8so20179257lbc.3 for ; Thu, 10 Sep 2015 03:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=gKX/jgsMjzrNAnMS7dmOrkJE9LUH4CsUvaAxTDVGx+I=; b=U0NpTNpMdyFvu3Otm1pcZV7TeGlLO2/Ui0n+4vt+6zYrwFD/sRZ8flg2fi9Z4XdLzD rEssEHmIqC3NPD1c43hh86AOBZyfF6hDqBVN//Em+S48aS2CFEE/wL1wl2SaLgylwLPQ aBsVJKK3zu6ki63z04pfDuGuUU2kyspbSIfsE= 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=gKX/jgsMjzrNAnMS7dmOrkJE9LUH4CsUvaAxTDVGx+I=; b=Oqyyy9/ceKgLUJAUBsFJkqruN3yC7o2J/XXC4SE6xdQxg8qsXaBMB1vUW5GS4s7Znh VYOor7wNIfay/Y22p+NkryfNwHxFpgYE0TBeEbaJ4NDJ9brk+2Hxe14ObVv/rAkPD4ls YqN461gRUpDX99BUmNYCt/eLQKD146Mt9FouJzR16UAkx6tvlR6Dtij5sRs5ytbiekjD UWLAGGYAaqszAbj7zOpg/8g9VSU/hzzQbvkkf987+gb1trxHSd1REl3bGSsY/p8DTzdk ZlZXgpN6SQlLXNg2104ZpqP5afvJgBqObyORR7J3Tmb+fYpg+yXm5R3ja7TCncsNyyp5 Po0A== X-Gm-Message-State: ALoCoQnEc9Ppk3+Ib4NUB/qHSPxR5lOqh59uonMGxgRl618FwCYdxKe33siwxuyUAW28rDJ/8yHXkwARLhGGqc1x3Gozb6vew1HVcnkwy3F35flrrcUsp8FzGIl4lqNBGtZxJnjpDKUR8G2wxACte8TkpjJNRC0kXYlttb/vUnspxyIjhOxl0b2dB//Svch88bxGMTYGS3C+ X-Received: by 10.152.36.233 with SMTP id t9mr33297997laj.47.1441879488301; Thu, 10 Sep 2015 03:04:48 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id rp6sm2518124lbb.44.2015.09.10.03.04.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Sep 2015 03:04:47 -0700 (PDT) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Janusz Dziedzic Subject: [PATCH] ibss: add VHT80 support for IBSS Date: Thu, 10 Sep 2015 12:04:13 +0200 Message-Id: <1441879453-6391-1-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 X-DomainID: tieto.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=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RCVD_IN_SBL_CSS,T_DKIM_INVALID,T_RP_MATCHES_RCVD, 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 Add VHT80 support for IBSS. eg. iw wlan0 ibss join 5180 80MHZ iw wlan0 ibbs join 5220 80MHZ Signed-off-by: Janusz Dziedzic --- ibss.c | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/ibss.c b/ibss.c index 7a0b707..460f549 100644 --- a/ibss.c +++ b/ibss.c @@ -16,6 +16,38 @@ 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, @@ -30,12 +62,8 @@ static int join_ibss(struct nl80211_state *state, int bintval; int i; unsigned long freq; - 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, @@ -60,6 +88,10 @@ static int join_ibss(struct nl80211_state *state, .width = NL80211_CHAN_WIDTH_10, .freq1_diff = 0, .chantype = -1 }, + { .name = "80MHZ", + .width = NL80211_CHAN_WIDTH_80, + .freq1_diff = 0, + .chantype = -1 }, }; if (argc < 2) @@ -90,7 +122,7 @@ static int join_ibss(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, @@ -192,7 +224,7 @@ COMMAND(ibss, leave, NULL, NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss, "Leave the current IBSS cell."); COMMAND(ibss, join, - " [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ] [fixed-freq] [] [beacon-interval ]" + " [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ|80MHZ] [fixed-freq] [] [beacon-interval ]" " [basic-rates ] [mcast-rate ] " "[key d:0:abcde]", NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,