Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp635920ybi; Fri, 14 Jun 2019 00:26:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGeyEFJUWErkY/0wW0sSu8k8cfqkhz6GNBdua7WURP0kvi6iNLw4y2JhS4n+vuwVKdZRr5 X-Received: by 2002:a17:90a:898e:: with SMTP id v14mr9635085pjn.119.1560497193080; Fri, 14 Jun 2019 00:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560497193; cv=none; d=google.com; s=arc-20160816; b=UWJmhi1YbdErMew0Bq58ekTM1mg9du+j87U1ucIL/jkZnIZOLI21z1ilqg/AfV+9CJ C+k4SlRaNI8mD1AcLiIw5nCKWIeB7c9ot32OOHWY80/PzBinP79OTFK3I6dJyS+yzFpo 5ugWgfv9AaQyA4hnqugrlnEM3BdgEqbGZpiXinCbJh/ZB0b2aVOowJLpYkvF3tgnxPu7 ZZIbUbUxGkfsZNJkpv72o86dHzp/51XmRbttuyhxRb0ocrb0dEAfohMjc7M2On7eniif o2AMyJY+Bzo+46xR7h5Rxe1OP2UjwuCFSIWhBV3xkCYFJVh8lgL7qlDoUCRiKG76Zoi3 YJBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=0Yt5WFEgVOaQuIC+uAMZgWAjMcv0IKFZX1Xc2ZxTs1w=; b=DynfvVymWwsra+A/k0Y2iNbkmCiqouXhFoI6afER637OdpCl5QFRzT3Bb/LP3EItZo tWrdP7wg/66pbVreaYANSbrwoKZd7eGr2E+827Aya8YH9ljnA7BHD1pxneaxybaLR5iQ TwRoEtWCSpnTXoV5LL0gwm7jNxRbLhAqVO4nwoUt9tE8opxSVjTJRWK7dqjMbQq82JJ2 XMN/eIIPw57hlXks6eqtieeqDxkz4OiL1UHAr6d6sbeiICWKFfgStwS5CAU2zIYJTxlc wZkOctCtQk4XhtxheWZoqcIV5JcYDw1Lw0FG9DhxRmZ+qMJIiWbXZfBpO8m7Z7EvbsD6 r/5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si1742610pgp.343.2019.06.14.00.26.17; Fri, 14 Jun 2019 00:26:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726567AbfFNHYZ (ORCPT + 99 others); Fri, 14 Jun 2019 03:24:25 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:48162 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfFNHYY (ORCPT ); Fri, 14 Jun 2019 03:24:24 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5E7OKYq024912, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x5E7OKYq024912 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 14 Jun 2019 15:24:20 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.439.0; Fri, 14 Jun 2019 15:24:20 +0800 From: To: CC: Subject: [PATCH v2 02/11] rtw88: add support for random mac scan Date: Fri, 14 Jun 2019 15:24:06 +0800 Message-ID: <1560497055-17197-3-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560497055-17197-1-git-send-email-yhchuang@realtek.com> References: <1560497055-17197-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang When driver uses random mac address to scan, the unicast probe response will not be received because the addr1 is not matched. Configure port address by requested mac address to receive probe response from AP. To support random mac scan, we need to configure the mac address during scan period to receive unicast prop_resp. After scan is completed, configure the mac address back to the original one that the port used. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/mac80211.c | 19 +++++++++++++++++++ drivers/net/wireless/realtek/rtw88/main.c | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index abded63..61436bb 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -446,20 +446,39 @@ static void rtw_ops_sw_scan_start(struct ieee80211_hw *hw, { struct rtw_dev *rtwdev = hw->priv; struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; + u32 config = 0; rtw_leave_lps(rtwdev, rtwvif); + mutex_lock(&rtwdev->mutex); + + ether_addr_copy(rtwvif->mac_addr, mac_addr); + config |= PORT_SET_MAC_ADDR; + rtw_vif_port_config(rtwdev, rtwvif, config); + rtw_flag_set(rtwdev, RTW_FLAG_DIG_DISABLE); rtw_flag_set(rtwdev, RTW_FLAG_SCANNING); + + mutex_unlock(&rtwdev->mutex); } static void rtw_ops_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct rtw_dev *rtwdev = hw->priv; + struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; + u32 config = 0; + + mutex_lock(&rtwdev->mutex); rtw_flag_clear(rtwdev, RTW_FLAG_SCANNING); rtw_flag_clear(rtwdev, RTW_FLAG_DIG_DISABLE); + + ether_addr_copy(rtwvif->mac_addr, vif->addr); + config |= PORT_SET_MAC_ADDR; + rtw_vif_port_config(rtwdev, rtwvif, config); + + mutex_unlock(&rtwdev->mutex); } const struct ieee80211_ops rtw_ops = { diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index d2e8d2e..306d799 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1178,6 +1178,8 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw) hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; + hw->wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; + rtw_set_supported_band(hw, rtwdev->chip); SET_IEEE80211_PERM_ADDR(hw, rtwdev->efuse.addr); -- 2.7.4