Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp880810rdb; Tue, 23 Jan 2024 19:37:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIamocXfce1lV/YcD4DYMLrxh1a2xcDNcNXN/YjObuKmF/0HBJjKEvcJ4Np97TPuihyWNM X-Received: by 2002:ae9:ea0f:0:b0:783:1c3e:beae with SMTP id f15-20020ae9ea0f000000b007831c3ebeaemr8377619qkg.123.1706067441114; Tue, 23 Jan 2024 19:37:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706067441; cv=pass; d=google.com; s=arc-20160816; b=ChiThP/fD+k5t5PKFXVPYjCCeQQ4q1+aoC29KVD6suYcWX9L1R50MO0K/K57rKaV6p k70YpT4H1eoknqk9i7lXmbqLH4ZXT7pXkH02bjVb0FVQIqUz+g9G12HiH5T1j/rCNJEI 7RzLnu0v0MUxYFAas48ESAopMtRqfx4im+ot7Iol3x7uCbVNujod0WzOvfdREhUKkxLP IlaLyoin5N1kfDWWtBW2WesES1cDY13rumU+15qTdGpklHcZBRXubSS+xCvgjUG5RrtQ mEfmOlNMAUxzkiL42hVm+apULtAowlAXwPbRCjqA2NHYgel6lBnvsojPdGjZ6Se1sRDG ggmw== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=zgoymWSFen42yAFd/OIaGLVJ11yYP3toUVIgdMnKMoI=; fh=119R0DZRwIns1LRpqAK2A6izyPVjL4TEe6VydCwW0T8=; b=gAT+i0TSrh9gJ9/3aTzxF9lxNQfVzBePo/6kbbMlJM5/IUzPexklQi9NTlSxVkOraS 5EAsg1Z1VC6TcmQ1IqYdWiz0b/R4YF/7J+Y1SuP8vevwAOwxykKu63a976qpr2U/o9AA ZOh6gXZxMSoiA8Km6+M3bilAEBmLT8phtfAOdF7mfWv223xpn6Xbz3RAZPzbpFmfzmyB 5yiItQ/kgZKeiHsTC1udXgL3+FlprtyfPI4LdwlAV8V6RY4V4Cg0h8Vc7MtCrZ5H+w/t uelJXa3SdNvcLNuD9m+80+y7R/61gvIkZn7awlhROXRVEFaGJaGh7uG+9/GZz22AFgwy H+PQ== 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-2428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2428-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p7-20020a05620a22a700b007837e9e6f93si9109814qkh.612.2024.01.23.19.37.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:37:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-2428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2428-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 DCC5B1C22D80 for ; Wed, 24 Jan 2024 03:37:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 927298465; Wed, 24 Jan 2024 03:37:15 +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 7E48F1381 for ; Wed, 24 Jan 2024 03:37:12 +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=1706067435; cv=none; b=JBOZ53ZOtHprFwITvLWGt5DfjXmLPnjQscDKpXYuggJSb0Xt6twChAuswuh+hGDiEo6a6mwSIsPVjW4XTJzFdzZuX2jIz9X9Fa5oohBuCRP32REpWJilCJZYRYTGZy/Ddkf4w5qWPNq4LJNyZIEPJruHjeoKDXBociF10uoDy/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706067435; c=relaxed/simple; bh=Oxc0cUtJEsuiPzsODHxmVBfKhPNQXkU48F6X3OXVHPQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ie+ppICVIYcUr6XmupRGBDfT0k75GvyAwaJ8cQzIzRoUq6UFqqItJ8b+1SKlsK/NXuv5Y8JsKd7SYzcDV+znqJCUl0bDAeon8LCrM44UMRcw/vn2HNJy17mZrz6FFD7qIXlbToOJP+s2dgHmZP1wivfW+PM5lD75j8x3Ztztgn4= 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 40O3b6cG5723697, 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 40O3b6cG5723697 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Jan 2024 11:37:06 +0800 Received: from RTEXDAG02.realtek.com.tw (172.21.6.101) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Wed, 24 Jan 2024 11:37:06 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXDAG02.realtek.com.tw (172.21.6.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 24 Jan 2024 11:37:06 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH 1/6] wifi: rtw89: 8922a: hook handlers of TX/RX descriptors to chip_ops Date: Wed, 24 Jan 2024 11:36:32 +0800 Message-ID: <20240124033637.12330-2-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240124033637.12330-1-pkshih@realtek.com> References: <20240124033637.12330-1-pkshih@realtek.com> 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 RTEXDAG02.realtek.com.tw (172.21.6.101) X-KSE-ServerInfo: RTEXDAG02.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback Hook implemented handlers to chip_ops, and fill packet frequency and signal strength to RX status from RX PPDU status packet. Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/rtw8922a.c | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922a.c b/drivers/net/wireless/realtek/rtw89/rtw8922a.c index f34e2a8bff07..9c7465d0715b 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8922a.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8922a.c @@ -1250,6 +1250,39 @@ static void rtw8922a_ctrl_nbtg_bt_tx(struct rtw89_dev *rtwdev, bool en, } } +static void rtw8922a_fill_freq_with_ppdu(struct rtw89_dev *rtwdev, + struct rtw89_rx_phy_ppdu *phy_ppdu, + struct ieee80211_rx_status *status) +{ + u8 chan_idx = phy_ppdu->chan_idx; + enum nl80211_band band; + u8 ch; + + if (chan_idx == 0) + return; + + rtw89_decode_chan_idx(rtwdev, chan_idx, &ch, &band); + status->freq = ieee80211_channel_to_frequency(ch, band); + status->band = band; +} + +static void rtw8922a_query_ppdu(struct rtw89_dev *rtwdev, + struct rtw89_rx_phy_ppdu *phy_ppdu, + struct ieee80211_rx_status *status) +{ + u8 path; + u8 *rx_power = phy_ppdu->rssi; + + status->signal = + RTW89_RSSI_RAW_TO_DBM(max(rx_power[RF_PATH_A], rx_power[RF_PATH_B])); + for (path = 0; path < rtwdev->chip->rf_path_num; path++) { + status->chains |= BIT(path); + status->chain_signal[path] = RTW89_RSSI_RAW_TO_DBM(rx_power[path]); + } + if (phy_ppdu->valid) + rtw8922a_fill_freq_with_ppdu(rtwdev, phy_ppdu, status); +} + static int rtw8922a_mac_enable_bb_rf(struct rtw89_dev *rtwdev) { rtw89_write8_set(rtwdev, R_BE_FEN_RST_ENABLE, @@ -1291,10 +1324,14 @@ static const struct rtw89_chip_ops rtw8922a_chip_ops = { .set_txpwr_ctrl = rtw8922a_set_txpwr_ctrl, .init_txpwr_unit = NULL, .ctrl_btg_bt_rx = rtw8922a_ctrl_btg_bt_rx, + .query_ppdu = rtw8922a_query_ppdu, .ctrl_nbtg_bt_tx = rtw8922a_ctrl_nbtg_bt_tx, .set_txpwr_ul_tb_offset = NULL, .pwr_on_func = rtw8922a_pwr_on_func, .pwr_off_func = rtw8922a_pwr_off_func, + .query_rxdesc = rtw89_core_query_rxdesc_v2, + .fill_txdesc = rtw89_core_fill_txdesc_v2, + .fill_txdesc_fwcmd = rtw89_core_fill_txdesc_fwcmd_v2, .h2c_dctl_sec_cam = rtw89_fw_h2c_dctl_sec_cam_v2, .h2c_default_cmac_tbl = rtw89_fw_h2c_default_cmac_tbl_g7, .h2c_assoc_cmac_tbl = rtw89_fw_h2c_assoc_cmac_tbl_g7, -- 2.25.1