Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1209809lqz; Sun, 31 Mar 2024 20:31:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIKstzpp645O1A4pYXn2T0BR4kyVWuvm4J+raigLCx+3Dh8glKb9GX8n1sJdyVxJ9BQ9OeK1QXzgsMshWnlwk9EJx6XnNtzpAjeZ664g== X-Google-Smtp-Source: AGHT+IFcN3Z7fC8MkG9CVMLf6aW1ExSivv5myKSKM6SgxtpjGwV0nUp2C81LCwfaFE7ErZCKUYxd X-Received: by 2002:ac8:5a8b:0:b0:431:8258:d7e7 with SMTP id c11-20020ac85a8b000000b004318258d7e7mr11628670qtc.19.1711942302910; Sun, 31 Mar 2024 20:31:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711942302; cv=pass; d=google.com; s=arc-20160816; b=kRn7myOq/eDmEmXPACICyR/doU9KcNzNIAEbO/r14aW43bduZKPi2HohomrP8IRHdm +PiSgA7MNHqGKpRAo1rkGeARXYty96ABsysUvLSO90n1tQpGNpOqTzgmfswFRQpy6icx D/FJ4bTolUPvBaevBV2TfREzkp3p+uO/2q1RU1VipGkEQlSl/SEETmA3ei7lLe5TUmL0 Xdyg+HOYoUzpUMNJ6AOafrPt0B/71cPCIHx46g1yQKe2QmaJtRSidgwVAd3nXnWmv9xY F2rP8fK1yueG9thQ9agoLOLTs2vGmT6x7flNqiLhk2tTOOPI6hvAsL/fVQBo8QIfND0+ Ezjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Tv+h6N2rV05BPosoLAJVExMOQlT8NOBlV5nCY4Zg4d0=; fh=cE7VFXx5RvyJxKbMJtti0i3fvFBM4JUdcpU8K9zYwFY=; b=ounqZhSVhR18gua3kD+qAjrFgokKwCBfNpn16R+OQXUlvwy6OlZEP4bgS/ElyzuoXD GdcwQo6rcMvwbVbgqRnOco9r/ptkqDQjVZU6xbMca7n17/9rxsfVj0gZZX+NfEWwz6VL Zxsl1KnoQnEUtIX0fB7J4P4OwDqUke5XlQd8vjnetWnrCNg0AOW03Hg2W4XzPWnGgLhW FmnGO1uHZ/XZPDpwALws0BTQE9QAezYrS8aVh3tEKQMVvg1iiAetwHAT+2x/vMEa21/l ArAHwY9Bn6PH1blU9NhFb9vydOH0F8SMl0F8oQZ2I7b9rTm1NWwqBISJQXUvoOLl+arK FCJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-5706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5706-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ef15-20020a05622a53cf00b00432c8c53cbfsi5088516qtb.358.2024.03.31.20.31.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 20:31:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-5706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5706-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8EECF1C20A7D for ; Mon, 1 Apr 2024 03:31:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8169443D; Mon, 1 Apr 2024 03:31:39 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1AC82F3E for ; Mon, 1 Apr 2024 03:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711942299; cv=none; b=B8UlZpT9p8sKvT+VnI6UixRy5BHoOx7fekD6P2vLtRqNJpLkNACDhNdPzzxtM7hZgrfrHK5+tXK/xRlSlgQKCmYOxdWY4kdC4wXOU5xmCk2B5lhGb8UAc2lODGf6lmkWE5cv3hfhpPfkpDfyaiv0RBTsiMdkq1DO07cDVmhBADU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711942299; c=relaxed/simple; bh=xUblZ8Xu4vAyoBewjt2qFGEL2mQV2zEx029l6nm+cZM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=IQB9qZi/6CiGTrSLedXb7OTIq1PGKm+ZWNNX+d4grgv4kPsxmsJ1SNbMkO4X8tEZr2Z7mU6xtx8VN0a2KHnmjcTexWxObO2GwrQkuvaoJI/+5HNov3bybRYoF7rIaxMclF4P/mUQzoXNGDgmHxWPmH0bl60+rbFXaTsuucu7v2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4313VX7J02396653, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 4313VX7J02396653 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 1 Apr 2024 11:31:33 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 1 Apr 2024 11:31:34 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 1 Apr 2024 11:31:33 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH] wifi: rtw88: Set default CQM config if not present Date: Mon, 1 Apr 2024 11:30:19 +0800 Message-ID: <20240401033019.9664-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) From: Po-Hao Huang When wpa_supplicant is initiated by users and not by NetworkManager, the CQM configuration might not be set. Without this setting, ICs with connection quality monitor handled by firmware won't detect connection loss. To fix this we prepare a default setting upon associated at first, then update again if any is given later. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw88/fw.c | 14 ++++++++++---- drivers/net/wireless/realtek/rtw88/fw.h | 2 ++ drivers/net/wireless/realtek/rtw88/mac80211.c | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c index 3f037ddcecf1..ab7d414d0ba6 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.c +++ b/drivers/net/wireless/realtek/rtw88/fw.c @@ -783,12 +783,18 @@ void rtw_fw_beacon_filter_config(struct rtw_dev *rtwdev, bool connect, static const u8 rssi_min = 0, rssi_max = 100, rssi_offset = 100; struct rtw_sta_info *si = sta ? (struct rtw_sta_info *)sta->drv_priv : NULL; - s32 threshold = bss_conf->cqm_rssi_thold + rssi_offset; + s32 thold = RTW_DEFAULT_CQM_THOLD; + u32 hyst = RTW_DEFAULT_CQM_HYST; u8 h2c_pkt[H2C_PKT_SIZE] = {0}; if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER)) return; + if (bss_conf->cqm_rssi_thold) + thold = bss_conf->cqm_rssi_thold; + if (bss_conf->cqm_rssi_hyst) + hyst = bss_conf->cqm_rssi_hyst; + if (!connect) { SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_BCN_FILTER_OFFLOAD_P1); SET_BCN_FILTER_OFFLOAD_P1_ENABLE(h2c_pkt, connect); @@ -805,15 +811,15 @@ void rtw_fw_beacon_filter_config(struct rtw_dev *rtwdev, bool connect, rtw_fw_send_h2c_command(rtwdev, h2c_pkt); memset(h2c_pkt, 0, sizeof(h2c_pkt)); - threshold = clamp_t(s32, threshold, rssi_min, rssi_max); + thold = clamp_t(s32, thold + rssi_offset, rssi_min, rssi_max); SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_BCN_FILTER_OFFLOAD_P1); SET_BCN_FILTER_OFFLOAD_P1_ENABLE(h2c_pkt, connect); SET_BCN_FILTER_OFFLOAD_P1_OFFLOAD_MODE(h2c_pkt, BCN_FILTER_OFFLOAD_MODE_DEFAULT); - SET_BCN_FILTER_OFFLOAD_P1_THRESHOLD(h2c_pkt, (u8)threshold); + SET_BCN_FILTER_OFFLOAD_P1_THRESHOLD(h2c_pkt, thold); SET_BCN_FILTER_OFFLOAD_P1_BCN_LOSS_CNT(h2c_pkt, BCN_LOSS_CNT); SET_BCN_FILTER_OFFLOAD_P1_MACID(h2c_pkt, si->mac_id); - SET_BCN_FILTER_OFFLOAD_P1_HYST(h2c_pkt, bss_conf->cqm_rssi_hyst); + SET_BCN_FILTER_OFFLOAD_P1_HYST(h2c_pkt, hyst); SET_BCN_FILTER_OFFLOAD_P1_BCN_INTERVAL(h2c_pkt, bss_conf->beacon_int); rtw_fw_send_h2c_command(rtwdev, h2c_pkt); } diff --git a/drivers/net/wireless/realtek/rtw88/fw.h b/drivers/net/wireless/realtek/rtw88/fw.h index 84e47c71ea12..e999c24e4634 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.h +++ b/drivers/net/wireless/realtek/rtw88/fw.h @@ -29,6 +29,8 @@ #define BCN_FILTER_CONNECTION_LOSS 1 #define BCN_FILTER_CONNECTED 2 #define BCN_FILTER_NOTIFY_BEACON_LOSS 3 +#define RTW_DEFAULT_CQM_THOLD -70 +#define RTW_DEFAULT_CQM_HYST 4 #define SCAN_NOTIFY_TIMEOUT msecs_to_jiffies(10) diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index 7af5bf7fe5b6..0acebbfa13c4 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -386,6 +386,8 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw, rtw_coex_media_status_notify(rtwdev, vif->cfg.assoc); if (rtw_bf_support) rtw_bf_assoc(rtwdev, vif, conf); + + rtw_fw_beacon_filter_config(rtwdev, true, vif); } else { rtw_leave_lps(rtwdev); rtw_bf_disassoc(rtwdev, vif, conf); -- 2.25.1