From patchwork Tue Dec 19 11:28:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10123091 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 941CA6019C for ; Tue, 19 Dec 2017 11:29:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 934C429280 for ; Tue, 19 Dec 2017 11:29:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 882CA292A2; Tue, 19 Dec 2017 11:29:40 +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 0EEC529280 for ; Tue, 19 Dec 2017 11:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967011AbdLSL3h (ORCPT ); Tue, 19 Dec 2017 06:29:37 -0500 Received: from mail-by2nam03on0045.outbound.protection.outlook.com ([104.47.42.45]:64231 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965110AbdLSL3b (ORCPT ); Tue, 19 Dec 2017 06:29:31 -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=D3GykI1K5cXfEG2eyNSUHmDeqnRPDnRlAsUoZzByZzM=; b=qSfxR4PO6e86wdoLp76uymkKJK7KjGuh99DAh/Gv3Igh0nJ2S0k9r1gNzX92P2jAaJ09kyKI9Iv7y2z1aYjmju9jlNAsXpUvqk7rs6qdWnpM/Y1Se8eIysxifpOYOpn4lHNxbv9cIPV+geF0rfmQ7w3D9LkQhkHE6EP11qUcG5E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1923.namprd05.prod.outlook.com (10.162.224.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.10; Tue, 19 Dec 2017 11:29:25 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Vasily Ulyanov Subject: [PATCH v2 07/10] qtnfmac: fill wiphy's extended capabilities Date: Tue, 19 Dec 2017 14:28:53 +0300 Message-Id: <20171219112856.22463-8-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171219112856.22463-1-sergey.matyukevich.os@quantenna.com> References: <20171219112856.22463-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR0502CA0022.eurprd05.prod.outlook.com (52.133.16.163) To BLUPR05MB1923.namprd05.prod.outlook.com (10.162.224.13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 226e5a4d-8e6b-4287-c97d-08d546d3c2a2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307); SRVR:BLUPR05MB1923; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 3:vjnqJKDik+yyjkEg7tgBRpqKchb0BRuQm42NTnQYJVovJqSnndyXnE1GjkdDTSL9Y3pHD4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2EEMfrFn+UoUQsa10KVBKUExl7ZEhLZTjBoZNkuCn2xZ4v9Cm15w3wpYZmyijGUTASQiG6iD4LGuzzOIYS4w9/YY5ZmPEE6nSnwADWOiio5h7+huVKlVKKzqi65X63qw9z+nJNV8UrcMaYwYq6c49VCot0FcF5WtFJJkpA/hlkltS40USeso+Bl/KOw7ZtXHcHagvJrZLI4Wb5AXzoe/zb8WKY61Os+z5aqRyC2TTV802aAbhA/yGILQAb8pA4tUqDh58Aiee+Fc2oHgAwqAKQz6uV; 4:FOWXx0kOirsoPK6fplAUokPrlgQdw80Mt8rxqSg0kJYNNwkzWTazhBzFx4LKRQjjPE3+QuNehHtHNorkZsTwY8mGGBOU5sQKI7399ix6h9j8VgCl6j2Rwl07gsAtaH5fzVzlGqv3OTMT7X8YS8IWSu8rE5aHGCRl25pxKW2UPZCcUDb5l2zyiTYk3S1JDWvIMi9NMOhjQva8gbYqKH0Rs18R/qZuBl+CF7mAzUVJFrTxrC9pNCRIlIIAcyNg7XVZt9H6xe021YYqGYCeY3rAYQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(3231023)(10201501046)(93006095)(93001095)(6041248)(20161123560025)(20161123564025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011); SRVR:BLUPR05MB1923; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR05MB1923; X-Forefront-PRVS: 052670E5A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39840400004)(346002)(396003)(189003)(199004)(48376002)(68736007)(50466002)(59450400001)(5660300001)(2950100002)(6666003)(6916009)(316002)(52116002)(76176011)(386003)(7696005)(97736004)(51416003)(16526018)(16586007)(107886003)(25786009)(54906003)(4326008)(69596002)(86362001)(53936002)(2906002)(81156014)(103116003)(6486002)(2361001)(2351001)(478600001)(8676002)(50226002)(1076002)(8936002)(7736002)(81166006)(66066001)(47776003)(106356001)(105586002)(3846002)(36756003)(6116002)(305945005)(53416004); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1923; H:bars.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; BLUPR05MB1923; 23:CAxFedwqPaLi/x4ENGLokzH81fZ1vLJNmFm7pBIVN?= =?us-ascii?Q?79bK9yuMULMAH+X1Q9dSWXthJQDz8nHzVtWOXjUcXgek97tKzq8SWxw+uTJh?= =?us-ascii?Q?qmXkGJ/Mdks0KDqgljCifX4msut3gKlV+orJVDHj6QvMQ0TTq99m+mmWdJUH?= =?us-ascii?Q?EnxqggERYCCcQTx/UUhf9yClu8SQLQMundBWOkra/tGUDu/CWT/DcUz+niBQ?= =?us-ascii?Q?rcGOkrZTMQo/Ir4RM/MyjCaLwrkfU9N/DEGolo8RlKJh9TrRz7Q4fjl5Rnxl?= =?us-ascii?Q?9gTzYLvVJ/f77TyHtFQOz5eobFfj5YOzCtzFkz7dSCFc9uctVaCX/ChgjQFO?= =?us-ascii?Q?HMqovWtvIojK9aW6JcyvZjGTWGQEgTGSNMXvIZ5jqyIsRUIhvjDv2KkFO1nT?= =?us-ascii?Q?VC/eYIsWn7Q9O/CMNjqhHVjC67FF9NlQhXBoI/wMwvSmn/x4lFPxmHdN54dJ?= =?us-ascii?Q?fzC4+uKaOaLrcxw5OLzdD9DmEPKqorbEUuKBbGgt2Eyo5adUZYxSnvNRrMXf?= =?us-ascii?Q?wTvHJedBLY0/v1n3I2MN5bdPaszeo4/mda6hL6VMWXvIUKduS2aAFWjp2H1D?= =?us-ascii?Q?ACWvSB96IHj0Ai3KyZ2tGoXyCkqNc+uD6Hk6QRTpVumiJM/Jh40GVCe1E5Uy?=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fuT4zYYhbAcgvN46M+Qb4UkRurhh8yDD1YA=; 5:b4B/gAoTQhjsaoOngaM3Iyqu43acPfXpOm7qss9zRlg+OrmhEJhTE07kB7borzHqBSgvv0K3A9H4Tc03ijNpIhSscUYWplF4qJrZ7mQcWYjmuS51M4hld/g3rEhiW849JA0Bm2YbHpjBqH8oLuVgWWSojF4iX2Wv1dVKp/md2eU=; 24:4CCKd0Vjl5bu3ZSBFiox6uUKLtD0HKj/Pcz084i7o9QAFJA3fkaFc9Xhs9NbonI0z1hW4yQxMDb3E1LiQbGfQhMqyhNPfag79NufooRlquU=; 7:DywuXsRdh9ZCrsvdPwfHqZpAeyW8EAckR4nQvyJouBiAO2z/WXhPZ41mEWGYoMJK2Zb62sGvX3WIqKRWgXi2R8CdHhOzpn9mXLfTvQQysnzhMc1UO4jWhdxIFkQV2f9RVG4RA1siQsF0r4YBwGwY1cCAC0SBdMa+oeAB6tfHphB/S1CwXTXEi+10NYhZ3ZsqkE9Rmq7c6wC72aecPbT2AWRTQmgi16kjYJOLjfM2/N3Pxh1lViAKb4UlxiLxF1W9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2017 11:29:25.2003 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 226e5a4d-8e6b-4287-c97d-08d546d3c2a2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1923 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 518a2fe927f7..ccd982b1c957 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 {