From patchwork Thu May 31 09:10:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10440559 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 D37AE602BF for ; Thu, 31 May 2018 09:11:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD6B1290A1 for ; Thu, 31 May 2018 09:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1D16291B9; Thu, 31 May 2018 09:11:27 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, 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 43D0D290A1 for ; Thu, 31 May 2018 09:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754208AbeEaJL0 (ORCPT ); Thu, 31 May 2018 05:11:26 -0400 Received: from mail-by2nam01on0082.outbound.protection.outlook.com ([104.47.34.82]:40832 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754091AbeEaJLT (ORCPT ); Thu, 31 May 2018 05:11:19 -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:X-MS-Exchange-SenderADCheck; bh=5I7WGZtqwBTz0fVYyJinFAhdDaNT05tzPBAPhNbI1kw=; b=15eMuxfiW1qlrfCUdOzVuN2w6JURPrlBopqXKbxLpteATpmZUDd7BpuvAXIfoF8F2OJlE3GNncDvs1VPu2NaLbVLz4JdAkaKeAqPMp8CM8h63T2j9KdLskgt4feUh4iBG8mnN2m0TTwElCDDV0UlUpnsE2Wmfpj1ha/j5igbRs4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BY2PR05MB1926.namprd05.prod.outlook.com (2a01:111:e400:58f7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.5; Thu, 31 May 2018 09:11:17 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Andrey Shevchenko , Sergei Maksimenko Subject: [PATCH 2/6] qtnfmac: enable source MAC address randomization support Date: Thu, 31 May 2018 12:10:58 +0300 Message-Id: <20180531091102.28666-3-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180531091102.28666-1-sergey.matyukevich.os@quantenna.com> References: <20180531091102.28666-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR0102CA0019.eurprd01.prod.exchangelabs.com (2603:10a6:209:14::32) To BY2PR05MB1926.namprd05.prod.outlook.com (2a01:111:e400:58f7::12) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BY2PR05MB1926; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB1926; 3:DoVA1Au2pM9PrglMNxMMG6/uH1BOHFgShMSx2HOFfy8NQcWUUq3SZisArU/WjQBpKKSQ/uQCaFFAk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mdVZCyLTSIsZHH/2ucfM64mjQ9Juljznj8wPmfbYzaaOa+8l0nNSmfMdx4Gq7Dw21ESK0NWV9US9KtLXMLEqotI1WIaZwkKRow7uoHqBcEF78pBLlAmrqZM0jE+U+xl55CVEAlr8wKQ4psGk1NCGXwpjpZonBc2HNQ6vi7uRNnXMcJ6f3Q5rY4srVr7qqP35GPd4CtlYCItIA884+lNBhGVVO7HQ4ZA0sWQCWiNaC6q3SzZmh6xH/qrnmso5vc9E1rcu8x95Vfp9vHnN5x2ZN; 4:5TJOaoqQmfkN1AbvIdnfCQkxYe8j+KI02QsLVJRFQcvOy6rNLrDMp6SrBS39lQzxz1yR7NOwsZChY/pqdIDVHfMmpZ+ZI4KVpw5NxcTMbDGvL2HV1qBXoHR3ItvewQupCXEBAtJecMdveMWR3jSgHxKAAL4b2wykv+aqMVhP2JYVsWG8EBGYVBp5CHha7bjqg/ClgbYZ8iYLm7ez4aCY7N9QYXqzQavyaFEpbtHzxZKPHzIk76gtwVznDSx8jeZZmq+AEZd4CUJ54DCmv772dg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:BY2PR05MB1926; BCL:0; PCL:0; RULEID:; SRVR:BY2PR05MB1926; X-Forefront-PRVS: 06891E23FB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39850400004)(396003)(39380400002)(346002)(199004)(189003)(52116002)(2906002)(68736007)(6116002)(6916009)(59450400001)(48376002)(3846002)(11346002)(2351001)(106356001)(7696005)(2616005)(476003)(81156014)(53936002)(76176011)(105586002)(956004)(2361001)(1076002)(26005)(16526019)(186003)(386003)(6666003)(36756003)(5660300001)(81166006)(51416003)(8936002)(478600001)(8676002)(54906003)(16586007)(86362001)(6486002)(50226002)(316002)(53416004)(446003)(25786009)(50466002)(69596002)(7736002)(47776003)(486006)(305945005)(107886003)(4326008)(97736004)(103116003)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR05MB1926; H:bars.quantenna.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR05MB1926; 23:mSE5R+ZMfW3ARFp2s4YaPh8ZpWCC5CQ+2z6zxtj3f?= =?us-ascii?Q?wytXY55VydDXBq+qh7RcXYYMwsYGieCNvobu6zi71Xv7acbototq/gnlb9pH?= =?us-ascii?Q?FaLeUIgsEgVZ6ywadtVsQcvHjlZ3Qw+WhEDaDj+NLsua8nWeftZUq5hpvi1/?= =?us-ascii?Q?4NrRqahdMcBG44yDacGJ3OaAR74Q3S6l4J55HNOX+/QUTclY0AeXUp8I1lIP?= =?us-ascii?Q?ob0DK2u65cV82NjyAFac25PKkM3sGpofj+gXGKEzc6xLY6qM6UjZi1qEeOse?= =?us-ascii?Q?7T9xndWc7ttbvLZBakFO4BvyIc13Jm7Qc1owz6GILyKKa61A3zlJ8LK/RHIt?= =?us-ascii?Q?jhW4QEhvEQUl9oiIMyuhm1PIExTVieek6AAXNagTo+wIU7c66dEVZzL1L37w?= =?us-ascii?Q?OXVvkkOWxjURTr7SjDBG5UAn84PykktF5to7Ydq+oDEs50SFZhJIYeTWzMy0?= =?us-ascii?Q?NdaRmVPWURAd42cJryd/cDyqZtJQQYjg3Tj5SZPQf/IECAhtqYewziSqFhnW?= =?us-ascii?Q?iSiDHRTgP0TjYeT3DqfvPwphqb32gQojnO4xKkq5kUFgh6K61kNlVoZwn+8a?= =?us-ascii?Q?aiWFT0JldwTiEp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sHsBUqT2U+g3tvq75atlpbg/lkAZlv1sR4RNPsvGdFCLT9jQC99KcFpBy0nhYBP0EU4ThMrzkbNTrhb4mDjkDKxb/oO7Uz/pncGjfY X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB1926; 6:vae72eRe5MVkt5uo20d87f2hDeavpIHCwdAzHsdR1qrbsbX47Aj/V5Tor4Jyc0wYLw2eVKSCKOFJcB+tZQbdXosgQdurDZcDyr9jhADzagPI5y3ujlmwvtOMKEjAikQpLbkiwvVmXjN/JGBXHnoSbx8bKv9uPQYGnpFGFqYDByhJa8/E8X0NqpoumhdKqZS7bn2K+3XE3RiKljKr8TMI4lGdr5D+sC+ACM9o97Bch3m/pYNjcJFuNZPogSN+qj/qPc1ho5ImC5+NOtaUMxi7LCTdccDtEZaGidp41Pztzww55xtC+R2nElc06RvaxhhXP+iuQBNCEtb/IJ0dzUA3/lQCQm4ZE8dub3rznO0g+ZejlnIDZcSmOlC2PeUHvZ7bzrgo92q5RLI5cvnuDgocwpHjr3lmsQMa5XA3I8hDBRqPG1N7S3qx6yGWP1YXbzeA62OjbR1tVCscqNexs0Arhw==; 5:33ARWdPaAyufukrcqLDlzjC7gwA1D1uYxvcY+j/xDVgQErBTy/Cm4LujDSDDNsjnqEUQbKUZPEKQwN2K2G+OKfQlnvbqIkuvQpReVAQJiW/uPb+Rr+Brq5U615APDuLq28/0nIzuZ0XnjKu6bhE4FuFng8so8CAWoFSUC3CxZEU=; 24:nPni82JklTTAmUS0rDnlOrpSfhxCOUFrlgFUfV40779hbYj1V53rCTirMchwRnZwZyMxtbsphSJCGHBSAt/pnrLJhEfXWJA4w/X1dKm0B1Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB1926; 7:t0d2xwG+r5ym3ZDSEWKIh0g0VgyttRlo4xNFJcPnjRIsVSqqPowyPAXQE+mr0lxQJd67h/vOnZULvUY5pe2KqsKe/XRmk+zypcSI2yhxCDk/0o8uOnbAelRPdnSkGeGba3nh17xnjicHfi5hMNoMk7YY6anFtU8H0QFYGVHeSDnEN4pZrSPZvZ09yvHxCdeD53P8ztrIVCzNVer5W6suHxZk8QltJwUJtFJJGFCtiN9DUFeiNaQQsuaOqNBBJysa X-MS-Office365-Filtering-Correlation-Id: 3ad76638-3849-4ea1-4bb7-08d5c6d67836 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2018 09:11:17.2888 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ad76638-3849-4ea1-4bb7-08d5c6d67836 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR05MB1926 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: Andrey Shevchenko Enable support for source MAC address randomization of probe request frames. Pass addr/mask randomization parameters to firmware. Signed-off-by: Andrey Shevchenko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 3 +++ drivers/net/wireless/quantenna/qtnfmac/commands.c | 25 +++++++++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/qlink.h | 20 ++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 220e2b710208..23366be9e394 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -1014,6 +1014,9 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac) if (hw_info->hw_capab & QLINK_HW_CAPAB_STA_INACT_TIMEOUT) wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER; + if (hw_info->hw_capab & QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR) + wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; + if (hw_info->hw_capab & QLINK_HW_CAPAB_REG_UPDATE) { wiphy->regulatory_flags |= REGULATORY_STRICT_REG | REGULATORY_CUSTOM_REG; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 5eb143667539..710806466bd9 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2234,6 +2234,22 @@ static void qtnf_cmd_channel_tlv_add(struct sk_buff *cmd_skb, qchan->chan.flags = cpu_to_le32(flags); } +static void qtnf_cmd_randmac_tlv_add(struct sk_buff *cmd_skb, + const u8 *mac_addr, + const u8 *mac_addr_mask) +{ + struct qlink_random_mac_addr *randmac; + struct qlink_tlv_hdr *hdr = + skb_put(cmd_skb, sizeof(*hdr) + sizeof(*randmac)); + + hdr->type = cpu_to_le16(QTN_TLV_ID_RANDOM_MAC_ADDR); + hdr->len = cpu_to_le16(sizeof(*randmac)); + randmac = (struct qlink_random_mac_addr *)hdr->val; + + memcpy(randmac->mac_addr, mac_addr, ETH_ALEN); + memcpy(randmac->mac_addr_mask, mac_addr_mask, ETH_ALEN); +} + int qtnf_cmd_send_scan(struct qtnf_wmac *mac) { struct sk_buff *cmd_skb; @@ -2291,6 +2307,15 @@ int qtnf_cmd_send_scan(struct qtnf_wmac *mac) } } + if (scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + pr_debug("MAC%u: scan with random addr=%pM, mask=%pM\n", + mac->macid, + scan_req->mac_addr, scan_req->mac_addr_mask); + + qtnf_cmd_randmac_tlv_add(cmd_skb, scan_req->mac_addr, + scan_req->mac_addr_mask); + } + ret = qtnf_cmd_send(mac->bus, cmd_skb, &res_code); if (unlikely(ret)) diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index f85deda703fb..4a32967d0479 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -69,11 +69,14 @@ struct qlink_msg_header { * associated STAs due to inactivity. Inactivity timeout period is taken * from QLINK_CMD_START_AP parameters. * @QLINK_HW_CAPAB_DFS_OFFLOAD: device implements DFS offload functionality + * @QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR: device supports MAC Address + * Randomization in probe requests. */ enum qlink_hw_capab { QLINK_HW_CAPAB_REG_UPDATE = BIT(0), QLINK_HW_CAPAB_STA_INACT_TIMEOUT = BIT(1), QLINK_HW_CAPAB_DFS_OFFLOAD = BIT(2), + QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR = BIT(3), }; enum qlink_iface_type { @@ -1089,6 +1092,7 @@ enum qlink_tlv_id { QTN_TLV_ID_HW_ID = 0x0405, QTN_TLV_ID_CALIBRATION_VER = 0x0406, QTN_TLV_ID_UBOOT_VER = 0x0407, + QTN_TLV_ID_RANDOM_MAC_ADDR = 0x0408, }; struct qlink_tlv_hdr { @@ -1360,4 +1364,20 @@ struct qlink_sta_stats { u8 rsvd[1]; }; +/** + * struct qlink_random_mac_addr - data for QTN_TLV_ID_RANDOM_MAC_ADDR TLV + * + * Specifies MAC address mask/value for generation random MAC address + * during scan. + * + * @mac_addr: MAC address used with randomisation + * @mac_addr_mask: MAC address mask used with randomisation, bits that + * are 0 in the mask should be randomised, bits that are 1 should + * be taken from the @mac_addr + */ +struct qlink_random_mac_addr { + u8 mac_addr[ETH_ALEN]; + u8 mac_addr_mask[ETH_ALEN]; +} __packed; + #endif /* _QTN_QLINK_H_ */