Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp526524lqo; Fri, 10 May 2024 07:10:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcFsBY6flXdA9MbGomQzwy5UW1g+bOibcVfrlFr+XzcSBgWS25OB421ouBq5/xRfw2rKO1btRhW0T0TlW7bFQIk+hHABB/0opHIejXbw== X-Google-Smtp-Source: AGHT+IHCNr+DKBpJEFyDyMLNyhe22hz4entvG1rADZknG1K3fg8xfaHXGwxS7bL3mQQW8zphAB2i X-Received: by 2002:a05:6e02:148e:b0:36c:4aef:6694 with SMTP id e9e14a558f8ab-36cc14f84bdmr28133905ab.31.1715350244371; Fri, 10 May 2024 07:10:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715350244; cv=pass; d=google.com; s=arc-20160816; b=pQnzO2Calpci8tcwH4s0C55PrH8fjh49MRn3Snv7RrUPFn0lznbxSyAKFAY2uV1Rrh zCqQJsla1vNIpqFJApqBIxo7jTlAE8Tbur0kmX5K56LkyOQYxCdEnsnvE6OwUHKSzx1I kq0G+zGO+lE3MYm+If0Jc/5wVPBRdpSMvmkZKOZWIOCmjFYZ+W1/b+Pgi+4eHlXf5S07 69IwCcBzWSqc70GVw6Z5Fv2FfajFpQQMNJyvEcEDGt53miDTFmkFHPSA7rUnjvk9NP1T tskzRvVArT2W0jJLHvjDO4eiiAYc/l7WNTwSt4WkNNYl1YPNiEVPi9Yj8stQjY+54SqL ZQ5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=MbRDagJKRQoawWORGaPCUM1I8Y9Pm8ZyWw3z0UnDouo=; fh=PDSSEjKy7cmFuHtkjoZ8a7qMM7lBImsSwUi+cbFWHlc=; b=SkmUq5/v29LRkoSCzyvpGUoxqGfkYSTiDboUoTttVf+RYkqaWqxNVfV1Y1MfTGmyRx vwWQOQEfA8j8L+v07w/kjPsjgARE00iT9kzpj6gNksiZQANZhBGXv50x/IkYinFIJKN0 XlT7GJruVVUUl8qGN1Gjy1O5npYIRbRkhXoPqKOQP7yy+ZaxSftkcZDm8xEesqkhsyZ7 dA/vhAE1TsDNpqP4sGNSoQ/X213fWXyBfHXAKQimxXU2P749Ig891vvOcVxtyOv1Micm ONhQYcf3YXu2HhKzRamo1dXjIQM/gQ9TnD03gA/RVADFbAPbT7EtHvfZi1hu5YnpG9tr mooA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k7SW7+oM; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-7461-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7461-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412a4d14csi3529988a12.714.2024.05.10.07.10.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 07:10:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7461-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k7SW7+oM; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-7461-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7461-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4100DB24747 for ; Fri, 10 May 2024 14:08:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C71331708A8; Fri, 10 May 2024 14:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k7SW7+oM" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3937D136E0C for ; Fri, 10 May 2024 14:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715350015; cv=none; b=u6mGNXKz+pL/yNX/gMKM676o7Mqjf+2eEPLjTUE33SO9VqsBNDQDywR59pttjVLNMBxiq/l3GmX7LgOjIxOSgTyoU1HZva7SLn2tv9oEq/WYFoY/a+QgO6Mmi4KY3JlCLZ1JI0X+qVl3dhqiTEtmrkT98L/ZKbGXXxbywjCbQPQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715350015; c=relaxed/simple; bh=2eYnwjii5TY0WonVlBXB1ItTcIGPYGSOvIvYYeqnqZg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F5A32IrdQmsIWiMyBGgtf36BNqAq6zUAMCFpDZ15xla4Xx1s2MxPUQkV91Vk9sJ3UmQ1v3nJbDKdX/hfpcgupIurwe7DVkiVqJ1klb6OYLdvlg36LQByFwT2SXizjLx+rhe8j8F/vN9klyWD/dxZeoZGa5QejPo6kVZlfGpRQVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=k7SW7+oM; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715350014; x=1746886014; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2eYnwjii5TY0WonVlBXB1ItTcIGPYGSOvIvYYeqnqZg=; b=k7SW7+oM1d8S8hWzRsBWwtsftQyIJEQHu9YHINTBLcJ0EgCF1LWejXOP 1sTtvnpV7Jh3+ySkftzIUyJJBFSF1P0aP4SCzllsRX1xjLUdxL7wRcOGf +Y6MVXsAiwEqc8Q8JOwB+E+x+chxutZlMx+RVkQ/b7Vp4ozktochofd11 aA8QhoIY5mdw2uGI0HTzGmlG34Ibc9k01LITSb0LPvMCJ7r033gq1Utjx O39gZWpDdZXJLurMdeB94obIlsDQV48+kUznw1KQdLq4GAmhidH7jzuzq 0hkihsGr45QshCfOaD6omfsQlVex+XCya21g9oZQYr/yNx7+5tV0zPXV9 A==; X-CSE-ConnectionGUID: o6b8ELmRQrK4g8ZD+h+4Tg== X-CSE-MsgGUID: 5+M1rJiET424KG85xyH8Kg== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="15125518" X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="15125518" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 07:06:54 -0700 X-CSE-ConnectionGUID: T49YHlbxSGmG0sw/LvEHwQ== X-CSE-MsgGUID: ALSkBiQyREm3oUzZ9zOIlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="67101808" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 07:06:53 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Luciano Coelho Subject: [PATCH 01/14] iwlwifi: dvm: clean up rs_get_rate() logic Date: Fri, 10 May 2024 17:06:28 +0300 Message-Id: <20240510170500.a4cdb41825eb.Id202bcc967c32829f70ab1412f8893b6eb7f78e2@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240510140641.1895860-1-miriam.rachel.korenblit@intel.com> References: <20240510140641.1895860-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited Content-Transfer-Encoding: 8bit From: Johannes Berg The logic here is rather convoluted - we cannot get here with lq_sta being NULL as mac80211 will (no longer) call us like that, and since I removed the rate_control_send_low() call in this function there's no longer any point in setting priv_sta to NULL either. So the only thing that remains to check is if we have actually initialized our lq_sta->drv pointer, and exit if we didn't in which case we'll use the data mac80211 already set up for the low rate usage. Signed-off-by: Johannes Berg Reviewed-by: Luciano Coelho --- drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c index f4a6f76cf193..8879e668ef0d 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c @@ -2673,20 +2673,16 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, IWL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n"); /* Get max rate if user set max rate */ - if (lq_sta) { - lq_sta->max_rate_idx = fls(txrc->rate_idx_mask) - 1; - if ((sband->band == NL80211_BAND_5GHZ) && - (lq_sta->max_rate_idx != -1)) - lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE; - if ((lq_sta->max_rate_idx < 0) || - (lq_sta->max_rate_idx >= IWL_RATE_COUNT)) - lq_sta->max_rate_idx = -1; - } + lq_sta->max_rate_idx = fls(txrc->rate_idx_mask) - 1; + if (sband->band == NL80211_BAND_5GHZ && lq_sta->max_rate_idx != -1) + lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE; + if (lq_sta->max_rate_idx < 0 || lq_sta->max_rate_idx >= IWL_RATE_COUNT) + lq_sta->max_rate_idx = -1; - /* Treat uninitialized rate scaling data same as non-existing. */ - if (lq_sta && !lq_sta->drv) { + if (!lq_sta->drv) { IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); - priv_sta = NULL; + /* mac80211 already set up the data for using low rates */ + return; } rate_idx = lq_sta->last_txrate_idx; @@ -2756,7 +2752,6 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i lq_sta = &sta_priv->lq_sta; sband = hw->wiphy->bands[conf->chandef.chan->band]; - lq_sta->lq.sta_id = sta_id; for (j = 0; j < LQ_SIZE; j++) -- 2.34.1