From patchwork Thu Oct 5 01:38:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mitsyanko X-Patchwork-Id: 9986281 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 2302E60291 for ; Thu, 5 Oct 2017 01:38:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1414828C06 for ; Thu, 5 Oct 2017 01:38:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08D2F28C33; Thu, 5 Oct 2017 01:38:30 +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 32E7128C3F for ; Thu, 5 Oct 2017 01:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751299AbdJEBiY (ORCPT ); Wed, 4 Oct 2017 21:38:24 -0400 Received: from mail-sn1nam01on0084.outbound.protection.outlook.com ([104.47.32.84]:52980 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751259AbdJEBiV (ORCPT ); Wed, 4 Oct 2017 21:38:21 -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=RHOzWUys9eOjabdnk/PkozHgU8lrEawkJofLn0w18eY=; b=3GQsl77bz4cEqx/JZkCA82/Re/ba3pJsGvDmNWTLqmM09HbfdldX4miulCLVIfaN5q+EfhPOAR3W38VmZLI2LLecTJ/0r9ieI6MURV4wt0AwfB5MUKAPJjb0KDK/faX7L1EWFnQK019s1ZdKymABWfIc6HL+u18+raW/PGYZr18= 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.20.77.5; Thu, 5 Oct 2017 01:38:19 +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 Subject: [PATCH V2 3/8] qtnfmac: pass channel definition to WiFi card on START_AP command Date: Wed, 4 Oct 2017 18:38:08 -0700 Message-Id: <20171005013813.13332-4-igor.mitsyanko.os@quantenna.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171005013813.13332-1-igor.mitsyanko.os@quantenna.com> References: <20171005013813.13332-1-igor.mitsyanko.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [12.131.200.68] X-ClientProxiedBy: MWHPR20CA0031.namprd20.prod.outlook.com (10.172.102.145) To SN1PR0501MB2047.namprd05.prod.outlook.com (10.163.227.20) X-MS-Office365-Filtering-Correlation-Id: 085f5ac7-31bd-4a09-d841-08d50b91c1f4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:SN1PR0501MB2047; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0501MB2047; 3:4RNH9xDK0jX0PxtsSfi8pSq0kj4WtRlgE2Q8K0DYoe/xbHfYrCMkUG3nSwGULOMVwSP7PSl6C3OmNxG4s5ca0Gul4B8RS31rrsb3ptSabpDoDimTwIUZHORQnydlngGf3QPgusvLZ2hGjk+jZI+wgPA0B+OEcx/LZLMmoYTDXy9qla91r6wjmfH4P1g5QETVKPaXwyGvOR+0aH1IkC31REqN//Z4gbYV4wZJCx3d2vvAGGmhz0TMOPElzSJhu0O2; 25:xqmFTyCuZqmuQs1U2OT9OwbsK+ZhIH9MnxR2621exwZSovJEZNdWGFX4Jvp98p6rf4QrEe6vBlstrXkbMtkK7FJlV/H/GVweFMGs410s8xQxm9ggXVSfqWmAncO8KojnEyB9J54RNIg84Ps9b6IdUiyu+AdL5O2KDF4kSVyvDewJfOkAgzZJ+IYPrW/m3DGItBWpm9eAxzlGHj8vNqQizaedpbpx33jaHvcqlYzfJ82L8lG2zWoztHpFvvEs5IdgpxK/33uHdYmA7NDRZOn/md+xFBy3XDC9p+QrJZlnaisXxRJIrb2agmtRVRBsqDJvC1PQBlpMKIjm1Ha5UQ/3fQ==; 31:EsAgRKtYO0hgVx/3Sqo8WQvLMARKy+FsdCUOxW263UXEdDLwrFG5spKeO+J4wxu1uGokzpjiIUcwwWdVIJwx966aUSVOrpBd773dmLOG2qRBgjE6kWfnJQ6Q1L8dP7pRTvaKGAbbusJgCqoze0+KiYVZUwyQ0SaGLaVOt+uyC7dwNf+Ph8lTr9hJ86tqmSZrdt2mtNm6tix/ScysFKrPhq8NW8lkUWuy5fzYBd1NHmY= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PR0501MB2047: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=igor.mitsyanko.os@quantenna.com; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0501MB2047; 20:rMPNxq3PIyQKl85GVf75bhqNMq23x9kpm2aAlOu6V8XCFD9mQAY3Xuaj9jlOOFzAv5a7kcZ05F84qZtrtuNunezjYY960VKTgcbp//idBSlBO3iARd7dLCnS+kEPq3yStqCp+N57icghtUr3ogeY5Hp/EfDQJwzR1l2x9CtNyscvbOExCfEt3PPXHyWQx9owZrAIRORivRgx/7dnHMOH7Re3Ce7o4jD/zkZtOhzvm1b9seLUR9Pfe9x4ONNu8IPmXbTTgVwxjAU8yDbU6/zCwaLfaj0xkJpSvH5xBsZpYVyOMH2rnnW7UgwuPImRKgGqR3BAh45PxflYE3pviz8d9UQpZ8Ksx/tImlMoRwNml52DhWzCay5xHVN7bmTHeZFkjDAmx9LNjFp4zr4FVE+4lvwzodw96g5zJXJzIUdRSb8d/wVhbm14huyhJVw/IvnFJEWiG+JQ8IDSCKoe8Tb7RNakSatgrXKSfVxHn1hzXl8sPoYevBXByCL5PGzG5aAi94YICMAV/1PnUgbNBto5xpy45CkaB04v1HNFVlPCwQ6gpa4+V4Zp9mnRwb21zUFuA8IwYMu5oIGDmcwrzvu6h1YXwGFzPfVTWymBABS6RVw=; 4:eCyrcMbBIo8Yx1CPWGVA57aI37YlBVarBceOngEQ29l5QIJgH04zlX6ZNvPLLHxqM/AM4O0QlIbHt5GbbetvOVmybBSWBNkue/7WTJ44r1Y7I/EEL9MSBZsLTX8JliUlzUR6PD+XMkEvt2qTYbtDeqQ/gCOQAMnffHV6uc7KEcndsBomXkvnNSVpJccB0bAE2gXIJc3owo+xKbpnm0zBRq/bZPtc31klMjpOnBC2Oj9wYqmpPy1Z2sHn+sJ51Yut 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)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(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: 04519BA941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6029001)(376002)(346002)(39830400002)(189002)(199003)(25786009)(106356001)(103116003)(105586002)(2351001)(33646002)(69596002)(53416004)(2361001)(3846002)(16526018)(85782001)(53936002)(66066001)(16586007)(2906002)(316002)(1076002)(47776003)(6116002)(478600001)(7736002)(8676002)(68736007)(86362001)(6666003)(97736004)(101416001)(6486002)(81166006)(76176999)(48376002)(189998001)(2950100002)(50986999)(8936002)(5660300001)(4326008)(36756003)(6916009)(50226002)(50466002)(5003940100001)(305945005)(81156014)(9686003)(85772001)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0501MB2047; H:dodo-dell.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; SN1PR0501MB2047; 23:yySPPEZXRuX0jzt3st80TAjppM20aEmS0lni4as?= =?us-ascii?Q?gLSYlKUfT0uEumzdBoFzsmXxEFIlgbA1oFnPM5V8+Mc64SUk4rA4JiDexg+f?= =?us-ascii?Q?U0PksXKkYKtTShqdEf7C3611ztqoyxHOXvK75BLUCawLqRCiE1j/EMgYPXC5?= =?us-ascii?Q?M4P0QGcXaunkIEp2tTD0nTaFy2CoYcUNdWJP3GKY+4ku9mDzqYWQTp1rfRHA?= =?us-ascii?Q?Vz9T0dtznSSYDc415PbXkXzWWOthzQIwWq2moXHACyElJ/z2FrvlNO09ugVC?= =?us-ascii?Q?LvdwFGHSROTRHLYbcdIhIro8kZfeLw9zwX9mMngqhUc8boKNxwXmQ2CgAW0h?= =?us-ascii?Q?lqA7BPiO9y/JWzoJMFf2t2FZkWcmJAEvK4x3gEiqkVXGLhD8mjhMDybTXC9u?= =?us-ascii?Q?sqJ+mSWcJl0G7I+LRtiIYcArpsbGMuy/LZRzd6gk43qenwqfjw6fFsxYojmX?= =?us-ascii?Q?+zNLc9+X3VztNyCDRICiNPl9Gtk2GRK80BohvqsbzJBSv4CA9kputuVAiKP7?= =?us-ascii?Q?Sfdi925PIHpF1EkDnu1aeUStd7VNJU8ZhUJLe5hXbksV51FYx2WH1U+PPc6f?= =?us-ascii?Q?gXgRpVgMoDSC66/P08BIIRznUL3iXqVaThILXQTg8axjdgP7AWqacvzON/dP?= =?us-ascii?Q?lrGsguFo0MVxGJ+TqOi8CzSqLNCS+Sxl1+kfmsYP0hRAA4iNR+V8LRWl3MU7?= =?us-ascii?Q?7ctIcRn+Ij4ZFB/YeWa/wGWaHhiJ3l58q0nJiFWug/0CeUMLJtYEMS4NcMpY?= =?us-ascii?Q?h/Z+6QF9xUDo7b4CRDPanW3GgWvzvrh9NrmMEZcR+m2C9UKWJHfFK+UZ2MDV?= =?us-ascii?Q?s3c5rTMGvfuYBDnL7NM8ajbi4941lDRlDH5Nfeq0TxKoYeoeRzPiW+UAE1Mo?= =?us-ascii?Q?b/RTQOwakOlu/a3gg6hs+6FQo+OSg98BV6wQ6Qm8QRKw1zhLMCwT1Gl4pbxu?= =?us-ascii?Q?oxEkyHfyR2CafqzMzISPNknjuczkWfeM7CpjLOgZEMB30vAy1LqxHKJurTyg?= =?us-ascii?Q?42PFfrtkigBs3Dm6zRVpDN0c4lV/05NRkSRcGm3FRh5xN4TKTKDI1BJCNecm?= =?us-ascii?Q?CsIeWRFh/xcDn+eYyDmP7fL1zOgSnYJsZLDrD2UDshjgfnE/DU5ltF63PeKK?= =?us-ascii?Q?K3y2ycKbVYYFsoPln2syrn4MWUx4O+bwz4s+65Bc0+SJlclU9npWugB/7w2m?= =?us-ascii?Q?MXzEPOc4lw3muJ9N32LkxMYKSt7YqUa0JhlcOV6I2PWUN2yoxjEk+jiT8jrr?= =?us-ascii?Q?lW6W+VrzehWPy2BsptTKiSOh9q+U0QpsIrXPWW9z7?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0501MB2047; 6:yX9prSjxCT++/Ys95qzb1sp/WyEJMxdSxSHPr4LKMfZvHn1TNX3Vnoez5ymVx34874jZfu/3hkjIweoUe3zGXHV39RKP18j85SMqiJH+9kxZkzt88LcIfyOLxFGlL9d6qvphfvPpfMahwV1UyC9w4/qVxmgCwdS1IfPj42CApSEeECG30/nV36DN2PmPrGS7OqqSx6pLXveANzm8T6sv9Xbhioeho3JvdbYsm7GnGesl9CkXZhmMY+xlVinP76Zyoh4NPIbfxLL8uCYBmQOKksUJR51zhOL2mtUGynanNaq2Bl9RPacY8qnyZAeYzxjgWA4cebGY9RvQ6dcfZMHYzQ==; 5:OoHwIdS8jVo+07lZ/rEfPI4bKY6Rhy99t//HVP2UAdpVAdv9jGWUfN5EkDFfMHLYudRBklzc4Kb/cbjNnf5X6drOFMQ62KKm0OGHZlCdCqP4+759GPbJicVJ+FOuXu2RsxSztqz3ejBQxCVmAtoGxg==; 24:5FM1o7i4c8ZlEH05m1V7yf04b6Kt9SzFptAcD2AHw1Y4/TL0kFH40Y5rU0E7L2+lJZ93Q7htGaZcQMW0sUVaQ2ttVzWSkbGP2V0XjD3c1wk=; 7:rCz90L4GJ5EWV5x9iQeCo8GkCtbAa8vxrHzhu6INICOIsWHb4+zaiMCu0Bl5ES8UTx+pfbgqUo55+ROsDWvcEvFxhM2DBvyx5RyUM/YQN8QL0gJgvUuTXYv1LgXMoNGn7PIMaspq7GublBXcQIEdQ+VPI6LwDySYRBE+TiVcgWxoJdNiKXFWJ1fHW87i1tqKyEDIxTQBohcXbGPM1Na0PzLOPcNTo2KTDQqyQu+xAiw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2017 01:38:19.0630 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff 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 Introduce "channel definition" TLV containing full channel description (center frequence for both segments + BW) and pass it to wireless card in a payload to START_AP command. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 9 ------ drivers/net/wireless/quantenna/qtnfmac/commands.c | 28 ++++++++++--------- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 13 +++++++++ .../net/wireless/quantenna/qtnfmac/qlink_util.c | 32 ++++++++++++++++++++++ .../net/wireless/quantenna/qtnfmac/qlink_util.h | 2 ++ 5 files changed, 62 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index fe157f5..056018e 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -266,17 +266,8 @@ static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *settings) { struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); - struct qtnf_wmac *mac = wiphy_priv(wiphy); int ret; - if (!cfg80211_chandef_identical(&mac->chandef, &settings->chandef)) { - memcpy(&mac->chandef, &settings->chandef, sizeof(mac->chandef)); - if (vif->vifid != 0) - pr_warn("%s: unexpected chan %u (%u MHz)\n", dev->name, - settings->chandef.chan->hw_value, - settings->chandef.chan->center_freq); - } - ret = qtnf_cmd_send_config_ap(vif, settings); if (ret) { pr_err("VIF%u.%u: failed to push config to FW\n", diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 493c3f8..f5bc43b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -185,8 +185,6 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, const struct cfg80211_ap_settings *s) { struct sk_buff *cmd_skb; - struct cfg80211_chan_def *chandef = &vif->mac->chandef; - struct qlink_tlv_channel *qchan; struct qlink_cmd_config_ap *cmd; struct qlink_auth_encr *aen; u16 res_code = QLINK_CMD_RESULT_OK; @@ -211,17 +209,6 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, cmd->ht_required = s->ht_required; cmd->vht_required = s->vht_required; - if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) - qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, - s->ssid_len); - - 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(struct qlink_tlv_hdr)); - qchan->hw_value = cpu_to_le16( - ieee80211_frequency_to_channel(chandef->chan->center_freq)); - aen = &cmd->aen; aen->auth_type = s->auth_type; aen->privacy = !!s->privacy; @@ -240,6 +227,21 @@ int qtnf_cmd_send_config_ap(struct qtnf_vif *vif, aen->control_port_ethertype = cpu_to_le16(be16_to_cpu(s->crypto.control_port_ethertype)); + if (s->ssid && s->ssid_len > 0 && s->ssid_len <= IEEE80211_MAX_SSID_LEN) + qtnf_cmd_skb_put_tlv_arr(cmd_skb, WLAN_EID_SSID, s->ssid, + s->ssid_len); + + if (cfg80211_chandef_valid(&s->chandef)) { + struct qlink_tlv_chandef *chtlv = + (struct qlink_tlv_chandef *)skb_put(cmd_skb, + sizeof(*chtlv)); + + 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); + } + qtnf_bus_lock(vif->mac->bus); ret = qtnf_cmd_send(vif->mac->bus, cmd_skb, &res_code); diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 6814254..641d252 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -941,6 +941,7 @@ enum qlink_tlv_id { QTN_TLV_ID_LRETRY_LIMIT = 0x0204, QTN_TLV_ID_REG_RULE = 0x0207, QTN_TLV_ID_CHANNEL = 0x020F, + QTN_TLV_ID_CHANDEF = 0x0210, QTN_TLV_ID_COVERAGE_CLASS = 0x0213, QTN_TLV_ID_IFACE_LIMIT = 0x0214, QTN_TLV_ID_NUM_IFACE_COMB = 0x0215, @@ -1128,6 +1129,18 @@ struct qlink_tlv_channel { u8 rsvd[2]; } __packed; +/** + * struct qlink_tlv_chandef - data for QTN_TLV_ID_CHANDEF TLV + * + * Channel definition. + * + * @chan: channel definition data. + */ +struct qlink_tlv_chandef { + struct qlink_tlv_hdr hdr; + struct qlink_chandef chan; +} __packed; + struct qlink_chan_stats { __le32 chan_num; __le32 cca_tx; diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c index 63a74b2..61d999a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.c @@ -128,6 +128,38 @@ void qlink_chandef_q2cfg(struct wiphy *wiphy, } } +static u8 qlink_chanwidth_nl_to_qlink(enum nl80211_chan_width nlwidth) +{ + switch (nlwidth) { + case NL80211_CHAN_WIDTH_20_NOHT: + return QLINK_CHAN_WIDTH_20_NOHT; + case NL80211_CHAN_WIDTH_20: + return QLINK_CHAN_WIDTH_20; + case NL80211_CHAN_WIDTH_40: + return QLINK_CHAN_WIDTH_40; + case NL80211_CHAN_WIDTH_80: + return QLINK_CHAN_WIDTH_80; + case NL80211_CHAN_WIDTH_80P80: + return QLINK_CHAN_WIDTH_80P80; + case NL80211_CHAN_WIDTH_160: + return QLINK_CHAN_WIDTH_160; + case NL80211_CHAN_WIDTH_5: + return QLINK_CHAN_WIDTH_5; + case NL80211_CHAN_WIDTH_10: + return QLINK_CHAN_WIDTH_10; + default: + return -1; + } +} + +void qlink_chandef_cfg2q(const struct cfg80211_chan_def *chdef, + struct qlink_chandef *qch) +{ + 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); +} + enum qlink_hidden_ssid qlink_hidden_ssid_nl2q(enum nl80211_hidden_ssid nl_val) { switch (nl_val) { diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h index 416f11d..260383d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h @@ -66,6 +66,8 @@ 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); +void qlink_chandef_cfg2q(const struct cfg80211_chan_def *chdef, + struct qlink_chandef *qch); enum qlink_hidden_ssid qlink_hidden_ssid_nl2q(enum nl80211_hidden_ssid nl_val); #endif /* _QTN_FMAC_QLINK_UTIL_H_ */