summaryrefslogtreecommitdiff
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorMukesh Sisodiya <mukesh.sisodiya@intel.com>2023-06-04 12:11:14 +0300
committerJohannes Berg <johannes.berg@intel.com>2023-06-06 14:15:04 +0200
commit1d10575bced5b65e138b029a35e6ef657f3b3273 (patch)
treea09478204741c6cc3aac4f9f24a22df27d847315 /net/mac80211/tx.c
parent2a5325f802863c399fe40de935ba01195d4c43c8 (diff)
wifi: mac80211: refactor ieee80211_select_link_key()
Simplify ieee80211_select_link_key(), no functional changes are made. Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230604120651.a4e332755bb0.Iff4a2b6ed767b2a329c51c29bb597ece9ebe2af8@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c28
1 files 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;
}