Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp38248rwr; Wed, 19 Apr 2023 03:06:09 -0700 (PDT) X-Google-Smtp-Source: AKy350a1QaY5K0aHqsLzyf0iZyFSbKJwoKN2lLdP8fotxz4jqQWg8Vf3kDEc70sHxlsoz/aLEtXa X-Received: by 2002:a17:90b:4a4f:b0:23b:4388:7d8a with SMTP id lb15-20020a17090b4a4f00b0023b43887d8amr2352417pjb.21.1681898769217; Wed, 19 Apr 2023 03:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681898769; cv=none; d=google.com; s=arc-20160816; b=V0JHMz7KmTioo09e3Qy42OekZD190gAMSP3JDnmy+y4cRv0K8nDN8+LDxFu1YVaUs1 YaV9BniYm7589nQM65kdkCmlB3HmTpRFDndOPQlX3Sdbfv5Jz8FRpDa4iGHskzFgjtbK o2NOioKk/QOg8XYydl1k1+I/6K0v5UngSDRn776tGBsaLXmMU0B5GFXrQiD48XYHyAQ1 HTHV9llKi98dQ3Hjs8eJ5p8Pzog9qp4xecL/2+2eZdYQzTVjmxLtXZHHlJZhjGOw2r6p TGqCnoPz+6ALKIoC2NVZI7XeMs8vOIsaM+k3B5a2t9FxBdUMcO3DMSiKuAqRKnLb1VYc VRFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=isYwCPMa6ROKGAa/ykodg/rXP/XQz4M6UJ99QdSwiwU=; b=hPErcwX8dZchwKNOskCPXe6W53mwd2Q0ILkhsfcc1jbo+TejaG7rF8Lv+mvln/o2YP Lh7y7+xrfkbSjgZYFr5mQSMVE5oacegNT/bN7vLsnMyvR9UedlJIjVQym8KMPOXy/buw UP0kwUyGlVIvf0PiCkB3AIPBFF/MMspgl1Icrg+A4NBO/tbzNtD27aegJMGz91F2GE41 5ABZmKcomHzIvHRQ40ztLF3NfftTercpDUq4NayvlT2Y+02tREij5j73RNSCqvavphjm SbvEvYy5zrtLHzvZvRDh3vxhU7VBnuns/uUoNLAvuDti7mhjtAjFZpKA0TZrX677PJ3Z 1tWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="O8b4/TfZ"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls4-20020a17090b350400b0024988ecf25bsi1500505pjb.86.2023.04.19.03.05.59; Wed, 19 Apr 2023 03:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="O8b4/TfZ"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232937AbjDSKCq (ORCPT + 64 others); Wed, 19 Apr 2023 06:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232936AbjDSKCU (ORCPT ); Wed, 19 Apr 2023 06:02:20 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58845469F for ; Wed, 19 Apr 2023 03:02:18 -0700 (PDT) From: Martin Kaistra DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681898533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=isYwCPMa6ROKGAa/ykodg/rXP/XQz4M6UJ99QdSwiwU=; b=O8b4/TfZYSSsC2fPyglJ97fJe7n965PTlXyqmX88hXf5udLQXje0zFqJEkOFAaiMphLO1c tYqKQuYkgaDvGAASKjAF97qpeFwMxrMnHmOKMa+FnaNARPnmrKG4WuFgi0WUBm9UyBZY0O KamUPuxvlPju5xGA4mjtwRL+76pTfMnVK2wfDc+tvfOk2/IbGz7XNFUfCie1TNJeNLuCoG LbTNXJarSXa9js3fPkOqtG1wtyAeOCYA7qBR2KjOTjtAe0T2RWWGVU35a/GnF067AJi73S X25FNhs9skSZFc2xlqJIBycEwPknetwf31Gt0dS1ntX+x2tfKd7S/wyTuT+l0w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681898533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=isYwCPMa6ROKGAa/ykodg/rXP/XQz4M6UJ99QdSwiwU=; b=TwM5jXc9UbzLSRHqWk1yhfjEWlvyudPuQJS1l1pjzm/C9y93vsXaDvJp2tBw/1q/mbgyIf HrKj/Vxxmz/CibDA== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH v2 15/18] wifi: rtl8xxxu: Remove usage of ieee80211_get_tx_rate() Date: Wed, 19 Apr 2023 12:01:42 +0200 Message-Id: <20230419100145.159191-16-martin.kaistra@linutronix.de> In-Reply-To: <20230419100145.159191-1-martin.kaistra@linutronix.de> References: <20230419100145.159191-1-martin.kaistra@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org As this driver uses HAS_RATE_CONTROL, tx_rates will not be provided by mac80211. For some frames c->control.rates[0].idx is negative, which means ieee80211_get_tx_rate() will print a warning and return NULL. Only management frames have USE_DRIVER_RATE set, so for all others the rate info of txdesc is ignored anyway. Remove call to ieee80211_get_tx_rate() and send management frames with 1M (rate info = 0). Signed-off-by: Martin Kaistra --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 27 +++---------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index f5b6ff3351e5a..b60f90ea5187b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -5180,21 +5180,14 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, bool short_preamble, bool ampdu_enable, u32 rts_rate, u8 macid) { - struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); struct rtl8xxxu_priv *priv = hw->priv; struct device *dev = &priv->udev->dev; u8 *qc = ieee80211_get_qos_ctl(hdr); u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - u32 rate; + u32 rate = 0; u16 rate_flags = tx_info->control.rates[0].flags; u16 seq_number; - if (rate_flags & IEEE80211_TX_RC_MCS && - !ieee80211_is_mgmt(hdr->frame_control)) - rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; - else - rate = tx_rate->hw_value; - if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) dev_info(dev, "%s: TX rate: %d, pkt size %u\n", __func__, rate, le16_to_cpu(tx_desc->pkt_size)); @@ -5253,24 +5246,17 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, bool short_preamble, bool ampdu_enable, u32 rts_rate, u8 macid) { - struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); struct rtl8xxxu_priv *priv = hw->priv; struct device *dev = &priv->udev->dev; struct rtl8xxxu_txdesc40 *tx_desc40; u8 *qc = ieee80211_get_qos_ctl(hdr); u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - u32 rate; + u32 rate = 0; u16 rate_flags = tx_info->control.rates[0].flags; u16 seq_number; tx_desc40 = (struct rtl8xxxu_txdesc40 *)tx_desc32; - if (rate_flags & IEEE80211_TX_RC_MCS && - !ieee80211_is_mgmt(hdr->frame_control)) - rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; - else - rate = tx_rate->hw_value; - if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) dev_info(dev, "%s: TX rate: %d, pkt size %u\n", __func__, rate, le16_to_cpu(tx_desc40->pkt_size)); @@ -5334,22 +5320,15 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, bool short_preamble, bool ampdu_enable, u32 rts_rate, u8 macid) { - struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); struct rtl8xxxu_priv *priv = hw->priv; struct device *dev = &priv->udev->dev; struct rtl8xxxu_ra_info *ra = &priv->ra_info; u8 *qc = ieee80211_get_qos_ctl(hdr); u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - u32 rate; + u32 rate = 0; u16 rate_flags = tx_info->control.rates[0].flags; u16 seq_number; - if (rate_flags & IEEE80211_TX_RC_MCS && - !ieee80211_is_mgmt(hdr->frame_control)) - rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; - else - rate = tx_rate->hw_value; - seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); if (ieee80211_is_data(hdr->frame_control)) { -- 2.30.2