Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4306097rwd; Sun, 4 Jun 2023 02:18:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ76Y49LwhWk+NrmPm2uHEI0pSXuhvo6cJSPeduvsZeig8BaDfnpyL3S2mIsXhlr0u6myshs X-Received: by 2002:a05:6870:5aad:b0:19d:732:1c6e with SMTP id dt45-20020a0568705aad00b0019d07321c6emr6655047oab.1.1685870281596; Sun, 04 Jun 2023 02:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685870281; cv=none; d=google.com; s=arc-20160816; b=lqoSx/nwCzaOYcZuNizni23/0JaKp/bPoFAJbqd7PFpoASjwuKH3eCGYJI6+dmVS/n Yy3mDi7HAY+0jqyFd7j+TRozh1OJ9As96/nffadIbYldeAdMeRtP1LuyC4evYwHIWH8N gcbSSbrM+TZnkBJca2fs+coKpofpBYHh+Y2eqyLxZpVXTbJwEll4pR1KbYUCpNxUdOWD BLtsrGaE/rPemFU2oro+4VPGWQ4IeDoPaPhAmTMZ94k1q2NTOSpk6l0ce5ngdByf+OI0 jR8xVuZtyoXZwceKLgFHJrES3+ylI+rUjTkznS/2mslzodYz8znMMCcsF1bb8hwb2Ppf T4MQ== 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=OMJ/Ci29LeuBheWNavoDMpHyLtzMJ8KKN+kpj20p0vc=; b=bg6ld5fqfUOB/4QAIZvbTwX87H67RLCvbzbjRn+nzpwkX3dK+yuMEq9ZbruWaS6UdQ re9uHJXoJ4B1Kd/86qv9LqbmTYjmRykakW8BuMkv6sKSuQ3vSaSgmIOWopxwWJ19D/AZ kx7GHoSkIU5jr7U3kvT3Tnxom6ZCImwaU2/IOGu2i3xsc4W9Vw+KAsqbTj78wO6LxSeZ 3BAMf6VxIPOhXh1k2YjgoVGKXZTQJv4fOFFnFfesQ4959YCKBvWGtC0YIMMSfHgP6FPQ 9Ro/+mg7rC/3vgJqcV+T+910Av85WT6J25958utSI1am8gdEODOh9Mj33yR4S/PbFQEX muFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fOVfxIPp; 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 q8-20020a170902dac800b001a1ee8ceedcsi3950411plx.495.2023.06.04.02.17.54; Sun, 04 Jun 2023 02:18:01 -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=fOVfxIPp; 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 S231135AbjFDJLx (ORCPT + 63 others); Sun, 4 Jun 2023 05:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231157AbjFDJLw (ORCPT ); Sun, 4 Jun 2023 05:11:52 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEE2EE3 for ; Sun, 4 Jun 2023 02:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685869911; x=1717405911; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oinPS/59FhzKbL9jairtcH3HqPZOtOm8RGgvaCxtiz4=; b=fOVfxIPpy1m1846iGD4WylYlFxrAjgLQv5yVrzyGZ1EnW+/tP54YPcVV lgVbecTm/uKthEuX11LXRDxlYuMe9oCljqs9lHAndUPZabqJU8vM21YG0 awO7rWXuczRrSEw7+B+22usQW5xoCTy7E0YtRA6hVlQ8sET6DHAP5D3ki NFsFswFFAQHNipRuJ1UlAJR0MM2XGKW5KJveJWyQo0F/DJ+ymh/V1nCUT r0IXmKAx4pF2Nr6LOOlsflgZZ9EtVB43lnLprCdnw5xUfu5U38SksZdfh X7pIyB8Ejo6aIAPjn95prHIm86I9c0SBWqN0Ew90PN/cX7ZXftrE1pkE2 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10730"; a="336526481" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="336526481" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2023 02:11:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10730"; a="820804333" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="820804333" Received: from yfruchte-mobl3.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.214.219.60]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2023 02:11:48 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Mukesh Sisodiya , Gregory Greenman Subject: [PATCH 02/16] wifi: mac80211: refactor ieee80211_select_link_key() Date: Sun, 4 Jun 2023 12:11:14 +0300 Message-Id: <20230604120651.a4e332755bb0.Iff4a2b6ed767b2a329c51c29bb597ece9ebe2af8@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230604091128.609335-1-gregory.greenman@intel.com> References: <20230604091128.609335-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_NONE,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: Mukesh Sisodiya Simplify ieee80211_select_link_key(), no functional changes are made. Signed-off-by: Mukesh Sisodiya Signed-off-by: Gregory Greenman --- net/mac80211/tx.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 1a3327407552..e809c4236f78 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -581,25 +581,9 @@ ieee80211_select_link_key(struct ieee80211_tx_data *tx) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - enum { - USE_NONE, - USE_MGMT_KEY, - USE_MCAST_KEY, - } which_key = USE_NONE; struct ieee80211_link_data *link; unsigned int link_id; - if (ieee80211_is_group_privacy_action(tx->skb)) - which_key = USE_MCAST_KEY; - else if (ieee80211_is_mgmt(hdr->frame_control) && - is_multicast_ether_addr(hdr->addr1) && - ieee80211_is_robust_mgmt_frame(tx->skb)) - which_key = USE_MGMT_KEY; - else if (is_multicast_ether_addr(hdr->addr1)) - which_key = USE_MCAST_KEY; - else - return NULL; - link_id = u32_get_bits(info->control.flags, IEEE80211_TX_CTRL_MLO_LINK); if (link_id == IEEE80211_LINK_UNSPECIFIED) { link = &tx->sdata->deflink; @@ -609,14 +593,14 @@ ieee80211_select_link_key(struct ieee80211_tx_data *tx) return NULL; } - switch (which_key) { - case USE_NONE: - break; - case USE_MGMT_KEY: + if (ieee80211_is_group_privacy_action(tx->skb)) + return rcu_dereference(link->default_multicast_key); + else if (ieee80211_is_mgmt(hdr->frame_control) && + is_multicast_ether_addr(hdr->addr1) && + ieee80211_is_robust_mgmt_frame(tx->skb)) return rcu_dereference(link->default_mgmt_key); - case USE_MCAST_KEY: + else if (is_multicast_ether_addr(hdr->addr1)) return rcu_dereference(link->default_multicast_key); - } return NULL; } -- 2.38.1