Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5381883ybi; Wed, 12 Jun 2019 01:22:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3Xv9o4ciOILFWN43c8DqM4W7w+UmhjU3SU2b8ahSXQ/InekDwQFVXqAsO6oB2TGtYzigi X-Received: by 2002:a65:50c3:: with SMTP id s3mr9886186pgp.177.1560327743804; Wed, 12 Jun 2019 01:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560327743; cv=none; d=google.com; s=arc-20160816; b=AdoqR77sJ2DQv+7Lo4z+5VqbSGFLelFYlJDNFnBP6FKWbidrkcFJZnsfqq3TKb21iV I9B868vhU/ZiKaHXFUIadklSBJU9OLhJUjqQMNb6S8ecHtSQRPeu9ldVrJ00apafSdQR ojftyBEdZHU/h4b7w1enepaa6QX3d4kzacKM8jUWF46dYSUM0kCHd1qcZXejfsKBDcgN OdI+LxLFSn5RusioaKAjHDmeEzaW0ymRAwf9XklQN82VwzCYZMSlWfQxdhN3Odk+djxA BxJcfJ5tRpvpfuVhi2Q3cyqDGJ058jfu++a1H42+sJoPwUKTDXQP7fMsybm7o6ai8AdS UTuA== 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=h4nKPHBRvZLFjux0Q/QgDYPtxN3R4hO/DlfAD2KVhnLXXp+Ro58rikC0SBfmGUK22Q 1q8lwcasTEAAloDAk5C2EjiAodvGz+KoFgodNdg9wwCMoe7mcrLA7TVfBlHFCLO97Qwp c+JjauCLRJfmapFZkN1uSuYlz/yRws1fZDDlGzm5buypM4boXt88rHP1sAndFeFOq6ua htocv4fEl0qSDBaNH0c1JhcCzQlB01fuvNqs8w4CvTVR0GfoOcLdrqolttq3wsPXFd4c XqFAfYYPX6uk8j3fGgxO24Lq9I+v0OcYN22YS8/zNnBDypAH0ATfjvDf9qDhei/DbAbu iOGQ== 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 d10si2670892pll.433.2019.06.12.01.21.58; Wed, 12 Jun 2019 01:22:23 -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 S1731221AbfFLGpc (ORCPT + 99 others); Wed, 12 Jun 2019 02:45:32 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:51293 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727443AbfFLGpc (ORCPT ); Wed, 12 Jun 2019 02:45:32 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5C6jSH5004348, 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 x5C6jSH5004348 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 12 Jun 2019 14:45:28 +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; Wed, 12 Jun 2019 14:45:27 +0800 From: To: CC: Subject: [PATCH 02/11] rtw88: add support for random mac scan Date: Wed, 12 Jun 2019 14:45:08 +0800 Message-ID: <1560321917-17751-3-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560321917-17751-1-git-send-email-yhchuang@realtek.com> References: <1560321917-17751-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