From patchwork Fri Aug 25 02:29:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mitsyanko X-Patchwork-Id: 9921159 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9856C600C5 for ; Fri, 25 Aug 2017 02:30:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 808B12026B for ; Fri, 25 Aug 2017 02:30:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 758B020564; Fri, 25 Aug 2017 02:30:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBC0E20453 for ; Fri, 25 Aug 2017 02:30:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754436AbdHYCat (ORCPT ); Thu, 24 Aug 2017 22:30:49 -0400 Received: from mail-cys01nam02on0041.outbound.protection.outlook.com ([104.47.37.41]:61440 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754347AbdHYCas (ORCPT ); Thu, 24 Aug 2017 22:30:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WgtGHce3tspl7dWNoFb3ZmccDz681Bptgyoe+UGPkmU=; b=ogotFgybrIHG5+Sm8sF84FbDQAiRFCeQSzQ/eOZf3JRky9r/59F1iTEilfRMTPzdLc4Nm8bkwFG1/0gfBLpUC2n4X4eczbiaMTPwg9x4/xs9ywXIPx/hFD/E0EiJ9VXH70TP8eN/vu7AhP5k6vvWvsS7OPjgQMDUHpE1nIPctJI= Received: from dodo-dell.quantenna.com (12.131.200.68) by SN1PR0501MB2047.namprd05.prod.outlook.com (10.163.227.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.4; Fri, 25 Aug 2017 02:30:45 +0000 From: igor.mitsyanko.os@quantenna.com To: linux-wireless@vger.kernel.org Cc: sergey.matyukevich.os@quantenna.com, avinashp@quantenna.com, johannes@sipsolutions.net, Igor Mitsyanko Subject: [PATCH 02/27] qtnfmac: make "Channel change" event report full channel info Date: Thu, 24 Aug 2017 19:29:59 -0700 Message-Id: <20170825023024.10565-3-igor.mitsyanko.os@quantenna.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170825023024.10565-1-igor.mitsyanko.os@quantenna.com> References: <20170825023024.10565-1-igor.mitsyanko.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [12.131.200.68] X-ClientProxiedBy: CY4PR15CA0017.namprd15.prod.outlook.com (10.172.74.27) To SN1PR0501MB2047.namprd05.prod.outlook.com (10.163.227.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a392daa9-3d05-4c66-e8f0-08d4eb614a47 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN1PR0501MB2047; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0501MB2047; 3:1iPaTgCWlhG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/GI9a4lJwJhV5auGtj6Ff+7+SOhXeKlqE69kG0OpzXAga2N6PVys2sCNEkpqgYnVXaNZZOecnGGdr80razpl2c0Uv51ljD3H1JHxQ4kNIgDjrz7QT0/ynX4h4AaF1mf1HB+967dq/nHDBCtgIYHWb231pz8gge3b2kU/9tpQANUHlyREAuRyVzIna65I5roAOfbWWNYpphheN9qF6A1NutieJVZbmn+4cGF9ylUU5GRofsWVJpZimhKAeswO9zX3EfMbF2KrF7mdJr0BPM1Puw7uMil1Qq9A0TOU0mjk08YPwdgmzhYBcezsb6vtcHgCdcjTf8oPDjj5SGxEtzZM8BSaXze6wIhJHa484S7icdzmagR9EED2ZAEX/fZMBHlrOIPOKUAvCuNIF9C82yUM9hvuVuAfalU5Pw27JGXMV8GTiSgxuVFCJkbTCrvU=; 4:ojS+f/MMApg4yfuy0L6ZXK8GC5+Q2YD0rFHgzxyDk9rFBHeWW8Dun83hfw53BDZm8XZKMhc78a69s/hg6mOYD6TiiYzML2m0xa/W2cf7s93V9v38eWW8UIvPGDJU3HsJi2Ky4U+PPt0UEhPIFd6yli71zZc+NXvh7uBrKRVPCBXr2nwibrfQIUxiOF12ZQoaBuVSZ0YpEccw6xHLlvs0oVKL3xul6pemSn3awDNO59O/r0WsaFuxqJLhFMIra3zT X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR0501MB2047; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR0501MB2047; X-Forefront-PRVS: 041032FF37 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39830400002)(199003)(189002)(76176999)(53416004)(50986999)(110136004)(7350300001)(6916009)(6666003)(2950100002)(47776003)(2906002)(9686003)(53936002)(66066001)(2361001)(106356001)(105586002)(2351001)(86362001)(305945005)(33646002)(7736002)(42186005)(81166006)(81156014)(107886003)(8676002)(103116003)(478600001)(85782001)(68736007)(50226002)(50466002)(3846002)(6486002)(25786009)(36756003)(97736004)(5660300001)(1076002)(6116002)(69596002)(5003940100001)(101416001)(4326008)(189998001)(48376002)(85772001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0501MB2047; H:dodo-dell.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=igor.mitsyanko.os@quantenna.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0501MB2047; 23:hcnlDa74iTh4i0SPslgrdgfA/pAVN1D0gzlE2EJ?= =?us-ascii?Q?i1sJZcP+SggBPqnoITxHEsCH5rmrI49pdcxbETH0oetJiTsJH4Xs6bmlzPEJ?= =?us-ascii?Q?Q33VcNSDqrVsQs822em4K+/mgiKKv657KZTxLuGyrTNTcHNi2jDprA3r7rNf?= =?us-ascii?Q?YoO4Z/PpStPyrSs4AmuNMvgKdKazqeh7VdiWWKC5lNO0fde2OV3BCKGRLUWR?= =?us-ascii?Q?ovqhPuAT1V/Bl1u7oWvEXEOQMsCpqwIJrKcS7x/upJpCBQP7y3snQoogzeLl?= =?us-ascii?Q?rDNEdLpu6xgkvcNq98swC/fsLTy+IzZznqnKEs3xwlWmXD2BCViN6TCA8rc1?= =?us-ascii?Q?CdH5GedSYhErmhNxPvIKa9Tvnz+nFufhcz/Xr79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eDA9yP5My+gGMJ70zH3XCBFn7yDcflF2F0O/RJHUJ?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0501MB2047; 6:yz8BILmkaEfUv0aGSnzHQjAI6Z6apgd189Lo5cScgR5WCURpwOrGdgUfFsmDtt9tnGyFaLo8qWqMZ7siVG2O+7j/cECC9Eh0U9JLOHbjsxAK6OiVM7h4Z5Dc1pfX/NRazWKaGvTF3CofRB+pO2rcqTdSYUSBq3wLdp7BoDn4Yrl3uaDDwlS/TLO+hXrOagkn6nhSzbW0ap8kjKSzn0zkNYCSIdlLxfcD572KqoOrLLLcUWx8ek1hJ2FarTRi6BfmQu3LO1O7zydrvdfV41bLbqVwTG2+7LznCCWMOuhvW3zRktmxH6OskejReqQ4HP0EIotHU9ed+VwdLQfkKAW8lg==; 5:CJgXm8gkMXiycEF0AaL7OqFEkhVPGeSjsXIIUFw0Tpy6bZrGIF5gNqEY01fCpyCiO8Pxs318gXTaMxqgtezh+5yPKoUC8pdiP8cEnKFpwUyiNYxHNJWl9fCQEJlGjodPZaBtu7sKCg+6j2e8Y8w3Jg==; 24:Z97aziV8F5AsOAcGetEL6cB41xS1+HsIcp2EY16RrU2GSptGzN8vS14ACPy8sx8THwXAlJgnI6zYpM7u5E7G10qdfFsI78dxgB2MjEy4pSM=; 7:RenWoMRPg69Tx9TyukVh3Iu+KhXUQ1NZy8OoM5rCAhsxDz8GV3KNK1Gv8Q0ydBcFnH1JG1Q2rcW04vLbgwTd1HbbwlcmNZCAZtQHoqHOSnXVq/4v6XBwYlCvpOn7rBcdZb8VKOuFWFqlJYKNSQmH0Xo4vIElwCG8vqBpouIGo+45/tLDU3NswMkzDJmORUtp0XuCkBFPXXZchjFetndD6ITgv72rAaDo+0eSYy4FgZg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2017 02:30:45.1195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0501MB2047 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Igor Mitsyanko Specifically, it has to report center frequency, secondary center frequency (for 80+80) and BW. Introduce channel definition structure to qlink and modify channel change event processing function accordingly. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/event.c | 34 +++++++------- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 18 +++++++- .../net/wireless/quantenna/qtnfmac/qlink_util.c | 52 ++++++++++++++++++++++ .../net/wireless/quantenna/qtnfmac/qlink_util.h | 4 ++ 4 files changed, 87 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 0fc2814..52e2652 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -25,6 +25,7 @@ #include "trans.h" #include "util.h" #include "event.h" +#include "qlink_util.h" static int qtnf_event_handle_sta_assoc(struct qtnf_wmac *mac, struct qtnf_vif *vif, @@ -358,41 +359,36 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac, u16 len) { struct wiphy *wiphy = priv_to_wiphy(mac); - struct cfg80211_chan_def chandef; - struct ieee80211_channel *chan; + struct cfg80211_chan_def chdef; struct qtnf_vif *vif; - int freq; int i; if (len < sizeof(*data)) { - pr_err("payload is too short\n"); + pr_err("MAC%u: payload is too short\n", mac->macid); return -EINVAL; } - freq = le32_to_cpu(data->freq); - chan = ieee80211_get_channel(wiphy, freq); - if (!chan) { - pr_err("channel at %d MHz not found\n", freq); + qlink_chandef_q2cfg(wiphy, &data->chan, &chdef); + + if (!cfg80211_chandef_valid(&chdef)) { + pr_err("MAC%u: bad channel freq1=%u bw=%u\n", mac->macid, + chdef.center_freq1, chdef.width); return -EINVAL; } - pr_debug("MAC%d switch to new channel %u MHz\n", mac->macid, freq); + pr_debug("MAC%d: new channel ieee=%u freq1=%u freq2=%u bw=%u\n", + mac->macid, chdef.chan->hw_value, chdef.center_freq1, + chdef.center_freq2, chdef.width); if (mac->status & QTNF_MAC_CSA_ACTIVE) { mac->status &= ~QTNF_MAC_CSA_ACTIVE; - if (chan->hw_value != mac->csa_chandef.chan->hw_value) + if (chdef.chan->hw_value != mac->csa_chandef.chan->hw_value) pr_warn("unexpected switch to %u during CSA to %u\n", - chan->hw_value, + chdef.chan->hw_value, mac->csa_chandef.chan->hw_value); } - /* FIXME: need to figure out proper nl80211_channel_type value */ - cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20); - /* fall-back to minimal safe chandef description */ - if (!cfg80211_chandef_valid(&chandef)) - cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20); - - memcpy(&mac->chandef, &chandef, sizeof(mac->chandef)); + memcpy(&mac->chandef, &chdef, sizeof(mac->chandef)); for (i = 0; i < QTNF_MAX_INTF; i++) { vif = &mac->iflist[i]; @@ -401,7 +397,7 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac, if (vif->netdev) { mutex_lock(&vif->wdev.mtx); - cfg80211_ch_switch_notify(vif->netdev, &chandef); + cfg80211_ch_switch_notify(vif->netdev, &chdef); mutex_unlock(&vif->wdev.mtx); } } diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index a69fd470..5936854 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -118,6 +118,20 @@ enum qlink_channel_width { QLINK_CHAN_WIDTH_160, }; +/** + * struct qlink_chandef - qlink channel definition + * + * @center_freq1: center frequency of first segment + * @center_freq2: center frequency of second segment (80+80 only) + * @width: channel width, one of @enum qlink_channel_width + */ +struct qlink_chandef { + __le16 center_freq1; + __le16 center_freq2; + u8 width; + u8 rsvd[3]; +} __packed; + /* QLINK Command messages related definitions */ @@ -764,11 +778,11 @@ struct qlink_event_bss_leave { /** * struct qlink_event_freq_change - data for QLINK_EVENT_FREQ_CHANGE event * - * @freq: new operating frequency in MHz + * @chan: new operating channel definition */ struct qlink_event_freq_change { struct qlink_event ehdr; - __le32 freq; + struct qlink_chandef chan; } __packed; enum qlink_rxmgmt_flags { diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c index 369b77d..3c1db5b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c @@ -75,3 +75,55 @@ u8 qlink_chan_width_mask_to_nl(u16 qlink_mask) return result; } + +static enum nl80211_chan_width qlink_chanwidth_to_nl(u8 qlw) +{ + switch (qlw) { + case QLINK_CHAN_WIDTH_20_NOHT: + return NL80211_CHAN_WIDTH_20_NOHT; + case QLINK_CHAN_WIDTH_20: + return NL80211_CHAN_WIDTH_20; + case QLINK_CHAN_WIDTH_40: + return NL80211_CHAN_WIDTH_40; + case QLINK_CHAN_WIDTH_80: + return NL80211_CHAN_WIDTH_80; + case QLINK_CHAN_WIDTH_80P80: + return NL80211_CHAN_WIDTH_80P80; + case QLINK_CHAN_WIDTH_160: + return NL80211_CHAN_WIDTH_160; + case QLINK_CHAN_WIDTH_5: + return NL80211_CHAN_WIDTH_5; + case QLINK_CHAN_WIDTH_10: + return NL80211_CHAN_WIDTH_10; + default: + return -1; + } +} + +void qlink_chandef_q2cfg(struct wiphy *wiphy, + const struct qlink_chandef *qch, + struct cfg80211_chan_def *chdef) +{ + chdef->center_freq1 = le16_to_cpu(qch->center_freq1); + chdef->center_freq2 = le16_to_cpu(qch->center_freq2); + chdef->width = qlink_chanwidth_to_nl(qch->width); + + switch (chdef->width) { + case NL80211_CHAN_WIDTH_20_NOHT: + case NL80211_CHAN_WIDTH_20: + case NL80211_CHAN_WIDTH_5: + case NL80211_CHAN_WIDTH_10: + chdef->chan = ieee80211_get_channel(wiphy, chdef->center_freq1); + break; + case NL80211_CHAN_WIDTH_40: + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + chdef->chan = ieee80211_get_channel(wiphy, + chdef->center_freq1 - 10); + break; + default: + chdef->chan = NULL; + break; + } +} diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h index de06c1e..5e49a8a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h @@ -19,6 +19,7 @@ #include #include +#include #include "qlink.h" @@ -62,5 +63,8 @@ static inline void qtnf_cmd_skb_put_tlv_u16(struct sk_buff *skb, u16 qlink_iface_type_to_nl_mask(u16 qlink_type); u8 qlink_chan_width_mask_to_nl(u16 qlink_mask); +void qlink_chandef_q2cfg(struct wiphy *wiphy, + const struct qlink_chandef *qch, + struct cfg80211_chan_def *chdef); #endif /* _QTN_FMAC_QLINK_UTIL_H_ */