From patchwork Mon Nov 13 10:28:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10055521 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 E9C8B6029B for ; Mon, 13 Nov 2017 10:28:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6D0C29362 for ; Mon, 13 Nov 2017 10:28:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB7642935C; Mon, 13 Nov 2017 10:28:42 +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 329A22935C for ; Mon, 13 Nov 2017 10:28:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752280AbdKMK2l (ORCPT ); Mon, 13 Nov 2017 05:28:41 -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 S1752177AbdKMK2i (ORCPT ); Mon, 13 Nov 2017 05:28:38 -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=XeE6/dL8PWutJlZ/fCkUSsDSJzQQfXPf9iry6owZhuE=; b=rK0AzoJ8x+LmRuLH42bPi7+/yUgk43hJm/3Emc+iSp7aKhuzxkyTPuSLHDZdRmGnGv0PkN7iqvfAZo84Pn6LlKvyhcw8+cXesTb9VLp9Sl8KeS+ZSTYg+wXrt4uMvgKZ19a8n4+zrIoT4Z2ZIDEPaVQZtSJsWHMW/o1PKUejxS0= 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:35 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Vasily Ulyanov Subject: [PATCH 07/10] qtnfmac: fill wiphy's extended capabilities Date: Mon, 13 Nov 2017 13:28:12 +0300 Message-Id: <20171113102815.11254-8-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: 9a9bb3a9-255e-4958-157d-08d52a814c6c 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:q4bxdrPZzw0K5ZCRi/SRbJ38m0b/6VCYhY+wqjdLqGxE+m5pcY5cz94PKYKlpRWWRVd2BDVFFBpX4tRrCI18y1vh/z7JjYLOloYBpF1bGWJrloICVPoCannghgPwPs+VnxN/yAb1SFbhJxCGmDvnRxMy1uOcw9koeAx5U+sPsoho8wM1OUrm5Wm2NC6lFtQKnKBVBIz5H0+BWkMI68bu1vaAjg7JukFc6gfanep96N8cYLBAydiQU69DJlUHjVVZ; 25:lMo3sUblefzuQaoLMLFGVVmfmdcPNE+GYVvtM9bkPFRroRO6q3UDzU2tbGraRVSqBDvGF5mc6Ksb0WDfpW1i81XLboQJnT29MSBhX2IZPZ8rj002q++oa6uzd8d0XHl1tNI6T4FKdNSttVtPbLVf7WZstImZV9BFOPHM0i6kslffpOK9ZnrT7Iw6Zc9S1WjCfN14MqkED0+JeoLyGM6ySiqFqO+DmSMlAcTDl4QP6OK2HJc02g8/oERAMBLRFpTix9npUHQsvS7vWQ0RC+bITxktb1GUMsmQKUvKyLbhcTHWW5OtxTda3JPJ6tBVq3RfPd039/ciM/2akdVrGEyjebwlkX5uZsu3q85555m2wLE=; 31:NkULXtw/jrbWzrOCo/6DASkE/2NE3F4x6ZdD6Dxk+nSXt1N0n4aFubiTsE/5Bh17+7G4a009qoTFttj/hqAPMc03w/0Zo2U44TEFG6P0nssHTlLwq+7mfuvC5OO3SxDupQtUXHF1ApoxXXmkMZ9MHZ6vTo4Ug3mEyNZbRcy+J717HXhrFX3R98giYsa03AGfdgD+fzNcBcrLyeXqPAO4xAQ6E0cxwijuGFU5398z4bw= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLUPR05MB1924: X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 20:j8ao5K8VBrXU7QvL67+/uytzHvPlMHUFU+kEks9zD1lz0THdiJoG7EVuUicO7v4BTIBEIaDG2QGbnE/fUyPR0cWGln9hdG8lQyOgNvVTayN5Jwz0mwpEcHa4wGTWLQCJIqWAONyxMmWj6Kfg01ojIYXYa5zGBSwnE3hcvUwwZN07nbQ/ryzeL2wTE2991HhpO0HH1YT3ufzfJrCWeSZ8+/ypgFRqxcZnrHsK0c4NXShN8EXF5BHwWKIUAvBvC8RIFd9XleJKB5HsYPNhOblGHhD4WWTaIu9xS7/NiBddsiVJwsn2NM3QAtgmzs91MRThxo3NMV9ygVoRwISEwm3QEtLn3Pb4fDIztQK8j26v0PnzP/xkjlJgll8LCap3efxE9cJ0Cm1WwRDZ0GFL9kb8X1Iz8xhmXzwlZRs7QJ2qSp146pGZyAMurHnrIeVzHeKQg3XF+3xHEn82ab4t3yohoWeaopYD3IZvkLB3hQa7O87Pud0PwQFKNRY7PGpAmP/5; 4:iYnO3VTljb+Cj0tuespjynSW0PGyWQyBasztvi60pb/yNuBdRLch0WhKymztxkpFahuKHDjIdBca9g++w/bmDn/rMEt1SKzk2WrB/nuBVWRq7PPyqDg6A9HXpzNubmyVFvGwr51cyjcFjE7rshVVu5gvX3qz4aCQ3Ty5k/YkUsjPgYDNCalJvIc9UsZBOBzTpYIdf+9B44VHB+i02vFeftSHzPlQ7Uxw9HXdvjTU66yGZ0SKmru6naJoGmw9ac4xNI9lA8YT6V6kAwBDZ92xnQ== 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:09aLs1K7qORiFtVBEGTD6UQa41SrbvD/HLbkb7nEV?= =?us-ascii?Q?cAvfPiVUJwITfBCw2YBwzWq3dDWS7KIl3Y7n6GpAtDubRlo7PlbjjMVewZPg?= =?us-ascii?Q?SYlu4MNV1lK+tCP/vWJ1HoiiyWnqiyfP6Q7gjGs/TGCary65HAogYivEKOzO?= =?us-ascii?Q?kXY9Y57j9WoMCgAEUOFcOL1eUTovziKItKndb7JtwLHbF1eMPPnnqtu/lLXk?= =?us-ascii?Q?eNgOKynHGtm76dI6AHCRrIbBFGAeaK4FUw5yHH/4cMSUWPf2EuLITrkC7Iul?= =?us-ascii?Q?5uiVJ/B7Y/RsPa39D+tJk6n/498keazJ5Owf7Y6Vs2DQ3YKDy06N8v2m2oGO?= =?us-ascii?Q?BY5t3pFlLWNQukv/tqziK7YvDxxFLNRkBd6m11tGIRuW1v39xE9H4+XzWlkp?= =?us-ascii?Q?3aBhfwriI6Ir260LbWqUQEWdt5C98i+o9CvUpTErK67WpWt9Tns2FzZjUoVc?= =?us-ascii?Q?rDaFWrZpvvDqhu//aU1JjKQxoPFEhiXPOKNI75XOoBJ//K2VUu5MCBxW5zSV?= =?us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WFzw9ofdcT+li72cIykJtnZwxLH0V1DtAFdCcWO97/XycZBwQaR0OeIQoiTLYTs7VdtEf9WPyo0xsQRwhOHu3LognJqlSyDdmkG98QGnDXgR39KcKdG3yWmof75DoFoX16/QRVTz5IvTZZPX5ToioglIcCho07myyGtb5rIsWYzZ0u2FXZUj5zWViDWXsjwaZ8OQVPIA66m0fICfvHTYsxcMaA5pDOQXxlwA/F9z/3ndyD09WsrVLuPB3rkHRtQ=; 5:XfzCBwkwlAQQxQFH9LyT/vakbCLA7b4Qc8jHxbEqK9k5+q9NWzPUNndWO1CVgVs6/I1lABnjW0ETOZrVgDi2GpryjNRxUYXR/DiEcOJlPuzdKgYMKK4SLjySWMP2pL6On+pgcd5jVPeCtuVVOfWiSIJSNnPy0BlRqn8wLmQXFP4=; 24:MY/2YRk5ljicjuOZXi58oPfpVjhlLBR+iEqHuBhArZlmo3thzbiS9mYZSR8NdmsYdlSlCHHjzoFBOa5Fyww/MAFEsVD6N/Q3xkjpoSdOxOQ=; 7:By2Kkudr2gBkUlqnamCClHPk64AlavGlqdnWYjd7roMYvENHJMua3sV61gAIkNL9NfdUYxmP5JD0jtSDl6QLsZZX1/yCCbz+TAi9xE3dDr/WVlSV8tLo/rhR04kboBnFu7Ryji7ECJLm9ApmaUAKW3/FfoHbBct6y/ADnYE6NEOLzBmI5kd8zuMYlWK6IQylfy80QjAxvphJrBZgAZyL0lHyr/Ff34TXFZcLj7AOvk/A7KtcVXkQ+7CcJvg8lT70 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2017 10:28:35.5654 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a9bb3a9-255e-4958-157d-08d52a814c6c 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 From: Vasily Ulyanov These are needed to inform userspace about features the hardware supports (e.g. BSS Transition Management 802.11v) Signed-off-by: Vasily Ulyanov --- drivers/net/wireless/quantenna/qtnfmac/commands.c | 44 +++++++++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/core.c | 2 ++ drivers/net/wireless/quantenna/qtnfmac/core.h | 3 ++ drivers/net/wireless/quantenna/qtnfmac/qlink.h | 1 + 4 files changed, 50 insertions(+) diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 7089f3eb7a87..839e86b99837 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -1029,6 +1029,10 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, struct qlink_iface_comb_num *comb; size_t tlv_full_len; const struct qlink_tlv_hdr *tlv; + u8 *ext_capa = NULL; + u8 *ext_capa_mask = NULL; + u8 ext_capa_len = 0; + u8 ext_capa_mask_len = 0; mac->macinfo.n_limits = 0; @@ -1092,6 +1096,18 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, if (limits[rec].types) rec++; break; + case WLAN_EID_EXT_CAPABILITY: + if (unlikely(tlv_value_len > U8_MAX)) + return -EINVAL; + ext_capa = (u8 *)tlv->val; + ext_capa_len = tlv_value_len; + break; + case QTN_TLV_ID_EXT_CAPABILITY_MASK: + if (unlikely(tlv_value_len > U8_MAX)) + return -EINVAL; + ext_capa_mask = (u8 *)tlv->val; + ext_capa_mask_len = tlv_value_len; + break; default: break; } @@ -1112,6 +1128,34 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac, return -EINVAL; } + if (ext_capa_len != ext_capa_mask_len) { + pr_err("MAC%u: ext_capa/_mask lengths mismatch: %u != %u\n", + mac->macid, ext_capa_len, ext_capa_mask_len); + return -EINVAL; + } + + if (ext_capa_len > 0) { + ext_capa = kmemdup(ext_capa, ext_capa_len, GFP_KERNEL); + if (!ext_capa) + return -ENOMEM; + + ext_capa_mask = + kmemdup(ext_capa_mask, ext_capa_mask_len, GFP_KERNEL); + if (!ext_capa_mask) { + kfree(ext_capa); + return -ENOMEM; + } + } else { + ext_capa = NULL; + ext_capa_mask = NULL; + } + + kfree(mac->macinfo.extended_capabilities); + kfree(mac->macinfo.extended_capabilities_mask); + mac->macinfo.extended_capabilities = ext_capa; + mac->macinfo.extended_capabilities_mask = ext_capa_mask; + mac->macinfo.extended_capabilities_len = ext_capa_len; + return 0; } diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index ea850cb7dffc..3de0b26f839d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -381,6 +381,8 @@ static void qtnf_core_mac_detach(struct qtnf_bus *bus, unsigned int macid) } kfree(mac->macinfo.limits); + kfree(mac->macinfo.extended_capabilities); + kfree(mac->macinfo.extended_capabilities_mask); kfree(wiphy->iface_combinations); wiphy_free(wiphy); bus->mac[macid] = NULL; diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index 8e42d1bdc65f..d7e295efb07d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -106,6 +106,9 @@ struct qtnf_mac_info { struct ieee80211_vht_cap vht_cap_mod_mask; struct ieee80211_iface_limit *limits; size_t n_limits; + u8 *extended_capabilities; + u8 *extended_capabilities_mask; + u8 extended_capabilities_len; }; struct qtnf_chan_stats { diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 1f150be98820..f4d7d1603e3c 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -1020,6 +1020,7 @@ enum qlink_tlv_id { QTN_TLV_ID_KEY = 0x0302, QTN_TLV_ID_SEQ = 0x0303, QTN_TLV_ID_IE_SET = 0x0305, + QTN_TLV_ID_EXT_CAPABILITY_MASK = 0x0306, }; struct qlink_tlv_hdr {