From patchwork Wed May 6 09:55:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 215706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37C45C28CBC for ; Wed, 6 May 2020 09:55:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EE442075A for ; Wed, 6 May 2020 09:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588758956; bh=YD4DMNr1yHZPIipOrEnMm7bnXE3vfPRPPws1SqKjxyM=; h=From:To:Cc:Subject:Date:List-ID:From; b=ecTo3H8/2AHSbtqtqDsVYRS0j9iTpS3ZRg+5X3H2Q+WVoILdA2ZsodbBmToJXdesV 0N+m+7DG50ao1BTx1+fCs9HvywdhbzkTG2z6WrHdkZm4/Ew80l8yuFAAvgqBb9d/NA gvmeueGYkFxP2/GQO5BVdN6nlLBeDhSlXIZCDldA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729255AbgEFJzz (ORCPT ); Wed, 6 May 2020 05:55:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:56574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729084AbgEFJzz (ORCPT ); Wed, 6 May 2020 05:55:55 -0400 Received: from localhost.localdomain.com (unknown [151.48.155.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9CB3020753; Wed, 6 May 2020 09:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588758954; bh=YD4DMNr1yHZPIipOrEnMm7bnXE3vfPRPPws1SqKjxyM=; h=From:To:Cc:Subject:Date:From; b=X6mdGeI5ChUfVpxHlYonIuxM0+q19DILwq4xrzonMLQmqVPMwFfo7tNg1UYVcxOIX sdILrNVDDpCSRWL9F1T7yC3gVT+19G+gX7qd4yWcSUb0kraRhaUjKFXw/VPmC231JC P+MZWpQSE79/rL6gQGt50J4pqsC44rHWukakOcYM= From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, sean.wang@mediatek.com Subject: [PATCH] mt76: mt7663: add support to sched scan with randomise addr Date: Wed, 6 May 2020 11:55:42 +0200 Message-Id: <9ff4b5dfa487c7d32cb46988fbcb09e0fef1e9de.1588758914.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Add support to sched scan with randomise addr Co-developed-by: Wan-Feng Jiang Signed-off-by: Wan-Feng Jiang Co-developed-by: Soul Huang Signed-off-by: Soul Huang Signed-off-by: Sean Wang Co-developed-by: Lorenzo Bianconi Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 7 ++++++- drivers/net/wireless/mediatek/mt76/mt7615/mcu.h | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index 1d49d65d1acd..37fc70197f92 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -139,7 +139,8 @@ void mt7615_check_offload_capability(struct mt7615_dev *dev) ieee80211_hw_set(hw, SUPPORTS_PS); ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS); - wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; + wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR | + NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; } else { dev->ops->hw_scan = NULL; dev->ops->cancel_hw_scan = NULL; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 89fadff44fa4..96bf39a4a3da 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -2907,7 +2907,12 @@ int mt7615_mcu_sched_scan_req(struct mt7615_phy *phy, req = (struct mt7615_sched_scan_req *)skb_put(skb, sizeof(*req)); req->version = 1; req->seq_num = mvif->scan_seq_num | ext_phy << 7; - req->scan_func = !!(sreq->flags & NL80211_SCAN_FLAG_RANDOM_ADDR); + + if (sreq->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + get_random_mask_addr(req->random_mac, sreq->mac_addr, + sreq->mac_addr_mask); + req->scan_func = 1; + } req->ssids_num = sreq->n_ssids; for (i = 0; i < req->ssids_num; i++) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h index 737ccec6dd96..0f12e6da89af 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h @@ -405,10 +405,11 @@ struct mt7615_sched_scan_req { u8 channel_type; u8 channels_num; u8 intervals_num; - u8 scan_func; + u8 scan_func; /* BIT(0) eable random mac address */ struct mt7615_mcu_scan_channel channels[64]; __le16 intervals[MT7615_MAX_SCHED_SCAN_INTERVAL]; - u8 pad2[64]; + u8 random_mac[ETH_ALEN]; /* valid when BIT(0) in scan_func is set */ + u8 pad2[58]; } __packed; struct nt7615_sched_scan_done {