From patchwork Mon Nov 13 10:28:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10055515 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 BC9AC6029B for ; Mon, 13 Nov 2017 10:28:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 890AE29363 for ; Mon, 13 Nov 2017 10:28:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DCB829368; Mon, 13 Nov 2017 10:28:37 +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 B35F429363 for ; Mon, 13 Nov 2017 10:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752200AbdKMK2f (ORCPT ); Mon, 13 Nov 2017 05:28:35 -0500 Received: from mail-sn1nam01on0085.outbound.protection.outlook.com ([104.47.32.85]:59533 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751391AbdKMK2c (ORCPT ); Mon, 13 Nov 2017 05:28:32 -0500 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=e51hkNQ4ugG36Tb2QoBSKfIiEeU7vSjc40RAlLO63M4=; b=kKlx1Zmh5MpH99sSVo4RJ1zkvxMbMi2HQFqZWWtz35K/GCqoRzdH94C2+FtaH5ojVZPiBgfHB3Cwe9tzPybKYuPVBdWtvVGtoQ3Thv1M8z1uyAbaYV2gwwiZCc1g43b57r0rWmesf5xTn6bMy4P8kKzmeVR2E+y/DFm6rGGc9AE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.239.4; Mon, 13 Nov 2017 10:28:28 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Vasily Ulyanov , Sergey Matyukevich Subject: [PATCH 02/10] qtnfmac: pass complete channel data between driver and firmware Date: Mon, 13 Nov 2017 13:28:07 +0300 Message-Id: <20171113102815.11254-3-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171113102815.11254-1-sergey.matyukevich.os@quantenna.com> References: <20171113102815.11254-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM5P190CA0007.EURP190.PROD.OUTLOOK.COM (10.161.47.148) To BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) X-MS-Office365-Filtering-Correlation-Id: 4463027d-5b3c-47cb-5fbc-08d52a814874 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BLUPR05MB1924; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 3:tQtKFo+w/LrliiCGnUOYHu6iY/nWuaPQhHhArv17ITZImkOGQ6EYxur69mp+GCXurF50C4XDTag+fq3T1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ysShZUdM+2cDAktkCnq25ZgbAxYxubqeWtOEct8CmineT5vh3hHAFxrfiZCt8eFs169zzzSjfnZSP3z2ti0TD0r48NEeLLWxFI/Ryq5loyYQJzvosFYB7fTaBM2Q2AwXDUhbHLWtNbpmgx39d/ORbRv2j7KhambhTqw/LSBMme1d1J9BeSc5mB0dcn4J+FPFtEH3Qzd7QQmVXcOAwSIQavv7ei9Ncqcd0yp0uxZV+zubHxm9DeJa4P4E5lIKWYcGj7aIHkdb2f3kzg9ucnI/P6CgzteCz/0WW2EwiD9md7p6etFyQUn; 4:PUt+j3tVwACdq8XudX8/lbgBJ1aa+bg9G18C1T0tZkYdaqUrnF+3gVK3gy8Cb8gxWJAYPYEQF1vFe6IrzDgUdRGfaoWLL91atDgeFNK3+Eu+OfZOU0BQTs/7kcM/6gET5zqqTDCDxarWWYhE65mPiJKv5gE9lvtsfv1RQSkWl/adIfR/BNi67KpQWw9JGfLtE40AZFNCBPz6S3jwon759ns7f+3G2WZzGiYx02Y0AYYBlbl/Cy6cieQ8ski5jaVefRschJCaOmwlK1HTILle2Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(3231022)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR05MB1924; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR05MB1924; X-Forefront-PRVS: 0490BBA1F0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39830400002)(346002)(199003)(189002)(5660300001)(107886003)(47776003)(105586002)(50226002)(54906003)(66066001)(53936002)(2361001)(76176999)(316002)(6486002)(6916009)(50986999)(97736004)(4326008)(33646002)(5003940100001)(106356001)(2906002)(6666003)(2950100002)(25786009)(101416001)(16526018)(189998001)(81166006)(81156014)(86362001)(575784001)(8676002)(6116002)(3846002)(478600001)(68736007)(53416004)(48376002)(7736002)(50466002)(2351001)(16586007)(103116003)(69596002)(36756003)(305945005)(1076002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1924; H:bars.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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB1924; 23:Va6mOOFLW+VqWeFOqnWAamIKmoUG4CQIrA8R3hAk2?= =?us-ascii?Q?y+/EiCK0Z7+awhEzYZJckLxbc+NQRrk9E/tuBg53d7wetFlSYyHjBbeakyen?= =?us-ascii?Q?GiaqslLXgW4iH7q7FbY9lXsmspbZJxnPc1R//4kHS53w5YhYkRyJ6ia9tR1k?= =?us-ascii?Q?fFMCuFlPqSXyfAc5bfo+XfB4gvMIwLSBC5N1gn3Vn8+QNufSdLq4BZSsweLE?= =?us-ascii?Q?raBWYKzTtF01AOCB4y/9YVw4yXbpCC16opXJ3j6kavdhlmnYt/E38AHPGWVR?= =?us-ascii?Q?4yvlc+c95qp+zu1TJqxd17qXnx0/m0fkpRd/G5oG1P5q4neW99PoFXQ8Nk9Q?= =?us-ascii?Q?DRjKGn7Mmp7wNDxStnsLj/Ueevzrout+umz0VVvjyMa3GIkvKh/FxnOK2UKJ?= =?us-ascii?Q?tUo/gKqrd0LjWgzbTGF8L+c8LSUj7IpESBGwfvMq2EQ8/mDYVY39PpvVT+Ga?= =?us-ascii?Q?e0Z6LMPOnm4lThy7+pAWcOQzz4Ugu+yXthdJl5gRUxiICG/Kwq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McS0Yg2jYPvz0g3xBxkJdJ0bfnWb5JoEieTG0osXK2cL3rPdpY3K76psZzDWY0qLD3IvQ3q3y2mXWlv0fG86TR25BldpakPrbErrndOHQwRoEoTvDD8ohtQYlEIQHjN7m/CubG+IHp8jqAtkKKH/GwJEM9rMC+z8WaDfvex6EbCi9tBp5wt1O29Phm72CFm2kZV1QbJOb5vSXF6tZwYc7x6yrUxE2tiBtsi9oiIkeUiM3CGJkz2Je3wkQ6M9hp9O7fh2A=; 5:IHa4y4SfXhYSWbJ5hZW594I6eeviv8wDG+xq878+cfR4QBqZKfXhI0oclscZwGmqhUIKulGyc1kwMqhyiitPBP0PXVB2XvvqesGVBt0isGHUg11b3giz036lvqIiV5zClipenwqhBeeiOnyVcIzTAn50q8iu1/Qi7E2JTrPF8ag=; 24:hPM8pEwwM01J0+Um1KM+3jYbg5Dln1gwlk3cdQbW5DTAABK1IvONHwrDuwYh3Jt2WQtdskNaliE9WoFSWDoi7jrm4Iv0Ot20dPDEmdzlECE=; 7:CJQ1QG/TZTuEIFVj4BsTX1FUL2cA71N02cCORY1FWHKzWP0MdoCEDhlWOd4KG+PbGGu9N8vMlmYG+YCQaN/ZUvoWEjVrEd4pEX/MrahPb27pqv42ShXbbs7Q35OTI0qmroDt1S+asV+U8DEnJawuNPUOgwyNVagaK9hv3PN1CLJLlTQyyVVLmwe8L/COuV8UXXiVx6E28HWhz7KIbnX7nMwfd5hMObI5QMTQiKaVbzNjYu8iJephFk1Qqcnl45EQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2017 10:28:28.7839 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4463027d-5b3c-47cb-5fbc-08d52a814874 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1924 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 Center frequency is not enough to describe the channel in HT and VHT modes. For 40MHz and 80MHz channels both primary channel and center frequency should be specified in order to qualify channel completely. This change adds primary channel info into qlink_chandef structure. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 3 +- drivers/net/wireless/quantenna/qtnfmac/commands.c | 14 +++--- drivers/net/wireless/quantenna/qtnfmac/event.c | 3 +- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 57 ++++++++++++++++------ .../net/wireless/quantenna/qtnfmac/qlink_util.c | 48 ++++++++---------- 5 files changed, 74 insertions(+), 51 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index eeffc7689455..67a57c841c3f 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -717,7 +717,8 @@ qtnf_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, } if (!cfg80211_chandef_valid(chandef)) { - pr_err("%s: bad chan freq1=%u freq2=%u bw=%u\n", ndev->name, + pr_err("%s: bad channel freq=%u cf1=%u cf2=%u bw=%u\n", + ndev->name, chandef->chan->center_freq, chandef->center_freq1, chandef->center_freq2, chandef->width); ret = -ENODATA; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 8bc8dd637315..bed81f0cb1cd 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -247,7 +247,7 @@ int qtnf_cmd_send_start_ap(struct qtnf_vif *vif, chtlv->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANDEF); chtlv->hdr.len = cpu_to_le16(sizeof(*chtlv) - sizeof(chtlv->hdr)); - qlink_chandef_cfg2q(&s->chandef, &chtlv->chan); + qlink_chandef_cfg2q(&s->chandef, &chtlv->chdef); } qtnf_cmd_tlv_ie_set_add(cmd_skb, QLINK_IE_SET_BEACON_HEAD, @@ -1186,7 +1186,7 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, size_t tlv_len; size_t tlv_dlen; const struct qlink_tlv_hdr *tlv; - const struct qlink_tlv_channel *qchan; + const struct qlink_channel *qchan; struct ieee80211_channel *chan; unsigned int chidx = 0; u32 qflags; @@ -1232,7 +1232,7 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, switch (tlv_type) { case QTN_TLV_ID_CHANNEL: - if (unlikely(tlv_len != sizeof(*qchan))) { + if (unlikely(tlv_dlen != sizeof(*qchan))) { pr_err("invalid channel TLV len %zu\n", tlv_len); goto error_ret; @@ -1243,7 +1243,7 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, goto error_ret; } - qchan = (const struct qlink_tlv_channel *)tlv; + qchan = (const struct qlink_channel *)tlv->val; chan = &band->channels[chidx++]; qflags = le32_to_cpu(qchan->flags); @@ -2037,8 +2037,8 @@ static void qtnf_cmd_channel_tlv_add(struct sk_buff *cmd_skb, qchan = skb_put_zero(cmd_skb, sizeof(*qchan)); qchan->hdr.type = cpu_to_le16(QTN_TLV_ID_CHANNEL); qchan->hdr.len = cpu_to_le16(sizeof(*qchan) - sizeof(qchan->hdr)); - qchan->center_freq = cpu_to_le16(sc->center_freq); - qchan->hw_value = cpu_to_le16(sc->hw_value); + qchan->chan.center_freq = cpu_to_le16(sc->center_freq); + qchan->chan.hw_value = cpu_to_le16(sc->hw_value); if (sc->flags & IEEE80211_CHAN_NO_IR) flags |= QLINK_CHAN_NO_IR; @@ -2046,7 +2046,7 @@ static void qtnf_cmd_channel_tlv_add(struct sk_buff *cmd_skb, if (sc->flags & IEEE80211_CHAN_RADAR) flags |= QLINK_CHAN_RADAR; - qchan->flags = cpu_to_le32(flags); + qchan->chan.flags = cpu_to_le32(flags); } int qtnf_cmd_send_scan(struct qtnf_wmac *mac) diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 4abc6d9ed560..a3a18d8469ae 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -369,7 +369,8 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac, qlink_chandef_q2cfg(wiphy, &data->chan, &chandef); if (!cfg80211_chandef_valid(&chandef)) { - pr_err("MAC%u: bad channel f1=%u f2=%u bw=%u\n", mac->macid, + pr_err("MAC%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n", + mac->macid, chandef.chan->center_freq, chandef.center_freq1, chandef.center_freq2, chandef.width); return -EINVAL; diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index a432fb001c41..534d11e4175a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -19,7 +19,7 @@ #include -#define QLINK_PROTO_VER 6 +#define QLINK_PROTO_VER 7 #define QLINK_MACID_RSVD 0xFF #define QLINK_VIFID_RSVD 0xFF @@ -122,17 +122,49 @@ enum qlink_channel_width { }; /** + * struct qlink_channel - qlink control channel definition + * + * @hw_value: hardware-specific value for the channel + * @center_freq: center frequency in MHz + * @flags: channel flags from &enum qlink_channel_flags + * @band: band this channel belongs to + * @max_antenna_gain: maximum antenna gain in dBi + * @max_power: maximum transmission power (in dBm) + * @max_reg_power: maximum regulatory transmission power (in dBm) + * @dfs_state: current state of this channel. + * Only relevant if radar is required on this channel. + * @beacon_found: helper to regulatory code to indicate when a beacon + * has been found on this channel. Use regulatory_hint_found_beacon() + * to enable this, this is useful only on 5 GHz band. + */ +struct qlink_channel { + __le16 hw_value; + __le16 center_freq; + __le32 flags; + u8 band; + u8 max_antenna_gain; + u8 max_power; + u8 max_reg_power; + __le32 dfs_cac_ms; + u8 dfs_state; + u8 beacon_found; + u8 rsvd[2]; +} __packed; + +/** * struct qlink_chandef - qlink channel definition * + * @chan: primary 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 { + struct qlink_channel chan; __le16 center_freq1; __le16 center_freq2; u8 width; - u8 rsvd[3]; + u8 rsvd; } __packed; #define QLINK_MAX_NR_CIPHER_SUITES 5 @@ -1113,19 +1145,16 @@ enum qlink_dfs_state { QLINK_DFS_AVAILABLE, }; +/** + * struct qlink_tlv_channel - data for QTN_TLV_ID_CHANNEL TLV + * + * Channel settings. + * + * @channel: ieee80211 channel settings. + */ struct qlink_tlv_channel { struct qlink_tlv_hdr hdr; - __le16 hw_value; - __le16 center_freq; - __le32 flags; - u8 band; - u8 max_antenna_gain; - u8 max_power; - u8 max_reg_power; - __le32 dfs_cac_ms; - u8 dfs_state; - u8 beacon_found; - u8 rsvd[2]; + struct qlink_channel chan; } __packed; /** @@ -1137,7 +1166,7 @@ struct qlink_tlv_channel { */ struct qlink_tlv_chandef { struct qlink_tlv_hdr hdr; - struct qlink_chandef chan; + struct qlink_chandef chdef; } __packed; enum qlink_ie_set_type { diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c index 61d999affb09..37b78f00e8e5 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c @@ -100,34 +100,6 @@ static enum nl80211_chan_width qlink_chanwidth_to_nl(u8 qlw) } } -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; - } -} - static u8 qlink_chanwidth_nl_to_qlink(enum nl80211_chan_width nlwidth) { switch (nlwidth) { @@ -152,9 +124,29 @@ static u8 qlink_chanwidth_nl_to_qlink(enum nl80211_chan_width nlwidth) } } +void qlink_chandef_q2cfg(struct wiphy *wiphy, + const struct qlink_chandef *qch, + struct cfg80211_chan_def *chdef) +{ + struct ieee80211_channel *chan; + + chan = ieee80211_get_channel(wiphy, le16_to_cpu(qch->chan.center_freq)); + + chdef->chan = chan; + 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); +} + void qlink_chandef_cfg2q(const struct cfg80211_chan_def *chdef, struct qlink_chandef *qch) { + struct ieee80211_channel *chan = chdef->chan; + + qch->chan.hw_value = cpu_to_le16(chan->hw_value); + qch->chan.center_freq = cpu_to_le16(chan->center_freq); + qch->chan.flags = cpu_to_le32(chan->flags); + qch->center_freq1 = cpu_to_le16(chdef->center_freq1); qch->center_freq2 = cpu_to_le16(chdef->center_freq2); qch->width = qlink_chanwidth_nl_to_qlink(chdef->width);