Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4401665rwb; Tue, 6 Sep 2022 07:06:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dx1mmB5/dUFK16OkOZbjayuM9Rd2WHp6yz8u66Cv0eHpa1tVIzcJUqH0Mlqb84hb/mHrW X-Received: by 2002:a63:1208:0:b0:434:d104:3ca1 with SMTP id h8-20020a631208000000b00434d1043ca1mr708597pgl.446.1662473184904; Tue, 06 Sep 2022 07:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662473184; cv=none; d=google.com; s=arc-20160816; b=P33tOz/Mj7dclPTslBUIFmfZqn7fAV51UkCNkEHBfGIeddYcrQc7M2pxEBMZA8j+/g dOdoeVGttZ20oKm9rz8C43f2Yk7RZfOwW690ntkSKgF3s4ZUKI5FU0nXE80MJKerZR+r SgPP0r7Uas968wunf1e4WFjtQuK1Jbh5vgTaJIvW9OBqkEQ44sX/N3iPtUpBbjbfqKdl 9tCHEIZ0fSo2A+6JkCzh7gzD9QgJ1TzmutIDS2YUnE+FmDF+itHE5faT3MU3p9lRztkH SowF2LH3Ru+vQ1xHWrA75szBAWJ+gIbxCrrXk+qro4Zek/+Hltq8f5lxGV1QhYl3iQ4P Xuqw== 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:from :dkim-signature; bh=iyyy3k/1jJ7JOsAKBVarC87QSG2bynWMuc4yoOCGXb4=; b=pi9HvKsyyiw7Tu8EuoWkyY5zjleN5EqKrXZqw+Ls/fBxzCQ+8Kt/4HAC52SXNZOfNB IrO9EFr7EhUIasfz/mp5hfFyo6Ou9E5nDyxTXnuMJnpKBH3T3QUBkjJGOr6l4EaiQUDZ fxuBbcVM7nW2W5wRh0JheLw8PmUF6u/HdL0cloyNDEA/Ug8NrbDPIujRCxzjhA4Bk0Vq oSJemOAcxRWrS/wY9OpHJAqXwN4EklTQ6tzWBMo1eLQy++ZKcyZ5aEsvK6kokM6lpjkO aU1P2huh9fjcAD2MA4WMzvzEOrYscN4yQP7HHfI4vH7WAZnQLJ5lh8vv+2msUX8n1Hec kHoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=irBfpWYk; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a63f304000000b0041d16f4f04fsi9460744pgh.515.2022.09.06.07.06.08; Tue, 06 Sep 2022 07:06:24 -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=@intel.com header.s=Intel header.b=irBfpWYk; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238560AbiIFOFP (ORCPT + 64 others); Tue, 6 Sep 2022 10:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241414AbiIFOER (ORCPT ); Tue, 6 Sep 2022 10:04:17 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCA0222BE5 for ; Tue, 6 Sep 2022 06:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662471897; x=1694007897; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=52D2F/yHOk+iTcQqICjsrT1eKWDPzyaGsuGa54hUkHQ=; b=irBfpWYkeWVspkYfQGwqYprOZFEfIo3V3l2uZEqdYARgqJtEPjJ7cf3V bis8ceO9o38+RNThXZnCjKZyt6pyAPVYFU4wm16s47pYv6YpyLhLb0zXh SxqqhntCCLLpZaNpKMZB7xhmuih5FB2tvdtRgn4V3lmDew3440Z20sx6e OtoNqXHqbGk7uHaBCXpTNROakbqdn3D6PY2BYgfZjUZebr9hcALILtWui mrQ1+tsDhK81NcEYOdnYDke5HE4CGXGRTHapUEHWi4DVzk0gEF3P78Q06 rq0fu30N7lYcUIbtHP4Ftr1D+qpZSK6P9CDesAN7GY3j6QuAliD8DCK96 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="276332709" X-IronPort-AV: E=Sophos;i="5.93,294,1654585200"; d="scan'208";a="276332709" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 06:43:26 -0700 X-IronPort-AV: E=Sophos;i="5.93,294,1654585200"; d="scan'208";a="942459646" Received: from ygueta-mobl2.ger.corp.intel.com (HELO ggreenma-mobl2.lan) ([10.249.82.178]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 06:43:24 -0700 From: gregory.greenman@intel.com To: kvalo@kernel.org, johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 05/15] wifi: iwlwifi: mvm: refactor iwl_mvm_set_sta_rate() a bit Date: Tue, 6 Sep 2022 16:42:09 +0300 Message-Id: <20220906161827.623e32931b67.Id743a7879e84ae37a849179e536c58b1bf55380f@changeid> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220906134219.365090-1-gregory.greenman@intel.com> References: <20220906134219.365090-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 From: Johannes Berg Use a switch statement over the rate type instead of the if chain, to simplify. Signed-off-by: Johannes Berg Signed-off-by: Gregory Greenman --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 5eb28f8ee87e..735d5ed412d1 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -4949,6 +4949,7 @@ static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, static void iwl_mvm_set_sta_rate(u32 rate_n_flags, struct rate_info *rinfo) { u32 format = rate_n_flags & RATE_MCS_MOD_TYPE_MSK; + u32 gi_ltf; switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) { case RATE_MCS_CHAN_WIDTH_20: @@ -5019,9 +5020,12 @@ static void iwl_mvm_set_sta_rate(u32 rate_n_flags, struct rate_info *rinfo) RATE_HT_MCS_INDEX(rate_n_flags) : u32_get_bits(rate_n_flags, RATE_MCS_CODE_MSK); - if (format == RATE_MCS_HE_MSK) { - u32 gi_ltf = u32_get_bits(rate_n_flags, - RATE_MCS_HE_GI_LTF_MSK); + if (rate_n_flags & RATE_MCS_SGI_MSK) + rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; + + switch (format) { + case RATE_MCS_HE_MSK: + gi_ltf = u32_get_bits(rate_n_flags, RATE_MCS_HE_GI_LTF_MSK); rinfo->flags |= RATE_INFO_FLAGS_HE_MCS; @@ -5060,19 +5064,14 @@ static void iwl_mvm_set_sta_rate(u32 rate_n_flags, struct rate_info *rinfo) if (rate_n_flags & RATE_HE_DUAL_CARRIER_MODE_MSK) rinfo->he_dcm = 1; - return; - } - - if (rate_n_flags & RATE_MCS_SGI_MSK) - rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; - - if (format == RATE_MCS_HT_MSK) { + break; + case RATE_MCS_HT_MSK: rinfo->flags |= RATE_INFO_FLAGS_MCS; - - } else if (format == RATE_MCS_VHT_MSK) { + break; + case RATE_MCS_VHT_MSK: rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; + break; } - } static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, -- 2.35.3